`> `
**restart;**

`> `

**Partial Fractions**

**Partial Fraction Decomposition and Integration**

*Partial fraction decomposition *
is a very useful method of rewriting rational functions in simpler terms. Partial fraction decomposition is used to integrate rational functions, but it also has other important applications that you will see later. Among others, partial fractions are used in engineering for finding inverse Laplace transforms. Let's look at the following example:

`> `
**Int(1/(x^2-4),x); value(%);**

`> `

How did Maple find the integral? Exactly the same way that you could find it by hand: by partial fraction decomposition of the rational function . Namely:

.

How can such a decomposition be found?

**Example 1**
. Find, by hand, the partial fraction decomposition of
.

If the numerator of a given rational function is of a lower degree than its denominator, you start your work by factoring the denominator. (Otherwise, as in Example 5 below, you perform the long division first.) The denominator of the above function factors to . According to an important theorem in algebra, this means that the rational function can be decomposed into the following simpler terms

for some constants A, B. To find these constants we use the method of
*undetermined coefficients*
. If the above equality is to hold then it must be that:

.

Since the denominators on both sides are the same, the numerators also must be the same. Hence

.

Rearranging the terms in the left hand side we obtain

.

We know that two polynomials are equal if and only if coefficients at the corresponding powers of x are equal. Hence, we obtain the following equations for A and B

,

which gives us . Thus

.

We have obtained the partial fraction decomposition, which, of course allows us to find easily the integral of .

It is important to know what kind of partial fraction decomposition to expect for a given rational function. The key is to factor the denominator. Then the general rules are as follows. If the factored denominator contains a first degree term of mulitiplicity 1, this term gives rise to a single partial fraction for some constant A, as in Example 1. If the denominator contains a term of multiplicity k, this term gives rise to possibly k partial fractions

, , ..., ,

for some constants , ,... . If the factored denominator contains an irreducible quadratic term , that is, a quadratic term which does not have real roots, that term gives rise to a fraction

for some constants
*B, C. *
If the factored denominator contains an irreducible quadratic factor
of multiplicity k, that term gives rise to possibly k fractions of the form

, , ..., .

*An important theorem in algebra *
says that every polynomial with real coefficients can be factored into first degree polynomials and irreducible quadratic polynomials with real coefficients. Furthermore, any rational function such that its denominator has the degree greater than its numerator, can be decomposed into partial fractions according to the rules stated above.

The theorem says that decomposition into partial fractions is possible. Quite another matter is finding such decomposition for a given rational function. As you can quess, the first obstacle may be factoring the denominator, which often is a difficult task. Maple can handle a variety of situations with simple commands.

The basic command for finding a partial fraction decomposition is "
convert(
*expression,*
parfrac,
*variable*
)
". For example

`> `
**convert(1/(x^2-4),parfrac,x);**

`> `

**Example 2. **
Consider the rational expression

.

Factor the denominator of w. Find the partial fraction decomposition. Find the indefinite integral of w. Compare the three.

`> `

First let's define the expression w.

`> `
**w:=(6*x^4-5*x+2)/(x^5+5*x^3+4*x^4+4*x^2+4*x);**

`> `

Now we want to factor the denominator of w. To save retyping we use the command " denom " which gives the denominator of a given expression. Similarly, the command " numer ", which we shall use later in this worksheet, gives the numerator of a given expression. This is how they act.

`> `
**numer(w);**

`> `
**denom(w);**

As you see, Maple couldn't help itself and somewhat simplifed the output. Let's factor the denominator.

`> `
**factor(denom(w));**

`> `

We see a first degree term x of multiplicity 1, a first degree term of multiplicity 2, and an irreducible quadratic term . The rules above tell us what kind of partial fraction decomposition to expect. Indeed:

`> `
**convert(w,parfrac,x);**

The decomposition has the form that we expected. Now let's look at the integral.

`> `
**Int(w,x); value(%);**

`> `

Clearly, the integral was found via partial fractions. You can see how to each fraction there corresponds a term in the integral. The last fraction gives rise to the two last terms in the integral. They were obtained by splitting the fraction into two parts: one with 4x in the numerator, which, after a simple substitution, gives the logarithm, and the second part with 47 in the numerator, which, of course, leads to arctan(x). Similarly, as long as is a polynomial with no real roots, any expression of the form can be easily be integrated (by substitution and completing the square), giving rise to a term containing a logarithm and a term containing an arctangent.

**Remark 1.**
Observe that w is defined as an expression in terms of x and not a function. We could have defined the corresponding rational function f(x). In that case the proper syntax would be "
convert(f(x),parfrac,x);
", and not "convert(f,parfrac,x);".

`> `

**Example 3**
. Define an expression m which gives a formula for a rational function

`> `
**m:=(x^8+x^7+2)/(x^6-5*x^4-9*x^2+8*x^3+8*x-3);**

`> `

Find the integral of m. Find the partial fraction decomposition of m. Factor the denominator of m. Compare the three.

Let's ask Maple for the integral of m first:

`> `
**Int(m,x); value(%);**

`> `

How did Maple obtain the value of the integral? By a partial fraction decomposition of the expression m. Let's find it.

`> `
**convert(m,parfrac,x);**

Note that the partial fraction decomposition of m contains a polynomial term. That is because the numerator of m is of a higher degree than its denominator, in which case the long division is performed first. The resulting polynomial is left alone, and the rational function whose denominator has greater degree than the numerator is decomposed into partial fractions.

It is clear how terms of the decomposition correspond to the terms in the integral. Can you quess from the decomposition what are the factors of the denominator of m and with what multiplicities? Pretty much. Let's check.

`> `
**factor(denom(m));**

`> `

This is, indeed, what we expected.

**Partial Fraction Decomposition Step-by-Step**

As you see Maple does for you partial fraction decomposition which you will find very useful in the future. How does Maple do it? This one time, in Example 5 below, we shall retrace Maple's reasoning and do the partial fraction decomposition of m step-by-step. As you may expect, the algebra is going to be brutal. Don't worry, however. Maple will do all the hard work!. It will give you a good introduction to handling rational functions and doing other algebraic chores in Maple. Before we recreate the partial fraction decomposition of m, let's look at a simple example of how to do the long division of polynomials in Maple.

**Example 4 (Long Division).**
You can easily check by hand that

Let's do the long division of by using Maple.

Let's first define the polynomials in question

`> `
**p1:=x^3+1;**

`> `
**p2:=x^2+2*x;**

The two basic commands for long division are " quo " and " rem ". One gives you the quotient, the other the remainder.

`> `
**quo(p1,p2,x);**

`> `
**rem(p1,p2,x);**

The final form of the quotient p1/p2 can be written as

`> `
**quo(p1,p2,x)+rem(p1,p2,x)/p2;**

`> `

**Example 5 (Finding Partial Fraction Decomposition Step-by-Step). **
Find the partial fraction decomposition of the expression m, step-by-step, using Maple to help you with the algebra.

Since our rational expression, m, is high up in the worksheet, let's remind ourselves of what m is

`> `
**m;**

Since the degree of the numerator is higher than the degree of the denominator, we shall perform the long division first.

`> `
**quo(numer(m),denom(m),x);**

`> `
**rem(numer(m),denom(m),x);**

This means that the expression m can be rewritten as

`> `
**quo(numer(m),denom(m),x)+rem(numer(m),denom(m),x)/denom(m);**

The first part is a polynomial. We shall leave it alone and focus on finding the partial fraction decomposition of the rational term. Define that term as k.

`> `
**k:=rem(numer(m),denom(m),x)/denom(m);**

To find the partial fraction decomposition of k, we have to first factor the denominator.

`> `
**factor(denom(k));**

We see one first order term of multiplicity 1, one first order term of multiplicity 3, and one irreducible quadratic term . This tells us what form the partial fraction decomposition of k is going to take. Let's call it "decompk".

`> `
**decompk:=A/(x+3)+B/(x-1)+C/((x-1)^2)+H/((x-1)^3)+(G*x+M)/(x^2+1);**

`> `

For some constants A,B,C,H, G, M the expression k will have the above form. (We do not use "D" as a constant as D has an assigned meaning in Maple.) The next step is finding constants A,B,C,H,G,M. It can be done in several ways. For example, we could follow the method of Example 1. However, there is a simpler way of finding the constants, and we use it below.

**Finding A,B,C,G,H,M.**

We know that decompk has to be equal to k for all values of x, except x=1,-3, where the denominators are 0. We have six unknowns A,B,C,G,H,M, let's choose six values for x, say 0,2,3,4,5,6, substitute them one-by-one into k and decompk, and set up the corresponding equations. Let's label these equations eq1, eq2... and so on. Do not confuse the sign " := ", which means "defined as", with " = ", which means "equals". Below we define six equations. For example, eq1:=subs(x=0,k=decompk); means that eq1 is defined as the equation that you obtain by substituting x=0 into both sides of the equation k=decompk, that is, into both sides of the equation:

`> `
**eq1:= subs(x=0,k=decompk);**

As you see, Maple evaluated k and decompk at x=0 and set both values equal.

`> `
**eq2:=subs(x=2,k=decompk);**

`> `
**eq3:=subs(x=3,k=decompk);**

`> `
**eq4:=subs(x=4,k=decompk);**

`> `
**eq5:=subs(x=5,k=decompk);**

`> `
**eq6:=subs(x=6,k=decompk);**

Now we shall solve the corresponding system of equations. We label our solutions sols.

`> `
**sols:=solve({eq1,eq2,eq3,eq4,eq5,eq6},{A,B,C,G,H,M});**

`> `

We have obtained the desired constants.

Once we have found the constants A,B,C,G,H,M we can substitute them into decompk and obtain the partial fraction decomposition of k. Since , we obtain the partial fraction decomposition of m by subsituting the constants into decompk and adding the polynomial. Let's call the result of this operation decm.

`> `
**decm:=x^2+x+5+subs(sols,decompk);**

`> `

We have obtained the partial fraction decomposition of the expression m "by hand" using Maple only to help us with algebra. Let's recall the result that we obtained using the "convert(m,parfrac,x);" command.

`> `
**convert(m,parfrac,x);**

`> `

Clearly, in the future, we are going to use the "convert(..,parfrac,...)" command rather than finding partial fraction decompositions by hand.

**What if Roots of the Denominator are not Rational?**

The command " convert(..,parfrac,..); ", similarly as the related command " factor ", work very reliably as long as the denominator has rational roots. As long as all coefficients in your expression are rationals in a non-decimal form, both commands are, in fact, telling Maple to find a factorization or a partial fraction decomposition using only rational numbers as constants. If your polynomial or the denominator of your rational function happen to have irrational roots, the commands may not work at all. For example:

`> `
**convert(1/(x^2-3),parfrac,x);**

`> `
**factor(x^2-3);**

`> `

This is not what we would like to see. Maple can deal with irrational roots in several ways. The best approach is to tell Maple to look for a factorization or a partial fraction decomposition which allows arbitrary real numbers, not just rationals. We can do it by specifying "real" under the corresponding command. Maple will respond by returning a partial fraction decomposition or a factorization in which coefficients and roots are floating point approximations of their exact values. For example

`> `
**convert(1/(x^2-3),parfrac,x,real);**

`> `
**factor(x^2-3,real);**

The roots above are floating point approximations of and . Indeed:

`> `
**evalf(sqrt(3));**

We obtained the desired decomposition and factorization. For all practical purposes floating point approximations of exact values are usually sufficient.

Incidentally, if coefficients of a polynomial or a rational function contain a decimal expression, Maple will automatically factor or decompose using real numbers. You do not even have to add "real" under your command. For example

`> `
**convert(1/(x^2-3.0),parfrac,x);**

**Remark 2. **
Engineers often prefer partial fraction decompositions using
*complex*
numbers. Maple provides a floating point complex decomposition with the command "
convert(...,parfrac,x,complex)
". For example

`> `
**convert(1/(x^2+2),parfrac,x,complex);**

`> `

(
* I*
stands, of course for the imaginary unit).

`> `

**Homework Problems**

**Problem 1. **
Consider the polynomials

, .

Perform the long division using Maple. Have Maple display the final form of the quotient .

**Problem 2. **
For each the following rational expressions

, ,

(a) Find the indefinite integral.

(b) Find the partial fraction decomposition (using the simple Maple command,
*not*
step-by-step!)

(c) Factor the denominator.

Do you see the relationship between the three?

**Problem 3. **
For

find its partial fraction decomposition step-by-step, as in Example 5. Then find the decomposition using the "convert(..parfrac..)" command and compare the results. (Hint: Since the degree of the numerator is less than the degree of the denominator, you do not have to perform the long division.)

**Problem 4. **
(a) Try to factor the polynomial
using the simple "factor" command. What happens?

(b) Use the appropriate command to obtain a floating point factorization of the polynomial p.

(c) Consider the rational function

.

Try finding its partial fraction decomposition with the simple "convert(...parfrac,x);" command. What happens? Use the appropriate command to obtain a floating point decomposition.

*MTH 142 Maple Worksheets written by B. Kaskosz and L. Pakula, Copyright 1999.*

*Last modified August 1999.*

`> `