AP CALCULUS AB • INTEGRATION AND ACCUMULATION OF CHANGE

Integrating Functions Using Long Division and Completing the Square

Transform stubborn rational integrals into standard forms you already know how to evaluate.

Historical Context & Motivation

Integration is often described as the inverse of differentiation, but in practice the two operations are far from symmetric. While differentiation follows straightforward, mechanical rules—product rule, chain rule, quotient rule—integration frequently demands algebraic ingenuity before any antidifferentiation can begin. Historically, mathematicians recognized that rational functions (ratios of polynomials) are among the most common integrands in science and engineering, yet many of them resist direct application of basic integration formulas. The challenge of evaluating these integrals drove the development of powerful algebraic preprocessing techniques, including polynomial long division and completing the square.

~250 CE
Diophantus & Rational Expressions
The Greek mathematician Diophantus manipulated rational algebraic expressions in his Arithmetica, laying groundwork for the algebra of polynomial fractions.
~825 CE
Al-Khwārizmī & Completing the Square
Persian mathematician Al-Khwārizmī systematized the method of completing the square to solve quadratic equations, a technique that would later prove indispensable in integral calculus.
1668
Mercator's Logarithmic Series
Nicolaus Mercator used long division of 1/(1 + x) to derive the power series for ln(1 + x), demonstrating that polynomial division could unlock integration results.
1690s
Leibniz & the Bernoullis Formalize Integration Techniques
Leibniz, Johann Bernoulli, and Jakob Bernoulli catalogued methods for integrating rational functions, including division and partial fractions, forming the toolkit still taught today.

The central question these techniques address is deceptively simple: How do we integrate a rational function whose numerator has degree greater than or equal to the denominator, or whose denominator is an irreducible quadratic? Neither the power rule nor the basic logarithmic or arctangent formulas apply directly in these cases. Long division and completing the square are the algebraic bridges that transform these integrals into forms we can evaluate with confidence.

Core Principles & Definitions

Before diving into computation, it is essential to understand why these algebraic techniques are necessary and when each one applies. Both methods rest on a single strategic idea: rewrite the integrand so that every resulting term matches a known antiderivative formula. The key is recognizing which transformation to apply based on the structure of the rational expression.

1

Proper vs. Improper Rational Functions

A rational function P(x)/Q(x) is proper if deg(P) < deg(Q) and improper if deg(P) ≥ deg(Q). Improper fractions require long division before integration.
2

Polynomial Long Division

Divides the numerator by the denominator to produce a polynomial quotient plus a proper remainder fraction. This separates the integrand into easily integrable pieces.
3

Completing the Square

Rewrites a quadratic expression ax² + bx + c in the form a(x − h)² + k, enabling the use of arctangent or natural logarithm integration formulas when the denominator is an irreducible quadratic.
4

Target Antiderivative Forms

The goal is to produce integrands matching ∫xⁿ dx, ∫1/u du = ln|u|, or ∫1/(u² + a²) du = (1/a) arctan(u/a). Recognizing these targets guides the algebra.
KEY TAKEAWAY
Think of long division and completing the square as translation tools. Just as an engineer might convert a signal from one representation (time domain) to another (frequency domain) to make analysis tractable, these algebraic methods translate a stubborn integrand into a language your antiderivative formulas can understand. Long division handles the case when the fraction is 'top-heavy' (improper), while completing the square handles the case when the denominator is an irreducible quadratic that doesn't factor nicely.

Visual Explanation

Decision Flowchart: Which Technique to Apply

Start at the top: check whether the rational function is improper. If yes, perform long division first. Then, for any remaining proper fraction with an irreducible quadratic denominator, complete the square to produce an arctangent or logarithmic integral.

The flowchart above captures the essential decision logic. When you encounter an integral of the form ∫P(x)/Q(x) dx, your first diagnostic question is always about degree: if the numerator's degree meets or exceeds the denominator's, polynomial long division is mandatory. After division, or if the fraction is already proper, examine the denominator. A factorable denominator often leads to partial fractions (a topic for another lesson), but an irreducible quadratic denominator calls for completing the square to reveal an arctangent or logarithmic antiderivative.

Mathematical Framework

Technique 1: Polynomial Long Division for Integration

When deg(P) ≥ deg(Q), we divide P(x) by Q(x) to obtain a polynomial quotient S(x) and a remainder R(x) with deg(R) < deg(Q). This decomposition is analogous to writing 7/3 as 2 + 1/3 in arithmetic—separating the 'whole' part from the fractional part.

LONG DIVISION DECOMPOSITION
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 R(x)/Q(x) is a proper fraction.
INTEGRATION AFTER DIVISION
∫ P(x)/Q(x) dx = ∫ S(x) dx + ∫ R(x)/Q(x) dx
The first integral is evaluated term by term using the power rule. The second integral, now a proper fraction, may yield to basic formulas, u-substitution, or completing the square.

Technique 2: Completing the Square for Integration

When the denominator is a quadratic expression that does not factor over the reals (its discriminant b² − 4ac < 0), completing the square transforms it into a sum-of-squares form. This is critical because the standard arctangent antiderivative formula requires the integrand to have the shape 1/(u² + a²).

COMPLETING THE SQUARE
ax² + bx + c = a[(x + b/(2a))² + (c/a − b²/(4a²))]
Often written as a(x − h)² + k, where h = −b/(2a) and k = c − b²/(4a). The expression inside the brackets becomes a shifted perfect square plus a constant.
ARCTANGENT INTEGRAL FORMULA
∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C
This formula is the payoff of completing the square. After the algebraic transformation, u represents the shifted variable (x − h) and a² is the constant k/a from the completed-square form.
📝 AP Exam Tip
On the AP Calculus AB exam, completing the square problems almost always lead to an arctangent answer. If you see an irreducible quadratic in the denominator and a constant in the numerator, completing the square is virtually guaranteed to be the intended approach. Watch for distractors that try to tempt you into a natural logarithm form—ln results require the numerator to be the derivative of the denominator.

Detailed Breakdown of Each Technique

Long Division: Step-by-Step Procedure

  1. Step 1: Confirm that deg(P) ≥ deg(Q). If the fraction is already proper, skip to completing the square or another technique.
  2. Step 2: Divide the leading term of P(x) by the leading term of Q(x) to get the first term of the quotient S(x).
  3. Step 3: Multiply Q(x) by this term and subtract from P(x). The result is a new, lower-degree polynomial.
  4. Step 4: Repeat Steps 2–3 with the new polynomial until the remainder has degree strictly less than deg(Q).
  5. Step 5: Write the original fraction as S(x) + R(x)/Q(x) and integrate each piece separately.
The left panel shows the geometric motivation for completing the square: the expression x² + 6x needs an additional 9 (a 3 × 3 square) to form a perfect square (x + 3)². Since the original constant is 13, we have 13 − 9 = 4 left over, giving (x + 3)² + 4. The right panel shows the resulting perfect square and the immediate integration payoff.

Completing the Square: Step-by-Step Procedure

  1. Step 1: If a ≠ 1, factor a from the x² and x terms: a(x² + (b/a)x) + c.
  2. Step 2: Take half the coefficient of x, square it: (b/(2a))².
  3. Step 3: Add and subtract this value inside the parentheses, then group the perfect square trinomial.
  4. Step 4: Write the result as a(x + b/(2a))² + (c − b²/(4a)). Identify u = x + b/(2a) and a² = (c − b²/(4a))/a for the arctangent formula.

Worked Examples

Example 1: Long Division then Integration

Evaluate ∫ (x³ + 2x² + 3x + 5)/(x² + 1) dx
1
Step 1 — Check DegreesThe numerator has degree 3 and the denominator has degree 2. Since 3 ≥ 2, the rational function is improper, so we must perform polynomial long division first.
2
Step 2 — Perform Long DivisionDivide x³ + 2x² + 3x + 5 by x² + 1. First, x³ ÷ x² = x. Multiply: x(x² + 1) = x³ + x. Subtract: (x³ + 2x² + 3x + 5) − (x³ + x) = 2x² + 2x + 5. Next, 2x² ÷ x² = 2. Multiply: 2(x² + 1) = 2x² + 2. Subtract: (2x² + 2x + 5) − (2x² + 2) = 2x + 3. Since deg(2x + 3) = 1 < 2 = deg(x² + 1), we stop.
(x³ + 2x² + 3x + 5)/(x² + 1) = x + 2 + (2x + 3)/(x² + 1)
3
Step 3 — Split the Integral∫ (x³ + 2x² + 3x + 5)/(x² + 1) dx = ∫ (x + 2) dx + ∫ (2x + 3)/(x² + 1) dx. The first integral is straightforward. For the second, split the fraction: ∫ 2x/(x² + 1) dx + ∫ 3/(x² + 1) dx.
4
Step 4 — Evaluate Each Piece∫ (x + 2) dx = x²/2 + 2x. For ∫ 2x/(x² + 1) dx, use u-substitution with u = x² + 1, du = 2x dx, yielding ln|x² + 1| = ln(x² + 1) (since x² + 1 > 0). For ∫ 3/(x² + 1) dx, this matches the arctangent formula directly: 3 arctan(x).
5
Step 5 — CombineCombine all parts and append the constant of integration.
x²/2 + 2x + ln(x² + 1) + 3 arctan(x) + C

Example 2: Completing the Square then Integration

Evaluate ∫ 1/(x² + 4x + 13) dx
1
Step 1 — Check for IrreducibilityThe discriminant is b² − 4ac = 16 − 52 = −36 < 0. Since the discriminant is negative, x² + 4x + 13 does not factor over the reals and is an irreducible quadratic. We need to complete the square.
2
Step 2 — Complete the SquareTake half the coefficient of x: 4/2 = 2. Square it: 2² = 4. Write x² + 4x + 13 = (x² + 4x + 4) + 9 = (x + 2)² + 9. Equivalently, (x + 2)² + 3².
x² + 4x + 13 = (x + 2)² + 3²
3
Step 3 — Apply the Arctangent FormulaWith u = x + 2 and a = 3, we apply ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C.
4
Step 4 — Write the Final AnswerSubstitute back u = x + 2 and a = 3.
(1/3) arctan((x + 2)/3) + C

Comparing the Two Techniques

Although long division and completing the square both serve as algebraic preprocessing steps, they address fundamentally different structural issues in the integrand. Understanding when to use each—and when you might need both in sequence—is essential for efficient problem solving on the AP exam.

Side-by-side comparison of long division and completing the square integration techniques
FeaturePolynomial Long DivisionCompleting the Square
When to usedeg(numerator) ≥ deg(denominator)Denominator is an irreducible quadratic
What it producesPolynomial + proper fractionSum-of-squares form (x − h)² + k
Target antiderivativePower rule (for quotient), then other rules for remainderArctangent: (1/a) arctan(u/a) + C
Common errorsSign errors during subtraction; forgetting to integrate the remainderDropping the constant; incorrect identification of u and a
AP exam frequencyModerate — appears in both MCQ and FRQModerate — often a single step within a larger FRQ
KEY TAKEAWAY
These two techniques are not competing strategies—they are complementary tools that often appear in the same problem. Long division is always the first step when the fraction is improper, and completing the square may then be needed on the proper remainder. Think of it like preparing ingredients before cooking: long division chops the problem down to size, and completing the square seasons the remaining piece into a recognizable form.

Connection to Partial Fractions & BC Topics

Long division and completing the square are foundational techniques that connect naturally to more advanced integration methods. In AP Calculus BC and college-level integral calculus, these tools become the first steps in the broader method of partial fraction decomposition. After performing long division to make a fraction proper, partial fractions further decomposes the remainder into simpler pieces—linear factors yield logarithmic integrals, while irreducible quadratic factors require completing the square to produce arctangent integrals. The techniques you have learned in this lesson are therefore not isolated tricks but permanent entries in your integration toolkit.

How AB-level techniques extend into BC and beyond
This Lesson (AB)Extension (BC / College)
Long division to reduce improper fractionsLong division as the mandatory first step before partial fraction decomposition
Completing the square for 1/(ax² + bx + c)Completing the square for irreducible quadratic factors within partial fractions
Result: arctan and ln antiderivativesExtended: also inverse hyperbolic functions and improper integrals with these forms
Constant numerators over irreducible quadraticsLinear (Ax + B) numerators over irreducible quadratics, requiring splitting into ln and arctan parts

Understanding long division and completing the square thoroughly now will pay dividends if you continue to BC or multivariable calculus. These algebraic manipulations also appear when evaluating Laplace transforms in engineering and when computing residues in complex analysis—further evidence that the preprocessing mindset you develop here is a durable mathematical habit.

Practice Problems

1
Which of the following integrals requires polynomial long division as a first step before it can be evaluated using standard antiderivative formulas?
2
Evaluate ∫ (x² + 1)/(x − 2) dx.
3
Evaluate ∫ 1/(x² − 6x + 18) dx.
PROBLEM 4APPLIED
A chemical reaction's rate of change of concentration C(t) satisfies dC/dt = (2t² + t − 3)/(t² + 1) for t ≥ 0, with C(0) = 5. (a) Use polynomial long division to rewrite the integrand. (b) Find C(t). (c) What is C(2)? Express your answer in exact form.
PROBLEM 5CRITICAL THINKING
Consider the integral ∫ (x² + 2x + 3)/(x² + 2x + 5) dx. (a) Explain why long division is needed even though the numerator and denominator have the same degree. (b) Perform the long division and rewrite the integrand. (c) Evaluate the integral completely, using completing the square where necessary.

Lesson Summary

Integrating rational functions often requires algebraic preprocessing before any antiderivative formula can be applied. When the rational function is improper (the numerator's degree is greater than or equal to the denominator's degree), polynomial long division decomposes it into a polynomial quotient plus a proper remainder fraction. The polynomial quotient integrates easily via the power rule, while the remainder may require further techniques.

When a proper fraction has an irreducible quadratic denominator (one whose discriminant is negative), completing the square rewrites the denominator in the form (x − h)² + a², enabling direct application of the arctangent integration formula: ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C. Together, these two algebraic techniques transform a wide class of otherwise intractable integrands into standard forms, and they serve as essential building blocks for the method of partial fraction decomposition encountered in AP Calculus BC and beyond.

Varsity Tutors • AP Calculus AB • Integrating Functions Using Long Division and Completing the Square