Skip to content

Chapter 12. Rank and Nullity

Rank and nullity measure two complementary parts of a matrix. Rank measures how many independent directions the matrix produces. Nullity measures how many independent directions the matrix sends to zero. For an m×nm\times n matrix AA, these quantities satisfy the rank-nullity theorem:

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

Here nn is the number of columns of AA. Equivalently, it is the dimension of the input space. This theorem says that every input direction is accounted for either by contributing to the image of AA, or by disappearing into the null space of AA.

12.1 Rank

The rank of a matrix is the number of pivot positions in any row echelon form of the matrix.

If AA row reduces to an echelon matrix with rr nonzero rows, then

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

For example,

A=[123246110]. A= \begin{bmatrix} 1&2&3\\ 2&4&6\\ 1&1&0 \end{bmatrix}.

Apply row operations:

R2R22R1,R3R3R1. R_2\leftarrow R_2-2R_1, \qquad R_3\leftarrow R_3-R_1.

Then

[123000013]. \begin{bmatrix} 1&2&3\\ 0&0&0\\ 0&-1&-3 \end{bmatrix}.

Swap rows 22 and 33:

[123013000]. \begin{bmatrix} 1&2&3\\ 0&-1&-3\\ 0&0&0 \end{bmatrix}.

There are two nonzero rows in echelon form. Therefore

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

12.2 Rank as Number of Pivots

Rank can be read from pivots.

Each pivot represents one independent constraint in the row view and one independent output direction in the column view. If a matrix has rr pivots, then its rank is rr.

For example,

R=[103201140000] R= \begin{bmatrix} 1&0&3&2\\ 0&1&-1&4\\ 0&0&0&0 \end{bmatrix}

has two pivots. Hence

rank(R)=2. \operatorname{rank}(R)=2.

The original matrix and its row echelon form have the same rank, because elementary row operations preserve the number of pivots.

12.3 Row Rank and Column Rank

There are two natural ways to define rank.

The row rank is the dimension of the row space: the number of linearly independent rows.

The column rank is the dimension of the column space: the number of linearly independent columns.

A fundamental theorem says that these two numbers are always equal. Thus we may speak simply of the rank of a matrix.

row rank(A)=column rank(A)=rank(A). \text{row rank}(A)=\text{column rank}(A)=\operatorname{rank}(A).

This equality is one reason rank is so useful. It connects equations, columns, transformations, and dimension.

12.4 Column Space

The column space of an m×nm\times n matrix AA is the span of its columns.

If

A=[a1a2an], A= \begin{bmatrix} |&|&&|\\ a_1&a_2&\cdots&a_n\\ |&|&&| \end{bmatrix},

then

Col(A)=span{a1,a2,,an}. \operatorname{Col}(A) = \operatorname{span}\{a_1,a_2,\ldots,a_n\}.

The column space is a subspace of FmF^m.

The equation

Ax=b Ax=b

has a solution exactly when

bCol(A). b\in \operatorname{Col}(A).

Thus the column space is the set of all right-hand sides that the matrix can produce.

12.5 Rank as Dimension of the Column Space

Rank is also the dimension of the column space:

rank(A)=dimCol(A). \operatorname{rank}(A)=\dim \operatorname{Col}(A).

This means rank counts how many independent columns the matrix has.

For example,

A=[123011000]. A= \begin{bmatrix} 1&2&3\\ 0&1&1\\ 0&0&0 \end{bmatrix}.

The first two columns

[100],[210] \begin{bmatrix} 1\\ 0\\ 0 \end{bmatrix}, \qquad \begin{bmatrix} 2\\ 1\\ 0 \end{bmatrix}

are independent. The third column is their sum:

[310]=[100]+[210]. \begin{bmatrix} 3\\ 1\\ 0 \end{bmatrix} = \begin{bmatrix} 1\\ 0\\ 0 \end{bmatrix} + \begin{bmatrix} 2\\ 1\\ 0 \end{bmatrix}.

Therefore the column space has dimension 22, and

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

12.6 Pivot Columns

Pivot columns identify a basis for the column space.

The important rule is this: row reduce AA, find the pivot column positions, then take the corresponding columns from the original matrix AA.

For example,

A=[123247124]. A= \begin{bmatrix} 1&2&3\\ 2&4&7\\ 1&2&4 \end{bmatrix}.

Row reduction gives

[123001001][123001000]. \begin{bmatrix} 1&2&3\\ 0&0&1\\ 0&0&1 \end{bmatrix} \longrightarrow \begin{bmatrix} 1&2&3\\ 0&0&1\\ 0&0&0 \end{bmatrix}.

The pivot columns are columns 11 and 33. Therefore a basis for the column space of the original matrix is

{[121],[374]}. \left\{ \begin{bmatrix} 1\\ 2\\ 1 \end{bmatrix}, \begin{bmatrix} 3\\ 7\\ 4 \end{bmatrix} \right\}.

Do not take the pivot columns from the reduced matrix when the goal is a basis for the original column space.

12.7 Row Space

The row space of a matrix is the span of its rows.

If AA is an m×nm\times n matrix, each row is a vector in FnF^n. The row space is therefore a subspace of FnF^n.

For example,

A=[123246011]. A= \begin{bmatrix} 1&2&3\\ 2&4&6\\ 0&1&1 \end{bmatrix}.

The rows are

(1,2,3),(2,4,6),(0,1,1). (1,2,3),\qquad (2,4,6),\qquad (0,1,1).

Since the second row is twice the first, it adds no new direction. The row space is spanned by

(1,2,3) (1,2,3)

and

(0,1,1). (0,1,1).

Thus the row rank is 22.

12.8 Basis for the Row Space

The nonzero rows of a row echelon form give a basis for the row space.

For example,

A=[123246011] A= \begin{bmatrix} 1&2&3\\ 2&4&6\\ 0&1&1 \end{bmatrix}

row reduces to

R=[123011000]. R= \begin{bmatrix} 1&2&3\\ 0&1&1\\ 0&0&0 \end{bmatrix}.

The nonzero rows of RR are

(1,2,3),(0,1,1). (1,2,3), \qquad (0,1,1).

They form a basis for the row space. Therefore

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

12.9 Null Space

The null space of an m×nm\times n matrix AA is the set of all vectors xFnx\in F^n such that

Ax=0. Ax=0.

It is denoted by

Null(A) \operatorname{Null}(A)

or

N(A). N(A).

Thus

Null(A)={xFn:Ax=0}. \operatorname{Null}(A)=\{x\in F^n:Ax=0\}.

The null space is a subspace of FnF^n. It contains all input vectors that the matrix sends to the zero vector.

12.10 Nullity

The nullity of a matrix is the dimension of its null space:

nullity(A)=dimNull(A). \operatorname{nullity}(A)=\dim \operatorname{Null}(A).

Equivalently, nullity is the number of free variables in the homogeneous system

Ax=0. Ax=0.

For example, suppose the reduced row echelon form of AA is

[102101340000]. \begin{bmatrix} 1&0&2&-1\\ 0&1&3&4\\ 0&0&0&0 \end{bmatrix}.

There are four variables and two pivots. Therefore there are two free variables. Hence

nullity(A)=2. \operatorname{nullity}(A)=2.

12.11 Computing the Null Space

To compute the null space, solve the homogeneous system

Ax=0. Ax=0.

Consider

A=[11112345]. A= \begin{bmatrix} 1&1&1&1\\ 2&3&4&5 \end{bmatrix}.

Row reduce:

[11112345][11110123][10120123]. \begin{bmatrix} 1&1&1&1\\ 2&3&4&5 \end{bmatrix} \longrightarrow \begin{bmatrix} 1&1&1&1\\ 0&1&2&3 \end{bmatrix} \longrightarrow \begin{bmatrix} 1&0&-1&-2\\ 0&1&2&3 \end{bmatrix}.

The homogeneous equations are

x1x32x4=0, x_1-x_3-2x_4=0, x2+2x3+3x4=0. x_2+2x_3+3x_4=0.

Let

x3=s,x4=t. x_3=s,\qquad x_4=t.

Then

x1=s+2t,x2=2s3t. x_1=s+2t, \qquad x_2=-2s-3t.

Thus

x=[s+2t2s3tst]=s[1210]+t[2301]. x= \begin{bmatrix} s+2t\\ -2s-3t\\ s\\ t \end{bmatrix} = s \begin{bmatrix} 1\\ -2\\ 1\\ 0 \end{bmatrix} + t \begin{bmatrix} 2\\ -3\\ 0\\ 1 \end{bmatrix}.

A basis for the null space is

{[1210],[2301]}. \left\{ \begin{bmatrix} 1\\ -2\\ 1\\ 0 \end{bmatrix}, \begin{bmatrix} 2\\ -3\\ 0\\ 1 \end{bmatrix} \right\}.

Therefore

nullity(A)=2. \operatorname{nullity}(A)=2.

12.12 Rank-Nullity Theorem for Matrices

Let AA be an m×nm\times n matrix. Then

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

The rank counts pivot variables. The nullity counts free variables. Since every variable is either a pivot variable or a free variable, their counts add to the total number of variables, which is the number of columns of AA.

If

rank(A)=r, \operatorname{rank}(A)=r,

then

nullity(A)=nr. \operatorname{nullity}(A)=n-r.

This formula is often the fastest way to compute nullity once rank is known.

12.13 Rank-Nullity Theorem for Linear Maps

The same theorem applies to linear transformations.

Let

T:VW T:V\to W

be a linear transformation, where VV is finite-dimensional. Then

dimV=dimker(T)+dimim(T). \dim V=\dim \ker(T)+\dim \operatorname{im}(T).

Here

dimker(T) \dim \ker(T)

is the nullity of TT, and

dimim(T) \dim \operatorname{im}(T)

is the rank of TT.

This form shows the conceptual meaning of the theorem. The domain splits into directions lost by TT and directions that contribute to the image.

12.14 Full Rank

An m×nm\times n matrix has full rank if its rank is as large as possible.

Since the rank cannot exceed the number of rows or the number of columns,

rank(A)min(m,n). \operatorname{rank}(A)\le \min(m,n).

Thus full rank means

rank(A)=min(m,n). \operatorname{rank}(A)=\min(m,n).

There are two common cases.

If mnm\ge n, full rank means rank nn. The columns are linearly independent, and the nullity is 00.

If mnm\le n, full rank means rank mm. The columns span the whole output space FmF^m.

12.15 Rank and Solvability

The equation

Ax=b Ax=b

is solvable exactly when

bCol(A). b\in \operatorname{Col}(A).

Thus rank tells how large the set of reachable right-hand sides is.

If AA is m×nm\times n, then

Col(A)Fm. \operatorname{Col}(A)\subseteq F^m.

If

rank(A)=m, \operatorname{rank}(A)=m,

then

Col(A)=Fm. \operatorname{Col}(A)=F^m.

In that case, Ax=bAx=b has at least one solution for every bFmb\in F^m.

If

rank(A)<m, \operatorname{rank}(A)<m,

then some right-hand sides are unreachable.

12.16 Rank and Uniqueness

The equation

Ax=b Ax=b

has at most one solution exactly when the null space is trivial:

Null(A)={0}. \operatorname{Null}(A)=\{0\}.

This is equivalent to

nullity(A)=0. \operatorname{nullity}(A)=0.

By rank-nullity, for an m×nm\times n matrix this means

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

Thus the columns of AA must be linearly independent.

If the null space contains a nonzero vector vv, then any solution pp gives infinitely many solutions:

p+tv,tF. p+tv,\qquad t\in F.

12.17 Square Matrices

For an n×nn\times n matrix AA, the rank-nullity theorem becomes

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

The matrix is invertible exactly when

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

Equivalently,

nullity(A)=0. \operatorname{nullity}(A)=0.

Thus an invertible matrix has no nonzero vector in its null space.

A singular matrix has

rank(A)<n \operatorname{rank}(A)<n

and

nullity(A)>0. \operatorname{nullity}(A)>0.

It collapses at least one nonzero direction to zero.

12.18 Rank of a Product

If AA and BB are matrices with compatible sizes, then

rank(AB)rank(A) \operatorname{rank}(AB)\le \operatorname{rank}(A)

and

rank(AB)rank(B). \operatorname{rank}(AB)\le \operatorname{rank}(B).

Multiplication cannot create more independent output directions than either factor allows.

Geometrically, BB first restricts the possible intermediate outputs. Then AA acts on those outputs. The final image cannot have dimension larger than the image available after either step.

12.19 Rank and Transpose

The rank of a matrix equals the rank of its transpose:

rank(A)=rank(AT). \operatorname{rank}(A)=\operatorname{rank}(A^T).

This is another way to express equality of row rank and column rank. The columns of ATA^T are the rows of AA, and the rows of ATA^T are the columns of AA.

12.20 Geometric Meaning

Rank is the dimension of the output produced by a matrix.

Nullity is the dimension of the input directions that disappear.

For example, the matrix

A=[1000] A= \begin{bmatrix} 1&0\\ 0&0 \end{bmatrix}

maps

[xy] \begin{bmatrix} x\\ y \end{bmatrix}

to

[x0]. \begin{bmatrix} x\\ 0 \end{bmatrix}.

The image is the xx-axis, so

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

The null space is the yy-axis, because all vectors of the form

[0y] \begin{bmatrix} 0\\ y \end{bmatrix}

are sent to zero. Therefore

nullity(A)=1. \operatorname{nullity}(A)=1.

Since AA has two columns,

1+1=2. 1+1=2.

12.21 Common Mistakes

MistakeCorrection
Confusing rank with number of rowsRank is the number of pivots, not the number of rows
Confusing nullity with number of zero rowsNullity is the number of free variables in Ax=0Ax=0
Taking column-space basis from reduced columnsUse pivot positions to select columns from the original matrix
Forgetting that null space lives in FnF^nFor m×nm\times n, null vectors have nn entries
Forgetting that column space lives in FmF^mColumns have mm entries
Assuming rank changes under row operationsRow operations preserve rank

12.22 Summary

Rank and nullity describe how a matrix acts on its input space.

Rank measures the dimension of the image:

rank(A)=dimCol(A). \operatorname{rank}(A)=\dim \operatorname{Col}(A).

Nullity measures the dimension of the null space:

nullity(A)=dimNull(A). \operatorname{nullity}(A)=\dim \operatorname{Null}(A).

For an m×nm\times n matrix,

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

The main interpretations are:

QuantityMeaning
RankNumber of pivots
RankDimension of column space
RankDimension of row space
NullityNumber of free variables in Ax=0Ax=0
NullityDimension of null space
Rank + nullityNumber of input variables

Rank tells how many independent directions survive. Nullity tells how many independent directions vanish. Together they account for the whole input space.