01 / 20

Integration:
Long Division & Completing the Square

Master two essential algebraic manipulation techniques that transform difficult integrals into forms you already know how to solve.

Calculus 2

Why Algebraic Manipulation Before Integration?

Many integrals look impossible at first glance, but they are just familiar integrals in disguise. The integrand's algebraic form doesn't match any standard rule: it might be an improper rational function or a quadratic with no clean factorization.

Polynomial Long Division for Integrals

When the degree of the numerator is greater than or equal to the degree of the denominator, you have an improper rational function. You cannot apply partial fractions or logarithm rules directly.

Improper
\(\deg(\text{num}) \geq \deg(\text{den})\), e.g. \(\displaystyle\frac{x^3 + 1}{x^2 + 1}\)
Proper
\(\deg(\text{num}) < \deg(\text{den})\), e.g. \(\displaystyle\frac{3x}{x^2 + 1}\)

Completing the Square for Integrals

When the denominator contains a quadratic that doesn't factor over the reals, completing the square transforms it into the form \(u^2 + a^2\) or \(a^2 - u^2\), unlocking inverse trig and logarithmic antiderivatives.

$$ax^2 + bx + c \;\longrightarrow\; a\!\left(x + \frac{b}{2a}\right)^{\!2} + \left(c - \frac{b^2}{4a}\right)$$

The Long Division Theorem

$$\frac{P(x)}{D(x)} = Q(x) + \frac{R(x)}{D(x)}$$

where \(\deg(R) < \deg(D)\). Therefore:

$$\int \frac{P(x)}{D(x)}\,dx = \int Q(x)\,dx + \int \frac{R(x)}{D(x)}\,dx$$

The Completing the Square Formulas

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

Long Division vs. Completing the Square

Long Division Completing the Square
When to use \(\deg(\text{num}) \geq \deg(\text{den})\) Irreducible quadratic in denominator
Goal Split into polynomial + proper fraction Rewrite quadratic as \(u^2 + a^2\)
Result Power rule + simpler integral \(\arctan\), \(\arcsin\), or \(\ln\)
Example trigger \(\displaystyle\frac{x^3}{x+1}\) \(\displaystyle\frac{1}{x^2+6x+13}\)

Step-by-Step: Long Division

1
Check degrees. If \(\deg(\text{numerator}) \geq \deg(\text{denominator})\), proceed. Otherwise, skip to another technique.
2
Divide. Perform polynomial long division: divide the leading term of the numerator by the leading term of the denominator.
3
Multiply and subtract. Repeat until the remainder has degree less than the denominator.
4
Rewrite and integrate. Write as \(Q(x) + \frac{R(x)}{D(x)}\), then integrate each term separately.

Step-by-Step: Completing the Square

1
Identify the quadratic. Look for \(ax^2 + bx + c\) in the denominator that doesn't factor over \(\mathbb{R}\).
2
Factor out \(a\) if \(a \neq 1\), so you have \(a(x^2 + \frac{b}{a}x) + c\).
3
Complete the square. Add and subtract \(\left(\frac{b}{2a}\right)^2\) inside: get \(a\left(x + \frac{b}{2a}\right)^2 + k\).
4
Substitute \(u = x + \frac{b}{2a}\) and match to a standard \(\arctan\) or \(\arcsin\) form. Integrate.

Example 1: Long Division

$$\int \frac{x^2 + 1}{x - 1}\,dx$$
Step 1: Divide
Since \(\deg(x^2+1) = 2 \geq \deg(x-1) = 1\), perform long division:
\(x^2 + 1 = (x-1)\cdot(x+1) + 2\)
Step 2: Rewrite
\(\displaystyle\frac{x^2+1}{x-1} = x + 1 + \frac{2}{x-1}\)
Step 3: Integrate
\(\displaystyle\int\!\left(x + 1 + \frac{2}{x-1}\right)dx = \frac{x^2}{2} + x + 2\ln|x-1| + C\)

Example 2: Completing the Square

$$\int \frac{dx}{x^2 + 6x + 13}$$
Step 1: Complete the square
\(x^2 + 6x + 13 = (x^2 + 6x + 9) + 4 = (x+3)^2 + 2^2\)
Step 2: Substitute
Let \(u = x + 3\), so \(du = dx\). The integral becomes \(\displaystyle\int \frac{du}{u^2 + 2^2}\).
Step 3: Apply formula
\(\displaystyle\frac{1}{2}\arctan\!\left(\frac{u}{2}\right) + C = \frac{1}{2}\arctan\!\left(\frac{x+3}{2}\right) + C\)

Example 3: Both Techniques Together

$$\int \frac{x^2}{x^2 + 4x + 8}\,dx$$
Step 1: Long division
Since the degrees are equal (\(\deg(\text{num}) = \deg(\text{den})\)), divide: \(\displaystyle\frac{x^2}{x^2+4x+8} = 1 - \frac{4x+8}{x^2+4x+8}\)
Step 2: Complete the square on denominator
\(x^2 + 4x + 8 = (x+2)^2 + 4\). Now rewrite the numerator of the remainder term:
\(\displaystyle\frac{4x+8}{(x+2)^2+4} = \frac{4(x+2)}{(x+2)^2+4}\)
Step 3: Integrate
\(\displaystyle\int 1\,dx - 4\int \frac{(x+2)}{(x+2)^2+4}\,dx = x - 2\ln\!\big((x+2)^2+4\big) + C\)

Decision Flowchart

Rational integrand?
\(\deg(\text{num}) \geq \deg(\text{den})?\)
Yes Long Division
\(Q(x) + \frac{R(x)}{D(x)}\)
then No Proper fraction: does den. factor? Yes Partial Fractions / \(\ln\) No Complete the Square

Splitting the Numerator After Completing the Square

When the numerator has a linear term \(Ax + B\) over an irreducible quadratic, split it into two integrals:

$$\int \frac{Ax + B}{(x+h)^2 + k^2}\,dx = A\!\int\!\frac{(x+h)}{(x+h)^2+k^2}\,dx + (B - Ah)\!\int\!\frac{dx}{(x+h)^2+k^2}$$
First integral
Has derivative of denominator in numerator: produces \(\ln\) via \(u\)-sub.
Second integral
Pure constant over sum of squares: produces \(\arctan\).

Common Mistakes to Avoid

✕ Skipping the Division
Attempting partial fractions or substitution on an improper rational function. Always check degrees first.
✕ Wrong Sign in Square
Writing \((x+3)^2 + 4\) when the algebra gives \((x+3)^2 - 4\). Expand and verify your completed square matches the original.
✕ Forgetting the \(a\) in \(\frac{1}{a}\arctan\)
The formula is \(\frac{1}{a}\arctan\!\left(\frac{u}{a}\right)\), not just \(\arctan\!\left(\frac{u}{a}\right)\). Missing the \(\frac{1}{a}\) factor is the most common error.

Summary of Techniques

Integrand Form Technique Result Contains
\(\frac{x^n + \cdots}{x^m + \cdots}\), \(n \geq m\) Long Division Polynomial + proper fraction
\(\frac{1}{x^2 + bx + c}\) (irreducible) Complete the Square \(\arctan\)
\(\frac{1}{\sqrt{a^2 - (x+h)^2}}\) Complete the Square \(\arcsin\)
\(\frac{Ax+B}{x^2+bx+c}\) (irreducible) CTS + Split Numerator \(\ln + \arctan\)
\(\frac{x^3+1}{x^2+bx+c}\) Long Div + CTS Polynomial + \(\ln\) + \(\arctan\)

Question 1 of 5

What is the first step to evaluate \(\displaystyle\int \frac{x^3 + 2x}{x^2 + 1}\,dx\)?

Question 2 of 5

What does \(x^2 + 4x + 13\) become after completing the square?

Question 3 of 5

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

Question 4 of 5

After performing long division on \(\displaystyle\frac{x^2 + 3}{x + 2}\), the result is:

Question 5 of 5

To evaluate \(\displaystyle\int \frac{2x + 5}{x^2 + 4x + 8}\,dx\), after completing the square you should: