Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I would like to apply Legendre polynomials to least square approximation. Therefore I would like the function:

$$L_n (x)=\sum_{k=0}^n a_k P_k (x)$$

to fit $f(x)$ defined over $[-1,1]$ in a least square sense.

We should minimize:

$$I(a_0, ..., a_n)= \int_{-1}^1 [f(x) - L_n (x)]^2 \; dx\tag1$$

and so we must set

$$\frac{\partial I}{\partial a_r} = 0,\qquad r=0,1, \ldots,n\tag2$$

Using equations $(1)$ and $(2)$

$$\int_{-1}^1 P_r(x) \left[f(x) - \sum_{k=0}^n a_k P_k (x)\right]dx = 0,\qquad r=0,1, \ldots,n$$

should be an equivalent term.

My question now is: why is that true?

I would be glad if someone could illustrate the last step with more details. Thanks, Rainier.

share|improve this question
    
thx for editing, looks much nicer now. –  rainier Sep 15 '12 at 15:58
    
It is true because the functional $I(a_0\ldots a_n)$ that you want to minimize is convex. Hence any critical point is a minimum. –  Giuseppe Negro Sep 15 '12 at 16:10
    
ok, equation (1) and (2) make perfect sense to me. The step which I don't understand is how to get to the last term. –  rainier Sep 15 '12 at 16:32
add comment

2 Answers

You have

$$ \frac{\partial}{\partial a_r}\int_{-1}^1 [f(x) - L_n (x)]^2dx=0\\ \int_{-1}^1 \frac{\partial}{\partial a_r}[f(x) - L_n (x)]^2dx=0\\ \int_{-1}^1 2[f(x) - L_n (x)]\frac{\partial}{\partial a_r}[f(x) - L_n (x)]dx=0\\ \int_{-1}^1 2[f(x) - L_n (x)][0 - \frac{\partial}{\partial a_r}L_n (x)]dx=0\\ -\int_{-1}^1 2[f(x) - L_n (x)]\frac{\partial}{\partial a_r}\sum a_kP_k(x)dx=0\\ -\int_{-1}^1 2[f(x) - L_n (x)]P_r(x)dx=0 $$

share|improve this answer
add comment

It is even easier than that. Because the Legendre polynomials are orthogonal, you can get the coefficients just from $a_n=\frac {2n+1}2\int_{-1}^1f(x)P_n(x)dx$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.