Orthogonal complement and shortest distance on $L^{2}[-1,1]$ Consider the subset $A\subset L^{2}[-1,1]$ defined by
$$
  A=\left\{f\in L^{2}[-1,1]:\int_{-1}^{1}f(t)dt=0\right\}
$$
I want to find the set $A^{\perp}=\{g\in L^{2}[-1,1]:(f,g)=0\}$ for all $f\in A$ and $(,)$ is the inner product on $L^{2}$. Also I want to know what is the shortest distance between $t^{2}$ and $A$.
My attempt to find $A^{\perp}$: Let $f\in A$ fixed and let $g\in L^{2}[-1,1]$, then, using Cauchy-Schwarz inequality I get
$$
 0\leq (f,g)\leq \|f\|\|g\|
$$
So I conclude that $A^{\perp}=\left\{g\in L^{2}[-1,1]:\int_{-1}^{1}|g(t)|^{2}dt=0\right\}$, am I correct?
I have troubles finding the shortest distance between $t^{2}$ and $A$, how can I calculate it?

First notice that any constant function is in $A^\perp$.
Take any $g \in A^\perp$. Then $(f,g) = 0$ for all $f \in A$. Set $\overline g = \frac  12 \int^1_{-1} g(t) dt$, and take $$f(x) = g(x) -  \overline g, \,\,\,\,x\in [-1,1].$$ Then $f \in A$ (you should check this), and so $$0 = (f,g) = (f,g) - (f,\overline g) = (f,g-\overline g) = (g-\overline g, g-\overline g) = \| g - \overline g\|_2^2.$$ Thus $g = \overline g$, and so $g$ is constant. Thus $A^\perp$ is precisely the constant functions.
To find the closest constant $c$ to $h(t) = t^2$ simply minimize $$\phi(c) = \int^1_{-1} (t^2 - c)^2 dt = \frac{2}{5} - \frac{4c}{3} + 2c^2$$ using a calculus argument: $$\phi'(c) = 4c - 4/3 \,\,\,\,\, \implies \,\,\,\,\, c = 1/3.$$ This isn't a coincidence, the best constant approximation to $h(t) = t^2$ is the average value $\overline h = \frac 1 2\int^1_{-1} h(t) dt = 1/3$. The distance is then $$\sqrt{\phi(1/3)} = \sqrt{\frac 8 {45}}.$$
