Integrating Trig Functions How you I solve the following integral?
$\int_{-\pi}^\pi \cos(5x)\cos(nx)dx$
I know I need to use the ${1\over 2}(\cos(u-v)+\cos(u+v))$ but I keep getting zero.

Firstly, $\cos(nx)\cos(5x)=\frac{1}{2}(\cos((n-5)x)+\cos((n+5)x))$.
If $n\neq\pm5$, we split the integral up as follows:
\begin{align*}
\int_{-\pi}^{\pi} \cos(nx)\cos(5x)dx&=\frac{1}{2}\left(\int_{-\pi}^{\pi}\cos((n-5)x)dx+\int_{-\pi}^{\pi}\cos((n+5)x)\right) \\
&= \frac{1}{2}\left[\frac{1}{n-5}\sin((n-5)x)+\frac{1}{n+5}\sin((n+5)x)\right]_{-\pi}^{\pi} \\
&= \frac{1}{2}\left(\left(\frac{1}{n-5}\sin((n-5)\pi)+\frac{1}{n+5}\sin((n+5)\pi)\right)-\left(\frac{1}{n-5}\sin(-(n-5)\pi)+\frac{1}{n+5}\sin(-(n+5)\pi)\right)\right) \\
&= \frac{1}{n-5}\sin((n-5)\pi)+\frac{1}{n+5}\sin((n+5)\pi)\:.
\end{align*}
Now if we are assuming that $n$ is an integer, then because $\sin$ is zero for integer multiples of $\pi$, this integral becomes 0.
If instead $n$ were equal to $\pm5$, using the evenness of the cosine function, we see:
\begin{align*}
\int_{-\pi}^{\pi} \cos(\pm5x)\cos(5x)dx &= \int_{-\pi}^{\pi} \cos^2(5x)dx \\
&= \frac{1}{2}\int_{-\pi}^{\pi}(\cos(10x)+1)dx \\
&= \frac{1}{2}\left[\frac{1}{10}\sin(10x)+x\right]_{-\pi}^{\pi} \\
&= \frac{1}{2}\left(\left(\frac{1}{10}\sin(10\pi)+\pi\right)-\left(\frac{1}{10}\sin(-10\pi)-\pi\right)\right) \\
&= \pi\:.
\end{align*}
