Finding the Principal Subspace
Page 1003 settled the coordinates and left one term standing: , with no in it. §10.3.3 minimises that over bases — and the book’s own summary of where it ends up is worth reading before the derivation:
Therefore, we omit a derivation that is identical to the one presented in Section 10.2.
Two chapters’ worth of setup, two genuinely different objectives, and the same eigenvectors. This page shows why that had to happen, and what it costs to choose otherwise.
What you’ll learn
Section titled “What you’ll learn”- Equations 10.41–10.43b: four rewritings that turn a sum of squared norms into — each step using exactly one property, and every form measured to agree within .
- Equation 10.44, , and the one-line reason it forces the top- eigenvectors: you are choosing which eigenvalues to pay, so you discard the cheapest.
- The conservation law nobody states: for every and every orthonormal — measured constant to . §10.2 and §10.3 are one optimisation with two signs.
- Whether the eigenbasis is genuinely optimal, tested rather than assumed: random orthonormal bases, zero of them better, best one worse by ; and an L-BFGS search over that lands back on the same subspace to — with a different basis.
- Why that last distinction matters: rotating by any orthogonal leaves exactly unchanged while moving the codes by . §10.7’s Equation 10.78 will call this ambiguity by name.
- The one thing only the eigenbasis gives you: a code whose components are uncorrelated — measured largest off-diagonal covariance against after a rotation.
Intuition: you are not choosing what to keep, you are choosing what to pay
Section titled “Intuition: you are not choosing what to keep, you are choosing what to pay”The trick of §10.3.3 is a change of viewpoint that Equation 10.38 already set up. The reconstruction error is built entirely from the directions you discarded — so write the objective in terms of those.
Once you do, the answer is arithmetic. Each discarded direction contributes its eigenvalue to the bill. Sixty-four eigenvalues, choose of them to pay: take the small ones.
flowchart TD A["J_M = average of ||sum over j>M of (b_j'x_n) b_j||^2
Equation 10.41"] A -->|"ONB kills the cross terms"| B["= average of sum over j>M of (b_j'x_n)^2
Equation 10.42a"] B -->|"b'x x'b, then swap the sums"| C["= sum over j>M of b_j' S b_j
Equation 10.43a"] C -->|"trace is linear and cyclic"| D["= trace of (projector onto U-perp) times S
Equation 10.43b"] D -->|"choose the cheapest D-M eigenvalues"| E["= sum over j>M of lambda_j
Equation 10.44"]
§10.3.3 The four moves
Section titled “§10.3.3 The four moves”Starting from Equation 10.38b, the displacement expanded in the discarded basis vectors:
Move one — expand the squared norm. The are orthonormal, so every cross term with is zero and the double sum collapses to a single one:
Move two — a scalar is its own transpose. , which introduces the outer product:
Move three — swap the sums. The do not depend on , so the average over falls onto the outer products and appears:
Move four — the trace. A scalar equals its own trace, and the trace is cyclic:
Minimizing the average squared reconstruction error is therefore equivalent to minimizing the projection of the data covariance matrix onto the orthogonal complement of the principal subspace. Equivalently, we maximize the variance of the projection that we retain in the principal subspace.
Every form, measured on the digit-”8” data:
| Eq 10.29 | Eq 10.41 | Eq 10.43a | Eq 10.43b | Eq 10.44 | |
|---|---|---|---|---|---|
Largest spread within any row, across all from to : .
Equation 10.44, and why the choice is forced
Section titled “Equation 10.44, and why the choice is forced”Minimising Equation 10.43b over orthonormal is minimising over the discarded directions — the same Rayleigh-quotient problem §10.2 solved, with the sign flipped. The stationary points are eigenvectors, and:
To minimize (10.44) we need to select the smallest eigenvalues, which then implies that their corresponding eigenvectors are the basis of the orthogonal complement of the principal subspace.
Which five of the eigenvectors you keep, measured:
| kept directions | |
|---|---|
| the top (Equation 10.44) | |
| every th () | |
| five from the middle (–) | |
| the bottom |
The last row is exactly — those five eigenvalues are the machine zeros from page 1001’s dead border pixels, so keeping them keeps nothing. You have built a five-dimensional subspace that stores no information at all, and the code is five numbers of noise.
What the objective can and cannot see
Section titled “What the objective can and cannot see”depends on only through . So for any orthogonal , , and the error cannot tell the two apart:
| basis for the same -dimensional span | ||
|---|---|---|
| the eigenvectors themselves | ||
| rotated by a random , draw | ||
| rotated by a random , draw | ||
| rotated by a random , draw | ||
| rotated by a random , draw |
Example 10.3, in two dimensions
Section titled “Example 10.3, in two dimensions”The book embeds MNIST’s “0”s and “1”s in the first two principal components and observes “a relatively clear separation” plus “the variation within the set of ‘0’ is significantly greater than the variation within the set of ‘1’.”
Worth noting what that does not mean. The labels were never used. PCA found the directions of greatest spread across all the images, and the classes happened to separate along them because “0” or “1” is a large part of what varies. When the dominant variation is something else — lighting, rotation, stroke width — the same two components will separate on that instead, and the classes will overlap. That is the difference between an unsupervised method and a supervised one, and Chapter 12 takes the other road.
-
Which property makes the cross terms vanish when Equation 10.41's squared norm is expanded?
Each of the four moves spends exactly one property: orthonormality collapses the double sum, a scalar equalling its own transpose introduces the outer product, independence of n lets the sums swap so S appears, and the trace being linear and cyclic gives Equation 10.43b. Measured, all five forms agree to 2.8e-13.
pch.quizShowAnswer
B — Orthonormality of the basis vectors — b_j-transpose b_k is zero for j not equal to k — Each of the four moves spends exactly one property: orthonormality collapses the double sum, a scalar equalling its own transpose introduces the outer product, independence of n lets the sums swap so S appears, and the trace being linear and cyclic gives Equation 10.43b. Measured, all five forms agree to 2.8e-13.
-
Why must the DISCARDED directions be the ones with the smallest eigenvalues?
Equation 10.44 makes the choice arithmetic. Measured at M = 5: keeping the top five costs 320.123369, five from the middle costs 725.666168, and keeping the bottom five costs 741.158872 — exactly the trace, because those eigenvalues are machine zero. That last subspace is five dimensions that store nothing.
pch.quizShowAnswer
B — Because J_M is the sum of the eigenvalues of the directions you discard, so you discard the cheapest — Equation 10.44 makes the choice arithmetic. Measured at M = 5: keeping the top five costs 320.123369, five from the middle costs 725.666168, and keeping the bottom five costs 741.158872 — exactly the trace, because those eigenvalues are machine zero. That last subspace is five dimensions that store nothing.
-
What is V_M + J_M, for any M and any orthonormal B?
The two projectors sum to the identity, so the two traces sum to the trace of S. That is why Sections 10.2 and 10.3 are one optimisation read from either end, and why the book can omit the second derivation entirely.
pch.quizShowAnswer
B — Always the trace of S — measured constant at 741.158872 to within 2.3e-13 — The two projectors sum to the identity, so the two traces sum to the trace of S. That is why Sections 10.2 and 10.3 are one optimisation read from either end, and why the book can omit the second derivation entirely.
-
You rotate B by an orthogonal M-by-M matrix R. What changes?
Measured: J_M stays at 320.123369 and B B-transpose matches to 1.1e-16, while the codes differ by 39.243537 with their norms preserved to 1.1e-14. The rotated code's covariance has off-diagonals up to 37.046852 against 5.1e-14 for the eigenbasis. Section 10.7's Equation 10.78 names this ambiguity, and Section 10.8 says it is why ICA exists.
pch.quizShowAnswer
B — Nothing about the error or the reconstructions; the codes change completely and stop being uncorrelated — Measured: J_M stays at 320.123369 and B B-transpose matches to 1.1e-16, while the codes differ by 39.243537 with their norms preserved to 1.1e-14. The rotated code's covariance has off-diagonals up to 37.046852 against 5.1e-14 for the eigenbasis. Section 10.7's Equation 10.78 names this ambiguity, and Section 10.8 says it is why ICA exists.
Exercises
Section titled “Exercises”Exercise 1 – From a sum of squares to a trace
Section titled “Exercise 1 – From a sum of squares to a trace”Exercise 2 – The conservation law
Section titled “Exercise 2 – The conservation law”Exercise 3 – Can any other subspace beat it?
Section titled “Exercise 3 – Can any other subspace beat it?”Exercise 4 – The error cannot see the basis
Section titled “Exercise 4 – The error cannot see the basis”Exercise 5 – What the rotation destroys
Section titled “Exercise 5 – What the rotation destroys”Recall card
Section titled “Recall card”- Section 10.3.3 rewrites the reconstruction error four times and lands on a trace: the projection of the data covariance onto the orthogonal complement of the subspace you kept.
- Each rewriting spends exactly one property — orthonormality, a scalar equalling its transpose, independence of the data index, and the trace being linear and cyclic. None of them touches the data.
- All five forms of the error agree to 2.8e-13 across every code length from one to sixty-three.
- Equation 10.44 makes the choice arithmetic: the error is the sum of the eigenvalues of the directions you discard, so you discard the smallest ones.
- Keeping the five cheapest eigenvectors instead costs the entire trace, because those eigenvalues are machine zero — five dimensions that store nothing.
- The variance kept and the variance lost always sum to the trace of S, measured constant to 2.3e-13. Sections 10.2 and 10.3 are one optimisation read from opposite ends.
- Two hundred thousand random orthonormal bases, and none of them beats the eigenbasis. The best is worse by 304.302698.
- A numerical optimiser over the basis finds the same subspace to 2.0e-07 and a different basis, differing by 0.351661 — which is the ambiguity the next sections name.
- Rotating the basis by any orthogonal matrix leaves the error exactly unchanged, because the objective depends on B B-transpose alone.
- But it changes the codes by 39.243537 while preserving their norms, and destroys the two properties the eigenbasis happens to add: sorted per-component variances, and uncorrelated components.
- Those extra properties were never optimised for. Equation 10.78 states the ambiguity formally, and Section 10.8 says it is why independent component analysis exists.
- Example 10.3’s class separation used no labels. PCA finds the directions of greatest spread; the classes separate only when the class is what varies most.
Next: Eigenvector Computation and Low-Rank Approximations — §10.4 connects the eigendecomposition to the SVD, and asks how you would compute any of this at scale.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading