MathsLinear Algebra

Matrix RREF
calculator.

Row reduce a matrix to its one reduced form, then read the rank and any solution.

How it's worked out

A matrix is in reduced row echelon form (RREF) when five rules hold. Rows of zeros sit at the bottom. The first nonzero entry of each row, called its pivot, sits to the right of the pivot above it. Every entry below a pivot is 0. Each pivot is 1. Each pivot is the only nonzero entry in its column.

Three row operations get you there, and none of them changes the solutions of the system the matrix stands for. You can swap two rows, multiply a row by a number that is not 0, or add a multiple of one row to another.

Ri→cRi,\displaystyle R_i \to c\,R_i,c\displaystyle c≠0\displaystyle {}\ne 0
Ri→Ri+kRjR_i \to R_i + k\,R_j

The tool works column by column from the left, which is Gauss-Jordan elimination. It finds the next column with a nonzero entry at or below the current row. It swaps a row up only when the natural pivot is 0, so the steps match hand working. Then it divides the pivot row so the pivot becomes 1, and clears every other entry in that column, above and below.

Any order of valid row operations ends at the same matrix, because every matrix has exactly one RREF. Your hand working can take a different route and still be right, as long as it ends at the same reduced matrix.

Worked examples

Priya checks a three-equation system from her homework

Priya has three equations in three unknowns. She writes the numbers as an augmented matrix, with the right sides in the last column.

[1−21002−8850−510]\begin{bmatrix} 1 & -2 & 1 & 0 \\ 0 & 2 & -8 & 8 \\ 5 & 0 & -5 & 10 \end{bmatrix}

The reduction takes 5 groups of row operations. The left block becomes the identity, so each row now says one variable equals one number.

[10010100001−1]\begin{bmatrix} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & -1 \end{bmatrix}

So x1=1x_1 = 1, x2=0x_2 = 0 and x3=−1x_3 = -1. Putting these back into the first equation gives 0, the second gives 8 and the third gives 10. Those match the right sides, so her answer holds.

Open this example in the tool

A system with two free variables

This system has five unknowns and three equations. Its top-left entry is 0, so the first step swaps rows 1 and 2 to get a nonzero pivot.

[10−230−2401−220−7000014]\begin{bmatrix} 1 & 0 & -2 & 3 & 0 & -24 \\ 0 & 1 & -2 & 2 & 0 & -7 \\ 0 & 0 & 0 & 0 & 1 & 4 \end{bmatrix}

Columns 3 and 4 have no pivot, so x₃ and x₄ are free: they can be any numbers. Each pivot row then gives one of the other unknowns in terms of them.

x1\displaystyle x_1=−24+2x3−3x4\displaystyle {}= -24 + 2x_3 - 3x_4
x2\displaystyle x_2=−7+2x3−2x4\displaystyle {}= -7 + 2x_3 - 2x_4
x5\displaystyle x_5=4\displaystyle {}= 4

Setting both free variables to 0 gives one particular solution, with x5=4x_5 = 4. Every other solution adds some amount of the two direction vectors the tool shows in vector form.

Open this example in the tool

Marco finds an inverse by reducing [A | I]

Marco needs the inverse of a 2 by 2 matrix. He writes the matrix with the identity beside it, so the grid is 2 by 4, and sets the last column as part of the matrix rather than a right side.

[34101201]\begin{bmatrix} 3 & 4 & 1 & 0 \\ 1 & 2 & 0 & 1 \end{bmatrix}

The inverse rule says that if the left block reduces to the identity, the right block is the inverse. Here the reduced matrix has rank 2 and its left block is the identity.

A−1\displaystyle A^{-1}=[1−2−1232]\displaystyle {}= \begin{bmatrix} 1 & -2 \\ -\frac{1}{2} & \frac{3}{2} \end{bmatrix}

The entry −12-\frac{1}{2} shows why the exact view matters: a decimal would hide that it is exactly a half. If the left block had kept a row of zeros, the matrix would have no inverse.

Open this example in the tool

Reading your result

For an augmented matrix [A | b], the pivots decide which of three cases you are in. The table uses this page's examples.

What the reduced matrix shows
CaseIn the RREFPivots
One solutionA pivot in every variable column3
Infinitely many2 variable columns with no pivot3
No solutionA pivot in the b column3

No solution. A pivot in the last column means a row reads 0 = 1. That can never be true, so the system is inconsistent. In the no-solution example it is row 3, after subtracting twice the first equation from the second leaves 0 = 1.

Free variables. A variable is free when its column has no pivot. If the system has a solution and at least one free variable, it has infinitely many.

Rank and nullspace. The rank is the number of pivots, and rank plus nullity equals the number of columns. The 2 by 3 matrix with rows (1, 2, 3) and (2, 4, 6) has rank 1, so its nullspace has 2 basis vectors, one for each free column.

The pivot columns of the original matrix, not of the reduced one, form a basis for its column space. Use the RREF to find which columns they are, then take those columns from A.

Common mistakes

  • Reading a row of zeros as infinitely many solutions. A zero row only means one equation repeated the others. What gives infinitely many is a variable column with no pivot, in a system that has a solution.
  • Leaving the last column set as part of the matrix. If the last column is really the right side b, a pivot there reads as one more unit of rank instead of a sign that there is no solution. Set the last column to b for a system of equations.
  • Typing a rounded decimal for a fraction. An entry of 0.333 is not 1/3, so the exact view cannot show clean fractions. Type 1/3 and the working stays exact.
  • Taking basis columns from the RREF. The reduced matrix tells you which columns are pivot columns. The basis for the column space is those columns of the original matrix.

Questions people ask

Yes. Every matrix is row equivalent to exactly one matrix in reduced row echelon form, whatever order of row operations you use. A plain row echelon form is not unique, because its pivots need not be 1 and the entries above them need not be 0.

Sources