PCA’s maximum-variance and minimum-error definitions choose the same subspace; the projection geometry explains why, and the algebra connects both to truncated SVD.
When we replace a measurement table with fewer coordinates, we want to know what those coordinates preserve. The six formulations answer that question for a fixed matrix; centring and scaling determine which matrix we have asked them to summarize.
Equivalence
The proof first relates the objectives for any admissible basis, then finds their optimizers. We fix centring, feature scaling, and a complete matrix throughout.
Covariance and normalization
The sample covariance of centred \(X\) is
\[
S = \frac{X^\top X}{n-1} \in \mathbb{R}^{d \times d},
\]
The denominator \(n-1\) accounts for estimating the column means. Switching to the maximum-likelihood convention \(X^\top X/n\) multiplies every eigenvalue by \((n-1)/n\); it changes neither eigenvectors nor explained-variance ratios.
\(S\) is symmetric positive semi-definite, so it has an orthonormal eigenbasis with non-negative eigenvalues:
\[
S = V\Lambda V^\top, \qquad \Lambda = \operatorname{diag}(\lambda_1 \ge \dots \ge \lambda_d \ge 0).
\]
The principal directions are the leading columns of \(V\), and \(\lambda_j\) is the variance of the data along direction \(v_j\) — set \(W = v_j\) in the trace objective and read it off. Because \(\operatorname{tr}(S) = \sum_j \lambda_j\) is the total variance across all \(d\) features, \(\lambda_j / \sum_i \lambda_i\) is the fraction of variance explained by component \(j\).
From reconstruction to energy
\(P = WW^\top\) is an orthogonal projector: \(P^\top = P\), and \(P^2 = WW^\top WW^\top = W(W^\top W)W^\top = WW^\top = P\) because \(W^\top W = I_k\). Expand the reconstruction error:
\[
\|X - XP\|_F^2
= \operatorname{tr}\!\left[(X - XP)^\top (X - XP)\right]
= \operatorname{tr}(X^\top X) - 2\operatorname{tr}(X^\top X P) + \operatorname{tr}(P X^\top X P).
\]
The last term collapses. Using the cyclic property of the trace and \(P^2 = P\),
\[
\operatorname{tr}(PX^\top XP) = \operatorname{tr}(X^\top X P P) = \operatorname{tr}(X^\top X P),
\]
so two of the three terms cancel into one:
\[
\|X - XWW^\top\|_F^2 = \operatorname{tr}(X^\top X) - \operatorname{tr}(X^\top X WW^\top) = \|X\|_F^2 - \|XW\|_F^2 .
\]
The last equality is the same cyclic move: \(\operatorname{tr}(X^\top X WW^\top) = \operatorname{tr}(W^\top X^\top X W) = \|XW\|_F^2\).
This is the Pythagorean split. Every observation’s squared length divides into the part the subspace keeps and the part it loses, with no cross term. And \(\|X\|_F^2\) does not contain \(W\):
\[
\min_{W^\top W = I} \|X - XWW^\top\|_F^2
\iff
\max_{W^\top W = I} \|XW\|_F^2 .
\]
Fitting the data as closely as possible and capturing as much energy as possible are the same instruction, because the two quantities sum to a constant.
From energy to variance
One line, already used in Section 4.2:
\[
\|XW\|_F^2 = \operatorname{tr}\!\left[(XW)^\top(XW)\right] = \operatorname{tr}(W^\top X^\top X W) = (n-1)\operatorname{tr}(W^\top S W).
\]
\(W^\top X^\top X W\) is the \(k \times k\) covariance of the scores, up to the factor \(n-1\). Its trace is the total projected variance. So maximum energy is maximum projected variance, and the \((n-1)\) never affects the maximiser.
Stationary directions
Nothing so far mentioned eigenvectors. They arrive as the solution of a constrained maximisation, and the constraint is what puts them there.
Maximising \(w^\top A w\) with \(A = X^\top X\) has no answer on its own: scale \(w\) up and the objective grows without bound. The constraint \(w^\top w = 1\) is what makes the problem well posed, and a constrained stationary point is found by Lagrange multipliers — add the constraint to the objective with an unknown coefficient, then look for a point where the combined function is flat in every direction:
\[
\mathcal{L}(w, \lambda) = w^\top A w - \lambda\,(w^\top w - 1).
\]
Differentiating in \(w\) and setting the gradient to zero gives
\[
\nabla_w \mathcal{L} = 2Aw - 2\lambda w = 0
\qquad \Longleftrightarrow \qquad
Aw = \lambda w .
\]
The eigenvector equation is the first-order condition. It was not assumed, and no eigendecomposition was invoked to get it: every stationary point of projected variance on the unit sphere is an eigenvector of \(X^\top X\), and nothing else is.
The multiplier is not bookkeeping either. At a stationary point,
\[
w^\top A w = w^\top (\lambda w) = \lambda\,w^\top w = \lambda ,
\]
so \(\lambda\) is the value of the objective there — the projected energy, and \(\lambda/(n-1)\) the projected variance. With distinct eigenvalues there are \(d\) stationary directions, each with two unit-vector signs. Repeated eigenvalues admit every unit vector in the corresponding eigenspace; comparing their objective values selects the largest eigenvalue. That is Rayleigh–Ritz, derived rather than quoted.
For \(k\) components the constraint \(W^\top W = I_k\) is \(k(k+1)/2\) scalar equations, so the multiplier is a symmetric \(k \times k\) matrix \(\Lambda\):
\[
\mathcal{L}(W, \Lambda) = \operatorname{tr}(W^\top A W) - \operatorname{tr}\!\left[\Lambda (W^\top W - I_k)\right],
\qquad
\nabla_W \mathcal{L} = 2AW - 2W\Lambda = 0 .
\]
So \(AW = W\Lambda\). A stationary \(W\) need not hold eigenvectors — but \(\Lambda\) is symmetric, so \(\Lambda = RDR^\top\) for an orthogonal \(R\), and \(\widetilde W = WR\) satisfies \(A\widetilde W = \widetilde W D\). Its columns are eigenvectors, and it spans the same subspace as \(W\).
For the subspace optimization, the stationarity condition pins the subspace, and leaves the basis inside it free up to the orthogonal \(R\) that diagonalises the multiplier.
The maximizing subspace
Stationarity gives \(k\) eigenvectors; it does not say which \(k\). For that, take \(A\) symmetric with eigenvalues \(\lambda_1 \ge \dots \ge \lambda_d\) and ask what maximises \(\operatorname{tr}(W^\top A W)\) over \(W^\top W = I_k\).
Write \(A = V\Lambda V^\top\) and set \(M = V^\top W\), which satisfies \(M^\top M = I_k\). Then
\[
\operatorname{tr}(W^\top A W) = \operatorname{tr}(M^\top \Lambda M) = \sum_{j=1}^{d} \lambda_j \, c_j,
\qquad c_j = \sum_{l=1}^{k} M_{jl}^2 .
\]
The weights \(c_j\) are constrained: each \(c_j \in [0, 1]\) because \(M\) has orthonormal columns, and \(\sum_j c_j = \|M\|_F^2 = k\). Maximising a weighted sum of the \(\lambda_j\) under “budget \(k\), at most \(1\) each” puts all of the budget on the \(k\) largest eigenvalues. The maximum is \(\lambda_1 + \dots + \lambda_k\), attained when \(W\) spans the leading \(k\) eigenvectors. That is the Ky Fan theorem, and at \(k = 1\) it is Rayleigh–Ritz.
Applied to \(A = X^\top X\): the maximiser is \(W = V_k\), the leading eigenvectors of \(X^\top X\), which are the leading eigenvectors of \(S\).
SVD and rank approximation
For the thin SVD \(X = U\Sigma V^\top\), let \(r=\min(n,d)\), so \(U\) is \(n\times r\), \(V\) is \(d\times r\), and \(\Sigma\) holds the \(r\) singular values. Zero singular values are included when \(X\) has smaller rank.
\[
X^\top X = V\Sigma^2V^\top,
\qquad \lambda_j(S)=\frac{\sigma_j^2}{n-1}.
\]
The right singular vectors provide the covariance eigenvectors represented by the thin decomposition. When \(d>n\), a full covariance eigenbasis also contains \(d-n\) additional null-space directions.
At the optimum, the scores and reconstruction are
\[
Z=XV_k=U_k\Sigma_k,\qquad
\hat X=XV_kV_k^\top=U_k\Sigma_kV_k^\top.
\]
The Eckart–Young–Mirsky theorem says this reconstruction also minimizes \(\|X-B\|_F^2\) over all matrices \(B\) of rank at most \(k\). Its error is \(\sum_{j>k}\sigma_j^2\); the theorem joins the subspace problem to the broader matrix-approximation problem.
Direct SVD avoids forming \(X^\top X\), which squares the ratio of largest to smallest nonzero singular value. It also avoids storing a \(d\times d\) covariance matrix when the data are wide; the SVD companion develops the numerical argument.
The chain
For every \(W\) satisfying \(W^\top W=I_k\),
\[
\boxed{\|X-XWW^\top\|_F^2
=\|X\|_F^2-\|XW\|_F^2
=\|X\|_F^2-(n-1)\operatorname{tr}(W^\top S W).}
\]
These are identities between objective values. Rayleigh–Ritz and Ky Fan identify a maximizing subspace, and Eckart–Young–Mirsky identifies a best rank-\(k\) reconstruction.
- \(W=V_k\) is an optimizer; so is \(V_kR\) for any orthogonal \(k\times k\) matrix \(R\).
- Conventional PCA chooses ordered eigenvectors, giving uncorrelated scores with covariance \(\operatorname{diag}(\lambda_1,\ldots,\lambda_k)\).
- An arbitrary rotation within the retained subspace preserves its projector and reconstruction, but generally makes the score covariance nondiagonal. It is an optimal subspace basis without necessarily being a set of principal axes.
Equivalence, uniqueness, and stability
These are separate guarantees:
| Do the objectives agree? |
A complete, fixed matrix, orthogonal projection, and squared Frobenius error give the projector identity. Column centring supplies the variance interpretation. |
| Is the optimal subspace unique? |
A strict boundary gap \(\lambda_k>\lambda_{k+1}\) fixes the leading \(k\)-dimensional subspace. A positive tie across the boundary permits multiple optimal subspaces and reconstructions; the objective equivalence still holds. |
| Are individual axes unique? |
Distinct eigenvalues fix eigenvector directions up to sign. Ties permit rotations inside the tied eigenspace. |
| Is the estimated subspace stable? |
A small boundary gap relative to sampling or measurement perturbations can make it unstable, even when the sample optimizer is unique. Resampling evaluates sensitivity to a specified sampling process. |
If \(k\) reaches the data rank, reconstruction is \(X\) itself. Adding directions from the null space can make the chosen basis or subspace nonunique while the reconstruction stays fixed.