Previous Up Next

15.7.3  Gauss-Jordan reduction

The reduced row echelon form of a matrix is the row echelon form (see previous section) with zeros above the leading 1s in each row. Gauss-Jordan reduction will turn any matrix into reduced row echelon form, and the reduced row echelon form of a matrix is unique. If the matrix is the augmented matrix of a system, then the reduced row echelon form of the matrix is the simplest form to solve the system. The rref command finds the reduced row echelon form of a matrix (see also Section 11.8.17).

Examples

Solve the system:

  

      3x+y=−2,
      3x +2y=2.
rref([[3,1,-2],[3,2,2]])
     


10−2
014


          

Hence x=−2 and y=4 is the solution of this system.

rref can also solve several linear systems of equations having the same matrix of coefficients by augmenting the matrix of coefficients by vectors representing the right hand side of the equations for each equation. For example, solve the systems:

  

      3x+y=−2,
      3x +2y=2

and

  

      3x+y=1,
      3x +2y=2.
rref([[3,1,-2,1],[3,2,2,2]])
     


10−20
0141


          

Which means that x=−2 and y=4 is the solution of the first system and x=0 and y=1 is the solution of the second system.

To perform Gauss-Jordan reduction only on the first column, input:

rref([[3,1,-2,1],[3,2,2,2]],1)
     





1
1
3
2
3
1
3
03123





          

Previous Up Next