Data Space
PC1: —
PC2: —
Total: —
Variance Captured
PC1
0%
PC2
0%
Cov
0
Combined
0%
PCA Explorer
Drag the axis handles to rotate your own principal components and watch how the captured variance changes. PCA finds the directions that maximize variance — can you find them by hand?
Interactions
- Drag axis handles (circles at arrow tips) to rotate
- Click canvas to add data points
- Snap to PCA animates to the optimal directions
- Lock orthogonal keeps axes perpendicular
- Watch the variance bars — PCA maximizes Axis 1
What to Notice
- The optimal PC1 aligns with the covariance ellipse’s long axis
- Projection lines are shortest when axes align with PCA
- Uncorrelated data has equal variance in all directions
- The ghost lines show where the true PCs are
PCA Steps
- Center the data by subtracting the mean
- Compute the 2×2 covariance matrix
- Eigendecompose — eigenvectors are the PC directions, eigenvalues are the variances
- Sort by eigenvalue (largest first = PC1)
- Project data onto the top-k eigenvectors
Why Maximize Variance?
Maximizing variance along the projection axis preserves the most information about the data’s spread. Equivalently, it minimizes the reconstruction error (the projection line lengths).
Distributions Along Axes
Covariance Matrix
Add points to see the covariance matrix.
Eigenvectors & Eigenvalues
Computed after adding points.
Variance Along Your Axes
Drag the axes to see live variance calculations.
0.50
0.50