Solution:
We use integration by parts:
∫f(x)g(x)dx=f(x)∫g(x)dx−∫[f′(x)∫g(x)dx]dx
Take x2 as the first function and ex as the second function.
∫x2exdx=x2ex−∫2xexdx
=x2ex−2∫xexdx
Integrating ∫xexdx by parts again, with x as the first function and ex as the second function,
∫xexdx=xex−∫1⋅exdx=xex−ex
Substituting back,
∫x2exdx=x2ex−2(xex−ex)+C
=x2ex−2xex+2ex+C
Therefore,
∫x2exdx=ex(x2−2x+2)+C