How do you integrate (x^2+x+1)e^-x?
Please show all work and explain, thank you.
Use integration by parts.
$\displaystyle \int{u\,dv} = uv - \int{v\,du}$.
In your case, let $\displaystyle u = x^2 + x + 1$ so that $\displaystyle du = 2x + 1$
Let $\displaystyle dv = e^{-x}$ so that $\displaystyle v = -e^{-x}$.
So $\displaystyle \int{(x^2 + x + 1)e^{-x}\,dx} = -e^{-x}(x^2 + x + 1) - \int{-e^{-x}(2x + 1)\,dx}$
$\displaystyle = -e^{-x}(x^2 + x + 1) + \int{e^{-x}(2x + 1)\,dx}$.
Use integration by parts again.
Let $\displaystyle u = 2x + 1$ so that $\displaystyle du = 2$
Let $\displaystyle dv = e^{-x}$ so that $\displaystyle v = -e^{-x}$.
$\displaystyle -e^{-x}(x^2 + x + 1) + \int{e^{-x}(2x + 1)\,dx}$
$\displaystyle = -e^{-x}(x^2 + x + 1) -e^{-x}(2x + 1) - \int{-2e^{-x}\,dx}$
$\displaystyle = -e^{-x}(x^2 + x + 1) - e^{-x}(2x + 1) + 2\int{e^{-x}\,dx}$
$\displaystyle = -e^{-x}(x^2 + x + 1) - e^{-x}(2x + 1) - 2e^{-x} + C$
$\displaystyle = -e^{-x}(x^2 + x + 1 + 2x + 1 + 2) + C$
$\displaystyle = -e^{-x}(x^2 + 3x + 4) + C$.