AP Calculus BC

Integral of x sin x: Answer, Parts, Mistakes

The integral of x sin x with respect to x is sin x - x cos x + C. Integration by parts with u = x and dv = sin x dx gives -x cos x plus the integral of cos x, so the answer is -x cos x + sin x + C. Differentiating it with the product rule returns x sin x.

xsinxdx=sinxxcosx+C\int x\sin x\,dx = \sin x - x\cos x + C

How to integrate x sin x by parts

The integrand is an algebraic factor times a trig factor, and neither is the derivative of the other, so substitution has nothing to grab. That is the signal for integration by parts, which reverses the product rule.

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

Choose uu to be the factor that simplifies when differentiated. Here xx differentiates to 11, while sinx\sin x only cycles, so let u=xu = x and dv=sinxdxdv = \sin x\,dx.

u=x,du=dx,dv=sinxdx,v=cosxu = x, \quad du = dx, \quad dv = \sin x\,dx, \quad v = -\cos x

Substitute into the formula. The uvuv term is xcosx-x\cos x, and the new integral vdu\int v\,du is cosxdx\int -\cos x\,dx, which is elementary.

xsinxdx=xcosx(cosx)dx=xcosx+cosxdx\int x\sin x\,dx = -x\cos x - \int (-\cos x)\,dx = -x\cos x + \int \cos x\,dx
xsinxdx=xcosx+sinx+C=sinxxcosx+C\int x\sin x\,dx = -x\cos x + \sin x + C = \sin x - x\cos x + C

Check it by differentiating

Differentiate sinxxcosx\sin x - x\cos x, using the product rule on the second term: cosx[cosx+x(sinx)]=cosxcosx+xsinx=xsinx\cos x - \left[\cos x + x(-\sin x)\right] = \cos x - \cos x + x\sin x = x\sin x. The cosine terms cancel and you recover the integrand.

Why u = x and not u = sin x

Parts only helps if vdu\int v\,du is easier than the integral you started with. Taking u=sinxu = \sin x and dv=xdxdv = x\,dx is legal but pushes the power up: v=x22v = \frac{x^2}{2}, and the new integral x22cosxdx\int \frac{x^2}{2}\cos x\,dx is harder than the original.

The LIATE ordering encodes the right choice: pick uu as the first type present, going Logarithmic, Inverse trig, Algebraic, Trig, Exponential. In xsinxx\sin x the algebraic xx outranks the trig sinx\sin x, so u=xu = x.

0πxsinxdx=[sinxxcosx]0π=(0π(1))0=π\int_{0}^{\pi} x\sin x\,dx = \left[\sin x - x\cos x\right]_{0}^{\pi} = \left(0 - \pi(-1)\right) - 0 = \pi

Integration by parts is Topic 6.11 inside Unit 6, which weights 15 to 20 percent of the exam. The definite form above is the common way this integrand appears, and the antiderivative keeps the endpoint arithmetic short.

Common mistakes with the integral of x sin x

  • Multiplying antiderivatives. There is no product rule for integrals, so cosxx22-\cos x \cdot \frac{x^2}{2} is not the answer.
  • Getting the sign of vv wrong. Antidifferentiating sinx\sin x gives v=cosxv = -\cos x, not +cosx+\cos x.
  • Dropping the minus in front of vdu\int v\,du and writing xcosxsinx+C-x\cos x - \sin x + C. One differentiation catches it.
  • Choosing u=sinxu = \sin x. It is legal but makes the remaining integral harder, because v=x22v = \frac{x^2}{2} raises the power.

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

What is the integral of x sin x?

It is sinxxcosx+C\sin x - x\cos x + C. Integration by parts with u=xu = x and dv=sinxdxdv = \sin x\,dx gives xcosx+cosxdx=xcosx+sinx+C-x\cos x + \int \cos x\,dx = -x\cos x + \sin x + C.

Why can't I use u-substitution for x sin x?

Substitution needs an inner function whose derivative is already in the integrand. In xsinxdxx\sin x\,dx, neither xx nor sinx\sin x is the derivative of the other up to a constant, so there is nothing to substitute. A product of two unrelated factors calls for integration by parts.

What is the definite integral of x sin x from 0 to pi?

It equals π\pi. Evaluate sinxxcosx\sin x - x\cos x at the endpoints: at x=πx = \pi it is 0π(1)=π0 - \pi(-1) = \pi, and at x=0x = 0 it is 00, so the difference is π\pi.