# Integral formulas for sinus and cosinus: $\int_0^{π}\cos(nx)\cos(mx)dx,\,\int_0^{π}\sin(nx)\sin(mx)dx$

Consider the formulas $$\int_0^{2π} \cos(nx) \cos(mx)\, dx = 0$$ and $$\int_0^{2π} \sin(nx) \sin(mx) \, dx = 0$$ for $m, n \in \mathbb{N_0}, m ≠ n$.

These formulas can be proven when given the integral $\int_0^{2π} e^{ikx} \, dx = 0$ for $k \in \mathbb{Z}$.

However, why do the two formulas on top still hold if we replace $2\pi$ via $\pi$? Because as far as I've tried, $\int_0^{π} e^{ikx} dx$ isn't always equal to zero anymore. It would be nice if someone could elaborate why this is the case :)

• Hint: Rederive those integrals using instead $\cos(a \pm b) = \cos a \cos b \mp \sin a \sin b$. – Simon S Apr 9 '15 at 17:59

Assume that $m$, $n$ are integers such that $m\neq-n$ and $m\neq n$.
You may observe that \begin{align} \int_0^{\pi}\cos (n x) \cos (mx) dx&=\frac12 \int_0^{\pi}\left(\cos((m+n)x) +\cos((m-n)x) \right)dx\\\\ &=\frac12 \left[\left(\frac{\sin((m+n)x)}{m+n} +\frac{\sin((m-n)x)}{m-n}\right)\right]_{x=0}^{x=\pi}\\\\ &=\frac12 \left(\frac{\sin((m+n)\pi)}{m+n} +\frac{\sin((m-n)\pi)}{m-n}\right)-0\\\\ &=0. \end{align} Similarly, \begin{align} \int_0^{\pi}\sin (n x) \sin (mx) dx&=\frac12 \int_0^{\pi}\left(\cos((m-n)x) -\cos((m+n)x) \right)dx\\\\ &=\frac12 \left[\left(\frac{\sin((m-n)x)}{m-n} -\frac{\sin((m+n)x)}{m+n}\right)\right]_{x=0}^{x=\pi}\\\\ &=\frac12 \left(\frac{\sin((m-n)\pi)}{m-n}-\frac{\sin((m+n)\pi)}{m+n}\right)-0\\\\ &=0. \end{align}