Application Center - Maplesoft

App Preview:

Calculus II: Lesson 11: Integration of Rational Functions

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

L11-intTechRational.mws

Calculus II

Lesson 11: Integration of Rational Functions

Introduction

You know from the Fundamental Theorem of Calculus that every continuous function has an anti-derivative. Specifically, if f is continuous on an interval [a, b] , then F(x) := Int(f(t),t = a .. x) is differentiable on the open interval ( a, b ), and D(f)(x) = f(x) on this interval, so F is an anti-derivative for f .

On the other hand, not every (continuous) function has an
elementary anti-derivative, which we could define loosely as an anti-derivative built up from functions discussed in first semester of Calculus. We have seen some examples already.

> int(exp(-x^2), x);

1/2*sqrt(Pi)*erf(x)

> int(sqrt(x^3 + 1), x);

2/5*x*sqrt(x^3+1)+6/5*(3/2-1/2*I*sqrt(3))*sqrt((x+1...

The functions erf and EllipticF appearing in these anti-derivatives are not familiar to us: they do not appear in Stewart, and are not considered elementary.

It is therefore of some interest to know which functions
do have elementary anti-derivatives. This worksheet will show you that every rational function does, by explicitly showing how, in principle, such a function may be anti-differentiated. (Recall that a rational function f is a function of the form f(x) = P(x)/Q(x) , where P and Q are polynomials.) The idea is to show first that any rational function can be written as a sum of certain special types of rational functions, then show how to find anti-derivatives for each of the special types. The special types are called partial fractions , and we will begin by looking at the types of partial fraction that are needed.

Partial Fractions

Suppose we are given a rational expression, for example

> f := (x^7 + 6*x^5 - 3*x^2 + 7) /
(2*x^5 + 21*x^4 + 44*x^3 - 24*x^2 + 144*x - 432);

f := (x^7+6*x^5-3*x^2+7)/(2*x^5+21*x^4+44*x^3-24*x^...

We will want to refer to the numerator and denominator of this expression separately, and we can extract them with the numer and denom commands:

> P := numer(f);

P := x^7+6*x^5-3*x^2+7

> Q := denom(f);

Q := 2*x^5+21*x^4+44*x^3-24*x^2+144*x-432

(Of course, we could equally well start with P and Q and define f to be their quotient.)

In this example, the degree of the numerator of
f is greater than or equal to the degree of the denominator, so we can divide P by Q , obtaining a quotient q and a remainder r , such that
P/Q = q+r/Q , where the degree of r is less than the degree of Q . We then rewrite the expression f in this form, denoting it by f1 .

> q := quo(P, Q, x);

q := 1/2*x^2-21/4*x+377/8

> r := rem(P, Q, x);

r := 20365+2100*x^2-5973/8*x^4-4543/2*x^3-9054*x

> f1 := q + r/Q;

f1 := 1/2*x^2-21/4*x+377/8+(20365+2100*x^2-5973/8*x...

We can easily check that the expression f1 is equal to f :

> simplify(f1);

(x^7+6*x^5-3*x^2+7)/(2*x^5+21*x^4+44*x^3-24*x^2+144...

Since the polynomial q can easily be anti-differentiated, the remaining problem is to see how to
anti-differentiate the
proper rational function r/Q . We will call this expression f2 :

> f2 := r/Q;

f2 := (20365+2100*x^2-5973/8*x^4-4543/2*x^3-9054*x)...


The next step is always possible
in principle , although it may be impossible to carry out in practice: we
factor the denominator into linear and irreducible quadratic factors.

> factor(Q);

(2*x-3)*(x^2+4)*(x+6)^2

With the factorisation completed, we can write f2 as a sum of partial fractions:

> f3 := convert(f2, parfrac, x);

f3 := 8051/45000*1/(2*x-3)+326693/600/((x+6)^2)-671...

It should now be clear that if we can anti-differentiate each term in this sum, we can anti-differentiate the original expression f . In later sections of the worksheet, we will see how to anti-differentiate any type of partial fraction, but first you should see what kinds of partial fraction can arise, and how they relate to the factorisation of the denominator.

Two observations:

1. The
convert command is able to do the initial polynomial division as well as the subsequent decomposition. For example, using our original f ,

> convert(f, parfrac, x);

1/2*x^2-21/4*x+377/8+8051/45000/(2*x-3)+326693/600/...

2. The factorisation step is the biggest hurdle in the whole partial fraction method: every other step is automatic (although the whole procedure can become extremely long and tedious), but there is no systematic method for finding the factorisation of a polynomial, although there is a theorem which guarantees that the factorisation exists.

Question 1

Here are some rational expressions. Use the convert command to write them in partial fractions, and observe the types of terms which can occur. Try to find a rule which relates the types of partial fraction which occur in a given decomposition to the factorisation of the numerator. Test your rule by making up other examples and seeing if you can predict the types of partial fractions you get.

Solutions.

> g1 := 1/(x^2 - 9);

g1 := 1/(x^2-9)

> convert(g1,parfrac,x);

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

> g2 := (3*x + 5)/(x^2 - 9);

g2 := (3*x+5)/(x^2-9)

> convert(g2,parfrac,x);

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

> g3 := (3*x + 5)/(x^2 - 9)^2;

g3 := (3*x+5)/((x^2-9)^2)

> convert(g3,parfrac,x);

7/18*1/((x-3)^2)-5/108*1/(x-3)-1/9*1/((x+3)^2)+5/10...

> g4 := (2*x^3 + x)/(x^2 - 9)^2;

g4 := (2*x^3+x)/((x^2-9)^2)

> convert(g4,parfrac,x);

19/12*1/((x-3)^2)+1/(x-3)-19/12*1/((x+3)^2)+1/(x+3)...

> g5 := (x^3 - 2*x^2 + 3)/(x^2 - 9)^3;

g5 := (x^3-2*x^2+3)/((x^2-9)^3)

> convert(g5,parfrac,x);

1/18*1/((x-3)^3)+1/24/((x-3)^2)+1/144/(x-3)+7/36/((...

> g6 := x/(x^2 + 9);

g6 := x/(x^2+9)

> convert(g6,parfrac,x);

x/(x^2+9)

> g7 := (x^7 - 1)/(x^2 + 5)^4;

g7 := (x^7-1)/((x^2+5)^4)

> convert(g7,parfrac,x);

(-1-125*x)/((x^2+5)^4)+75*x/((x^2+5)^3)-15*x/((x^2+...

> g8 := 1/(x^10 - 3*x^8 + 8*x^7 - 18*x^6 + 24*x^5 - 26*x^4 + 24*x^3 - 15*x^2 + 8*x - 3);

g8 := 1/(x^10-3*x^8+8*x^7-18*x^6+24*x^5-26*x^4+24*x...

> factor(denom(g8));

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

> convert(g8,parfrac,x);

-1/64000*1/(x+3)+1/32/((x-1)^3)-13/128*1/((x-1)^2)+...

> g9 := (x^7 + x^5 + x^3 + 1) /
(x^10 - 3*x^8 + 8*x^7 - 18*x^6 + 24*x^5 - 26*x^4 + 24*x^3 - 15*x^2 + 8*x - 3);

g9 := (x^7+x^5+x^3+1)/(x^10-3*x^8+8*x^7-18*x^6+24*x...

> factor(denom(g9));

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

> convert(g9,parfrac,x);

307/8000*1/(x+3)+1/8/((x-1)^3)+1/16/((x-1)^2)+13/64...

The denominators of the partial fractions are factors (or powers of factors) of the denominator of the original fraction. If a factor appears only once in the denominator, there is a single partial fraction with that factor as its denominator; if a factor is repeated, there will be partial fractions with that power and all lower powers of that factor in their denominators.

As for the numerators of the partial fractions: any partial fraction coming from a linear factor has a constant in its numerator ( Maple writes this constant in front of the fraction, leaving a numerator of 1); any partial fraction coming from an irreducible quadratic factor has at most a linear polynomial in the numerator.

Terms arising from Linear Factors

After doing Question 1 in the last section, you should be convinced that (apart from a possible polynomial) only two types of partial fraction show up in the decomposition of a rational function. If the denominator of the original rational function has a linear factor a*x+b , possibly repeated, there will be
partial fractions of the form
1/((a*x+b)^n) in the decomposition; if the original denominator has an irreducible quadratic factor a*x^2+b*x+c , possibly repeated, there will be partial fractions of the form (A*x+B)/((a*x^2+b*x+c)^n) . In each case, the highest value of n which appears is the number of times the corresponding factor is repeated in the original denominator. It follows that if we can find anti-derivatives for each of these expressions, we can anti-differentiate any rational function.

It is easy to find anti-derivatives for the partial fractions arising from linear factors: just substitute
u = a*x+b . Here are two worked examples, using changevar from the student package.

> with(student):

> p1 := Int(1/(2*x - 3), x);

p1 := Int(1/(2*x-3),x)

> p2 := changevar(u=2*x - 3, p1, u);

p2 := Int(1/2*1/u,u)

> p3 := simplify(p2);

p3 := 1/2*Int(1/u,u)

> p4 := value(p3);

p4 := 1/2*ln(u)

> p5 := subs(u = 2*x - 3, p4);

p5 := 1/2*ln(2*x-3)

> p1 = p5 + C;

Int(1/(2*x-3),x) = 1/2*ln(2*x-3)+C

> q1 := Int(1/(4*x + 17)^6, x);

q1 := Int(1/((4*x+17)^6),x)

> q2 := changevar(u = 4*x + 17, q1, u);

q2 := Int(1/4*1/(u^6),u)

> q3 := simplify(q2);

q3 := 1/4*Int(1/(u^6),u)

> q4 := value(q3);

q4 := -1/20*1/(u^5)

> q5 := subs(u = 4*x + 17, q4);

q5 := -1/20*1/((4*x+17)^5)

> q1 = q5 + C;

Int(1/((4*x+17)^6),x) = -1/20*1/((4*x+17)^5)+C

After the suggested substitution, the problem reduces to finding Int(1/(u^n),u) . If n = 1 we get a logarithm term; otherwise the anti-derivative is a rational function again.

Question 2

Use the method shown above to find the following anti-derivatives:

(a)
Int(1/((4*x+5)^3),x)

Solution.

> p1 := Int(1/(4*x + 5)^3, x);

p1 := Int(1/((4*x+5)^3),x)

> p2 := changevar(u = 4*x + 5, p1, u);

p2 := Int(1/4*1/(u^3),u)

> p3 := simplify(p2);

p3 := 1/4*Int(1/(u^3),u)

> p4 := value(p3);

p4 := -1/8*1/(u^2)

> p5 := subs(u = 4*x + 5, p4);

p5 := -1/8*1/((4*x+5)^2)

> p1 = p5 + C;

Int(1/((4*x+5)^3),x) = -1/8*1/((4*x+5)^2)+C

>

(b) Int(1/(sqrt(2)*x-1),x)

Solution.

> q1 := Int(1/(sqrt(2)*x - 1), x);

q1 := Int(1/(sqrt(2)*x-1),x)

> q2 := changevar(u = sqrt(2)*x - 1, q1, u);

q2 := Int(1/2*sqrt(2)/u,u)

> q3 := simplify(q2);

q3 := 1/2*sqrt(2)*Int(1/u,u)

> q4 := value(q3);

q4 := 1/2*sqrt(2)*ln(u)

> q5 := subs(u = sqrt(2)*x - 1, q4);

q5 := 1/2*sqrt(2)*ln(sqrt(2)*x-1)

> q1 = q5 + C;

Int(1/(sqrt(2)*x-1),x) = 1/2*sqrt(2)*ln(sqrt(2)*x-1...

>

(c) Int(5/(x+2),x)

Solution.

> r1 := Int(5/(x + 2), x);

r1 := Int(5*1/(x+2),x)

> r2 := changevar(u = x+2, r1, u);

r2 := Int(5*1/u,u)

> r3 := simplify(r2);

r3 := 5*Int(1/u,u)

> r4 := value(r3);

r4 := 5*ln(u)

> r5 := subs(u = x+2, r4);

r5 := 5*ln(x+2)

> r1 = r5 + C;

Int(5*1/(x+2),x) = 5*ln(x+2)+C

Terms arising from Quadratic Factors

In this section, we will see how to anti-differentiate the second type of partial fraction: one of the
form
(A*x+B)/((a*x^2+b*x+c)^n) arising from an irreducible quadratic factor a*x^2+b*x+c in the original denominator.
We will begin by looking at two special cases. The general case can then be handled by cleverly combining these two.

CASE 1: A = 0 .

In this case, our partial fraction looks like
B/((a*x^2+b*x+c)^n) . The constant B in the numerator can be pulled through the anti-derivative sign, so we may as well assume B = 1 . We can also factor the coefficient a out of the denominator (it will become a^n when we pull it through the n -th power) and pull it through the anti-derivative sign, so we may as well assume a = 1 also. We are now reduced to finding Int(1/((x^2+b*x+c)^n),x) , where x^2+b*x+c is irreducible.

To solve this problem, we re-write x^2+b*x+c by completing the square, and make a tangent substitution. Needless to say, Maple has a command completesquare . This command resides in the student package, so you should load that package now if you have not already done so.

Here are two worked examples of case 1:

> p1 := Int(1/(x^2 - 6*x + 18), x);

p1 := Int(1/(x^2-6*x+18),x)

> den1 := x^2 - 6*x + 18;

den1 := x^2-6*x+18

> den2 := completesquare(den1, x);

den2 := (x-3)^2+9

> p2 := subs(den1=den2, p1);

p2 := Int(1/((x-3)^2+9),x)

> p3 := changevar(x-3 = 3*tan(u), p2, u);

p3 := Int((1+tan(u)^2)/(3+3*tan(u)^2),u)

> p4 := simplify(p3);

p4 := 1/3*Int(1,u)

> p5 := value(p4);

p5 := 1/3*u

> p6 := subs(u = arctan((x-3)/3), p5);

p6 := 1/3*arctan(1/3*x-1)

> p1 = p6 + C;

Int(1/(x^2-6*x+18),x) = 1/3*arctan(1/3*x-1)+C

> q1 := Int(1/(x^2 - 6*x + 18)^3, x);

q1 := Int(1/((x^2-6*x+18)^3),x)

> q2 := subs(den1 = den2, q1);

q2 := Int(1/(((x-3)^2+9)^3),x)

> q3 := changevar(x-3 = 3*tan(u), q2, u);

q3 := Int(1/243*1/((1+tan(u)^2)^2),u)

> q4 := simplify(q3);

q4 := 1/243*Int(1/((1+tan(u)^2)^2),u)

Maple seems unwilling to make the next simplification, so we will have to force it.

> q5 := subs(1 + tan(u)^2 = sec(u)^2, q4);

q5 := 1/243*Int(1/(sec(u)^4),u)

> q6 := simplify(q5);

q6 := 1/243*Int(cos(u)^4,u)

This is now do-able: we have a reduction formula for powers of cosine. Rather than grind out the calculation, we will allow Maple to evaluate this anti-derivative.

> q7 := value(q6);

q7 := 1/972*cos(u)^3*sin(u)+1/648*cos(u)*sin(u)+1/6...

> q8 := subs(u = arctan((x-3)/3), q7);

q8 := 1/972*cos(arctan(1/3*x-1))^3*sin(arctan(1/3*x...

> q9 := simplify(q8);

q9 := 1/648*(126*x-216+3*x^3-27*x^2+arctan(1/3*x-1)...
q9 := 1/648*(126*x-216+3*x^3-27*x^2+arctan(1/3*x-1)...
q9 := 1/648*(126*x-216+3*x^3-27*x^2+arctan(1/3*x-1)...

>

Question 3

Use the method above to find these anti-derivatives:

(a) Int(1/(x^2+2*x+11),x)

Solution.

> expr := 1/(x^2 + 2*x + 11);

expr := 1/(x^2+2*x+11)

> p1 := Int(expr, x);

p1 := Int(1/(x^2+2*x+11),x)

> den1 := denom(expr);

den1 := x^2+2*x+11

> den2 := completesquare(den1);

den2 := (x+1)^2+10

> p2 := subs(den1 = den2, p1);

p2 := Int(1/((x+1)^2+10),x)

> p3 := changevar(x+1 = sqrt(10)*tan(u), p2, u);

p3 := Int(sqrt(10)*(1+tan(u)^2)/(10*tan(u)^2+10),u)...

> p4 := simplify(p3);

p4 := 1/10*sqrt(10)*Int(1,u)

> p5 := value(p4);

p5 := 1/10*sqrt(10)*u

> p6 := subs(u = arctan((x+1)/sqrt(10)), p5);

p6 := 1/10*sqrt(10)*arctan(1/10*(x+1)*sqrt(10))

> p1 = p6 + C;

Int(1/(x^2+2*x+11),x) = 1/10*sqrt(10)*arctan(1/10*(...

As always, it is easy to check this answer. (I usually don't do the checks in my solutions, but you should!)

> check := diff(p6, x);

check := 1/10*1/(1+1/10*(x+1)^2)

> simplify(check);

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

>

(b) Int(1/(x^2+6*x+11),x)

Solution.

> expr := 1/(x^2 + 6*x + 11);

expr := 1/(x^2+6*x+11)

> q1 := Int(expr, x);

q1 := Int(1/(x^2+6*x+11),x)

> den1 := denom(expr);

den1 := x^2+6*x+11

> den2 := completesquare(den1);

den2 := (x+3)^2+2

> q2 := subs(den1 = den2, q1);

q2 := Int(1/((x+3)^2+2),x)

> q3 := changevar(x + 3 = sqrt(2)*tan(u), q2, u);

q3 := Int(sqrt(2)*(1+tan(u)^2)/(2*tan(u)^2+2),u)

> q4 := simplify(q3);

q4 := 1/2*sqrt(2)*Int(1,u)

> q5 := value(q4);

q5 := 1/2*sqrt(2)*u

> q6 := subs(u = arctan((x+3)/sqrt(2)), q5);

q6 := 1/2*sqrt(2)*arctan(1/2*(x+3)*sqrt(2))

> q1 = q6 + C;

Int(1/(x^2+6*x+11),x) = 1/2*sqrt(2)*arctan(1/2*(x+3...

>

(c) Int(1/((2*x^2-4*x+10)^2),x)

Solution.

> expr := 1/(2*x^2 - 4*x + 10);

expr := 1/(2*x^2-4*x+10)

> r1 := Int(expr^2, x);

r1 := Int(1/((2*x^2-4*x+10)^2),x)

> den1 := denom(expr);

den1 := 2*x^2-4*x+10

> den2 := completesquare(den1);

den2 := 2*(x-1)^2+8

> r2 := subs(den1 = den2, r1);

r2 := Int(1/((2*(x-1)^2+8)^2),x)

> r3 := changevar(x-1 = 2*tan(u), r2, u);

r3 := Int(1/(32+32*tan(u)^2),u)

> r4 := simplify(r3);

r4 := 1/32*Int(1/(1+tan(u)^2),u)

> r5 := subs(1 + tan(u)^2 = sec(u)^2, r4);

r5 := 1/32*Int(1/(sec(u)^2),u)

> r6 := simplify(r5);

r6 := 1/32*Int(cos(u)^2,u)

> r7 := value(r6);

r7 := 1/64*cos(u)*sin(u)+1/64*u

> r8 := subs(u = arctan((x-1)/2), r7);

r8 := 1/64*cos(arctan(1/2*x-1/2))*sin(arctan(1/2*x-...

> r9 := simplify(r8);

r9 := 1/64*(2*x-2+arctan(1/2*x-1/2)*x^2-2*arctan(1/...

> r1 = r9 + C;

Int(1/((2*x^2-4*x+10)^2),x) = 1/64*(2*x-2+arctan(1/...

Since this is the most complicated example we have worked out so far, we might check it:

> check := diff(r9, x);

check := 1/64*(2+1/2*x^2/(1+(1/2*x-1/2)^2)+2*arctan...
check := 1/64*(2+1/2*x^2/(1+(1/2*x-1/2)^2)+2*arctan...

> simplify(check);

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

This is the original rational function, though written in a slightly different form.

>

>


CASE 2:
A*x+B = 2*a*x+b .

In this case, the numerator is exactly the derivative of the irreducible polynomial
a*x^2+b*x+c . If this remarkable coincidence occurs, the substitution u = a*x^2+b*x+c does the job.

> p1 := Int((2*x + 2)/(x^2 + 2*x + 11), x);

p1 := Int((2*x+2)/(x^2+2*x+11),x)

> p2 := changevar(u = x^2 + 2*x + 11, p1, u);

p2 := Int(1/u,u)

> p3 := value(p2);

p3 := ln(u)

> p4 := subs(u = x^2 + 2*x + 11, p3);

p4 := ln(x^2+2*x+11)

> p1 = p4 + C;

Int((2*x+2)/(x^2+2*x+11),x) = ln(x^2+2*x+11)+C

> q1 := Int((6*x + 30)/(3*x^2 + 30*x + 33)^7, x);

q1 := Int((6*x+30)/((3*x^2+30*x+33)^7),x)

> q2 := changevar(u = 3*x^2 + 30*x + 33, q1, u);

q2 := Int(1/(u^7),u)

> q3 := value(q2);

q3 := -1/6*1/(u^6)

> q4 := subs(u = 3*x^2 + 30*x + 33, q3);

q4 := -1/6*1/((3*x^2+30*x+33)^6)

> q1 = q4 + C;

Int((6*x+30)/((3*x^2+30*x+33)^7),x) = -1/6*1/((3*x^...

Case 2 may appear to be very special, but at least it is very easy.

THE GENERAL CASE.

As mentioned above, the general case can be written as a combination of the two special cases. This is done by re-writing the numerator
A*x+B as A/(2*a) ( 2*a*x+b ) + ( B-A*b/(2*a) ) . This formula may not be too illuminating: the point is that we write the derivative of a*x^2+b*x+c in the numerator, so that we can use Case 2, and then we adjust constants so that we have the correct numerator. If you think about it, this is the same as dividing A*x+B by 2*a*x+b , so we can use Maple 's rem and quo commands to do the algebra. For example:

> expr1 := (5*x - 3)/(x^2 + 2*x + 11);

expr1 := (5*x-3)/(x^2+2*x+11)

We find the derivative of the denominator, and find the quotient and remainder when it is divided into the numerator.

> d := diff(denom(expr1), x);

d := 2*x+2

> q := quo(numer(expr1), d, x);

q := 5/2

> r := rem(numer(expr1), d, x);

r := -8

> expr2 := q*d/denom(expr1);

expr2 := 5/2*(2*x+2)/(x^2+2*x+11)

> expr3 := r/denom(expr1);

expr3 := -8*1/(x^2+2*x+11)

We can easily check that our original expression is the sum of these two:

> simplify(expr2 + expr3);

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

Since expr2 is an example of Case 2 (apart from the factor of 5/2, which causes no difficulty), and expr3 is an example of Case 1, we can find anti-derivatives for each of them, and hence for the original expression. In exactly the same way, if we had started with a power of a*x^2+b*x+c in the denominator, for example

> expr4 := (5*x - 3)/(x^2 + 2*x + 11)^3;

expr4 := (5*x-3)/((x^2+2*x+11)^3)

we would re-write it as the sum of the two expressions

> expr5 := q*d/denom(expr1)^3;

expr5 := 5/2*(2*x+2)/((x^2+2*x+11)^3)

and

> expr6 := r/denom(expr1)^3;

expr6 := -8*1/((x^2+2*x+11)^3)

Check:

> simplify(expr5 + expr6);

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

In conclusion, we can now anti-differentiate any partial fraction coming from an irreducible quadratic factor, and hence any rational function.

>

Question 4

Re-write each of the following expressions as a sum of an expression that falls into Case 1 and one that falls into Case 2.

> p1 := (3*x + 4)/(x^2 + x + 1);

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

Solution. (To be honest, this procedure is probably done more easily by hand, but here are Maple solutions, following the method indicated above.)

> den := denom(p1);

den := x^2+x+1

> d := diff(den, x);

d := 2*x+1

> q := quo(numer(p1), d, x);

q := 3/2

> r := rem(numer(p1), d, x);

r := 5/2

> p2 := q*d/den + r/den;

p2 := 3/2*(2*x+1)/(x^2+x+1)+5/2/(x^2+x+1)

>

> q1 := (6*x + 5)/(x^2 + 4*x + 13)^2;

q1 := (6*x+5)/((x^2+4*x+13)^2)

Solution.

> quad := x^2 + 4*x + 13;

quad := x^2+4*x+13

> d := diff(quad, x);

d := 2*x+4

> q := quo(numer(q1), d, x);

q := 3

> r := rem(numer(q1), d, x);

r := -7

> q2 := (q*d)/quad^2 + r/quad^2;

q2 := 3*(2*x+4)/((x^2+4*x+13)^2)-7/((x^2+4*x+13)^2)...

>

>

Question 5

Work through the complete procedure we have outlined, and find anti-derivatives for the following expressions: first use convert to find the partial-fraction decomposition, then find anti-derivatives for each of the partial fractions.

> p1 := 1/((x-1)*(x+1)^2);

p1 := 1/((x-1)*(x+1)^2)

Solution.

> p2 := convert(p1, parfrac, x);

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

> p3 := Int(1/(4*(x-1)), x);

p3 := Int(1/(4*x-4),x)

> p4 := changevar(u=x-1, p3, u);

p4 := Int(1/4*1/u,u)

> p5 := simplify(p4);

p5 := 1/4*Int(1/u,u)

> p6 := value(p5);

p6 := 1/4*ln(u)

> p7 := subs(u=x-1, p6);

p7 := 1/4*ln(x-1)

Since the next two partial fractions involve the same substitution, we will do them together.

> p8 := op(2, p2) + op(3, p2);

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

> p9 := Int(p8, x);

p9 := Int(-1/2*1/((x+1)^2)-1/4*1/(x+1),x)

> p10 := changevar(u=x+1, p9, u);

p10 := Int(-1/2*1/(u^2)-1/4*1/u,u)

> p11 := value(p10);

p11 := 1/2*1/u-1/4*ln(u)

> p12 := subs(u=x+1, p11);

p12 := 1/2*1/(x+1)-1/4*ln(x+1)

> p13 := p7 + p12;

p13 := 1/4*ln(x-1)+1/2/(x+1)-1/4*ln(x+1)

> Int(p1, x) = p13 + C;

Int(1/((x-1)*(x+1)^2),x) = 1/4*ln(x-1)+1/2/(x+1)-1/...

>

> q1 := (3*x + 4)/(x^2 + x + 1);

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

Solution. Since the denominator is irreducible (as will become apparent when we complete the square), this expression is already in partial-fraction form. We proceed as in Question 4.

> den := denom(q1);

den := x^2+x+1

> d := diff(den, x);

d := 2*x+1

> q := quo(numer(q1), d, x);

q := 3/2

> r := rem(numer(q1), d, x);

r := 5/2

> q2 := q*d/den;

q2 := 3/2*(2*x+1)/(x^2+x+1)

> q3 := r/den;

q3 := 5/2*1/(x^2+x+1)

The expression q1 has been split into expressions that fall into case 1 and case 2, so we can proceed to find anti-derivatives for each of them. We start with q2 .

> q4 := Int(q2, x);

q4 := Int(3/2*(2*x+1)/(x^2+x+1),x)

> q5 := changevar(u = x^2 + x + 1, q4, u);

q5 := Int(3/2*1/u,u)

> q6 := value(q5);

q6 := 3/2*ln(u)

> q7 := subs(u = x^2 + x + 1, q6);

q7 := 3/2*ln(x^2+x+1)

Now for q3 .

> q8 := Int(q3, x);

q8 := Int(5/2*1/(x^2+x+1),x)

> den1 := completesquare(den);

den1 := (x+1/2)^2+3/4

> q9 := subs(den=den1, q8);

q9 := Int(5/2*1/((x+1/2)^2+3/4),x)

> q10 := changevar(x + 1/2 = sqrt(3/4)*tan(u), q9, u);

q10 := Int(5/2*(1/2*sqrt(3)+1/2*sqrt(3)*tan(u)^2)/(...

> q11 := simplify(q10);

q11 := 5/3*sqrt(3)*Int(1,u)

> q12 := value(q11);

q12 := 5/3*sqrt(3)*u

> q13 := subs(u = arctan((x + 1/2)/sqrt(3/4)), q12);

q13 := 5/3*sqrt(3)*arctan(2/3*(x+1/2)*sqrt(3))

Now we put the two parts together.

> q14 := q7 + q13;

q14 := 3/2*ln(x^2+x+1)+5/3*sqrt(3)*arctan(2/3*(x+1/...

> Int(q1, x) = q14 + C;

Int((3*x+4)/(x^2+x+1),x) = 3/2*ln(x^2+x+1)+5/3*sqrt...

This was a long calculation, so let's check:

> check := diff(q14, x);

check := 3/2*(2*x+1)/(x^2+x+1)+10/3/(1+4/3*(x+1/2)^...

> simplify(check);

(3*x+4)/(x^2+x+1)

>

> r1 := 1/(x^3 - 1);

r1 := 1/(x^3-1)

Solution.

> r2 := convert(r1, parfrac, x);

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

Now anti-differentiate the partial fractions, one by one.

> r3 := op(1, r2);

r3 := 1/3*1/(x-1)

> r4 := Int(r3, x);

r4 := Int(1/3*1/(x-1),x)

> r5 := changevar(u = x-1, r4, u);

r5 := Int(1/3*1/u,u)

> r6 := value(r5);

r6 := 1/3*ln(u)

> r7 := subs(u = x-1, r6);

r7 := 1/3*ln(x-1)

The first partial fraction is done, so we move to the second. This must first be broken into case 1 and case 2 fractions ( r9 and r10 below).

> r8 := op(2, r2);

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

> den := denom(r8);

den := 3*x^2+3*x+3

> d := diff(den, x);

d := 6*x+3

> q := quo(numer(r8), d, x);

q := -1/6

> r := rem(numer(r8), d, x);

r := -3/2

> r9 := q*d/den;

r9 := -1/6*(6*x+3)/(3*x^2+3*x+3)

> r10 := r/den;

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

Anti-differentiate r9 :

> r11 := Int(r9, x);

r11 := Int(-1/6*(6*x+3)/(3*x^2+3*x+3),x)

> r12 := changevar(u = 3*x^2 + 3*x + 3, r11, u);

r12 := Int(-1/6*1/u,u)

> r13 := value(r12);

r13 := -1/6*ln(u)

> r14 := subs(u = 3*x^2 + 3*x + 3, r13);

r14 := -1/6*ln(3*x^2+3*x+3)

Anti-differentiate r10 :

> r15 := Int(r10, x);

r15 := Int(-3/2*1/(3*x^2+3*x+3),x)

> den1 := completesquare(den);

den1 := 3*(x+1/2)^2+9/4

> r16 := subs(den = den1, r15);

r16 := Int(-3/2*1/(3*(x+1/2)^2+9/4),x)

> r17 := changevar(x + 1/2 = sqrt(3/4)*tan(u), r16, u);

r17 := Int(-3/2*(1/2*sqrt(3)+1/2*sqrt(3)*tan(u)^2)/...

> r18 := simplify(r17);

r18 := -1/3*sqrt(3)*Int(1,u)

> r19 := value(r18);

r19 := -1/3*sqrt(3)*u

> r20 := subs(u = arctan((x + 1/2)/sqrt(3/4)), r19);

r20 := -1/3*sqrt(3)*arctan(2/3*(x+1/2)*sqrt(3))

Put everything together:

> r21 := r7 + r14 + r20;

r21 := 1/3*ln(x-1)-1/6*ln(3*x^2+3*x+3)-1/3*sqrt(3)*...

> Int(r1, x) := r21 + C;

Int(1/(x^3-1),x) := 1/3*ln(x-1)-1/6*ln(3*x^2+3*x+3)...

Check:

> check := diff(r21, x);

check := 1/3*1/(x-1)-1/6*(6*x+3)/(3*x^2+3*x+3)-2/3*...

> simplify(check);

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

This is the original rational function, as you can see by multiplying out the denominator.