Solution (source code)

= Solution

The fixed-point space $I=\ker(U-I)$ is closed. If $y\in I$ and $w=Ux-x\in W$, then <unitarity> gives
$$
\langle y,w\rangle
=\langle y,Ux\rangle-\langle y,x\rangle
=\langle U^{-1}y,x\rangle-\langle y,x\rangle=0,
$$
so $I\perp W$.

Conversely, $z\in W^\perp$ exactly when
$$
0=\langle z,Ux-x\rangle
=\langle U^*z-z,x\rangle
$$
for every $x\in H$. Thus $U^*z=z$, equivalently $Uz=z$, and $z\in I$. Hence $W^\perp=I$, so the <double orthogonal complement> identity gives
$$
\overline W=(W^\perp)^\perp=I^\perp.
$$
The <orthogonal decomposition by a closed subspace> now yields
$$
\boxed{H=I\oplus\overline W}.
$$

Define the <Cesaro average>
$$
A_n=\frac1n\sum_{i=0}^{n-1}U^i.
$$
For $y\in I$, $A_ny=y$. For a generator $w=Uz-z$ of $W$, the sum telescopes:
$$
A_nw=\frac{U^nz-z}{n},
\qquad
\|A_nw\|\leq\frac{2\|z\|}{n}\longrightarrow0.
$$
Moreover $\|A_n\|\leq1$, so approximation extends this convergence from $W$ to $\overline W$. Writing $x=Px+(I-P)x$ according to the orthogonal decomposition gives the <Von Neumann mean ergodic theorem>
$$
\boxed{\lim_{n\to\infty}\frac1n\sum_{i=0}^{n-1}U^ix=Px}.
$$