How do you compute PCA from the singular value decomposition (SVD) of the centred data matrix Xc∈Rn×d, 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 Xc=USV⊤, where U and V have orthonormal columns and S is diagonal with singular values s1≥s2≥⋯≥0. Then C=1n−1Xc⊤Xc=VS2n−1V⊤. So the principal directions are the columns of V, the variances are λj=sj2n−1, and the projected coordinates (scores) are XcV=US.

Steps

  1. Centre the data, Xc=X−1μ⊤, where μ is the vector of column means. PCA describes spread around the mean, so this step is essential.
  2. Take the thin SVD Xc=USV⊤ with U⊤U=I and V⊤V=I.
  3. Substitute: Xc⊤Xc=VSU⊤USV⊤=VS2V⊤, because U⊤U=I. This has exactly the form “eigenvectors times eigenvalues times eigenvectors transposed”. So C has eigenvectors vj (columns of V) and eigenvalues sj2/(n−1).
  4. Scores: Z=XcV=USV⊤V=US. Keep the first k columns for a k-dimensional projection. The fraction of variance kept is ∑j≤ksj2/∑jsj2.
  5. Explain why SVD is preferred. Forming Xc⊤Xc 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 k components, or when d is much larger than n.

Common mistakes

How long your answer should be

Half a page; about 4 minutes.

Last checked on 4 December 2026.

Read this

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 c=2 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 Δ(A,B)=nAnBnA+nB∥μA−μB∥2? How do you check it on A={0,2} and B={6}?