Matrix Rank Calculator – Find Rank, REF, and RREF Instantly
The rank of a matrix is the number of linearly independent rows (or, equivalently, columns) it contains. It is one of the most useful single numbers you can extract from a matrix: it tells you whether a system of linear equations has a unique solution, no solution, or infinitely many; whether a square matrix is invertible; and how many dimensions the matrix's row space actually spans. This calculator computes the rank of any m×n matrix using Gaussian elimination with partial pivoting, showing every row operation along the way so you can follow — or check — the working.
How Rank Is Computed
The algorithm reduces the matrix to row echelon form (REF): working column by column, it selects the largest available pivot (partial pivoting, for numerical stability), swaps it into place if needed, and eliminates every entry below it using elementary row operations. Once elimination finishes, the rank equals the number of non-zero rows — the rows that still contain a pivot. The calculator then continues to reduced row echelon form (RREF) by normalizing each pivot to 1 and clearing every entry above it as well, giving the cleanest possible representation of the same row space.
Row Swap
R₂ ↔ R₃Brings the largest available entry into the pivot position for numerical stability.
Row Elimination
R₂ → R₂ − k·R₁Zeroes out the entries below (and, for RREF, above) each pivot column.
Pivot Count
rank = pivotsThe number of pivot positions found is, by definition, the matrix's rank.
Full Rank vs. Rank-Deficient
For an m×n matrix, the maximum possible rank is min(m, n). When the computed rank reaches that maximum, the matrix is full rank — a square full-rank matrix is invertible, a tall (more rows than columns) full-rank matrix has full column rank, and a wide (more columns than rows) full-rank matrix has full row rank. When the rank falls short of that maximum, the matrix is rank-deficient: at least one row is a linear combination of the others, which for a square matrix means the determinant is zero and no inverse exists.
[[1, 2, 3], [2, 4, 6], [3, 6, 9]] has every row as a multiple of the first, so row reduction collapses it to a single non-zero row — its rank is 1, not 3.Nullity and the Rank-Nullity Theorem
The nullity of a matrix is the dimension of its null space — the set of vectors that the matrix sends to zero. The rank-nullity theorem states that rank + nullity = n, where n is the number of columns. A full column-rank matrix therefore has nullity 0 (only the zero vector maps to zero), while a rank-deficient matrix has a nullity greater than zero, indicating a non-trivial null space.
Why Numerical Tolerance Matters
Computer arithmetic uses finite-precision floating-point numbers, so a value that should be mathematically exact zero can end up as something like 1e-14 after a series of subtractions. Without care, this rounding noise could be mistaken for a valid pivot and inflate the reported rank. The calculator's tolerance (epsilon) setting treats any pivot candidate smaller than the chosen threshold as zero, keeping the rank calculation reliable even for matrices with awkward numerical structure.
Practical Uses of Matrix Rank
Solving linear systems: Comparing the rank of the coefficient matrix to the rank of the augmented matrix tells you whether a system has no solution, one solution, or infinitely many.
Invertibility checks: A square matrix is invertible exactly when its rank equals its size — a faster sanity check than computing the full inverse.
Dimensionality reduction: In data science, the rank of a data matrix bounds how many independent components techniques like PCA can extract.
Control theory: Controllability and observability of a linear system are determined by the rank of specific matrices built from the system's state matrices.
Tips for Best Results
- Use the sample presets to quickly see how identity, singular, tall, and wide matrices behave before entering your own data.
- Fractions work as input — enter
1/3or-5/8directly and the parser evaluates them automatically. - Increase decimal precision for matrices whose entries carry many significant digits, to avoid misleading rounding in the displayed REF/RREF.
- Adjust the tolerance if you suspect floating-point noise is affecting the pivot count on an ill-conditioned matrix.