Logo

MonoCalc

/

Matrix Rank Calculator

Math

Sample matrices

Enter matrix values (3×3) — integers, decimals, or fractions like 1/2

About This Tool

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 = pivots

The 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.

Example: a rank-deficient matrix
The matrix [[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/3 or -5/8 directly 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.

Frequently Asked Questions

Is the Matrix Rank Calculator free?

Yes, Matrix Rank Calculator is totally free :)

Can I use the Matrix Rank Calculator offline?

Yes, you can install the webapp as PWA.

Is it safe to use Matrix Rank Calculator?

Yes, any data related to Matrix Rank Calculator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does the Matrix Rank Calculator work?

Enter your matrix values in the interactive grid (any size up to 10×10), then click Calculate. The tool reduces the matrix to row echelon form using Gaussian elimination with partial pivoting, then counts the non-zero pivot rows — that count is the rank. It also continues to reduced row echelon form (RREF) and shows every row operation along the way.

What is the rank of a matrix?

The rank is the number of linearly independent rows (equivalently, columns) in a matrix. It tells you the dimension of the space spanned by the rows, whether a system of linear equations has a unique solution, and whether a square matrix is invertible. A matrix with rank equal to its smaller dimension (min of rows and columns) is called full rank.

What does 'rank-deficient' mean?

A matrix is rank-deficient when its rank is less than the smaller of its row and column counts, meaning some rows (or columns) are linear combinations of others. For a square matrix, this is equivalent to being singular — its determinant is zero and it has no inverse.

What is nullity and how is it related to rank?

Nullity is the dimension of a matrix's null space — the set of vectors that the matrix maps to zero. By the rank-nullity theorem, nullity equals the number of columns minus the rank (n − rank). A full column-rank matrix has nullity 0, meaning only the zero vector maps to zero.

Why does the calculator use a numerical tolerance (epsilon)?

Floating-point arithmetic can leave tiny non-zero residues (like 1e-14) where a value should mathematically be exactly zero. The tolerance/epsilon setting treats any pivot smaller than that threshold as zero, preventing the calculator from reporting an incorrectly inflated rank due to rounding noise.

Can I compute the rank of a non-square matrix?

Yes. The calculator works for any m×n matrix, not just square ones. For a tall matrix (more rows than columns) the maximum possible rank equals the number of columns; for a wide matrix (more columns than rows) the maximum possible rank equals the number of rows.