# How do you integrate int x^2e^x by integration by parts method?

Jan 19, 2017

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

#### Explanation:

The "integration by parts" method can be seen as a form of inverse product rule for differentiation:

$\int f g ' \mathrm{dx} = f g - \int f ' g \mathrm{dx}$, where $f , g$ functions of $x$.

Here, we see that $\left({e}^{x}\right) ' = {e}^{x}$, so this matches directly with

$\int f g ' \mathrm{dx}$ where $f \left(x\right) = {x}^{2}$ and $g \left(x\right) = {e}^{x}$.

Therefore,

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

Now, since ${e}^{x}$ can be differentiated indefinitely without a change, we can apply this method again, differentiating repeatedly until the integrals are gone:

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

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

$= 2 x {e}^{x} - 2 {e}^{x} + c$

Now, we have to subtract this from the original ${x}^{2} {e}^{x}$ (the $f g$ part in our example) to get the final answer:

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

I did realize I said subtract, yet still put $+ c$ instead of $- c$ at the end. That is because it's an arbitrary constant, and can be any real number, and in the end, most people use $+ c$ in their notation.