Using Matrices to Solve Systems of Equations
This tutorial: Part B: Solving a System by GaussJordan
 Online Pivot & GaussJordan Utility
 Excel OnLine Pivot & GaussJordan Utility (downloadable Excel workbook)
 Online Matrix Algebra Tool
 Pivot Program for the TI82 and TI83
In this tutorial, we put row operations to work for us in solving systems of equations. (If you are not familiar with row operations, go to Part A of this tutorial by pressing "Previous Topic" on the sidebar.) First of all, let's start with a complicated looking system of equations, such as

Augmented matrix:  \mat{\[ \frac{1}{2} , \frac{2}{3}, \frac{1}{6} \]!2,\frac{1}{4} , \frac{1}{2} } 
\mat{\[ \frac{1}{2} , \frac{2}{3}, \frac{1}{6} \],! 2,\frac{1}{4} , \frac{1}{2}} 

\mat4{\[1, 0 , 0.2 \]! , , ! 0 , 1 , 0.4}  
Original matrix  Reduced matrix 
A Look at the matrix on the right. If we translate its rows back into equations (see the preceding tutorial for help on this), we get:
 Row 1: 1x + 0y = 0.2, that is, x = 0.2
Row 2: 0x + 1y = 0.4, that is, y = 0.4
Q OK I'm impressed. So, how do you come up with the row operations to accomplish this magical transformation?
A We will be doing the row reduction in several steps. One of the key steps is called clearing a column, and we are going to discuss that first before revealing the entire process to you. To clear a column, we first need to designate one of the nonzero entries of the matrix as a pivot.
By clearing the pivot column, or pivoting, we mean using row operations of type aR_{i} ± bR_{j} to wind up with a matrix in which the pivot is the only nonzero number in its column. In other words, everything else in that column is "cleared away" (equal to zero).
Here are some matrices with the pivot column cleared:
A Before we reveal the secret, let's take a look at how its done in a simple case:
Rule: The coefficients a and b must be whole numbers, and a negative sign is not permitted at the beginning of the row operation.
 Examples of permitted row operations: 3R1+4R2, 5R16R2, R1+R2, R13R2
Examples of disallowed row operations: 3R1+4R2, 5R16R2, (1/2)R1+3R2
Q HELP!!! I'm still stumped. How do I come up with the row operations necessary to clear the pivot column?
A Here is a mechanical way to set up the row operations, illustrated with three examples.
How to Clear a Column
1. Once the pivot is selected, focus on the "pivot column". This is the column that contains the pivot you have already designated:
2. To clear the pivot column, you will need to get zeros in place of all the bluecolored entries by changing their rows. Next to each row you want to change  that is, next to each row with a blue entry that is not already zero  write the name of that row on the left, and the pivot row (the row that contains the pivot) on the right:
3. Next to the blue row label, write the absolute value of the red number, and next to the red row label, write the absolute value of the blue number:
4. If the blue and red entries have the same sign, insert a minus (), but if they have different signs, insert a plus (+):
The result of doing these operations will be to clear the pivot column. (Try them!) ^{*}NOTE We can (and should!) use smaller numbers when the coefficients have a common factor. For instance, instead of using 2R_3 + 6R_2 as we did in the center matrix, it is better to use R_3 + 3R_2 (divide the original coefficients 2 and 6 by the common factor 2). Similarly, 8R_3  12R_2 could be replaced by 2R_3  3R_2 (divide by the common factor 4). The result of using the smaller coefficients will be a matrix with smaller entries. 

Example for you Write down the row operations aR_i ± bR_2 needed to clear the pivot column. 
How to Reduce a Matrix
We are now ready to write down the steps needed to completely reduce a matrix (and hence write down the solution of the system of equations it may represent).
Step 1: Clear all fractions and/or Decimals (if any).
We clear fractions and decimals by multiplying the rows that contain them by suitable integers. In the example we are considering, we can do this by multiplying the first row by 6 and the second row by 4 as follows:


Example of Step 1 for you:  
Step 2: Designate the first nonzero entry in the first row as the pivot and clear its column.
Terminology: The first nonzero entry in a row is called the leading entry of that row. Thus, the pivot will be the first element in the first row, unless it is zero, in which case we would use the first one that is nonzero in that row. (If the whole row is zero, then we skip this step.) In the example we are considering, the pivot is therefore the (1, 1)entry:


Examples of Step 2 for you:
Clear the column of the indicated pivot. If a row does not need a row operation, leave its instruction blank. Hint Consider using the Online Pivot & GaussJordan Utility to assist you. Repeat for the following matrix. If a row does not need a row operation, leave its instruction blank. 

Simplification Step: If at any stage of the process, all the entries in a row are divisible of an integer, divide by that integer  a Type 2 operation.
In the example we are considering, we notice that the entries in Row 2 are divisible by 7, so we divide that row by 7; that is, we multiply by 1/7: Although simplification steps are optional, they are enormously helpful as they help keep the entries small. For instance, in the above example on the left, if we skipped the simplification step we would have to deal with entries like 35 and 14 from here on. In this page, and also in the Online Pivot & GaussJordan Utility, you can enter this row operation as (1/7)R2 (and not R2/7). Caution Do not divide by a number if it results in fractions. After Step 1, we deal only with integer matrices until the very last step. 

Step 3: Designate the leading entry in the next row as the pivot and clear its column. Repeat this step until the last row.
Thus, the pivot will be the first nonzero entry in that row. If the whole row is zero, then we go to the next row. In the example we are considering, the leading entry in Row 2 is the 5, so we pivot on it:
Since there are no more rows, we are finished with Step 3. 

Example of all the steps so far for you:
Follow the instructions given to do all the steps so far:


Final Step: Turn all the leading entries into 1s by dividing each row by the value of its leading entry.
In the example we were considering earlier (see Step 3 above) we wound up with the following matrix after Step 3 (the leading entries are boxed):
y = \frac{2}{5} or 0.4  
Example of Final Step for you: Below is a matrix in which the columns of all the leading entries have been cleared. Enter the row operations for the last step and the resulting matrix. 
Q Do we always get the leading entries going down diagonally like we have been seeing in the above examples?
A Not always; we might, for instance, get a zero where we expect to see the next leading entry, or a whole row of zeros. In the next tutorial we consider such things.
You are now ready to go on to
Copyright © 2009 Stefan Waner