Solution (source code)

= Solution

The decomposition $x=P_nx+(x-P_nx)$ is <orthogonal> by (i). Therefore $\|x\|^2=\|P_nx\|^2+\|x-P_nx\|^2$. Substitute (ii) and rearrange to obtain
$$
\boxed{\|x-P_nx\|^2=\|x\|^2-\sum_{k=1}^n|\langle x,e_k\rangle|^2.}
$$
In particular nonnegativity of the left side gives the finite <Bessel inequality>.