I am trying to evaluate the following integral:
$$I_n=\int\limits_{-1}^1 f(x)P_n(x)dx$$ where $f(x)=1$ for $x\in[-1,0)$ and $f(x)=-1$ for $x\in(0,1]$ and $P_n(x)$ is the Legendre polynomial of degree n.
What I did (which is most probably wrong):
Argue that $I_n=0$ for all even n since $P_{even \,\,\, n}$ is symmetric along $x=0$. But then when I tried to evaluate the odd $n$'s , I get $I_n=2\int\limits_{-1}^0 P_n(x) dx=2\int\limits_{-1}^0 P'_{n+1}(x) -P'_{n-1}(x)dx=0$??
Thanks for helping!
The Legendre polynomials satisfy $(2n+1)P_n(x)=P'_{n+1}(x)-P'_{n-1}(x)$, and $P_n(-1)=(-1)^n$, so for odd $n$ we have:
$$ \begin{eqnarray} I_n&=&2\int_{-1}^0 P_n(x)dx\\ &=&\frac{2}{2n+1}\left[ (P_{n+1}(0)-P_{n-1}(0)) - (P_{n+1}(-1)-P_{n-1}(-1)) \right] \\ &=&\frac{2}{2n+1}(P_{n+1}(0)-P_{n-1}(0))\end{eqnarray} $$ But for odd $n$, $P_{n+1}(0)\ne P_{n-1}(0)$, so $I_n \ne 0$.