On subspaces of Hilbert spaces Let $H$ be a Hilbert space and $S$ be a subspace of $H$. Let $x\in H$ and $\lvert\lvert x\rvert\rvert=1$. Prove that $$\inf_{z\in S^\perp}\lvert\lvert x-z\rvert\rvert=\sup\{\lvert\langle x,y\rangle\rvert :y\in S, \lvert\lvert y\rvert\rvert\leq1\}.$$
I am not a functional analysis person but I need to solve a few problems for some tests. Any hints would be helpful. If someone can point me the underlying philosophy and mechanics of such a problem, it shall be great. As this problem stands now, I do not have a feel for what is actually going on here.
Thanks in advance!
 A: Let's start with the left hand side but lets replace the norm with the norm squared, since if we minimize the norm squared we also minimize the norm. We can decompose $x$ on the two subspaces $S$ and $S^\perp$ in the following way,
$$x = x_S + x_{S^\perp},\quad x_S\in S,\quad x_{S^\perp}\in S^\perp$$
Substituting that into the l.h.s gives,
$$\inf\limits_{z\in S^\perp}\Vert x_S+x_{S^\perp} - z\Vert^2$$
Now, there is a theorem (in fact, it is the Pythagorean theorem for Hilbert spaces) which says $\Vert x+y\Vert^2 = \Vert x\Vert^2 + \Vert y\Vert^2$ if $x$ and $y$ are orthogonal. We know that $x_{S^\perp}-z$ is an element of $S^\perp$ because it is a subspace and $z\in S^\perp$. We also know, since $x_S\in S$, that $x_S$ is orthogonal to $x_{S^\perp}-z$. Thus we can write the following,
$$\inf\limits_{z\in S^\perp}\Vert x_S+x_{S^\perp} - z\Vert^2 = \inf\limits_{z\in S^\perp}\Big(\Vert x_{S^\perp} - z\Vert^2 + \Vert x_S\Vert^2\Big) = \Vert x_S\Vert^2 + \inf\limits_{z\in S^\perp}\Vert x_{S^\perp} - z\Vert^2$$
Since $x_{S^\perp}\in S^\perp$ we can take $z=x_{S^\perp}$ to get,
$$\inf\limits_{z\in S^\perp}\Vert x-z\Vert^2 = \Vert x_S\Vert^2\implies \inf\limits_{z\in S^\perp}\Vert x-z\Vert =\Vert x_S\Vert.$$

Now let's focus on the right hand side. We will use the same decomposition for $x$ as above but now we will use orthogonality and then the Cauchy Schwarz inequality.
$$\sup\limits_{y\in S, \vert y\vert\leq 1}\vert \langle y,x_S+x_{S^\perp}\rangle\vert = \sup\limits_{y\in S, \vert y\vert\leq 1}\vert \langle y,x_S\rangle\vert$$
The term we are taking the supremum of has an upper bound given by the CS inequality,
$$\vert \langle y, x_S\rangle \vert\leq \Vert y\Vert \Vert x_S\Vert\leq\Vert x_S\Vert$$
where the last inequality is due to our assumption that $\Vert y \Vert \leq 1$. Equality for the CS inequality is attained if the two vectors are linearly dependent, i.e. $y=\alpha x_S$ for some scalar $\alpha$. Since we are choosing $y$ to be in the unit ball, take $y=\frac{x_S}{\Vert x_S\Vert}$ which gives,
$$\sup\limits_{y\in S, \vert y\vert\leq 1}\vert \langle y, x_S\rangle\vert = \Vert\frac{x_S}{\Vert x_S\Vert}\Vert\Vert x_S\Vert = \Vert x_S\Vert$$

Thus the two sides are equal.
A: By continuity of the inner product, we may assume that $S$ is closed. 
Write $x=Px+Qx$ where $P$ and $Q$ are the canonical projections on $S$ and $S^{\perp}$ respectively.
Then, $\inf_z\|x-z\|=\|Px\|.$ 
Now, the Hahn Banach theorem (applied to $S$) shows that 
$\|Px\|=\sup\{|L(Px)|:L\in \mathscr L(S,\mathbb C);\ \|L\|=1\}.$
And, by the Riesz theorem, there is a $w\in S$ such that $Ls=\langle s,w\rangle$, and $\|w\|=1$ so
$\|Px\|=\sup\{|\langle Px,w\rangle :w\in S;\ \|w\|=1\}=$
$\sup\{|\langle Px+Qx,w\rangle :w\in S;\ \|w\|=1\}=$
$\sup\{|\langle x,w\rangle :w\in S;\ \|w\|=1\},$
as desired.
