AP CALCULUS BC • INTEGRATION AND ACCUMULATION OF CHANGE

Integrating Functions Using Long Division and Completing the Square

Transform rational integrands into recognizable antiderivative forms through algebraic manipulation.

Historical Context & Motivation

The quest to evaluate integrals of rational functions stretches back to the earliest days of calculus. When Newton and Leibniz independently developed the fundamental framework of integration in the late seventeenth century, they quickly encountered rational expressions—quotients of polynomials—that resisted direct antidifferentiation. The challenge was clear: while basic power-rule integrals were straightforward, a rational function like ∫(x³ + 2x)/(x² + 1) dx required algebraic preprocessing before any integration rule could apply. Over the next two centuries, mathematicians systematized a collection of algebraic techniques—including polynomial long division and completing the square—that convert unwieldy integrands into standard forms whose antiderivatives are known.

1670s
Newton & Leibniz Formalize Calculus
Both Newton and Leibniz independently develop the fundamental theorem of calculus, linking differentiation and integration and motivating the search for antiderivatives of increasingly complex functions.
1702
Leibniz & Bernoulli on Rational Integration
Leibniz and Johann Bernoulli debate the integration of rational functions, leading to early versions of partial fraction decomposition and the recognition that polynomial long division is a necessary first step when the degree of the numerator meets or exceeds that of the denominator.
1768
Euler's Integral Tables
Euler publishes systematic treatments of integrals involving arctan and logarithmic forms, codifying the standard results that arise after completing the square in quadratic denominators.
1800s
Textbook Codification
Algebraic manipulation techniques—long division, completing the square, and partial fractions—become standard curricular content in calculus courses throughout European and American universities.

The central question these techniques address is deceptively simple: how do we integrate a rational function that does not match any standard form? Long division handles the case where the numerator's degree is at least as large as the denominator's, reducing the integrand to a polynomial plus a proper fraction. Completing the square handles the case where an irreducible quadratic in the denominator must be rewritten to match an arctangent or logarithmic template. Together, these two algebraic tools unlock a wide class of integrals that would otherwise seem impenetrable.

Core Principles & Definitions

Before diving into computation, it is essential to understand the structural criteria that determine which algebraic technique to apply. A rational function is any function of the form P(x)/Q(x) where P and Q are polynomials. The relationship between the degrees of P and Q dictates the strategy: if deg(P) ≥ deg(Q), perform long division first; if the denominator contains an irreducible quadratic, completing the square converts it into a form amenable to standard inverse-trigonometric or logarithmic antiderivatives.

1

Improper vs. Proper Rational Functions

A rational function P(x)/Q(x) is improper if deg(P) ≥ deg(Q) and proper if deg(P) < deg(Q). Long division converts an improper rational function into a polynomial plus a proper fraction.
2

Polynomial Long Division

Analogous to integer long division, this algorithm divides P(x) by Q(x) to produce a quotient polynomial S(x) and a remainder R(x) such that P(x)/Q(x) = S(x) + R(x)/Q(x), where deg(R) < deg(Q).
3

Completing the Square

This technique rewrites ax² + bx + c as a(x − h)² + k, converting the quadratic into a sum-of-squares form that matches the derivative templates of arctan(x) or ln|x² + a²|.
4

Standard Antiderivative Templates

∫ 1/(x² + a²) dx = (1/a) arctan(x/a) + C and ∫ x/(x² + a²) dx = (1/2) ln(x² + a²) + C. These are the target forms that completing the square enables.
5

Decision Criterion

Always check degree first. If deg(P) ≥ deg(Q), perform long division before any other technique. If the resulting proper fraction has an irreducible quadratic denominator, complete the square.
KEY TAKEAWAY
Think of long division and completing the square as the algebraic "translators" of integration. Just as an engineer converts a complex signal into component frequencies before analyzing it (Fourier decomposition), you convert a complex rational integrand into simpler pieces—polynomials, logarithmic forms, and arctangent forms—before integrating each one. Neither technique is an integration rule itself; each is a preprocessing step that makes the actual integration possible.

Visual Explanation — The Decision Flowchart

This flowchart illustrates the decision process for integrating a rational function P(x)/Q(x). Begin by comparing degrees: if the numerator's degree meets or exceeds the denominator's, long division is mandatory. After obtaining a proper fraction, check whether the denominator contains an irreducible quadratic; if so, completing the square converts it into a standard arctangent or logarithmic template.

The flowchart above encodes the essential decision logic. Notice that long division and completing the square are not mutually exclusive—a single integral may require long division followed by completing the square on the resulting proper fraction. The key is to proceed sequentially: reduce the degree first, then transform the denominator's structure. This systematic approach ensures you never waste time attempting to integrate an expression that hasn't yet been simplified into a recognizable template.

Mathematical Framework

Polynomial Long Division for Integration

Given a rational function P(x)/Q(x) with deg(P) ≥ deg(Q), polynomial long division yields a unique quotient S(x) and remainder R(x) satisfying the following identity.

LONG DIVISION IDENTITY
P(x)/Q(x) = S(x) + R(x)/Q(x), deg(R) < deg(Q)
S(x) is the quotient polynomial, R(x) is the remainder. The integral splits: ∫ P(x)/Q(x) dx = ∫ S(x) dx + ∫ R(x)/Q(x) dx. The first integral is a straightforward polynomial integral; the second is a proper rational function that may require further techniques.

Completing the Square for Integration

When the denominator of a proper fraction is an irreducible quadratic ax² + bx + c (with b² − 4ac < 0), we rewrite it in the form a(x − h)² + k, which matches the standard arctangent and logarithmic templates. The completing-the-square transformation is given below.

COMPLETING THE SQUARE
ax² + bx + c = a(x + b/(2a))² + (c − b²/(4a))
Here h = −b/(2a) and k = c − b²/(4a). The expression (x + b/(2a))² + k/a (when a = 1) directly matches the form x² + a² needed for the arctangent integral.
ARCTANGENT TEMPLATE
∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C
After completing the square, let u = x + b/(2a) so that du = dx. The resulting integral fits this template directly. This is one of the most frequently tested standard antiderivatives on the AP Calculus BC exam.
LOGARITHMIC TEMPLATE
∫ u/(u² + a²) du = (1/2) ln(u² + a²) + C
When the numerator is a linear function of u (not a constant), split it into a part matching the derivative of the denominator and a constant part. The derivative-matching part yields a logarithm; the constant part yields an arctangent.
💡 Splitting a Linear Numerator
For ∫ (Ax + B)/(u² + a²) du, write the numerator as (A/2) · d/du(u² + a²) + (B − A·something). Concretely, if you have ∫ (2x + 5)/(x² + 4) dx, rewrite as ∫ 2x/(x² + 4) dx + ∫ 5/(x² + 4) dx. The first integral yields ln(x² + 4) and the second yields (5/2) arctan(x/2) + C.

Detailed Breakdown of Each Technique

Long Division: Step-by-Step Procedure

  1. Step 1: Arrange both P(x) and Q(x) in descending powers of x, inserting zero-coefficient placeholders for any missing powers.
  2. Step 2: Divide the leading term of P(x) by the leading term of Q(x) to obtain 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 the new dividend.
  4. Step 4: Repeat until the degree of the new dividend is strictly less than deg(Q). The accumulated terms form S(x); the final dividend is R(x).
This diagram traces each step of dividing x³ + 3x² + 5x + 4 by x + 1. Each subtraction (shown in color) corresponds to one term of the quotient. The remainder 1 produces the proper fraction 1/(x + 1), whose antiderivative is ln|x + 1|.

Completing the Square: Step-by-Step Procedure

  1. Step 1: Factor the leading coefficient a from the x² and x terms: a(x² + (b/a)x) + c.
  2. Step 2: Take half the coefficient of x inside the parentheses, square it, and add and subtract it: a(x² + (b/a)x + (b/(2a))² − (b/(2a))²) + c.
  3. Step 3: Rewrite the perfect square trinomial: a(x + b/(2a))² + (c − b²/(4a)). Identify u = x + b/(2a) and k² = (c − b²/(4a))/a.
  4. Step 4: Substitute u into the integral and apply the arctangent or logarithmic template as appropriate.
Standard antiderivative forms obtained after completing the square
Integrand Form After Completing the SquareAntiderivative
∫ 1/((x − h)² + k²) dx(1/k) arctan((x − h)/k) + C
∫ (x − h)/((x − h)² + k²) dx(1/2) ln((x − h)² + k²) + C
∫ 1/√(k² − (x − h)²) dxarcsin((x − h)/k) + C

Worked Examples

Example 1: Long Division Followed by Integration

Evaluate ∫ (x³ − 2x + 4)/(x² + 1) dx
1
Step 1 — Check DegreesThe numerator has degree 3 and the denominator has degree 2. Since deg(P) = 3 ≥ deg(Q) = 2, we must perform polynomial long division first.
2
Step 2 — Perform Long DivisionDivide x³ − 2x + 4 by x² + 1. Note the missing x² term in the dividend, so write it as x³ + 0x² − 2x + 4. The leading term x³ ÷ x² = x. Multiply: x(x² + 1) = x³ + x. Subtract: (x³ + 0x² − 2x + 4) − (x³ + 0x² + x + 0) = −3x + 4. Since deg(−3x + 4) = 1 < deg(x² + 1) = 2, we stop.
(x³ − 2x + 4)/(x² + 1) = x + (−3x + 4)/(x² + 1)
3
Step 3 — Integrate the Polynomial Part∫ x dx = x²/2.
x²/2
4
Step 4 — Integrate the Proper FractionSplit ∫ (−3x + 4)/(x² + 1) dx = −3 ∫ x/(x² + 1) dx + 4 ∫ 1/(x² + 1) dx. For the first integral, note that d/dx(x² + 1) = 2x, so ∫ x/(x² + 1) dx = (1/2) ln(x² + 1). For the second integral, use the standard form ∫ 1/(x² + 1) dx = arctan(x).
−3 · (1/2) ln(x² + 1) + 4 arctan(x) = −(3/2) ln(x² + 1) + 4 arctan(x)
5
Step 5 — Combine ResultsAdd the polynomial integral and the proper fraction integral together.
∫ (x³ − 2x + 4)/(x² + 1) dx = x²/2 − (3/2) ln(x² + 1) + 4 arctan(x) + C

Example 2: Completing the Square for Integration

Evaluate ∫ 1/(x² + 6x + 13) dx
1
Step 1 — Verify Proper FractionThe numerator is 1 (degree 0) and the denominator is x² + 6x + 13 (degree 2). Since 0 < 2, this is already a proper fraction. No long division needed.
2
Step 2 — Check the DiscriminantCompute b² − 4ac = 36 − 52 = −16 < 0. The quadratic is irreducible over the reals, so we must complete the square.
3
Step 3 — Complete the Squarex² + 6x + 13 = (x² + 6x + 9) + 4 = (x + 3)² + 4 = (x + 3)² + 2².
x² + 6x + 13 = (x + 3)² + 2²
4
Step 4 — Apply the Arctangent TemplateLet u = x + 3, so du = dx. The integral becomes ∫ 1/(u² + 2²) du = (1/2) arctan(u/2) + C. Substituting back gives the result.
∫ 1/(x² + 6x + 13) dx = (1/2) arctan((x + 3)/2) + C

Strengths, Limitations & When to Use Each Technique

Comparison of the two algebraic preprocessing techniques for integration
CriterionLong DivisionCompleting the Square
When to Usedeg(P) ≥ deg(Q)Irreducible quadratic in the denominator of a proper fraction
OutputPolynomial + proper fractionExpression matching arctan or arcsin template
StrengthsMechanical, always works for improper fractions; no judgment calls requiredUnlocks inverse trig integrals; essential when partial fractions aren't applicable
LimitationsOnly reduces degree; doesn't resolve the resulting proper fraction aloneOnly applies to quadratics; higher-degree denominators require factoring first
Common ErrorsForgetting to include zero-coefficient placeholders; sign errors during subtractionArithmetic mistakes computing b²/(4a); forgetting to substitute back for x
KEY TAKEAWAY
Long division and completing the square are complementary, not competing, tools. Think of them like different surgical instruments in an operating room: long division is the scalpel that removes the "excess" polynomial tissue (the improper part), while completing the square is the precision forceps that reshape the remaining quadratic into an operable form. In a single integral you may need both—first the scalpel, then the forceps.

Connection to Partial Fractions and Advanced Techniques

Long division and completing the square serve as the gateway to a more powerful technique: partial fraction decomposition. In the AP Calculus BC curriculum, partial fractions apply exclusively to proper rational functions—which is precisely why long division is a prerequisite skill. When the denominator factors into distinct linear factors, partial fractions alone suffice; when the denominator contains irreducible quadratic factors, completing the square becomes essential during the integration of the resulting terms. Thus, the techniques covered in this lesson are not merely stand-alone tools but foundational components of the full partial-fraction integration pipeline.

How this lesson's techniques relate to partial fraction decomposition
FeatureLong Division / Completing the SquarePartial Fraction Decomposition
ScopeAlgebraic preprocessing; transforms integrand structureDecomposition of proper fractions into simpler addends
When UsedBefore decomposition; whenever degree condition or irreducible quadratic is presentAfter long division; when the denominator factors into two or more distinct factors
ResultPolynomial + proper fraction, or expression matching arctan/ln templateSum of simpler fractions: A/(x − r), (Bx + C)/(x² + bx + c), etc.
AP Exam NoteFrequently tested as an embedded step within a larger integration problemBC-only topic; often combined with these preprocessing techniques in free-response questions

Looking ahead, these same algebraic skills appear in contexts beyond rational integration. In series analysis, long division of power series produces Maclaurin expansions of rational functions. In differential equations, completing the square arises when solving second-order linear ODEs with constant coefficients via Laplace transforms. Mastering these techniques here creates transferable algebraic fluency that will serve you throughout the rest of the AP Calculus BC curriculum and into college-level mathematics.

Practice Problems

1
Which of the following is the correct first step when evaluating ∫ (x⁴ + x)/(x² − 3) dx?
2
Evaluate ∫ (x² + 3)/(x − 1) dx.
3
Evaluate ∫ 1/(x² − 4x + 8) dx.
PROBLEM 4APPLIED
A particle moves along the x-axis with velocity v(t) = (2t³ + t² − 3t + 5)/(t² + 1) meters per second for t ≥ 0. (a) Perform polynomial long division to rewrite v(t) as the sum of a polynomial and a proper rational function. (2 points) (b) Find the position function x(t) given that x(0) = 0. Express your answer in exact form. (3 points)
PROBLEM 5CRITICAL THINKING
Evaluate ∫ (x² + 2x + 3)/(x² + 2x + 5) dx. Your solution must clearly indicate where long division and completing the square are each used.

Lesson Summary

When faced with an integral of a rational function P(x)/Q(x), the first diagnostic question is always about degree comparison: if deg(P) ≥ deg(Q), apply polynomial long division to express the integrand as S(x) + R(x)/Q(x) with deg(R) < deg(Q). The polynomial part S(x) integrates immediately via the power rule. For the proper fraction R(x)/Q(x), examine the denominator: if it contains an irreducible quadratic (negative discriminant), apply completing the square to rewrite it in the form (x − h)² + k², which directly matches the arctangent template ∫ 1/(u² + a²) du = (1/a) arctan(u/a) + C or the logarithmic template when the numerator contains the derivative of the denominator.

These two techniques are not standalone integration methods but rather algebraic preprocessing steps that convert integrands into recognizable forms. They are foundational to the broader technique of partial fraction decomposition tested on the AP Calculus BC exam. Remember the decision flowchart: check degrees first (long division if needed), then inspect the denominator's factorization (completing the square for irreducible quadratics). Mastery of these skills ensures you can integrate any rational function systematically.

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