AP Calculus BC

Integral of x sin 2x: Answer, Proof, and Steps

The integral of x sin(2x) is -(x cos(2x))/2 + sin(2x)/4 + C. Integration by parts with u = x and dv = sin(2x) dx gives v = -cos(2x)/2, and the leftover integral of cos(2x)/2 supplies the sin(2x)/4 term.

xsin2xdx=xcos2x2+sin2x4+C\int x\sin 2x\,dx = -\frac{x\cos 2x}{2}+\frac{\sin 2x}{4} + C

Setting up parts

A polynomial multiplied by a sine is the standard integration by parts case. Differentiating xx removes it entirely, and integrating sin2x\sin 2x keeps the trig factor the same size.

udv=uvvdu\int u\,dv = uv - \int v\,du

Two separate things happen inside vv: the antiderivative of sine carries a minus sign, and the inside coefficient 2 divides.

u=x,du=dx,dv=sin2xdx,v=cos2x2u = x, \quad du = dx, \quad dv = \sin 2x\,dx, \quad v = -\frac{\cos 2x}{2}

Finishing and checking

Substituting into the formula, the minus sign in vv meets the minus sign in front of vdu\int v\,du, so the remaining integral enters with a plus.

xsin2xdx=xcos2x2+cos2x2dx\int x\sin 2x\,dx = -\frac{x\cos 2x}{2} + \int \frac{\cos 2x}{2}\,dx
cos2x2dx=12sin2x2=sin2x4\int \frac{\cos 2x}{2}\,dx = \frac{1}{2}\cdot\frac{\sin 2x}{2} = \frac{\sin 2x}{4}
xsin2xdx=xcos2x2+sin2x4+C\int x\sin 2x\,dx = -\frac{x\cos 2x}{2} + \frac{\sin 2x}{4} + C

Differentiate to confirm. The product rule on the first term gives cos2x2+xsin2x-\frac{\cos 2x}{2} + x\sin 2x, and the second term gives 2cos2x4=cos2x2\frac{2\cos 2x}{4} = \frac{\cos 2x}{2}. The cosine pieces cancel, leaving xsin2xx\sin 2x.

The mistake students make

Almost every wrong answer here is a sign, not a method. Writing v=cos2x2v = \frac{\cos 2x}{2} without the minus sign negates the whole answer, since that one sign rides through both terms, while forgetting the minus in front of vdu\int v\,du flips only the second term. Differentiating separates them: the first slip returns xsin2x-x\sin 2x, and the second returns xsin2xcos2xx\sin 2x - \cos 2x.

The other slip is dropping the 12\frac{1}{2} in vv, which comes from the inside coefficient. Both terms in the final answer inherit that half, which is why the second one lands on a 4 in the denominator rather than a 2.

One derivative settles it

Differentiating your answer takes about fifteen seconds and catches every sign error. If the product rule does not return xsin2xx\sin 2x exactly, the mistake is upstream in vv.

Every answer on this page is machine checked

An automated test differentiates the antiderivative above and confirms it returns the integrand. A wrong sign or a missing factor fails the build, so it cannot reach you.

Frequently asked questions

Where does the plus sign on sin 2x over 4 come from?

From two minus signs meeting. v=cos2x2v = -\frac{\cos 2x}{2} is negative, and the parts formula subtracts vdu\int v\,du, so the leftover integral enters positive.

Can u-substitution do this instead?

No. Setting u=2xu = 2x clears the inside coefficient but leaves 14usinudu\frac{1}{4}\int u\sin u\,du, still a product of two different kinds of function. The stray xx is not a multiple of the derivative of anything inside, so substitution alone cannot finish it.

What is the definite integral from 0 to pi/2?

Evaluate xcos2x2+sin2x4-\frac{x\cos 2x}{2} + \frac{\sin 2x}{4} at both ends. At x=π2x = \frac{\pi}{2}, cosπ=1\cos \pi = -1 and sinπ=0\sin \pi = 0, giving π4\frac{\pi}{4}; at x=0x = 0 both terms vanish. The integral is π4\frac{\pi}{4}.