Q:

Prove that distance doesn't attained.

Consider $C[0,1]$ and $S = \{f \in C[0,1] | \int_{0}^{1} (2x-1)f(x) dx = 0\}$. Now we want to prove that distance $dist(S, S^{c})$ doesn't attained, where $\displaystyle dist(S, S^{c}) = \min_{f \in S, g\in S^{c}} \int_{0}^{1} (f - g)^{2}$.
My attempt : It's easy to see that distance doesn't equal to zero , because then functions must be in one set. Suppose we fix some $g : dist(g,S) = a$ and this distance equals to $dist(g,f_{1})$. So I've tried to build a function $f_{2} \in S$, such as $dist(g,f_{2}) = a\cdot c$ , where $c < 1$. But then I build such function it doesn't applied to definition of $S$. Maybe there is some different approach ? Any hints ?

A:

Since $x \mapsto x^2$ is increasing, one might as well consider the distance in the $L^2$-norm: $$d(S, S^c) = \inf_{f \in S, g \in S^c} \|f - g\|_2 = \inf_{f \in S, g \in S^c} \sqrt{\int_0^1 (f(x) - g(x))^2\,dx }$$
Now notice that the set $S$ is closed with respect to the $L^2$-norm. Namely, define $\phi : C[0,1] \to \mathbb{R}$ as $$\phi(f) = \int_{0}^1 (2x-1)f(x)\,dx = \Big\langle 2x - 1, f(x)\Big\rangle$$
$\phi$ is clearly a bounded linear functional so $S = \operatorname{Ker} \phi$ is closed. $S^c$ is therefore open.
Now assume $f \in S$, $g \in S^c$ are such that $\|f - g\|_2 = d(S, S^c)$.  Since $S^c$ is open, there exists $r > 0$ such that the open ball $B(g, r)$ is contained in $S^c$.
Now for $0 < \varepsilon < \min\left\{\|f - g\|_2, \frac{r}2\right\}$ clearly we have $g + \varepsilon\frac{f - g}{\|f - g\|} \in S^c$ and $$\left\|f - \left(g + \varepsilon\frac{f - g}{\|f - g\|}\right)\right\|_2 = \left(1 - \frac{\varepsilon}{\|f-g\|_2}\right)\|f - g\|_2 < \|f-  g\|_2 = d(S, S^c)$$
which contradicts the assumption.

