# How do you find the antiderivative of (x^2)(e^x)dx?

Nov 9, 2016

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

#### Explanation:

Integration of $\int {x}^{2} {e}^{x} \mathrm{dx}$ will require two applications of Integration By Parts.

If you are studying maths, then you should learn the formula for Integration By Parts (IBP), and practice how to use it:

$\int u \frac{\mathrm{dv}}{\mathrm{dx}} \mathrm{dx} = u v - \int v \frac{\mathrm{du}}{\mathrm{dx}} \mathrm{dx}$, or less formally $\int u \mathrm{dv} = u v - \int v \mathrm{du}$

I was taught to remember the less formal rule in word; "The integral of udv equals uv minus the integral of vdu". If you struggle to remember the rule, then it may help to see that it comes a s a direct consequence of integrating the Product Rule for differentiation.

Essentially we would like to identify one function that simplifies when differentiated, and identify one that simplifies when integrated (or is at least is integrable).

So for the integrand ${x}^{2} {e}^{x}$, hopefully you can see that ${x}^{2}$ simplifies when differentiated and ${e}^{x}$ remains unchanged under differentiation or integration.

Let $\left\{\begin{matrix}u = {x}^{2} & \implies & \frac{\mathrm{du}}{\mathrm{dx}} = 2 x \\ \frac{\mathrm{dv}}{\mathrm{dx}} = {e}^{x} & \implies & v = {e}^{x}\end{matrix}\right.$

Then plugging into the IBP formula gives us:
$\int \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \mathrm{dx} = \left(u\right) \left(v\right) - \int \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \mathrm{dx} \left(+ C\right)$
$\therefore \int \left({x}^{2}\right) \left({e}^{x}\right) \mathrm{dx} = \left({x}^{2}\right) \left({e}^{x}\right) - \int \left({e}^{x}\right) \left(2 x\right) \mathrm{dx} + C$
$\therefore \int {x}^{2} {e}^{x} \mathrm{dx} = {x}^{2} {e}^{x} - 2 \int x {e}^{x} \mathrm{dx} + C$

So We still have more work to do to find $\int x {e}^{x} \mathrm{dx}$, but this integral is simpler than the original $\int {x}^{2} {e}^{x} \mathrm{dx}$ and we can find $\int x {e}^{x} \mathrm{dx}$ with another application of IBP as follows:

Let $\left\{\begin{matrix}u = x & \implies & \frac{\mathrm{du}}{\mathrm{dx}} = x \\ \frac{\mathrm{dv}}{\mathrm{dx}} = {e}^{x} & \implies & v = {e}^{x}\end{matrix}\right.$

Then plugging into the IBP formula gives us:
$\int \left(u\right) \left(\frac{\mathrm{dv}}{\mathrm{dx}}\right) \mathrm{dx} = \left(u\right) \left(v\right) - \int \left(v\right) \left(\frac{\mathrm{du}}{\mathrm{dx}}\right) \mathrm{dx}$
$\therefore \int \left(x\right) \left({e}^{x}\right) \mathrm{dx} = \left(x\right) \left({e}^{x}\right) - \int \left({e}^{x}\right) \left(1\right) \mathrm{dx}$
$\therefore \int x {e}^{x} \mathrm{dx} = x {e}^{x} - {e}^{x}$

Inserting this into our earlier result gives us:
$\therefore \int {x}^{2} {e}^{x} \mathrm{dx} = {x}^{2} {e}^{x} - 2 \left\{x {e}^{x} - {e}^{x}\right\} + C$
$\therefore \int {x}^{2} {e}^{x} \mathrm{dx} = {x}^{2} {e}^{x} - 2 x {e}^{x} + 2 {e}^{x} + C$
$\therefore \int {x}^{2} {e}^{x} \mathrm{dx} = \left({x}^{2} - 2 x + 2\right) {e}^{x} + C$