TITLE: Distance in Hilbert spaces
QUESTION [1 upvotes]: Let $H$ be a Hilbert space and let $S$ be a one-dimensional subspace of $H$. Let $c$ be a nonzero element in $S$. How to prove that for every $x\in H$ we have
    \begin{equation*}
 distance(x,S^\perp)=\frac{|<x,c>|}{\|c\|}.
 \end{equation*} 
It is easy to see this in a geometric sense. But I stuck in proving this result and I don't know how to start.

REPLY [1 votes]: Hint: Supposed $\|c\|=1$, set $x_\|:=\langle x,c\rangle\cdot c $ and $x_\perp:=x-x_\|$, and show that

$x_\perp$ is indeed $\perp c$. 
$x_\|$ is the shortest vector of the form $x-u$ with $u\perp c\,$.


 With $z:=x-x_\|-u$, we have $z\perp c$, so $\|x-u\|^2=\|x_\|\|^2+\|z\|^2$.
{"set_name": "stack_exchange", "score": 1, "question_id": 2275589}