`intx^2 e^-x dx`

The 2nd and 3rd "priorities" for choosing `u` given earlier said:

2. Let `u = x^n`

3. Let `u = e^(nx)`

This questions has both a power of `x` and an exponential expression. But we choose `u=x^2` as it has a higher priority than the exponential. (You could try it the other way round, with `u=e^-x` to see for yourself why it doesn't work.)

So `u=x^2` and this gives `du=2x\ dx`.

That leaves `dv=e^-x\ dx` and integrating this gives us `v=-e^-x`.

We substitute these into the Integration by Parts formula to give:

`intx^2 e^-x dx =intu\ dv`

`=uv-intv\ du`

`=x^2(-e^-x)-int(-e^-x)(2x\ dx) `

`=-x^2e^-x+2intxe^-x dx `

Now, the integral we are left with cannot be found immediately. We need to perform integration by parts again, for this new integral.

This time we choose `u=x` giving `du=dx`.

Once again we will have `dv=e^-x\ dx` and integrating this gives us `v=-e^-x`.

Substituting into the integration by parts formula gives:

`int x e^-x dx=intu\ dv`

`=uv-intv\ du`

`=x(-e^-x)-int(-e^-x)dx`

`=-xe^-x+inte^-x dx`

`=-xe^-x-e^-x `

So putting this answer together with the answer for the first part, we have the final solution:

div class="alignEquals">

`intx^2e^-xdx =-x^2e^-x+2(-xe^-x-e^-x) `

`=-e^-x(x^2+2x+2)+K`