Integral of x sin x: Formula, Steps and Examples
The integral of x sin x is sin x − x cos x + C. See the integration by parts steps, a check by differentiating, a graph and examples like x² sin x.
Products and integration by parts Updated 3 min read
At a glance
- Antiderivative
- \sin x - x\cos x + C
- Method
- Integration by parts with u = x, dv = \sin x\,dx
- From 0 to π
- \pi
- From 0 to π/2
- 1
- With sin(kx)
- \int x\sin kx\,dx = -\frac{x}{k}\cos kx + \frac{1}{k^2}\sin kx + C
On this page
The integral of x\sin x is \sin x - x\cos x + C. It is a power of x times a trig function, which is a classic integration by parts problem.
Graph of x sin x
How to integrate x sin x step by step
The integration by parts formula is \int u\,dv = uv - \int v\,du.
- Choose the parts. u = x and dv = \sin x\,dx. Algebraic comes before trig in LIATE.
- Find du and v. du = dx and v = -\cos x, from the integral of sin x.
- Apply the formula. \int x\sin x\,dx = x(-\cos x) - \int(-\cos x)\,dx = -x\cos x + \int\cos x\,dx
- Finish. \int\cos x\,dx = \sin x, so \int x\sin x\,dx = -x\cos x + \sin x + C
If you choose u = \sin x and dv = x\,dx instead, the leftover integral is \int\frac{x^2}{2}\cos x\,dx, with a higher power. That is the signal to switch.
Check by differentiating
The \cos x terms cancel, and the product rule on x\cos x supplies the x\sin x.
Definite integrals
Let F(x) = \sin x - x\cos x.
| Integral | Work | Value |
|---|---|---|
| \int_0^{\pi/2} x\sin x\,dx | F\!\left(\frac{\pi}{2}\right) - F(0) = 1 - 0 | 1 |
| \int_0^{\pi} x\sin x\,dx | F(\pi) - F(0) = \pi - 0 | \pi |
| \int_\pi^{2\pi} x\sin x\,dx | F(2\pi) - F(\pi) = -2\pi - \pi | -3\pi |
| \int_0^{2\pi} x\sin x\,dx | F(2\pi) - F(0) | -2\pi |
In general the hump from k\pi to (k+1)\pi has area (2k+1)\pi, with sign (-1)^k. The total area (not signed) from 0 to 2\pi is \pi + 3\pi = 4\pi.
Worked examples
Example 1: a scaled angle. \int x\sin 2x\,dx. With u = x, dv = \sin 2x\,dx, v = -\frac{1}{2}\cos 2x:
Example 2: x squared, with the tabular method. For \int x^2\sin x\,dx, differentiate x^2 down to 0 and integrate \sin x alongside, with alternating signs:
| Sign | Differentiate | Integrate |
|---|---|---|
| + | x^2 | \sin x |
| - | 2x | -\cos x |
| + | 2 | -\sin x |
| 0 | \cos x |
Multiply along the diagonals:
Example 3: a volume. Rotating the first hump of y = \sin x (from 0 to \pi) about the y-axis, the shell method gives
See the volumes of revolution guide for the setup.
Example 4: a shifted angle. \int x\sin(x + 1)\,dx = \sin(x+1) - x\cos(x+1) + C, since the inside has slope 1.
Common mistakes
- Getting v wrong. \int\sin x\,dx = -\cos x, not \cos x. Most errors on this problem are sign errors.
- Losing the double negative. -\int(-\cos x)\,dx = +\int\cos x\,dx.
- Choosing u = \sin x. The leftover integral then has x^2 in it.
- Forgetting \frac{1}{k} and \frac{1}{k^2} with \sin kx. Differentiate your answer to check.
Compare with the integral of x cos x, which has the same steps with different signs. More practice is in the integration by parts guide.
Practice it now
Integration by parts
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson