Let
I=∫(x2+1)ex(x+1)2dxSubstitute u=x+1⟹du=dx,x2=(u−1)2
⟹I=e−1∫((u−1)2+1)euu2du
=e−1∫((u−1)2euu2)du+∫euu2du
=e−1∫((u2−2u+1)2euu2)du+∫euu2du
=e−1∫(eu−2euu+euu2)du+∫euu2du
=e−1∫(eu−2euu+2euu2)du
⟹I=e−1(eu−2Ei(u)+2∫euu2du) ........ (2)
To evaluate ∫euu2du
Let f=eu and g′=1u2⟹f′=eu and g=−1u
Using integration byparts
∫euu2du=−euu−∫−euudu
=−euu+Ei(u)
From (2),
I=e−1(eu−2Ei(u)−2euu+2Ei(u))
=eu−1−2eu−1u
⟹I=ex−2exx+1+C
⟹I=ex(x−1)x+1+C