MatrixStep

Matrix Rank Calculator

Finds the pivots by row reduction to get the rank, and reports the nullity and pivot columns.

INPUT

Integers, fractions (1/3) and decimals (0.25) are accepted. Empty cells count as 0. Paste a block of numbers from a spreadsheet or textbook into the first cell to fill the whole matrix.

RESULT

LaTeX is the math code you can paste into Overleaf, Notion equation blocks or Word's equation editor.

What is the rank?

The rank is the number of linearly independent rows (or columns) of a matrix. It equals the number of pivots in the reduced row echelon form.

Rank-nullity theorem: rank(A) + nullity(A) = number of columns, where the nullity is the dimension of the solution space of Ax = 0.

Full explanation with examples: Rank and Reduced Row Echelon Form (RREF) Explained

Exam tipAn n×n matrix with rank n is invertible and has a nonzero determinant.

How to do it by hand

  1. Row-reduce only as far as row echelon form (REF); you do not need the reduced form.
  2. Count the nonzero rows. That is the rank, and it equals the number of pivots.
  3. Columns minus rank is the dimension of the null space (nullity). rank + nullity = number of columns always holds.
  4. A square matrix is invertible exactly when its rank is n, which is the same as det ≠ 0.
Worked example

Find the rank of A = [1 2; 2 4; 3 6].

R₂ − 2R₁ → [0 0], R₃ − 3R₁ → [0 0]. What remains is [1 2; 0 0; 0 0].

One nonzero row, so the rank is 1. All three rows are multiples of (1, 2).

Columns 2 − rank 1 = 1 is the nullity, and the null space is spanned by (−2, 1).

Where is it used?

  • Deciding how many solutions a system has: rank(A) = rank([A | b]) means a solution exists, and if that equals the number of unknowns it is unique.
  • Counting independent information in data. A matrix with 1000 columns and rank 3 really carries 3 dimensions of information, which is the idea behind PCA and low-rank approximation.
  • Image compression: approximating a picture by a low-rank matrix shrinks it dramatically.

Common mistakes

  • Counting nonzero entries. Rank is the number of independent rows (or columns).
  • Thinking row rank and column rank can differ. They are always equal, which is why we just say 'rank'.
  • Assuming rank can reach the larger of the two dimensions. It is at most the smaller one: a 3×5 matrix has rank at most 3.

How to use

  1. Set the matrix size with the row and column buttons. Up to 6×6 is supported.
  2. Type numbers into the cells and the result updates instantly. Enter fractions as 1/3 and negatives as -2.
  3. Enter moves to the next cell; the ← → ↑ ↓ arrow keys move between cells.
  4. Open ‘Steps’ to see the full working. ‘Copy LaTeX’ copies the result as math code you can paste into Overleaf, a Notion equation block or Word's equation editor.

FAQ

How are rank and determinant related?
For a square matrix, a nonzero determinant means full rank n. A zero determinant means the rank is less than n.
How do I find a basis of the column space?
Take the pivot column numbers from the RREF and use those columns of the original matrix A, not the columns of the RREF.
Can row rank and column rank differ?
No. They are always equal, so rank(A) = rank(Aᵀ).

Related guides