Partial Fraction Decomposition with Maple

Copyright 1999, 2001 by James F. Hurley, University of Connecticut Department of Mathematics, U-9, Storrs CT 06269-3009. All rights reserved.

The interactive version of this Maple worksheet is in MSB 203, in the Math 116 course folder.

Let f(x) = p(x)/q(x) be a rational function in proper form, that is, deg p(x) < deg q(x). Then f(x) is expressible as a sum of partial fractions of one or more of the forms A[i]/(a[j]*x+b[j]) , A[i]/((a[j]*x+b[j])^i) , (A[i]*x+B[i])/(c[j]*x^2+d[j]*x+e[j]) , (A[i]*x+B[i])/((c[j]*x^2+d[j]*x+e[j])^i) . Maple has a command to carry out such decomposition by doing all the necessary calculations automatically. The command is

convert(f(x), parfrac, x)


-- f(x) is the rational expression to decompose

-- parfrac is the command to split f(x) into a sum of partial fractions

-- x is the variable with respect to which all factoring and decomposing takes place.

For an illustration of convert execute the routine below by placing the cursor at the end of the final line, and hitting the Enter key.

> f(x) := 1/(x^3 + 2*x^2 - 7*x + 4);
g(x) := convert( f(x), parfrac, x );

f(x) := 1/(x^3+2*x^2-7*x+4)

g(x) := 1/25*1/(x+4)+1/5/((x-1)^2)-1/25*1/(x-1)

Before decomposing
f(x) into a sum of partial fractions, in the background Maple first factored it into the product of irreducible linear factors. To confirm that, ask Maple to carry out the factorization explicitly by executing the following command.

> factor(f(x));


The integral of the rational function
f(x) is easy to evaluate directly by hand, but you can have Maple check the calculation. Just execute the next command.

> int( g(x), x );


Note that the output omits the constant
C of integration, and so would get only 9 points out of 10 on a test or quiz problem to evaluate int(f(x),x) !

Needless to say, Maple's value comes not from checking integration that you can easily do by hand, but rather from handling complicated integrals with irreducible quadratic factors, perhaps even to powers, in the denominator. As an illustration, consider Examples 7 and 8 from Section 8.4 of Stewart's
Calculus, 4th Edition, ITP Brooks/Cole, 1999, pp. 530531. Execute the commands, and compare to the corresponding material in the text. (The colons at the end of the lines that define the functions h and s suppress printing the formulas for h(x) and s(x), which really is of little value.)

> h(x) := (x^3 + x^2 + 1)/( x*(x - 1)*(x^2 + x + 1)*(x^2 + 1)^3 ):
k(x) := convert( h(x), parfrac, x);

k(x) := -1/x+1/8/(x-1)-(x+1)/(x^2+x+1)+1/8*(-1+15*x...

> s(x) := (1 - x + 2*x^2 - x^3)/( x*(x^2 + 1)^2 ):
t(x) := convert( s(x), parfrac, x);

t(x) := 1/x-(x+1)/(x^2+1)+x/((x^2+1)^2)

> int( t(x), x);


Again, except for the missing constant of integration, the last output agrees with Stewart's final answer to Example 8.

If you try to decompose by hand a rational function that is not in proper form
[that is, one in which the degree of the numerator
p(x) is greater than deg q(x) ], the resulting calculations normally produce a bogus answer. However, if you use parfrac on a rational expression not in proper form, Maple first does the necessary division of p(x) by q(x) in the background. The next command illustrates this for Stewart's Example 6, p. 529.

> r(x) := (4*x^2 - 3*x + 2)/(4*x^2 - 4*x + 3);
convert( r(x), parfrac, x);

r(x) := (4*x^2-3*x+2)/(4*x^2-4*x+3)


I t is easy to confirm that Maple actually did divide p(x) by q(x). Note that q(x) = 4*x^2-4*x+3 is an irreducible quadratic polynomial. The following routine reduces p(x)/q(x) to proper form explicitly, and outputs the first displayed equation of Stewart's solution. The command quo finds the quotient of the numerator by the denominator, and rem calculates the remainder that comes from that division.

> p(x) := 4*x^2 - 3*x + 2:
q(x) := 4*x^2 - 4*x + 3:
w(x) := quo( p(x), q(x), x):
v(x) := rem( p(x), q(x), x)/q(x):
u(x) := w(x) + v(x);

u(x) := 1+(x-1)/(4*x^2-4*x+3)

Let's have Maple decompose the rational function
v(x), which is in proper form, and then check the text's integration.

> z(x) := convert( v(x), parfrac, x);
int(1 + z(x), x);

z(x) := (x-1)/(4*x^2-4*x+3)


Again except for the missing constant of integration, the output agrees with the results of Stewart's hand calculations.