Why is $\int_0^L [\cos(\frac{n \pi x}{L} - \frac{m \pi x}{L}) - \cos(\frac{n \pi x}{L} + \frac{m \pi x}{L})]dx = L $? Why is $\int_0^L [\cos(\frac{n \pi x}{L} - \frac{m \pi x}{L}) - \cos(\frac{n \pi x}{L} + \frac{m \pi x}{L})]dx = L$ when $n$ does equal $m$ but neither $n$ nor $m$ equal $0$?
$n$ is an integer, $L$ is a constant.
 A: If $n = m$ then
$$\begin{aligned}
\int_0^L \cos\left(\frac{(n-m)\pi x}{L}\right) dx
&= \int_0^L \cos(0) dx \\
&= \int_0^L 1\ dx \\
&= L
\end{aligned}$$
Note that if $n+m=0$ then (substituting $n=m$) we have $2n = 0$, so $n=0$, and similarly, $m=0$. Since this is not the case, we must have $n+m \neq 0$. Then:
$$\begin{aligned}
\int_0^L \cos\left(\frac{(n+m)\pi x}{L}\right) dx
&=\frac{L}{(n+m)\pi}\left.\sin\left(\frac{(n+m)\pi x}{L}\right)\right|_{x=0}^{L} \\
&= \frac{L}{(n+m)\pi}\sin\left((n+m)\pi\right) \\
&= 0
\end{aligned}$$
since $\sin(k\pi) = 0$ for any integer $k$.
A: Well, since you said $n = m$ your integral reduces to
$$\int_0^L\ 1 - \cos\left(\frac{2\pi n x}{L}\right)\ dx$$
which is
$$L - \frac{L\sin(2 n \pi)}{2 n \pi} = L$$
Since n is an integer and $\sin(2n\pi) = 0$ for integers $n$. 
A: Hints
$1.$ Note that
$$\cos(x+y)=\cos(x)\cos(y)-\sin(x)\sin(y) \\
\cos(x-y)=\cos(x)\cos(y)+\sin(x)\sin(y)$$
$2.$ Subtract the above relations
$$\cos(x-y)-\cos(x+y)=2\sin(x)\sin(y)$$
$3.$ Conclude that
$$\cos(\frac{n \pi x}{L} - \frac{m \pi x}{L}) - \cos(\frac{n \pi x}{L} + \frac{m \pi x}{L})=2\sin(\frac{n \pi x}{L})\sin(\frac{m \pi x}{L})$$
$4.$ Prove that
$$\int_{0}^{L}\sin(\frac{n \pi x}{L})\sin(\frac{m \pi x}{L})=\delta_{mn}\int_{0}^{L}\sin^2(\frac{n \pi x}{L})$$
A: For $n\neq m$, $n,m\in \mathbb{Z}$ 
$$\int_0^L [\cos(\frac{n \pi x}{L} - \frac{m \pi x}{L}) - \cos(\frac{n \pi x}{L} + \frac{m \pi x}{L})]dx \\=
\int_0^L \cos(\left(n -m\right)\frac{\pi  }{L} x) dx - \int_0^L \cos(\left(n +m\right)\frac{\pi  }{L} x) dx 
 L=\\
\frac{L}{n-m}\sin((n -m)\frac{\pi}{L} x) \Bigg|_0^L + 
\frac{L}{n+m}\sin((n + m) \frac{\pi}{L} x \Bigg|_0^L =\\
\frac{L}{(n-m)\pi}\sin((n -m){\pi})  + 
\frac{L}{(n+m)\pi}\sin((n + m) {\pi})=0
$$
For $n= m$, 
$$\int_0^L [\cos(\frac{n \pi x}{L} - \frac{m \pi x}{L}) - \cos(\frac{n \pi x}{L} + \frac{m \pi x}{L})]dx \\=
\int_0^L [\cos(0) - \cos(\frac{2n \pi x}{L} )]dx =\int_0^L [1-\cos(\frac{2n \pi x}{L} )]dx =\\
x\Bigg|_0^L + 
\frac{L}{2n\pi}\sin(2n \frac{\pi}{L} x) \Bigg|_0^L=L
$$
