Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Prerequisites:
Intro to Sage
Symbolic Integration
Partial Fractions
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.
Example 1
Here is an example of computing a partial fraction decomposition in Sage:
Example 2
Find the antiderivative of .
First, we'll integrate with Sage, then we'll find the partial fraction decomposition and integrate term by term.
Note: We would normally write this as follows:
(notice the absolute values and the ).
Now let's try partial fractions:
So
This means
Non-repeated Linear Factors
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
Example 3
Find
Again, we'll use Sage to compute the integral directly, and then we'll compare the partial fraction approach.
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.
Repeated Linear Factors
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 , .
Example 4
Find .
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.
Example 5
Find .
So our integral is .
Non-repeated Irreducible Quadratics
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!
Example 6
Find .
Note: the quadratics in the denominator are irreducible.
Our answer involves three terms: two natural logs and one arctan. Let's use partial fractions to see where these come from.
Integrating the first term gives the arctan and one log:
Integrating the second terms gives the other log:
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?
Repeated Irreducible Quadratics
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
Example 7
Find .
This last integral can be computed using trig substitution. I'll spare you the gory details.
What if the degree of the denominator is not greater than the degree of the numerator?
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.
Example 8
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.