Proof that the orthonormal projection $P$ onto $W$ in a Hilbert space satisfies $P^2=P$ and $P*=P$. Let $H$ be a Hilbert space.
Given a closed subspace $W\subseteq H$, the orthogonal projection onto $W$ is the unique bounded linear operator $P$ such that $\text{Im}(P)=W$ and $\ker(P)=W^{\perp}$. The orthogonal projection $P$ satisfies:

*

*$P^2=P$.

*$P^*=P$, where $P^*$ is the adjoint of $P$.


I was wondering where I may find a proof of the above result, since there is no proof in my notes nor in the chapter on Hilbert spaces of Rudin's $\textit{Real and Complex Analysis}$.
 A: I am confused -- it seems the given definition is not complete. If $H$ is $\mathbb{R}^2$ with the standard inner product and $W$ is the $x$-axis, then
$$
P = \begin{pmatrix} -1 & 0 \\ 0 & 0 \end{pmatrix}
$$
is a bounded linear operator such that $\text{Im}(P) = W$ and $\text{Ker}(P) = W^\perp$ even though it is not the orthogonal projection onto $W$ (and isn't idempotent).
A: You need $P^{2}=P$ by definition for $P$ to be a projection.

$\textbf{Definition:}$  Let $\mathcal{H}$ be a Hilbert space. A linear map $P: \mathcal{H}\rightarrow \mathcal{H}$ is called a projector if
$$P^{2}=P\circ P = P$$
and an orthogonal projector if in addition
$$ran(P) \perp ker(P).$$

One can show that $$P\, orthogonal\, projection\; \text{if and only if}\; P=P^{\ast}.$$
For this we need

$\textbf{Theorem:}$  Let $\mathcal{H}$ be a Hilbert space and W be a closed subspace of $\mathcal{H}$. Then there exists a unique orthogonal projector $P$ such that
$$W=ran(P)\; \text{and}\;W^{\perp}=ker(P).$$
Furthermore, for any $x\in\mathcal{H}$, there is a unique decomposition $$y=x_{1}+x_{2}\; \text{with}\;x_{1}\in W, x_{2} \in W^{\perp}$$
with $x_{1}=Px$ and $x_{2}=(I-P)x$.


For an operator T on a Hilbert space $\mathcal{H}$ it holds that $ker(T)=ran(T^{\ast})^{\perp}$ and $ker(T^{\ast})=ran(T)^{\perp}$.

$\mathbf{\Rightarrow}$
Let $x,y \in \mathcal{H}$. By the theorem above we can write $x=x_{W}+x_{W^{\perp}}$ and $y=y_{W}+y_{W^{\perp}}$ with $x_{W},y_{W}\in W$ and $x_{W^{\perp}},y_{W^{\perp}}\in W^{\perp}$.
It follows
$$
\begin{aligned}
\langle Tx,y \rangle
=&
\langle T(x_{W} +x_{W^{\perp}}),y_{W}+y_{W^{\perp}} \rangle\\
=&
\langle Tx_{W},y_{W} \rangle + \langle Tx_{W}, y_{W^{\perp}} \rangle + \langle Tx_{W^{\perp}},y_{W} \rangle + \langle Tx_{W^{\perp}}, y_{W^{\perp}} \rangle \\
=&
\langle Tx_{W},y_{W}\rangle\\
=&
\langle x_{W},y_{W}\rangle
\end{aligned}
$$ which follows since $Tx_{W}=x_{W}$,  $x_{W}  \perp y_{W^{\perp}}$ and $Tx_{W^{\perp}}=0$.
and
$$
\begin{aligned}
\langle x,Ty \rangle
=&
\left\langle x_{W} +x_{W^{\perp}},T(y_{W}+y_{W^{\perp}}) \right\rangle\\
=&
\langle x_{W},Ty_{W}\rangle + \langle x_{W},Ty_{W^{\perp}}\rangle + \langle x_{W^{\perp}},Ty_{W} \rangle + \langle x_{W^{\perp}},Ty_{W^{\perp}} \rangle\\
=&
\langle x_{W},y_{W}\rangle
\end{aligned}
$$ since $Ty_{W}=y_{W}$,  $x_{W}  \perp y_{W^{\perp}}$ and $Ty_{W^{\perp}}=0$.
Therefore $$\langle Tx ,y \rangle = \langle x,Ty \rangle\; \text{for all}\, x,y \in \mathcal{H}$$ thus $P$ is self-adjoint ($P=P^{\ast}).
$\mathbf{\Leftarrow}$
Let $P$ be self-adjoint ($P=P^{\ast}$). Together with  $ker(P)=ran(P^{\ast})^{\perp}$ this yields $ker(P)=ran(P)^{\perp}$ thus $P$ is an orthogonal projection.
