Series expansion Fourier-Legendre Can anyone explain me how can I expand this function using the Fourier-Legendre expansion?
f(x) = x ; -1<=x<=1

Thanks.
 A: As $f(x)$ itself is a Legendre polynomial, namely $P_1$, the expansion can directly be seen to be
$$f(x) = x = 0\cdot P_0+1\cdot P_1+0\cdot P_2+0\cdot P_3+ \cdot\cdot\cdot$$
Formally, you could look at the Fourier-Legendre expansion defined for any $f(x)$ as follows:
$$f(x)=\sum_{j=0}^\infty a_jP_j(x)$$
where the coefficients can be calculated from
$$a_j=\frac{\int_{-1}^{+1} f(x)P_jdx}{\int_{-1}^{+1} P_j^2dx}$$
The integral $\int_{-1}^{+1} P_j^2dx$ is easily evaluated to be equal to $\frac{2}{2j+1}$, see for instance (Legendre Polynomials: proofs).
Here, the other integral can be evaluated for $j=0$ and $j>=1$ separately as follows:
$$\int_{-1}^{+1} f(x)P_0dx=\int_{-1}^{+1} xdx=0$$
and
$$\int_{-1}^{+1} f(x)P_jdx=\int_{-1}^{+1} xP_jdx=\int_{-1}^{+1} \frac{(j+1)P_{j+1}+jP_{j-1}}{2j+1}dx$$
which equals zero for $j>=2$ because $\int_{-1}^{+1} P_jdx=0$ when $j>=1$, and only the term for $j=1$ evaluates to a non-zero-value:
$$\int_{-1}^{+1} xP_1dx=\int_{-1}^{+1} \frac{2P_2+P_0}{3}=\int_{-1}^{+1} \frac{P_0}{3}=\int_{-1}^{+1} \frac{1}{3}=\frac{2}{3}$$
And thus the only non-zero coefficient is
$$a_1=\frac{2/3}{2/3}=1$$
as expected.
Above use has been made of the recurrence formula $(n+1)P_{n+1}=(2n+1)xP_n−nP_{n−1}$ for which a proof can be found in (Legendre Equation Properties), and the fact that when $n\not =m$, then $P_n$ and $P_m$ are orthogonal, that is to say $\int_{-1}^{+1} P_nP_mdx=0$, with as special case $\int_{-1}^{+1} P_ndx=\int_{-1}^{+1} P_nP_0dx=0$ when $n\not=0$.
Of course, using this same orthogonality property and noting that $f(x)=x=P_1(x)$, you could derive immediately that $\int_{-1}^{+1} f(x)P_j(x)dx=\int_{-1}^{+1} P_1(x)P_j(x)dx=0$, thus also $a_j=0$, when $j\not=1$.
