inf sup duality in Hilbert spaces Let $Y$ be a Hilbert space, for all $y \in Y$ and  $X$ a closed subspace of $Y$, I want to prove the following duality result:
$$\inf_{g \in X} || y -g|| = \sup_{(f,X)=0} \frac{(y,f)}{||f||},$$
where by $(f,X)=0$ I mean that $f$ is orthogonal to each element of $X$.
 A: The infimum on left hand side of the claimed identity
$$\inf_{x\in X} \lVert y-x\rVert = \sup_{z \bot X,\ \lVert z \rVert=1} (y, z), $$
is usually called distance from $y$ to $X$. To begin let us perform a preliminary reduction. We know that we can uniquely decompose $y$ as
$$\tag{1} y= y_\bot + y_X,$$
where $y_X\in X$ and $y_\bot \in X^\bot$. Pythagoras' theorem then yields that the distance from $y$ to $X$ is equal to $\lVert y_\bot\rVert$. All of this is standard Hilbert space thoery. It is easier to understand if one pictures $Y$ as the Euclidean plane, $y$ as a vector applied at the origin and $X$ as a line, again passing through the origin. 
We are now reduced to prove that 
$$\lVert y_\bot\rVert = \sup_{z\bot X,\ \lVert z \rVert=1} (y, z).$$
Using again the orthogonal decomposition (1) we see that 
$$(y, z)=(y_\bot, z),\qquad \forall z \bot X.$$
By the Cauchy-Schwarz inequality we have 
$$(y_\bot, z)\le \lVert y_\bot\rVert \lVert z \rVert,$$
and we can always take $z=y_\bot/\lVert y_\bot \rVert$ (provided that $y_\bot \ne 0$, of course. In that case $y\in X$ and the equality we want to prove trivializes to 0=0). This shows that the maximum value of $(y, z)$ is exactly $\lVert y_\bot\rVert$ and concludes the proof. 
As a last remark, let me note here that we are implicitly assuming that $Y$ is a real Hilbert space. In the complex case everything works fine if one replaces $(y, z)$ by $|(y, z)|$.
