RREF Calculator

Enter a matrix up to 4 rows by 5 columns and watch it reduce to RREF one named row operation at a time, in exact fractions rather than rounded decimals, with the rank, pivot columns, and linear independence read out in plain words. Flip the augmented switch and the same reduction solves your linear system, or shows you the exact row that proves no solution exists.

Put this calculator on your website for free

Copy one snippet and give your visitors a working RREF Calculator.

How this RREF calculator works

You give it a matrix, up to 4 rows by 5 columns, and it runs Gauss-Jordan elimination in front of you: one row operation at a time, each one named the way your textbook names it and explained in plain words, with the whole matrix reprinted after every move. Nothing is skipped and nothing is batched, because the steps are the point. The answer at the end is the reduced row echelon form, along with the rank, the pivot and free columns, a linear independence verdict on the columns, and the dimension of the null space.

Every calculation runs in exact fractions. When a row operation produces one third, you see 1/3, not 0.3333333333. That is not a display preference; it is the whole design, and the last section explains why it matters. One pleasant side effect: numerical software swaps rows to put the largest entry in the pivot spot, purely to fight rounding error. Exact arithmetic has no rounding error to fight, so this page can use the first nonzero entry as the pivot, exactly the way the textbook procedure does, and the narration stays recognizable.

The three rules of reduced row echelon form

A matrix is in reduced row echelon form when it obeys three rules. First, the leading entry of every nonzero row is a 1, called a pivot. Second, each pivot is the only nonzero entry in its entire column: zeros above it as well as below. Third, the pivots march down and to the right in a staircase, with any all-zero rows collected at the bottom. The first two rules make the matrix as simple as row operations can make it; the third makes it readable at a glance. Row echelon form (REF, without the "reduced") relaxes the second rule and only clears below each pivot, which is why two people can get different REFs from the same matrix but everyone gets the same RREF.

The formula

Swap Ri ↔ Rj    Ri → c · Ri (c ≠ 0)    Ri → Ri - c · Rj

Those are the three legal row operations: swap two rows, scale a row by a nonzero constant, and subtract a multiple of one row from another. Each one is reversible, which is the quiet reason the whole method is trustworthy: none of them can create or destroy information about the solutions, only rearrange it into a readable shape. Gauss-Jordan applies them in a fixed routine: find the first column with a nonzero entry, swap it into position if needed, scale it to make the pivot 1, clear everything above and below, then move one column to the right and repeat.

Worked example

Reduce the augmented matrix [[1, 2, 1, 3], [2, 4, 0, 2], [3, 6, 2, 7]], a system of three equations in x1, x2, x3. Five row operations do it. First clear column 1: R2 → R2 - (2) R1 gives [0, 0, -2, -4], and R3 → R3 - (3) R1 gives [0, 0, -1, -2]. Column 2 has nothing left below the first row, so the next pivot lives in column 3: R2 → (-1/2) R2 turns row 2 into [0, 0, 1, 2]. Clear that column: R1 → R1 - (1) R2, and then R3 → R3 - (-1) R2, which is the machine's uniform way of saying "add row 2 once," and row 3 becomes all zeros.

The result is [[1, 2, 0, 1], [0, 0, 1, 2], [0, 0, 0, 0]]: rank 2, pivots in columns 1 and 3, and column 2 free. Read the system's fate straight off it: x2 is free, so set x2 = t and the pivot rows say x1 = 1 - 2t and x3 = 2. Infinitely many solutions, one for every choice of t, and the all-zero row is the honest record that one of the three original equations carried no new information.

Rank is a measure of information

Rank sounds abstract until you see what it counts. Take the matrix [[1, 2], [2, 4]]. It has two rows, but look closely: the second row is exactly twice the first. Anyone who knows row 1 can reconstruct row 2, so the matrix carries two rows of numbers but only one row's worth of information. Its RREF is [[1, 2], [0, 0]] and its rank is 1. That is all rank is: the number of genuinely independent directions in the matrix, the row count after redundancy has been squeezed out. This page reports it for the columns too, in the same spirit: five columns with rank 2 means those five columns carry only two independent directions, and the other three are combinations of them.

A modern reason to care: the giant weight matrices inside AI language models turn out to need surprisingly few independent directions to describe how they change during fine-tuning. The technique called LoRA leans on exactly that: instead of retraining a huge matrix entry by entry, it writes the adjustment as the product of two thin matrices, a low-rank update, and trains only those. A matrix with millions of entries gets steered by a sliver of that many numbers. The idea only works because rank measures information, and the information in the change is small even when the matrix is enormous.

Rank-nullity, honestly

The rank-nullity theorem says that for a matrix with n columns, rank + nullity = n, where the nullity is the dimension of the null space: the set of every vector the matrix sends to zero, or equivalently every recipe for combining the columns so they cancel completely. The bookkeeping reads almost too simple, and that is the honest content of the theorem: every column either contributes a new direction (a pivot column, counted by rank) or it is a combination of earlier ones (a free column), and each free column contributes exactly one independent way to make zero. Columns minus rank is the nullity. This page computes it that way, from the free columns the reduction actually found, so the count is read off the work rather than asserted.

Reading a system's fate from its RREF

Flip the augmented switch and the last column becomes the constants of a linear system, and the RREF becomes a verdict with three possible readings. If some row reduces to all zeros except a 1 in the constants column, that row says 0 = 1, and no choice of variables can rescue it: the system has no solution, and the calculator points at the exact row. If every variable column has a pivot and no such row appears, each variable is pinned to a single value: one solution, read directly off the reduced matrix. And if the system is consistent but some variable column has no pivot, that variable is free: pick any value for it and the pivot variables follow, which is infinitely many solutions, written out here in parametric form with the free variables named. Three outcomes, and the staircase tells you which one you have every time.

Why exact fractions instead of decimals

Row reduction is a long chain of small divisions, and in floating point every one of them can shed a hair of accuracy. Most of the time that costs nothing. But rank is a knife-edge quantity: it depends on whether entries are exactly zero, and a pipeline that carries 0.9999999998 where the true value is 1 can leave a not-quite-zero residue where a zero row belongs, or wipe out a pivot that should have survived. At the margin, that flips a rank verdict, and everything downstream of rank, independence, nullity, the very existence of solutions, flips with it. Working in integer fractions removes the question: 1/3 is 1/3, a zero is a zero, and the RREF you get is the RREF, checkable by hand at every step. We hold ourselves to a ceiling for that promise, too: if a numerator or denominator ever grows past 245, where exactness could quietly erode, the page stops and tells you rather than rounding behind your back. Ordinary classroom matrices never come near that line.

When you want the determinant or the inverse rather than the reduction itself, the matrix calculator handles those, the matrix multiplication calculator does full row-times-column products, and the eigenvalue calculator picks up where rank leaves off. For a single equation rather than a system, there is the solve for x calculator.

Frequently asked questions

What does RREF stand for?

Reduced row echelon form. It is the tidiest shape row operations can put a matrix into: every nonzero row leads with a 1 (a pivot), every pivot stands alone in its column with zeros above and below, and the pivots descend in a staircase with any all-zero rows at the bottom. Once a matrix is in this form, its rank, its free columns, and the solutions of any system it represents can all be read off by eye.

What is the difference between REF and RREF?

Row echelon form (REF) only requires zeros below each pivot, so the numbers above a pivot can be anything and different sequences of row operations give different REFs. Reduced row echelon form clears above the pivots too and scales each pivot to 1. REF is enough for back-substitution; RREF finishes the job so the answer sits on the surface with no substitution needed.

Is the RREF of a matrix unique?

Yes. Whatever order of legal row operations you use, every matrix has exactly one reduced row echelon form. That is what makes the answer checkable: if your hand computation and this page disagree, one of you made an arithmetic slip, and the step-by-step narration lets you find exactly where the two paths part ways.

What does the rank of a matrix tell you?

Rank counts the independent directions in the matrix, which is the amount of genuine information it carries. A matrix like [[1,2],[2,4]] has two rows, but the second is exactly twice the first, so it holds only one row's worth of information: rank 1. Rank equals the number of pivots in the RREF, and it decides invertibility, the dimension of the null space, and whether a system of equations can pin down its unknowns.

How do you see that a system has no solution from the RREF?

Look for a row that is all zeros in the coefficient columns but has a nonzero constant at the end. After full reduction it reads 0 = 1, and no values of the variables can make zero equal one. Equivalently, the rank of the augmented matrix is bigger than the rank of the coefficient matrix, and that gap is exactly the contradictory row. This calculator points at the row for you.

What is a free variable?

A variable whose column ends up with no pivot in the RREF. The equations place no independent constraint on it, so you can set it to anything, and the pivot variables adjust to match. Each free variable becomes a parameter (t, s, and so on) in the solution, and the number of free variables is the dimension of the solution set: one free variable traces out a line of solutions, two a plane.

Why does this calculator show fractions instead of decimals?

Because rank verdicts live and die on exact zeros. Every entry here is kept as an integer fraction through every row operation, so a third is 1/3 forever and a canceled entry is exactly 0, never 0.0000000002 left over from rounding. The result is an RREF you can check by hand digit for digit, and rank, independence, and solution readouts that cannot be flipped by float error at the margin.

Related calculators