I came across an example when understanding Fourier Series. There was one part where they converted a trigonometry function to standard variable. They did this:

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

What have they done here? Can this be done to sine too? Thanks in advance for the help.