Finding $\int ^\pi_{-\pi}\sin(nx)\cos(mx)dx$ 
Find $$\int ^\pi_{-\pi}\sin(nx)\cos(mx)dx$$

I used the product identity and got:
$\displaystyle \int ^\pi_{-\pi}\sin(nx)\cos(mx)dx = -\frac{\cos((n+m){\cdot}x)}{2{\cdot}(n+m)}-\frac{\cos((n-m){\cdot}x)}{2{\cdot}(n-m)} \Bigg | ^{\pi}_{-\pi}=\frac 12\left(\frac{1}{n+m}-\frac 1 {n-m}\right)$
Since $\cos(c\pi)=\cos(-k\pi)=-1$ but the answer is supposed to be zero, so what did I do wrong? the integral is correct as you can see here.
 A: You are integrating an odd continuous function over $[-\pi,\pi]$. Hence, the integral must be $0$.
Added
Your mistake was probably here
$$\int_{-\pi}^{\pi}\sin(mx)\cos(nx)\,dx=\left[-{\cos((n+m)x)\over 2(n+m)}-{\cos((m-n)x)\over 2(n-m)}\right]_{-\pi}^\pi=\\=-{\cos((n+m)\pi)\over 2(n+m)}-{\cos((m-n)\pi)\over 2(n-m)}+{\cos(-(n+m)\pi)\over 2(n+m)}+{\cos(-(m-n)\pi)\over 2(n-m)}=0$$
And the case $n=m$ must be done on itself, but I leave it to you.
A: You cannot simply plug $\pi$ and $-\pi$ into the result and evaluate without expanding the sum of cosine.
\begin{align}
\frac{-\cos((n+m)x)}{2(n+m)} &- \frac{\cos((n-m)x)}{2(n-m)} \\
\frac{-\cos(nx+mx)}{2(n+m)} &- \frac{\cos(nx-mx)}{2(n-m)} \\
\frac{-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)}{2(n+m)} &- \frac{\cos(nx)\cos(-mx) -\sin(-nx)\sin(-mx)}{2(n-m)} \\
\frac{-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)}{2(n+m)} &- \frac{-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)}{2(n-m)}
\end{align}
Finding common denominators, we get,
\begin{equation}
\begin{split}
&\frac{[m-n][-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)]}{2(n+m)(n-m)} \\ 
&- \frac{[n+m][-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)]}{2(n+m)(n-m)}
\end{split}
\end{equation}
Factoring out $u = \dfrac{-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)}{2(n+m)(n-m)}$ we find
\begin{align}
(n-m)u &- (n+m)u \\
&-2mu
\end{align}
So then we know $\displaystyle\int_{-\pi}^{\pi} \sin(nx)\cos(mx)\;\mathrm{d}x = \left.-2mu\right|_{-\pi}^{\pi}$ where $u = \dfrac{-\cos(nx)\cos(mx) + \sin(nx)\sin(mx)}{2(n+m)(n-m)}$
So,
\begin{align}
\int_{-\pi}^{\pi} \sin(nx)\cos(mx)\;\mathrm{d}x &= \left.m\frac{\cos(nx)\cos(mx) - \sin(nx)\sin(mx)}{(n+m)(n-m)}\right|_{-\pi}^{\pi}\\
&= \frac{m}{(n+m)(n-m)}\bigg[\cos(n\pi)\cos(m\pi) - \sin(n\pi)\sin(m\pi)\\
&- \cos(-n\pi)\cos(-m\pi) - \sin(-n\pi)\sin(-m\pi)\bigg] \\
&= \frac{m}{(n+m)(n-m)}\bigg[\cos(n\pi)\cos(m\pi) - \sin(n\pi)\sin(m\pi)\\
&- \cos(n\pi)\cos(m\pi) - \sin(n\pi)\sin(m\pi)\bigg] \\
&= \frac{-m}{(n+m)(n-m)}\bigg[2\sin(n\pi)\sin(m\pi)\bigg] \\
&= \frac{-m}{(n+m)(n-m)}\bigg[\cos\big((n\pi-m\pi)\big) - \cos\big((n\pi+m\pi\big)\bigg] \\
&= \frac{-m}{(n+m)(n-m)}\bigg[\cos\big((n-m)\pi)\big) - \cos\big((n+m)\pi\big)\bigg)]
\end{align}
Notice $n+m$ and $n-m$ are either both even or both odd, since they are integers. Since cosine of an even number times $\pi$ is always 1 and cosine of an odd number times $\pi$ is always -1, we will always have $\cos\big((n+m)\pi\big) - \cos(\big((n-m)\pi\big) = 0$. We could also note that since $\sin(n\pi) = 0$ for all $n$, we know that the line before this is also 0, without using the product to sum identity. Thus the integral evaluates to $0$ for $n \neq m$. We know that $n\neq m$ because otherwise the $n-m$ in the denominator would be 0 and then the value would be undefined.
A: If you are interested in another way to prove the more general orthogonality relation:
\begin{equation*}
\frac{1}{L}\int^{L}_{-L}\cos \left(n\frac{\pi}{L}t\right) \sin\left(m\frac{\pi}{L}t\right)\mathrm{d}t=0,
\end{equation*}
try using the formulae:
\begin{equation*}
\cos(at)=\frac{e^{iat}+e^{-iat}}{2},~\sin(at)=\frac{e^{iat}-e^{iat}}{2i}.
\end{equation*}
