# How would you integrate $\int x\cos(x)\sin(2nx)\,dx$?

How would you integrate $$\int x\cos(x)\sin(2nx)\,dx?$$ I have no idea how to integrate this. take one of the trig functions away and I could do integration by parts. I would really appreciate the help!

• Use the formula $2\cos A \sin B =\sin (A+B)-\sin(A-B)$ – Samrat Mukhopadhyay Nov 6 '14 at 17:22

The first thing I would do is use the product-to-sum identity $$\sin \alpha \cos \beta = \frac{1}{2} (\sin (\alpha+\beta) + \sin(\alpha-\beta)).$$

• Oh okay. So for my problem I could rewrite it as $\displaystyle\frac{1}{2}x\sin(x(2n+1)) + \displaystyle\frac{1}{2}x\sin(x(2n-1))$? – Nick Freeman Nov 6 '14 at 17:35
• That is correct. Now you may integrate each term by whatever method you see fit. – heropup Nov 6 '14 at 17:48

Integrating by parts,

$\displaystyle\int x\cos(x)\sin(2nx)dx$

$$=x\displaystyle\int\cos(x)\sin(2nx)dx-\int\left(\frac{dx}{dx}\int\cos(x)\sin(2nx)dx\right)dx$$

Now by Werner Formula: $2\cos(x)\sin(2nx)=\sin(2n+1)x+\sin(2n-1)x$

Hint: I think you surely know how to evaluate $$\int xe^{kx}\;dx$$ using integration by parts. This works regardless of whether $k$ is real or complex. Using the facts that $$\cos t = \frac{e^{it}+e^{-it}}{2}$$ and $$\sin t = \dfrac{e^{it}-e^{-it}}{2i}$$ you can write your integrand as a sum of terms of the form $xe^{kx}$ by multiplying these expressions for the sine and cosine together and simplifying products of exponentials.

It is dirt simple, if tedious, and doesn't require anything more than algebra (the simplification, that is). Then you can integrate each term and recombine using the equivalent fact $$e^{it} = \cos t + i\sin t$$.

This is admittedly somewhat lengthy, but it always works and you can easily remember how to do it, so it's a fallback if you're stuck.

Comment: Note that you can integrate any polynomial function of sines and cosines using this technique.