Skip to content
Marlbridge

AP® Calculus AB · Unit 6 · Topic 6.10

Integrating Functions Using Long Division and Completing the Square: Study Guide (Calculus AB 6.10)

Learn when to rewrite an integrand first: long division for top-heavy rational functions, and completing the square to reach arctan and arcsin forms.

Course scope. This topic is shared by Calculus AB and Calculus BC. Everything here is examinable for both.

A note on notation

This page has no equation renderer, so integrals are written in a compact form. ∫ f(x) dx is an indefinite integral (add + C). ∫ (a to b) f(x) dx is the definite integral from x = a to x = b. [F(x)] (a to b) means F(b) − F(a). arctan and arcsin are the inverse tangent and inverse sine; you may also see them written tan⁻¹ and sin⁻¹.

Why rewrite before integrating?

Some integrands match no basic rule and no obvious substitution as written. Try ∫ (x² + 3x + 1)/(x + 1) dx. Let u = x + 1? Then du = dx, but you are left with (x² + 3x + 1)/u, which still needs work. There is no product or chain-rule pattern to undo.

The fix is to write the same function in a different form that does match the rules you know. Two algebra tools do most of the work:

What you see First step What you get
Rational function, degree of top ≥ degree of bottom Long division Polynomial + (remainder)/(divisor)
1/(quadratic) where the quadratic has no real roots Complete the square an arctan form
1/√(quadratic) with a negative x² term Complete the square an arcsin form
(linear)/(quadratic with no real roots) Split the numerator, then complete the square a ln term plus an arctan term

The rewriting is pure algebra. It changes how the function looks, not its values, so it changes nothing about the integral.

Where AB stops. If the denominator factors into distinct linear factors, such as x² − 4 = (x − 2)(x + 2), the tool you need is partial fractions. That is a BC-only topic (6.12). In this topic, after division the denominator is usually linear or a quadratic with no real roots. (A perfect square such as (x + 1)² is fine too: ∫ dx/(x + 1)² is a power-rule substitution.)

Tool 1: long division

When the top’s degree is at least the bottom’s, divide, exactly as with numbers. 17/5 = 3 + 2/5, and in the same way:

(x² + 3x + 1)/(x + 1) = x + 2 − 1/(x + 1)

The division, step by step:

  1. x² ÷ x = x. Multiply: x(x + 1) = x² + x. Subtract: (x² + 3x + 1) − (x² + x) = 2x + 1.
  2. 2x ÷ x = 2. Multiply: 2(x + 1) = 2x + 2. Subtract: (2x + 1) − (2x + 2) = −1.
  3. Quotient x + 2, remainder −1. So the fraction equals x + 2 + (−1)/(x + 1).

Check by multiplying back: (x + 2)(x + 1) − 1 = x² + 3x + 2 − 1 = x² + 3x + 1. Correct.

Now each piece is easy: x and 2 are powers, and ∫ 1/(x + 1) dx = ln|x + 1| + C. The graph below shows what the division means.

The curve y = (x² + 3x + 1)/(x + 1) below the line y = x + 2 for x from 0 to 2 The solid curve y = (x² + 3x + 1)/(x + 1) rises from (0, 1) to (2, 11/3). The dashed straight line y = x + 2 rises from (0, 2) to (2, 4) and lies above the curve the whole way. The region under the curve from x = 0 to x = 2 is shaded with diagonal hatching and labelled area 6 − ln 3. The unshaded strip between the curve and the line is labelled gap 1/(x + 1), area ln 3. The gap is 1 unit tall at x = 0 and 1/3 of a unit tall at x = 2. 00.511.52x 1234y dashed: y = x + 2 solid: y = (x² + 3x + 1)/(x + 1) gap = 1/(x + 1), area ln 3 area = 6 − ln 3 ≈ 4.90
Figure 1. Long division splits the curve into a straight line minus a small gap. The area under the dashed line y = x + 2 from 0 to 2 is a trapezoid, (2 + 4)/2 × 2 = 6. The gap between line and curve has height 1/(x + 1), and its area is ln 3. So the hatched area under the curve is 6 − ln 3. Axes are unitless.

Two quick cases. When the degrees are equal, the quotient is a constant: (x² + 2)/(x² + 1) = 1 + 1/(x² + 1). When the top is a simple shift of the bottom, you can “add and subtract” instead of dividing: x/(x + 1) = (x + 1 − 1)/(x + 1) = 1 − 1/(x + 1).

Tool 2: completing the square

The target forms are two results you can derive from Topic 6.8 with a substitution (Topic 6.9). For a constant a > 0:

Arctan form. ∫ du/(a² + u²) = (1/a) arctan(u/a) + C

Arcsin form. ∫ du/√(a² − u²) = arcsin(u/a) + C

Where the 1/a comes from. In ∫ du/(a² + u²), take a² out of the bottom: (1/a²) ∫ du/(1 + (u/a)²). Let w = u/a, so du = a dw. This gives (1/a²) · a ∫ dw/(1 + w²) = (1/a) arctan w + C. In the arcsin form, the factor a from du cancels the a from the square root, so no 1/a appears.

To reach these forms, complete the square:

x² + bx + c = (x + b/2)² + (c − b²/4)

  • x² + 6x + 13 = (x + 3)² + 4, so a = 2 and u = x + 3. Then ∫ dx/(x² + 6x + 13) = (1/2) arctan((x + 3)/2) + C.
  • 6x − x² = −(x² − 6x) = −((x − 3)² − 9) = 9 − (x − 3)², so a = 3 and u = x − 3. Then ∫ dx/√(6x − x²) = arcsin((x − 3)/3) + C.

When does arctan apply? Only if the quadratic has no real roots (discriminant b² − 4ac < 0). Then the constant left after completing the square is positive, and you get a sum of squares. x² − 4 has discriminant 16 > 0, so it is a difference of squares, and arctan does not apply.

Worked example 1: long division in a definite integral

Question. Evaluate ∫ (0 to 2) (x² + 3x + 1)/(x + 1) dx exactly.

  1. Compare degrees. Top degree 2, bottom degree 1. Divide first.
  2. Divide (shown above): the integrand equals x + 2 − 1/(x + 1).
  3. Integrate each term: an antiderivative is x²/2 + 2x − ln|x + 1|. On [0, 2], x + 1 > 0, so write ln(x + 1).
  4. Evaluate. At x = 2: 2 + 4 − ln 3 = 6 − ln 3. At x = 0: 0 + 0 − ln 1 = 0.
  5. Answer: 6 − ln 3, about 4.90.

Check with the picture. Figure 1 gives the same answer: trapezoid area 6 minus gap area ln 3. The curve runs from height 1 to height 11/3 over a width of 2, so the area must lie between 2 and about 7.3. The answer fits.

Worked example 2: completing the square to reach arctan

Question. Evaluate ∫ (1 to 3) 1/(x² − 2x + 5) dx exactly.

  1. Compare degrees. Top degree 0, bottom degree 2. No division needed.
  2. Check for real roots. Discriminant (−2)² − 4(5) = −16 < 0. No real roots, so aim for arctan.
  3. Complete the square: x² − 2x + 5 = (x − 1)² + 4. So a = 2, and let u = x − 1, with du = dx.
  4. Change the limits: x = 1 gives u = 0; x = 3 gives u = 2.
  5. Integrate: ∫ (0 to 2) du/(4 + u²) = [(1/2) arctan(u/2)] (0 to 2) = (1/2)(arctan 1 − arctan 0).
  6. Evaluate: arctan 1 = π/4 and arctan 0 = 0, so the answer is (1/2)(π/4) = π/8, about 0.393.

Check. The integrand falls from 1/4 at x = 1 to 1/8 at x = 3, over a width of 2. So the area lies between 2 × 1/8 = 0.25 and 2 × 1/4 = 0.5. The answer 0.393 fits.

Worked example 3: splitting the numerator

Question. Find ∫ (x + 4)/(x² + 4x + 8) dx.

  1. Compare degrees. Top degree 1, bottom degree 2. No division.
  2. Look at the derivative of the bottom: d/dx (x² + 4x + 8) = 2x + 4.
  3. Split the top into a multiple of 2x + 4 plus a constant: x + 4 = (1/2)(2x + 4) + 2.
  4. Write two integrals: (1/2) ∫ (2x + 4)/(x² + 4x + 8) dx + 2 ∫ 1/(x² + 4x + 8) dx
  5. First integral: derivative over function (u = x² + 4x + 8), so it gives (1/2) ln(x² + 4x + 8). The quadratic is always positive (discriminant 16 − 32 < 0), so no absolute value is needed.
  6. Second integral: complete the square: x² + 4x + 8 = (x + 2)² + 4, so a = 2. It gives 2 · (1/2) arctan((x + 2)/2) = arctan((x + 2)/2).
  7. Answer: ∫ (x + 4)/(x² + 4x + 8) dx = (1/2) ln(x² + 4x + 8) + arctan((x + 2)/2) + C

Check. Differentiate: (1/2)(2x + 4)/(x² + 4x + 8) + (1/2)/(1 + (x + 2)²/4). The second term equals 2/(4 + (x + 2)²) = 2/(x² + 4x + 8). Adding gives (x + 2 + 2)/(x² + 4x + 8) = (x + 4)/(x² + 4x + 8). Correct.

Common misconceptions

  • Integrating top and bottom separately. ∫ p(x)/q(x) dx is not (∫ p dx)/(∫ q dx). Rewrite first.
  • Forgetting the remainder. After dividing, the remainder term is usually where the ln comes from. Dropping it loses part of the answer.
  • Completing the square when the top is too big. If the top’s degree is at least the bottom’s, divide first.
  • Writing ln of the quadratic for 1/(quadratic). ∫ 1/(x² + 6x + 13) dx is not ln(x² + 6x + 13). That would need 2x + 6 on top.
  • Using 1/a² or a² instead of 1/a and a. From (x − 1)² + 4, a = 2, not 4.
  • Sign slips in completing the square. x² − 2x + 5 = (x − 1)² + 4, not (x + 1)² + 4. Expand your square to check.
  • Forcing arctan onto a quadratic that factors. 1/(x² − 4) is not an arctan form. It needs partial fractions, which is BC-only.

Where this leads

Topic 6.14, Selecting Techniques for Antidifferentiation, asks you to choose between basic rules, substitution and the rearrangements on this page. BC students add integration by parts and partial fractions before that. Rewritten integrands come up again in Unit 7 (separable differential equations) and Unit 8 (areas and volumes). Students in either course can return to the Calculus AB roadmap or the Calculus BC roadmap.

Try the practice questions now, then use the revision notes and the checklist to consolidate.

Quick questions

Is this page for Calculus AB or Calculus BC?

Both. Topic 6.10 is common content, so the same page serves AB and BC students. BC students later add partial fractions (Topic 6.12) for denominators that factor into linear factors.

How do I know whether to divide or to complete the square?

Compare degrees first. If the top has degree at least that of the bottom, divide. If the top has lower degree and the bottom is a quadratic that does not factor, complete the square.

What if the quadratic in the denominator factors, like x² − 4?

Then completing the square does not lead to arctan, because you get a difference, not a sum. Integrals like ∫ 1/(x² − 4) dx need partial fractions, which is a BC-only topic (6.12).

AP® and Advanced Placement® are trademarks registered by the College Board, which is not affiliated with, and does not endorse, this website. Marlbridge is an independent tuition provider. It is not an authorized AP course provider, an AP school or an exam centre, and these resources are not official College Board materials. Reading them or doing simulations does not meet the laboratory requirement of an AP science course.