Proving integral is zero I want to prove that for $m,n\in \mathbb{N}$, $m\neq n$ following holds $(\cos (nx),\cos (mx))=0$ in $L_2(-\pi,\pi)$. Which means
$$\int_{-\pi}^\pi\cos(nx)\cos(mx)dx=0.$$
Is there a clever way to do this?
 A: You may write $ \cos (nx) = \dfrac{\exp (inx   ) + \exp(-inx)}{2}$ and then when calculating the integral you will end up with exponentials contributing zero. 
Notice this is equivalent with Biro's way, however it is easier for me to remember the used identity using Euler's formula.
A: If you are in an exam and you simply can't remember the trigonometric formula used by @MichaelBiro, and you also are afraid of @clark's complex exponentials, then integrating by parts twice will save you (assuming $n \ne 0$):
$$\int \limits _{-\pi} ^\pi \underbrace {\cos mx} _u \underbrace {\cos nx} _{v'} \ \Bbb d x = \cos mx \frac {\sin nx} n \Bigg| _{-\pi} ^\pi - \int \limits _{-\pi} ^\pi (-m \sin mx) \frac {\sin nx} n \Bbb d x =\\
\frac m n \int \limits _{-\pi} ^\pi \underbrace{\sin mx} _u \underbrace{\sin nx} _{v'} \Bbb d x = \frac m n \left( \sin mx \frac {-\cos nx} n \Bigg| _{-\pi} ^\pi - \int \limits _{-\pi} ^\pi m \cos mx \frac {-\cos nx} n \ \Bbb d x \right) =\\
\frac {m^2} {n^2} \int \limits _{-\pi} ^\pi \cos mx \cos nx \ \Bbb d x$$
whence it follows that
$$\left( \frac {m^2} {n^2} - 1 \right) \int \limits _{-\pi} ^\pi \cos mx \cos nx \ \Bbb d x = 0$$
whence (remembering that $m \ne n$)
$$\int \limits _{-\pi} ^\pi \cos mx \cos nx \ \Bbb d x = 0 .$$
If $n = 0$ then $m \ne 0$, so just exchange $u$ and $v$.
A: $$\cos(nx)\cos(mx) = \frac{1}{2}\left( \cos((n-m)x) - \cos((n + m)x)\right)$$
A: Just observe that $\cos nx \cos mx = \frac12(\cos(n+m)x + \cos(n-m)x)$.
Assuming that $n\neq \pm m$, this has an antiderivative which is a constant multiple of $\sin (n+m)x + \sin(n-m)x$, which vanishes when evaluated at each of the limits of integration.
I don't know this formula automatically, by the way. I just wrote
$$\cos nx \cos mx = \left(\frac{e^{inx}+e^{-inx}}2\right)\left(\frac{e^{imx}+e^{-imx}}2\right)$$
$$= \frac12\left(\frac{e^{i(n+m)x}+ e^{i(n-m)x}+ e^{-i(n-m)x}+e^{-i(n+m)x}}2\right)$$
$$= \frac12{}\left(\frac{e^{i(n+m)x}+e^{-i(n+m)x}}2 + \frac{e^{i(n-m)x}+e^{-i(n-m)x}}2\right)$$
$$=\frac12 (\cos (n+m)x + \cos (n-m)x)$$
