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

Sep 17, 2016

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

#### Explanation:

We do it using integration by parts.

Let $u = {x}^{2}$ and $v = {e}^{x}$, then $\mathrm{du} = 2 x \mathrm{dx}$ and $\mathrm{dv} = {e}^{x} \mathrm{dx}$

Now integration by parts states that

$\int u \left(x\right) v ' \left(x\right) \mathrm{dx} = u \left(x\right) v \left(x\right) - \int v \left(x\right) u ' \left(x\right) \mathrm{dx}$

Hence $\int {x}^{2} {e}^{x} \mathrm{dx} = {x}^{2} {e}^{x} - \int {e}^{x} \times 2 x \mathrm{dx}$

= ${x}^{2} {e}^{x} - 2 \int x {e}^{x} \mathrm{dx} + c$ ...............(1)

Now we set $u = x$, then $\mathrm{du} = \mathrm{dx}$

and $\int x {e}^{x} \mathrm{dx} = x {e}^{x} - \int {e}^{x} \times 1 \times \mathrm{dx}$ or

$\int x {e}^{x} \mathrm{dx} = x {e}^{x} - \int {e}^{x} \mathrm{dx} = x {e}^{x} - {e}^{x}$

Putting this in (1), we get

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

= ${e}^{x} \left({x}^{2} - 2 x + 2\right) + c$