A question about projection in Hilbert space . Let $a$ be a non-zero element  of an Hilbert space $H$. I try to prove that for every $x\in H$, 
$$
d(x, \{a\}^{\perp})=\frac{\left|\langle x,a\rangle \right|}{\left\|a\right\|}.
$$ 
So $d(x, \{a\}^{\perp})= \left\|x- p(x)\right\|$ where $p(x)$ is the orthogonal projection of $x$ on $\{a\}^{\perp}$, if I can show that  $x- p(x)$ is parallel to $a$, then we conclude the proof by using the Cauchy-Schwarz inequality.
In fact, writing  $x=x- p(x) + p(x)$ it gives
$\left| \langle x,a\rangle \right|=\left|\langle x- p(x),a\rangle \right|$ because $p(x) \in \{a\}^{\perp}$.
By what argument can I say that 
$x- p(x)$ is parallel to $a$?
Thank's  
 A: I think you mean "perpendicular to", not "parallel to", in the question.
It is clear from the formula for $p(x)$ in terms of $x$, $a$, and the inner product, namely
$$
p(x) = \frac{\langle x, a\rangle}{\langle a, a\rangle} a,
$$
that $x - p(x)$ is perpendicular to $a$.  Just do a short calculation with the formula:
$$
\begin{align}
\langle x - p(x), a\rangle & = \langle x, a\rangle - \langle p(x), a\rangle \\
& = \langle x ,a\rangle - \left\langle \frac{\langle x, a\rangle}{\langle a, a\rangle} a, a \right\rangle \\
& = \langle x,a\rangle - \frac{\langle x, a\rangle}{\langle a, a\rangle}  \langle a, a\rangle \\
& = \langle x, a\rangle - \langle x, a\rangle \\
& = 0.
\end{align}
$$
So perhaps your question is really why $p(x)$ is given by that formula.  To answer that we'd need to know whatever definition you had of $p(x)$.  In any case, for what you want, it's enough to just take the above formula as the definition of $p(x)$.  To give the argument:
Fix any $y$ in $\{a\}^{\perp}$.  The above calculation shows that $x - p(x)$ is perpendicular to $a$, and so is $y$, so the difference $x - p(x) - y$ is also perpendicular to $a$, and hence to $p(x)$ (as $p(x)$ is a scalar multiple of $a$ by definition).  So by the Pythagorean theorem
$$
\begin{align}
d(x,y)^2 & = \|x - y\|^2 \\
& = \|x - p(x) - y + p(x)\|^2\\
& = \|x - p(x) - y\|^2 + \|p(x)\|^2 \\
& \geq \|p(x)\|^2
\end{align}
$$
and taking square roots one deduces
$$
d(x,y) \geq \|p(x)\| = \left\|\frac{\langle x,a\rangle}{\|a\|^2} a\right \| = \frac{|\langle x,a\rangle|}{\|a\|^2} \|a\| = \frac{|\langle x,a\rangle|}{\|a\|}.
$$
The argument given for this inequality also shows that equality holds if and only if $\|x - p(x) - y\|^2 = 0$, ie, if and only if $y = x - p(x)$ (which we know is possible, as we proved $x - p(x)$ was indeed in $\{a\}^{\perp}$ ).  This establishes
$$
d(x,\{a\}^{\perp}) = \frac{|\langle x,a\rangle|}{\|a\|}.
$$
