Backporch
Pillars · deep dive
← The pillars

The geometry of L²

One move ties the back half of statistics together: put an inner product on your random variables. Do that and covariance becomes an inner product, correlation becomes a cosine, the variance of a difference becomes the law of cosines — and standardization, whitening, Mahalanobis distance, PCA, and SVD all fall out as the same idea seen from different sides. The curse of dimensionality is what happens to that geometry when the room gets too big.

1 · Random variables are vectors

Center every variable (subtract its mean). Collect all the finite-variance random variables on a space into one set, , and equip it with an inner product:

It obeys every inner-product axiom — bilinear, symmetric, with — so is a Hilbert space and probability turns into geometry. For centered variables, that inner product is exactly the covariance:

2 · Covariance is the inner product; variance is squared length

Standard deviation is a length; covariance is the inner product between two directions. And the fundamental bound on correlation is nothing but Cauchy–Schwarz:

That one inequality is the entire reason .

3 · Correlation is a cosine; the law of cosines is variance

The angle between two centered variables is defined by

Pearson correlation is the cosine of the angle — and "cosine similarity" on centered data is exactly . Now apply the law of cosines, which holds in any inner-product space:

The variance-of-a-difference formula and the law of cosines are the same theorem. Uncorrelated () means orthogonal (), and then variances add like Pythagoras. Independence implies orthogonality; the converse fails, because the angle sees only second moments, never the whole joint law.

4 · Distance, standardization, whitening — all change of basis

Standardization is the one-dimensional move: rescale a variable to unit length.

Its multivariate twin is whitening — rotate and rescale a vector until its covariance is the identity:

That is a change of basis into a frame where the coordinates are uncorrelated and unit-variance. In that frame, plain Euclidean distance becomes Mahalanobis distance back in the original coordinates:

The covariance matrix is the metric. Euclidean distance trusts every direction equally; Mahalanobis trusts the directions the data actually varies in. Cosine distance throws away length entirely, keeping only the angle from section 3.

5 · The spectral theorem names the axes

The covariance matrix is symmetric and positive semidefinite, so the spectral theorem hands us an orthonormal eigenbasis:

The columns of are the principal axes — orthogonal directions of variation — and each is the variance along its axis. Whitening from section 4 is simply: rotate into the eigenbasis, divide each axis by its standard deviation, rotate back.

6 · PCA and SVD are the same decomposition

PCA is the eigendecomposition of : keep the eigenvectors with the largest eigenvalues and you keep the directions carrying the most variance. The fraction of variance a component explains is

SVD reaches the same place without ever forming . For a centered data matrix (rows are observations),

The right singular vectors are the principal axes, and the singular values satisfy. SVD is the numerically honest way to do PCA, and it extends the spectral theorem to non-square matrices.

7 · The curse of dimensionality is this geometry breaking down

Take two independent random vectors in . As , concentration of measure forces them to be nearly orthogonal:

Distances concentrate as well — nearest and farthest neighbors become almost equidistant, so "closeness" stops carrying information:

This is why dimension reduction is a necessity, not a convenience, and why the eigenbasis of section 5 matters: real data lives near a low-dimensional subspace, and PCA finds it. The spine closes its loop — the cosine that began as correlation is the same cosine that collapses in high dimension.

Study these — derivation cards

Not recall — reconstruction. Each prompt asks you to derive the link before you flip. Reveal only after you've tried it on paper. The same deck, formatted for spaced repetition, lives in the Obsidian vault.

Prompt 1 · tap to reveal
Define the inner product that turns centered random variables into a geometry. What are and ?
1 / 10