Where We Are
Chapter 012 showed that a valid basis must do two things:
- reach every vector in the space,
- represent each vector uniquely.
Then we saw a failure case:
These vectors do not form a basis of the plane.
Why not?
They look like two vectors, but they only contain one independent direction.
That observation leads to three connected ideas:
- span,
- linear independence,
- rank.
1. The Problem: Counting Vectors Is Not Counting Information
Suppose we have
These give two independent directions.
Now add
We now have three vectors.
But did we gain a new direction?
No.
Because
So the third vector contains no new directional information.
Intuition — Three instructions do not necessarily mean three freedoms. One instruction may be completely predictable from the others.
2. Span: What Can These Vectors Build?
Take vectors
Their span is the set of every linear combination:
Read that as:
choose any coefficients, scale the vectors, add them; everything you can reach belongs to the span.
3. Span of One Vector
Let
Its span contains
All those points lie on one line through the origin.
So one nonzero vector spans a line.
4. Span of Two Nonparallel Vectors
Take
A general linear combination is
Since and can be any real numbers, every point in the plane is reachable.
Therefore
5. A Tempting Wrong Idea: “Two Vectors Always Span 2D”
Take
But
Any combination
becomes
So every result still lies on the same line.
A Tempting Wrong Idea
The number of vectors does not tell you the dimension of their span. What matters is how many independent directions they contribute.
6. Linear Independence
Vectors are linearly independent if none of them can be built from the others.
The formal test is:
must have only the trivial solution
If there is any nonzero combination that produces zero, the vectors are dependent.
7. Why the Zero-Combination Test Works
Suppose
with
Then rearrange:
So is built from the others.
That is dependence.
The test is not arbitrary—it encodes redundancy.
8. Example by Hand
Take
Suppose
Then
Second coordinate gives
Then first gives
Only trivial solution.
So the vectors are independent.
9. Matrices Turn This Into Rank
Put vectors into the columns of a matrix:
The column space of is exactly the span of its columns.
The number of independent columns is the rank.
10. Rank as Dimension of the Output Space
Consider
Its second column is twice the first.
So rank is 1.
Now apply it to
Then
Every output has equal coordinates.
So every output lies on the line
A 2D input space has been crushed onto a 1D line.
Rank counts the dimension that survives.
11. Full Rank
A square matrix has full rank if
Then its columns are independent.
For a square matrix, full rank implies the transformation does not collapse any direction completely.
This is exactly when an inverse exists.
So several ideas meet:
full rank
⇔ independent columns
⇔ no lost dimension
⇔ unique coordinates
⇔ inverse exists (for square matrices)
12. Why Information Loss Prevents Inversion
Take
Then
All y-information disappears.
For example,
all map to
From the output alone, there is no way to know which input was original.
No inverse can reconstruct destroyed information.
13. Null Space: Which Inputs Disappear?
The null space contains vectors sent to zero:
For
we need
So
while can be anything.
Thus the null space is the entire y-axis.
Those are exactly the directions the transformation destroys.
14. Rank–Nullity Intuition
For a transformation from an -dimensional input space,
Interpretation:
input dimensions
= dimensions that survive
+ dimensions that disappear
For the projection matrix above:
- input dimension = 2,
- rank = 1,
- nullity = 1.
So
This theorem makes information loss measurable.
15. Row Space and Column Space
A matrix contains two related geometric spaces.
Column space
All possible outputs .
Row space
The span of its row vectors.
Both have the same dimension:
That equality is one of linear algebra’s central structural facts.
For machine learning, the most intuitive view is often:
rank tells us how many independent output directions the matrix can express.
16. Rank and Data
Suppose a dataset has three features:
height_cm
height_m
weight_kg
But
The two height columns are redundant.
The dataset has three columns but fewer than three independent feature directions.
Rank exposes redundancy.
This matters for:
- regression,
- covariance matrices,
- PCA,
- numerical stability,
- compression.
17. Near Dependence: The Numerical Version of Trouble
Exact dependence is easy:
Real data is often almost dependent instead.
Example:
These are technically independent.
But they are nearly parallel.
Solving equations with such directions can be numerically unstable.
Later, singular values will quantify exactly how close a matrix is to losing a direction.
18. Shape Check
If
then
Why?
A matrix cannot have more independent columns than columns, nor more independent output directions than output dimensions.
For a (5×3) matrix:
For a (2×100) matrix:
19. Code and Verification
import numpy as np
A = np.array([
[1., 2.],
[1., 2.]
])
assert np.linalg.matrix_rank(A) == 1
B = np.array([
[1., 0.],
[0., 1.]
])
assert np.linalg.matrix_rank(B) == 2
Do not treat matrix_rank as magic.
The conceptual question is always:
how many genuinely independent directions remain?
20. Break It
Duplicate feature
Copy one dataset column. Rank should not increase.
Linear combination feature
Add a new feature equal to 2*x1 - 3*x2. The number of columns increases; rank may not.
Projection
Use a matrix that maps 3D points onto a plane. Observe rank drop from at most 3 to at most 2.
Almost duplicate feature
Add tiny noise to a duplicate column. Mathematically rank may become full, but numerical conditioning becomes poor.
This prepares us for SVD.
21. History Lens — Solving Equations Reveals Structure
Many ideas around rank emerged from studying systems of linear equations. Mathematicians needed to know when equations had unique solutions, infinitely many solutions, or contradictions.
The modern geometric interpretation is especially useful:
- independent directions carry new information,
- dependent directions repeat information,
- rank counts how much survives a transformation.
Machine learning repeatedly faces the same issue in datasets with redundant features and in low-dimensional representations.
22. Distinctions That Matter
| Pair | Difference |
|---|---|
| span vs independence | what vectors can build vs whether any vector is redundant |
| number of columns vs rank | stored vectors vs independent directions |
| rank vs nullity | surviving dimensions vs destroyed dimensions |
| column space vs null space | possible outputs vs inputs mapped to zero |
| exact dependence vs near dependence | algebraic redundancy vs numerical instability |
23. What We Discovered
- Span is everything reachable by linear combinations.
- Linear independence means no vector is redundant.
- Rank counts independent directions in a matrix.
- Column-space dimension equals rank.
- Rank deficiency means some dimensions are collapsed.
- Null space contains the directions destroyed by a transformation.
- Rank + nullity equals input dimension.
- Full-rank square matrices are invertible.
- Redundant data features reduce effective dimension.
- Near dependence motivates singular values and SVD.
24. One-Minute Explanation
Span tells us everything a set of vectors can build. Linear independence asks whether each vector adds a genuinely new direction. Rank counts how many independent directions a matrix contains or preserves. If rank drops, the matrix has collapsed some information; the directions that disappear live in the null space. A full-rank square matrix loses no dimension and can be inverted. These ideas explain why some coordinate systems fail and prepare us to study eigenvectors and singular values.
25. Mastery Check
- What is the span of one nonzero vector in 2D?
- Why can two vectors span only a line?
- State the linear-independence test.
- Why does a nontrivial zero combination imply dependence?
- What does rank measure geometrically?
- Why does rank deficiency imply information loss?
- What is the null space?
- Explain rank–nullity in plain English.
- Why can duplicated features fail to increase rank?
- What is the difference between exact and near dependence?
🔭 Bridge to Chapter 014
Rank tells us how many directions survive.
But some transformations have special directions that survive in an even stronger sense:
they do not turn at all—they only stretch, shrink, or flip.
Which directions does a transformation leave pointing along themselves?
That question leads to eigenvectors.