Understanding the RREF and rank calculator — concept and principle
This calculator reduces a matrix to reduced row echelon form (RREF) and reads off its rank and nullity. RREF is the cleanest way to see the structure of a linear system: which variables are determined, which are free, whether the equations are consistent, and whether a set of vectors is linearly independent. Rank also reveals redundant variables in data.
How it is calculated
The calculator applies Gauss-Jordan elimination with three row operations: swap two rows, multiply a row by a non-zero number, and add a multiple of one row to another. It works column by column, choosing a non-zero pivot, scaling it to 1 and clearing every other entry in that column. The result is RREF, in which:
- every non-zero row starts with a leading 1 (a pivot),
- each pivot is to the right of the pivot above it,
- every other entry in a pivot column is 0, and zero rows sit at the bottom.
Rank = number of pivots. Nullity = number of columns − rank (the rank-nullity theorem).
The principle
Row operations never change the set of solutions of Ax = 0, nor the row space, so the RREF keeps all the information you need while making it easy to read. Each pivot marks one genuinely independent equation; a zero row reveals an equation that was a combination of the others. Columns without pivots correspond to free variables, and each free variable adds one dimension to the null space. The RREF of a matrix is unique, so any correct method gives the same answer.
Worked example
- Default: A = [1 2 3; 4 5 6; 7 8 9].
- R2 − 4·R1 gives [0 −3 −6]; R3 − 7·R1 gives [0 −6 −12].
- Divide R2 by −3: [0 1 2]. Then R3 + 6·R2 = [0 0 0].
- Clear above the second pivot: R1 − 2·R2 = [1 0 −1].
- RREF = [1 0 −1; 0 1 2; 0 0 0], with two pivots, so rank = 2 and nullity = 3 − 2 = 1.
The free variable x₃ = t gives x₁ = t and x₂ = −2t, so (1, −2, 1) spans the null space: indeed row 1 − 2·row 2 + row 3 = 0.
How to read the result
For an n×n matrix, rank n means it is invertible; anything less means det = 0. For a system [A | b], it is consistent exactly when adding b does not raise the rank; if rank equals the number of unknowns, the solution is unique, otherwise there are infinitely many solutions with "nullity" free parameters.
Common mistakes
- Stopping at row echelon form (REF) and reading pivots that are not yet 1 or entries above pivots that are not yet cleared.
- Counting non-zero entries instead of non-zero rows.
- Treating tiny values like 1e-16 as non-zero; they are rounding errors.
Frequently asked questions
Is the rank of A the same as the rank of Aᵀ?
Yes. Row rank always equals column rank.
Does the RREF depend on the order of operations?
No. Every matrix has exactly one RREF.
What does nullity 0 mean?
Ax = 0 has only the trivial solution x = 0, so the columns are linearly independent.
Sources: Gilbert Strang, Introduction to Linear Algebra, Wellesley-Cambridge Press — elimination and the four subspaces · David C. Lay, Linear Algebra and Its Applications, Pearson