How to Find a Basis for the Null Space
The null space of a matrix A, also called the kernel, is the set of all vectors x such that Ax = 0. Finding a basis for it means identifying a small, linearly independent set of vectors that spans that entire solution space. The process is mechanical once you know where to look.
What the Null Space Actually Is
For an m × n matrix A, the null space lives in Rⁿ. Every vector in it satisfies the homogeneous system Ax = 0. The null space always contains at least the zero vector, but it gets more interesting when free variables appear during row reduction.
The dimension of the null space is called the nullity of A. By the rank-nullity theorem, rank(A) + nullity(A) = n, where n is the number of columns. So a 3 × 5 matrix with rank 3 has a null space of dimension 2, meaning its basis will contain exactly two vectors.
Step 1: Row Reduce to RREF
Start by reducing A to reduced row echelon form. Every pivot column corresponds to a basic variable; every non-pivot column corresponds to a free variable. The number of free variables equals the nullity.
Take this 3 × 5 matrix as a working example:
A = [ 1 2 0 3 1 ]
[ 0 0 1 4 2 ]
[ 0 0 0 0 0 ]
This is already in RREF. Pivot columns are 1 and 3 (they contain leading 1s). Columns 2, 4, and 5 are free. So there are three free variables and the null space has dimension 3.
Step 2: Label Basic and Free Variables
Read off the variables from the column positions:
- x₁: basic (pivot in column 1)
- x₂: free
- x₃: basic (pivot in column 3)
- x₄: free
- x₅: free
The system Ax = 0 gives:
x₁ + 2x₂ + 3x₄ + x₅ = 0
x₃ + 4x₄ + 2x₅ = 0
Solve for the basic variables in terms of the free ones:
x₁ = -2x₂ - 3x₄ - x₅
x₃ = -4x₄ - 2x₅
Step 3: Write the Parametric Vector Form
Set each free variable to a parameter and leave the others zero. This is where basis vectors emerge directly.
x₂ = s, x₄ = t, x₅ = u (and s, t, u are arbitrary real numbers):
x = [ x₁ ] [ -2s - 3t - u ] [ -2 ] [ -3 ] [ -1 ]
[ x₂ ] = [ s ] = s[ 1 ] + t [ 0 ] + u [ 0 ]
[ x₃ ] [ -4t - 2u ] [ 0 ] [ -4 ] [ -2 ]
[ x₄ ] [ t ] [ 0 ] [ 1 ] [ 0 ]
[ x₅ ] [ u ] [ 0 ] [ 0 ] [ 1 ]
The parametric vector form separates the solution into three independent directions. Each direction corresponds to one free variable being set to 1 while the others are 0.
Step 4: Extract the Basis Vectors
The three vectors multiplying s, t, and u form a basis for the null space:
v₁ = [ -2, 1, 0, 0, 0 ]ᵀ
v₂ = [ -3, 0, -4, 1, 0 ]ᵀ
v₃ = [ -1, 0, -2, 0, 1 ]ᵀ
These vectors are linearly independent by construction. Each one has a 1 in exactly one position where the others have 0 (the positions corresponding to x₂, x₄, and x₅). That structure guarantees independence without any additional checking.
The null space of A is span{v₁, v₂, v₃}.
A Smaller Example with Two Free Variables
Here is a cleaner example to see the two-free-variable case. Start with:
B = [ 1 3 0 2 ]
[ 0 0 1 5 ]
Already in RREF. Pivot columns: 1 and 3. Free columns: 2 and 4. Variables: x₁ basic, x₂ free, x₃ basic, x₄ free.
System Bx = 0:
x₁ + 3x₂ + 2x₄ = 0
x₃ + 5x₄ = 0
Solve for basic variables:
x₁ = -3x₂ - 2x₄
x₃ = -5x₄
Set x₂ = s, x₄ = t:
x = s[ -3, 1, 0, 0 ]ᵀ + t[ -2, 0, -5, 1 ]ᵀ
Basis for Null(B):
u₁ = [ -3, 1, 0, 0 ]ᵀ
u₂ = [ -2, 0, -5, 1 ]ᵀ
You can verify each one: multiply B by u₁ and you get 0. Same for u₂. That check takes thirty seconds and confirms the work.
The connection to the row space, column space, and null space picture is worth keeping in mind. These two basis vectors span a 2-dimensional subspace of R⁴, and B has rank 2, so rank + nullity = 2 + 2 = 4 = n. Everything checks out.
When the Null Space Is Trivial
If A has no free variables, every column is a pivot column. The only solution to Ax = 0 is x = 0. The null space is {0}, sometimes written as the trivial subspace. Its basis is the empty set, and its dimension is 0.
This happens with square invertible matrices, and more generally with any matrix whose rank equals its number of columns (full column rank). A tall matrix with more rows than columns often falls into this category.
Frequently asked questions
Is the null space basis unique?
No. Different row reduction sequences, or different choices of which free variable to set to 1, can produce different-looking basis vectors. All valid bases span the same subspace, but the individual vectors can differ. What stays fixed is the number of vectors, which equals the nullity.
How do I know how many basis vectors to expect?
Count the columns of A, then subtract the rank. Rank equals the number of pivot positions in RREF, which equals the number of non-zero rows. The difference gives the nullity, and that is exactly how many basis vectors the null space basis will contain.
Can I find the null space without reducing all the way to RREF?
You can stop at row echelon form (REF), but RREF makes the back-substitution automatic. In REF you still have to substitute upward to express basic variables in terms of free ones. RREF does that work for you, so it is almost always faster to go all the way.
What is the difference between the null space and the left null space?
The null space of A consists of vectors x with Ax = 0, living in Rⁿ (column space dimension). The left null space consists of vectors y with Aᵀy = 0, or equivalently yᵀA = 0ᵀ, living in Rᵐ (row space dimension). To find a basis for the left null space, transpose A and apply the same procedure.