Let S be a symmetric positive semi-definite matrix with eigenvalues λ1≥⋯≥λd. How do you prove that over all d×k matrices U with orthonormal columns, tr⁡(U⊤SU) is maximised by the top k eigenvectors, with maximum value λ1+⋯+λk (the Ky Fan theorem)? Why does this justify PCA with k components?

Unsupervised learning, Principal component analysis
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can prove the key extremal property that sits behind all multi-component PCA statements, not just the one-component case.

Key idea

Write tr⁡(U⊤SU)=∑jλjpj where pj=vj⊤UU⊤vj∈[0,1] and ∑jpj=k; a linear function with decreasing weights over this set is maximised by putting pj=1 on the first k indices.

Steps

  1. Diagonalise S=VΛV⊤ with orthonormal eigenvectors vj. Let P=UU⊤, an orthogonal projection of rank k. By the cyclic property of the trace, tr⁡(U⊤SU)=tr⁡(SP)=∑jλj vj⊤Pvj.
  2. Define pj=vj⊤Pvj=∥U⊤vj∥2. Since P is a projection, 0≤pj=∥Pvj∥2≤∥vj∥2=1.
  3. Also ∑jpj=tr⁡(V⊤PV)=tr⁡(P)=k.
  4. So we maximise ∑jλjpj subject to 0≤pj≤1 and ∑pj=k. Because λj is decreasing, the maximum puts all the weight on the largest values: p1=⋯=pk=1 and the rest 0.
  5. Formal check (exchange argument): ∑jλjpj−∑j≤kλj=∑j>kλjpj−∑j≤kλj(1−pj). Since ∑j>kpj=∑j≤k(1−pj), call this common value t≥0. The first sum is at most λk+1t, the second is at least λkt, so the difference is at most (λk+1−λk)t≤0.
  6. Equality holds when P projects onto the span of the top k eigenvectors (if λk>λk+1). So max⁡tr⁡(U⊤SU)=∑j≤kλj.
  7. This proves the k-component maximum-variance form of PCA directly, and, because the average squared reconstruction error of x↦UU⊤x is tr⁡S−tr⁡(U⊤SU) for centred data, it also proves the minimum-reconstruction-error form. A greedy approach (choose v1, then the best direction orthogonal to it) happens to reach the same answer, but it needs this argument to justify it.

Common mistakes

How long your answer should be

One page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Unsupervised learning: For whitened data z (zero mean, identity covariance), FastICA finds one independent component with the update w+=E[z(w⊤z)3]−3w followed by w←w+/∥w+∥. How do you derive this fixed-point rule from the kurtosis contrast F(w)=E[(w⊤z)4]−3 under ∥w∥=1 using Newton's method?
Next in Unsupervised learning: none