advanced practice · coding problem

PCA variance explained

2D data with cov matrix [[4,3],[3,9]]. Eigenvalues are 10 and 3. What fraction of variance do the top 1 and top 2 components explain? Why center before PCA?

The mechanism

PCA finds an orthogonal basis ordered by variance. Top-k projection is the best k-dimensional summary in squared-error sense. Center first.

Study PCA & Projection

Expected evidence

PC1: 10/13≈77%; both: 100%. Centering removes the mean offset so variance is spread, not dominated by the origin.

Try this drill in the practice workspace →

Hints when you need them
  • Variance explained = λ_i / Σλ.
  • Uncentered PCA chases the mean.

Watch for these mistakes

  • PCA on uncentered data
  • Components without domain meaning
  • PCA for prediction without care

Check the sources

Browse all practice briefs