By integrating by parts twice, show that $I_n$, as defined below for integers $n > 1$, has the value shown.
$$I_n = \int_0^{\pi / 2} \sin n \theta \cos \theta \,d\theta = \frac{n-\sin(\frac{\pi n}{2})}{n^2 -1}$$
I can do this using the formula $$\sin A \cos B = \frac{1}{2}[\sin(A-B)+\sin(A+B)] ,$$ but when I try using integration by parts I get stuck in a loop of integrating the same thing over and over.
$$\cos{(x)} \sin{\left( n x\right) }=\frac{\sin{\left( \left( n+1\right) x\right) }+\sin{\left( \left( n-1\right) x\right) }}{2}$$ $$\int{\left. \cos{(x)} \sin{\left( n x\right) }dx\right.}=-\frac{\cos{\left( \left( n+1\right) x\right) }}{2 \left( n+1\right) }-\frac{\cos{\left( \left( n-1\right) x\right) }}{2 \left( n-1\right) }$$ Then $$\int_{0}^{\frac{\pi}{2}}{\left. \cos{(x)} \sin{\left( n x\right) }dx\right.}\\= \frac{n}{n^2-1}-\frac{\left( n-1\right) \cos{\left( \frac{{\pi} n+{\pi} }{2}\right) }+\left( n+1\right) \cos{\left( \frac{{\pi} n-{\pi} }{2}\right) }}{2n^2-2}\\= \frac{n}{{{n}^{2}}-1}-\frac{\sin{\left( \frac{{\pi} n}{2}\right) }}{{{n}^{2}}-1}$$