CALCULUS 2 • INTEGRATION FOUNDATIONS

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

Transform intractable rational and quadratic integrands into standard forms amenable to direct antidifferentiation.

Historical Context & Motivation

The problem of computing antiderivatives has occupied mathematicians since the earliest days of calculus. When Isaac Newton and Gottfried Wilhelm Leibniz independently formalized integral calculus in the late seventeenth century, they recognized that many integrands do not present themselves in a form that matches a known differentiation rule. The task of rewriting an integrand—algebraically massaging it until a standard antiderivative formula applies—became a central concern of the discipline. Two algebraic techniques, polynomial long division and completing the square, trace their roots to antiquity and the Islamic Golden Age, respectively, yet they remain indispensable preprocessing steps in modern integration.

c. 825
Al-Khwārizmī's Al-jabr
Muhammad ibn Mūsā al-Khwārizmī systematically introduces the technique of completing the square to solve quadratic equations, establishing an algebraic tradition that would later serve integral calculus.
1665–1676
Newton & Leibniz Develop Calculus
Newton's method of fluxions and Leibniz's differential and integral notation formalize the relationship between derivatives and antiderivatives, creating a need for systematic integration techniques.
1768
Euler's Integral Tables
Leonhard Euler publishes extensive integral tables in his Institutiones Calculi Integralis, cataloguing standard forms and demonstrating how algebraic manipulation—including long division—reduces complex integrands to tabulated entries.
1800s
Systematic Integration Methods
Mathematicians such as Ostrogradsky and Hermite refine partial-fraction decomposition and related techniques, all of which rely on polynomial long division as a prerequisite step when the rational integrand is improper.

Despite centuries of theoretical advancement, the core challenge persists: most functions we encounter in applications—especially rational functions with polynomial numerator degree equal to or exceeding the denominator degree, or expressions involving irreducible quadratics—are not directly integrable by inspection. The question that motivates this lesson is therefore practical: How do we systematically rewrite an integrand so that it matches a form whose antiderivative we already know? Long division and completing the square are two of the most powerful answers.

Core Principles & Definitions

Both techniques in this lesson serve the same strategic role: they are algebraic preprocessing steps that convert an integrand into a sum of terms, each of which matches a standard antiderivative formula. Neither technique is itself an integration rule; rather, they prepare the way for rules you already know—the power rule, the natural logarithm form, and the arctangent form, among others.

1

Improper vs. Proper Rational Functions

A rational function P(x)/Q(x) is improper when deg(P) ≥ deg(Q). Long division converts an improper fraction into a polynomial plus a proper fraction, the latter having deg(numerator) < deg(denominator).
2

Polynomial Long Division

Divide the numerator by the denominator just as you would with integers. The result is a quotient polynomial plus a remainder over the original divisor: P(x)/Q(x) = S(x) + R(x)/Q(x), where deg(R) < deg(Q).
3

Completing the Square

Rewrite a quadratic expression ax² + bx + c in the form a(x − h)² + k. This transforms the denominator into a pattern matching the standard arctangent or arcsine integral forms.
4

Standard Integral Forms

The key target forms are ∫ dx/(x² + a²) = (1/a) arctan(x/a) + C and ∫ dx/√(a² − x²) = arcsin(x/a) + C. Completing the square maps quadratic denominators onto these templates.
5

Synergy of the Two Techniques

In complex integrals, you may first apply long division to separate the polynomial part, then complete the square in the resulting proper fraction's denominator. The techniques are complementary, not competing.
KEY TAKEAWAY
Think of these techniques as translation tools. Long division is like converting a foreign sentence into a language you speak: the meaning hasn't changed, but now you can understand it. Completing the square is like reformatting a file into a compatible format—the data is identical, but now your software (i.e., your antiderivative formulas) can process it. Neither creates new mathematics; both reveal structure that was already present.

Visual Explanation — Long Division Flow

The following diagram illustrates the decision process and algebraic flow when encountering a rational integrand. Starting from the raw integral, you first assess the degrees of numerator and denominator. If the function is improper, polynomial long division decomposes it. If the remaining denominator contains an irreducible quadratic, completing the square transforms it into a standard form.

The flowchart shows the decision tree: check degree first (long division if improper), then examine the denominator structure (complete the square if an irreducible quadratic is present).

Notice how the two techniques occupy different stages of the pipeline. Long division acts first, handling the global structure of the rational function by separating the polynomial part from the proper fractional part. Completing the square then acts locally on the denominator of whatever proper fraction remains, reshaping it to match a standard integral template. This sequential relationship means you should always consider long division before completing the square when both might apply.

Mathematical Framework

Long Division for Integration

Given a rational function P(x)/Q(x) where deg(P) ≥ deg(Q), the division algorithm for polynomials guarantees the existence of unique polynomials S(x) (the quotient) and R(x) (the remainder) such that the following decomposition holds.

LONG DIVISION DECOMPOSITION
P(x)/Q(x) = S(x) + R(x)/Q(x), where deg(R) < deg(Q)
P(x) = numerator polynomial, Q(x) = denominator polynomial, S(x) = quotient polynomial (directly integrable via power rule), R(x)/Q(x) = proper fraction amenable to further techniques.

Because S(x) is a polynomial, its antiderivative is immediate. The remaining proper fraction R(x)/Q(x) may then be integrated via partial fractions, logarithmic forms, or—after completing the square—inverse trigonometric forms.

Completing the Square for Integration

When the denominator of a proper fraction is an irreducible quadratic ax² + bx + c (i.e., b² − 4ac < 0), completing the square rewrites it as a sum of a squared linear term and a constant. This matches the integrands for the arctangent and related inverse trigonometric families.

COMPLETING THE SQUARE
ax² + bx + c = a(x + b/(2a))² + (c − b²/(4a))
Set u = x + b/(2a) and k² = (c − b²/(4a))/a, so the expression becomes a(u² + k²). The substitution u = x + b/(2a) is a simple shift with du = dx.
STANDARD ARCTANGENT INTEGRAL
∫ dx/(u² + k²) = (1/k) arctan(u/k) + C
This is the primary target form. After completing the square and substituting, most integrals involving irreducible quadratic denominators reduce to this template or a minor variant.
LOGARITHMIC COMPANION FORM
∫ u du/(u² + k²) = (1/2) ln|u² + k²| + C
When the numerator is a constant multiple of the derivative of the denominator, the integral is logarithmic. Often you must split the numerator into a part proportional to 2u (yielding ln) and a constant part (yielding arctan).

Detailed Breakdown of the Two Techniques

Polynomial Long Division — Step by Step

Polynomial long division mirrors arithmetic long division. You divide the leading term of the numerator by the leading term of the denominator, multiply the entire denominator by that quotient term, subtract from the numerator, and repeat until the remainder has degree strictly less than the denominator. The following diagram walks through the division of (x³ + 2x² − x + 3) by (x + 1).

The six-step long division yields quotient x² + x − 2 with remainder 5. Each step divides the current leading term of the remainder by x, the leading term of the divisor.

Completing the Square — Algebraic Detail

Consider the quadratic x² + 6x + 13 in a denominator. The discriminant is 6² − 4(1)(13) = 36 − 52 = −16 < 0, confirming the quadratic is irreducible over the reals. To complete the square, take half the coefficient of x (which is 3), square it (9), and add and subtract that value: x² + 6x + 9 + 4 = (x + 3)² + 4. The integral ∫ dx/(x² + 6x + 13) becomes ∫ dx/((x + 3)² + 4), which with the substitution u = x + 3 yields (1/2) arctan((x + 3)/2) + C.

💡 When to Split the Numerator
If the numerator of a proper fraction over an irreducible quadratic is linear (e.g., (2x + 5)/(x² + 6x + 13)), split it into a part proportional to the derivative of the denominator (which yields a logarithm) and a constant part (which yields an arctangent). Write 2x + 5 = 1·(2x + 6) − 1, so the integral becomes ∫(2x + 6)/(x² + 6x + 13) dx − ∫ dx/(x² + 6x + 13), the first being ln|x² + 6x + 13| and the second being the arctangent form.

Worked Examples

Example 1: Long Division then Integration

Evaluate ∫ (x³ − 3x² + 5x − 1)/(x − 2) dx
1
Step 1 — Identify Improper FractionThe numerator has degree 3 and the denominator has degree 1. Since 3 ≥ 1, this is an improper rational function. We must perform polynomial long division before integrating.
2
Step 2 — Perform Long DivisionDivide x³ − 3x² + 5x − 1 by x − 2. Leading term x³ ÷ x = x². Multiply: x²(x − 2) = x³ − 2x². Subtract: (x³ − 3x² + 5x − 1) − (x³ − 2x²) = −x² + 5x − 1. Next: −x² ÷ x = −x. Multiply: −x(x − 2) = −x² + 2x. Subtract: (−x² + 5x − 1) − (−x² + 2x) = 3x − 1. Next: 3x ÷ x = 3. Multiply: 3(x − 2) = 3x − 6. Subtract: (3x − 1) − (3x − 6) = 5.
(x³ − 3x² + 5x − 1)/(x − 2) = x² − x + 3 + 5/(x − 2)
3
Step 3 — Integrate Term by Term∫ [x² − x + 3 + 5/(x − 2)] dx = ∫ x² dx − ∫ x dx + ∫ 3 dx + 5 ∫ 1/(x − 2) dx. Apply the power rule to each polynomial term and the logarithmic form to the last term.
= x³/3 − x²/2 + 3x + 5 ln|x − 2| + C

Example 2: Completing the Square then Integration

Evaluate ∫ dx/(x² + 4x + 13)
1
Step 1 — Verify Proper Fraction & IrreducibilityThe numerator has degree 0 and the denominator has degree 2, so the fraction is already proper—no long division is needed. The discriminant is 4² − 4(1)(13) = 16 − 52 = −36 < 0, confirming the denominator is irreducible.
2
Step 2 — Complete the SquareTake x² + 4x + 13. Half the coefficient of x is 2; squaring gives 4. Write x² + 4x + 4 + 9 = (x + 2)² + 9 = (x + 2)² + 3².
x² + 4x + 13 = (x + 2)² + 3²
3
Step 3 — Substitute and Apply Arctangent FormulaLet u = x + 2, so du = dx. The integral becomes ∫ du/(u² + 3²). By the standard arctangent formula with k = 3, we obtain (1/3) arctan(u/3) + C.
∫ dx/(x² + 4x + 13) = (1/3) arctan((x + 2)/3) + C

Example 3: Combined — Long Division then Completing the Square

Evaluate ∫ (x² + 3)/(x² + 2x + 5) dx
1
Step 1 — Check DegreesBoth numerator and denominator have degree 2, so deg(P) = deg(Q). The fraction is improper (deg(P) ≥ deg(Q)), and long division is required.
2
Step 2 — Long DivisionDivide x² + 3 by x² + 2x + 5. Leading term x² ÷ x² = 1. Multiply: 1·(x² + 2x + 5) = x² + 2x + 5. Subtract: (x² + 3) − (x² + 2x + 5) = −2x − 2.
(x² + 3)/(x² + 2x + 5) = 1 + (−2x − 2)/(x² + 2x + 5)
3
Step 3 — Complete the Square in the Denominatorx² + 2x + 5 = (x + 1)² + 4 = (x + 1)² + 2². The discriminant 4 − 20 = −16 < 0 confirms irreducibility.
x² + 2x + 5 = (x + 1)² + 2²
4
Step 4 — Split the Numerator and IntegrateWrite −2x − 2 = −1·(2x + 2). Note that 2x + 2 is exactly the derivative of x² + 2x + 5 (up to a constant—actually d/dx(x² + 2x + 5) = 2x + 2, a perfect match). So ∫ (−2x − 2)/(x² + 2x + 5) dx = −∫ (2x + 2)/(x² + 2x + 5) dx = −ln|x² + 2x + 5| + C₁. The full integral is therefore:
∫ (x² + 3)/(x² + 2x + 5) dx = x − ln(x² + 2x + 5) + C

Strengths, Limitations & When to Use Each

Comparison of long division and completing the square as integration tools
CriterionLong DivisionCompleting the Square
When Requireddeg(numerator) ≥ deg(denominator)Irreducible quadratic in denominator
OutputPolynomial + proper fractionSum-of-squares form: (x − h)² + k²
Target Integral FormsPower rule, ln|x − a|, further partial fractions(1/k) arctan(u/k), arcsin, logarithmic forms
StrengthsPurely mechanical; always reduces degree; prerequisite for partial fractionsHandles integrands no other elementary method can; pairs with trig substitution
LimitationsDoes not help with proper fractions; result may still need further processingOnly applies to quadratic expressions; requires careful algebra to avoid sign errors
Common ErrorForgetting to subtract correctly (sign errors in intermediate steps)Dropping the constant term after adding/subtracting the square
KEY TAKEAWAY
Within the broader integration toolkit, long division and completing the square sit at the algebraic-manipulation layer—they precede the actual antidifferentiation step. They are analogous to preprocessing in data science: just as raw data must be cleaned and reshaped before a machine-learning model can train on it, raw integrands must be algebraically restructured before an antiderivative formula can be applied. Recognizing which preprocessing step a given integrand requires is itself a skill that improves with deliberate practice.

Connection to Advanced Techniques

Long division and completing the square are often gateway steps to more sophisticated integration methods. Understanding where they fit in the larger ecosystem helps you develop strategic fluency—knowing not just how to execute a technique, but when and why to deploy it.

Foundation TechniqueLeads IntoHow They Connect
Long DivisionPartial Fraction DecompositionLong division is a mandatory first step; partial fractions only apply to proper fractions.
Completing the SquareTrigonometric SubstitutionAfter completing the square yields u² + a² or a² − u², a trig substitution (u = a tan θ or u = a sin θ) finishes the integral.
Completing the SquareIntegration involving √(ax² + bx + c)Radicals of quadratics require completing the square to identify the appropriate trig or hyperbolic substitution.
Both TechniquesLaplace Transforms (Diff. Eq.)Inverse Laplace transforms of rational functions in s require partial fractions (hence long division) and completing the square to match transform table entries.

In courses beyond Calculus 2, you will encounter these techniques repeatedly—in real and complex analysis, in solving ordinary and partial differential equations, and in applied fields such as signal processing and control theory. Mastering them now builds algebraic fluency that pays compounding returns throughout your mathematical career.

Practice Problems

PROBLEM 1CONCEPTUAL
Explain why polynomial long division must be performed before partial fraction decomposition when integrating an improper rational function. What would go wrong if you skipped the division step?
PROBLEM 2BASIC CALCULATION
Evaluate ∫ (x² + 1)/(x − 1) dx using polynomial long division.
PROBLEM 3INTERMEDIATE
Evaluate ∫ (3x + 7)/(x² + 2x + 10) dx by completing the square and appropriately splitting the numerator.
PROBLEM 4APPLIED
In circuit analysis, the charge on a capacitor in a series RLC circuit can involve integrals of the form ∫ dt/(t² + 4t + 8). Evaluate this integral and express your answer in a form suitable for determining the charge as a function of time.
PROBLEM 5CRITICAL THINKING
Evaluate ∫ (2x³ + x² + 4)/(x² + x + 2) dx. This problem requires both long division and completing the square. After integrating, verify your result by differentiating.

Lesson Summary

This lesson covered two essential algebraic preprocessing techniques for integration. Polynomial long division converts improper rational functions (where deg(P) ≥ deg(Q)) into the sum of a directly integrable quotient polynomial and a proper fraction that may be processed further via partial fractions, logarithmic forms, or other methods.

Completing the square transforms an irreducible quadratic denominator ax² + bx + c into the form a(x − h)² + k², enabling the application of the standard arctangent integral (1/k) arctan(u/k) + C. When the numerator is linear, a numerator-splitting strategy separates the integrand into a logarithmic part and an arctangent part. Together, these techniques form the algebraic foundation upon which partial fractions, trigonometric substitution, and many applied methods in differential equations and engineering analysis are built.

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