I'm looking at example 1 from this page, which reads
Show that $\left\{ {\cos \left( {\frac{{n\pi x}}{L}} \right)} \right\}_{n\,\, = \,\,0}^\infty$ is mutually orthogonal on $- L \le x \le L$.
The author gives a lengthy proof that uses the evenness of cosine to work with the integral from $0$ to $L$ instead. But I think I've found a simpler approach.
If we can show that
$\int_{{ - L}}^{L}{{\cos \left( {\frac{{n\pi x}}{L}} \right)\cos \left( {\frac{{m\pi x}}{L}} \right)\,dx}} = 0$
for all $m \ne n$, then we know that the set is mutually orthogonal.
By a trig identity, the above equals
$\frac{1}{2}\int_{{ - L}}^{L}{{\cos \left({(n-m)\frac{{\pi x}}{L}} \right)+\cos \left( {(n+m)\frac{{\pi x}}{L}} \right)\,dx}}$
$= \frac{1}{2}\int_{{ - L}}^{L}{{\cos \left({(n-m)\frac{{\pi x}}{L}} \right)\,dx}}+\frac{1}{2}\int_{{ - L}}^{L}{{\cos \left( {(n+m)\frac{{\pi x}}{L}} \right)\,dx}}$
Since cosine is an even function, each of these integrals evaluates to zero.
Is this reasoning sound?
Your argument is not correct as already pointed out in the comments. $\int_{-L}^{L} \cos((n-m)\frac {\pi x} L)dx= [\sin ((n-m)\frac {\pi x} L))]/[n-m)\frac {\pi } L)]_{-L}^{L}=0$ since $\sin (k\pi)=0$ for $k=n-m$ as well as for $k=m-n$. Similarly the second integral is also $0$.