An example of the Gauss-Jordan algorithm The problem. Use the Gauss-Jordan algorithm to solve the linear system: x2 − 2x3 − 5x4 = 0, 2x1 + 4x2 + 6x3 + 2x4 = 4, 6x1 + 10x2 + 20x3 + 12x4 = 10. Applying the Gauss-Jordan algorithm. Call the coefficient matrix A and the vector of right-hand sides ~b. Row reduce the augmented matrix [A | ~b]: 0 1 −2 −5 | 0 4 6 2 | 4 [A | ~b] = 2 (1) 6 10 20 12 | 10 2 4 6 2 | 4 1 −2 −5 | 0 ↔ 0 (2) 6 10 20 12 | 10 1 2 3 1 | 2 1 −2 −5 | 0 ↔ 0 (3) 6 10 20 12 | 10 1 2 3 1 | 2 1 −2 −5 | 0 (4) ↔ 0 0 −2 2 6 | −2 1 0 7 11 | 2 0 (5) ↔ 0 1 −2 −5 | 0 0 −2 −4 | −2 1 0 7 11 | 2 (6) ↔ 0 1 −2 −5 | 0 0 0 1 2 | 1 1 0 0 −3 | −5 2 = rref([A | ~b]) (7) ↔ 0 1 0 −1 | 0 0 1 2 | 1 What happened above. Here are the elementary row operations used in the indicated steps: (1) The initial pivot column is column 1. (2) Swap rows 1 and 2 in order to bring a nonzero entry to the pivot position. (If the entry M2,1 had been 0, then you would have swapped rows 1 and 3 instead.) (3) Scale row 1 to make the pivot entry 1 instead of 2. Specifically, multiply row 1 by 1/2. 1 (4) Use a “rowadd” operation to “zero out” the remaining nonzero entry in column 1, namely, the first entry in row 3. Specifically, replace row 3 by row 3 minus 6 times row 1. You are done with column 1. Move over to column 2. The pivot position there is row 2, column 2. (5) The current pivot entry is already 1, so no scaling is required. Use two rowadd operations to “zero out” the rest of column 2. Specifically, replace row 1 by row 1 minus 2 times row 2; and replace row 3 by row 3 plus 2 times row 2. You are done with column 2. Move over to column 3. The pivot position there is row 3, column 3. (6) Scale row 3 to make the pivot entry 1 instead of −2. Specifically, multiply row 3 by 1/(−2). (7) Use two rowadd operations to “zero out” the rest of column 3. Specifically, replace row 1 by row 1 minus 7 times row 3; and replace row 2 by row 2 plus 2 times row 3. The matrix is now in reduced row-echelon form. How many solutions are there? The original problem did not explicitly ask that. But it’s a good idea to answer that question before actually writing the solutions. In rref([A | ~b]) there are only three leading 1’s, in columns 1, 2, 3 (corresponding to variables, x1 , x2 , x3 ). Since column 4 of rref([A | ~b]) does not contain a leading 1, the original system will have infinitely many solutions. Write the solutions. The matrix rref([A | ~b]) is the augmented matrix of the linear system x1 − 3x4 = −5, x2 − x4 = 2, x3 + 2x4 = 1. whose solutions are the same as those of the original linear system. Solve for the leading variables: x1 = 3x4 − 5, x2 = x4 + 2, x3 = −2x4 + 1 Write the solution “in vector form”. Indicate that x4 is “free”—the solutions are given by: x1 = 3x4 − 5, x = x4 + 2, 2 x3 = −2x4 + 1, x4 = x4 2 x1 x2 The solutions ~x = x3 in vector form are therefore: x4 3 −5 1 2 ~x = x4 −2 + 1 . 1 0 Rank of coefficient and augmented matrices. The problem did not ask about that, but the ranks can be found from the row reduction. Since rref([A | ~b]) has three leading 1’s, then by definition of “rank”, rank rref([A | ~b]) = 3. The very same elementary row operations that obtained rref([A | ~b]) from [A | ~b] serve to obtain rref(A) from the coefficient matrixA. Then 1 0 0 −3 rref(A) = 0 1 0 −1 , 0 0 1 2 and thus A, like [A | ~b] has 3 leading 1’s. Hence rank A = 3. Checking work with Mathematica. See notebook Leontieff.nb for how directly to solve a linear system and how to find the rref of a matrix. 3