Tutorials › Calculus II › Completing The Square As A Strategic Rewrite

Integration Strategy · Tutorial 17 of 998

Completing The Square As A Strategic Rewrite

Rewrite quadratic expressions to reveal a useful integration form, then choose and verify an appropriate method.

Beginner 9 min read

What You'll Learn

  • Complete the square in a general quadratic and identify its center and sign pattern.
  • Recognize when a quadratic denominator leads to an arctangent or logarithmic antiderivative.
  • Separate a numerator into a denominator-derivative part and a remaining part.
  • Recognize a difference-of-squares radicand suited to trigonometric substitution.
  • Check candidate antiderivatives by differentiating them.

Why Rewrite a Quadratic?

A quadratic expression does not always advertise the best integration method in its expanded form. For example, \(x^2+4x+13\) may look like an ordinary polynomial, but its denominator becomes much easier to read after rewriting it as \((x+2)^2+9\). The rewritten form shows a shifted square plus a positive constant, a standard inverse-trigonometric pattern.

Completing the square is an algebraic rewrite, not an integration method by itself. Its strategic value is that it reveals the sign and scale of the expression around its center. Those features help distinguish denominator forms associated with logarithms or inverse tangents, and radicands suited to trigonometric substitution.

Definition: To complete the square in a quadratic, rewrite it as a constant multiple of a squared linear expression plus a constant. For \(ax^2+bx+c\), where \(a\ne 0\), the completed-square form is
$$ ax^2+bx+c = a\left(x+\frac{b}{2a}\right)^2 +\left(c-\frac{b^2}{4a}\right). $$

The center of the square is \(h=-\frac{b}{2a}\). Writing \(u=x-h\) makes the quadratic a multiple of \(u^2\) plus a constant. The sign of that constant, after factoring out the leading coefficient, is often the key clue.

Completing the Square and Reading the Sign

To derive the formula, factor \(a\) from the quadratic terms, then add and subtract the square of half the coefficient of \(x\) inside the parentheses:

$$ \begin{aligned} ax^2+bx+c &=a\left(x^2+\frac{b}{a}x\right)+c\\ &=a\left[\left(x+\frac{b}{2a}\right)^2-\frac{b^2}{4a^2}\right]+c\\ &=a\left(x+\frac{b}{2a}\right)^2+c-\frac{b^2}{4a}. \end{aligned} $$

The completed form commonly reveals one of these denominator patterns, after translating and scaling the variable:

$$ \frac{1}{u^2+r^2} \qquad\text{or}\qquad \frac{1}{u^2-r^2}. $$

For \(r>0\), the first pattern has an inverse-tangent antiderivative; the second factors into linear terms and leads to a logarithm. A repeated-square denominator, \(1/u^2\), is a different power-rule case, so it should not be mistaken for either pattern.

Key formulas: For \(r>0\),
$$ \int \frac{du}{u^2+r^2} = \frac{1}{r}\arctan\left(\frac{u}{r}\right)+C, \qquad \int \frac{du}{u^2-r^2} = \frac{1}{2r}\ln\left|\frac{u-r}{u+r}\right|+C. $$
The second formula applies on intervals that do not contain \(u=r\) or \(u=-r\). The absolute value makes the logarithm valid on the other parts of the real domain as well.

Why the Denominator Patterns Give These Forms

The inverse-tangent pattern follows directly by scaling the standard derivative of \(\arctan\). Set \(z=u/r\), so \(du=r\,dz\) and \(u^2+r^2=r^2(1+z^2)\). Then

$$ \int \frac{du}{u^2+r^2} = \frac{1}{r}\int \frac{dz}{1+z^2} = \frac{1}{r}\arctan(z)+C = \frac{1}{r}\arctan\left(\frac{u}{r}\right)+C. $$

For the difference of squares, \(u^2-r^2=(u-r)(u+r)\). The partial-fraction identity

$$ \frac{1}{u^2-r^2} = \frac{1}{2r}\left(\frac{1}{u-r}-\frac{1}{u+r}\right) $$

shows why logarithms appear: integrating the two reciprocal linear factors gives logarithms. These justifications also make the sign and scale in each formula easier to check.

Worked Example: A Shifted Sum of Squares

Worked Example: A Shifted Sum of Squares

Evaluate \(\displaystyle \int \frac{dx}{x^2+4x+13}\).

Complete the square. Half of \(4\) is \(2\), and \(2^2=4\), so

$$ x^2+4x+13=(x^2+4x+4)+9=(x+2)^2+9. $$

Let \(u=x+2\). Then \(du=dx\), and the integral becomes

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

Check by differentiating. With \(u=x+2\),

$$ \frac{d}{dx}\left[\frac{1}{3}\arctan\left(\frac{u}{3}\right)\right] = \frac{1}{3}\cdot\frac{1}{1+(u/3)^2}\cdot\frac{1}{3} = \frac{1}{u^2+9} = \frac{1}{x^2+4x+13}. $$

The derivative is the original integrand, so the antiderivative is correct.

Numerators Can Reveal More Than One Form

A completed-square denominator can be useful even when the numerator is not a constant. Compare the numerator with the derivative of the denominator. If it contains that derivative, separate the matching part from what remains. The matching part may integrate to a logarithm; the remainder may still have an inverse-tangent form.

Worked Example: Separating a Logarithmic Part from an Inverse-Tangent Part

Evaluate \(\displaystyle \int \frac{2x+1}{x^2+2x+5}\,dx\).

First complete the square:

$$ x^2+2x+5=(x+1)^2+4. $$

The derivative of the denominator is \(2x+2\). Rewrite the numerator as \(2x+1=(2x+2)-1\), giving

$$ \int \frac{2x+1}{x^2+2x+5}\,dx = \int \frac{2x+2}{x^2+2x+5}\,dx - \int \frac{dx}{(x+1)^2+4}. $$

The first integral is \(\ln(x^2+2x+5)\), since the denominator is positive for every real \(x\). In the second, use the inverse-tangent formula with \(u=x+1\) and \(r=2\). Thus

$$ \int \frac{2x+1}{x^2+2x+5}\,dx = \ln(x^2+2x+5) -\frac{1}{2}\arctan\left(\frac{x+1}{2}\right)+C. $$

To check, differentiate the proposed answer:

$$ \begin{aligned} \frac{d}{dx}\left[ \ln(x^2+2x+5)-\frac{1}{2}\arctan\left(\frac{x+1}{2}\right) \right] &= \frac{2x+2}{x^2+2x+5} -\frac{1}{(x+1)^2+4}\\ &= \frac{2x+2-1}{x^2+2x+5}\\ &= \frac{2x+1}{x^2+2x+5}. \end{aligned} $$

This equals the original integrand.

When a Difference of Squares Leads to a Logarithm

Completing the square can reveal a difference rather than a sum. The resulting denominator has real zeros, so the original integrand is undefined at those points. The antiderivative must therefore be considered separately on intervals that avoid them.

Worked Example: A Difference-of-Squares Denominator

Evaluate \(\displaystyle \int \frac{dx}{x^2-4x-5}\) on intervals where the integrand is defined.

Complete the square and then express the result as a difference of squares:

$$ x^2-4x-5=(x-2)^2-9=(x-2)^2-3^2. $$

Set \(u=x-2\), so \(du=dx\). Apply the difference-of-squares formula:

$$ \begin{aligned} \int \frac{dx}{x^2-4x-5} &=\int \frac{du}{u^2-3^2}\\ &=\frac{1}{6}\ln\left|\frac{u-3}{u+3}\right|+C\\ &=\frac{1}{6}\ln\left|\frac{x-5}{x+1}\right|+C. \end{aligned} $$

The excluded points are \(x=5\) and \(x=-1\), where the denominator is zero. Differentiate the result on any interval that avoids those points:

$$ \begin{aligned} \frac{d}{dx}\left[\frac{1}{6}\ln\left|\frac{x-5}{x+1}\right|\right] &=\frac{1}{6}\left(\frac{1}{x-5}-\frac{1}{x+1}\right)\\ &=\frac{1}{6}\cdot\frac{6}{(x-5)(x+1)}\\ &=\frac{1}{x^2-4x-5}. \end{aligned} $$

The derivative matches the integrand wherever it is defined.

Radicands: A Clue for Trigonometric Substitution

Completing the square is just as useful inside a square root. In particular, a translated expression of the form \(r^2-u^2\), where \(r>0\), suggests the substitution \(u=r\sin\theta\). Then \(r^2-u^2=r^2\cos^2\theta\), and the square root simplifies when \(\cos\theta\ge 0\). This is a trigonometric-substitution signal; the variable shift and the positive scale are essential to identifying it.

Worked Example: A Shifted Difference-of-Squares Radicand

Evaluate \(\displaystyle \int \sqrt{9-(x-1)^2}\,dx\) on the interval \(-2<x<4\).

The radicand is already in the form \(3^2-u^2\), with \(u=x-1\). Set \(u=3\sin\theta\). On \(-\frac{\pi}{2}<\theta<\frac{\pi}{2}\), \(\cos\theta>0\), so \(\sqrt{9-u^2}=3\cos\theta\). Also \(dx=du=3\cos\theta\,d\theta\). Therefore

$$ \begin{aligned} \int \sqrt{9-(x-1)^2}\,dx &=9\int \cos^2\theta\,d\theta\\ &=\frac{9}{2}\left(\theta+\sin\theta\cos\theta\right)+C. \end{aligned} $$

Since \(\theta=\arcsin\left(\frac{x-1}{3}\right)\), \(\sin\theta=\frac{x-1}{3}\), and \(\cos\theta=\frac{\sqrt{9-(x-1)^2}}{3}\), substitute back:

$$ \frac{9}{2}\arcsin\left(\frac{x-1}{3}\right) +\frac{x-1}{2}\sqrt{9-(x-1)^2}+C. $$

Check by differentiation. Write \(u=x-1\). The derivative of the first term is \(\frac{9}{2\sqrt{9-u^2}}\). The derivative of the second is \(\frac{1}{2}\sqrt{9-u^2}-\frac{u^2}{2\sqrt{9-u^2}}\). Adding them gives

$$ \frac{9-u^2}{2\sqrt{9-u^2}}+\frac{\sqrt{9-u^2}}{2} = \sqrt{9-u^2} = \sqrt{9-(x-1)^2}. $$

The derivative is the original integrand throughout the stated interval.

A Reliable Decision Process

Use the completed form to identify a pattern before committing to a method. The algebra does not guarantee that every integral becomes easy, but it can rule in or rule out common standard forms.

1
Find the center.
For \(ax^2+bx+c\), shift the variable by \(h=-\frac{b}{2a}\), so the squared term is \((x-h)^2\).
2
Determine the sign and scale.
Rewrite the expression as a constant multiple of a square plus or minus a positive constant, if possible.
3
Match the integrand.
A denominator with a positive square plus a positive constant suggests an inverse tangent; a difference of squares suggests logarithms. A radicand \(r^2-u^2\) suggests trigonometric substitution.
4
Check the domain and numerator.
Record where a denominator vanishes, and check whether the numerator contains a useful multiple of the denominator's derivative.
5
Verify the result.
Differentiate the proposed antiderivative and compare it with the original integrand on its domain.

A Common Mistake: Losing the Scale

A frequent error is to recognize the right pattern but omit its scale factor. For example,

$$ \int \frac{du}{u^2+9} \ne \arctan\left(\frac{u}{3}\right)+C. $$

Differentiating the incorrect expression gives

$$ \frac{d}{du}\arctan\left(\frac{u}{3}\right) = \frac{1}{3}\cdot\frac{1}{1+(u/3)^2} = \frac{3}{u^2+9}, $$

which is three times the required integrand. The correct antiderivative includes a factor of \(\frac{1}{3}\):

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

Another sign error is to treat \(u^2-r^2\) as though it were \(u^2+r^2\). The former has real zeros and leads to logarithms, not the inverse-tangent formula. Factoring or differentiating the proposed answer is a quick way to catch either mistake.

Check Your Understanding

For each question, identify the useful completed form before selecting an integration pattern.

  1. Complete the square in \(x^2-8x+20\). Is the result a shifted sum or difference of squares?
  2. What standard antiderivative form is suggested by the denominator \((x-3)^2+16\)?
  3. Rewrite \(x^2+2x-8\) as a difference of squares centered at its vertex. Which two real values make the denominator zero?
  4. For the integral \(\displaystyle \int \frac{2x+2}{x^2+2x+5}\,dx\), how is the numerator related to the denominator's derivative?
  5. What substitution is suggested by the radicand \(25-(x+2)^2\), and what interval can be used to keep the resulting cosine nonnegative?

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