## Calculus Online: Lab 5

Welcome to Lab 5 of Math 100 Sections 103, 104, 107 and 109.

#### Instructions

1. At the bottom of this page you will find a tool for saving and reloading your work. Enter your login id and student number into the fields, and then use the Save and Load buttons.
2. You do not need to complete your work during your lab session. But be sure to save your work before you leave. You can then restore your old session at another time with the Load button.
3. All submissions must be received by 11:59 pm on 23 November 1998.

## Approximations

The derivative has been a useful tool for us so far. For instance, it has helped us determine where a function is increasing or decreasing and where it has extrema. In this lab, we'll look at another application of derivatives: providing approximate solutions to problems we cannot solve exactly.

Remember that we started the course by looking at the graph of a function near a point x0 on a very small scale. When we did this, the graph essentially looked like a straight line which we called the tangent line.

Another way to state this observation is like this:

Near the point x0, the tangent line at x0 provides a good approximation for the graph.

#### Question 1: How to solve equations with Newton's Method

This question will explain a technique called Newton's Method. It's a common problem to encounter equations we cannot easily solve and Newton's Method is a means of finding approximate solutions.

Suppose we would like to solve an equation f(x) = 0. Geometrically, this means that we want the values of x at which the graph of f crosses the x axis. If the graph of f(x) were a straight line, this would be easy. However, in other cases, we might not be able to solve the equation f(x) = 0 directly so we need a technique for finding approximate solutions.

Suppose that we know there is a solution near the point x0 . (We'll see a more concrete example of this in a minute.) If we cannot solve the equation f(x) = 0, we will instead look at the tangent line at the point x0 which is shown in the picture below. The point at which the tangent line crosses the x axis can be thought of as an approximation of the solution to the equation f(x) = 0.

Now we will tackle the specific problem of solving f(x) = x2 - 5 = 0. Of course, we know that a solution is but let's pretend we don't know that. From our experience with squares, we can guess that the square root of five is between 2 and 3 since 22 = 4 and 32 = 9. In fact, let's assume that our initial guess is not even that good: we will just say that we know the solution is somewhere around 1.

Part a (2 marks)

If you select "Question 1a" above, you will see the graph of f(x) = x2 - 5. On this graph, you will also see a point which can be moved together with the tangent line at that point. Move the point to x0 = 1. This is our original guess for the solution.

Part b (2 marks)

Now this is where the fun begins: we make the initial guess that a solution is near x0 = 1 and we produce an approximate solution by considering where the tangent line crosses the axis. We will call this point x1. You should notice that this value is about 3 and it is a better approximation to the solution than x0. Select "Question 1b" above and you will see another dot which can be moved together with its tangent line. Now move the dot to the point x1.

Part c (2 marks)

In Part b, you have found another approximate solution x2 where the tangent line to the graph at x1 crosses the x axis. Notice that this is a better approximation because it is closer to the location of the root that we are trying to find.

Now select "Question 1c" and move the new dot to x2. You may want to zoom in to position the dot carefully. In the same way, this produces a new approximate solution x3 which is an even better approximation. Of course, you could continue this indefinitely, but the approximate solutions start to stabilize at a solution to f(x) = 0. Notice that with three simple steps, we have gotten quite close to the actual solution.

To summarize, starting with a rather bad guess for the value of we have used a repeated procedure to generate better and better approximations to the true value. This is the crux of Newton's method.

#### Question 2: A Practical Example of Newton's Method

Question 1 hopefully convinces you that Newton's Method is a pretty simple trick: you simply replace a problem you cannot solve---find where f(x) = 0 ---by a problem you can solve---find where the tangent line crosses the x axis. This produces an approximate solution and the process can be repeated. When the approximate solutions stabilize, then you have found a solution.

In class, we'll see how to compute using Newton's Method, but for now, we'll take it for granted that this can be done. In this question, we would like to find the roots of the degree 3 polynomial: Below is a device which will perform Newton's Method for you. Simply enter a value for x0 and click the Step button. You will see the next approximate solution appear. If you click the button again, you will see the next result and so on.

Part a (2 marks)

Select "Question 2a" above and enter an inital guess as to where a root to the polynomial p(x) is. Use the "Step" button to find a root by repeating the process until the result stabilizes.

Part b (2 marks)

Select "Question 2b" above and find another root to the polynomial p(x) by making a different initial guess. If you cannot quickly find a different root, you may wish to think about the polynomial for a minute (for instance, where are its critical points?)

#### Question 3: Euler's Method Explained

In the last two problems, we used Newton's Method to find approximate solutions to algebraic equations. In this problem, we will describe Euler's Method, a means of finding approximate solutions to differential equations.

We will consider the differential equation together with the initial value y(0) = 1. Of course, we know that a solution is y(t) = e-t so there is no need to find an approximate solution. However, we will pretend that we don't know this so that we we might illustrate the method.

Shown below is the graph of the solution y(t) = e-t. We will build an approximate solution piece by piece. The approximate solution will not be a formula or a smooth function. Rather, it will consist of a collection of straight line segments which approximately "track" the true solution.

Part a (1 mark)

Select "a", enter the initial value y(0) for the function in the window above the graph and press the button "OK". You will see a dot appear on the graph at the corresponing point.

Part b (1 mark)

Since the differential equation is and y(0) = 1, what is the slope of the tangent line (i.e. the derivative) at t = 0? Select "b" above, enter the slope and click "OK". You should see the tangent line appear.

Part c (1 mark)

Generally, we apply Euler's Method when we do not know the solution of the differential equation. So we approximate the solution by the tangent line whose graph we have just constructed.

Select "c" above and enter the approximate value of the solution at t = 0.5 obtained from the tangent line. When you click "OK", you should see a dot appear on the tangent line you constructed in Part b.

Part d (1 mark)

As in Newton's Method, we can repeat this idea. Remember that the differential equation is Using your value for the approximate solution in Part c, what is the approximate slope of the tangent line at t = 0.5. (It is minus the value you entered in Part c. Why?) Select "d" above, enter your result and click "OK". You will see the next piece of the approximation.

Part e (1 mark)

What is the value of your approximation at t = 1. Select "e" above, enter your result and click "OK".

The idea you have just seen is called Euler's Method. The point is that we often face a differential equation which cannot be easily solved. However, the differential equation gives us the slope of the tangent line and so we can approximate the solution by the tangent line. We can stop every so often and take a new bearing: the differential equation will give us a new slope at our approximate position. You can see that our approximate solution does indeed track the actual solution.

#### Question 4: A Practical Example of Euler's Method (2 marks)

In the last question, we saw how to build approximate solutions to a differential equation by approximating the solution with its tangent lines. Of course, the tangent line at some point only looks like the graph near that point. You can see this above: the further away from the original point we get, the worse the approximation is. We can get a better approximation by taking more and smaller steps: this guarantees that the tangent line is only being used in a region where the approximation is relatively good.

In this question, we will look at the differential equation You may recognize this as the differential equation from the last question in Lab 4. We will build an approximate solution to this differential equation with the initial value y(0) = 0.8 If you look below, you will see a graph with a window above it. Using this window, you can experiment with the number of steps and see how an increase in the number of steps produces different approximate solutions. Begin with a small number of steps and steadily increase. You should see that the approximations start to stabilize when you use a large number of steps.

Enter the approximate time for which y(t) = 0.2 in the window below the graph.

The important thing to notice is that we originally had no idea about how the solution to this equation behaved quantitatively. (We did see how it behaved qualitatively in Lab 4.) However, Euler's Method gives us a means to build approximate solutions to any degree of accuracy by increasing the number of steps.

You have now completed the lab. If technical problems prevent your answers from being saved, you should receive a message telling you so and giving you the option to send your work by email. If you submit in this way, please include your login name in the email message.

How did you like this lab? Was it interesting, challenging, frustrating, difficult, boring, fun? Please let us know by sending us email.