The Singular Value Decomposition and Applications (PCA, Covariance)
The factorization every matrix admits, and how it powers principal component analysis of asset returns.
Leads to: Low-rank approximation and PCA recur in statistical learning (Phase 11) and risk modeling (Phase 14).
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- State the singular value decomposition and relate singular values to eigenvalues of \(A^\top A\).
- Interpret the SVD geometrically as rotate–stretch–rotate.
- Derive PCA as the eigendecomposition of the covariance matrix (or SVD of centered data).
- Implement power iteration to extract the top eigenvector/principal component.
Key Vocabulary
- Singular value decomposition
- \(A=U\Sigma V^\top\) with orthogonal \(U,V\) and nonnegative diagonal \(\Sigma\).
- Singular value
- A diagonal entry \(\sigma_i\ge0\) of \(\Sigma\); \(\sigma_i=\sqrt{\lambda_i(A^\top A)}\).
- Principal component
- An eigenvector of the covariance matrix; a direction of maximal variance in the data.
- Explained variance
- The eigenvalue \(\lambda_i\) of \(\Sigma\), the variance captured by component \(i\).
- Low-rank approximation
- The best rank-\(k\) fit \(A_k=\sum_{i\le k}\sigma_i u_i v_i^\top\) (Eckart–Young).
- Power iteration
- Repeated multiplication \(x\leftarrow Ax/\lVert Ax\rVert\) converging to the dominant eigenvector.
Intuition & Motivation
The singular value decomposition
Geometrically \(A\) maps the unit sphere to an ellipsoid whose axes are the \(u_i\) with lengths \(\sigma_i\). The rank of \(A\) is the number of nonzero singular values, and \(\sigma_1=\max_{\lVert x\rVert=1}\lVert Ax\rVert\) is the operator (spectral) norm.
Best low-rank approximation
Truncating the SVD gives the optimal compression:
the Eckart–Young theorem. Keeping the top \(k\) singular triplets captures the most structure per unit of storage - the mathematics behind image compression, latent factor models, and denoising.
PCA from the covariance matrix
Let the rows of a centered data matrix \(X\) (\(N\) observations, \(d\) features) be demeaned returns. The sample covariance is \(\Sigma=\tfrac1{N-1}X^\top X\), symmetric PSD. Its spectral decomposition \(\Sigma=Q\Lambda Q^\top\) defines PCA:
- The eigenvectors \(q_i\) (columns of \(Q\)) are the principal components - orthogonal directions of decreasing variance.
- The eigenvalues \(\lambda_i\) are the variances along them; \(\lambda_i/\sum_j\lambda_j\) is the fraction of variance explained.
- Projecting data onto the top few components \(Z=XQ_k\) gives a low-dimensional summary retaining most variance.
Equivalently, PCA is the SVD of the centered data: \(X=U\Sigma V^\top\) gives principal components \(V\) and variances \(\sigma_i^2/(N-1)\) - numerically preferable to forming \(X^\top X\) (Phase 5).
Interactive: power iteration for the top component
- Confusing singular values with eigenvalues of \(A\); singular values are \(\sqrt{\lambda(A^\top A)}\) and are always nonnegative.
- Running PCA on un-centered (or un-scaled) data - PCA needs demeaned columns, and standardization matters when units differ.
- Interpreting the largest principal component as ‘the most important asset’; it is a direction (a portfolio), not a single asset.
- Forgetting power iteration finds only the dominant eigenvector; deflation or a full solver is needed for the rest.
- Prefer the SVD of centered data over eigendecomposing \(X^\top X\) - it avoids squaring the condition number.
- The scree plot of \(\lambda_i\) (or \(\sigma_i^2\)) shows how many factors to keep; a few usually explain most variance in returns.
- Power iteration converges at rate \((\lambda_2/\lambda_1)^k\) - fast when the top eigenvalue is well-separated.
Knowledge Check
Practical Exercise
A centered return matrix has sample covariance \(\Sigma=\begin{bmatrix}4&2\\2&4\end{bmatrix}\). (a) Find the principal components and their explained-variance fractions. (b) If you keep only the first PC, what fraction of total variance is retained, and what is the interpretation?
(a) Eigenvalues from \(\lambda^2-8\lambda+12=0\): \(\lambda=6,2\) (trace 8, det 12 check out). Eigenvectors \(q_1=(1,1)/\sqrt2\) for \(\lambda_1=6\) and \(q_2=(1,-1)/\sqrt2\) for \(\lambda_2=2\). Explained fractions \(6/8=75\%\) and \(2/8=25\%\).
(b) Keeping PC1 retains \(75\%\) of total variance. Interpretation: a single common factor - the equally-weighted combination \((1,1)/\sqrt2\) - drives three-quarters of the joint variability of the two assets; the remaining \(25\%\) is the idiosyncratic spread between them. This is the one-factor reduction underlying factor risk models.
Lesson Summary
Formula Sheet Additions
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: The singular values of A are the nonnegative square roots of the eigenvalues of A^T A (equivalently AA^T).
A: Eigendecompose the (centered-data) covariance Σ=QΛQ^T: eigenvectors are principal components, eigenvalues are variances, and λ_i/Σλ_j is the explained-variance fraction.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check
Source References
This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.
- Numerical Linear Algebra (Trefethen & Bau, SIAM, 1997) foundational - Lec. 4-5 - Lec. 4-5: the singular value decomposition, geometry, and low-rank approximation.
- The Elements of Statistical Learning (Hastie, Tibshirani & Friedman, 2nd ed.) current - Ch. 14 - Ch. 14: principal components analysis and its link to the SVD of the data matrix.