The Rank–Nullity Theorem
Feed a matrix a vector and it does something to it. Some directions come out the other side alive,
stretched or squished but still there in the output. Other directions get flattened to
nothing — the matrix sends them straight to the zero vector, and they vanish. Here's the beautiful
part: every single input direction has exactly one of these two fates. It either
survives into the output, or it collapses to zero. Nothing does both; nothing does neither.
The rank–nullity theorem is just the accountant's version of that sentence. For an
m \times n matrix A — a machine that takes
vectors from \mathbb{R}^n and returns vectors in
\mathbb{R}^m — it says:
\operatorname{rank}(A) + \operatorname{nullity}(A) = n.
The number of surviving directions plus the number of collapsing directions equals the number of
directions you started with. The books always balance. And that n on the
right is the number of columns — the dimension of the input space — a detail that
trips up almost everyone the first time, so keep an eye on it.
Meet the two characters
Both terms in the equation you already know from the two pages before this one; the theorem just
insists they add up.
-
Rank is the dimension of the
column space —
also called the image. It counts the surviving directions: how many independent
directions the output actually fills. It equals the number of pivot columns once
you row-reduce.
-
Nullity is the dimension of the
null space. It
counts the collapsing directions: the independent directions A crushes
to zero. It equals the number of free columns (the non-pivot columns) once you
row-reduce.
And there is the whole proof in one breath. Row-reduce A. Every
one of its n columns is either a pivot column or a
free column — there is no third kind. Pivot columns are counted by the rank, free
columns are counted by the nullity, and every column falls into exactly one bucket. So the two
counts must add to n. The theorem isn't a coincidence you verify
with examples; it's the statement that you can't be in two buckets at once.
- For any m \times n matrix,
\operatorname{rank}(A) + \operatorname{nullity}(A) = n, where
n is the number of columns (the dimension of the
domain).
- Equivalently: (number of pivot columns) + (number of free columns) = (total columns).
- Since \operatorname{nullity} \ge 0 and rank is bounded by the number
of rows, \operatorname{rank}(A) \le \min(m, n) always.
See the books balance
Picture the input space \mathbb{R}^n as a bar of height
n. Drag the sliders: n sets how many input dimensions
there are, r sets the rank. The bar splits into a
surviving part (height = rank, which flows across to the
image) and a collapsing part (height = nullity, which folds down onto the single zero vector). The
two pieces always stack back up to the full height n — that's the theorem,
made of coloured blocks.
Notice what the extremes mean. Push r all the way up to
n and the collapsing block disappears — nullity 0,
nothing crushed, the map is injective (one-to-one). Pull
r down to 0 and the whole space collapses to a
point — that's the zero matrix, which sends everything to \mathbf{0}.
Worked example: a 3×4 matrix
Let A be the 3 \times 4 matrix
A = \begin{bmatrix} 1 & 2 & 0 & 3 \\ 0 & 0 & 1 & 4 \\ 2 & 4 & 1 & 10 \end{bmatrix}.
Row-reduce. Row 3 minus twice row 1 gives [0,0,1,4], which is identical to
row 2, so subtracting row 2 wipes it out:
\begin{bmatrix} 1 & 2 & 0 & 3 \\ 0 & 0 & 1 & 4 \\ 0 & 0 & 0 & 0 \end{bmatrix}.
Two pivots — in columns 1 and 3. So \operatorname{rank}(A) = 2.
Now the theorem does the rest without any more arithmetic. There are n = 4
columns, so
\operatorname{nullity}(A) = n - \operatorname{rank}(A) = 4 - 2 = 2.
The null space is two-dimensional — a whole plane of vectors that
A sends to zero. Columns 2 and 4 are the free columns, one free parameter
each, which is exactly the two collapsing directions the count promised. You never had to solve
A\mathbf{x} = \mathbf{0} to know its solution set is a plane; the theorem
told you the moment you counted the pivots.
Worked example: a wide system must have hidden solutions
Here's the theorem earning its keep as a guarantee. Take any homogeneous system with more
unknowns than equations — say 2 equations in 3
unknowns, A\mathbf{x} = \mathbf{0} with A a
2 \times 3 matrix. Does it have a solution other than the obvious
\mathbf{x} = \mathbf{0}?
Rank is bounded by the number of rows, so \operatorname{rank}(A) \le 2.
There are n = 3 columns, so
\operatorname{nullity}(A) = 3 - \operatorname{rank}(A) \ge 3 - 2 = 1.
A nullity of at least 1 means the null space contains more than just the
zero vector — there is a whole line (at least) of nonzero solutions. So every
homogeneous system with more unknowns than equations has infinitely many solutions. Not "usually" —
always, provably, with no computation at all. More generally, a map
\mathbb{R}^n \to \mathbb{R}^m with n > m can
never be injective: the rank can't exceed m, so the nullity is forced to
be positive, and something must get crushed.
Why this ties everything together
Once you have this one equation, a pile of facts about matrices stop being separate rules and become
the same rule seen from different sides. Take a square
n \times n matrix. The following are all just
\operatorname{rank} + \operatorname{nullity} = n read out loud:
- A is
invertible
\iff \operatorname{nullity}(A) = 0 \iff \operatorname{rank}(A) = n.
Full rank leaves no room for a nontrivial null space, so the map is one-to-one and onto at
once.
- If any direction collapses (\operatorname{nullity} > 0), the rank
falls short of n, the columns can't
span
\mathbb{R}^n, and the matrix is singular.
- Injective and surjective become the same condition for a square matrix — lose a
dimension to the null space and you lose exactly a dimension of the image. That's why "it has an
inverse," "its determinant is nonzero," and "it has no free variables" are all one idea.
For rectangular matrices the two halves separate again — a tall matrix can be injective without being
surjective — and rank–nullity is precisely the ledger that tracks the trade-off. It's the hinge the
rest of linear algebra swings on, and it sits right alongside
rank and solvability,
which reads the same numbers off to decide how many solutions a system has.
The single most common slip with this theorem is adding rank and nullity to m, the number
of rows. It's n, the number of columns — the dimension of the input space
\mathbb{R}^n. The reason is baked into the proof: rank and nullity count
columns (pivot columns and free columns), and a matrix has exactly
n columns, so their total can only ever be
n.
A quick sanity check that saves you every time: the rank can never exceed either dimension,
\operatorname{rank}(A) \le \min(m, n). So for a wide
2 \times 5 matrix the rank is at most 2, which
forces the nullity up to at least 3 — the numbers must still add to the
5 columns, not the 2 rows. If your rank and
nullity ever add up to the row count, you've mixed up which dimension is which.
For finite matrices rank–nullity is a clean equation. Push the same idea to infinite-dimensional
spaces — the operators of quantum mechanics and functional analysis — and it grows into the
rank–nullity (or "index") theorem for linear maps, and eventually into the celebrated
Atiyah–Singer index theorem, where the difference between "dimension of what survives" and "dimension
of what collapses" turns out to be governed by the shape of the underlying space. A humble
column-counting fact for 3 \times 4 matrices is the first rung of a ladder
that reaches some of the deepest results in modern geometry. Not bad for an accountant's identity.