← mapVector Spaces

Rank–Nullity

⚗ Dr. Möbius, from the lab

Every linear map is a goddamn accountant, and rank–nullity is its balance sheet: it cannot lose a dimension or conjure one from thin air. Today we prove that the books always close — dim(ker)+dim(im)\dim(\ker) + \dim(\operatorname{im}) equals exactly what you started with, no more, no less. It's the conservation law of this entire stratum, and the Federation of Boring Textbook Authors will never tell you how beautiful it is.

THE BIG IDEA

For a linear map T from an n-dimensional space, dim(kernel) + dim(image) = n — every input dimension is either crushed to zero or survives into the output, with none created and none lost.

Two numbers that name a map

Back in Linear Maps we built the two subspaces that come free with any linear T:VWT : V \to W:

  • the kernel kerT={v:T(v)=0}\ker T = \{\, v : T(v) = 0 \,\} — everything that gets crushed to zero,
  • the image imT={T(v):vV}\operatorname{im} T = \{\, T(v) : v \in V \,\} — everything you can actually hit.

Give each of them a number. The rank is the dimension of the image:

rank(T)=dim(imT).\operatorname{rank}(T) = \dim(\operatorname{im} T).

The nullity is the dimension of the kernel:

nullity(T)=dim(kerT).\operatorname{nullity}(T) = \dim(\ker T).

If you've run Gaussian elimination on the matrix of TT, you already know these numbers in disguise. After you row-reduce, the pivot columns count the rank — each pivot is one independent direction the map can produce. The free variables count the nullity — each free variable is one independent direction you can wander in the kernel without leaving zero. Rank is "how much survives." Nullity is "how much dies."

The theorem

Here it is, clean and load-bearing.

Rank–Nullity Theorem. Let T:VWT : V \to W be linear with dimV=n<\dim V = n < \infty. Then

rank(T)+nullity(T)=n.\operatorname{rank}(T) + \operatorname{nullity}(T) = n.

Read it as a conservation law. The domain hands the map nn dimensions of freedom. The map sorts each one into exactly one of two bins: crushed (it's in the kernel) or survives (it shows up in the image). No dimension gets duplicated into both bins, and none vanishes into some third place that isn't accounted for. The total is conserved. That's the whole emotional content — now let's earn it.

The proof: extend a kernel basis

This is the cleanest proof in the stratum, so pay the hell attention, you magnificent idiot.

Start inside the kernel. It's a subspace of VV, so it has a basis. Say dim(kerT)=k\dim(\ker T) = k and pick a basis

{u1,,uk}\{\, u_1, \dots, u_k \,\}

for kerT\ker T. These are kk independent vectors living in VV. Now extend them to a basis of all of VV — a basis-extension theorem from Basis & Dimension guarantees you can throw in extra vectors

{u1,,uk,  w1,,wr}\{\, u_1, \dots, u_k, \; w_1, \dots, w_r \,\}

that together span VV and stay independent. Since this is a basis of VV and dimV=n\dim V = n, we have k+r=nk + r = n.

Claim: the images {T(w1),,T(wr)}\{\, T(w_1), \dots, T(w_r) \,\} form a basis of imT\operatorname{im} T. If that's true, then rank(T)=r\operatorname{rank}(T) = r, and

rank(T)+nullity(T)=r+k=n.\operatorname{rank}(T) + \operatorname{nullity}(T) = r + k = n. \quad\blacksquare

So everything rides on the claim. Two parts.

They span the image. Take any output T(v)T(v). Write vv in the full basis: v=aiui+bjwjv = \sum a_i u_i + \sum b_j w_j. Apply TT. The uiu_i are in the kernel, so T(ui)=0T(u_i) = 0 and they all drop out:

T(v)=bjT(wj).T(v) = \sum b_j\, T(w_j).

Every image vector is a combination of the T(wj)T(w_j). They span.

They're independent. Suppose cjT(wj)=0\sum c_j\, T(w_j) = 0. By linearity T(cjwj)=0T\big(\sum c_j w_j\big) = 0, so cjwjkerT\sum c_j w_j \in \ker T. But the kernel is spanned by the uiu_i, so cjwj=diui\sum c_j w_j = \sum d_i u_i for some scalars. Rearranged, cjwjdiui=0\sum c_j w_j - \sum d_i u_i = 0 — a dependence among the full basis of VV. A basis is independent, so every coefficient is zero; in particular every cj=0c_j = 0. Independent.

Both parts hold, the claim is true, the theorem is proved. Every dimension of VV either fell into the kernel (the uiu_i) or got carried alive into the image (the wjT(wj)w_j \mapsto T(w_j)). Nothing else can happen — that's the whole damn thing.

The trophy wall: the Invertible Matrix Theorem

Now aim it at a square matrix AA, an n×nn \times n matrix viewed as a map RnRn\mathbb{R}^n \to \mathbb{R}^n. Watch a pile of conditions you've met across the whole matrices stratum collapse into one — it's fucking gorgeous.

If nullity(A)=0\operatorname{nullity}(A) = 0 then kerA={0}\ker A = \{0\}, so AA is injective (kernel-is-zero ⟺ injective, proved in Linear Maps). By rank–nullity, rank(A)=n0=n\operatorname{rank}(A) = n - 0 = n, so the image is all of Rn\mathbb{R}^nAA is surjective too. For a square matrix, injective and surjective arrive together or not at all. That handcuff is rank–nullity doing the work.

Bolt on the facts from Determinants and Matrix Inverses and you get the trophy. For an n×nn \times n matrix AA, the following are all the same statement wearing different clothes:

A invertible    detA0    kerA={0}    rankA=n    columns of A are a basis of Rn.A \text{ invertible} \iff \det A \ne 0 \iff \ker A = \{0\} \iff \operatorname{rank} A = n \iff \text{columns of } A \text{ are a basis of } \mathbb{R}^n.

Add: AA injective ⟺ AA surjective ⟺ Ax=bAx = b has a unique solution for every bb. One object, eight masks. The Federation of Boring Textbook Authors makes you memorize this as a list and charges you forty dollars for the privilege. I want you to see it as one fact: a square map that loses no dimensions loses nothing at all.

Reading Ax=bAx = b at a glance

Rank also lets you predict the entire solution set of Ax=bAx = b without grinding it out. Let AA be m×nm \times n with rank rr.

  • Free variables: there are nrn - r of them (that's the nullity). If r=nr = n, no free variables — at most one solution. If r<nr < n and a solution exists, the solution set is a shifted copy of the (nr)(n-r)-dimensional kernel: infinitely many.
  • Consistency: Ax=bAx = b has a solution exactly when bimAb \in \operatorname{im} A. If r=mr = m the image is all of Rm\mathbb{R}^m, so it's solvable for every bb.

Rank is the single number that controls "how many solutions" before you compute even one of them. My lab runs on this insight. You should too.

TLDR before the gauntlet

Rank counts what survives, nullity counts what dies, and the two always sum to the dimension of the domain because a linear map can only crush or carry — it can't invent shit. Go do the damn exercises.

🔬 SPECIMENS (worked examples)

Worked example 1 — read the two numbers off a reduced matrix

A matrix AA representing a map R4R3\mathbb{R}^4 \to \mathbb{R}^3 row-reduces to (102001100001).\begin{pmatrix} 1 & 0 & 2 & 0 \\ 0 & 1 & -1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}. Find the rank and the nullity, and check rank–nullity.

Pivots = rank. Scan for leading ones: columns 1, 2, and 4 each have a pivot. That's 33 pivots, so

rank(A)=3.\operatorname{rank}(A) = 3.

Free variables = nullity. The map is from R4\mathbb{R}^4, so there are 44 variables; columns 1, 2, 4 are pivot columns, leaving column 3 free — one free variable:

nullity(A)=43=1.\operatorname{nullity}(A) = 4 - 3 = 1.

Check. The domain is R4\mathbb{R}^4, so n=4n = 4, and indeed

rank+nullity=3+1=4=n.\operatorname{rank} + \operatorname{nullity} = 3 + 1 = 4 = n. \checkmark

Note the codomain is R3\mathbb{R}^3 and rank =3= 3, so this map is also surjective — but the 44 in the balance sheet came from the domain, not the codomain.

Worked example 2 — nullity without breaking a sweat

A linear map T:R7R4T : \mathbb{R}^7 \to \mathbb{R}^4 is known to be surjective (it hits all of R4\mathbb{R}^4). What is its nullity?

Surjective means imT=R4\operatorname{im} T = \mathbb{R}^4, so

rank(T)=dim(imT)=dim(R4)=4.\operatorname{rank}(T) = \dim(\operatorname{im} T) = \dim(\mathbb{R}^4) = 4.

The domain is R7\mathbb{R}^7, so n=7n = 7. Rank–nullity:

nullity(T)=nrank(T)=74=3.\operatorname{nullity}(T) = n - \operatorname{rank}(T) = 7 - 4 = 3.

No matrix, no elimination, no sweat. The theorem turned one geometric fact ("it's surjective") into a hard number ("the kernel is 3-dimensional"). That's the whole point of having a conservation law: you measure one side and read off the other.

Worked example 3 — the trap: when injectivity is physically impossible

Can a linear map T:R5R3T : \mathbb{R}^5 \to \mathbb{R}^3 be injective? Justify with rank–nullity.

Injective means kerT={0}\ker T = \{0\}, i.e. nullity(T)=0\operatorname{nullity}(T) = 0. Suppose that held. Then

rank(T)=nnullity(T)=50=5.\operatorname{rank}(T) = n - \operatorname{nullity}(T) = 5 - 0 = 5.

But the image lives inside the codomain R3\mathbb{R}^3, so rank(T)=dim(imT)3\operatorname{rank}(T) = \dim(\operatorname{im} T) \le 3. We'd need 535 \le 3 — false.

So no linear map R5R3\mathbb{R}^5 \to \mathbb{R}^3 can be injective. You cannot stuff 55 independent dimensions into a 33-dimensional room without collapsing at least 22 of them; the nullity is forced to be at least 53=25 - 3 = 2. This is the trap: people assume injectivity is always achievable with enough cleverness. It isn't — the dimension count vetoes it before you draw a single arrow.

☠ KNOWN HAZARDS

  • Thinking rank-nullity references the codomain dimension. It does NOT — and this mistake will haunt you. The sum is the domain dimension n=dimVn = \dim V, not dimW\dim W. A map R5R2\mathbb{R}^5 \to \mathbb{R}^2 still has rank + nullity =5= 5.

  • Forgetting nullity can be zero — or maxed out. A crush-everything zero map has nullity nn, rank 00. An injective map has nullity 00, rank nn. Both obey the theorem; the kernel basis in the proof is just empty in the injective case.

  • Confusing "free variables" with "number of solutions". Free variables count the kernel's dimension — they say nothing about existence. The system Ax=bAx=b might have zero solutions (if bimAb \notin \operatorname{im} A) even when there are free variables. Nullity describes the shape of the solution set when one exists, not whether it exists. Mixing these up is a bullshit mistake that costs easy points.

  • Assuming surjective implies injective for non-square maps. That handcuff only clicks for square matrices. A map R3R2\mathbb{R}^3 \to \mathbb{R}^2 can be surjective (rank 2) while having a 1-dimensional kernel.

TL;DR

  • Rank =dim(imT)== \dim(\operatorname{im} T) = pivot count; nullity =dim(kerT)== \dim(\ker T) = free-variable count.

  • Rank–Nullity: for T:VWT:V\to W with dimV=n\dim V = n, rank(T)+nullity(T)=n\operatorname{rank}(T) + \operatorname{nullity}(T) = n. Proof: extend a kernel basis; the new vectors' images are a basis of the image.

  • Conservation law: every input dimension is either crushed (kernel) or survives (image). None created, none vanish.

  • For square AA: invertible     detA0    kerA={0}    rankA=n    \iff \det A \ne 0 \iff \ker A=\{0\} \iff \operatorname{rank} A = n \iff columns are a basis     \iff injective     \iff surjective. The Invertible Matrix Theorem.

  • Ax=bAx=b has nrank(A)n - \operatorname{rank}(A) free variables; full row rank (r=mr=m) ⟹ solvable for every bb; full column rank (r=nr=n) ⟹ at most one solution.

unlocks