Let $f : (-1,1)\to \mathbb{R}$ be given by
$$f(x) = \begin{cases}0, & x\in (-1,0) \\ 1, & x \in [0,1)\end{cases}$$
and suppose we want to compute the Fourier-Legendre series of $f$, that is we want to write
$$f = \sum_{n}c_n P_n$$
with
$$c_n = \dfrac{\langle f,c_n\rangle }{|P_n|^2} = \dfrac{2}{2n+1}\int_{-1}^{1}f(x)P_n(x)dx.$$
This integral, though is quite complicated. Substituting $f$ we have
$$c_n = \dfrac{2}{2n+1}\int_0^1P_n(x)dx.$$
Now, I've been trying to compute the RHS but I still couldn't. I've tried writing
$$P_n(x) = \dfrac{1}{2^nn!}\dfrac{d^n}{dx^n}[(x^2-1)^n]$$
so that
$$c_n = \dfrac{2}{(2n+1)2^n n!} \left[\dfrac{d^{n-1}}{dx^{n-1}}[(x^2-1)^n]\right]_0^1,$$
but still I can't compute the boundary terms. In that case, is there an easier way to compute those coefficients? If not, how could I finish the calculation I've started?
Thanks very much in advance.