## Euler's Method

We have seen how to use a direction field to obtain qualitative information about the solutions to a differential equation. This simple kind of reasoning lead to predictions for the eventual behaviour of solutions to the logistic equation.

Sometimes, however, we want more detailed information. For instance, we might want to know how long it will take before the solution is near the limiting value. In this case, we can use the linear approximation to numerically approximate solutions to differential equations. We will demonstrate this approach through an example.

A Simple Initial Value Problem

Let's start by looking at an initial value problem whose solution is known:

We know that the solution is . This means that after we find our approximate solution, we will be able to determine how good of an approximation it really is.

Let's suppose that we are interested in the value of the solution at . We know the value at since that is a part of the initial value problem---namely, . Notice that the differential equation also tells us the derivative of the solution at since

If we now form the linear approximation at , we find that . Then our approximation yields

This approximation is not too good but it was easy to obtain. Graphically, the picture is like this:

The problem with the approximation is that the derivative of the solution is changing across the interval but the approximation assumes that it is constantly 1 . We can try to fix this up by diving the interval into two pieces: First, we will use the linear approximation based at to approximate the value at . Then we will use a linear approximation at to obtain an approximate value at .

We have already obtained the linear approximation based at . This produces the approximate value . This tells us that the solution curve approximately passes through . That means that

We will then form the linear approximation at the point : it produces

which yields the approximation . This is, in fact, a better approximation to the value . Graphically, what we have done is illustrated in the diagram.

Here you can see why we have a better approximation: the derivative of the solution changes as we move across the interval . In the second approximation, we take this into account by stopping at , recomputing the derivative and then continuing on.

Now you can probably imagine that we will get better approximations if we take shorter steps and correct the slope at every step. To do this, imagine walking from 0 to 1 by taking n steps, each of width . We will call the points we obtain .

Notice that since this is where the initial value problem tells us to begin. To get from one step to the next, we are assuming that the solution approximately passes through . At that point, the derivative, which is equal to the y coordinate by the differential equation, is . That means that the linear approximation at that point is

This means that at , we have

The following demonstration will let you select the number of steps and show you the approximate solution (type in the number of steps and press "Return"). Notice that as the number of steps gets larger, the approximation becomes very good.

Euler's Method

Now we will work with a general initial value problem

We will again form an approximate solution by taking lots of little steps. We will call the distance between the steps h and the various points . To get from one step to the next, we will form the linear approximation at . The derivative at this point is given by the differential equation: . The linear approximation is then

so that

This technique is called Euler's Method.

The logistic equation

Now we will consider the initial value problem

Notice that this has the basic form of the logistic equation. We have studied this equation qualitatively, but we do not explicitly know solutions. As an example, we will approximate the solution on the interval by taking steps of width h.

Applying Euler's Method, we can generate an approximate solution by

In the demonstration below, you can enter the number of steps and see the approximate solution. Again, as you take more steps, the solution does not vary too much when you increase the number of steps. You can then feel confident that your solution is a good approximation.