Find the Fourier Series of $f(x)=\begin{cases} 1 & x \in(-\pi,0) \\ -1 & x \in(0, \pi) \end{cases}$.
I know that: $$f(x)=A_0+\sum_{n=1}^{\infty} \left(A_n \cos \frac {n\pi x}L+B_n \sin \frac {n\pi x}{L} \right)$$ and I understand that since the period $L = \pi$ then $$f(x)=A_0+\sum_{n=1}^{\infty}(A_n\cos(nx)+B_n \sin(nx))$$ and $$A_0=\frac 1{2\pi}\int_{-\pi}^{\pi}f(x) \, dx \\ A_n=\frac 1\pi\int_{-\pi}^{\pi}f(x)\cos(nx) \, dx \\B_n= \frac 1\pi \int_{-\pi}^{\pi}f(x)\sin(nx) \, dx$$
But don't know what to do next, is $f(x)$ odd? Then it has to simplify the integral calculation?


$$A_0 = \frac 1{2\pi} \left(\int_{-\pi}^0 -1\ dx + \int_{0}^\pi 1\ dx \right)=0$$
Not at all surprising considering $f(x)$ is an odd function. And since $f(x)$ is odd we know: $$A_n = \frac 1{\pi} \left(\int_{-\pi}^0 -\cos nx\ dx + \int_{0}^\pi \cos nx\ dx \right)=0$$
Leaving
$$B_n = \frac 1{\pi} \left (\int_{-\pi}^0 -\sin nx\ dx + \int_{0}^\pi \sin nx\ dx \right)$$
to keep you busy. Let me know if you still need help