StatGardenREF. DESK
Calculators/Maths/Null space & rank of a matrix
Maths

Null space & rank of a matrix calculator

Rank, nullity and a basis for the null space of a 2×2 or 3×3 matrix.

Published 25 September 2026

What this calculator does

The null space of a matrix is every vector the matrix sends to zero. For the matrix with rows 1 2 3, 2 4 6 and 1 1 1, the null space is one-dimensional and spanned by (1, −2, 1).

Rank and nullity always add to the number of columns, which is the rank-nullity theorem and the quickest sanity check on any answer. A 3-column matrix of rank 2 must have nullity 1, so if you find two independent null vectors you have made an arithmetic slip somewhere.

The formula

FormulaRank = number of non-zero rows after row reduction; nullity = columns − rank (rank-nullity theorem); the null space is every x with Ax = 0

The matrix is reduced to row-echelon form by Gaussian elimination with partial pivoting. The number of pivot columns is the rank, and every column without a pivot corresponds to a free variable. Setting one free variable to 1 and the rest to 0, then reading the pivot rows back, produces one basis vector per free column.

TermMeaning
Null spaceEvery vector x satisfying Ax = 0. Also called the kernel.
NullityThe dimension of the null space: how many independent vectors span it.
RankThe number of independent rows or columns, equal to the pivot count.
Rank-nullity theoremRank plus nullity equals the number of columns, always.

The inputs explained

FieldWhat to enter
Matrix sizeMatrix size. The row entry is read to match, so extra values are ignored and short rows are padded with zeros.
Matrix rows, one per line (comma separated)One row per semicolon, values within a row separated by commas. For example 1, 2, 3; 2, 4, 6; 1, 1, 1.

When to use it

Solving a homogeneous system

The null space is exactly the solution set of Ax = 0, so a basis for it describes every solution.

Testing whether a matrix is invertible

A square matrix is invertible precisely when its null space contains only the zero vector.

Checking linear independence

A non-trivial null space means the columns are linearly dependent, and the basis vector shows the dependency.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

What null space do these matrices have?

Three matrices with different amounts of linear dependence.

3 × 3 matrices
Matrix rowsNullity (dimension of the null space)RankNull space basis
1, 0, 0; 0, 1, 0; 0, 0, 103 of 3only the zero vector — the matrix is invertible
1, 2, 3; 2, 4, 6; 1, 1, 112 of 3(1.00, -2.00, 1.00)
1, 2, 3; 2, 4, 6; 3, 6, 921 of 3(-2.00, 1.00, 0.00) (-3.00, 0.00, 1.00)
The identity matrix has rank 3 and nullity 0, so only the zero vector maps to zero. The last matrix has every row a multiple of the first, giving rank 1 and nullity 2. In every row rank plus nullity comes to 3, which is the theorem doing its job.

Questions

What does the null space tell me?

Which combinations of the columns cancel out to zero. A non-trivial null space means the columns are linearly dependent, the matrix is singular, and any system Ax = b either has no solution or infinitely many rather than exactly one.

What is the rank-nullity theorem?

Rank plus nullity equals the number of columns. It holds for every matrix without exception, which makes it the fastest check on a computed answer: if your rank and nullity do not sum to the column count, one of them is wrong.

Why is the basis not unique?

Because any set of independent vectors spanning the same space is a valid basis. Scaling a basis vector, or adding one to another, gives an equally correct answer. The convention here sets each free variable to 1 in turn, which produces one standard choice.

What does nullity zero mean?

That only the zero vector maps to zero, so the matrix is full rank and invertible. For a square matrix this is equivalent to a non-zero determinant, and to the columns being linearly independent.

For inverting a matrix, see the matrix inverse calculator. For the determinant, see the matrix determinant calculator.

Advertisement
Advertisement