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.

∫xsin⁡2x dx=−xcos⁡2x2+sin⁡2x4+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 sin⁡2x\sin 2x keeps the trig factor the same size.

∫u dv=uv−∫v du\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=sin⁡2x dx,v=−cos⁡2x2u = 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 ∫v du\int v\,du, so the remaining integral enters with a plus.

∫xsin⁡2x dx=−xcos⁡2x2+∫cos⁡2x2 dx\int x\sin 2x\,dx = -\frac{x\cos 2x}{2} + \int \frac{\cos 2x}{2}\,dx
∫cos⁡2x2 dx=12⋅sin⁡2x2=sin⁡2x4\int \frac{\cos 2x}{2}\,dx = \frac{1}{2}\cdot\frac{\sin 2x}{2} = \frac{\sin 2x}{4}
∫xsin⁡2x dx=−xcos⁡2x2+sin⁡2x4+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 −cos⁡2x2+xsin⁡2x-\frac{\cos 2x}{2} + x\sin 2x, and the second term gives 2cos⁡2x4=cos⁡2x2\frac{2\cos 2x}{4} = \frac{\cos 2x}{2}. The cosine pieces cancel, leaving xsin⁡2xx\sin 2x.

The mistake students make

Almost every wrong answer here is a sign, not a method. Writing v=cos⁡2x2v = \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 ∫v du\int v\,du flips only the second term. Differentiating separates them: the first slip returns −xsin⁡2x-x\sin 2x, and the second returns xsin⁡2x−cos⁡2xx\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 xsin⁡2xx\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=−cos⁡2x2v = -\frac{\cos 2x}{2} is negative, and the parts formula subtracts ∫v du\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 14∫usin⁡u du\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 −xcos⁡2x2+sin⁡2x4-\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}.