# How do you find the antiderivative of int x^2cosx dx?

Oct 22, 2017

The answer is $= \left({x}^{2} - 2\right) \sin x + 2 x \cos x + C$

#### Explanation:

The integration by parts is

$\int u v ' \mathrm{dx} = u v - \int u ' v$

Apply the integration by parts

Let $u = {x}^{2}$, $\implies$, $u ' = 2 x$

$v ' = \cos x$, $\implies$, $v = \sin x$

Therefore,

$\int {x}^{2} \cos x \mathrm{dx} = {x}^{2} \sin x - \int 2 x \sin x \mathrm{dx}$

Apply the integration by parts a second time

Let $u = x$, $\implies$, $u ' = 1$

$v ' = \sin x$, $\implies$, $v = - \cos x$

So,

$\int {x}^{2} \cos x \mathrm{dx} = {x}^{2} \sin x - \int 2 x \sin x \mathrm{dx}$

$= {x}^{2} \sin x - 2 \left(- x \cos x - \int - \cos x \mathrm{dx}\right)$

$= {x}^{2} \sin x + 2 x \cos x - 2 \sin x + C$

$= \left({x}^{2} - 2\right) \sin x + 2 x \cos x + C$