We want to estimate a solution to the differential equation $f '(x) = P(x,y)$ where $P(x,y)$ indicates a number that depends (possibly) on both the values of $x$ and $y$. [In other words $P(x,y)$ is a function of the two variables $x$ and $y$.] You might think of $x$ as time and $y$ as position in the dynamic interpretation so that we have a context where the velocity is determined by time and position. In an economic interpretation you might think of $x$ as units of production and as $y$ the total cost of production so that we have the marginal cost determined by level of production and current total cost.]

Step 1. First, suppose that we are given $a=x_0$ and $f (x_0) = y_0$.

Step 2. We choose a value for $h = dx$ and then let $x_1 = x_0 + h$.

Step 3. Now we estimate $f (x_1)$ by $y_1= y_0 + P(x_0 , y_0) \cdot h$.

See figure at right.

Step 4. We continue by letting $x_2 = x_1 + h$ and estimate $f (x_2)$ by $y_2= y_1 + P(x_1 , y_1) \cdot h$.

See figure at right.

In general (see Table CIS.EM.T1) we let $x_{k+1} = x_k + h [= x_0 + (k+1)\cdot h]$.

and estimate $f (x_{k+1})$ by $y_{k+1}= y_k + P(x_k , y_k) \cdot h$.

$n$ |
$x_n$ |
$y_n$ |
$f'(x_n)=P(x_n,y_n)$ |
$dy_n=P(x_n,y_n)\cdot h$ |

$0$ |
$x_0=a$ |
$y_0$ |
$P(x_0 , y_0)$ | $dy_0=P(x_0,y_0)\cdot h$ |

$1$ |
$x_1 = x_0 + h$ | $y_1= y_0 + dy_0$ | $P(x_1 , y_1)$ | $dy_1=P(x_1,y_1)\cdot h$ |

$2$ |
$x_2 = x_1 + h$ | $y_2= y_1 + dy_1$ | ||

. . . |
. . . |
. . . |
. . . |
. . . |

$k$ |
$x_k$ |
$y_k$ |
$P(x_k , y_k)$ | $dy_k=P(x_k,y_k)\cdot h$ |

$k+1$ |
$x_{k+1} = x_k+ h$ | $y_{k+1}= y_k + dy_k$ | ||

. . . |
. . . |
. . . |
. . . |
. . . |

$n$ |
$x_n = x_{n-1} + h$ | $y_{n}= y_{n-1} + dy_{n-1}$ |

If $x_0 = a$ and $x_n = b$ then we have that $f (b)$ is estimated by $y_n$ found after $n$ applications of this method.

Since $b=x_n=x_0+n∗h=a+n∗h$, if we wish to use this method to estimate $f (b)$ starting from $f (a)$ in $n$ steps of equal length, then we use $h=\frac {b−a}n$.

The visualization of this method with mapping diagrams as well as on a graph is shown below with GeoGebra.

When # var = 1, $P(x)= \frac1{x+1}; a=0, b=1, f(a)=2,$ and $n = 4$.

When # var = 2, $P(x,y) = y+x; a=0, b=1, f(a)=2,$ and $n = 4$.

The sliders can be used to change the values of $a, b$ and $n$. You can change the value of $f(a)= y_0$ by entering a new value in the appropriate input box.

Check the appropriate box to see:

- A step by step visualization of Euler's mthod using the slider
**k**that will appear for the step number.with the related table of values for the computations.

- All the steps in Euler's method together with the related table of values for the computations.
- The slope field for the
differential equation on the graph.

- The solution for the initial value problem if possible from GeoGebra's DE solver.

If $\frac {dy}{dx}$ depends only on the variable $x$ use # var = 1. Otherwise move the slider so # var = 2. and you can change the function $P(x,y)=f '(x,y)$ by entering a function of $x$ and $y$ in the input box where indicated.You can change the scales on the target axis of the mapping diagram with the slider for the Target Scale Factor.

To gain more experience with Euler"s method, set $P(x)=2x$ with $a=x_0=0, b=x_n=1$ and $f(a)= y_02$. The solution of this differential equation with initial condition is $f(x) =x^2 +2$, so $f(1)=3$. Compare this with $y_n$ in Euler's method with $n = 4, n= 10$, and $n=20$.