# Integrate the function$x^2e^x$

Toolbox:
• (i)Let us consider two functions u and v and if they are of the form $\int u dv,$then we can solve it by the method of integration by parts$\int udv=uv-\int vdu$
• (ii)$\int e^xdx=e^x+c.$
Given $I=\int x^2e^x dx.$

Clearly the given integral function is of the form $\int u dv$,so let us follow the method of integration by parts where $\int udv=uv-\int vdu$

Let $u=x^2$.

On differentiating we get

du=2xdx.

Let $dv=e^xdx.$

On integrating on both sides we get

$v=e^x$

On substituting for u,v,du and dx we get,

$\int x^2e^xdx=(x^2.e^x)-\int e^x.2xdx.$

$\;\;\;=(x^3e^x)-2\int e^x.xdx.$-----(1)

Again $\int e^xdx$ is of the form $\int u dv.$

Let u=x.

On differentiating we get

du=dx.

let $dv=e^xdx.$

On integrating we get

$v=e^x.$

Hence on substituting for u,v,du and dv we get

$\int x.e^xdx=(xe^x)-\int e^xdx.$

On integrating we get

$xe^x-e^x+c$-----(2)

Substituting this in equ(1) we get

$\int x^2e^xdx=x^2e^x-2(xe^x-e^x)+c.$

Taking $e^x$ as the common factor we get

$\;\;\;=e^x[x^2-2x+2]+c.$