Integral of x²eˣ: By Parts Twice (Solved)

Find ∫x²eˣdx. This is the classic integration-by-parts problem, and it is hard for exactly one reason: one round of integration by parts does not finish the job. Most students apply the formula ∫u dv = uv − ∫v du once, stare at the leftover ∫2xeˣdx, and conclude they did something wrong. They did not. The leftover is expected, and the fix is to apply by parts a second time.

The tell-tale sign is the shape of the integrand: a polynomial multiplied by eˣ. Polynomials get simpler when you differentiate them (x² → 2x → 2), while eˣ never changes when you integrate it. That combination is the green light for repeated integration by parts. Two rounds, and the polynomial is gone.

Worked solution

  1. Write down the formula: ∫u dv = uv − ∫v du. The strategy is to let u be the factor that simplifies when differentiated.
  2. Choose u = x² and dv = eˣdx. Then du = 2x dx and v = eˣ. (Choosing u = eˣ instead is the classic trap: eˣ never simplifies, and the integral gets worse instead of better.)
  3. Apply the formula once: ∫x²eˣdx = x²eˣ − ∫2xeˣdx.
  4. The new integral ∫2xeˣdx has the same shape as the original (polynomial times eˣ), one degree lower. Apply by parts again with u = 2x and dv = eˣdx, so du = 2dx and v = eˣ.
  5. ∫2xeˣdx = 2xeˣ − ∫2eˣdx = 2xeˣ − 2eˣ. The polynomial is gone; what remains is a basic exponential integral.
  6. Substitute back into step 3: ∫x²eˣdx = x²eˣ − (2xeˣ − 2eˣ) + C. Distribute the outer minus with care: = x²eˣ − 2xeˣ + 2eˣ + C.
  7. Factor eˣ for the clean final form: ∫x²eˣdx = eˣ(x² − 2x + 2) + C. Add +C once, at the very end; dragging a constant through the middle algebra is a classic source of sign errors.

Why this method works

Integration by parts trades one hard integral for an easier one. Here each round differentiates the polynomial down one degree (x² → 2x → 2) while eˣ sails through integration unchanged. After two rounds there is no polynomial left to reduce, only ∫2eˣdx, which is immediate. The method works precisely because one factor simplifies under differentiation and the other is immune to integration.

Common mistakes

  • Choosing u = eˣ and dv = x²dx. Then v = x³/3 and the integral gets worse, not better. Always differentiate the polynomial and integrate the exponential.
  • Sign errors in the formula. It is uv MINUS ∫v du, and in step 6 the outer minus must distribute over the whole parenthesis: x²eˣ − (2xeˣ − 2eˣ) becomes x²eˣ − 2xeˣ + 2eˣ, not x²eˣ − 2xeˣ − 2eˣ.
  • Stopping after one round. If the leftover integral still contains a polynomial times eˣ, you are not done. Apply by parts again.

Check (never skip)

Differentiate the answer and confirm the integrand comes back. d/dx[eˣ(x² − 2x + 2)] needs the product rule: = eˣ(x² − 2x + 2) + eˣ(2x − 2) = eˣ(x² − 2x + 2 + 2x − 2) = eˣ(x²) = x²eˣ. ✓ The −2x and +2x cancel, the +2 and −2 cancel, and exactly the original integrand remains. This check takes thirty seconds and catches every sign error from step 6.

The tabular shortcut, worked

The two rounds above compress into a table. Left column: derivatives of x² until zero. Right column: integrals of eˣ, same count.

x² → 2x → 2 → 0 eˣ → eˣ → eˣ → eˣ

Multiply diagonally with alternating signs starting from +: (+1)(x²)(eˣ) + (−1)(2x)(eˣ) + (+1)(2)(eˣ) = x²eˣ − 2xeˣ + 2eˣ, plus C. Same answer as the long way, in a quarter of the writing. The table is just integration by parts with the bookkeeping hidden; every row is one round. It shines exactly here: polynomial times eˣ, where one column dies out and the other repeats forever.

FAQ

Q: How do I pick u and dv? A: Use the ILATE order (Inverse trig, Logarithmic, Algebraic, Trig, Exponential): whichever factor comes first becomes u. Here x² is Algebraic and eˣ is Exponential, so u = x². The rule of thumb behind it: u should be the factor that gets simpler when differentiated.

Q: Is there a faster way than two full rounds of by parts? A: Yes, the tabular method. List derivatives of x² down one column (x² → 2x → 2 → 0) and integrals of eˣ down another (eˣ → eˣ → eˣ), then combine with alternating signs. It is the same mathematics, compressed.

Q: What if the polynomial were x³ instead of x²? A: Same idea, three rounds: x³ → 3x² → 6x → 6. In general, ∫xⁿeˣdx needs n rounds and produces eˣ times a degree-n polynomial, plus C.

Solve it with steps on our integral calculator.