Finding the maximum of an integral of a function with given constraints. 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!
 A: 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$.
A: From Lagrange multiplies the following Lagrange equation can be immediately derived:
$$
g(x)=a x^3+bx^2+cx+d
$$
This equation  is not differential because the functional does not depend on $g^\prime$. 
The constant $a,b,c,d$ are derived from the constraints on $g$. 
Indeed we have:
$$
2b/3+2d=0\\
a/2+c=0\\
2b/5+2d/3=0\\
$$
Then $b=d=0$  and $a=-2c$ so $g(x)=c(2x^3-x)$, $c$ is obtained from the last constraint. The sign of $c$ can be obtained from the sign of final value to achieve the maximum. 
