01 / 22
\u222B

Integration by
Long Division & Completing the Square

Master two powerful algebraic techniques for rewriting rational integrands into forms you already know how to integrate.

AP Calculus BC

Why Algebraic Rewriting Before Integrating?

Not every rational function fits a standard integration rule. When the degree of the numerator is greater than or equal to the degree of the denominator, or when the denominator is an irreducible quadratic, we must first transform the integrand into a friendlier form.

When to Use Long Division

Polynomial long division applies whenever the degree of the numerator \(\geq\) the degree of the denominator. The goal: rewrite the improper rational function as a polynomial plus a proper fraction.

$$\frac{P(x)}{D(x)} = Q(x) + \frac{R(x)}{D(x)}, \quad \deg R < \deg D$$

When to Complete the Square

Completing the square is your tool when the denominator contains an irreducible quadratic (no real roots). It transforms \(ax^2 + bx + c\) into the form \(a(x-h)^2 + k\), which matches the \(\arctan\) or \(\arcsin\) integration formulas.

\(\arctan\) Pattern
\(\displaystyle\int \frac{dx}{u^2+a^2} = \frac{1}{a}\arctan\!\frac{u}{a}+C\)
\(\arcsin\) Pattern
\(\displaystyle\int \frac{dx}{\sqrt{a^2-u^2}} = \arcsin\!\frac{u}{a}+C\)

The Long Division Algorithm

1
Compare degrees. If \(\deg(\text{numerator}) \geq \deg(\text{denominator})\), proceed with division.
2
Divide the leading term of the numerator by the leading term of the denominator.
3
Multiply the entire denominator by that result and subtract from the numerator.
4
Repeat until the remainder has degree strictly less than the denominator.
5
Integrate each resulting term separately.

Completing the Square: Step by Step

1
Factor out the leading coefficient from the quadratic terms: \(a(x^2 + \frac{b}{a}x) + c\).
2
Add and subtract \(\left(\frac{b}{2a}\right)^2\) inside the parentheses to form a perfect square.
3
Rewrite as \(a\left(x + \frac{b}{2a}\right)^2 + \left(c - \frac{b^2}{4a}\right)\).
4
Substitute \(u = x + \frac{b}{2a}\) and match to an \(\arctan\) or \(\arcsin\) template.

Long Division vs. Completing the Square

Long Division Completing the Square
When to use \(\deg P \geq \deg D\) Irreducible quadratic in denominator
Goal Reduce to proper fraction Match \(\arctan\)/\(\arcsin\) form
Result Polynomial + \(\frac{R}{D}\) \(\frac{1}{u^2+a^2}\) or similar
Then integrate via Power rule, \(\ln\), partial fractions Inverse trig formulas

Decision Flowchart

Rational integrand \(\frac{P(x)}{D(x)}\)?
\(\deg(P) \geq \deg(D)\)?
Yes Long Division Integrate polynomial + proper fraction No Irreducible quadratic in denominator? Yes Complete the Square then use arctan/arcsin

Example 1: Long Division

$$\int \frac{x^3 + 2x^2 - x + 3}{x+1}\,dx$$

Step 1: Since \(\deg(x^3 + 2x^2 - x + 3) = 3 \geq 1 = \deg(x+1)\), we divide.

Example 1: Finishing the Integral

Step 2: Integrate each piece using the power rule and \(\ln\):

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

Example 2: Completing the Square

$$\int \frac{dx}{x^2 + 6x + 13}$$

Step 1: Complete the square in the denominator:

$$x^2 + 6x + 13 = (x^2 + 6x + 9) + 4 = (x+3)^2 + 4$$

Example 2: Final Answer

Step 2: Apply the formula \(\displaystyle\int\frac{du}{u^2+a^2} = \frac{1}{a}\arctan\!\frac{u}{a}+C\):

$$\int \frac{dx}{(x+3)^2 + 2^2} = \frac{1}{2}\arctan\!\left(\frac{x+3}{2}\right) + C$$

Example 3: Both Techniques Combined

$$\int \frac{x^2 + 1}{x^2 + 4x + 8}\,dx$$

Observe: \(\deg(\text{num}) = \deg(\text{den}) = 2\), so we need long division first.

Now the remainder fraction is proper. Next, we'll handle \(\dfrac{-4x-7}{x^2+4x+8}\) by completing the square in the denominator.

Example 3: Splitting the Remainder

Complete the square: \(x^2+4x+8 = (x+2)^2 + 4\). Let \(u = x+2\), so \(x = u - 2\) and the remainder numerator \(-4x - 7 = -4(u-2) - 7 = -4u + 1\).

$$\int\frac{-4u+1}{u^2+4}\,du = -4\!\int\frac{u\,du}{u^2+4} + \int\frac{du}{u^2+4}$$

Example 3: Complete Solution

Combining everything and substituting back \(u = x+2\):

$$\int \frac{x^2+1}{x^2+4x+8}\,dx = x - 2\ln\!\big((x+2)^2+4\big) + \frac{1}{2}\arctan\!\frac{x+2}{2} + C$$

Common Mistakes to Avoid

✕ Skipping Long Division
Trying partial fractions or substitution on an improper fraction. Always check: is \(\deg P \geq \deg D\)?
✕ Wrong Constant in the Square
Forgetting to add and subtract the same value. \(\left(\frac{b}{2a}\right)^2\) must be both added and subtracted inside.
✕ Ignoring the Numerator
After completing the square, you must split the numerator into a part matching \(\frac{u}{u^2+a^2}\) and a constant part.

Summary: Integration Toolkit

Integrand Form Technique Resulting Form
\(\frac{x^3+\cdots}{x+a}\) Long Division Polynomial + \(\frac{R}{x+a}\)
\(\frac{1}{x^2+bx+c}\) Complete the Square \(\frac{1}{(x-h)^2+k} \to \arctan\)
\(\frac{x}{x^2+bx+c}\) Complete + Split \(\ln + \arctan\)
\(\frac{x^2+\cdots}{x^2+bx+c}\) Long Div + Complete Polynomial + \(\ln + \arctan\)

Question 1 of 5

What is the first step when evaluating \(\displaystyle\int\frac{x^3 - 1}{x - 2}\,dx\)?

Question 2 of 5

Completing the square on \(x^2 - 4x + 13\) gives:

Question 3 of 5

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

Question 4 of 5

After performing long division on \(\dfrac{2x^2 + 3x + 1}{x + 1}\), what is the quotient and remainder?

Question 5 of 5

To evaluate \(\displaystyle\int\frac{2x+3}{x^2+4x+13}\,dx\), you should split the numerator into which two parts?