Show that $\int_{-\pi}^\pi\sin mx\sin nx d x$ is 0 $m\neq n$ and $\pi$ if $m=n$ using integration by parts
Show that $$\int_{-\pi}^{\pi}\sin{mx}\,\sin{nx}\, d x =\begin{cases} 0&\text{if }m\neq n,\\ \pi&\text{if }m=n. \end{cases}$$ by using integration by parts.
I've done the following, but I'm not sure if I went the wrong direction, if I messed up some calculation, or if I'm almost there and just can't see what to do next...
$$\int_{-\pi}^{\pi}\sin{mx}\,\sin{nx} \, d x=-\left(\frac{n}{n^2-m}\right)\sin{mx}\cos{nx}+\left(\frac{m}{n^2-m}\right)\cos{mx}\sin{nx}+C$$
$$=-2\left(\frac{n}{n^2-m}\right)\sin{m\pi}\cos{n\pi}+2\left(\frac{m}{n^2-m}\right)\cos{m\pi}\sin{n\pi}$$
Now ... I figure that if $n=m$, then I can just as well replace them all with a 3rd variable... say $z$...
$$=-2\left(\frac{z}{z^2-z}\right)\sin{z\pi}\cos{z\pi}+2\left(\frac{z}{z^2-z}\right)\cos{z\pi}\sin{z\pi}$$
Wouldn't that equal 0? Or am I completely mistaken?
Addition:
By following the suggestions below and using the product-to-sum forumulas, I got the following:
$$\frac{1}{2}\int\cos{((n-m)x)}\ dx-\frac{1}{2}\int\cos{((n+m)x)}\ dx=\frac{\sin{((n-m)x)}}{2(n-m)}-\frac{\sin{((n+m)x)}}{2(n+m)}$$
So now if $n=m$, then the first quotient will end up dividing by 0...
First, since $\,\sin kx\,$ is an odd function, $\,\sin mx\sin nx\,$ is even, so
$$\int\limits_{-\pi}^\pi\sin mx\sin nx\,dx=2\int\limits_0^\pi\sin mx\sin nx\,dx$$
Now, by parts:
$$u=\sin mx\;,\;\;u'=m\cos mx\\v'=\sin nx\;,\;\;v=-\frac{1}{n}\cos nx$$
so
$$\text{J:}=2\int\limits_0^\pi\sin mx\sin nx\,dx=\stackrel{\text{this is zero}}{\overbrace{\left.-\frac{2}{n}\sin mx\cos nx\right|_0^\pi}}+\frac{2m}{n}\int\limits_0^\pi\cos mx\cos nx\,dx$$
Again, by parts:
$$u=\cos mx\;,\;\;u'=-m\sin mx\\v'=\cos nx\;,\;\;v=\frac{1}{n}\sin nx\;\;\;\Longrightarrow$$
$$\text{J}=\left.-\frac{2m}{n^2}\sin nx\cos mx\right|_0^\pi+\frac{2m^2}{n^2}\int\limits_0^\pi\sin mx\sin nx\,dx\Longrightarrow$$
$$\left(\frac{n^2-m^2}{n^2}\right)\text{J}=0\;,\;\text{and thus} \;n\neq m\Longrightarrow \text{J}\,=0\,$$
If $\,n=m\,$ , then after the line where J first appears we get
$$2\int\limits_0^\pi\sin mx\sin mx\,dx=2\int\limits_0^\pi\cos mx\cos mx\,dx\Longrightarrow$$ $$2\text{ J}\,=2\int\limits_0^\pi\left(\cos mx\cos mx+\sin mx\sin mx\right)\,dx=2\int\limits_0^\pi \cos[(m-m)x]\,dx=$$
$$=2\int\limits_0^\pi dx=2\pi\Longrightarrow\,\text{ J}\,=\pi$$
Addedd: Using the complex exponential:
$$\sin kx:=\frac{e^{ikx}-e^{-ikx}}{2i}\;,\;\;k,x\in\Bbb R\Longrightarrow$$
$$\text{ J}\,=2\int\limits_0^\pi\sin mx\sin nx\,dx=-\frac{1}{2}\int\limits_0^\pi\left(e^{imx}-e^{-imx}\right)\left(e^{inx}-e^{-inx}\right)dx=$$
$$-\frac{1}{2}\int\limits_0^\pi\left[\left(e^{ix(m+n)}+e^{-ix(m+n)}\right)-\left(e^{ix(m-n)}+e^{-ix(m-n)}\right)\right] dx=$$
$$=\int\limits_0^\pi\left(\cos(m-n)x-\cos(m+n)x\right)dx=$$
$$=\begin{cases}\int\limits_0^\pi(dx-\cos2mx)dx=\pi-\left.\frac{1}{2m}\sin 2mx\right|_0^\pi=\pi\;\;,\;\;\;\;m=n\\{}\\{}\\ \left.\left(\frac{1}{m-n}\sin(m-n)x-\frac{1}{m+n}\sin(m+n)x\right)\right|_0^\pi=0\;\;,\;\;\;\;m\neq n\end{cases}$$
Of course, the use of the complex exponential in this case is a lame excuse to "forget" the basic trigonometric identity we got here and get it in a rather easy way.
HINT:
We don't really need Integration by parts
We know, $$2\sin mx\sin nx=\cos(m-n)x-\cos(m+n)x$$
$$\cos(m-n)x-\cos(m+n)x=\begin{cases} 1-\cos2nx&\text{ if }m=n,\\ \cos2nx-1&\text{if }m+n=0. \end{cases} $$
Now use $\int\cos axdx=\frac{\sin ax}a$