Back to Blog
CalculusDecember 29, 202514 min read

How to Evaluate ∫ x²e^x dx Using Integration by Parts

Master integration by parts with this complete walkthrough of a challenging problem. Learn when to apply the technique twice, how to choose u and dv correctly, and avoid the common mistakes that trip up calculus students.

Integration by parts calculus problem

📹 Video Walkthrough: This Exact Problem

Watch the full solution for evaluating ∫ x²e^x dx step-by-step using integration by parts.

Click to view full video
Generate Your Own Custom Problem →

The Problem

Evaluate the integral:

∫ x²e^x dx

Use integration by parts to find the antiderivative. Express your answer in simplest form.

This is one of those integrals that looks simple but requires some real technique. You've got x² multiplied by e^x, and neither one is going away with a simple substitution. That's your signal: integration by parts time.

The tricky part? You'll need to apply integration by parts twice. The first application reduces x² to x, and the second reduces x to a constant. It's like peeling an onion, but with calculus. If you're stuck on a similar problem, you can always generate a custom video solution on Torial.

Understanding Integration by Parts

Integration by parts formula visualization

Integration by parts comes from the product rule for derivatives. The formula is:

∫ u dv = uv - ∫ v du

The key is choosing u and dv wisely

The whole game is picking the right u and dv. You want u to get simpler when you differentiate it, and dv to stay manageable when you integrate it.

💡 Key Insight: For ∫ x²e^x dx, you want u = x² because when you differentiate it, you get 2x (simpler!). And dv = e^x dx because integrating e^x is still e^x (easy!).

This is the LIATE rule in action: Logarithmic, Inverse trig, Algebraic, Trigonometric, Exponential. Choose u from earlier in the list.

Our choices for the first application:

u (to differentiate):

u = x²

du = 2x dx

dv (to integrate):

dv = e^x dx

v = e^x

Notice how u gets simpler (x² → 2x) while v stays the same (e^x → e^x). That's exactly what you want. Need a refresher on basic integration? Check out other calculus videos in our library.

First Application of Integration by Parts

Let's plug everything into the formula. This first pass will reduce the power of x from 2 to 1.

Applying the formula:

∫ x²e^x dx = x²e^x - ∫ e^x · 2x dx

Simplifying:

= x²e^x - 2∫ xe^x dx

Progress check: We started with ∫ x²e^x dx and now we have x²e^x minus 2∫ xe^x dx. The new integral is simpler (x instead of x²), but we're not done yet. We need to apply integration by parts one more time.

See how the power of x dropped? That's the whole point. Each application of integration by parts reduces the power by 1. We went from x² to x. One more time and we'll get to a constant.

Second Application of Integration by Parts

Second application of integration by parts

Now we need to evaluate ∫ xe^x dx. Same strategy, but this time u = x (which becomes 1 when differentiated).

Second set of choices:

u (to differentiate):

u = x

du = dx

dv (to integrate):

dv = e^x dx

v = e^x

Applying integration by parts again:

∫ xe^x dx = xe^x - ∫ e^x dx

= xe^x - e^x

= e^x(x - 1)

Perfect! This time the integral ∫ e^x dx is straightforward—it's just e^x. No more integration by parts needed. We've reduced everything to basic functions.

Notice how this second application gave us a clean answer. The x disappeared entirely, leaving us with just e^x terms. That's the goal: keep applying until you get something you can integrate directly.

Combining the Results

Now we need to put it all together. Remember, we had:

From the first application:

∫ x²e^x dx = x²e^x - 2∫ xe^x dx

Substituting our result for ∫ xe^x dx:

∫ x²e^x dx = x²e^x - 2[e^x(x - 1)]

= x²e^x - 2xe^x + 2e^x

⚠️ Watch the signs: When you distribute the -2, make sure every term gets the right sign. -2 times e^x(x - 1) becomes -2xe^x + 2e^x. The negative distributes to both terms inside the parentheses.

This is where students often mess up. Take your time with the algebra. One sign error here and the whole answer is wrong.

Simplifying to the Final Answer

Final simplified answer

Factor out e^x to get the cleanest form. This makes it easier to verify and looks more professional.

Factoring out e^x:

∫ x²e^x dx = x²e^x - 2xe^x + 2e^x

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

Final Answer:

∫ x²e^x dx = e^x(x² - 2x + 2) + C

Don't forget the constant of integration!

That's it! We went from x²e^x to a clean factored form. The polynomial inside (x² - 2x + 2) came from reducing the power of x twice. Want to see more worked examples? Browse through hundreds of calculus solutions on Torial.

Verifying the Answer

Always check your work. Differentiate your answer and make sure you get back to x²e^x. If you want personalized help with verification, create a custom study video for your specific problem.

✓ Verification by differentiation:

Let F(x) = e^x(x² - 2x + 2). We need to show F'(x) = x²e^x.

Using the product rule:

F'(x) = e^x · (x² - 2x + 2) + e^x · (2x - 2)

Factor out e^x:

= e^x[(x² - 2x + 2) + (2x - 2)]

Simplify:

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

= e^x(x²)

= x²e^x ✓

Perfect! Our answer is correct.

Common Mistakes to Avoid

Here are the mistakes that cost students the most points. Learn them now so you don't make them on test day.

❌ Mistake #1: Choosing u and dv backwards

Setting u = e^x and dv = x² dx. This makes things worse because differentiating e^x gives e^x (no simpler), and integrating x² gives x³/3 (more complicated).

Fix: Always choose u to be the part that gets simpler when differentiated. For polynomials times exponentials, u should be the polynomial.

❌ Mistake #2: Forgetting to apply integration by parts twice

Stopping after the first application and thinking you're done. You still have ∫ xe^x dx to evaluate, which also needs integration by parts.

Fix: Keep going until the remaining integral is something you can integrate directly. With x², you'll always need two applications.

❌ Mistake #3: Sign errors when distributing

When substituting back, writing -2[e^x(x - 1)] = -2xe^x - 2e^x instead of -2xe^x + 2e^x. The negative applies to both terms.

Fix: Distribute carefully. -2 times (x - 1) means -2 times x AND -2 times -1, which gives -2x + 2.

❌ Mistake #4: Forgetting the constant of integration

Writing the answer without + C. This costs points on exams, even if everything else is correct.

Fix: Always add + C at the end. It's free points and shows you understand indefinite integrals.

❌ Mistake #5: Not simplifying the final answer

Leaving the answer as x²e^x - 2xe^x + 2e^x instead of factoring out e^x. It's not wrong, but it's not in simplest form.

Fix: Always factor out common terms. e^x(x² - 2x + 2) is cleaner and easier to verify.

❌ Mistake #6: Mixing up the formula

Writing ∫ u dv = uv + ∫ v du instead of ∫ u dv = uv - ∫ v du. That plus sign should be a minus.

Fix: Memorize it as "uv minus the integral of v du." The minus is crucial.

Practice Problems with Video Solutions

Best way to get good at this? Practice. Try these similar problems and check your work with video solutions. You can also generate instant video explanations for any integration problem you're working on.

Practice Problem 1: Higher Power

Evaluate: ∫ x³e^x dx

Hint: Same strategy, but you'll need to apply integration by parts three times. Each application reduces the power of x by 1.

Get instant video solution on Torial →

Practice Problem 2: Different Exponential

Evaluate: ∫ x²e^(2x) dx

Hint: Same process, but when you integrate e^(2x), you get e^(2x)/2. Watch the coefficients.

Get instant video solution on Torial →

Practice Problem 3: With Trig Function

Evaluate: ∫ x²sin(x) dx

Hint: Integration by parts twice again, but this time with sin(x). Remember: derivative of sin is cos, integral of sin is -cos.

Get instant video solution on Torial →

Practice Problem 4: Definite Integral

Evaluate: ∫₀¹ x²e^x dx

Hint: Find the antiderivative first (same as above), then evaluate at x = 1 and x = 0, and subtract.

Get instant video solution on Torial →

When to Use Integration by Parts

How do you know when integration by parts is the right technique?

✓ Use Integration by Parts When:

  • You have a product of two functions
  • One function gets simpler when differentiated
  • Substitution doesn't work
  • You see polynomials times exponentials or trig functions
  • The integral looks like ∫ f(x)g'(x) dx

✓ Try Other Methods When:

  • You can use u-substitution instead
  • The functions are too complicated
  • You see a clear pattern for substitution
  • Partial fractions might work better
  • The integral is already in a simple form

For this problem? Integration by parts is perfect. You've got x² (polynomial) times e^x (exponential). The polynomial gets simpler when differentiated, and the exponential stays manageable. When you're juggling multiple integration techniques, it helps to have a step-by-step video walkthrough that shows exactly which method to use.

Other Videos

Stuck on a Different Problem?

Get instant, personalized video explanations for your homework

Create Your First Video

Related Articles