I have worked through the following question

$\displaystyle f(t)=\begin{cases} -1, -2 < t < -1 \\ t, -1 < t < 1 \\ 1, 1 < t < 2 \\

\end{cases}$

with a period of 4

and got

4/n^2*pi^2 sin (n*pi/2) - 2/n*pi cos (n*pi)

Can someone tell me why the cos part of the answer is n*pi and not (-1)^n?