practicecalculus
Products and integration by parts

Integral of x² eˣ: Formula, Steps and Examples

The integral of x² eˣ is (x² − 2x + 2)eˣ + C. See integration by parts twice, the tabular shortcut, a check, a graph and the xⁿ eˣ pattern.

Products and integration by parts Updated 3 min read

At a glance

\int x^2 e^x\,dx = (x^2 - 2x + 2)e^x + C
Antiderivative
(x^2 - 2x + 2)e^x + C
Method
Integration by parts twice, or the tabular method
From 0 to 1
e - 2 \approx 0.718
With e^(−x), 0 to ∞
\int_0^\infty x^2e^{-x}\,dx = 2
Pattern
\int x^3e^x\,dx = (x^3 - 3x^2 + 6x - 6)e^x + C
On this page
  1. Graph of x² eˣ and its antiderivative
  2. How to integrate x² eˣ step by step
  3. The tabular shortcut
  4. Check by differentiating
  5. Definite integrals
  6. The xⁿ eˣ pattern
  7. Worked examples
  8. Common mistakes

The integral of x^2e^x is (x^2 - 2x + 2)e^x + C. It takes integration by parts twice, and it is the standard example for the tabular method.

\int x^2e^x\,dx = (x^2 - 2x + 2)e^x + C

Graph of x² eˣ and its antiderivative

y = x² eˣ and its antiderivative (x² − 2x + 2)eˣ
The shaded area from 0 to 1 is e - 2 \approx 0.718. The dashed antiderivative is always increasing, because x^2e^x \ge 0 for every x.

How to integrate x² eˣ step by step

Use integration by parts, \int u\,dv = uv - \int v\,du, with the power of x as u each time.

  1. First pass. u = x^2, dv = e^x\,dx, so du = 2x\,dx and v = e^x: \int x^2e^x\,dx = x^2e^x - 2\int xe^x\,dx
  2. Second pass. You already know \int xe^x\,dx = (x-1)e^x from the integral of x eˣ. If not, use u = x, dv = e^x\,dx again.
  3. Combine. x^2e^x - 2(x - 1)e^x + C = (x^2 - 2x + 2)e^x + C

The tabular shortcut

When one factor differentiates to zero and the other is easy to integrate over and over, set up a table. Differentiate x^2 in the left column, integrate e^x in the right, and attach alternating signs:

Sign Differentiate Integrate
+ x^2 e^x
- 2x e^x
+ 2 e^x
0 e^x

Multiply each left entry by the right entry one row down, using the sign of the left row:

+x^2e^x - 2xe^x + 2e^x = (x^2 - 2x + 2)e^x

The repeated parts and LIATE lesson practices this method.

Check by differentiating

\frac{d}{dx}\Big[(x^2 - 2x + 2)e^x\Big] = (2x - 2)e^x + (x^2 - 2x + 2)e^x = x^2e^x

Everything except x^2 cancels. A nice way to remember the answer: the polynomial p(x) = x^2 - 2x + 2 satisfies p + p' = x^2.

Definite integrals

From 0 to 1:

\Big[(x^2 - 2x + 2)e^x\Big]_0^1 = (1)e - (2)(1) = e - 2 \approx 0.718

From −∞ to 0: as x \to -\infty, (x^2 - 2x + 2)e^x \to 0, so the integral is 2 - 0 = 2.

With a decaying exponential. \int x^2e^{-x}\,dx = -(x^2 + 2x + 2)e^{-x} + C, so

\int_0^\infty x^2e^{-x}\,dx = 0 - (-2) = 2 = 2!

This is a case of the Gamma function result \int_0^\infty x^ne^{-x}\,dx = n!. See improper integrals for why the limit at infinity is 0.

The xⁿ eˣ pattern

Each extra power of x adds one row to the table:

Integral Answer
\int e^x\,dx e^x + C
\int xe^x\,dx (x - 1)e^x + C
\int x^2e^x\,dx (x^2 - 2x + 2)e^x + C
\int x^3e^x\,dx (x^3 - 3x^2 + 6x - 6)e^x + C

The polynomial is x^n minus its derivative plus its second derivative and so on, with alternating signs.

Worked examples

Example 1: a faster exponential. \int x^2e^{2x}\,dx. In the tabular method the right column is e^{2x}, \frac{1}{2}e^{2x}, \frac{1}{4}e^{2x}, \frac{1}{8}e^{2x}:

\frac{x^2}{2}e^{2x} - \frac{2x}{4}e^{2x} + \frac{2}{8}e^{2x} + C = \left(\frac{x^2}{2} - \frac{x}{2} + \frac{1}{4}\right)e^{2x} + C

Example 2: a quadratic. \int(x^2 + 1)e^x\,dx. Here p = x^2 + 1, and the pattern gives (p - p' + p'')e^x = (x^2 + 1 - 2x + 2)e^x = (x^2 - 2x + 3)e^x + C.

Example 3: a substitution first. \int x^3e^{x^2}\,dx. Let w = x^2, dw = 2x\,dx, so the integral is \frac{1}{2}\int we^w\,dw = \frac{1}{2}(x^2 - 1)e^{x^2} + C.

Common mistakes

  1. Stopping after one pass. x^2e^x - 2\int xe^x\,dx still has an integral in it.
  2. Losing the factor 2. The first pass brings out 2x, and the 2 multiplies the whole second result.
  3. Wrong signs in the table. The signs alternate +, -, + starting from the top row.
  4. Choosing u = e^x. The power of x goes up instead of down.

More practice: the integration by parts practice problems.

Practice it now

Repeated parts and LIATE

Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.

Practice this lesson

Frequently asked questions

What is the integral of x² eˣ?

It is (x^2 - 2x + 2)e^x + C, which expands to x^2e^x - 2xe^x + 2e^x + C.

What is the integral of x² e^(−x)?

It is -(x^2 + 2x + 2)e^{-x} + C. From 0 to \infty it equals 2.

How many times do you use integration by parts for x² eˣ?

Twice. The first pass turns x^2 into 2x, and the second turns 2x into 2. After that only \int e^x\,dx remains.

What is the integral of x³ eˣ?

It is (x^3 - 3x^2 + 6x - 6)e^x + C. Use the tabular method with three nonzero derivatives of x^3.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.