How to maximize this integral? Rudin asked me to maximize $$\int^{1}_{-1}x^{3}g(x)dx$$ under the restraint that $$\int^{1}_{-1}g(x)=\int^{1}_{-1}xg(x)dx=\int^{1}_{-1}x^{2}g(x)dx=0$$
This is clearly a Hilbert space problem need to use orthogonal relations. I computed $x^{3}$'s coefficients under the $L^{2}$ inner product and it turns out $x^{3}=\frac{3}{5}x^{2}+c$, with $c$ being orthogonal to $\{1,x,x^{2}\}$. But how does this help to find $g$?
A related question I also do not know how to solve is to find the minimum of $$\int^{\infty}_{0}|x^{3}-a-bx-cx^{2}|^{2}e^{-x}dx$$And it is not clear to me what the linearly independent underlying set is - $\{1,x,x^{2},e^{-x/2}\}$?
 A: Hopefully you can recognize the second question as an application of what is sometimes called the "best approximation theorem" or "orthogonal projection theorem" in a Hilbert space. I'll show one approach, but there are others that people can chime in on.
If $\{\varphi_i(x)\}$ forms a complete orthonormal family on an interval $I$, with respect to the weight function $w(x)$, i.e., $$\langle \varphi_i,\varphi_j\rangle_w:=\int_I \varphi_i(x)\varphi_j(x)w(x)\,dx=\begin{cases} 0, &i\not=j,\\ 1, &i=j,\end{cases}$$ and we want to approximate $f\in L^2_w(I)$ as $$f(x)\approx\sum_{i=1}^n c_i \varphi_i(x), \quad x\in I,$$ then the "best" choice for the coefficients $c_i$ in the sense of minimizing the weighted $L^2$ norm of the error, $$\left\|f(x)-\sum_{i=1}^n c_i \varphi_i(x)\right\|_{L^2_w(I)},$$ is simply $c_i=\langle f,\varphi_i\rangle_w$, $i=1,\dots,n$.
To bring this to bear on your problem, the weight on the inner product is $e^{-x}$, $I=[0,\infty)$, $f(x)=x^3$, and we want to minimize the weighted $L^2_w(I)$ error when using the approximation $$x^3\approx a+bx+cx^2=\sum_{i=0}^2 c_i L_i(x),$$ where $L_i(x)$ denotes the $i$th Laguerre polynomial. 
Since $L_0(x)=1$, $L_1(x)=1-x$, and $L_2(x)={1\over 2}(2-4x+x^2)$, from the best approximation theorem above,
\begin{align}
c_0&=\langle x^3,L_0\rangle_w=\int_0^\infty x^3 e^{-x}\,dx=6,\\
c_1&=\langle x^3,L_1\rangle_w=\int_0^\infty x^3(1-x)e^{-x}\,dx=-18,\\
c_2&=\langle x^3,L_2\rangle_w=\int_0^\infty x^3\cdot{1\over 2}(2-4x+x^2)e^{-x}\,dx=18,
\end{align}
which results in
$$a=c_0+c_1+c_2=6, \quad b=-c_1-2c_2=-18, \quad c={c_2\over 2}=9.$$
Of course, if we want to let Mathematica do the work for us, it can:

but where's the fun in that? ;-)
Hope that helps.
