### Integrals of Rational Functions

Scott R. Fulton

### 1 Overview

A rational function has the form

r(x) = p(x) q(x) where p and q are polynomials. For example,

f (x) = x^{2}− 3
x^{4}+ 3,
g(t) = t^{6}+ 4t^{2}− 3

7t^{5}+ 3t ,
and

h(s) = 5

s^{3}− 4s^{2}+ 3s − 8

are all rational functions. A rational function is called proper if the degree of the numerator is less than the degree of the denominator, and improper otherwise. Thus, f and h are proper rational functions, while g is an improper rational function.

Indefinite integrals (antiderivatives) of rational functions can always be found by the following steps:

1. Polynomial Division: Divide the denominator into the numerator (if needed) to write the integrand as a polynomial plus a proper rational function.

2. Partial Fraction Expansion: Expand the proper rational function using partial frac- tions.

3. Completing the Square: If any terms involve quadratics, eliminate the linear term if needed by completing the square.

4. Term by Term Integration: Use elementary integral formulas and substitution.

Before detailing this general approach, we will first look at some simple cases where ordinary substitution works easily. Then we will look at each of the above steps in turn, and finally put them together to find integrals of rational functions.

Note: While this handout is concerned primarily with integrating rational functions, many of the techniques discussed here are useful in other contexts. In particular, partial fraction expansions are used extensively in solving differential equations by Laplace transform methods.

### 2 Substitution

In some special cases, integrals (antiderivatives) of rational functions can be found by simple substitutions. The easiest case is when the numerator is the derivative of the denominator (or differs by a multiplicative constant).

Example 1: Find

Z 1

x − 2dx.

Solution: Here we use the substitution

w = x − 2, from which we compute

dw = dx.

Making this substitution then gives

Z 1

x − 2dx =

Z 1

wdw = ln |w| + C = ln |x − 2| + C.

Example 2: Find

Z r^{2}− 2r
r^{3}− 3r^{2}+ 1 dr.

Solution: Here we notice that the numerator is the derivative of the denominator (to within a constant factor). Therefore, we substitute for the denominator

w = r^{3}− 3r^{2} + 1,
which implies

dw = (3r^{2}− 6r)dr = 3(r^{2}− 2r)dr.

Making this substitution gives

Z r^{2}− 2r

r^{3}− 3r^{2}+ 1dr =

Z 1 w

1

3dw = 1 3

Z 1

wdw = 1

3ln |w| + C = 1

3ln |r^{3}− 3r^{2} + 1| + C.

Sometimes a substitution can be helpful even though the numerator isn’t the derivative of the denominator.

Example 3: Find

Z s + 2 s − 3ds.

Solution: Here we can substitute for the denominator, choosing w = s − 3, which implies dw = ds. Since we must convert everything to w, including the numerator, we solve for s to obtain s = w + 3 and thus s + 2 = w + 5. Making these substitutions gives

Z s + 2 s − 3ds =

Z w + 5 w dw =

Z

1 + 5 w

dw = w + 5 ln |w| + C = s − 3 + 5 ln |s − 3| + C.

### 3 Polynomial Division

When no simple substitution works for integrating a given rational function, the systematic approach is to use partial fraction expansions. Since this technique works for proper rational functions, if the integrand is an improper rational function we must first express it as a polynomial plus a proper rational function. That is, if we want to integrate p(x)/q(x) and the degree of the numerator p is not less than the degree of the denominator q, our first step is to write

p(x)

q(x) = f (x) + r(x) q(x),

where f is a polynomial and the degree of the remainder r is less than the degree of q. How do we find f and r? Long division will always work.

Example 4: Express x^{3}− 4

x^{2}− x − 2 as a polynomial plus a proper rational function.

Solution: Using long division, just like for numbers (don’t forget the zeros for the “missing”

powers of x) we find:

x+1
x^{2} − x − 2 x^{3}+0x^{2}+0x−4

−(x^{3} −x^{2}−2x)
x^{2}+2x−4

−(x^{2} −x−2)
3x−2
Thus we can write

x^{3}− 4

x^{2} − x − 2 = (x + 1) + 3x − 2
x^{2}− x − 2.

Sometimes it isn’t necessary to do the long division so formally, as long as we can arrive at the proper form.

Example 5: Express s + 2

s − 3 as a polynomial plus a proper rational function.

Solution: By adding and subtracting in the numerator we can simplify this rational function as follows:

s + 2

s − 3 = s + 2 − 5 + 5

s − 3 = (s − 3) + 5

s − 3 = 1 + 5 s − 3.

Note that if we integrate this result, we obtain s + 5 ln |s − 3| + C. Compare this with the result of Example 3: can you explain why both answers are correct?

### 4 Partial Fraction Expansion

The idea of partial fraction expansion is to take a proper rational function and express it as the sum of simpler rational functions. This is just the reverse of ordinary addition of rationals. For example, we know that

5

x − 3− 2

x + 1 = 5(x + 1) − 2(x − 3)

(x − 3)(x + 1) = 3x + 11
x^{2}− 2x − 3.

What we want to do now is turn this around: that is, start with the right-hand side of this equation (a proper rational function) and somehow split it up to obtain the left-hand side (a sum of simpler rational functions). This can be accomplished step by step as follows.

Step 1: Factor the denominator. In the simplest case, we can factor the denominator into linear (degree one) factors. For instance, for the above example we have by inspection that

x^{2}− 2x − 3 = (x − 3)(x + 1).

In cases which can’t be factored readily, we can turn to the quadratic formula (for quadrat-
ics) or other root-finding methods for higher-degree polynomials, as studied in high school
algebra. Sometimes a quadratic (degree two) factor cannot be further broken down (using
real numbers): x^{2} + 4 is such an irreducible quadratic. However, it can be shown that any
polynomial with real coefficients is a product of linear and/or irreducible quadratic factors
with real coefficients.

Step 2: Expand using undetermined coefficients A, B, C, . . . . This means writing out the rational function as a sum of terms involving the factors of the denominator.

For the example at hand, this expansion takes the form 3x + 11

(x − 3)(x + 1) = A

x − 3+ B

x + 1 (∗)

where A and B are constants which are yet to be determined. Note: the specific form of the expansion depends on what type of factors the denominator has—more on this a bit later.

Step 3: Clear fractions. Multiply both sides by the denominator so no fractions remain. For the example at hand, we multiply both sides of equation (*) by (x − 3)(x + 1) to obtain

(x − 3)(x + 1) 3x + 11

(x − 3)(x + 1) = (x − 3)(x + 1) A

(x − 3) + (x − 3)(x + 1) B (x + 1). Cancelling the common factors reduces this to

3x + 11 = (x + 1)A + (x − 3)B. (∗∗)

Step 4: Solve for the coefficients A, B, C, . . . . There are two approaches here.

The systematic approach is to gather together like powers of the variable and equate their coefficients, which gives a set of equations to solve for A, B, C, . . . . For the example at hand, we rewrite the equation (**) as

3x + 11 = (A + B)x + (A − 3B).

Since this must hold for all values of x, the coefficients of like powers of x on both sides must match. Thus, from the x terms we obtain

3 = A + B, and from the constant terms we obtain

11 = A − 3B.

Solving these equations yields A = 5 and B = −2.

An alternate (and often easier) approach here is to simply plug specific values of x into the expansion (after clearing fractions) to obtain equations for A, B, C, . . . . By choosing the x values intelligently, the resulting equations usually can be made much simpler. For the example at hand, we can plug x = 3 into equation (**) to obtain

3(3) + 11 = (3 + 1)A + (3 − 3)B,

which simplifies immediately to 20 = 4A so A = 5. Likewise, plugging x = −1 into equation (**) gives

3(−1) + 11 = (−1 + 1)A + (−1 − 3)B, which reduces to 8 = −4B so B = −2.

Step 5: Substitute A, B, C, . . . into the expansion. At this point we’re done:

since the values of the coefficients are known, the expansion is known. For the example at hand, we substitute A = 5 and B = −2 (from step 4) into equation (*) to obtain

3x + 11

(x − 3)(x + 1) = 5

x − 3 − 2 x + 1, which is the desired partial fraction expansion.

Example 6: Expand 3x − 2

x^{2}− x − 2 using partial fractions.

Solution: First, we factor the denominator:

x^{2}− x − 2 = (x − 2)(x + 1)
(by inspection). Next, we set up the partial fraction expansion:

3x − 2

x^{2}− x − 2 = 3x − 2

(x − 2)(x + 1) = A

x − 2+ B x + 1. Clearing fractions (by multiplying by the denominator) gives

3x − 2 = (x + 1)A + (x − 2)B.

To solve for the undetermined coefficients A and B we use the second of the two methods explained in step 4 above (since it is easier). Which values of x should we choose? A natural choice is x = 2, since when we plug it into the equation the B term will drop out: we get

3(2) − 2 = (2 + 1)A + (2 − 2)B,

which reduces to 4 = 3A so A = 4/3. The other natural choice is x = −1, since it will cause the A term to drop out: plugging it in gives

3(−1) − 2 = (−1 + 1)A + (−1 − 2)B,

which simplifies to −5 = −3B so B = 5/3. Substituting these values for A and B into the expansion gives

3x − 2

x^{2}− x − 2 = 4/3

x − 2+ 5/3 x + 1.

Note that we can easily check this result by combining the terms on the right-hand side.

What form should we assume for the partial fraction expansion in step 2? The correct form depends on the factors of the denominator as follows:

• For each linear factor in the denominator, use a constant divided by that factor—and another for each multiple of that factor if it is repeated.

• For each irreducible quadratic factor in the denominator, use a linear term divided by that factor—and another for each multiple of that factor if it is repeated.

Some examples of the correct forms of expansions should make this clear:

x^{2}+ 1

(x − 2)(x + 2)(x − 5) = A

x − 2 + B

x + 2 + C x − 5, s − 2

s(s + 3)^{2} = A

s + B

s + 3+ C
(s + 3)^{2},
1

(t + 1)(t^{2}+ 2) = A

t + 1 +Bt + C
t^{2}+ 2 ,
x^{2}− 4

x^{2}(x^{2}+ 1)^{2} = A
x + B

x^{2} +Cx + D

x^{2}+ 1 + Ex + F
(x^{2}+ 1)^{2}.

r^{3}

(r − 7)^{3}(r^{2} + 5r + 7)^{2} = A

r − 7 + B

(r − 7)^{2} + C

(r − 7)^{3} + Dr + E

r^{2}+ 5r + 7 + F r + G
(r^{2}+ 5r + 7)^{2}.
Note that:

• The rational functions on the left-hand side are all proper: if they were not, we must first divide out the denominator as explained in section 3.

• Some of the coefficients A, B, C, . . . might turn out to be zero, but we cannot assume that from the start.

### 5 Completing the Square

In dealing with quadratic factors, it is often useful to rewrite them in a form which does not explicitly involve a linear (x) term. To illustrate this process of completing the square, consider the polynomial

x^{2} − 6x + 8.

Take the coefficient of x, divide it by two, and square it to get (−6/2)^{2} = 3^{2} = 9. Add and
subtract this number and factor the result to get

x^{2}− 6x + (9 − 9) + 8 = (x^{2}− 6x + 9) − 1 = (x − 3)^{2}− 1.

Thus, we have rewritten the original quadratic in a form which lacks a linear term.

If the coefficient of the x^{2} term isn’t 1, we must factor it out before starting. The following
two examples show how to do this.

Example 7: Complete the square for 21 − 4s − s^{2}.

Solution: We start by factoring out the coefficient −1 of s^{2}, and then add and subtract
(4/2)^{2} = 4:

21 − 4s − s^{2} = (−1)(s^{2}+ 4s − 21)

= (−1)(s^{2}+ 4s + 4 − 4 − 21)

= (−1)[(s + 2)^{2}− 25]

= 5^{2}− (s + 2)^{2}.

Example 8: Complete the square for 5y^{2}− 10y + 9.

Solution: Again, we start by factoring out the coefficient 5 of y^{2}; this time it doesn’t factor
out of the constant term nicely, so we’ll leave the constant term hanging (but be careful to
add and subtract in the same place—inside the parentheses):

5y^{2}− 10y + 9 = 5(y^{2}− 2y) + 9

= 5(y^{2}− 2y + 1 − 1) + 9

= 5[(y − 1)^{2}− 1] + 9

= 5(y − 1)^{2}+ 4.

### 6 Term by Term Integration

In the previous sections we have described how to write any rational function as the sum of a polynomial and a partial fraction expansion. To find the integral in this form, we can integrate term by term. The integral of a polynomial is easy, and the integral of a proper rational function with a linear denominator is easy, too:

Z 1

x + adx = ln |x + a| + C

(by substitution, as discussed in section 2). For integrals with quadratics in the denominator, the main tool is the formula

Z 1

x^{2}+ a^{2} dx = 1

aarctan

x a

+ C, which comes from the basic integration formula

Z 1

1 + w^{2} dw = arctan(w) + C using the
substitution w = x/a. If the quadratic involves a linear term, we can first eliminate it by
completing the square.

Example 9: Find

Z 1

4x^{2} − 4x + 5dx.

Solution: The denominator is an irreducible quadratic (try the quadratic formula—there are no real roots). Thus, we cannot further break down the integrand using partial fractions.

To convert it to a form we can integrate, we first complete the square. Factoring out the
coefficient of x^{2} and adding and subtracting (−1/2)^{2} = 1/4 gives

4x^{2}− 4x + 5 = 4(x^{2}− x) + 5

= 4(x^{2}− x + ^{1}_{4} −^{1}_{4}) + 5

= 4[(x − ^{1}_{2})^{2}− ^{1}_{4}] + 5

= 4(x − ^{1}_{2}) + 4.

We can then do the integral using the substitution w = x − ^{1}_{2}:

Z 1

4x^{2}− 4x + 5dx =

Z 1

4(x − ^{1}_{2})^{2}+ 4dx

= 1 4

Z 1

(x −^{1}_{2})^{2}+ 1dx

= 1 4

Z 1

w^{2}+ 1dw

= 1

4arctan(w) + C

= 1

4arctan(x −^{1}_{2}) + C.

If the denominator is quadratic and the numerator is linear, adding and subtracting a constant in the numerator will yield two pieces which can be integrated as described above.

The key here is to construct a linear term in the numerator which is the derivative of the denominator (up to a constant factor).

Example 10: Express 2s + 1

s^{2}+ 3s + 7 as two terms which can be integrated by methods already
considered.

Solution: Since the derivative of the denominator is 2s + 3, we add and subtract 2 in the numerator to obtain

2s + 1

s^{2}+ 3s + 7 = 2s + 1 + 2 − 2

s^{2}+ 3s + 7 = 2s + 3

s^{2}+ 3s + 7 − 2
s^{2}+ 3s + 7.

The first of these terms is easily integrated by the substitution w = s^{2}+ 3s + 7; the second
can be integrated by completing the square and using the formula involving arctan.

### 7 Putting It All Together

Having discussed each of the steps separately, now it’s time to put them together to integrate rational functions. For our first example, we simply collect the pieces we worked out in detail in several previous examples.

Example 11: Find

Z x^{3}− 4
x^{2}− x − 2dx.

Solution: Since the integrand is an improper rational function, we first divide the denomi- nator into the numerator to obtain

x^{3}− 4

x^{2} − x − 2 = (x + 1) + 3x − 2
x^{2}− x − 2.

Next, we expand the remaining (proper) rational function using partial fractions:

x^{3}− 4

x^{2}− x − 2 = (x + 1) + 4/3

x − 2+ 5/3 x + 1. Finally, we integrate term by term:

Z x^{3}− 4

x^{2}− x − 2dx =

Z

(x + 1) dx +

Z 4/3 x − 2dx +

Z 5/3 x + 1 dx

= 1

2x^{2} + x + 4

3ln |x − 2| + 5

3ln |x + 1| + C.

Example 12: Find

Z x^{2}

(x − 1)^{2}(x + 1)dx.

Solution: Here the integrand is a proper rational function and the denominator is already factored, so our first step is to find the partial fraction expansion. This must take the form

x^{2}

(x − 1)^{2}(x + 1) = A

x − 1 + B

(x − 1)^{2} + C
x + 1.

Note that since the factor (x − 1)^{2} appears with multiplicity 2, we must include two corre-
sponding terms in the expansion (the terms involving A and B). Clearing fractions (multi-
plying by the denominator) gives

x^{2} = (x − 1)(x + 1)A + (x + 1)B + (x − 1)^{2}C.

To find A, B, and C we plug in specific values of x: using x = 1 leads to 1 = 2B so B = 1/2, and using x = −1 leads to 1 = 4C so C = 1/4. To find A we could use any other value of x;

perhaps the easiest one to work with is x = 0, which leads to the equation 0 = −A + B + C.

Plugging in the values B = 1/2 and C = 1/4 we already found leads to A = 3/4. Substituting these into the partial fraction expansion gives

x^{2}

(x − 1)^{2}(x + 1) = 3/4

x − 1 + 1/2

(x − 1)^{2} + 1/4
x + 1.
Finally, we integrate term by term:

Z x^{2}

(x − 1)^{2}(x + 1)dx = 3

4ln(x − 1) − 1

2(x − 1) + 1

4ln(x + 1) + C (for the middle integral we used the substitution w = x − 1).

### 8 Problems

Find the integrals in problems 1–4:

1.

Z x^{2}

3x^{3}+ 7dx 2.

Z x + 1
x^{2}+ 2x + 3dx
3.

Z t − 5

t + 2dt 4.

Z 2r + 1 r − 1 dr

In problems 5–8, express the rational function as the sum of a polynomial and a proper rational function.

5. x^{2}+ 5

x^{2}− 4 6. s^{2}− 7

s^{2}+ 1
7. r^{3}+ 1

r^{2}− 2r 8. x^{4}+ 2x

x^{2}− 4

In problems 9–20, give the correct form of the partial fraction expansion for the rational function. Do not evaluate the undetermined coefficients A, B, C, . . . .

9. 2

x^{2}− 4 10. 3x − 1

x^{2}+ 4

11. 4y

y^{2}− 6y + 9 12. 7

t^{2}+ 4t − 5
13. x + 4

(x^{2}− 9)(x + 3) 14. 3y^{2}

(y^{2}− 25)(y + 1)

15. 16

(2s + 1)^{3}(s + 5) 16. x + 2

x^{2}(x − 3)^{2}

17. r − 7

(3r^{2}+ 1)(r − 1)^{2} 18. 5t + 2

(4t^{2}− 1)(4t^{2}+ 1)
19. x^{4}+ 3

x(x^{2}+ 2)^{2}(6x^{2}− x) 20. s^{3}+ 2s − 3

s^{2}(s^{2}− 16)(s + 4)(s^{2}+ 4)

Expand each rational function in problems 21–24 using partial fractions.

21. 1

x^{2}− 4x + 3 22. 1

t^{2}− t − 6

23. 1

s(s^{2}+ 1) 24. 2x + 1

(x − 1)(x^{2}+ x + 1)

Rewrite each polynomial in problems 25–30 by completing the square.

25. x^{2}− 8x + 7 26. r^{2}+ 6r + 10

27. 2t^{2}− 8t + 13 28. 3y^{2}+ 18y + 20

29. 9s^{2}− 6s + 2 30. 3x^{2}+ 2x

Find the integrals in problems 31–36:

31.

Z x^{2}

(x − 1)^{2}(x + 1)dx 32.

Z x

x^{2}+ 2x − 3dx
33.

Z 2s

s^{2}− 2s + 5ds 34.

Z 2t

t^{2}+ 2t + 10dt
35.

Z x^{3}− 5x + 7

x^{2}+ x − 6 dx 36.

Z x^{3}− 11x − 26
x^{2}− 2x − 8 dx

### 9 Answers to Odd-Numbered Problems

1. 1

9ln |3x^{3}+ 7| + C
3. t − 7 ln |t + 2| + C
5. 1 + 9

x^{2}− 4
7. r + 2 + 4r + 1

r^{2}− 2r
9. A

x − 2 + B x + 2 11. A

y − 3 + B
(y − 3)^{2}
13. A

x − 3+ B

x + 3 + C
(x + 3)^{2}
15. A

2s + 1 + B

(2s + 1)^{2} + C

(2s + 1)^{3} + D
s + 5
17. Ar + B

3r^{2}+ 1 + C

r − 1 + D
(r − 1)^{2}
19. A

x + B

x^{2} + Cx + D

x^{2}+ 2 + Ex + F

(x^{2}+ 2)^{2} + G
6x − 1
21. 1/2

x − 3− 1/2 x − 1 23. 1

s − s
s^{2}+ 1
25. (x − 4)^{2}− 9
27. 2(t − 2)^{2}+ 5
29. 9

s − 1 3

2

+ 1 31. − 1

2(x − 1) +3

4ln |x − 1| + 1

4ln |x + 1| + C
33. ln |s^{2}− 2s + 5| + arctan

s − 1 2

+ C 35. 1

2x^{2}− x + ln |x − 2| + ln |x + 3| + C