Class 12 Maths, Worked in Full Past papersGet updates
Chapter 7 · Integrals

Exercise 7.6 · Q3: ∫x2ex dx\int x^2e^x\,dx

Exercise 7.6Integration by parts · Section 7.6
The question

Integrate the functions in Exercises 1 to 22.

3. x2exx^2e^x

Exam answer

Let I=∫x2ex dxI = \displaystyle\int x^2e^x\,dx⁠.

Taking x2x^2 as the first function, by parts:

I=x2ex−∫2x⋅ex dx=x2ex−2∫xex dx\begin{aligned} I &= x^2e^x - \int 2x\cdot e^x\,dx \\ &= x^2e^x - 2\int xe^x\,dx \end{aligned}

Again by parts, taking xx as the first function:

∫xex dx=xex−∫1⋅ex dx=xex−ex\begin{aligned} \int xe^x\,dx &= xe^x - \int 1\cdot e^x\,dx \\ &= xe^x - e^x \end{aligned} ∴ I=x2ex−2(xex−ex)+C\therefore\ I = x^2e^x - 2\left(xe^x - e^x\right) + C

∴ I=ex(x2−2x+2)+C\therefore\ I = e^x\left(x^2 - 2x + 2\right) + C⁠.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

Each use of integration by parts with uu = the power of xx lowers that power by one, while exe^x stays exe^x when integrated. Starting from x2x^2⁠, two uses bring the power down to x0=1x^0 = 1⁠, and then ∫ex dx\int e^x\,dx is standard.

Given, to find, and the plan
Given
The function x2exx^2e^x⁠, defined and continuous for every real xx⁠.
To find
∫x2ex dx\int x^2e^x\,dx⁠.
Plan
(1) Name uu and dvdx\frac{dv}{dx}⁠. (2) First integration by parts, which leaves ∫xex dx\int xe^x\,dx⁠. (3) Second integration by parts for ∫xex dx\int xe^x\,dx⁠. (4) Put the pieces together. (5) Differentiate back.

Basics you need

1Integration by parts

Section 7.6, equation (1):

∫u dvdx dx=uv−∫v dudx dx,\int u\,\frac{dv}{dx}\,dx = uv - \int v\,\frac{du}{dx}\,dx,

with uu the first function (differentiated) and dvdx\frac{dv}{dx} the second (integrated to give vv⁠). Lesson: integration by parts

2Which factor should be uu⁠?

Remark (iii) after Example 17: a power of xx is usually the first function. In the memory aid ILATE (Inverse trigonometric, Logarithmic, Algebraic, Trigonometric, Exponential; not in the book), Algebraic comes before Exponential.

3The exponential function

∫ex dx=ex+C\int e^x\,dx = e^x + C (standard formula (xi), Section 7.2) and ddxex=ex\frac{d}{dx}e^x = e^x⁠. Basics: integration undoes differentiation

4Power rule for derivatives

ddxx2=2x\frac{d}{dx}x^2 = 2x⁠, ddxx=1\frac{d}{dx}x = 1⁠. Basics: powers of x

Solution

  1. Name uu and dvdx\frac{dv}{dx}

    u=x2(first),dvdx=ex(second).\begin{aligned} u &= x^2 \quad (\text{first}), \\ \frac{dv}{dx} &= e^x \quad (\text{second}). \end{aligned}

    Then dudx=2x\frac{du}{dx} = 2x and v=∫ex dx=exv = \int e^x\,dx = e^x⁠.

    ILATE: x2x^2 is Algebraic, exe^x is Exponential; A comes first. Differentiating x2x^2 lowers the power to xx⁠; integrating exe^x gives exe^x again, no harder. The opposite choice would raise the power to x33\frac{x^3}{3}⁠. No constant is added to vv (Remark (ii) after Example 17).
    Remark (iii) after Example 17, Section 7.6; standard formula (xi). Lesson: integration by parts
  2. First integration by parts

    ∫x2ex dx=uv−∫v dudx dx=x2ex−∫ex⋅2x dx=x2ex−2∫xex dx.\begin{aligned} \int x^2e^x\,dx &= uv - \int v\,\frac{du}{dx}\,dx \\ &= x^2e^x - \int e^x\cdot 2x\,dx \\ &= x^2e^x - 2\int xe^x\,dx. \end{aligned}
    The new integral ∫xex dx\int xe^x\,dx has xx instead of x2x^2⁠: one step simpler, but still a product. So we use integration by parts once more.
    Section 7.6, equation (1); constant multiple rule (Section 7.2.1). Lesson: integration by parts
  3. Second integration by parts: ∫xex dx\int xe^x\,dx

    Now take u=xu = x (first) and dvdx=ex\frac{dv}{dx} = e^x (second), so dudx=1\frac{du}{dx} = 1 and v=exv = e^x⁠:

    ∫xex dx=xex−∫ex⋅1 dx=xex−ex.\begin{aligned} \int xe^x\,dx &= xe^x - \int e^x\cdot 1\,dx \\ &= xe^x - e^x. \end{aligned}
    The same choice for the same reason: differentiating xx leaves 1, and ∫ex dx=ex\int e^x\,dx = e^x is standard. This is exactly the book's Example 19. We add the constant only once, at the end of Step 4.
    Example 19, Section 7.6. Example 19
  4. Put the pieces together

    ∫x2ex dx=x2ex−2(xex−ex)+C=x2ex−2xex+2ex+C=ex(x2−2x+2)+C.\begin{aligned} \int x^2e^x\,dx &= x^2e^x - 2\left(xe^x - e^x\right) + C \\ &= x^2e^x - 2xe^x + 2e^x + C \\ &= e^x\left(x^2 - 2x + 2\right) + C. \end{aligned}
    Substitute the result of Step 3 into Step 2, open the bracket (the −2-2 multiplies both terms, so −2⋅(−ex)=+2ex-2\cdot(-e^x) = +2e^x⁠), and take out the common factor exe^x⁠.
    Distributive law; common factor. Lesson: integration by parts
  5. Check: differentiate the answer

    By the product rule, with ddx(x2−2x+2)=2x−2\frac{d}{dx}(x^2 - 2x + 2) = 2x - 2⁠:

    ddx[ex(x2−2x+2)]=ex(x2−2x+2)+ex(2x−2)=ex(x2−2x+2+2x−2)=x2ex.\begin{aligned} &\frac{d}{dx}\Big[e^x\left(x^2 - 2x + 2\right)\Big] \\ &= e^x\left(x^2 - 2x + 2\right) + e^x(2x - 2) \\ &= e^x\left(x^2 - 2x + 2 + 2x - 2\right) \\ &= x^2e^x. \end{aligned}
    The −2x-2x and +2x+2x cancel, and so do the +2+2 and −2-2⁠: only x2exx^2e^x is left, for every real xx⁠.
    Product rule; ddxex=ex\frac{d}{dx}e^x = e^x⁠. Basics: integration undoes differentiation
Result ∫x2ex dx=ex(x2−2x+2)+C,\int x^2e^x\,dx = e^x(x^2 - 2x + 2) + C,

valid for every real xx⁠. (Textbook answer: ex(x2−2x+2)+Ce^x(x^2 - 2x + 2) + C⁠, the same.)

Check it with numbers

With F(x)=ex(x2−2x+2)F(x) = e^x(x^2 - 2x + 2)⁠, on [0,1][0, 1]⁠:

F(1)−F(0)=e(1−2+2)−1⋅2=e−2=0.7182818285…\begin{aligned} F(1) - F(0) &= e(1 - 2 + 2) - 1\cdot 2 \\ &= e - 2 = 0.7182818285\ldots \end{aligned}

Numerical integration of x2exx^2e^x over [0,1][0, 1] gives 0.7182818285…0.7182818285\ldots⁠, the same.

Common mistakes
  1. Dropping the 2. ddxx2=2x\frac{d}{dx}x^2 = 2x⁠, so the first use of the formula leaves 2∫xex dx2\int xe^x\,dx⁠, not ∫xex dx\int xe^x\,dx⁠.
  2. Sign of the last term. −2(xex−ex)=−2xex+2ex-2(xe^x - e^x) = -2xe^x + 2e^x⁠: the last term is +2ex+2e^x⁠.
  3. Choosing u=exu = e^x⁠. Then v=x33v = \frac{x^3}{3} and the power of xx goes up at every step.
What to take away
  1. For xnexx^n e^x⁠, use integration by parts nn times, each time with the power of xx as uu⁠.
  2. The pattern behind the answer: exe^x times (the polynomial, minus its derivative, plus its second derivative, and so on). For x2x^2 this is x2−2x+2x^2 - 2x + 2⁠.
  3. Add the constant CC once, at the very end.

Every fact used, and where it comes from

FactUsed inSource
Integration by partsSteps 2, 3Section 7.6, equation (1) (Lesson: integration by parts)
Choice of the first function (ILATE)Steps 1, 3Remark (iii) after Example 17, Section 7.6
No constant needed in vvSteps 1, 3Remark (ii) after Example 17, Section 7.6
∫xex dx=xex−ex+C\int xe^x\,dx = xe^x - e^x + CStep 3Example 19, Section 7.6
∫ex dx=ex+C\int e^x\,dx = e^x + CSteps 1, 3Standard formula (xi), Section 7.2
Constant multiple ruleStep 2Property (IV), Section 7.2.1
Product ruleStep 5Chapter 5, Section 5.3
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →