# Expanding an f(x) in terms of Legendre Polynomials

1. Apr 2, 2013

### mliuzzolino

1. The problem statement, all variables and given/known data

Expand f(x) = 1 - x2 on -1 < x < +1 in terms of Legendre polynomials.

2. Relevant equations

3. The attempt at a solution

Unfortunately, I missed the class where this was explained and I have other classes during my professor's office hours. I have no idea how to begin this...

Last edited: Apr 2, 2013
2. Apr 3, 2013

### CompuChip

As 1 - x² is only a quadratic function you could first try doing it by trial-and-error, knowing that
$$P_0(x) = 1, P_1(x) = x, P_2(x) = \tfrac12(3x^2 - 1)$$
which should give you the right answer after you give it some thought.

More formally, there is an expansion along the lines of
$$f(x) = \sum_{n = 0}^\infty a_n P_n(x)$$
where
$$a_n = \langle P_n(x), f(x) \rangle \operatorname{:=} \int_{-1}^1 P_n(x) f(x) \, dx$$
If you have any text or lecture notes, you should be able to find a similar looking expression in there.

3. Apr 3, 2013

### mliuzzolino

I have seen these in my textbook (Advanced Engineering Mathematics by O'Neil), but the section only has 3 problems where it wants you to expand some simple polynomial into Legendre polynomials, only one answer to the 1 of problems but no idea how it is reached, and no examples in the chapter.

So I have f(x) = $\sum_{n = 0}^{\infty}$anPn(x), and I have a formula for the coefficients: an = $\int_{-1}^{-1}$ Pn(x)f(x)dx.

How do I find the coefficients, an, if the integral is dependent on Pn(x)? Do I do it as follows:

n = 0 --> P0(x) = 1.
a0 = $\int_{-1}^{-1}$ 1 - x2 dx = x - x3/3 evaluated from -1 to 1 = 4/3.

So a0 = 4/3.

The same for n = 1, n = 2. Then a1 = 0, a2 = 14/15.

But then P(x) = 4/3 P0(x) + 0 + 14/15 P2(x) + ...

?

Using this method to check the one problem in the book doesn't yield the correct answer. Am I missing a recursion relation or something?

Between 2nd semester o-chem, neurogenetics, nonlinear dynamics and stability theory, mathematical reasoning and writing, and this advanced applied analysis course, my brain is starting to go crazy and it's becoming incredibly difficult to retain everything nearing the end of the semester. I apologize if I'm failing to understand or I'm missing some simple concept...I'm just feeling very lost in applied analysis at this point...

So any help is greatly, greatly appreciated.

4. Apr 3, 2013

### CompuChip

Yes, that is the idea, and up to a minus sign in a3 it looks like you are on the right track. Try to find the exact expression for an in your notes, there is an additional factor dependent on n which will lead to the right answer (the reason it is there is that $\int P_m(x) P_n(x) \, dx$ is not equal to 1 for m = n which it should be for the expression I gave you to be correct; this is the difference between an orthogonal and an orthonormal basis).

If you continue working out the ... at the end you will find that all of them are zero. I guess you can use the recursion relation to prove this fact. In fact any polynomial will only have finitely many terms in the expansion.

As for your confusion, I can only hope that going through the calculation will help. This whole theory of expanding in orthogonal/orthonormal bases and how you get the coefficients is pretty interesting, but it's a bit too complicated for this little white box. If you are interested, you should find a book (a good one, maybe readers can recommend one); otherwise, you'll just have to take the whole sum / integral thing for granted :)