Let $(E,||\cdot||)$ be a Banach space, $M\subset E$ a linear subspace and $f_0 \in E^*$. Prove that there exists $g_0 \in M^\perp$ such that $$ \inf_{g \in M^\perp} ||f_0-g|| = ||f_0-g_0|| $$ HINT: Note that $B_{E^*}$ is compact for $\sigma(E^*, E)$ and $M^\perp$ is closed in $\sigma(E^*,E) $.
I tried following the hint and I showed that $M^\perp$ is closed, since $M^\perp= \bigcap_{x\in M} J_x^{-1}(\{0\})$ is an intersection of closed sets; I also know that $B_{E^*}$ is compact. Anyway, I do not know how to proceed (I thought of using sequential compactness of the closed unit ball in $E^*$, but it seems that the hypothesis that $E^*$ is separable is necessary to have it). Any help is really appreciated.