Back to the on-screen lesson ·

Euler's method

Stepping along the slope field, why the error over a whole interval is one order worse than the error of one step, and the first sign that a step can be too large for reasons other than accuracy.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to carry out Euler's method step by step, distinguish the local truncation error from the global error and derive one from the other, predict which way the method errs on a curving solution, and recognise a run whose step size has made it unstable.

2. What you already know

You can read a slope field and you know that an initial value problem has a unique solution under mild conditions. You also know, from composite quadrature, that summing many small errors over a fixed interval hands back one power of the step.

3. The words this lesson uses

An initial value problem is $y' = f(t, y)$ with $y(t_0)$ given. The local truncation error is what a single step gets wrong, starting from the exact value; the global error is the gap at the end of a fixed interval. A method is of order $p$ when its global error is proportional to $h^{p}$. A method is explicit when each step is computed from values already known.

4. Euler's method

Follow the slope field. From $(t_n, y_n)$, evaluate the slope there and move along it for one step: $y_{n+1} = y_n + h f(t_n, y_n)$. Taylor's theorem says what that leaves out: $y(t+h) = y(t) + hy' + \tfrac12 h^{2}y''(\xi)$, so one step is wrong by about $\tfrac12 h^{2}y''$ — the local truncation error, second order. Over a fixed interval of length $L$ there are $L/h$ steps, and the errors accumulate rather than cancel when the solution curves one way throughout, so the global error is about $\tfrac12 Lhy''$: first order. That is the order a method is named by, and it is why halving the step only halves the answer's error — an expensive exchange. Euler under-shoots a solution that curves upwards, because it commits to the slope at the start of a step while the true slope grows across it. And for a decaying solution something worse than inaccuracy is available: the step multiplies by $1 + h\lambda$, and if that is larger than one in size, the computed solution grows while the true one decays. That is instability, it is a condition on $h$, and it is the subject of the last lesson of this course.

Another way: picture

The slope field is a field of little arrows. Euler's method starts at the given point, reads the arrow it is standing on, and walks in that direction for a fixed distance — then reads the arrow where it has arrived. Between readings it ignores the field entirely, and that is where the error lives.

Another way: steps

  1. Evaluate the slope at the current point.
  2. Multiply by the step size.
  3. Add to the value, then advance the time.
  4. Repeat, and remember that halving the step only halves the final error.

5. The mistake to watch for

Local and global error differ by a power of $h$, and quoting the wrong one is the standard slip. The name of a method refers to its global order: Euler is first order although its local error is $h^{2}$, and Heun is second although its local error is $h^{3}$. The arithmetic is always the same — multiply the local error by $L/h$ steps — and it is worth doing once rather than remembering four numbers.

6. Euler lagging behind

  1. $y' = y$, $y(0) = 1$, $h = \tfrac12$: each step multiplies by $1.5$.

    Two steps give $2.25$.

  2. The true value at $t = 1$ is $e \approx 2.718$.

    Euler is well short.

  3. $1.5$ is the first two terms of the series for $e^{1/2}$, and the terms left out are the error.

    Truncation, named literally.

7. Halving the step

  1. The same problem with $h = \tfrac14$ takes four steps of $1.25$: $2.4414$.

    Closer.

  2. The errors are about $0.468$ and $0.277$ — a ratio near $\tfrac12$, not $\tfrac14$.

    First order, confirmed.

  3. Reaching six digits this way would take about a million steps, which is the argument for every method in the next three lessons.

    First order is rarely enough.

8. Your turn: one Euler step on $y' = t + y$ from $y(0) = 1$ with $h = \tfrac12$

  1. The slope at $(0, 1)$ is $0 + 1 = 1$.

  2. So $y_1 = 1 + \tfrac12 \times 1 = 1.5$, at $t = \tfrac12$.

  3. Your turn: work this step out. Its working is at the end of the packet.

    The slope at the new point is $\tfrac12 + 1.5 = 2$, which is what the next step will use — and which was already larger during the step just taken.

9. Guided practice

Solve $y' = 3t$ with $y(0) = 3$ by Euler's method with step $\tfrac12$. Fill in the value at each of the first three steps.

Computed value
At t = 1/2
At t = 1
At t = 3/2

10. Guided practice

Euler's method is run over a fixed interval with $32$ steps. How do the error of a single step and the error at the end of the interval depend on the step size?

11. Practice

Put one step of Euler's method, inside a loop of $13$ steps, into order.

Number the steps in order (write the number in the box):

12. Practice

Solve $y' = t$ with $y(0) = 0$ by Euler's method with step $1$, and plot the computed value after each of the first three steps.

Plot your answer on the grid:

12342468101214161820stepcomputed value

13. Somewhere new

Solve $y' = -4y$ with $y(0) = 3$ by Euler's method with step $1$. What is the computed value after two steps?

Answer:

14. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

15. Test question

Solve $y' = 3y$ with $y(0) = 1$ by Euler's method with step $\tfrac12$. Give the value after one step and after two.

After one step one, after two steps two

16. What you can do now

You can run Euler's method, state its local and global orders and say which way it errs. Say in your own words why a method whose single step is second order is called first order.

Working for the steps left to you

8. Your turn: one Euler step on $y' = t + y$ from $y(0) = 1$ with $h = \tfrac12$, step 3