Skip to content
VidiMaster it, module by module
Module 1/Matrices

Rank & Nullity (Matrices)

Rank counts the independent directions a matrix produces (its pivots), while nullity counts the directions it collapses. The Rank–Nullity Theorem ties them together: for an m×nm\times n matrix, rank⁡(A)+nullity⁡(A)=n\operatorname{rank}(A)+\operatorname{nullity}(A)=n.

Before you start — give these a try

Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.

Find the rank of A=[12−124−236−3].A=\begin{bmatrix} 1 & 2 & -1 \\ 2 & 4 & -2 \\ 3 & 6 & -3 \end{bmatrix}.

Find the nullity of A=[112022410001].A=\begin{bmatrix} 1 & 1 & 2 & 0 \\ 2 & 2 & 4 & 1 \\ 0 & 0 & 0 & 1 \end{bmatrix}.

What you’ll be able to do

  • Define the rank and nullity of a matrix in terms of its reduced row echelon form (RREF).
  • Compute the rank and nullity of a small matrix by row reduction, counting pivot and free columns.
  • State and apply the Rank–Nullity Theorem rank⁡(A)+nullity⁡(A)=n\operatorname{rank}(A)+\operatorname{nullity}(A)=n to recover a missing quantity.
  • Explain why dim⁡(column space)=dim⁡(row space)=#pivots\dim(\text{column space})=\dim(\text{row space})=\#\text{pivots}.
  • Decide which rank/nullity combinations are possible for a matrix of a given size.

In your course

· MATH2015 · Linear Algebra & Probability
§4.5 The rank of a matrix
  • Definition 4.7Rank (max independent columns) and nullity =n−rank⁡=n-\operatorname{rank}
  • Theorem 4.5Image, kernel, rank and nullity of a matrix map
    For f(x)=Axf(x)=Ax with columns c1,…,cnc_1,\dots,c_n: im⁡(f)=span⁡{c1,…,cn}\operatorname{im}(f)=\operatorname{span}\{c_1,\dots,c_n\}, ker⁡(f)={x:Ax=0}\ker(f)=\{x:Ax=\mathbf 0\}, dim⁡im⁡(f)=rank⁡(A)\dim\operatorname{im}(f)=\operatorname{rank}(A), dim⁡ker⁡(f)=n−rank⁡(A)=nullity⁡(A)\dim\ker(f)=n-\operatorname{rank}(A)=\operatorname{nullity}(A).
  • Remark 4.4Rank–nullity in matrix form
    If AA is m×nm\times n, then rank⁡(A)+nullity⁡(A)=n\operatorname{rank}(A)+\operatorname{nullity}(A)=n.
  • Theorem 4.6 / Corollary 4.1Row rank = column rank, so rank⁡(A)=rank⁡(AT)\operatorname{rank}(A)=\operatorname{rank}(A^{\mathsf T})
1

Rank, intuitively: how many independent directions survive

Think of an m×nm\times n matrix AA as a machine that takes an input vector x∈Rn\mathbf{x}\in\mathbb{R}^{n} and produces an output Ax∈RmA\mathbf{x}\in\mathbb{R}^{m}. Here mm is the number of rows and nn is the number of columns.

The output AxA\mathbf{x} is always a combination of the columns of AA: Ax=x1 a1+x2 a2+⋯+xn an,A\mathbf{x}=x_1\,\mathbf{a}_1+x_2\,\mathbf{a}_2+\cdots+x_n\,\mathbf{a}_n, where aj\mathbf{a}_j is the jj-th column and xjx_j is the jj-th entry of x\mathbf{x}.

  • The set of all outputs {Ax}\{A\mathbf{x}\} is the column space Col⁡(A)\operatorname{Col}(A).
  • The rank of AA is the dimension of that column space: the number of genuinely independent directions the matrix can reach.

If some columns are redundant (a column is a combination of the others), they add no new direction, so the rank is smaller than nn. Rank measures how much "spread" the matrix has in its output.

2

RREF, pivots, and free columns

To measure rank concretely we use row reduction. Every matrix can be brought by elementary row operations to a unique reduced row echelon form (RREF), which looks like a staircase of leading 11s.

  • A pivot is a leading 11 in a nonzero row of the RREF; the column it sits in is a pivot column.
  • A free column is a column of the RREF with no pivot in it.

Two facts make this useful:

  1. Row operations do not change the row space, so the number of nonzero rows in RREF equals dim⁡(row space)\dim(\text{row space}).
  2. Row operations preserve the dependence relations among columns, so a column of AA is independent of the earlier ones exactly when it becomes a pivot column.

Consequently the number of pivots is the fundamental count: it equals both the number of independent rows and the number of independent columns.

3

Formal definitions: four counts that agree

Let AA be an m×nm\times n matrix and let RR be its RREF.

Rank. rank⁡(A)=#{pivots in R}=dim⁡Col⁡(A)=dim⁡Row⁡(A).\operatorname{rank}(A)=\#\{\text{pivots in }R\}=\dim\operatorname{Col}(A)=\dim\operatorname{Row}(A).

Null space. The null space is Null⁡(A)={x∈Rn:Ax=0}\operatorname{Null}(A)=\{\mathbf{x}\in\mathbb{R}^{n}:A\mathbf{x}=\mathbf{0}\}. When you solve Ax=0A\mathbf{x}=\mathbf{0}, each free column corresponds to a free variable you can choose arbitrarily.

Nullity. nullity⁡(A)=dim⁡Null⁡(A)=#{free columns in R}=#{free variables in Ax=0}.\operatorname{nullity}(A)=\dim\operatorname{Null}(A)=\#\{\text{free columns in }R\}=\#\{\text{free variables in }A\mathbf{x}=\mathbf{0}\}.

So rank counts the pivot columns and nullity counts the free columns. Since every one of the nn columns is either a pivot column or a free column (never both, never neither), the two counts must add up to nn.

4

The Rank–Nullity Theorem and how to use it

Because each of the nn columns is either a pivot column or a free column, we get the central identity: rank⁡(A)+nullity⁡(A)=n(n=#columns).\boxed{\operatorname{rank}(A)+\operatorname{nullity}(A)=n}\qquad(n=\#\text{columns}).

Reading it two ways.

  • Know the matrix size and the rank? Then nullity⁡(A)=n−rank⁡(A)\operatorname{nullity}(A)=n-\operatorname{rank}(A) with no extra work.
  • Know the nullity instead? Then rank⁡(A)=n−nullity⁡(A)\operatorname{rank}(A)=n-\operatorname{nullity}(A).

Useful bounds. Rank cannot exceed the number of rows or columns, so 0≤rank⁡(A)≤min⁡(m,n),hencenullity⁡(A)=n−rank⁡(A)≥n−min⁡(m,n).0\le\operatorname{rank}(A)\le\min(m,n),\qquad\text{hence}\qquad \operatorname{nullity}(A)=n-\operatorname{rank}(A)\ge n-\min(m,n). A square n×nn\times n matrix is invertible exactly when rank⁡(A)=n\operatorname{rank}(A)=n, i.e. when nullity⁡(A)=0\operatorname{nullity}(A)=0 (the only solution of Ax=0A\mathbf{x}=\mathbf{0} is x=0\mathbf{x}=\mathbf{0}).

Warning. The nn on the right-hand side is the number of columns, not rows. A common mistake is to add rank and nullity to the number of rows.

Rank–Nullity Theorem (matrix form)

For any m×nm\times n matrix AA, rank⁡(A)+nullity⁡(A)=n\operatorname{rank}(A)+\operatorname{nullity}(A)=n, where nn is the number of columns of AA.

Intuition. In the RREF every column is classified exactly once: it either holds a pivot (contributing to rank) or it is free (contributing to nullity). Adding the two counts just counts all nn columns, so the sum is forced to be nn.
Row Rank Equals Column Rank

For any matrix AA, dim⁡(row space of A)=dim⁡(column space of A)\dim(\text{row space of }A)=\dim(\text{column space of }A). This common value is rank⁡(A)\operatorname{rank}(A) and equals the number of pivots in the RREF of AA.

Intuition. Row operations leave the row space unchanged and preserve the linear-dependence relations among columns. The RREF therefore reveals exactly one pivot per independent row and per independent column, so the count of independent rows must match the count of independent columns.

Worked examples

Example 1

Find the rank and nullity of the 3×43\times4 matrix A=[121324041235].A=\begin{bmatrix} 1 & 2 & 1 & 3 \\ 2 & 4 & 0 & 4 \\ 1 & 2 & 3 & 5 \end{bmatrix}.

  1. 1

    First note the size: AA has m=3m=3 rows and n=4n=4 columns. By Rank–Nullity we will have rank⁡(A)+nullity⁡(A)=4\operatorname{rank}(A)+\operatorname{nullity}(A)=4, so once we find the rank the nullity is automatic.

  2. 2

    Use the first row as a pivot row and clear column 1 below it. Replace R2R_2 with R2−2R1R_2-2R_1: (2−2,  4−4,  0−2,  4−6)=(0,0,−2,−2)(2{-}2,\;4{-}4,\;0{-}2,\;4{-}6)=(0,0,-2,-2). Replace R3R_3 with R3−R1R_3-R_1: (1−1,  2−2,  3−1,  5−3)=(0,0,2,2)(1{-}1,\;2{-}2,\;3{-}1,\;5{-}3)=(0,0,2,2). The matrix becomes [121300−2−20022].\begin{bmatrix} 1 & 2 & 1 & 3 \\ 0 & 0 & -2 & -2 \\ 0 & 0 & 2 & 2 \end{bmatrix}.

  3. 3

    Column 2 has no available pivot (all remaining entries below the first row are 00 there), so move to column 3. Scale R2R_2 by −12-\tfrac12 to get a leading 11: R2=(0,0,1,1)R_2=(0,0,1,1). Then eliminate the 22 in R3R_3 with R3−2R2R_3-2R_2 — but more directly R3+R2R_3+R_2 using the un-scaled row gives (0,0,0,0)(0,0,0,0). After clearing, R3=(0,0,0,0)R_3=(0,0,0,0).

  4. 4

    Finally clear column 3 above the pivot: R1−1⋅R2=(1,2,1,3)−(0,0,1,1)=(1,2,0,2)R_1-1\cdot R_2 = (1,2,1,3)-(0,0,1,1)=(1,2,0,2). The RREF is R=[120200110000].R=\begin{bmatrix} 1 & 2 & 0 & 2 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}.

  5. 5

    Count pivots: there is a leading 11 in column 1 and in column 3 — that is 22 pivots. Hence rank⁡(A)=2\operatorname{rank}(A)=2. The pivot columns are {1,3}\{1,3\}; the free columns are {2,4}\{2,4\}, which is 22 columns, so nullity⁡(A)=2\operatorname{nullity}(A)=2.

  6. 6

    Check with the theorem: rank⁡+nullity⁡=2+2=4=n\operatorname{rank}+\operatorname{nullity}=2+2=4=n. ✓

Answer. rank⁡(A)=2\operatorname{rank}(A)=2 and nullity⁡(A)=2\operatorname{nullity}(A)=2.
Example 2

Find the rank and nullity of B=[132264−1−31].B=\begin{bmatrix} 1 & 3 & 2 \\ 2 & 6 & 4 \\ -1 & -3 & 1 \end{bmatrix}.

Example 3

Find the rank and nullity of C=[1234].C=\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}.