# Calculating Fourier expansion using Legendre Polynomials

I'm trying to write any function of the type $t^m$ using Legendre polynomials $P_n(t)$ . That means:

$$t^m=\sum_{n=0}^\infty\langle P_n,t_m\rangle P_n =\sum_{n=0}^\infty a_{mn}P_n$$

Where I have to calculate:

$$a_{mn}=\frac{1}{2^n n!}\int_{-1}^{1}t^m\frac{d^n}{dt^n}(t^2-1)^ ndt$$

If I integrate by parts:

$$a_{mn}=\frac{1}{2^n n!}\left( \left. t^{m}\frac{d^{n-1}}{dt^{n-1}}(t^2-1)^ n \right|_{-1}^1 -m\int_{-1}^{1}t^{m-1}\frac{d^{n-1}}{dt^{n-1}}(t^2-1)^ ndt \right)$$

If I assume that the first part is zero (which may be wrong) and since terms where n>m are zero:

$$a_{mn}=\frac{1}{2^n n!}\left( (-1)^nm(m-1)\dots(m-n+1)\int_{-1}^{1}t^{m-n}(t^2-1)^ ndt \right)$$

I can't see how to calculate this integral. I guess parity is involved in some way.

NOTE: I forgot to normalize $P_n$, there should be a multiplicative factor.

A closed-form result for $a_{mn}$ is here: http://mathworld.wolfram.com/LegendrePolynomial.html.
See where it gives the first few powers of $x$ up to $x^6$, then says "A closed form for these is given by." The citation for this result is a personal communication.