Home » Blog » Evaluate the indefinite integral of x2ex

Evaluate the indefinite integral of x2ex

Compute the following indefinite integral,

    \[ \int x^2 e^x \, dx. \]


We compute the integral using integration by parts. Let,

    \begin{align*}  u &= x^2 & du &= 2x \, dx \\ dv &= e^x \, dx & v &= e^x. \end{align*}

Then we have

    \[  \int x^2 e^x \, dx &= x^2 e^x - 2 \int xe^x \, dx. \]

But we know from a previous exercise (Section 6.17, Exercise #13) that

    \[ \int xe^x \, dx = e^x (x-1) + C. \]

Therefore we have,

    \begin{align*}   \int x^2 e^x \, dx &= x^2 e^x - 2 \int xe^x \, dx \\  &= x^2 e^x - 2 \left( e^x(x-1) \right) + C \\  &= e^x (x^2 - 2x + 2) + C.  \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):