This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Symbolic Integration

Partial fraction decomposition is a tool to help us integrate rational functions (quotients of polynomials). It allows us to "decompose" a complicated rational function into a sum of simpler rational functions.

It is the reverse of fraction addition. For example, consider this addition:

Partial fraction decomposition undoes the addition.

So if you wanted to find the antiderivative of , you could find the antiderivatives of and and add them together.

Of course, in terms of practice, it is silly to use the computer to do partial fraction decomposition in order to integrate, since the computer can already integrate the original rational function. So the goal of this lab is to explore the different kinds of decompositions and the kind of antiderivatives you get out of the process.

Here is an example of computing a partial fraction decomposition in Sage:

-1/(x + 3) + 1/(x + 1)

Find the antiderivative of .

First, we'll integrate with Sage, then we'll find the partial fraction decomposition and integrate term by term.

3/2*log(x + 3) - 1/2*log(x + 1)

Note: We would normally write this as follows:

(notice the absolute values and the ).

Now let's try partial fractions:

3/2/(x + 3) - 1/2/(x + 1)

So

This means

3/2*log(x + 3)
-1/2*log(x + 1)

In general, a rational function whose denominator has distinct linear factors will decompose similar to the last example.

Suppose is a rational function which may be written as

where is a polynomial of degree less than and all the are distinct (note: is the degree of the denominator).

Then there exists constants (i.e., real numbers) such that:

Then

Find

Again, we'll use Sage to compute the integral directly, and then we'll compare the partial fraction approach.

9/4*log(x + 3) - log(x + 2) + 3/4*log(x - 1)

9/4/(x + 3) - 1/(x + 2) + 3/4/(x - 1)

9/4*log(x + 3)
-log(x + 2)
3/4*log(x - 1)

So

Note: To perform the partial fraction decomposition by hand, you have to first factor the denominator (another example where finding roots of polynomials is important), and then you set up a system of equations to solve for the constants (the ). I'll leave the details to your lecture professor. It's a lot of work, but it's the only way to deal with rational functions by hand.

Let's start with a rational function with only one root with multiplicity greater than 1.

Suppose a rational function may be written

where is a polynomial of degree less than (the degree of the denominator).

Then there exist constants such that

Integrating each of these terms is fairly simple.

Recall, , and for , .

Find .

-1/2*(4*x - 5)/(x^2 - 2*x + 1) + log(x - 1)

1/(x - 1) + 2/(x - 1)^2 - 1/(x - 1)^3

Our answers look different, but they are the same. In the first integral, Sage has combined the rational pieces into one. In the partial fraction approach we can see the two rational pieces separately. In other words,

Here's an example with more than one repeated linear factor.

Find .

1/375*(6*x^3 - 39*x^2 + 47*x - 77)/(x^4 - 7*x^3 + 9*x^2 + 27*x - 54) - 2/625*log(x + 2) + 2/625*log(x - 3)

-2/625/(x + 2) + 2/625/(x - 3) - 1/125/(x + 2)^2 - 1/125/(x - 3)^2 + 1/5/(x - 3)^4

So our integral is .

We know that some polyomials do not have real roots. Such polynomials cannot be factored into (real) linear factors. However, any polynomial can be factored into linear factors and irreducible quadratic factors (in this context, irreducible means these quadratic functions have no real roots - you may recall that such functions have two complex roots, which are complex conjugates).

We now consider partial fraction decomposition for rational functions that have irreducible quadratic factors in the denominator.

Suppose is a rational function which may be written

where all the quadratics factors in the denominator are distinct, and the degree of is less than (the degree of the denominator).

Then there exist constants and such that

Integrating this is usually a pain. If you're lucky, some of these terms may be fairly simple substitution problems (when the numerator is a constant multiple of the derivative of the denominator). When you integrate, your answer involves a natural logarithm (ln).

If you're not so lucky, then you have to do some algebra, including completing the square. After integrating, the result may involve a natural logarithm and/or an inverse tangent (arctan).

If that sounds bad, that's because it is!

Find .

Note: the quadratics in the denominator are irreducible.

-4/7*sqrt(7)*arctan(1/7*sqrt(7)*(2*x + 1)) + log(x^2 + x + 2) + 1/2*log(x^2 + 1)

Our answer involves three terms: two natural logs and one arctan. Let's use partial fractions to see where these come from.

(2*x - 1)/(x^2 + x + 2) + x/(x^2 + 1)

Integrating the first term gives the arctan and one log:

-4/7*sqrt(7)*arctan(1/7*sqrt(7)*(2*x + 1)) + log(x^2 + x + 2)

Integrating the second terms gives the other log:

1/2*log(x^2 + 1)

The last piece is a simple substitution. Let . Then , so

(Note: is positive, so you don't need the absolute value.)

The first piece is more complicated (as you can see by the result).

Notice, if you tried to substitute , then you get , which is not what you have in the numerator. But we can force it into the numerator and then adjust by adding another term:

When you integrate the first term, you get .

The second term is where the arctan comes from, but the algebra is messy. First, you complete the square in the denominator.

Now you have to factor out of the denominator.

Now substitute to get

Aren't you glad to have Sage?

If the irreducible quadratic factors are repeated, you get something similar to what happened with the repeated linear factors.

Suppose is a rational function which may be written

where the quadratic is irreducible, and the degree of is less than (the degree of the denominator).

Then there exist constants and such that

Find .

1/2*(2*x + 1)/(x^2 + 1) + arctan(x) + 1/2*log(x^2 + 1)

x/(x^2 + 1) - (x - 2)/(x^2 + 1)^2

1/2*log(x^2 + 1)

1/2*(2*x + 1)/(x^2 + 1) + arctan(x)

This last integral can be computed using trig substitution. I'll spare you the gory details.

We have only considered examples where the degree of the numerator is less than the degree of the denominator. If this is not the case, then you must first use long division of polynomials to rewrite your rational function as a polynomial plus a new rational function for which the degree of the numerator is smaller.

In general, if and the degree of degree of , then there exist polynomials and , with degree of < degree of , such that

Integrating is easy (it's a polynomial), and integrating is accomplished as above.

Find .

First, we divide to find that

Thus,

There is a command in Sage to find the quotient and remainder from polynomial long division, but it's somewhat cumbersome to use. Fortunately, we don't have to worry about this, since the partial_fraction command will deal with this situation with no problems.

x^2 + 2*x + 11/(x - 2) + 5

1/3*x^3 + x^2 + 5*x
11*log(x - 2)