Find \(\int x^{2}\,e^{x}\,dx\).
Then \[ du=2x\,dx\qquad \hbox{and}\qquad v=\int e^{x}\,dx=e^{x} \]
475
and \[ \int x^{2} e^{x}\,dx=x^{2}e^{x}-2\int xe^{x}\,dx \]
The integral on the right is simpler than the original integral. To find it, we use integration by parts a second time. (Refer to Example 1.)
\[ \begin{equation*} \int xe^{x}\,dx=xe^{x}-e^{x} \end{equation*} \]
Then \[ \int x^{2}e^{x}\,dx=x^{2}e^{x}-2( xe^{x}-e^{x}) +C=e^{x}(x^{2}-2x+2)+C \]