Essay
Covariance: How Variables Move Together
From scatter clouds to covariance ellipses, principal directions and positive semidefinite matrices.
Variance asks how one variable spreads. Covariance asks whether two variables move together.
For random variables X,Y,
Cov(X,Y)=E[(X−μX)(Y−μY)].
The orientation of a cloud tells the sign of covariance; its spread tells us much more.
For a random vector X∈Rn,
Σ=E[(X−μ)(X−μ)⊤].
Why covariance matrices are PSD
Take any vector a. Then
a⊤Σa=Var(a⊤X)≥0.
So Σ is positive semidefinite.
This is not merely algebra: a⊤Σa is the variance of the data when viewed along direction a.
The eigenvectors of the covariance matrix give the ellipse's principal axes; eigenvalues encode spread along them.
And suddenly covariance connects directly to eigenvectors and PCA.