# How has this been done? (Integral)

I'm seeing this, and I don't know how it's done:

$$\int_0^\pi\cos (x)\sin (nx)=\frac{1}{2}\int_0^\pi\left[\sin[(n+1)x]+\sin\left[(n-1)x\right]\right]dx$$

I've tried by expressing $\sin(nx)$ as a function of $\sin(x)$ and $\cos(x)$, but I don't get that, not even close.

-
Hint: $\sin((n+1)x)=\sin(nx+x)$ and $\sin((n-1)x)=\sin(nx-x)$, then use angle-sum formula for sine. –  vadim123 May 2 '13 at 19:26
@vadim123 Ok, understood, so this is more a backwards step... I mean done from right to left...? Thanks –  MyUserIsThis May 2 '13 at 19:34
Right to left is the way to go for this problem. –  vadim123 May 2 '13 at 19:45

An equivalent path:

Well known trig identity: $\sin(a+b)=\sin(a)\cos(b)+\sin(b)\cos(a)$

Now, you have that, so ask yourself, what does $\sin(a-b)$ equal?

Now combine your result for $\sin(a-b)$ with the first identity to get an expression for $\sin(a)\cos(b)$.

-
Hint: Use $\sin(x')−\sin(y')=2\cos(\frac{x'+y'}{2})\sin(\frac{x'-y'}{2})$ with $x'=(n+1)x$ and $y'=-(n-1)x$.