Gram-Schmidt procedure to construct an orthogonal basis for best approximation of a function I'm using the Gram-Schmidt procedure to construct an orthogonal basis of
the $Span(1, x, x^3)$ for the interval [−1, 1]. I'm trying to determine the best approximation to $f(x) = x^5$.
$p(x) = c0*e0(x) + c1*e1(x) + c2*e2(x) + c3*e3(x) + c4*e4(x) + c5*e5(x)$
Where $c0 = <f,e0> / <e0,e0>$
In this case, is $e0(x) = 1, e1(x) = x, e2(x) = x^3$ ? Would I then use these to find $e3(x)$ to $e5(x)$?
For the inner product $<f,g>$, I am using $\int_{-1}^1f(x)g(x)dx$
 A: Suppose $e_k$ are orthonormal, then
$\|f-\sum_k \alpha_k e_k \|^2 = \|f\|^2 -2 \sum_k \alpha_k \langle f, e_k \rangle + \sum_k \alpha_k^2$.
To find the best approximation, we minimise the above over the $\alpha_k$. This is a convex quadratic separable problem, and the solution is given by
just differentiating with respect to the $\alpha_k$. This gives
$\alpha_k = \langle f, e_k \rangle$.
Hence the best approximation is $\sum_k \langle f, e_k \rangle e_k$.
In the above problem, you are given $g_1(x) = 1, g_2(x) = x, g_3(x) = x^3$.
Use Gram Schmidt to orthonormalise the $g_k$ to get $e_k$. Then the 
coefficients $\alpha_k$ can be computed as above.
Here are the orthonormalised functions:
$e_1(x) = {1 \over \sqrt{2}}$, $e_2(x) = \sqrt{3 \over 2} x$, 
$e_3(x) = \sqrt{7 \over 8}(5 x^3-3x)$.
Then for $f(x) = x^5$ we have $\langle f, e_1 \rangle = 0$,
$\langle f, e_2 \rangle = { \sqrt{6} \over 7}$, $\langle f, e_3 \rangle = {\sqrt{32} \over 9 \sqrt{7}}$.
Grinding through the details gives the best approximation
$\sum_k \langle f, e_k \rangle e_k = -{5 \over 21} x + {10 \over 9} x^3$.

