AP Calculus BC

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

The integral of x cos(2x) is (x sin(2x))/2 + cos(2x)/4 + C. Integration by parts with u = x and dv = cos(2x) dx leaves the integral of sin(2x)/2, which supplies the cos(2x)/4 term. Differentiating the result returns x cos(2x).

xcos2xdx=xsin2x2+cos2x4+C\int x\cos 2x\,dx = \frac{x\sin 2x}{2}+\frac{\cos 2x}{4} + C

Choosing u and dv

The integrand is a polynomial times a trig function, and the polynomial gets simpler when differentiated while the cosine costs nothing to integrate. That pairing is the signal for integration by parts.

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

Take u=xu = x and dv=cos2xdxdv = \cos 2x\,dx. Then du=dxdu = dx, and vv is an antiderivative of cos2x\cos 2x, which carries the usual division by the inside coefficient.

u=x,du=dx,dv=cos2xdx,v=sin2x2u = x, \quad du = dx, \quad dv = \cos 2x\,dx, \quad v = \frac{\sin 2x}{2}

Running the formula

Assemble uvvduuv - \int v\,du. The new integral has no xx left in it, which is the whole point of letting uu be the polynomial.

xcos2xdx=xsin2x2sin2x2dx\int x\cos 2x\,dx = \frac{x\sin 2x}{2} - \int \frac{\sin 2x}{2}\,dx

Since sin2xdx=cos2x2\int \sin 2x\,dx = -\frac{\cos 2x}{2}, the half out front makes the leftover piece cos2x4-\frac{\cos 2x}{4}, and subtracting a negative adds.

xcos2xdx=xsin2x2+cos2x4+C\int x\cos 2x\,dx = \frac{x\sin 2x}{2} + \frac{\cos 2x}{4} + C

Check it by differentiating. The product rule on the first term gives sin2x2+xcos2x\frac{\sin 2x}{2} + x\cos 2x, and the second term gives 2sin2x4=sin2x2-\frac{2\sin 2x}{4} = -\frac{\sin 2x}{2}. The two sine pieces cancel and xcos2xx\cos 2x is left.

The mistake students make

The common misstep is choosing u=cos2xu = \cos 2x and dv=xdxdv = x\,dx. Nothing about that is illegal, but it moves backwards: v=x22v = \frac{x^2}{2}, and the new integral x22(2sin2x)dx\int \frac{x^2}{2}\cdot(-2\sin 2x)\,dx has a higher power of xx than the original. Parts is progress only when the leftover integral is simpler.

The second error is writing v=sin2xv = \sin 2x and losing the 12\frac{1}{2}. That single slip doubles both terms, because uvuv becomes xsin2xx\sin 2x and the leftover integral becomes +cos2x2+\frac{\cos 2x}{2}, so the answer is exactly twice the correct one. Differentiating it returns 2xcos2x2x\cos 2x rather than xcos2xx\cos 2x.

Pick u so it dies

For a polynomial times a sine, cosine, or exponential, let uu be the polynomial. Each round of parts drops its degree by one, so the process terminates instead of cycling.

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

Why is v equal to sin 2x over 2 rather than sin 2x?

vv has to be an antiderivative of cos2x\cos 2x, and ddx[sin2x]=2cos2x\frac{d}{dx}[\sin 2x] = 2\cos 2x. Dividing by 2 undoes that inside coefficient.

Do I need a constant of integration when I find v?

No. Any single antiderivative works, and the simplest one keeps the algebra clean. A constant added to vv contributes equal and opposite amounts to uvuv and vdu\int v\,du, so it cancels.

Can I use tabular integration here?

Yes. Differentiate xx down to 0, integrate cos2x\cos 2x twice to get sin2x2\frac{\sin 2x}{2} then cos2x4-\frac{\cos 2x}{4}, and pair the rows with alternating signs. You get xsin2x2+cos2x4\frac{x\sin 2x}{2} + \frac{\cos 2x}{4}. With a first-degree polynomial the table runs three rows and yields only two products, so it saves little over writing the parts formula out.