Let $E$ be a Banach space and $G \subset E$ a closed subspace of $E$. In a proof somewhere in Brezis's book, he claims that:
$$\operatorname{dist}(f, G^{\perp}) = \sup\{f(x) \ \vert \ x \in G, \|x\| \leq 1 \}$$
where we define $G^{\perp} = \{f \in E^{*} \ \vert \ f(x) = 0 \ \forall x \in G \}$. I'm having trouble seeing why this is true.
Here's what I tried: since $G^{\perp}$ is closed, there exists (because of Hahn-Banach) $h \in G^{\perp}$ such that:
$$\operatorname{dist}(f, G^{\perp}) = \|f - h\| $$
And therefore: $$\operatorname{dist}(f, G^{\perp})= \sup\{ |f(x) - h(x)| \ \vert \ x \in G, \|x\| \leq 1\} = \sup\{|f(x)| \ \vert \ x \in G, \|x\| \leq 1\}$$
This is almost what I wanted, but there's an absolute value missing. I don't think both the book and I can be right simultaneously, so did I make a mistake somewhere here? Or what is it that I'm missing?
I'd appreciate any help.