TITLE: Orthogonal projection on the Hilbert space .
QUESTION [10 upvotes]: I want to prove the following: 


If $X$ is a Hilbert space and $Y$ is a closed subspace of $X$, then
  every $x\in X$ can be written as $x=y+z $ where $y\in Y$,
  $z \in Y^\perp$. 
The projection (into $Y$) map $P:X\to Y$, given by $P(x)=y$ is linear,
  bounded, $P^2=P$, and $\langle x_1 , Px_2\rangle =\langle Px_1 , x_2\rangle$.


Here I have avoided subscripts (but the projection is always onto the $Y$ space): 
Consider $x$ in $X$  , then there is a closest point to $x$ in $Y$ . Let us say that point as $Px$ , now we prove that $x-Px$ is orthogonal to $Y$ .   Choose  $y \in Y$ and $ |y|=1$ 
Now $|x-(Px+ y)|^2 =|x-Px|^2-2Re \alpha(x-Px,  y) + |\alpha|^2 y^2$   Let us choose $\alpha = (y, x-Px)$ then it becomes , 
$ := |x-Px|^2 - 2|(x-Px,  y) |^2 + |(y, x-Px)|^2 =|x-Px|^2 - |(x-Px, y) |^2 $
Which implies that distance of $x$ from $Px+y \in Y$ is less than the $|x-Px|$ , unless $|(x-Px, y) |^2 =0$ which gives us that $x$ and $x-Px$ are orthogonal . 
Now let us see if $P : x \to Px$ is linear , 
Define $Qx =x-Px$ , We have already shown that $Qx$ is orthogonal to $Y$ 
Then $P(ax+by)+Q(ax+by) =ax+by =a(Px+Qx)+b(Py+Qy$, moving $P$ and $Q$ on two sides we get 
$P(ax+by)-(aPx +bPy) = Q(ax+by) -(aQx+bQy)$, since the right side is in $Y$ and the left side is not in $Y$, both the side should be equal to $0$ , 
$P(ax+by)-(aPx +bPy)=0$ , hence we show that $P$ is linear . 
And the boundedness follows because $|x|^2=|Px|^2+|Qx|^2$ , is that right ? 
Am i right so far ? I am having a bit of difficulty in proving rest of the stuff. 
Thanks for your help.

REPLY [11 votes]: The first part is often called the Orthogonal Decomposition Theorem and is found in just about any textbook on Hilbert spaces. Here (look at 3.6 and right below 3.9) is a readily available proof from the web.
For the second part, we can establish the following properties about $P$ rather quickly:

linear: Let $x_i=y_i+z_i$, where $x_i\in X$, $y_i\in Y$, $z_i\in Y^\perp$, and $\alpha,\beta$ be scalars. Then \begin{align}P(\alpha x_1+\beta x_2)&=P(\alpha(y_1+z_1)+\beta(y_2+z_2))\\&=P(\alpha y_1+\beta y_2+\alpha z_1+\beta z_2)=\alpha y_1+\beta y_2=\alpha P(x_1)+\beta P(x_2).\end{align}
bounded: Since $x=0$ is trivial, suppose $x\not=0$. Because the projection is orthogonal, the (generalized) Pythagorean Theorem says $\|x\|^2=\|y\|^2+\|z\|^2$, so $$\|Px\|^2=\|y\|^2=\|x\|^2-\|z\|^2\le \|x\|^2.$$ Therefore, $${\|Px\|^2\over \|x\|^2}\le 1 \implies \|P\|=\max_{x\not =0}{\|Px\|\over \|x\|}\le 1,$$ and hence $P$ is bounded.
idempotent: $P^2x=P(Px)=Py=y=Px$, so $P^2=P$.
self-adjoint: $$\langle Px_1,x_2\rangle=\langle y_1,y_2+z_2\rangle=\langle y_1,y_2\rangle+\langle y_1,z_2\rangle=\langle y_1,y_2\rangle+0=\langle y_1,y_2\rangle$$ and $$\langle x_1,Px_2\rangle=\langle y_1+z_1,y_2\rangle=\langle y_1,y_2\rangle+\langle z_1,y_2\rangle=\langle y_1,y_2\rangle+0=\langle y_1,y_2\rangle,$$ so $\langle Px_1,x_2\rangle=\langle x_1,Px_2\rangle$.