# Orthogonalization of polynomial

• Jun 3rd 2013, 01:33 PM
Stormey
Orthogonalization of polynomial
Hi guys.
I have the following base for $\displaystyle \mathbb{R}_2[x]$: $\displaystyle \left \{ 1,x,x^2 \right \}$
I want to orthogonalize this base with respect to the inner product:
$\displaystyle <p(x),q(x)>=\int_{0}^{1}p(x)q(x)dx$

somthing doesn't add up, and I suspect that I have made some calculation error, even though I checked several times.

so let's say the new orthogonal base will be $\displaystyle \left \{ \tilde{v}_1, \tilde{v}_2, \tilde{v}_3 \right \}$
I first set $\displaystyle \tilde{v}_1=v_1=1$.
then:
$\displaystyle \tilde{v}_2=v_2-\frac{v_2\cdot v_1}{v_1\cdot v_1}v_1=x-\frac{1}{2}$ (I checked it - it is correct, since it's orthogonal to $\displaystyle v_1$, which is 1)

but when I try to find $\displaystyle \tilde{v}_3$, I get:

$\displaystyle \tilde{v}_3=v_3-\frac{v_3\cdot v_1}{v_1\cdot v_1}v_1-\frac{v_3\cdot v_2}{v_2\cdot v_2}v_2$

$\displaystyle \tilde{v}_3=x^2-\frac{\int_{0}^{1}x^2}{\int_{0}^{1}1}1-\frac{\int_{0}^{1}x^3}{\int_{0}^{1}x^2}x$

$\displaystyle \tilde{v}_3=x^2-\frac{1}{3}-\frac{3}{4}x$

so this is what I get, but $\displaystyle \tilde{v}_3$ is NOT orthogonal to neither $\displaystyle \tilde{v}_1$ or $\displaystyle \tilde{v}_2$!

any help would be greatly appreciated!
• Jun 3rd 2013, 03:31 PM
BobP
Re: Orthogonalization of polynomial
In your expression for $\displaystyle \tilde{v}_{3},$ the $\displaystyle v_{1}$ and $\displaystyle v_{2}$ (wherever they appear), on the RHS should be $\displaystyle \tilde{v}_{1}$ and $\displaystyle \tilde{v}_{2}$ shouldn't they ?

(You got lucky with $\displaystyle \tilde{v}_2},$ because $\displaystyle \tilde{v}_{1} = v_{1}.)$
• Jun 3rd 2013, 11:33 PM
Stormey
Re: Orthogonalization of polynomial
Hi BobP, and thanks for the help.

I don't see why does it matter if I take $\displaystyle v_1$,$\displaystyle v_2$ or $\displaystyle \tilde{v}_1$,$\displaystyle \tilde{v}_2$.
both $\displaystyle v_1$,$\displaystyle v_2$ and $\displaystyle \tilde{v}_1$,$\displaystyle \tilde{v}_2$ spans the same vector space, so if a vector is orthogonal to $\displaystyle v_1$,$\displaystyle v_2$, it will be orthogonal to $\displaystyle \tilde{v}_1$,$\displaystyle \tilde{v}_2$ as well.
nevertheless, I tried to take $\displaystyle \tilde{v}_1,\tilde{v}_2$ instead, and this is what I get:

$\displaystyle \tilde{v}_3=v_3-\frac{v_3\cdot \tilde{v}_1}{\tilde{v}_1\cdot \tilde{v}_1}\tilde{v}_1-\frac{v_3\cdot \tilde{v}_2}{\tilde{v}_2\cdot \tilde{v}_2}\tilde{v}_2$

$\displaystyle \tilde{v}_3=v_3-\frac{1}{3}-\frac{\int_{0}^{1}x_2(x-\frac{1}{2})}{\int_{0}^{1}(x-\frac{1}{2})^2}(x-\frac{1}{2})$

$\displaystyle \tilde{v}_3=x^2+\frac{1}{5}x-\frac{7}{30}$

which is still not orthogonal to $\displaystyle v_1$/$\displaystyle \tilde{v}_1$/$\displaystyle v_2$/$\displaystyle \tilde{v}_2$
• Jun 4th 2013, 01:56 AM
BobP
Re: Orthogonalization of polynomial
The formula that you have for $\displaystyle \tilde{v}_{3}$ comes from the assumption that $\displaystyle \tilde{v}_{3}=v_{1}+\alpha \tilde{v}_{1}+\beta\tilde{v}_{2}.$
To calculate the coefficient $\displaystyle \beta$ (for example) you take the inner product of this equation with $\displaystyle \tilde{v}_{2}.$
That gets you
$\displaystyle (\tilde{v}_{3},\tilde{v}_{2})=(v_{1},\tilde{v}_{2} )+\alpha(\tilde{v}_{1},\tilde{v}_{2})+\beta(\tilde {v}_{2},\tilde{v}_{2}),$
from which
$\displaystyle \beta=-\frac{(v_{1},\tilde{v}_{2})}{(\tilde{v}_{2},\tilde {v}_{2})}.$
That doesn't happen if you use $\displaystyle v_{1} \text{ and } v_{2}$ rather than $\displaystyle \tilde{v}_{1} \text{ and } \tilde{v}_{2},$ since $\displaystyle v_{1} \text{ and } v_{2}$ are not orthogonal.

For the last bit, check your integration.
I get
$\displaystyle \tilde{v}_{3}= x^{2}-x+1/6.$
• Jun 4th 2013, 02:39 AM
Stormey
Re: Orthogonalization of polynomial
Great! Thank you so much.
• Jun 4th 2013, 03:53 AM
BobP
Re: Orthogonalization of polynomial
Actually, I made a mistake !

I should have put $\displaystyle \tilde{v}_{3}=v_{3}+\dots .$

That changes the next two lines. You get the drift though ?
• Jun 4th 2013, 04:50 AM
Stormey
Re: Orthogonalization of polynomial
yeah, I'll get it from here. thanks.