Tutorials › Calculus II › Completing the Square After Partial-Fraction Decomposition

Completing the Square Techniques · Tutorial 272 of 998

Completing the Square After Partial-Fraction Decomposition

Complete each quadratic denominator, match its numerator to the logarithmic and inverse-tangent forms, and combine the resulting antiderivatives.

Intermediate 10 min read

What You'll Learn

  • Normalize an irreducible quadratic denominator by completing its square.
  • Rewrite each linear numerator in terms of the shifted variable.
  • Identify which numerator parts produce logarithms and which produce inverse tangents.
  • Integrate and combine several distinct quadratic partial fractions.
  • Check a combined antiderivative by differentiating it.
  • Recognize and correct a common scaling error in the inverse-tangent term.

Why Complete the Square After Decomposition?

Partial-fraction decomposition can turn a rational function into a sum of terms with simpler denominators. When those denominators are distinct irreducible quadratics, each term can be integrated separately. Completing the square then reveals two familiar contributions: a logarithm from the part of the numerator proportional to the shifted variable, and an inverse tangent from the remaining constant part.

The main task is to handle every quadratic consistently. A shift that works for one denominator will generally not work for another, and the constant left over in the numerator must be recalculated after each shift. Once each term is in the correct form, the antiderivatives are added.

Key idea: For each irreducible quadratic term, complete the square in its own denominator, rewrite its linear numerator using the same shift, and integrate the resulting logarithmic and inverse-tangent parts separately.

The Formula for One Quadratic Term

Consider a quadratic denominator \(ax^2+bx+c\) with \(a>0\) and \(b^2-4ac<0\). The negative discriminant means it has no real roots. Define

$$ h=-\frac{b}{2a}, \qquad d=\sqrt{\frac{c}{a}-h^2}. $$

Since \(b^2-4ac<0\), we have \(d>0\), and completing the square gives

$$ ax^2+bx+c = a\bigl((x-h)^2+d^2\bigr). $$

For a linear numerator \(Ax+B\), write \(Ax+B=A(x-h)+(Ah+B)\). This expresses the numerator in terms of the same shifted variable \(x-h\) that appears in the completed square. The resulting integral is

$$ \int \frac{Ax+B}{ax^2+bx+c}\,dx = \frac{A}{2a}\ln\bigl((x-h)^2+d^2\bigr) + \frac{Ah+B}{ad} \arctan\left(\frac{x-h}{d}\right)+C. $$

Here \(C\) is an arbitrary constant. This formula applies when the denominator is an irreducible quadratic with positive leading coefficient and the numerator has degree at most one. If the leading coefficient is not positive, the denominator can first be multiplied by \(-1\) and the numerator adjusted accordingly.

Why the Formula Works

The formula follows by separating the two numerator parts and differentiating the proposed antiderivative. Put \(u=x-h\). Then the integrand becomes

$$ \frac{Ax+B}{ax^2+bx+c} = \frac{1}{a}\frac{Au+(Ah+B)}{u^2+d^2}. $$

The part containing \(Au\) is integrated by recognizing that the derivative of \(u^2+d^2\) is \(2u\). The constant part uses the derivative of \(\arctan(u/d)\). In full,

$$ \frac{d}{dx} \left[ \frac{A}{2a}\ln(u^2+d^2) + \frac{Ah+B}{ad}\arctan\left(\frac{u}{d}\right) \right] = \frac{A}{a}\frac{u}{u^2+d^2} + \frac{Ah+B}{a}\frac{1}{u^2+d^2}. $$

For the second term, the chain rule gives \(\frac{d}{dx}\arctan(u/d)=d/(u^2+d^2)\), which accounts for the factor \(1/d\) in the antiderivative. Combining the two derivative terms recovers the rewritten integrand exactly.

Result: In a sum of partial fractions with distinct irreducible quadratic denominators, integrate each term by its own completed-square form and add the antiderivatives. This uses the linearity of integration: the integral of a finite sum is the sum of the integrals, on any interval where the original integrand is defined.

Worked Example: Two Quadratic Terms from a Rational Function

Worked Example: Two Quadratic Terms from a Rational Function

Integrate the rational function below. Its partial-fraction decomposition is shown as a sum, and the numerator of the combined fraction is included so the decomposition can be checked.

$$ \int \frac{5x^3+5x^2+9x+53}{(x^2+2x+5)(x^2-4x+8)}\,dx = \int\left( \frac{2x+6}{x^2+2x+5} + \frac{3x+1}{x^2-4x+8} \right)dx. $$

To verify the decomposition, combine the fractions. The numerator is

$$ \begin{aligned} (2x+6)(x^2-4x+8)+(3x+1)(x^2+2x+5) &=(2x^3-2x^2-8x+48)+(3x^3+7x^2+17x+5)\\ &=5x^3+5x^2+9x+53. \end{aligned} $$

For the first denominator, complete the square and shift the numerator together with it:

$$ x^2+2x+5=(x+1)^2+4, \qquad 2x+6=2(x+1)+4. $$

Therefore, the first integral is

$$ \int \frac{2x+6}{x^2+2x+5}\,dx = \ln\bigl((x+1)^2+4\bigr) + 2\arctan\left(\frac{x+1}{2}\right). $$

For the second denominator, use a different shift:

$$ x^2-4x+8=(x-2)^2+4, \qquad 3x+1=3(x-2)+7. $$

It follows that

$$ \int \frac{3x+1}{x^2-4x+8}\,dx = \frac{3}{2}\ln\bigl((x-2)^2+4\bigr) + \frac{7}{2}\arctan\left(\frac{x-2}{2}\right). $$

Adding both results gives an antiderivative of the original rational function:

$$ F(x)= \ln\bigl((x+1)^2+4\bigr) +2\arctan\left(\frac{x+1}{2}\right) +\frac{3}{2}\ln\bigl((x-2)^2+4\bigr) +\frac{7}{2}\arctan\left(\frac{x-2}{2}\right)+C. $$

Check by differentiating. The first two terms give \(\frac{2(x+1)+4}{(x+1)^2+4}=\frac{2x+6}{x^2+2x+5}\). The next two give \(\frac{3(x-2)+7}{(x-2)^2+4}=\frac{3x+1}{x^2-4x+8}\). Their sum is the displayed partial-fraction decomposition, so the derivative agrees with the integrand.

Worked Example: Combining Three Distinct Quadratics

Worked Example: Combining Three Distinct Quadratics

Integrate the following sum of three distinct quadratic terms. The decomposition is already displayed, so the calculation focuses on completing each square and combining the results.

$$ \int\left( \frac{2x+4}{x^2+4x+8} +\frac{3x-1}{x^2-2x+2} +\frac{4x+5}{x^2+6x+13} \right)dx. $$

For the first term, \(x^2+4x+8=(x+2)^2+4\). With \(u=x+2\), the numerator is \(2x+4=2u\). Thus

$$ \int \frac{2x+4}{x^2+4x+8}\,dx = \int\frac{2u}{u^2+4}\,du = \ln(u^2+4) = \ln\bigl((x+2)^2+4\bigr). $$

For the second term, \(x^2-2x+2=(x-1)^2+1\). Put \(v=x-1\), so \(3x-1=3v+2\). Then

$$ \begin{aligned} \int \frac{3x-1}{x^2-2x+2}\,dx &=\int\frac{3v+2}{v^2+1}\,dv\\ &=\frac{3}{2}\ln(v^2+1)+2\arctan(v)\\ &=\frac{3}{2}\ln\bigl((x-1)^2+1\bigr)+2\arctan(x-1). \end{aligned} $$

For the third term, \(x^2+6x+13=(x+3)^2+4\). Put \(w=x+3\), so \(4x+5=4w-7\). Separating the two numerator parts gives

$$ \begin{aligned} \int\frac{4x+5}{x^2+6x+13}\,dx &=\int\frac{4w-7}{w^2+4}\,dw\\ &=2\ln(w^2+4)-\frac{7}{2}\arctan\left(\frac{w}{2}\right)\\ &=2\ln\bigl((x+3)^2+4\bigr)-\frac{7}{2}\arctan\left(\frac{x+3}{2}\right). \end{aligned} $$

Combining the three antiderivatives yields

$$ \begin{aligned} F(x)={}&\ln\bigl((x+2)^2+4\bigr) +\frac{3}{2}\ln\bigl((x-1)^2+1\bigr) +2\arctan(x-1)\\ &+2\ln\bigl((x+3)^2+4\bigr) -\frac{7}{2}\arctan\left(\frac{x+3}{2}\right)+C. \end{aligned} $$

Check by differentiation. The derivative of the first logarithm is \(2(x+2)/((x+2)^2+4)\), matching the first fraction. The derivative of the second logarithm and its inverse tangent together is \((3(x-1)+2)/((x-1)^2+1)=(3x-1)/(x^2-2x+2)\). The last logarithm and inverse tangent differentiate to \((4(x+3)-7)/((x+3)^2+4)=(4x+5)/(x^2+6x+13)\). Thus \(F'(x)\) is the original sum.

Worked Example: Quadratics with Nonunit Leading Coefficients

Worked Example: Quadratics with Nonunit Leading Coefficients

Integrate a sum in which the quadratic denominators do not have leading coefficient \(1\):

$$ \int\left( \frac{6x+9}{2x^2+4x+10} + \frac{5x-2}{3x^2-6x+15} \right)dx. $$

First complete the square in each denominator, keeping its leading coefficient visible:

$$ 2x^2+4x+10=2\bigl((x+1)^2+4\bigr), \qquad 3x^2-6x+15=3\bigl((x-1)^2+4\bigr). $$

For the first fraction, let \(u=x+1\). Then \(6x+9=6u+3\), and the fraction becomes \(\frac{3u+3/2}{u^2+4}\). Hence

$$ \int\frac{6x+9}{2x^2+4x+10}\,dx = \frac{3}{2}\ln\bigl((x+1)^2+4\bigr) +\frac{3}{4}\arctan\left(\frac{x+1}{2}\right). $$

For the second fraction, let \(v=x-1\). Then \(5x-2=5v+3\), so the fraction is \(\frac{(5/3)v+1}{v^2+4}\). Therefore

$$ \int\frac{5x-2}{3x^2-6x+15}\,dx = \frac{5}{6}\ln\bigl((x-1)^2+4\bigr) +\frac{1}{2}\arctan\left(\frac{x-1}{2}\right). $$

The combined antiderivative is the sum of these two expressions. To check it, differentiate the first pair of terms: their derivatives add to \(\bigl(3(x+1)+3/2\bigr)/((x+1)^2+4)\), which equals the original first fraction after dividing its numerator and denominator by \(2\). For the second pair, the derivatives add to \(\bigl((5/3)(x-1)+1\bigr)/((x-1)^2+4)\), which equals the original second fraction after dividing its numerator and denominator by \(3\). The derivative of the combined result is therefore the given integrand.

A Common Scaling Pitfall

The inverse-tangent term must include the scale created by the constant in the completed square. For example, with \(u=x+2\),

$$ \int\frac{dx}{(x+2)^2+4} = \int\frac{du}{u^2+4} = \frac{1}{2}\arctan\left(\frac{u}{2}\right)+C. $$

A common incorrect calculation is to write this integral as \(\arctan(u/2)+C\), omitting the factor \(1/2\). Differentiating that incorrect result gives

$$ \frac{d}{du}\arctan\left(\frac{u}{2}\right) = \frac{2}{u^2+4}, $$

which is twice the required integrand. The correction is the factor \(1/2\), since

$$ \frac{d}{du}\left[\frac{1}{2}\arctan\left(\frac{u}{2}\right)\right] = \frac{1}{u^2+4}. $$

More generally, the antiderivative of \(1/(u^2+d^2)\), for \(d>0\), is \((1/d)\arctan(u/d)+C\). Checking this derivative is a reliable way to catch a missing scale factor.

A Reliable Sequence of Steps

1
Separate the quadratic terms.
Use the given partial-fraction sum and treat each distinct denominator on its own.
2
Complete each square.
Record the shift and the positive constant left in the denominator.
3
Rewrite the numerator using that shift.
Express it as a multiple of the shifted variable plus a constant.
4
Integrate and combine.
The shifted-variable part gives a logarithm; the constant part gives an inverse tangent. Add all terms and differentiate to check.

This method matters because rational functions with several irreducible quadratic factors often yield antiderivatives containing several different logarithms and inverse tangents. The structure of each contribution is determined locally by that factor and its numerator. Keeping the shifts and constants paired prevents one denominator’s completed square from being mistakenly used for another.

Check Your Understanding

For each question, identify the completed-square form and keep track of the numerator after making the shift.

  1. Complete the square in \(x^2-6x+13\), then rewrite \(2x+5\) using the shifted variable.
  2. Which part of a numerator of the form \(Au+K\) produces a logarithm, and which produces an inverse tangent when the denominator is \(u^2+d^2\)?
  3. Find the antiderivative of \((2x+3)/(x^2+2x+5)\).
  4. Why must the antiderivative of \(1/(u^2+9)\) contain a factor of \(1/3\) multiplying \(\arctan(u/3)\)?
  5. After integrating a sum of three distinct quadratic terms, what derivative check confirms that the combined result is correct?

Test yourself: Calculus II final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon