# Doubt in Fourier Series

When we solve the equation $$\frac 2{\pi}\int_{0}^{\pi}k\sin(nx)dx;$$ after integrating it, we get $\frac {2k}{n\pi}(1-\cos n\pi)$. Why is $\cos n\pi=(-1)^n$?

• Look at the graph of $cos x$. – gmath Sep 24 '14 at 14:49
• $\cos 0=1$, $\cos \pi=-1$, $\cos 2\pi=1$, ... – Paul Sundheim Sep 24 '14 at 14:51
• Oh.. i did'nt think of that. Thanks for the help guys! – Fad Lion Sep 24 '14 at 14:55

The cosine is $2\pi$ periodic and has maxima at $2\pi k$ for $k \in \mathbb Z$ and minima at $\pi (2k+1)$ for $k \in \mathbb Z$. So $\cos n \pi$ is always at a maximum or minimum for $n \in \mathbb Z$.
\begin{align*}&\cos 0=1\implies \cos(0+2n\pi)=\cos 2n\pi=1\\ &\cos \pi=1\implies \cos(\pi+2n\pi)=\cos((2n+1)\pi)=-1\end{align*}\;\;\implies \cos(n\pi)=(-1)^n