# gram-schmidt with polynomials

With the inner product $<f,g>=\int_{-1}^{1} f(x)g(x) dx$, apply the gram-schmidt algorithm to construct orthogonal polynomials from basis elements {1,x,x^2}.

I am thinking that the answer would simply be:

$p_0(x)=1$

$p_1(x)=x-\frac{<x,p_0>}{<p_0,p_0>}p_0(x)$

$p_0(x)=x^2-\frac{<x^2,p_0>}{<p_0,p_0>}p_0(x)-\frac{<x^2,p_1>}{<p_1,p_1>}p_1(x)$

is this correct?

It looks correct to me, with one caveat: $\langle 1, 1\rangle = 2$, so some rescaling is necessary if you want your answers to be orthonormal.
• Also, am I able to replace the $p_0$ with 1 to simplify my final answer? – Math Major Apr 7 '15 at 20:43
• so like: $p_1(x)=x-\frac{<x,p_0>}{<p_0,p_0>}p_0(x)=x-\frac{<x,1>}{<1,1>}$? – Math Major Apr 7 '15 at 20:43
• I would also expect that you should also compute $\langle x, 1\rangle$ and so forth. – Rolf Hoyer Apr 7 '15 at 20:45