Skip to content
ML to LLMs
Labs / Classical ML

Find the first principal component

Rotate a projection axis over a 2D cloud and see variance kept versus thrown away.

Theory and worked examples: PCA, t-SNE, and UMAP

Find the first principal component

Synthetic, centered 2D data. Rotate the axis: PCA picks the direction that keeps the most variance when you project onto it.

Projecting points onto an axis-4-2024-4-2024feature 1 (centered)feature 2 (centered)
your axisPC1lost distance
Variance kept as the axis rotates0501001500123angle (°)variance

Variance along direction u is uᵀCu. Its maximum is λ₁ at PC1; its minimum is λ₂, 90° away.

Kept + lost always equals the total (1.960 + 1.254 = 3.214). Maximizing the variance you keep is the same as minimizing the squared distances you throw away.

Rotate toward the long axis of the cloud. The teal share rises until the axis lines up with PC1, the eigenvector with the largest eigenvalue.