Solution (source code)

= Solution

Let $\lambda_1\geq\cdots\geq\lambda_p\geq0$ be the <eigenvalues> of the symmetric <covariance matrix> $V$, and choose an <orthonormal basis> of <eigenvectors> $v_1,\ldots,v_p$. If $\ell=\sum_ja_jv_j$ has unit length, then $\sum_ja_j^2=1$ and
$$
\operatorname{Var}(\ell^TX)=\ell^TV\ell=\sum_j\lambda_ja_j^2\leq\lambda_1.
$$
Equality is attained by $v_1$, and precisely by <unit vectors> in the top <eigenspace>. Hence \b[choose $\ell_1$ to be any unit <eigenvector> for the largest <eigenvalue>; the maximum <variance> is $\lambda_1$]. This proves the maximizing property of the <Rayleigh quotient>, rather than merely specifying a stationary point.