Solution (source code)

= Solution

The <Riesz representation theorem> states that every bounded <linear functional> $L$ on a real or complex <Hilbert space> $H$ is represented by a unique $h\in H$:
$$
\boxed{L(v)=\langle v,h\rangle\quad(v\in H),\qquad\|L\|=\|h\|.}
$$
For the complex case take the <inner product> to be linear in its first argument.

If $L=0$, choose $h=0$. Otherwise its <kernel> $K$ is a closed linear subspace. Choose $x$ with $L(x)\ne0$ and let $z=x-P_Kx$, using the <orthogonal projection>. Then $z\ne0$, $z\perp K$, and $L(z)=L(x)\ne0$. For every $v$,
$$
v-\frac{L(v)}{L(z)}z\in K,
\qquad
\langle v,z\rangle=\frac{L(v)}{L(z)}\|z\|^2.
$$
Therefore take $h=L(z)z/\|z\|^2$ in the real case, and $h=\overline{L(z)}z/\|z\|^2$ in the complex case. The conjugate in the latter formula compensates for conjugate linearity in the second argument.

The <Cauchy-Schwarz inequality> gives $|L(v)|\leq\|v\|\|h\|$, and evaluation at $v=h/\|h\|$ when $h\ne0$ gives equality of the <norms>. If two vectors represent $L$, their difference is <orthogonal> to every vector, including itself, hence zero. This proves all assertions of the <Riesz representation theorem>.