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=1232463710134>Example 1: Computing rank
>1232463710134R2−2R1,R3−3R1100200311111R3−R2100200310110>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=100200310110>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=121242130RREF100200010>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=[102000]>Example 6: Null space basis
>A=[1020−1101]>Actually let's use a better example.
>x1x2x3x4=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=101011>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=100110011>Q1: Find rank from RREF
>A=121242363484>This is already in REF with 3 pivots. rank(A)=3. Q2: Rank and nullity
>100200300400>Solution: Rows 1 and 3 are identical; row 2 is 2× row 1. RREF:
>A=[10100112]>. 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
>x1x2x3x4=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=12324k>Basis: {(−1,1,0,0),(−1,0,−2,1)}. Q5: Full row rankFor what k does
>12324kR2−2R1,R3−3R110020k−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