Previous Up Next

15.7.2  Gauss reduction of a matrix

A matrix A is in row-echelon form if the first non-zero element of each row is 1 and each of these leading 1s is further right than the leading 1s of the preceding rows. Gaussian elimination will transform a matrix into row echelon form, and the row echelon form of the augmented matrix of a system of linear equations has the same set of solutions as the original, but in a form that is simple to solve.

The ref command transforms a matrix into a row echelon form of the matrix.

ref is typically used to solve a linear system of equations written in matrix form.

Example

Solve the system:

  

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





    1
1
3
2
3
014





          

Hence the solution is y=4 (from the last row) and x=−2 (substitute y in the first row).


Previous Up Next