Let $M$ be a closed subspace of a Hilbert space $H$. Take $x_0 \in H\setminus M$ and let $d = \text{dist}(x_0,M)$. Show without using Hahn-Banach that there exists a $y \in H$ such that $\langle x_0,y\rangle = 1 $, $\langle x,y\rangle = 0$ for all $x \in M$, and $\|y\|= 1/d$.
I am sure that this is an easy exercise, but I cannot quite complete it. My initial idea is to take $y = x_0 - z$ where $z$ is the orthogonal projection of $x_0$ onto $M$. Indeed, this $y$ would satisfy $\langle x,y\rangle = 0$ for all $x \in M$, and we have $$\langle x_0,y\rangle = \langle y,y\rangle = \|y\|^2,$$ after normalizing $y$ we would get $\langle x_0,y\rangle =1$. But in the act of normalizing $y$ we could not have $\|y\| = 1/d$ ... Is there another approach to this?