what is the best way to solve this integral: have this integral, and looking for the best\quickest way to solve it:
$$\int_{-b}^bD\sin\left({\pi ny \over b}\right)\sin\left({\pi n'y \over b}\right)dy$$
 A: $$\cos(a+b)=\cos(a) \cos(b)-\sin(a) \sin(b)$$
$$\cos(a-b)=\cos(a) \cos(b)+\sin(a) \sin(b)$$
From these two relations ,we get that:
$$\sin(a) \sin(b)=\frac{\cos(a-b)-\cos(a+b)}{2}$$
A: Use complex exponential functions: $2i \sin(x) = \exp(ix)-\exp(-ix)$. Let $k=n\pi/b$ and $k'=n'\pi/b$, then we can rewrite the integral as,
$$\frac{-D}{4} \int_{-b}^b dy (e^{iky}-e^{-iky})(e^{ik'y}-e^{-ik'y}), $$
$$= \frac{-D}{4} \int_{-b}^b dy (e^{i(k+k')y}-e^{-i(k-k'
)y}+e^{i(k-k')y}-e^{-i(k+k'
)y}), $$
$$=  \frac{-D}{4} \left[ \frac{e^{i(k+k')y}}{i(k+k')}-\frac{e^{-i(k-k'
)y}}{-i(k-k')}+\frac{e^{i(k-k')y}}{i(k-k')}-\frac{e^{-i(k+k')y}}{-i(k+k')} \right]_{-b}^b,  $$
$$=  \frac{-D}{4} \left[ \frac{e^{i(k+k')y}+e^{-i(k+k')y}}{i(k+k')}+\frac{e^{-i(k-k'
)y}+e^{i(k-k')y}}{i(k-k')}+\right]_{-b}^b,  $$
$$=  \frac{-D}{4} \left[ \frac{2\cos((k+k')y)}{i(k+k')}+\frac{2\cos((k-k')y)}{i(k-k')}+\right]_{-b}^b,  $$
$$=  \frac{-D}{4} \left[ \frac{2\cos((k+k')b)-2\cos(-(k+k')b)}{i(k+k')} \\+\frac{2\cos((k-k')b)-2\cos(-(k-k')b)}{i(k-k')}+\right],  $$
$$=  0. $$
However since the anti-derivatives used above had a division by $k-k'$ we must treat the case where $k=k'$ separately. 
