Minimum maximum identity

Let $x_0\in H$. $H$ is an Hilbert space, $M$ is a closed subspace of $H$. In my lecture notes about functional analysis, there is the following identity

$$\min\{\|y-x_0\|: y\in M\}=\max\{|\langle x_0,y\rangle|:y\in M^\perp, \|y\|=1\}$$

I am not able to prove it, maybe you could help me.

-

Geometrically the left hand side means the distance of $x_0$ from $M$, and the right hand side means the maximum length of orthogonal projections to any line orthogonal to $M$.
So, try to prove that, if $y_0$ denotes the orthogonal projection of $x_0$ to $M$, then $||y_0-x_0||$ will give the minimum for the left side. And it is also the maximum for the right side: it belongs to $y:=\displaystyle\frac{(y_0-x_0)}{||y_0-x_0||} \perp M$.