Back to the on-screen lesson ·

The rank-nullity theorem

Rank plus nullity is the number of columns, proved by counting pivot and free columns, and what that forces about wide, tall and square matrices.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to state the rank-nullity theorem with the dimension of the domain on the right-hand side and explain why the codomain does not appear, prove it by partitioning the columns into pivot and free, compute any one of rank, nullity and column count from the other two, give the dimensions of all four fundamental subspaces from a shape and a rank, and say what a wide, a tall or a square shape forces about a system before any entry is read.

2. The two counts you already take

You can reduce a matrix, count its pivot columns to get the rank, and count its free columns to get a basis of the null space. This lesson adds nothing to either procedure. It points out that the two counts are counts of the same set of columns, sorted into two heaps, and then spends the rest of the time on what follows.

3. Rank, nullity, and the two shapes

The rank of a matrix is the dimension of its column space, equivalently the number of pivots in its reduced form. Its nullity is the dimension of its null space, equivalently the number of free columns. A matrix is wide when it has more columns than rows and tall when it has more rows than columns. A linear map is injective when only the zero vector goes to zero, and surjective when its image is the whole codomain.

4. One partition of the columns

Theorem. For any $m \times n$ matrix $A$, $\operatorname{rank} A + \operatorname{nullity} A = n$.

Proof. Reduce $A$. Every column of the reduced form either contains a pivot or does not. The pivot columns number $\operatorname{rank} A$, by definition. The free columns each contribute one special solution, and those special solutions are a basis of the null space — they are independent, because each has a $1$ in a position where the others have $0$, and they span it, because writing the pivot variables in terms of the free ones expresses every solution as a combination of them. So the free columns number $\operatorname{nullity} A$. There are $n$ columns and each is counted exactly once. $\square$

The content is the last sentence. Nothing is computed anywhere in the argument; a set is split into two parts and the parts are added back up.

In the language of maps, for $T : V \to W$ linear,

$$\dim \ker T + \dim \operatorname{im} T = \dim V.$$

The dimension of $W$ is absent, and its absence is the thing to remember. The theorem is an accounting of what goes in: each input direction is either crushed to zero or survives into the image, and no direction does both or neither.

What it forces. Since $\operatorname{rank} A \le \min(m, n)$:

Another way: picture

Plot rank across and nullity up. Every matrix with $n$ columns lands on the segment from $(0, n)$ to $(n, 0)$ — a straight line of gradient $-1$ — and no matrix with $n$ columns lands anywhere else. Moving one step right along it means one more pivot, and it costs exactly one step down, because the column that gained the pivot is the column that stopped being free. The extreme points are the zero matrix at $(0, n)$ and a matrix of full column rank at $(n, 0)$.

Another way: steps

  1. Count the columns. That is the total the two dimensions must reach.
  2. Find whichever of rank or nullity is easier, by reduction or from the shape.
  3. Subtract to get the other.
  4. If the question is about injectivity or surjectivity, compare the rank with $n$ and with $m$ separately — they are different comparisons unless the matrix is square.

5. Why the codomain is not in the equation

The commonest misstatement of this theorem puts the number of rows on the right-hand side, and the quickest cure is an example where the two differ wildly.

Let $T : \mathbb{R}^2 \to \mathbb{R}^{100}$ send $(x, y)$ to $(x, y, 0, 0, \dots, 0)$. The kernel is $\{0\}$, so the nullity is $0$; the image is a plane, so the rank is $2$. And $0 + 2 = 2 = \dim \mathbb{R}^2$. The number $100$ appears nowhere, and it could have been a million without changing a thing.

The reason is structural. The theorem is proved by partitioning the columns of the matrix, and there is one column per dimension of the domain. The rows are not partitioned by anything; they are just where the pivots have to fit, which is why the row count bounds the rank without ever being equal to a sum of dimensions.

There is a companion statement at the other end, and it is about the transpose: $\operatorname{rank} A + \dim N(A^{\mathsf{T}}) = m$. Same theorem, applied to $A^{\mathsf{T}}$, whose column count is $m$. Together the two account for all four fundamental subspaces: $r + (n - r) = n$ at the input end, $r + (m - r) = m$ at the output end, with the single shared $r$ being the fact that row rank equals column rank.

6. Two consequences worth having by heart

A square matrix is invertible exactly when its nullity is zero. For $m = n$, rank $n$ makes the columns independent and spanning at once, so the map is a bijection and the inverse matrix exists. This is why every test for invertibility in this course — non-zero determinant, full rank, trivial null space, $n$ pivots, columns a basis — is the same test. For a non-square matrix these come apart immediately, and nothing called an inverse exists at all.

The rank of a product is at most the smaller of the two ranks: $\operatorname{rank}(AB) \le \min(\operatorname{rank} A, \operatorname{rank} B)$. Every column of $AB$ is $A$ applied to a column of $B$, so the column space of $AB$ sits inside the column space of $A$, giving $\operatorname{rank}(AB) \le \operatorname{rank} A$. And anything $B$ sends to zero, $AB$ sends to zero, so $N(B) \subseteq N(AB)$ and the nullity can only grow — which, by the theorem, means the rank can only fall.

The reading is worth more than the inequality: a direction that has been collapsed cannot be recovered. If $B$ makes two vectors equal, no later $A$ can tell them apart again. That single sentence explains why rank never rises under multiplication, why a projection composed with anything stays a projection-sized map, and why the rank of a long product is governed by its weakest factor.

7. Where it is misremembered

Adding up to the number of rows. The theorem partitions the columns. For a non-square matrix the row count gives the wrong answer, and for a square one it happens to give the right answer for the wrong reason, which is worse — it works until the first non-square example and then quietly does not.

Thinking injective and surjective still come together. They do for square matrices only. A wide matrix can be onto and never one-to-one; a tall one can be one-to-one and never onto. Getting this right is most of what the theorem is for.

Treating nullity $0$ as "the null space is empty". The null space always contains the zero vector, so it is never empty. Dimension $0$ means it contains nothing else.

Expecting rank to rise under multiplication. It never does. $\operatorname{rank}(AB)$ is at most both ranks, and it can be strictly smaller than both — two non-zero matrices can multiply to zero.

Using the theorem on a non-linear map. The proof is a statement about a matrix. A map that is not linear has no matrix, no kernel that is a subspace, and no theorem here.

8. Reading both ends of a shape

  1. $A$ is $3 \times 5$. Its rank is at most $3$, so its nullity is at least $5 - 3 = 2$.

    The bound comes from the rows.

  2. So $Ax = 0$ has infinitely many solutions, whatever the fifteen entries are — five unknowns and three equations cannot pin a point down.

    No arithmetic required.

  3. Can $A$ be onto? Onto needs rank $3$, which is possible but not guaranteed; it holds exactly when the three rows are independent. Wide matrices may be onto and are never one-to-one.

    The two questions are separate.

9. A product that loses rank

  1. $A = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}$ and $B = \begin{pmatrix} 1 & 1 \\ -1 & -1 \end{pmatrix}$ both have rank $1$.

    Two rank-one matrices.

  2. $AB = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}$, of rank $0$ and nullity $2$.

    Strictly below both factors.

  3. $B$ collapses everything onto the line spanned by $(1, -1)$, and $A$ sends that line to zero. Rank fell because each map crushed a direction and nothing restores one.

    The inequality is not tight.

10. Your turn: $T : \mathbb{R}^7 \to \mathbb{R}^4$ is onto. What is the dimension of its kernel?

  1. Onto means the image is all of $\mathbb{R}^4$, so the rank is $4$.

    Turn the word into a number.

  2. The theorem adds up to the dimension of the domain, which is $7$, not $4$.

    Domain, every time.

  3. Your turn: work this step out. Its working is at the end of the packet.

    So the nullity is $7 - 4 = 3$: a three-dimensional subspace of $\mathbb{R}^7$ is sent to zero, and $T$ is very far from one-to-one.

11. Guided practice

$A$ has $3$ columns and rank $3$. Put the steps of the rank-nullity count in order.

Number the steps in order (write the number in the box):

12. Guided practice

Three matrices each have $5$ columns. Fill in the missing rank or nullity for each.

ColumnsRankNullity
Matrix $A$52
Matrix $B$52
Matrix $C$54

13. Practice

$A$ is $4 \times 7$ with rank $3$. What is the dimension of its null space?

Answer:

14. Practice

$T : \mathbb{R}^{4} \to \mathbb{R}^{2}$ is linear. Which equation is the rank-nullity theorem?

15. Practice

Match each matrix to the conclusion its shape forces, whatever its entries.

Its null space contains a non-zero vectorIt cannot be ontoIt is invertible
$A$ is $4 \times 6$, with more columns than rows
$B$ is $6 \times 4$, with more rows than columns
$C$ is $4 \times 4$ with nullity $0$

16. Somewhere new

Three matrices each have $5$ columns, of ranks $1$, $2$ and $3$. Plot the point (rank, nullity) for each.

Plot your answer on the grid:

1234512345ranknullity

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

$A$ has $6$ columns and rank $1$. Put the steps of the rank-nullity count in order.

Number the steps in order (write the number in the box):

19. What you can do now

You can move between rank, nullity and the number of columns in either direction, and say what a matrix's shape alone guarantees. Say in your own words why the number of rows is not in the equation. Next: linear maps, of which every matrix is one written in a chosen pair of bases.

Working for the steps left to you

10. Your turn: $T : \mathbb{R}^7 \to \mathbb{R}^4$ is onto. What is the dimension of its kernel?, step 3

Onto and one-to-one are independent here.