Projections and the Principal Component Analysis
Math 123: Mathematical Aspects of Data Analysis – Fall 2026
Recap
Last time we proved the Eckart-Young theorem in both the spectral and Frobenius norms, then set up the geometric problem: for centered data, find the subspace of dimension at most \(k\) that best fits the point cloud. We stopped right after recalling orthogonal projection, so we restate the definition and its properties here before picking the thread back up.
We also carry over the standing notation from last time: \(\bfX\in\Rbb^{n\times d}\) is the centered data matrix, \(r=\operatorname{rank}(\bfX)\leq\min\{n,d\}\), and \[ \bfX=\bfU_r\Sigma_r\bfV_r^\top=\sum_{j=1}^r\sigma_j\bfu_j\bfv_j^\top, \qquad \sigma_1\geq\cdots\geq\sigma_r>0, \] with \(\bfu_j\in\Rbb^n\) and \(\bfv_j\in\Rbb^d\), \(\bfV_k=[\bfv_1\ \cdots\ \bfv_k]\in\Rbb^{d\times k}\), \(\bfU_k=[\bfu_1\ \cdots\ \bfu_k]\in\Rbb^{n\times k}\), and \(\bfX_k=\sum_{j=1}^k\sigma_j\bfu_j\bfv_j^\top\) for the truncated SVD of \(\bfX\).
The best-fitting subspace
Among all subspaces of dimension at most \(k\), which one passes closest to the point cloud, measuring “close” by total squared distance?
Each term is the squared distance from the centered observation to the subspace (Proposition 1, part 3), so \(\Ecal(S)\) is exactly the total squared distance from the data to \(S\).
We can write the above definition in the following (familiar!) matrix form.
Proof. Row \(i\) of \(\bfX\bfP_S\) is \((\bfx_i-\bar{\bfx})^\top\bfP_S=(\bfP_S(\bfx_i-\bar{\bfx}))^\top\), using \(\bfP_S^\top=\bfP_S\). The squared Frobenius norm of a matrix is the sum of the squared norms of its rows (the Frobenius norm sums the squared entries, which we group by row), so \(\|\bfX-\bfX\bfP_S\|_F^2\) is exactly the sum defining \(\Ecal(S)\). Finally \(\bfX\bfP_S=(\bfX\bfW)\bfW^\top\) is a product with an inner dimension of \(k\), so its rank is at most \(k\).
The geometric problem is now a rank-constrained matrix approximation problem, and we know the answer to those! Enter Eckart-Young:
Proof. For the identity, use \(\bfX\bfv_j=\sigma_j\bfu_j\) (building the left singular vectors): \[ \bfX\bfV_k\bfV_k^\top =\sum_{j=1}^k(\bfX\bfv_j)\bfv_j^\top =\sum_{j=1}^k\sigma_j\bfu_j\bfv_j^\top =\bfX_k. \] For the lower bound, let \(S\) be any subspace with \(\dim S\leq k\). By Proposition 2, \(\bfX\bfP_S\) has rank at most \(\dim S\leq k\), so \(\bfX\bfP_S\) is a competitor in the minimization of Eckart-Young theorem, Frobenius norm and \[ \Ecal(S)=\|\bfX-\bfX\bfP_S\|_F^2\geq\|\bfX-\bfX_k\|_F^2=\sum_{j=k+1}^r\sigma_j^2. \] The choice \(S=S_k\) turns this inequality into an equality, by the identity just proved.
Note, Eckart-Young minimizes over all rank-\(k\) matrices, a larger set than the projections \(\bfX\bfP_S\), and the winner happens to be a projection. That is what lets a theorem about matrix approximation answer a question about geometry.
Principal component analysis
By Theorem 1, PCA is not just a \(k\)-dimensional summary of the data; it is a best one in squared reconstruction error, and it is computed by a single SVD.
Some authors call \(\bfv_j\) the \(j\)-th principal component, others reserve that name for the scores \(\bfX\bfv_j\), and software splits the difference (sklearn’s components_ are the \(\bfv_j\), while fit_transform returns the scores). We will say principal direction for \(\bfv_j\in\Rbb^d\) and score for the coordinates, and you should check the convention whenever you read someone else’s statement. Note also that principal directions are only determined up to sign, and not determined at all when singular values tie.
The variance interpretation
Proof. Apply Proposition 1, part 4, to each centered observation: \[ \|\bfx_i-\bar{\bfx}\|_2^2 =\|\bfP_S(\bfx_i-\bar{\bfx})\|_2^2+\|(\bfx_i-\bar{\bfx})-\bfP_S(\bfx_i-\bar{\bfx})\|_2^2. \] Sum over \(i\) and divide by \(n\). The last claim is Theorem 1 plus \(\|\bfX_k\|_F^2=\sum_{j\leq k}\sigma_j^2\).
So the principal directions can be described in two equivalent ways: minimize the distance you throw away, or keep as much spread as you can. Proposition 3 says these are equivalent.
Take \(k=2\) (or \(k=3\)) in Definition 3, so the projection is onto the principal subspace \(S_2=\operatorname{span}\{\bfv_1,\bfv_2\}\) (or \(S_3=\operatorname{span}\{\bfv_1,\bfv_2,\bfv_3\}\)). By Theorem 1 this is the plane (or 3D subspace) that loses the least squared distance, which by Proposition 3 is the one that keeps the most spread.
The object you plot is the score matrix \[ \bfZ=\bfX\bfV_k=\bfU_k\Sigma_k\in\Rbb^{n\times k}, \qquad k\in\{2,3\}, \] so row \(i\) is the point \(\bfz_i=\bfV_k^\top(\bfx_i-\bar{\bfx})\in\Rbb^2\) (or \(\Rbb^3\)), one dot per observation, with horizontal coordinate \(\bfv_1^\top(\bfx_i-\bar{\bfx})\), vertical coordinate \(\bfv_2^\top(\bfx_i-\bar{\bfx})\), and, in 3D, depth \(\bfv_3^\top(\bfx_i-\bar{\bfx})\).
Be careful not to confuse this with the projected data \(\bfX\bfV_k\bfV_k^\top=\bfX_k\in\Rbb^{n\times d}\). Its rows are the same projected points, but written in the original \(d\) coordinates, so they still live in \(\Rbb^d\) and cannot be drawn directly. The \(k\times d\) matrix \(\bfV_k^\top\) is what maps each centered observation to plotting coordinates.
Note, nothing is distorted inside the subspace! Since \(\bfV_k\) has orthonormal columns, \(\|\bfV_k\bfz_i-\bfV_k\bfz_j\|_2=\|\bfz_i-\bfz_j\|_2\), so distances in the plot are exactly the distances between the projected points. What you do lose is everything perpendicular to \(S_k\), and the explained variance ratio \(R_2\) or \(R_3\) (Definition 5) tells you how much of the spread the picture shows. If it is small, points that look close in the plot may be far apart in \(\Rbb^d\).