Rank, Dimension & the Rank-Nullity Theorem
2283 words
11 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# Rank, Dimension & the Rank-Nullity Theorem ## ๐ฏ Learning Objectives After this topic you will be able to: - Compute the rank of a matrix using Gaussian elimination - Find the nullity of a matrix - State and apply the rank-nullity theorem - Relate rank to the dimension of the column space - Use rank to determine p...

Rank, Dimension & the Rank-Nullity Theorem
๐ฏ Learning Objectives
After this topic you will be able to:
- Compute the rank of a matrix using Gaussian elimination
- Find the nullity of a matrix
- State and apply the rank-nullity theorem
- Relate rank to the dimension of the column space
- Use rank to determine properties of linear systems
๐ Prerequisites
- Gaussian Elimination (Week 2) โ finding pivots and RREF
- Basis & Dimension (this week) โ dimension of a vector space
- Subspaces (Week 3) โ null space and column space
1. Intuition: Counting Independent Directions
The rank of a matrix answers the question: how many independent directions does this matrix capture?
If you have a 3ร5 matrix, its columns live in R3. The rank tells you whether the columns span:
- A line (rank 1)
- A plane (rank 2)
- All of R3 (rank 3) The nullity tells you the opposite: how many directions in the domain get crushed to zero. (Diagram) The rank-nullity theorem says: rank(A)+nullity(A)=numberย ofย columns. It's a conservation law: every column either contributes to the output (rank) or gets crushed (nullity).
2. Rank of a Matrix
2.1 Definition
rank(A)=dim(C(A))=dim(R(A))=#pivotsDefinition (Rank). The rank of a matrix A is:
- The number of non-zero rows in its RREF
- Equivalently, the number of pivot columns
- Equivalently, the dimension of the column space C(A)
- Equivalently, the dimension of the row space
2.2 Computing Rank
The simplest way: row reduce and count pivots.
>A=โ123โ246โ3710โ134โโ>Example 1: Computing rank
>โ123โ246โ3710โ134โโR2โโ2R1โ,R3โโ3R1โโโ100โ200โ311โ111โโR3โโR2โโโ100โ200โ310โ110โโ>Row reduce:
Two non-zero rows: rank(A)=2.
2.3 Properties of Rank
| Property | Explanation |
|---|---|
| 0โคrank(A)โคmin(m,n) | Cannot exceed number of rows or columns |
| rank(AT)=rank(A) | Row space = column space of transpose |
| rank(AB)โคmin(rank(A),rank(B)) | Composition can't increase rank |
| rank(A+B)โคrank(A)+rank(B) | Subadditivity |
| rank(A)=n for Anรnโ invertible | Full rank means invertible |
3. Nullity
3.1 Definition
>nullity(A)=dim(N(A))>Definition (Nullity). The nullity of a matrix A is the dimension of the null space N(A):
Nullity = number of free variables in the solution of Ax=0. Nullity = number of columns without a pivot.
>A=โ100โ200โ310โ110โโ>Example 2: Computing nullityFor
(RREF from Example 1):Pivots in columns 1 and 3. Free variables: columns 2 and 4. nullity(A)=2.Check: A has 4 columns. Rank = 2. 2+2=4 โ (rank-nullity).
4. The Rank-Nullity Theorem
>rank(A)+nullity(A)=n>Theorem (Rank-Nullity). For an mรn matrix A:
where n is the number of columns of A. Proof SketchRow reduce A to RREF. Let r=rank(A) = number of pivot columns. Then there are nโr non-pivot columns, each corresponding to a free variable. The null space has dimension nโr (each free variable contributes one basis vector). So nullity(A)=nโr=nโrank(A). Rearranging gives rank(A)+nullity(A)=n. Example 3: Applying rank-nullityA is 5ร7 with rank 3. Find nullity.nullity(A)=7โ3=4.The null space is a 4-dimensional subspace of R7.
4.1 Consequences
| Situation | What rank-nullity tells us |
|---|---|
| Square nรn , invertible | rank=n , nullity=0 โ unique solution to Ax=b |
| Square nรn , singular | rank0 โ either 0 or โ solutions |
| More columns than rows ( m<n ) | nullityโฅnโm>0 โ always non-trivial null space |
| More rows than columns ( m>n ) | rankโคn , nullity could be 0 |
5. Finding Bases for Row Space, Column Space, Null Space
5.1 Row Space Basis
Row reduce to RREF. The non-zero rows of the RREF form a basis for the row space.
>A=โ121โ242โ130โโRREFโโ100โ200โ010โโ>Example 4: Row space basis
Basis for row space: {(1,2,0),(0,0,1)}.
5.2 Column Space Basis
The original columns corresponding to pivot columns form a basis for the column space.
Example 5: Column space basisSame A as above. Pivot columns are 1 and 3. Original columns: {(1,2,1),(1,3,0)} form a basis for C(A).
5.3 Null Space Basis
Solve Ax=0, express in parametric form. The vectors multiplying the free parameters form a basis.
>A=[10โ20โ00โ]>Example 6: Null space basis
>A=[10โ20โโ11โ01โ]>Actually let's use a better example.
>โx1โx2โx3โx4โโโ=x2โโโ2100โโ+x4โโโ10โ11โโ>(RREF).Pivots in columns 1 and 3. Free variables: x2โ, x4โ.x1โ=โ2x2โ+x3โ=โ2x2โโ(โx4โ)=โ2x2โ+x4โ? Wait, let's solve properly:From RREF: x1โ+2x2โโx3โ=0, x3โ+x4โ=0. From row 2: x3โ=โx4โ. From row 1: x1โ=โ2x2โ+x3โ=โ2x2โโx4โ.Free: x2โ,x4โ.
Basis for N(A): {(โ2,1,0,0),(โ1,0,โ1,1)}. Nullity = 2.
6. Full Column Rank vs. Full Row Rank
| Type | Condition | Properties |
|---|---|---|
| Full column rank | rank(A)=n (number of columns) | Columns are independent; N(A)={0} |
| Full row rank | rank(A)=m (number of rows) | Rows are independent; C(A)=Rm |
| Full rank (square) | rank(A)=m=n | Invertible matrix |
>A=โ101โ011โโ>Example 7: Full column rank
is 3ร2. Row reduce shows pivots in both columns. rank(A)=2=n. Nullity = 2โ2=0. N(A)={0}.
7. Edge Cases & Gotchas
| Situation | What Happens |
|---|---|
| Zero matrix | rank=0 , nullity=n |
| Identity matrix | rank=n , nullity=0 |
| ** A is mรn with m<n ** | rankโคm0 (always has non-trivial null space) |
| Rank of a product | rank(AB)โคmin(rank(A),rank(B)) |
8. Common Pitfalls
โ Pitfall 1: Confusing rank with number of rows
Rank is the dimension of the column space, not the number of rows. A 5ร3 matrix can have rank at most 3, not 5.
โ Pitfall 2: Forgetting rank-nullity applies to columns
Students sometimes use number of rows instead of columns. rank(A)+nullity(A)=n (columns), not m.
โ Pitfall 3: Taking RREF rows as column space basis
The RREF rows are a basis for the row space, not the column space. For the column space, use original pivot columns.
9. Formula Summary Table
| Concept | Formula | Notes |
|---|---|---|
| Rank | #pivots=dim(C(A)) | 0โคrankโคmin(m,n) |
| Nullity | dim(N(A)) | Number of free variables |
| Rank-Nullity | rank(A)+nullity(A)=n | n = number of columns |
| Full column rank | rank(A)=n | N(A)={0} |
| Full row rank | rank(A)=m | C(A)=Rm |
| Invertible (square) | rank(A)=n | Aโ1 exists |
10. ๐ Practice Questions
>A=โ100โ110โ011โโ>Q1: Find rank from RREF
>A=โ121โ242โ363โ484โโ>This is already in REF with 3 pivots. rank(A)=3. Q2: Rank and nullity
>โ100โ200โ300โ400โโ>Solution: Rows 1 and 3 are identical; row 2 is 2ร row 1. RREF:
>A=[10โ10โ01โ12โ]>. Rank = 1, Nullity = 4โ1=3. Q3: Rank-Nullity applicationIf A is 3ร5 with rank 2, what are the dimensions of N(A) and C(A)?Solution: dim(C(A))=rank(A)=2. nullity(A)=5โ2=3. N(A) is a 3-dim subspace of R5, C(A) is a 2-dim subspace of R3. Q4: Finding null space basisFind a basis for N(A) where
>โx1โx2โx3โx4โโโ=x2โโโ1100โโ+x4โโโ10โ21โโ>.Solution: Already in RREF. Pivots in columns 1, 3. Free: columns 2, 4.Row 1: x1โ+x2โ+x4โ=0โx1โ=โx2โโx4โ Row 2: x3โ+2x4โ=0โx3โ=โ2x4โ
>A=โ123โ24kโโ>Basis: {(โ1,1,0,0),(โ1,0,โ2,1)}. Q5: Full row rankFor what k does
>โ123โ24kโโR2โโ2R1โ,R3โโ3R1โโโ100โ20kโ6โโ>have full row rank?Solution: Full row rank means rank(A)=3 (number of rows). But A is 3ร2, so max rank is min(3,2)=2. It's impossible for a 3ร2 matrix to have rank 3.The question should be: when does it have full column rank?Row reduce:
If k๎ =6, there are 2 pivots โ rank 2 (full column rank). If k=6, rank 1. Q6: Rank of a productIf A is 3ร4 with rank 2 and B is 4ร2 with rank 2, what can you say about rank(AB)?Solution: rank(AB)โคmin(rank(A),rank(B))=min(2,2)=2.Also, rank(AB)โคmin(3,2)=2 (dimensions of AB are 3ร2).So rank(AB)โค2. It could be 0, 1, or 2. Q7: Rank from determinantIf A is 4ร4 with det(A)=0, what is the maximum possible rank?Solution: det(A)=0 means A is singular, so rank(A)<4. The maximum possible rank is 3. Q8: Invertibility and rankIf A is 5ร5 with rank(A)=5, what is nullity(A)? Is A invertible?Solution: nullity(A)=5โ5=0. Yes, A is invertible (full rank square matrix). Q9: Row space dimensionIf A is 7ร4 with rank 3, what is the dimension of the row space?Solution: dim(rowย space)=rank(A)=3. Q10: Rank of transposeIf A is 5ร3 with rank 2, what is rank(AT)?Solution: rank(AT)=rank(A)=2.
๐ Cross-References
- Next topic: Null Space & Column Space
- Week 5 (Linear Transformations): Rank-nullity generalizes to linear transformations
- Week 6 (Kernel & Image): Kernel = null space, image = column space
- Week 11 (Hessian): The Hessian matrix's rank determines if a critical point is degenerate
- BSCS2004 (ML Foundations): Low-rank approximations, PCA, dimensionality reduction Join Discord Previous4.1 Basis & DimensionNext5.1 Null Space & Column Space