Compute the Fourier series 
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: $$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
A: We know that $f(x)$ is odd iff $f(x) = -f(-x)$, i.e. it is symmetric in the origin; hence the function's areas cancel and are equal to zero. 
In this case the function is clearly odd, so the integral $A_0=0$. But also the integral $A_n=0$ as $cos(*)$ is an even function and an even function multiplied by an odd function is an odd function. 
We are left with just computing the $B_n$ coefficient. Note that it's a piecewise function, so we split the integral
$$B_n = \frac{1}{\pi}\left(\int_{-\pi}^0 \sin(nx) + \int_0^{\pi} -sin(nx)\right).$$
I'll leave you to compute the details. 
Note that the Fourier series is an infinite series. We can see that after the first 10 terms the function is resembled. After 60 terms it's beginning to look very similar to $f(x)$ apart from at the discontinuities. This is Gibbs phenomenon!

A: thank u all for the answers, i finally calculated this
$$A_0=\frac 1{2\pi}\int_{-\pi}^{\pi}f(x) \, dx = \frac 1{2\pi}\left(\int_{-\pi}^{0}f(x)dx +\int_{0}^{\pi}f(x)dx\right)=\frac 1{2\pi}\left(\int_{-\pi}^{0}-1dx +\int_{0}^{\pi}1dx\right)=0  \\$$
$$A_n=\frac 1\pi\int_{-\pi}^{\pi}f(x)\cos(nx) \, dx=\frac 1{\pi}\left(\int_{-\pi}^{0}-cos(nx)dx +\int_{0}^{\pi}cos(nx)dx\right) = 0\\$$
$$B_n=\frac 1\pi \int_{-\pi}^{\pi}f(x)\sin(nx) \, dx = \frac 1{\pi}\left(\int_{-\pi}^{0}-sin(nx)dx +\int_{0}^{\pi}sin(nx)dx\right) = \frac 1{\pi}\left(\left[\frac 1n cos(nx)\right]_{-\pi}^{0} +\left[\frac {-1}n cos(nx)\right]_{0}^{\pi}\right) = \frac 1\pi\left(\frac 1n-\frac {cos(\pi n)}{n}+\left[-\frac {cos(\pi n)}{n}-\left(-\frac 1n\right)\right]\right) = \frac {2(1-cos(\pi n))}{\pi n}\\$$
