Where We Are
A matrix can transform space.
But most vectors change direction when a matrix acts on them.
What if we could find a special direction that doesn’t turn — it only gets stretched or shrunk?
Are there directions a transformation leaves pointing the same way?
Next → Eigenvectors.
1. The Problem: One Direction Refused to Move
Chapter 4 left an observation dangling. Apply the shear to a few vectors and watch what happens to their directions:
Almost everything tilts. But:
Nothing. That direction came out exactly as it went in.
The scaling matrix does the same thing twice over — it leaves both axes pointing where they were and merely changes their lengths, one by a factor of 2 and the other by 3. Meanwhile a 90° rotation leaves nothing pointing where it started.
So matrices differ in a way Chapter 4 never captured. Some directions are special to a particular matrix: it acts on them by pure stretching, with no turning at all.
Why care? Because a transformation described as “stretch by 2 along this direction and by 3 along that one” is about as simple as a transformation can get. If every matrix could be described that way, matrices would stop being mysterious.
2. What Would an Answer Need?
We want a method that, given any matrix:
- Finds the special directions, if there are any.
- Reports the stretch factor for each one.
- Tells us honestly when there are none — the rotation must not produce a fake answer.
- Lets us rebuild the matrix from those directions, so the description is complete rather than partial.
3. First Attempt: Try Every Direction
The obvious method: take a vector, apply the matrix, check whether the output points the same way. Rotate the input a little and repeat.
This is Chapter 4 §3’s mistake again: there are infinitely many directions, and sampling them can only ever suggest an answer, never prove one. Worse, it would silently miss a special direction that happens to fall between our samples.
A Tempting Wrong Idea
“Search numerically until the output is close enough to parallel.”
“Close to parallel” is not a property a direction either has or lacks — it depends on your tolerance. And the question is exact: either is a multiple of or it is not. Stop searching and write the condition down as an equation.
4. The Discovery: Write the Question as an Equation
State the requirement in symbols. We want a vector whose image is a scalar multiple of itself:
That is the whole definition. is an eigenvector — a direction the matrix does not turn. (lambda) is its eigenvalue — the factor it gets stretched by. Eigen is German for “own” or “characteristic”: these are the matrix’s own directions.
One exclusion: satisfies the equation for every and tells us nothing, so eigenvectors are required to be non-zero.
Now solve it. Move everything to one side — but carefully, because is a matrix and is a number, so is nonsense. Insert the identity matrix to fix the types:
Read what this says: the matrix sends the non-zero vector to the origin. Chapter 4 §8 gave that a name — is in the null space — and told us exactly when a non-trivial null space exists:
This is the characteristic equation, and it is a polynomial in alone. The infinite search of §3 has become finding the roots of a polynomial.
The whole move was refusing to hunt and instead writing the requirement as an equation. Chapter 4’s determinant then converted “a direction survives” into “this number is zero.”
History Lens — Euler, Cauchy, and a German Prefix
The idea arrived through physics, not algebra. In the 1750s Leonhard Euler, studying how rigid bodies rotate, found that every rotation of a solid body has an axis — a line that stays put while everything else turns. That is an eigenvector, three-quarters of a century before anyone wrote .
In the 1820s Augustin-Louis Cauchy, working on quadratic forms and the “principal axes” of surfaces, produced the characteristic equation in essentially the form above and proved that symmetric matrices always have real roots — the fact that makes §10’s PCA work at all.
The name came last. Mathematicians called them “proper values” or “characteristic values” for decades; David Hilbert used Eigenwert in the early 1900s, and when the German literature was translated the prefix survived untranslated. So “eigenvalue” is a half-translated word — and its meaning, the matrix’s own value, is exactly right.
5. Doing It by Hand
Take a matrix small enough to solve completely:
Step 1 — build .
Step 2 — set its determinant to zero. Using from Chapter 4 §7:
Step 3 — expand and solve.
Step 4 — find each direction. For , solve :
So any vector along works. Both rows gave the same equation — that is the determinant being zero, showing up as a redundant row.
For : , giving the direction .
Step 5 — check.
The entire behaviour of on the whole plane is now one sentence: stretch by 3 along the diagonal , and leave the anti-diagonal alone.
Note that eigenvectors have no natural length — and are equally valid. Only the direction is determined, so we usually normalize to length 1.
6. When There Is No Answer
Requirement 3 said the method must fail honestly. Test it on the two awkward cases from §1.
The shear :
Solving gives — only the direction . A repeated root, but just one eigenvector direction instead of two. Such matrices are called defective, and they cannot be rebuilt from their eigenvectors alone. Our §1 observation was right: the shear has exactly one special direction.
The rotation :
No real solutions. And that is exactly correct — a 90° rotation turns every direction, so there is no real direction it leaves alone. The mathematics did not invent a fake answer; it reported the truth.
Precision, not false simplicity. Over the complex numbers , and those complex eigenvalues encode the rotation angle — genuinely useful in signal processing and in analysing recurrent networks (Chapter 40). But over the real plane, where our houses and pixels live, the honest answer is: none.
7. Diagonalization: Rebuilding the Matrix
Requirement 4 said the description should let us rebuild . Put the eigenvectors in the columns of a matrix and the eigenvalues down the diagonal of :
Then
For our matrix, , and multiplying out gives back exactly.
Read it right to left, as Chapter 4 §9 taught, and it tells a story in three acts:
| translate | rewrite the vector in eigenvector coordinates | |
| stretch | scale each of those coordinates by its eigenvalue — the easy part | |
| translate back | express the result in ordinary coordinates again |
Intuition — Every diagonalizable matrix is secretly just a scaling. It only looks complicated because we insist on describing it in the wrong coordinate system. Change to the matrix’s own axes and all it does is stretch.
8. Why This Is Powerful: Repeated Application
Here is where eigenvalues stop being a curiosity. Suppose you need — apply the transformation ten times. Direct multiplication is nine matrix products. With diagonalization:
The inner cancels, and the pattern continues:
And is trivial, because powering a diagonal matrix just powers each diagonal entry. For our :
Now look at what happened to the two eigenvalues. ; . After ten applications, the direction is 59,049 times more important than the other. Apply it a hundred times and the second direction is numerically invisible.
This single observation explains a startling amount of deep learning:
- Repeatedly applying a matrix drives everything toward its dominant eigenvector. That is why the power-iteration experiment in the notebook converges.
- If eigenvalues exceed 1, repeated application explodes; if they are below 1, it vanishes. That is precisely the exploding/vanishing gradient problem of Chapters 39–40, and the reason LSTMs were invented.
- Chapter 4’s Level-4 exercise asked what happens to the determinant of a long chain of matrices. This is the answer: products of eigenvalues, compounding.
9. Every Matrix, Not Just Square Ones: the SVD
Eigenvectors have two limitations. They need a square matrix — our data matrix is , so does not even typecheck — and §6 showed some square matrices are defective anyway.
The fix is the singular value decomposition, which works for every matrix without exception:
Read right to left again: rotates, stretches along the new axes (its diagonal entries are the singular values), and rotates again. So:
Every matrix, whatever its shape, is a rotation, then a stretch, then another rotation. That is all any linear map has ever been.
For our four-house matrix , the singular values are
and that ratio should look familiar. Chapter 2 §10 found the loss landscape of this data had a condition number of about 3.6 million and was untrainable. Here is where that number came from:
The condition number of the loss surface is the square of the ratio of the data’s singular values. Chapter 2 measured the symptom; this is the cause.
Because the singular values are ordered, keeping only the largest few gives the best possible approximation of using less information — the basis of image compression, recommender systems, and the low-rank adapters (LoRA) of Chapter 116.
10. 🔬 The Experiment: Finding the Axes of Real Data
Our four houses are four points in a plane. They are not scattered randomly — Chapter 2 §9 hinted that bigger houses have more rooms and more area. If that is true, the cloud of points has a natural long axis, and eigenvectors should find it.
That is principal component analysis: take the covariance matrix of the data and compute its eigenvectors. The dominant one is the direction of greatest variation.
Predict before reading on. Run PCA on rooms (values 2–4) and area (values 800–1600) as they are. Which direction comes out as “most important” — and is that a discovery about houses, or about units?
Run it on the raw data and the first component explains 100.00% of the variance, pointing almost exactly along the area axis.
That is not a finding about houses. Area is measured in numbers ~400× larger than rooms, and variance is measured in squared units, so area’s variance is ~140,000× larger. PCA on unscaled data simply finds whichever feature has the biggest units. It is Chapter 2 §10’s lesson in a new costume: scale controls geometry.
Standardize both features first — subtract the mean, divide by the standard deviation — and repeat. The covariance matrix becomes the correlation matrix:
whose eigenvalues are and , with eigenvectors and .
Now the answer means something:
- PC1 — rooms and area rising together. Call it overall size. It explains of the variation.
- PC2 — rooms up while area goes down. Call it cramped versus spacious. The remaining 14.9%.
Two measured features, and the data really lives along roughly one direction. That is what dimensionality reduction means, and it is why Chapter 146 can talk about a “1000-dimensional” representation that actually occupies far fewer directions.
11. How It Breaks
| Failure | What it looks like | Why |
|---|---|---|
| Defective matrix | fewer eigenvectors than dimensions | Repeated root with only one direction. Cannot diagonalize. §6 |
| Complex eigenvalues | no real answer | The matrix rotates. Correct, not a bug. §6 |
| PCA on unscaled data | the largest-unit feature “explains everything” | §10. Standardize first. |
| Eigenvalues near 1 in a chain | explode or vanish over many steps | compounds. §8, and Chapters 39–40 |
| Tiny | numerically unstable inverses | is the condition number. §9 |
| Reading eigenvectors as causes | confident nonsense | PC1 is the direction of most variance, which need not correspond to any real mechanism. |
12. 🎯 Machine Learning Connection
| Eigen-idea | Where it shows up |
|---|---|
| dominant eigenvalue of repeated maps | exploding/vanishing gradients (Ch 39–40) |
| condition number | why feature scaling decides trainability (Ch 2, 33) |
| eigenvalues of the loss Hessian | curvature, and the stability limit (Ch 1, 8, 32) |
| PCA | dimensionality reduction, whitening, visualizing representations (Ch 46) |
| low-rank approximation | compression, and LoRA fine-tuning (Ch 53) |
| spectral properties of weight matrices | measuring what a trained network has learned (Ch 56) |
The stability threshold from Chapter 1 was an eigenvalue all along. We wrote without being able to say what was; now you know — it is the largest eigenvalue of the loss surface’s curvature, the steepest direction of the valley.
13. Distinctions That Matter
| Eigenvector — a direction unturned | Eigenvalue — how much that direction is stretched |
| Eigen-decomposition — square matrices, may fail | SVD — every matrix, always exists |
| Eigenvalues of | Singular values of — are eigenvalues of |
| Diagonalizable — a full set of eigenvectors | Defective — fewer than the dimension |
| Variance explained — a statistical fact | Cause — not implied by any of this |
| Rank (Ch 4) — how many directions survive | Effective rank — how many have non-negligible |
14. What We Discovered
- Some directions come out of a transformation pointing exactly where they went in, stretched but unturned.
- Searching for them is hopeless; writing and applying Chapter 4’s determinant turns the search into a polynomial.
- Solving that polynomial gives the stretch factors; the null space of gives the directions.
- Not every matrix cooperates — shears are defective, rotations have no real eigenvectors, and the mathematics says so honestly.
- When it does work, says every such matrix is just a scaling, seen from the wrong coordinates.
- Powers become trivial, and the dominant eigenvalue takes over exponentially — which is exactly why gradients explode or vanish.
- The SVD extends all of it to every matrix: rotate, stretch, rotate.
- The condition number that made Chapter 2’s data untrainable is the square of the ratio of its singular values.
- PCA is eigenvectors applied to covariance — and on unscaled data it merely finds the biggest units.
15. Mathematics We Built
16. What Each Symbol Means
| Symbol | English | In code |
|---|---|---|
| eigenvalue — the stretch factor | eigvals | |
| eigenvector — the unturned direction | eigvecs[:, i] | |
| identity — leaves everything alone | np.eye(n) | |
| “this direction survives” | np.linalg.eig(A) | |
| eigenvectors as columns | eigvecs | |
| eigenvalues on the diagonal | np.diag(eigvals) | |
| singular value | np.linalg.svd(A)[1] | |
| condition number | np.linalg.cond(A) | |
| PC1 | direction of greatest variance | top eigenvector of the covariance |
17. One-Minute Explanation
With no equations:
A transformation turns almost every arrow. What is special about the few it does not turn, and why does that make applying the transformation a thousand times easy?
18. Exercises
Level 1 — Observe. Chapter 4’s four transformations were scale, rotate, shear and project. Without calculating, say how many real eigenvector directions each one has, and what the eigenvalues should be. Then check one prediction: what must the eigenvalues of a projection be, given that applying it twice is the same as applying it once?
Level 2 — Calculate (by hand). Find the eigenvalues and eigenvectors of . Verify each by computing and checking it is . Then confirm two shortcuts on your answers: the eigenvalues should sum to the trace , and multiply to . Why must those hold?
Level 3 — Derive. Prove that if then , then extend it to . Use it to prove that if every , then for every starting — and explain in one sentence what that means for a 50-layer network whose weight matrices all have small eigenvalues.
Level 4 — Investigate (notebook Steps 8–11). Start from a random vector and apply repeatedly, normalizing each time. Which direction does it converge to, and how many steps does it take? Then rerun with . Convergence becomes dramatically slower — explain why using the ratio .
Level 5 — Design. You have a image and can store only 50 numbers per row. Using §9, design a compression scheme: what do you keep, what do you discard, and how do you reconstruct? Estimate the compression ratio. Then state the harder part — what kind of image would your scheme handle beautifully, and what kind would it ruin?
19. Common Mistakes
| Mistake | Why it is wrong |
|---|---|
| “Every matrix has eigenvectors.” | Defective matrices do not. §6 |
| “No real eigenvalues means I made an arithmetic error.” | It usually means the matrix rotates. §6 |
| “Eigenvectors have a specific length.” | Only the direction is determined; any non-zero multiple is the same eigenvector. §5 |
| “Eigenvalues and singular values are the same.” | Equal only for symmetric positive-definite matrices. are eigenvalues of . §9 |
| “PC1 is the most important variable.” | It is a combination of variables, in the direction of most variance — and on unscaled data, of the largest unit. §10 |
| “PCA tells me what causes what.” | It describes spread, not mechanism. §11 |
20. Socratic Questions
- The trace of a matrix equals the sum of its eigenvalues and the determinant equals their product. What does that say about a matrix with a zero eigenvalue — and how does it connect to Chapter 4 §8?
- A symmetric matrix always has real eigenvalues and perpendicular eigenvectors. Covariance matrices are always symmetric. Is that a lucky coincidence for PCA, or is it forced by what covariance means?
- If repeatedly applying a matrix drives every vector toward the dominant eigenvector, what does that suggest about what a very deep network does to its inputs before we add activations?
- Eigenvalues of the loss Hessian set the stability limit . What would you do if were enormous but were tiny — is one learning rate ever enough? (Chapter 32 is the answer.)
- The SVD says every matrix is rotate–stretch–rotate. Where did the “shear” from Chapter 4 §6 go? It is not a rotation and not a scaling.
- PCA found that our houses vary mostly along one direction. If you kept only PC1, what exactly would you lose about house C — and could you tell you had lost it?
21. 🔭 Bridge to Chapter 018
Part I is finished. We can now say what a number, a list, a table and a transformation are, and we have taken a matrix apart to see the directions it is built around.
Every one of those tools describes structure that sits still. A vector is at a place. A matrix sends a point somewhere. An eigenvector is a direction that stays.
But Chapter 1 did not need any of that. It needed something else entirely, and we faked it. When we asked “which way should I nudge to reduce the loss?”, we computed the loss at two nearby values, took a difference, divided by the gap, and watched what happened as the gap shrank to nothing. We called the result a slope and moved on, promising to come back.
That promise is due. The quantity we invented is not about where things are — it is about how fast one thing changes when another thing moves, measured at a single instant. None of Part I can express that.
What does it mean to measure a rate of change at a single point, where nothing has had a chance to change yet?
That is where Chapter 018 begins, and it makes Chapter 1’s borrowed compass rigorous at last.