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

Miscellaneous · Q21: ∫x2+x+1(x+1)2(x+2) dx\int\frac{x^2+x+1}{(x+1)^2(x+2)}\,dx

Miscellaneous ExercisePartial fractions with a repeated linear factor · Miscellaneous Exercise
The question

Integrate the function:

x2+x+1(x+1)2(x+2)\frac{x^2+x+1}{(x+1)^2(x+2)}
Exam answer

Let I=∫x2+x+1(x+1)2(x+2) dxI = \displaystyle\int\frac{x^2 + x + 1}{(x + 1)^2(x + 2)}\,dx⁠.

Let

x2+x+1(x+1)2(x+2)=Ax+1+B(x+1)2+Cx+2\begin{aligned} &\frac{x^2 + x + 1}{(x + 1)^2(x + 2)} \\ &= \frac{A}{x + 1} + \frac{B}{(x + 1)^2} + \frac{C}{x + 2} \end{aligned} ⇒ x2+x+1=A(x+1)(x+2)+B(x+2)+C(x+1)2\begin{aligned} &\Rightarrow\ x^2 + x + 1 \\ &= A(x + 1)(x + 2) \\ &\quad + B(x + 2) + C(x + 1)^2 \end{aligned}

Putting x=−1x = -1⁠: B=1B = 1⁠. Putting x=−2x = -2⁠: C=3C = 3⁠.

Comparing coefficients of x2x^2⁠: A+C=1A + C = 1⁠, so A=−2A = -2⁠.

∴ I=−2∫dxx+1+∫dx(x+1)2+3∫dxx+2\begin{aligned} \therefore\ I &= -2\int\frac{dx}{x + 1} \\ &\quad + \int\frac{dx}{(x + 1)^2} \\ &\quad + 3\int\frac{dx}{x + 2} \end{aligned}

∴ I=−2log⁡∣x+1∣\therefore\ I = -2\log|x + 1| −1x+1+3log⁡∣x+2∣- \dfrac{1}{x + 1} + 3\log|x + 2| +c+ c⁠.

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

The one idea this problem is built on

The fraction is proper and its denominator has a repeated linear factor (x+1)2(x+1)^2 and a single factor x+2x+2⁠. Table 7.2, row 4 says such a fraction splits as Ax+1+B(x+1)2+Cx+2\frac{A}{x+1} + \frac{B}{(x+1)^2} + \frac{C}{x+2}⁠. The two simple fractions give logarithms, and the squared one gives a power of x+1x+1⁠.

Given, to find, and the plan
Given
f(x)=x2+x+1(x+1)2(x+2)f(x) = \frac{x^2+x+1}{(x+1)^2(x+2)}⁠, defined for every real xx except −1-1 and −2-2⁠.
To find
∫x2+x+1(x+1)2(x+2) dx\displaystyle\int\frac{x^2+x+1}{(x+1)^2(x+2)}\,dx⁠.
Plan
(1) Check the fraction is proper and choose the form. (2) Clear denominators. (3) Find AA⁠, BB⁠, CC⁠. (4) Integrate each piece. (5) Differentiate back. (6) Compare with the key.

Basics you need

1Table 7.2, row 4px2+qx+r(x−a)2(x−b)=Ax−a+B(x−a)2+Cx−b\frac{px^2+qx+r}{(x-a)^2(x-b)} = \frac{A}{x-a} + \frac{B}{(x-a)^2} + \frac{C}{x-b}

Lesson: partial fractions

2Logarithm and power integrals

∫dxx+k=log⁡∣x+k∣+C\int\frac{dx}{x+k} = \log|x+k| + C and ∫(x+k)−2 dx=−1x+k+C\int (x+k)^{-2}\,dx = -\frac{1}{x+k} + C (standard formulae (xii) and (i), Section 7.2). Basics: logarithms and 1/x

3Comparing coefficients

Two polynomials equal for every xx have equal coefficients. Basics: splitting fractions

Solution

  1. Choose the method and the form

    The numerator has degree 2 and the denominator (x+1)2(x+2)(x+1)^2(x+2) has degree 3, so the fraction is proper. Its factors are x+1x+1 (twice) and x+2x+2⁠, so

    x2+x+1(x+1)2(x+2)=Ax+1+B(x+1)2+Cx+2.(1)\frac{x^2+x+1}{(x+1)^2(x+2)} = \frac{A}{x+1} + \frac{B}{(x+1)^2} + \frac{C}{x+2} . \qquad (1)
    A rational function with a factorised denominator and no obvious substitution is a job for partial fractions. A repeated factor (x+1)2(x+1)^2 needs two terms, one over x+1x+1 and one over (x+1)2(x+1)^2⁠; with only the squared term there would be just two unknowns, too few to match the three coefficients of a general quadratic numerator.
    Section 7.5, Table 7.2, row 4. Lesson: partial fractions
  2. Clear the denominators

    Multiply (1) by (x+1)2(x+2)(x+1)^2(x+2)⁠:

    x2+x+1=A(x+1)(x+2)+B(x+2)+C(x+1)2.(2)x^2 + x + 1 = A(x+1)(x+2) + B(x+2) + C(x+1)^2 . \qquad (2)
    (1) holds for every x≠−1,−2x \ne -1, -2⁠, so the two polynomials in (2) agree at infinitely many points and therefore for every real xx⁠. That is what lets us put in x=−1x = -1 and x=−2x = -2 next.
    Remark after Example 11, Section 7.5.
  3. Find AA⁠, BB⁠, CC

    x=−1x = -1⁠: 1−1+1=B(1)1 - 1 + 1 = B(1)⁠, so B=1B = 1⁠.

    x=−2x = -2⁠: 4−2+1=C(−1)24 - 2 + 1 = C(-1)^2⁠, so C=3C = 3⁠.

    Coefficient of x2x^2 in (2): 1=A+C1 = A + C⁠, so A=1−3=−2A = 1 - 3 = -2⁠.

    Confirm with the constant term: the right side of (2) has constant 2A+2B+C=−4+2+3=12A + 2B + C = -4 + 2 + 3 = 1⁠, matching the left side.

    Each of the two roots kills all but one term. No value of xx isolates AA⁠, so we compare the x2x^2 coefficients (only A(x+1)(x+2)A(x+1)(x+2) and C(x+1)2C(x+1)^2 contain x2x^2⁠). The constant-term comparison is an independent check of all three values.
  4. Integrate each piece

    x2+x+1(x+1)2(x+2)=−2x+1+1(x+1)2+3x+2,\frac{x^2+x+1}{(x+1)^2(x+2)} = -\frac{2}{x+1} + \frac{1}{(x+1)^2} + \frac{3}{x+2} , ∫x2+x+1(x+1)2(x+2) dx=−2log⁡∣x+1∣−1x+1+3log⁡∣x+2∣+C.\begin{aligned}&\int\frac{x^2+x+1}{(x+1)^2(x+2)}\,dx\\ &= -2\log|x+1| - \frac{1}{x+1} + 3\log|x+2| + C .\end{aligned}
    ∫dxx+1=log⁡∣x+1∣\int\frac{dx}{x+1} = \log|x+1| and ∫dxx+2=log⁡∣x+2∣\int\frac{dx}{x+2} = \log|x+2| (substitute t=x+kt = x+k⁠, standard formula (xii)). For the middle term, ∫(x+1)−2 dx=(x+1)−1−1=−1x+1\int(x+1)^{-2}\,dx = \frac{(x+1)^{-1}}{-1} = -\frac{1}{x+1} (power formula with n=−2n = -2⁠): not a logarithm.
    Standard formulae (i) and (xii), Section 7.2. Basics: logarithms and 1/x
  5. Check: differentiate the answer

    ddx(−2log⁡∣x+1∣−1x+1+3log⁡∣x+2∣)=−2x+1+1(x+1)2+3x+2.\begin{aligned}&\frac{d}{dx}\left(-2\log|x+1| - \frac{1}{x+1} + 3\log|x+2|\right)\\ &= -\frac{2}{x+1} + \frac{1}{(x+1)^2} + \frac{3}{x+2} .\end{aligned}

    Over the common denominator (x+1)2(x+2)(x+1)^2(x+2) the numerator is

    −2(x+1)(x+2)+(x+2)+3(x+1)2=(−2x2−6x−4)+(x+2)+(3x2+6x+3)=x2+x+1. ✓\begin{aligned}&-2(x+1)(x+2) + (x+2) + 3(x+1)^2\\ &= (-2x^2 - 6x - 4) + (x + 2) + (3x^2 + 6x + 3)\\ &= x^2 + x + 1 .\ \checkmark\end{aligned}
    The derivative is the integrand. The answer is valid on each of the intervals (−∞,−2)(-\infty, -2)⁠, (−2,−1)(-2, -1) and (−1,∞)(-1, \infty)⁠, which avoid both excluded points.
    ddxlog⁡∣x∣=1x\frac{d}{dx}\log|x| = \frac1x (Section 7.2, list item (xii)). Basics: integration undoes differentiation
  6. Compare with the textbook's answer

    The key gives −2log⁡∣x+1∣−1x+1+3log⁡∣x+2∣+C-2\log|x+1| - \frac{1}{x+1} + 3\log|x+2| + C⁠, exactly our answer.

    Partial fractions are unique, so any correct method must give these same three terms; only the constant can differ.
Result

For x≠−1,−2x \ne -1, -2⁠:

∫x2+x+1(x+1)2(x+2) dx=−2log⁡∣x+1∣−1x+1+3log⁡∣x+2∣+C\begin{aligned}&\int\frac{x^2+x+1}{(x+1)^2(x+2)}\,dx\\ &= -2\log|x+1| - \frac{1}{x+1} + 3\log|x+2| + C\end{aligned}

(Textbook answer: −2log⁡∣x+1∣−1x+1+3log⁡∣x+2∣+C-2\log|x+1| - \frac{1}{x+1} + 3\log|x+2| + C⁠.)

Check it with numbers

Decomposition at x=0x = 0⁠: the integrand is 11⋅2=12\frac{1}{1\cdot 2} = \frac12⁠, and −2+1+32=12-2 + 1 + \frac32 = \frac12⁠.

Area from 0 to 1 (no excluded point there): F(1)−F(0)=3log⁡3−5log⁡2+12F(1) - F(0) = 3\log 3 - 5\log 2 + \frac12⁠, so F(1)−F(0)≈0.3301009632F(1) - F(0) \approx 0.3301009632⁠. Numerical integration of the integrand from 0 to 1 also gives 0.33010096320.3301009632⁠.

Common mistakes
  1. Only one term for the repeated factor. (x+1)2(x+1)^2 needs both Ax+1\frac{A}{x+1} and B(x+1)2\frac{B}{(x+1)^2}⁠.
  2. Integrating 1(x+1)2\frac{1}{(x+1)^2} to log⁡(x+1)2\log(x+1)^2⁠. It is a power: the integral is −1x+1-\frac{1}{x+1}⁠.
  3. Sign slips at x=−2x = -2⁠. C(x+1)2C(x+1)^2 at x=−2x = -2 is C(−1)2=CC(-1)^2 = C⁠, positive.
What to take away
  1. A factor (x−a)2(x-a)^2 contributes Ax−a+B(x−a)2\frac{A}{x-a} + \frac{B}{(x-a)^2}⁠: one log and one −Bx−a-\frac{B}{x-a}⁠.
  2. Roots give some constants at once; compare a coefficient for the rest, and check with another.

Every fact used, and where it comes from

FactUsed inSource
Proper fractions; Table 7.2, row 4Step 1Section 7.5 (Lesson: partial fractions)
The decomposition is an identitySteps 2, 3Remark after Example 11, Section 7.5
∫dtt=log⁡∣t∣+C\int\frac{dt}{t} = \log|t| + C⁠; ∫tn dt\int t^n\,dtStep 4Standard formulae (xii), (i), Section 7.2
ddxlog⁡∣x∣=1x\frac{d}{dx}\log|x| = \frac1xStep 5Section 7.2, list item (xii)
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 →