How do you compute PCA from the singular value decomposition (SVD) of the centred data matrix , how are the principal directions, variances and projected coordinates read off it, and why is the SVD route preferred in practice?
Unsupervised learning, Dimensionality reduction
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can connect the eigendecomposition of the covariance matrix to the SVD of the data matrix.
Key idea
The SVD writes , where and have orthonormal columns and is diagonal with singular values . Then . So the principal directions are the columns of , the variances are , and the projected coordinates (scores) are .
Steps
- Centre the data, , where is the vector of column means. PCA describes spread around the mean, so this step is essential.
- Take the thin SVD with and .
- Substitute: , because . This has exactly the form “eigenvectors times eigenvalues times eigenvectors transposed”. So has eigenvectors (columns of ) and eigenvalues .
- Scores: . Keep the first columns for a -dimensional projection. The fraction of variance kept is .
- Explain why SVD is preferred. Forming squares the condition number (a measure of numerical sensitivity), so small components lose precision. Truncated or randomised SVD is also cheaper when you only need the top components, or when is much larger than .
Common mistakes
- Skipping the centring. The first “component” then points towards the mean instead of along the spread.
- Mixing up the rows of and the columns of , or using as the principal directions. lives in sample space and holds scaled scores.
- Forgetting the when converting singular values into variances.
How long your answer should be
Half a page; about 4 minutes.
Last checked on 4 December 2026.
Read this
- Shlens (2014), A Tutorial on Principal Component Analysis: Section VI (A More General Solution Using SVD): shows the right singular vectors are the principal directions and singular values give the variances. Note that Shlens puts features in rows, so his transposes differ from the X_c (n x d) convention.
- Mathematics for Machine Learning (Deisenroth, Faisal, Ong): Free PDF. Section 10.4 (Eigenvector Computation and Low-Rank Approximations), pp. 333-335: PCA from the SVD of the data matrix, the Eckart-Young low-rank view, and practical numerical notes.
- NPTEL: Deep Learning, Part 1 (IIT Ropar, Prof. Sudarshan Iyengar; lectures by Prof. Mitesh M. Khapra): Week 5: Singular Value Decomposition and the PCA lectures, which connect the SVD of the data matrix to principal components.
Previous in Unsupervised learning: A 2-D dataset has two clusters: 50 points evenly spaced on a circle of radius 1 and 200 points evenly spaced on a circle of radius 5, both centred at the origin. (a) Can fuzzy c-means with separate the two rings? (b) Can DBSCAN, and which values of and MinPts work, which fail, and why?
Next in Unsupervised learning: How do you show that Ward's linkage, which merges the pair of clusters that least increases the total within-cluster sum of squares, has merge cost ? How do you check it on and ?