Solution (source code)

= Solution

Take the squared norm of the <orthonormal> expansion from (i). All mixed inner products vanish and every diagonal <inner product> is one, so
$$
\boxed{\|P_nx\|^2=\sum_{k=1}^n|\langle x,e_k\rangle|^2.}
$$