CALCULUS 1 • INTEGRATION: ACCUMULATION & FTC

Integration: Long Division & Completing Square — Integrating Functions Using Long Division and Completing the Square

Master two algebraic techniques that transform tricky integrands into forms you already know how to integrate.

Historical Context & Motivation

Integration has never been a one-size-fits-all operation. Unlike differentiation, where a handful of rules can handle almost any function, finding antiderivatives often requires creative algebraic manipulation before you can even begin. Two of the oldest and most reliable tools in this algebraic toolkit are polynomial long division and completing the square. Both techniques were developed centuries before calculus itself existed, but they remain essential for rewriting integrands into recognizable forms.

~300 BCE
Euclid's Division Algorithm
Euclid described a systematic method for dividing one number by another in his Elements. This idea of quotient-plus-remainder was later extended to polynomials.
~820 CE
Al-Khwārizmī and Completing the Square
The Persian mathematician al-Khwārizmī used a geometric version of completing the square to solve quadratic equations in his foundational algebra text, giving the technique its first systematic treatment.
1660s
Newton & Leibniz Develop Calculus
Isaac Newton and Gottfried Leibniz independently formalized integration. They immediately needed algebraic tricks—including long division and completing the square—to evaluate integrals of rational functions.
1700s
Euler Systematizes Integration Techniques
Leonhard Euler catalogued integration methods, showing how algebraic preprocessing (long division, completing the square, partial fractions) could reduce a wide class of integrals to standard forms involving logarithms and arctangent.

The central question these techniques answer is: What do you do when the integrand doesn't match any standard antiderivative rule? Rather than inventing new formulas, you reshape the function algebraically until it matches a pattern you already know. Long division handles rational functions where the degree of the numerator is at least as large as the degree of the denominator. Completing the square transforms quadratic expressions in the denominator into forms that lead to logarithmic or inverse trigonometric antiderivatives.

Core Principles & Definitions

Before diving into calculations, you need to understand why these techniques work and when to apply each one. Both methods are forms of algebraic preprocessing—rewriting an integrand so that it fits a known integration pattern. The key is recognizing which tool to reach for based on the structure of the function you're integrating.

1

Polynomial Long Division

When integrating a rational function P(x)/Q(x) where the degree of P is ≥ the degree of Q, divide first. This produces a polynomial plus a proper fraction, both of which are easier to integrate.
2

Completing the Square

When the denominator contains a quadratic expression like ax² + bx + c, rewrite it as a(x − h)² + k. This form matches the standard arctangent or logarithmic integral patterns.
3

Proper vs. Improper Rational Functions

A rational function is proper when deg(numerator) < deg(denominator). Long division converts improper rational functions into a polynomial plus a proper rational function.
4

Standard Forms to Recognize

After preprocessing, you should see forms like 1/(x² + a²) → (1/a)arctan(x/a), or 1/(x − a) → ln|x − a|. These are the payoff of algebraic manipulation.
KEY TAKEAWAY
Think of integration like fitting puzzle pieces. Your "board" has slots shaped like ln|x|, arctan(x), and basic power functions. Long division and completing the square are the tools you use to reshape awkward pieces until they snap into the slots you already have. You're not learning new integration rules—you're learning how to make old rules apply to new situations.

Visual Explanation: Decision Flowchart

When you encounter a rational function to integrate, the first decision is whether the fraction is improper (numerator degree ≥ denominator degree) or proper (numerator degree < denominator degree). The following flowchart guides you through the decision process for choosing the right algebraic technique.

Start at the top with your rational function. If the fraction is improper, use long division first. Once you have a proper fraction, check whether the denominator is quadratic—if so, completing the square is your next move.

Notice how the flowchart always funnels toward a standard integral form. The entire strategy is about simplification: long division peels off a polynomial that you can integrate term-by-term, and completing the square reshapes the remaining denominator so it matches an arctan or natural log pattern. Neither technique changes the value of the integral—they just reveal a structure that was hidden.

Mathematical Framework

Long Division for Integration

When you divide a polynomial P(x) by another polynomial Q(x), you get a quotient S(x) and a remainder R(x). This is the same division algorithm you learned in Algebra, applied to polynomials instead of numbers. The result is the fundamental identity that makes this technique work.

POLYNOMIAL DIVISION IDENTITY
P(x) / Q(x) = S(x) + R(x) / Q(x)
where S(x) is the polynomial quotient, R(x) is the remainder with deg(R) < deg(Q), and Q(x) is the original denominator.

Because S(x) is a polynomial, you integrate it using the power rule term by term. The remaining fraction R(x)/Q(x) is now a proper rational function, which you can handle with other techniques like completing the square, u-substitution, or partial fractions.

INTEGRATION AFTER LONG DIVISION
∫ P(x)/Q(x) dx = ∫ S(x) dx + ∫ R(x)/Q(x) dx
The first integral uses the power rule. The second integral is a proper fraction that can be evaluated using completing the square, partial fractions, or substitution.

Completing the Square for Integration

When the denominator of a proper fraction contains a quadratic expression ax² + bx + c that doesn't factor nicely, you can rewrite it in vertex form. This converts the quadratic into a sum or difference of squares, which matches standard integral formulas.

COMPLETING THE SQUARE
ax² + bx + c = a(x + b/(2a))² + (c − b²/(4a))
The expression is rewritten by adding and subtracting (b/(2a))² inside the parentheses. The constant h = −b/(2a) shifts the variable, and k = c − b²/(4a) is the remaining constant.
STANDARD ARCTANGENT INTEGRAL
∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C
This is the target form. After completing the square with a = 1, set u = x + b/2 and match the denominator to u² + a². If the leading coefficient is not 1, factor it out first.
STANDARD LOGARITHMIC INTEGRAL
∫ 1/(x − a) dx = ln|x − a| + C
When the denominator is linear (degree 1), the antiderivative is a natural logarithm. This form often appears as part of the remainder after long division.

Step-by-Step Breakdown of Each Technique

Long Division: The Process Visualized

Polynomial long division follows the same logic as numerical long division: divide, multiply, subtract, bring down. The diagram below walks through the division of (x³ + 2x² − x + 3) by (x + 1), showing each stage of the process and how the quotient and remainder emerge.

The division produces the quotient x² + x − 2 and the remainder 5. The original integrand becomes x² + x − 2 + 5/(x + 1), and each piece can be integrated using basic rules.

Completing the Square: The Process

Completing the square rewrites a quadratic from standard form (ax² + bx + c) into vertex form (a(x − h)² + k). Here's the step-by-step procedure, illustrated with the example x² + 6x + 13.

  1. Step 1: Start with the quadratic: x² + 6x + 13. Make sure the coefficient of x² is 1 (if it's not, factor it out first).
  2. Step 2: Take half the coefficient of x: 6/2 = 3. Square it: 3² = 9.
  3. Step 3: Add and subtract 9 inside the expression: x² + 6x + 9 − 9 + 13 = (x + 3)² + 4.
  4. Step 4: Recognize the form: (x + 3)² + 2² matches u² + a² with u = x + 3 and a = 2.
  5. Step 5: Apply the standard integral: ∫ 1/((x+3)² + 4) dx = (1/2) arctan((x+3)/2) + C.
💡 When to Use Each Technique
Use long division when deg(numerator) ≥ deg(denominator). Use completing the square when the denominator has an irreducible quadratic (one that doesn't factor over the reals). Sometimes you'll use both techniques on the same integral—long division first to get a proper fraction, then completing the square on the remainder.

Worked Examples

Example 1: Long Division Before Integrating
1
Step 1 — Identify the ProblemEvaluate ∫ (x² + 3x + 5)/(x + 1) dx. The degree of the numerator (2) is greater than the degree of the denominator (1), so this is an improper rational function. We must perform long division first.
2
Step 2 — Perform Long DivisionDivide x² + 3x + 5 by x + 1. First: x² ÷ x = x. Multiply: x(x + 1) = x² + x. Subtract: (x² + 3x) − (x² + x) = 2x. Next: 2x ÷ x = 2. Multiply: 2(x + 1) = 2x + 2. Subtract: (2x + 5) − (2x + 2) = 3.
(x² + 3x + 5)/(x + 1) = x + 2 + 3/(x + 1)
3
Step 3 — Integrate Each TermNow integrate term by term: ∫ x dx = x²/2. ∫ 2 dx = 2x. ∫ 3/(x + 1) dx = 3 ln|x + 1|. Each of these uses a basic antiderivative rule.
4
Step 4 — Combine and Add ConstantPutting it all together, we get the final antiderivative.
∫ (x² + 3x + 5)/(x + 1) dx = x²/2 + 2x + 3 ln|x + 1| + C
Example 2: Completing the Square Before Integrating
1
Step 1 — Identify the ProblemEvaluate ∫ 1/(x² + 4x + 13) dx. The numerator has degree 0 and the denominator has degree 2, so this is already a proper fraction. The denominator x² + 4x + 13 does not factor over the reals (its discriminant is 4² − 4(13) = 16 − 52 = −36 < 0), so we need to complete the square.
2
Step 2 — Complete the SquareTake half the coefficient of x: 4/2 = 2. Square it: 2² = 4. Rewrite: x² + 4x + 13 = (x² + 4x + 4) + 9 = (x + 2)² + 9 = (x + 2)² + 3².
x² + 4x + 13 = (x + 2)² + 3²
3
Step 3 — Match the Standard FormThe integral is now ∫ 1/((x + 2)² + 3²) dx. This matches the pattern ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C with u = x + 2 and a = 3. Since du = dx (no chain rule adjustment needed), we apply the formula directly.
4
Step 4 — Write the Final AnswerSubstituting u = x + 2 and a = 3 into the arctangent formula gives us the antiderivative.
∫ 1/(x² + 4x + 13) dx = (1/3) arctan((x + 2)/3) + C

Strengths, Limitations & When to Use Each

Comparison of the two algebraic preprocessing techniques for integration
FeatureLong DivisionCompleting the Square
When to usedeg(numerator) ≥ deg(denominator)Irreducible quadratic in denominator
Prerequisite skillPolynomial division (Algebra 2)Completing the square (Algebra 1/2)
Result formPolynomial + proper fraction(x − h)² + k² form in denominator
Leads toPower rule + ln or arctanArctan (or ln for factorable quadratics)
LimitationOnly applies to improper fractions; remainder may still need further techniquesOnly works on quadratics; if numerator has x-terms, may need u-sub first
Can be combined?Yes — do long division first, then complete the square on the remainderYes — often follows long division or precedes a u-substitution
KEY TAKEAWAY
Think of these two techniques as a one-two punch. Long division is the heavy first hit that breaks an improper fraction into manageable chunks. Completing the square is the precise follow-up that transforms a tricky quadratic denominator into a recognizable form. Together with partial fractions and u-substitution, they form a complete toolkit for integrating any rational function.

Connection to Advanced Integration Techniques

Long division and completing the square are foundational techniques that connect directly to more advanced methods you'll encounter in Calculus 2 and beyond. Understanding them now builds a bridge to partial fraction decomposition, trigonometric substitution, and even complex analysis methods for integration.

How today's techniques connect to Calculus 2 methods
This Lesson's TechniqueAdvanced ExtensionWhat Changes
Long division to simplify improper fractionsPartial fraction decompositionAfter long division, the proper remainder is further split into simpler fractions with linear or irreducible quadratic denominators
Completing the square → arctanTrigonometric substitutionInstead of using the arctan formula, you substitute x = a tan(θ) directly, which handles cases with √(x² + a²) in the numerator
Completing the square → lnIntegration by partsWhen the numerator has higher powers of x multiplied by the fraction, integration by parts combined with completing the square handles the extra complexity

The important thing to realize is that these techniques don't become obsolete as you learn more calculus. Instead, they remain as essential first steps in a longer chain of transformations. In Calculus 2, when you face ∫ (3x⁴ + 2x² − 1)/(x³ + x) dx, you'll still start with long division before applying partial fractions to the remainder. The algebra always comes first.

🔭 Looking Ahead
In Calculus 2, you'll learn partial fraction decomposition, which breaks proper fractions into sums of simpler fractions. Long division ensures the fraction is proper before you start. Completing the square often appears within partial fraction problems when you encounter irreducible quadratic factors. Mastering these algebraic tools now will save you significant time later.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why you must perform long division before integrating ∫ (x³ + 1)/(x² + 1) dx, and describe what the result of the division would look like (without doing the full computation).
PROBLEM 2BASIC CALCULATION
Evaluate ∫ (x² + 5)/(x − 2) dx by first performing polynomial long division.
PROBLEM 3INTERMEDIATE
Evaluate ∫ 1/(x² − 6x + 18) dx by completing the square.
PROBLEM 4APPLIED
A particle moves along a line with velocity v(t) = (t² + 4t + 7)/(t + 2) meters per second for t ≥ 0. Find the position function s(t) if s(0) = 0.
PROBLEM 5CRITICAL THINKING
Evaluate ∫ (x² + 2x + 3)/(x² + 2x + 5) dx. This problem requires you to combine ideas: recognize a strategic rewriting, use completing the square, and integrate. (Hint: think about what happens when the numerator and denominator have the same degree.)

Lesson Summary

When faced with integrals of rational functions, two algebraic preprocessing techniques are essential. Polynomial long division applies whenever the degree of the numerator is greater than or equal to the degree of the denominator. It splits the integrand into a polynomial quotient (integrated via the power rule) and a proper rational remainder that can be handled by other techniques.

Completing the square transforms an irreducible quadratic denominator into the form (x − h)² + k², which matches the standard arctangent integral formula: ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C. These two techniques, used separately or together, allow you to integrate a wide class of rational functions by reducing them to forms involving power rules, natural logarithms, and inverse trigonometric functions. Mastering them prepares you for partial fraction decomposition and trigonometric substitution in Calculus 2.

Varsity Tutors • Calculus 1 • Integration: Long Division & Completing Square