Fourier series function $f(x) = x$ , $f(x+2\pi) = f(x) $       on $ [-\pi , \pi] $ 
How do I know that this function is even or odd? My book says odd, but I don't understand how to work this out? 
also why does $a_0 = 0$ and $a_n = 0$? 
since its an odd function I thought we use the even extension? 
i.e $$ a_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos(nx)dx $$
but the answer is 
$$ b_{n} = \frac{-2}{n}\cos(n\pi) = \frac{2(-1)^{n+1}}{n} $$
 A: If $f(-x)=-f(x)$, then we say $f$ is odd. On the other hand if $f(-x)=f(x)$ we say $f$ is even.
The general Fourier representation of $f$ is 
$$
f(x)=\frac{a_0}{2}+\sum_{n=1}^\infty \biggl[ a_{n}\cos\biggl(\frac{n\pi x}{L}\biggl)+b_{n} \sin\biggl(\frac{n\pi x}{L}\biggl) \biggl]\qquad for~-L\leq x\leq L
$$
where
 \begin{align*}
a_0&=\frac{1}{L}\int_{-L}^{L} f(x)dx \\
 a_n&=\frac{1}{L}\int_{-L}^{L} f(x)\cos\biggl(\frac{n\pi x}{L}\biggl)dx \\
b_n&=\frac{1}{L}\int_{-L}^{L} f(x)\sin\biggl(\frac{n\pi x}{L}\biggl)dx
\end{align*}
And we represent even functions using Fourier cosine since cosine is an even function. For the same reason we use sine function to represent odd function.
In  your case $f$ is an odd function that is why the coefficient of cosine becomes zero. 
To calculate $b_n$, just plug in the values $L=\pi$ and $f(x)=x$ 
$$
b_n =\frac{1}{\pi}\int_{-\pi}^{\pi} x\sin(nx)dx
$$
Hint: use integration by parts to evaluate the integral. 
Hence the answer!
A: The integral of an odd function over symmetric limits is zero.  To see this, we observe
$$\begin{align}
\int_{-a}^af(x)dx&=\int_{-a}^0f(x)dx+\int_{0}^af(x)dx\tag1\\\\
&=-\int_{0}^af(x)dx+\int_{0}^af(x)dx\tag2\\\\
&=0
\end{align}$$
where we used the substitution $x \to -x$ in going from $(1)$ to $(2)$.
We also have that the product of an odd function and an even function is an odd function.  We can show this as follows.  Let $f$ be even and let $g$ be odd and let $h=fg$.  Then 
$$h(-x)=f(-x)g(-x)=f(x)(-g(x))=-h(x)$$
as was to be shown.
For the problem at hand, note that $\cos nx$ is even about $x=0$ and $\sin nx$ is odd about $x=0$.  We also note that $x$ is odd about $x=0$.  Thus, we have 
$$a_n=\frac{1}{\pi}\int_{-\pi}^{\pi}x \cos (nx)\,dx=0$$
