AP® Calculus BC · Unit 6 · Topic 6.10

Integrating Functions Using Long Division and Completing the Square

When a rational function has a numerator of equal or higher degree than its denominator, divide first; when a quadratic denominator won't factor, complete the square to reveal an arctangent integral. Both tricks rewrite the integrand into a shape you already know how to integrate.

A rational function like (x2+3x)/(x+1) is called top-heavy because the numerator's degree is at least as large as the denominator's. You cannot integrate that directly — there is no clean rule for it — but polynomial long division rewrites it as a polynomial plus a proper fraction, something like x+2-2/(x+1). Each piece now matches a rule you already know: power rule for the polynomial part, natural log for the leftover fraction. The division is not a trick on top of integration, it is what makes integration possible at all.

Completing the square handles the other hard case: a denominator like x2+6x+13 that does not factor nicely and is not a simple sum of squares. Completing the square rewrites it as (x+3)2+4, a shifted sum of squares, matching the pattern 1/((x-h)2+R2). That pattern integrates to (1/R)atan((x-h)/R)+C, so once the denominator is in that form the integral falls out directly. The whole point of completing the square here is purely cosmetic: it does not change the function, it just repackages the denominator into a shape the arctangent rule recognizes.

Both techniques sit at the end of the integration-methods unit because they are really algebra moves in service of integration, not new calculus rules. They often show up right before or alongside partial fractions, since all three methods exist to break an unfriendly rational function into pieces that power rule, log rule, or arctangent rule can finish. Recognizing which repackaging a denominator needs — factorable, irreducible quadratic, or top-heavy — is the real skill here.

Key terms

Top-heavy rational function
A fraction whose numerator has degree greater than or equal to the denominator's degree.
Long division
Dividing polynomials to rewrite a top-heavy fraction as a polynomial plus a proper remainder fraction.
Completing the square
Rewriting a quadratic as (x-h)2+k to expose a perfect-square-plus-constant structure.
Arctangent integral form
The rule that 1/((x-h)2+R2) dx integrates to (1/R)atan((x-h)/R)+C.

Watch it explained

  1. How it worksHow does completing the square turn a messy quadratic into an arctangent shape?
  2. Worked exampleFind the integral of (x2 + 3x)/(x + 1) dx using long division.
  3. Worked exampleFind the integral of 1/(x2 + 6x + 13) dx by completing the square.
  4. Common mistakeWhy isn't the integral of 1/(x2 + 9) just the natural log of the denominator?

Check yourself

Your turn1 of 2
Find F(x), the antiderivative of f(x) = (x2 + 2x)/(x + 5), satisfying F(0) = 0, using long division.

End of topic.