I am currently evaluating the classical Fourier series for $f(x) = \cos(2x)$ on $(-\pi,\pi)$. We can compute the coefficient $a_n$ as
\begin{align} a_{n} &= \frac1\pi \int_{-\pi}^{\pi}f(x) \cos(nx)dx \\ &= \frac{2n \sin(n \pi )}{\pi(n^2-4)} \end{align}
My abilities in performing Fourier series means I can get to the end result but I decided to slow down and look at this result. I am very confused why I have a $\sin(n \pi)$ in the numerator as I would then expect $a_n$ to be zero for any $n$.
Can someone explain to me if I have performed this wrong or if I am just looking at the result the wrong way? Any help would be greatly appreciated.
Andrew
$$\sin(\pi n ) = 0$$
Sines vanishes at integer multiple of $\pi$.