This comes from Rudin's Real Analysis text. The first part of the problem asks us to compute $\displaystyle\min_{a,b,c}\int_{-1}^1|x^3-a-bx-cx^2|dx$ (which I have done). Now it asks us to find $\displaystyle\max\int_{-1}^1x^3g(x)dx$ given that $\displaystyle\int_{-1}^1g(x)dx=\int_{-1}^1xg(x)dx=\int_{-1}^1x^2g(x)dx=0$ and $\displaystyle\int_{-1}^1|g(x)|^2dx=1$.
I understand that the string of equalities shows us that $g(x)$ is orthogonal to the functions $f_1(x)=1)$, $f_2(x)=x$, and $f_3(x)=x^2$, but I am unsure how to use this information (along with the first part's result and the last equality) to prove what is expected of me. Any hints, tips, and tricks would be greatly appreciated! Thanks in advance!
Let $H$ be a Hilbert space and let $M$ be a closed subspace of $H$. If $x \in X$, then $$\sup_{z \in M^\perp, \|z\| = 1} |\langle x,z \rangle| = \inf_{y \in M} \|x-y\|$$ because if $y \in M$ and $z \in M^\perp$ with $\|z\| = 1$ you have $$|\langle x,z \rangle| = |\langle x-y,z \rangle| \le \|x-y\|$$ since $\langle y,z \rangle = 0$. On the other hand, you can uniquely write $x = m + n$ where $m \in M$ and $n \in M^\perp$ so that $$\|x-m\| = \|n\| = \langle m+n,\frac{n}{\|n\|} \rangle$$ and equality holds.
Now try to solve the problem. Let $H = L^2([-1,1])$ and $M = \mathrm{span}\{1,x,x^2\}$. You are given $g \in M^\perp$ and $\|g\| = 1$.