I have worked through the following question

$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?

2. Well,

$\cos(n\pi)=(-1)^{n}.$

You can convince yourself of this by looking at the graph of the cosine function.

3. so why would this be (-1)^2 and not the another?

5. The step before I got the answer of (-1)^2 was cos(n*pi) for post 3. The step before post 1 was cos(n*pi) and stayed cos(n*pi) and I dont know why.

6. Where did the (-1)^2 come from? I thought we were talking about (-1)^n. Did you mean (-1)^n in all your posts?

7. yeah sorry I do

8. Ah. So the answer to your question is post # 5 is that I have no clue. Post # 2 still stands. It could be a preference of the author, though I find the exponential expression to be simpler than the trig expression.

9. so the answer can be both in post #2

10. They're entirely equivalent. It's a preference thing.

11. or right, we were never told that in class. Thats helped me, thanks for that.

12. You're very welcome. Have a good one!