Integral of x cos x
Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The integral of x cos x
∫
xcos(x)
dx =cos(x)+xsin(x)+C
The integral of x cos x is cos x + x sin x + C. Choose u = x and dv = cos x dx.
y=xcos(x)
in blue and its integral y=cos(x)+xsin(x)
(with C = 0) in red.How to integrate x cos x
Method: integration by parts.
- 1Choose u = x and dv = cos x dx.
- 2Then du = dx and v = sin x.
- 3Integration by parts gives x sin x − ∫sin x dx.
- 4The integral of sin x is −cos x, so this is x sin x + cos x.
- 5So the result is cos x + x sin x + C.
What it means
x cos x is an odd function, so its integral is even, and from −a to a the integral is 0.
The integral from 0 to π/2
Using the antiderivative: F(π/2) − F(0) = π/2 − 1, which is about 0.570796. A direct numerical integration of x cos x gives 0.570796, which agrees.
Check by differentiating
The derivative of the answer should give back the original function. The last column measures that slope directly from the answer, and it matches.
| x | x cos x | Slope of the answer |
|---|---|---|
| −π | π | π |
| −π/2 | 0 | 0 |
| 0 | 0 | 0 |
| π/2 | 0 | −0 |
| π | −π | −π |
Common mistakes
- Getting the sign of cos x wrong in the last step.
Frequently asked questions
What is the integral of x cos x?
The integral of x cos x is cos x + x sin x + C.
What is the integral of x cos x from 0 to π/2?
π/2 − 1, which is about 0.570796.
Keep going
Integrate any function
Type your own function into the integral calculator for the steps, the answer and a graph.