L8-intTechSubs.mws

Calculus II

Lesson 8: Integration by Substitution

Introduction

We are about to study what is commonly called "Techniques of Integration". This is really a misnomer: what we will learn are techniques of anti-differentiation ---the material of this chapter has nothing to do with partitioning, approximating and summing. Of course, the Fundamental Theorem of Calculus tells you that if you can find an anti-derivative for a function then you can integrate that function, which is why many people---and textbooks---confuse the two topics.

As we study this area, you may get the impression that it's all just a bunch of tricks. In a sense, that is true. Differentiation is a very systematic process: learn the product, quotient and chain rules, and a few basic derivatives, and you can differentiate just about any function. Anti-differentiation, on the other hand, is far less automatic. Consider the following examples. (Apart from looking at the answers, notice two things: the use of the unevaluated Int command to print out the integral which is being evaluated, and the fact that Maple does not add the arbitrary constant to an anti-derivative, so we have to put it in by hand.)

> Int(x*sqrt(1 + x^2),x) = int(x*sqrt(1 + x^2),x) + C;

Int(x*sqrt(1+x^2),x) = 1/3*(1+x^2)^(3/2)+C

> Int(x^2*sqrt(1 + x^2),x) = int(x^2*sqrt(1 + x^2),x) + C;

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

> Int(x^3*sqrt(1 + x^2),x) = int(x^3*sqrt(1 + x^2),x) + C;

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

The first and third examples are not too surprising: at least the answer is the same type of function as the integrand. It is not easy to see why the second answer should have an inverse hyperbolic function in it. Perhaps this suggests why anti-differentiation can be so frustrating: it is often impossible to guess the type of functions that will appear in an anti-derivative, and changing the integrand slightly can produce a completely different anti-derivative.

Even finding an anti-derivative may not be very useful. Look at these examples:

> Int(exp(-x^2),x) = int(exp(-x^2),x) + C;

Int(exp(-x^2),x) = 1/2*sqrt(Pi)*erf(x)+C

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

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

Maple can find these anti-derivatives, but they are expressed in terms of functions you have probably never heard of, the error function erf and the elliptic function EllipticF . Unless you know the definitions of these functions, the answers are no use to you. (They are not much use even if you do know their definitions, because these functions are defined in terms of the respective anti-derivatives.) These examples show that it is not enough to have an anti-derivative: to be useful, the anti-derivative must be written in terms of known

functions. Traditionally, we consider an anti-derivative to be useful if it is written in terms of the so-called elementary functions: polynomials, rational functions, exponentials, trigonometric functions and their inverses. (Note that this includes logarithms and hyperbolic functions.)

We have to face one difficulty when using Maple to study techniques of anti-differentiation: it is just too powerful. Any problem in this chapter can be solved in Maple with one int command, so we will have to deliberately tie our hands. We will allow ourselves to check answers by using int if necessary (though it is probably better to check them using diff ), but we will use the unevaluated Int command while we are working out the answer. The game is to use one or more of the methods we will study to convert a given anti-derivative problem into one we can recognise and evaluate.

While there are many tricks involved in anti-differentiation, there are 2 main methods. In the rest of this worksheet, we will look at some simple examples of these methods, and see how we will implement them in Maple .

Anti-differentiation by Substitution

> restart;

If you were asked to evaluate the anti-derivative Int(x*sqrt(1+x^2),x) by hand, you should think of substituting u = 1+x^2 . (You should probably work through this example by hand before solving it in Maple .)

We can get Maple to work through the substitution by using a command changevar . Like many Maple commands, this one is not loaded automatically when the program starts. It is contained in the student package, and so this package must be loaded before we can use changevar . The Maple command that loads a package is with .

> with(student);

[D, Diff, Doubleint, Int, Limit, Lineint, Product, ...
[D, Diff, Doubleint, Int, Limit, Lineint, Product, ...

(When Maple loads a package, the commands contained in the package are listed. If you are familiar with the package, you can suppress this listing by ending the with command with a colon.) Once a package has been loaded, you can use any command in the package in all the usual ways. In particular, you can get help for them.

Now follow through the computation of Int(x*sqrt(1+x^2),x) using changevar . We first define an expression p1 to be the (unevaluated) integral, then we make the suggested substitution. The use of simplify in the third line is optional: in any given example it may or may not help. On the other hand, the third argument in changevar is necessary: there are two variables in the problem ( x and u ), and you must tell Maple which of them is to be the new variable of integration.

> p1 := Int(x*sqrt(1 + x^2),x);

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

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

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

> p3 := simplify(p2);

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

The last expression is a known integral---a simple power of u ---and so we will allow ourselves to evaluate it. The command value will evaluate an unevaluated expression.

> p4 := value(p3);

p4 := 1/3*u^(3/2)

Finally, of course, we must write the answer in terms of x , using the substitution equation u = x^2+1. We first find one anti-derivative, then the general one. This makes it easier to check the answer by differentiation.

> p5 := subs(u=x^2 + 1,p4);

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

> p1 = p5 + C;

Int(x*sqrt(1+x^2),x) = 1/3*(1+x^2)^(3/2)+C

You can check this answer with int , but you should get into the habit of checking anti-derivatives by differentiating them, so let's do that. Note that p5 is an expression, so we can use it in a diff command:

> diff(p5,x);

x*sqrt(1+x^2)

The derivative of p5 is what it should be, so we have found the correct anti-derivative.

Question 1

Use the method described above to find the following anti-derivatives, then check them by differentiation. (All of these are taken from the Chapter 5 Review Exercises in Stewart, and you should do them all---and others---with pencil and paper for homework.)

(a) Int(x^2*(1+2*x^3)^3,x)

Solution.

> p1 := Int(x^2 * (1 + 2*x^3)^3, x);

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

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

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

> p3 := simplify(p2);

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

> p4 := value(p3);

p4 := 1/24*u^4

> p5 := subs(u=1+2*x^3, p4);

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

> p1 = p5 + C;

Int(x^2*(1+2*x^3)^3,x) = 1/24*(1+2*x^3)^4+C

Check:

> diff(p5,x);

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

(By the way: I just got this one wrong--I mistyped the final substitution--so the check was useful!)

(b) Int(exp(sqrt(x))/sqrt(x),x)

Solution.

> p1 := Int(exp(sqrt(x))/sqrt(x),x);

p1 := Int(exp(sqrt(x))/(sqrt(x)),x)

> p2 := changevar(u=sqrt(x),p1,u);

p2 := Int(2*exp(u),u)

> p3 := simplify(p2);

p3 := 2*Int(exp(u),u)

> p4 := value(p3);

p4 := 2*exp(u)

> p5 := subs(u=sqrt(x), p4);

p5 := 2*exp(sqrt(x))

> p1 = p5 + C;

Int(exp(sqrt(x))/(sqrt(x)),x) = 2*exp(sqrt(x))+C

Check:

> diff(p5,x);

exp(sqrt(x))/(sqrt(x))

(c) Int(sec(theta)*tan(theta)/(1+sec(theta)),theta)

Solution.

> p1 := Int(sec(theta)*tan(theta)/(1 + sec(theta)),theta);

p1 := Int(sec(theta)*tan(theta)/(1+sec(theta)),thet...

> p2 := changevar(u=1+sec(theta),p1,u);

p2 := Int(1/u,u)

> p3 := value(p2);

p3 := ln(u)

> p4 := subs(u=1+sec(theta),p3);

p4 := ln(1+sec(theta))

> p1 = p4 + C;

Int(sec(theta)*tan(theta)/(1+sec(theta)),theta) = l...

Check:

> diff(p4,theta);

sec(theta)*tan(theta)/(1+sec(theta))

(d) Int(x/sqrt(1-x^4),x)

Solution.

> p1 := Int(x/sqrt(1 - x^4), x);

p1 := Int(x/(sqrt(1-x^4)),x)

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

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

> p3 := simplify(p2);

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

> p4 := value(p3);

p4 := 1/2*arcsin(u)

> p5 := subs(u=x^2, p4);

p5 := 1/2*arcsin(x^2)

> p1 = p5 + C;

Int(x/(sqrt(1-x^4)),x) = 1/2*arcsin(x^2)+C

Check:

> diff(p5,x);

x/(sqrt(1-x^4))