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.
Solve the system:
⎧ ⎨ ⎩ |
|
ref([[3,1,-2],[3,2,2]]) |
|
Hence the solution is y=4 (from the last row) and x=−2 (substitute y in the first row).