Expand the step function $$f(x)=\begin{cases}-1, &-1<x<0\\+1,&0<x<1\end{cases}$$ in a series of Legendre polynomials $P_l(x)$. Obtain an explicit formula for the expansion coefficients.

Expand the step function $$f(x)=\begin{cases}-1, &-1<x<0\\+1,&0<x<1\end{cases}$$ in a series of Legendre polynomials $P_l(x)$. Obtain an explicit formula for the expansion coefficients.

Copyright © 2021 JogjaFile Inc.
Hm I gather you really have no idea on how to tackle this. In fact it is really simple. Suppose you have an expansion of (an arbitrary) $f$ as follows:
$$f(x) = \sum_{l=0}^\infty a_lP_l(x)$$
Then
$$\int_{-1}^1f(x)P_n(x)dx = \sum_{l=0}^\infty \int_{-1}^1a_lP_l(x)P_n(x)dx = a_n \cdot \frac{2}{2n+1}$$
As we know the details of function $f$ here, we can determine the value of the integral on the left:
$$\int_{-1}^1f(x)P_n(x)dx = -\int_{-1}^0P_n(x)dx + \int_{0}^1P_n(x)dx$$
For even $n$, $P_n$ is an even function [$P_n(-x)=P_n(x)$], hence the result will be zero.
For odd $n$, $P_n$ is an odd function [$P_n(-x)=-P_n(x)$], hence the result will be
$$2 \cdot\int_{0}^1P_n(x)dx = 2 \cdot\frac{(-1)^n}{2^{2n+1}(n+1)}\cdot \frac{(2n)!}{(n!)^2}$$
I leave it to you to find the expression for $a_n$ (for odd $n$).