On this page
If you have row-reduced a matrix and counted pivots, you have already used the rank–nullity theorem. Every column is either a pivot column or a free column, and the theorem counts both.
What is the rank–nullity theorem?
For an m×n matrix A, rank(A) + nullity(A) = n, the number of columns (rank–nullity theorem, Wikipedia).
The rank is the number of pivots. The nullity is the dimension of the null space, the set of all x with Ax = 0. In his textbook Introduction to Linear Algebra, Gilbert Strang shows that the null space has dimension n − r and calls r + (n − r) = n the Counting Theorem (Strang, section 3.5).
Why it holds: after elimination, each column without a pivot belongs to a free variable, and each free variable gives one special solution of Ax = 0. Strang shows that these special solutions form a basis for the null space. Pivots count the rank, free variables count the nullity, and together they count every column.
How do you find a kernel basis for a 3×4 matrix?
Take this matrix A, written row by row:
Row 1: 1, 2, 0, 3
Row 2: 2, 4, 1, 7
Row 3: 1, 2, 1, 4
Reduce it and read off the kernel (another name for the null space):
Subtract 2 × row 1 from row 2: row 2 becomes 0, 0, 1, 1.
Subtract row 1 from row 3: row 3 becomes 0, 0, 1, 1.
Subtract the new row 2 from row 3: row 3 becomes 0, 0, 0, 0.
The reduced rows are (1, 2, 0, 3), (0, 0, 1, 1), (0, 0, 0, 0). Pivots sit in columns 1 and 3, so the rank is 2.
Columns 2 and 4 have no pivot, so x2 and x4 are free. The theorem predicts nullity 4 − 2 = 2.
Set x2 = 1, x4 = 0: then x3 = 0 and x1 = −2. Special solution: (−2, 1, 0, 0).
Set x2 = 0, x4 = 1: then x3 = −1 and x1 = −3. Special solution: (−3, 0, −1, 1).
These two vectors are a basis for the kernel: every solution of Ax = 0 is x2(−2, 1, 0, 0) + x4(−3, 0, −1, 1). Rank 2 + nullity 2 = 4 columns.
If finding the rank is still shaky, see our walk-through on how to find the rank of a matrix using row echelon form.
What does rank–nullity tell you about solutions of Ax = b?
MIT's 18.06SC lecture notes state that Ax = b is solvable exactly when b is in the column space of A, and that the complete solution is one particular solution plus every vector in the null space, x = xp + xn (MIT OpenCourseWare 18.06SC, Solving Ax = b).
In our example, row 3 of A equals row 2 minus row 1, so a solution exists only when b3 = b2 − b1. For b = (3, 7, 4) the condition holds. Setting the free variables to zero gives xp = (3, 0, 1, 0), and the full solution set is (3, 0, 1, 0) + x2(−2, 1, 0, 0) + x4(−3, 0, −1, 1). For b = (3, 7, 5) the condition fails, and there is no solution.
Whenever a solution exists, the nullity is the number of free parameters in it. The MIT notes sort every case by rank r, rows m and columns n:
r = m = n: exactly one solution for every b.
r = n < m: 0 or 1 solution.
r = m < n: infinitely many solutions, for every b.
r < m and r < n: 0 or infinitely many. Our 3×4 example sits here.
Why does a 3×5 system always have free variables?
The same MIT notes point out that for an m by n matrix of rank r, r ≤ m and r ≤ n (MIT OpenCourseWare 18.06SC).
A 3×5 matrix has three rows, so at most three pivots. Rank–nullity then gives nullity = 5 − rank, which is at least 5 − 3 = 2. At least two of the five unknowns are free, whatever the numbers. Strang's own 3×5 example in section 3.5 has rank 2, so it has three free variables.
So Ax = 0 always has solutions other than x = 0, and Ax = b never has exactly one solution: it has none, or a family with at least two free parameters. The same counting sits behind questions on when a system has a unique solution; see how to find k for a unique solution of a linear system.
A four-step check for any matrix
Write down n, the number of columns.
Row-reduce and count pivots: that is the rank r.
Nullity = n − r: find one special solution per free variable.
For Ax = b, apply the same row operations to b. If every zero row of A ends with a zero on the right, the answer is xp plus n − r free parameters; if not, there is no solution.
If you keep landing on the wrong pivot count, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer. Each concept in the Fermi Concept Library has its own lesson and its place in the map.



