Intermediate Value Theorem and Maple

advertisement
Theorem (The Intermediate Value Theorem) If the function f is continuous on
the closed interval [a , b] and N is any number between f ( a ) and f ( b ) , then
there exists a number c in the interval (a , b) such that f ( c )  N .
We use the Intermediate Value Theorem to find a solution to the equation
f ( x )  0 , where f is a continuous function, in the following way:
1. If f ( a )  0 and f ( b )  0 and f is continuous on the closed interval [a , b],
then there exists a number c in the interval (a , b) such that f ( c )  0 .
OR
2. If f ( a )  0 and f ( b )  0 and f is continuous on the closed interval [a , b],
then there exists a number c in the interval (a , b) such that f ( c )  0 .
Example We will use the Intermediate Value Theorem (IVT) to show that the
2
equation x  x  1 has a solution in the interval (1, 2) and then we will use
Maple and the IVT to find an approximate to this solution.
x2 
x  1 implies that x 2 
x 1  0
2
Let f ( x )  x 
x  1 . The function f is continuous on the closed interval
2
[1, 2] since the function y  x is continuous on the interval [1, 2] and the function
y  x  1 is continuous on [1, 2]. Since f is the difference of two functions
which are continuous on the closed interval [1, 2], then f is continuous on this
interval. We will apply the IVT using the closed interval [1, 2].
f (1)  1 
f ( 2)  4 
2  0
3  0
Thus, by the IVT, there exists a number c in the open interval (1, 2) such that
f (c)  0.
2
Since f ( x )  x 
x  1 , then f ( c )  0 implies that c 2 
2
This implies that c is a solution (root) of the equation x 
2
is also a solution (root) of the original equation x 
c 1  0.
x  1  0 , which
x 1 .
Also, since f ( c )  0 , then c is the x-coordinate of the x-intercept of the graph
y  f ( x )  x2 
x 1 .
Let's
use
Maple
to
graph
the
function
y  x 2  x  1 and find an approximation to this solution (root), which is
accurate to six decimal places.
Recall, an approximation a to the solution c of an equation is accurate to n decimal
n
places if a  c  0.5 * 10 . That is, the absolute value of the difference
between c, the solution, and a, the approximation to this solution, is less than 0.5
times 10 raised to the negative nth power. But how can you determine this if you
don't have c, the solution to the equation. Well, find two approximations a 1 and
a 2 to the solution c such that a 1  c  a 2 and a 1  a 2  0.5 * 10  n . That
is, find two approximations such that the solution c is between these two
approximations and that the absolute value of the difference between these two
approximations is less than 0.5 times 10 raised to the negative nth power. Then use
either a 1 or a 2 as your approximation to the solution c.
Thus, for this problem, to find an approximation to the solution c of the equation
x 2  x  1  0 which is accurate to six decimal places, we will need to find
two approximations a 1 and a 2 to the solution c such that a 1  c  a 2 and
a 1  a 2  0.5 * 10  n .
> restart:
> f := x -> x^2 - sqrt(x+1);
f :   x 2 
> f(x);
2
x > plot(f(x), x=1..2);
x+1
x 1
Note: since we know that there is a solution to the equation between 1 and 2 by the
IVT, then we only need to graph the function f on the interval (1, 2). From the
graph, it appears that the solution (root) is between 1.2 and 1.3. At this point, if we
pick any number in the interval [1.2, 1.3] for the solution (root), the error for our
solution is at most 1.3 - 1.2 = 0.1. Now, let's graph f on the interval [1.2, 1.3].
> plot(f(x), x=1.2..1.3);
From this graph, it appears that the solution (root) is between 1.22 and 1.23. At
this point, if we pick any number in the interval [1.22, 1.23] for the solution (root),
1
the error for our solution is at most 1.23  1.22  0.01  0.1 * 10
and our
solution is correct to at least one decimal place. Now, let's graph f on the interval
[1.22, 1.23].
> plot(f(x), x=1.22..1.23);
From this graph, it appears that the solution (root) is between 1.220 and 1.221. At
this point, if we pick any number in the interval [1.220, 1.221] for the solution
2
(root), the error for our solution is at most 1.221  1.220  0.001  0.1 * 10
and our solution is correct to at least two decimal places. Now, let's graph f on the
interval [1.220, 1.221].
> plot(f(x), x=1.220..1.221);
From this graph, it appears that the solution (root) is between 1.2206 and 1.2208.
At this point, if we pick any number in the interval [1.2206, 1.2208] for the solution
(root), the error for our solution is at most 1.2208  1.2206  0.0002 
0.2 * 10  3 and our solution is correct to at least three decimal places. Now, let's
graph f on the interval [1.2206, 1.2208].
> plot(f(x), x=1.2206..1.2208);
From this graph, it appears that the solution (root) is between 1.22074 and 1.22076.
At this point, if we pick any number in the interval [1.22074, 1.22076] for the
solution (root), the error for our solution is at most 1.22076  1.22074 
0.00002  0.2 * 10  4 and our solution is correct to at least four decimal places.
We can continue this process of "zeroing in" on the solution (root). However, we
can also keep applying the IVT by evaluating the function f at the following
numbers starting at 1.220740 and increasing the digit in the millionths place by one
until we reach 1.220750. We will see that our solution (root) is somewhere
between these two numbers. We want to identify the first place where the value of
the function changes sign. This could be from positive to negative or from negative
to positive.
> f(1.220740); f(1.220741); f(1.220742); f(1.220743);
f(1.220744);
f(1.220745);
f(1.220746);
f(1.220747);
f(1.220748); f(1.220749); f(1.220750);
-0.000008602
-0.000006496
-0.000004390
-0.000002284
-1.78 10
-7
0.000001928
0.000004034
0.000006140
0.000008246
0.000010352
0.000012457
Note: f (1.220744 )  0 and f (1.220745 )  0 . The IVT tells us that the
solution (root) is somewhere between 1.220744 and 1.220745. At this point, if we
pick any number in the interval [1.220744, 1.220745] for the solution (root), the
5
error in our solution is at most 1.220745  1.220744  0.000001  0.1 * 10
and our solution is correct to at least five decimal places. Again, we will apply the
IVT. However, let's "speed up" the process by evaluating the function f at
1.2207440, 1.2207445 (the midpoint), and 1.2207450. Again, we want to identify
where the value of the function changes sign.
> f(1.2207440); f(1.2207445); f(1.2207450);
-1.78 10
8.75 10
-7
-7
0.000001928
Note: f (1.2207440 )  0 and f (1.220744 5)  0 . Thus, by the IVT, the root is
between 1.2207440 and 1.2207445. Now, evaluate the function f at the following
numbers starting at 1.2207440 and increasing the digit in the ten-millionths place
by one until we reach 1.2207445.
>
f(1.2207440);
f(1.2207441);
f(1.2207442);
f(1.2207443); f(1.2207444); f(1.2207445);
-1.78 10
3.3 10
-7
-8
2.43 10
-7
4.54 10
-7
6.64 10
-7
8.75 10
-7
Note: f (1.2207440 )  0 and f (1.2207441)  0 . Thus, by the IVT, the
solution (root) is between 1.2207440 and 1.2207441. At this point, if we pick any
number in the interval [1.2207440, 1.2207441] for the solution (root), the error in
6
our solution is at most 1.2207441  1.2207440  0.0000001  0.1 * 10
and
our solution is correct to at least six decimal places.
At this point, we can say that the solution (root) of the equation
x 2  x  1  0 in the interval (1, 2) is approximately 1.2207440 or 1.2207441,
which is accurate to six decimal places. You can continue to apply the IVT in
order to find the root correct to as many decimal places as you want. Let's apply
the IVT one more time.
Note: f (1.2207440 )  0 and f (1.2207441)  0 . Thus, by the IVT, the root is
between 1.2207440 and 1.2207441. Evaluate the function f at 1.22074400,
1.22074405 (the midpoint), and 1.2207441. Again, we want to identify where the
value of the function changes sign.
> f(1.22074400); f(1.22074405); f(1.22074410);
-1.78 10
-7.2 10
3.3 10
-7
-8
-8
Note: f (1.22074405 )  0 and f (1.22074410 )  0 . Thus, by the IVT, the root
is between 1.22074405 and 1.22074410. Now, evaluate the function f at the
following numbers starting at 1.22074405 and increasing the digit in the hundredmillionths place by one until we reach 1.22074410.
>
f(1.22074405);
f(1.22074406);
f(1.22074407);
f(1.22074408); f(1.22074409); f(1.22074410);
-7.2 10
-8
-5.2 10
-8
-3.1 10
-8
-1.0 10
-8
1.1 10
-8
3.3 10
-8
Note: f (1.22074408 )  0 and f (1.22074409 )  0 . Thus, by the IVT, the
solution (root) is between 1.22074408 and 1.22074409. At this point, if we pick
any number in the interval [1.22074408, 1.22074409] for the solution (root), the
error in our solution is at most 1.22074409  1.22074408  0.00000001 
0.1 * 10  7 and our solution is correct to at least seven decimal places. At this
2
point, we can say that the solution (root) of the equation x 
x  1  0 in the
interval (1, 2) is approximately 1.22074408 or 1.22074409, which is accurate to
seven decimal places.
Let's see how well we did with our approximation by asking Maple to solve the
2
equation x  x  1  0 , which is also the equation f ( x )  0 .
> solve(f(x)=0); evalf(%);
4
4
RootOf (-_Z - 1 + _Z , -0.7244919590 ), RootOf (-_Z - 1 + _Z , 1.220744085 )
-0.7244919590, 1.220744085
Our approximations of 1.2207440 or 1.2207441 (correct to six decimal places),
obtained by the IVT, isn't too bad. Of course our approximations of 1.22074408 or
1.22074409 (correct to seven decimal places) are even better. Note: the equation
x 2  x  1  0 also has a solution (root) in the interval (-1, 0).
NOTE: You can also check your answer without using the solve command by
evaluating the function f at your approximation, say 1.22074408:
> f(1.22074408);
-1.0 10
-8
Download