Let I=∫x2exdx Taking x2 as first function and ex as second function and integrating using by parts, we obtain I=x2∫exdx−∫{(ddxx2)∫exdx}dx =x2ex−∫2x⋅exdx =x2ex−2[x⋅∫exdx−∫{(ddxx)⋅∫exdx}dx] =x2ex−2[xex−∫exdx] =x2ex−2[xex−ex] =x2ex−2xex+2ex+C =ex(x2−2x+2)+C