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.

A smooth function curve with a function symbol and rising tangent trend.
Inside this lesson 10 sections 5 questions 9 figures

SECTION 1

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.

SECTION 2

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.

SECTION 3

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.

Integration Decision Flowchart for Rational Functions∫ P(x)/Q(x) dxdeg(P) ≥ deg(Q)?NOYESPerformLong DivisionPolynomial +Proper Fractionremainder goes backProper FractionQuadratic indenominator?NOYESComplete theSquareUse arctan or lnStandard Integral ✓Other techniques(partial fractions, u-sub)Evaluate Integral
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.

SECTION 4

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)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∫ 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

ax2+bx+c=a(x+b/(2a))2+(c−b2/(4a))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/(u2+a2)du=(1/a)arctan(u/a)+C∫ 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∫ 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.

SECTION 5

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.

Polynomial Long Division: (x³ + 2x² − x + 3) ÷ (x + 1)Step-by-step process:STEP 1: Divide leading termsx³ ÷ x = x²← first term of quotientSTEP 2: Multiply and subtractx²(x + 1) = x³ + x²(x³ + 2x²) − (x³ + x²) = x²← new leading termSTEP 3: Repeat — divide x² ÷ x = xx(x + 1) = x² + x(x² − x) − (x² + x) = −2xSTEP 4: Repeat — divide −2x ÷ x = −2−2(x + 1) = −2x − 2(−2x + 3) − (−2x − 2) = 5← remainderResult: x² + x − 2 + 5/(x + 1)
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.

SECTION 6

Worked Examples

Example 1: Long Division Before Integrating

  1. 1

    Step 1 — Identify the Problem

    Evaluate ∫ (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. 2

    Step 2 — Perform Long Division

    Divide 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. 3

    Step 3 — Integrate Each Term

    Now 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. 4

    Step 4 — Combine and Add Constant

    Putting 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. 1

    Step 1 — Identify the Problem

    Evaluate ∫ 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. 2

    Step 2 — Complete the Square

    Take 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. 3

    Step 3 — Match the Standard Form

    The 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. 4

    Step 4 — Write the Final Answer

    Substituting 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

SECTION 7

Strengths, Limitations & When to Use Each

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

Comparison of the two algebraic preprocessing techniques for integration

✦

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.

SECTION 8

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.

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

How today's techniques connect to Calculus 2 methods

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.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

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).
Show answer
Long division is required because the degree of the numerator (3) is greater than the degree of the denominator (2), making this an improper rational function. You cannot directly apply the arctangent formula or any other standard integration pattern to an improper fraction. After performing long division, the result would have the form S(x) + R(x)/(x² + 1), where S(x) is a polynomial of degree 1 (since 3 − 2 = 1), and R(x) is a polynomial of degree less than 2. This means the quotient is a linear function like ax + b, and the remainder fraction is a proper fraction that you can integrate using known formulas.

Question 2: BASIC CALCULATION

Evaluate ∫ (x² + 5)/(x − 2) dx by first performing polynomial long division.
Show answer
Dividing x² + 5 by x − 2: x² ÷ x = x, then x(x − 2) = x² − 2x, subtract to get 2x + 5. Next, 2x ÷ x = 2, then 2(x − 2) = 2x − 4, subtract to get 9. So (x² + 5)/(x − 2) = x + 2 + 9/(x − 2). Now integrate each term: ∫ x dx = x²/2, ∫ 2 dx = 2x, and ∫ 9/(x − 2) dx = 9 ln|x − 2|. The final answer is x²/2 + 2x + 9 ln|x − 2| + C.

Question 3: INTERMEDIATE

Evaluate ∫ 1/(x² − 6x + 18) dx by completing the square.
Show answer
First, complete the square on x² − 6x + 18. Half of −6 is −3, and (−3)² = 9. So x² − 6x + 18 = (x² − 6x + 9) + 9 = (x − 3)² + 9 = (x − 3)² + 3². The integral becomes ∫ 1/((x − 3)² + 3²) dx. Using the standard formula ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C with u = x − 3 and a = 3, we get (1/3) arctan((x − 3)/3) + C. Since du = dx, no additional substitution adjustment is needed.

Question 4: APPLIED

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.
Show answer
The position function is s(t) = ∫ v(t) dt = ∫ (t² + 4t + 7)/(t + 2) dt. Since deg(numerator) = 2 ≥ deg(denominator) = 1, perform long division. Dividing: t² ÷ t = t, multiply t(t + 2) = t² + 2t, subtract to get 2t + 7. Then 2t ÷ t = 2, multiply 2(t + 2) = 2t + 4, subtract to get 3. So v(t) = t + 2 + 3/(t + 2). Integrating: s(t) = t²/2 + 2t + 3 ln|t + 2| + C. Applying s(0) = 0: 0 = 0 + 0 + 3 ln(2) + C, so C = −3 ln(2). The position function is s(t) = t²/2 + 2t + 3 ln((t + 2)/2).

Question 5: CRITICAL 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.)
Show answer
Since the degrees are equal, perform long division (or recognize the shortcut). Dividing x² + 2x + 3 by x² + 2x + 5: the leading terms give quotient 1, and (x² + 2x + 3) − 1·(x² + 2x + 5) = −2. So the integrand equals 1 − 2/(x² + 2x + 5). Now complete the square on x² + 2x + 5: half of 2 is 1, and 1² = 1, so x² + 2x + 5 = (x + 1)² + 4 = (x + 1)² + 2². Integrate each piece: ∫ 1 dx = x, and ∫ 2/((x+1)² + 2²) dx = 2 · (1/2) arctan((x+1)/2) = arctan((x+1)/2). Combining: the final answer is x − arctan((x + 1)/2) + C. This problem elegantly demonstrates how both techniques work together in a single integral.

SUMMARY

Lesson Summary

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