# How do you integrate x^2(sinx)dx?

Jul 26, 2016

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

#### Explanation:

Use integration by parts, which takes the form:

$\int u \mathrm{dv} = u v - \int v \mathrm{du}$

For $\int u \mathrm{dv} = \int {x}^{2} \sin \left(x\right) \mathrm{dx}$, we let:

$u = {x}^{2} \text{ "=>" "(du)/dx=2x" "=>" } \mathrm{du} = 2 x \mathrm{dx}$

$\mathrm{dv} = \sin \left(x\right) \mathrm{dx} \text{ "=>" "intdv=intsin(x)dx" "=>" } v = - \cos \left(x\right)$

Thus, substituting these into the integration by parts formula, we see that:

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

Simplifying the negative signs:

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

Now, do integration by parts once more on the remaining integral:

$u = x \text{ "=>" "(du)/dx=1" "=>" } \mathrm{du} = \mathrm{dx}$

$\mathrm{dv} = \cos \left(x\right) \mathrm{dx} \text{ "=>" "intdv=intcos(x)dx" "=>" } v = \sin \left(x\right)$

Thus:

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

Since $\int \sin \left(x\right) \mathrm{dx} = - \cos \left(x\right)$, this becomes:

$\int x \cos \left(x\right) \mathrm{dx} = x \sin \left(x\right) + \cos \left(x\right)$

Now, returning to before:

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

Substitute in $\int x \cos \left(x\right) \mathrm{dx} = x \sin \left(x\right) + \cos \left(x\right)$:

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

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