PCA finds the direction of maximum variance — but it doesn't know or care about class labels. Two clusters can overlap completely along PCA's favorite direction while sitting far apart along some other direction PCA never considers. What if you do have labels, and want the direction that best tells the classes apart?
Class B's mean never moves. Shrink its spread and watch the dashed projection axis rotate — and the separation score climb — purely because the classes have gotten individually tighter, not because they've moved any further apart.
Fisher's LDA looks for the direction that maximizes the ratio of between-class separation to within-class spread once every point is projected onto it:
- — the mean position of class A and class B.
- — the within-class scatter: how spread out each class is around its own mean, summed across both classes. Small means tight clusters.
- — inverting it means directions where the classes are naturally tight get amplified more than directions where they're naturally spread out.
- — the resulting direction: not just "toward the other class's mean," but rescaled by how reliable each axis is.
- Between-class scatter is the mean gap, squared
— large when the class means are far apart, independent of how tight or loose either cluster is.
- Without S_W^-1, this would just be PCA on the mean difference
Projecting onto the raw mean-difference vector alone ignores each class's own shape — a direction where both classes happen to be tightly packed is far more useful for separating them than a raw "toward the other mean" heading.
- A degenerate S_W (perfectly collinear class spread) breaks the inverse
If both classes' points fall on a single shared line, becomes singular and doesn't exist — the same failure mode ridge regression exists to patch, one chapter over.
The raw Euclidean distance between the two class means never changes as you move the slider — only class B's own spread does. Yet the LDA separation score moves a lot: distance between means alone isn't what makes classes separable, distance relative to how tight each class is does.
Class A: , mean . Class B: , mean .
- Within-class scatter for each class
Each class's scatter is the sum of over its points.
- Class A: deviations and . Both outer products give , summing to .
- Class B: deviations and . Both outer products give , summing to .
Summed: — a clean multiple of the identity, so .
- The mean-difference vector
.
- The LDA direction, and the resulting separation
. Projecting each point onto (raw dot product):
- Class A: and — mean
- Class B: and — mean
A gap of exactly , with each class landing tightly around its own mean.
Decrease class B's spread until the separation score climbs above 14 — without moving either class's mean at all.
LDA's direction isn't just "point from one class mean toward the other" — it's that heading, corrected by so that directions where the classes are naturally tight count for more than directions where they're naturally spread out. That's what makes it a classification-aware projection, where PCA is not.