Skip to content
MoneyDeck

Matrix Rank Calculator

Find the rank and nullity of any matrix with exact row-reduction steps

Updated · Free, no signup

Separate entries with spaces or commas. Fractions (1/3) and decimals are fine. Up to 8 rows × 8 columns.

Rank

2

Nullity (columns − rank)

2

Matrix size

3 × 4

Full rank?

No — rank 2 < min(3, 4) = 3

Pivot columns

C1, C2

Reduced row echelon form

[ 1  0  1  0 ]
[ 0  1  1  2 ]
[ 0  0  0  0 ]
  • Rank–nullity check: rank 2 + nullity 2 = 4 columns.
  • 1 row(s) and 2 column(s) are linear combinations of the others.

Row operations (Gauss–Jordan elimination)

StepRow operation
1R2 → R2 − 2·R1
2R3 → R3 − R1
3Swap R2 and R3
4R2 → R2 ÷ -2
5R1 → R1 − 2·R2

About the Matrix Rank Calculator

This matrix rank calculator finds the rank of a matrix — the number of linearly independent rows (equivalently, columns) — together with its nullity, the pivot columns and the reduced row echelon form (RREF). Type or paste the matrix one row per line, with entries separated by spaces or commas; fractions such as 1/2 and decimals such as 0.25 are accepted, and any shape from 1×1 up to 8×8 works, square or not.

Row reduction is done with exact fraction arithmetic rather than floating-point numbers, so the rank is never thrown off by rounding error — a common problem when nearly dependent rows are reduced numerically. Every row operation (swap, scale, add a multiple of another row) is listed in order so you can follow or check a hand calculation.

Linear algebra students use it to check homework on rank, linear independence and the rank–nullity theorem; engineers and data analysts use it to test whether a system of equations has a unique solution, or whether a set of vectors spans a space. If the rank equals the number of columns, the columns are independent; if it equals the number of rows, the rows are.

With the default inputs, the rank is 2. Change any value above to recalculate instantly.

How to use the matrix rank calculator

  1. 1Type the matrix with one row per line and entries separated by spaces or commas.
  2. 2Use fractions like 3/4 or decimals if needed — they are handled exactly.
  3. 3Read the rank, the nullity and whether the matrix is full rank.
  4. 4Check which columns hold pivots: those columns of A form a basis for its column space.
  5. 5Follow the row-operation table to verify each step of a hand calculation.

Formula and method

rank(A) = number of pivots in RREF(A); nullity(A) = n − rank(A)

The rank is found by Gauss–Jordan elimination: swap rows to bring a non-zero entry into the pivot position, divide the row by that pivot, and subtract multiples of it from every other row until each pivot column has a single 1. The number of pivots (leading 1s) in the reduced row echelon form is the rank. Row operations never change the row space, so they never change the rank.

All arithmetic uses exact fractions, so a row that should become all zeros really does, instead of leaving a tiny 1e-16 residue. The nullity follows from the rank–nullity theorem: for an m × n matrix, rank + nullity = n, the number of columns. Rank can never exceed min(m, n); a matrix that reaches that bound is called full rank.

A
The m × n matrix you enter
m, n
Number of rows and columns
rank(A)
Number of linearly independent rows = linearly independent columns
nullity(A)
Dimension of the null space (solutions of Ax = 0)

Worked examples

3×4 matrix with a repeated row

Row 2 is exactly twice row 1, so it adds nothing new and reduces to zeros. Rows 1 and 3 are independent, giving pivots in columns 1 and 2: rank 2. With 4 columns, the nullity is 4 − 2 = 2.

The classic singular 3×3 matrix

Row 3 equals 2 × row 2 − row 1 (2·[4 5 6] − [1 2 3] = [7 8 9]), so only two rows are independent. The rank is 2, the determinant is 0, and one free variable remains, so the nullity is 1.

Invertible matrix with fractions

The determinant is 2(3·4 − (−1)·1) − ½(1·4 − 0) = 2·13 − 2 = 24, which is non-zero, so all three rows are independent. The rank is 3 (full rank) and the null space contains only the zero vector.

Frequently asked questions

What does the rank of a matrix tell you?+

Rank is the number of linearly independent rows or columns — the dimension of the space the columns span. It tells you how many equations in a linear system are genuinely independent and whether Ax = b has no, one or infinitely many solutions.

Is row rank always equal to column rank?+

Yes. For every matrix the maximum number of independent rows equals the maximum number of independent columns. This is a basic theorem of linear algebra, which is why we can speak simply of "the rank".

What is the rank–nullity theorem?+

For an m × n matrix, rank + nullity = n. The nullity is the dimension of the null space, so every column either carries a pivot (counted in the rank) or corresponds to a free variable (counted in the nullity).

How do I know if a square matrix is invertible from its rank?+

An n × n matrix is invertible exactly when its rank is n. If the rank is less than n, the determinant is zero, the rows are dependent, and the matrix has no inverse.

Why use exact fractions instead of decimals?+

Floating-point row reduction can leave tiny values like 2e-16 where an exact zero belongs, which can make a dependent row look independent and inflate the rank. Exact fractions remove that rounding problem entirely.

What is the maximum possible rank?+

The rank of an m × n matrix is at most the smaller of m and n. A 3 × 5 matrix can have rank at most 3; when it reaches that maximum it is called full rank.

Related tools