The direction of maximum variance
Stack observations of variables into a data matrix () and subtract each column's mean. The sample covariance matrix is
Project every row onto a unit vector and each observation becomes a single number. The column of those numbers, , has variance
PCA asks which unit makes this as large as possible. is symmetric, so the spectral theorem hands us an orthonormal eigenbasis with eigenvalues . Write with . Then , a weighted average of the eigenvalues, which is largest when all the weight sits on . The best direction is the top eigenvector and the variance it captures is . The best direction orthogonal to that one is , and so on down the list. These eigenvectors are the principal components.
Example: two stocks with daily return covariance in . Trace 7 and determinant 6 give eigenvalues 6 and 1. The first PC is with variance 6. For comparison, the first stock alone, , gives 5, and the equal-weight direction gives . No unit direction beats 6, and that single line carries of the total variance.