The following problem is from Functional analysis written by Brezis.
$\mathbf{3.9}$ Let $E$ be a Banach space; let $M\subset E$ be a linear subspace, and let $f_0\in E^*$. Prove that there exists some $g_0\in M^{\perp}$ such that \begin{align*} \inf_{g\in M^\perp}\|f_0-g\|=\|f_0-g_0\|. \end{align*}
Two methods are suggested :
Use Theorem 1.12
Use the weak$^*$ topology $\sigma(E^*,E).$
My attempt is following.
Observe that \begin{align*} M^\perp=\{ f\in E^* : \left<f,x \right>=0\hspace{5mm}\forall x\in M \}=\bigcap_{x\in M} \varphi_x^{-1}(\{0\}) \end{align*} where $\varphi_x \in E^{**}$ is evaluation map defined by $\varphi_x(f)=f(x)=\left<f,x \right>$. Thus, $M^\perp$ is the intersection of closed sets so is closed. Thus, there exists $g_0\in M^\perp$ such that \begin{align*} \inf_{g\in M^\perp} \|f_0-g\|=\|f_0-g_0\| \end{align*}
Now, as you can see I have not used any fact about weak* topology. I only used the fact that $M^\perp$ is closed and so the minimizer should be in there. I feel like I am clearly missing something based on what Brezis suggested. Could you let me know where I am missing? Thanks in advance!
Apparently, it has been asked several time in Brezis Exercise 3.9 and in Exercise about weak topology, and in A Consequence of Banach Alaoglu Bourbaki theorem and so on. But none of them seem clear about my concern.