Every real dataset has a covariance matrix, and every real covariance matrix shares one strange property: no matter which direction you measure variance along, you never get a negative number. That's not a coincidence — it's baked into what "variance" means, and it has a name: positive semi-definite.
Each bar is at a different direction . For the covariance matrix, every bar stays on the positive side no matter which direction you check. Switch to the other matrix and watch one bar cross to the negative side — proof that matrix could never be a real covariance matrix.
A symmetric matrix is positive semi-definite (PSD) if its quadratic form never goes negative:
- — a symmetric matrix (so ).
- — any vector; the condition must hold for all of them, not just some.
- — the quadratic form: a single number measuring how acts along direction .
- Why covariance matrices are always PSD
For a covariance matrix , is exactly the variance of the data projected onto direction — and variance, being an average of squared numbers, can never be negative.
- What it means for the eigenvalues
is PSD if and only if every eigenvalue of is . Along an eigenvector , , so a negative eigenvalue immediately produces a negative quadratic form there.
- Not every symmetric matrix qualifies
Symmetry alone isn't enough — a symmetric matrix with even one negative eigenvalue fails the test, and could never arise as an actual covariance matrix of real data.
covariance C = [[5,3],[3,5]]
not-PSD M = [[1,2],[2,1]]
Same eight directions, both matrices. The covariance matrix's bars all sit at or above zero; the other matrix's bars straddle it. That's the entire PSD test, run by hand, eight times.
Four mean-centered points give the covariance matrix (population covariance, dividing by ):
- Variance along the x-axis
: — matches directly.
- Variance along the direction of maximum spread
: expanding with gives — this is 's top eigenvalue, and its eigenvector.
- Confirm PSD-ness at the minimum-variance direction too
: still , but now since the two components have opposite signs. Substituting into : — still positive. and are 's two eigenvalues; both positive, so is (strictly) positive definite.
M = [[1,2],[2,1]] is symmetric but NOT positive semi-definite. Compute vTMv by hand at each candidate direction and click the one where it goes negative — that's your proof.
Positive semi-definiteness is what separates "a matrix that could plausibly be a covariance matrix" from "a matrix that never could be" — and it reduces entirely to a sign check on eigenvalues. This matters beyond statistics: kernel matrices in SVMs, Hessians at a true minimum, and Gram matrices in optimization all have to be PSD for the same underlying reason, and the low-rank and SVD chapters ahead lean directly on this eigenvalue-sign machinery.