Euler’s Method and Local Slopes

Approximate an initial-value problem and compare numerical steps with an exact solution.

Builds on Nonlinear Systems and Local Linearization

The bigger question: How do we trust a numerical trajectory?

On this page

The idea

Euler’s method follows the tangent line over a short time step. Starting from (tn,yn)(t_n,y_n), it uses the slope f(tn,yn)f(t_n,y_n) throughout the next step. The result is an approximation to the solution, not a new exact solution of the original equation.

Method and assumptions

With step h>0h>0, set tn+1=tn+ht_{n+1}=t_n+h and yn+1=yn+hf(tn,yn)y_{n+1}=y_n+h f(t_n,y_n). Repeat to the desired time, shortening the final step if necessary. For sufficiently smooth, well-behaved problems over a fixed finite interval, the one-step defect is order h2h^2 and accumulated global error is order hh.

Worked example: one decay step

For y′=−yy'=-y, y(0)=1y(0)=1, and h=1/2h=1/2, Euler gives y1=1−1/2=1/2y_1=1-1/2=1/2. The exact value is e−1/2≈0.6065e^{-1/2}\approx0.6065, so the numerical step decays too far.

Worked example: refining at the same endpoint

At t=1t=1, two steps with h=1/2h=1/2 give (1/2)2=0.25(1/2)^2=0.25. Four steps with h=1/4h=1/4 give (3/4)4≈0.3164(3/4)^4\approx0.3164. The exact value is e−1≈0.3679e^{-1}\approx0.3679. Smaller steps reduce the error here, but require more evaluations.

Interpreting the result

Compare methods at the same final time. A smoother-looking polyline does not prove accuracy. Step refinement, exact checks when available and stability analysis provide stronger evidence.

Explore

Exact decay versus Euler steps

Try this. Keep the decay rate at 1 and compare 4, 8 and 16 steps. Then use rate 3 with one step: the numerical result fails to follow exact decay. Refine the steps to recover the shape.

Exact decay versus Euler steps00.5100.511.52ty
y′ = −1y, y(0) = 1. At t = 2: exact 0.135, Euler 0.063, signed error -0.073. Step h = 0.5; update factor = 0.5. Euler is in its decay stability range. Green: exact; orange: Euler; gray: slope field. Vertical scale adjusts to include the approximation.

This explorer compares Euler steps with the exact solution of y′=−kyy'=-ky on 0≤t≤20\le t\le2. Change the decay rate, starting value or step count and compare error with the stability factor.

PAUSE & THINKA quick check, not a grade

Try it yourself.

Choose an answer and explain your reasoning to yourself. Use a hint if you get stuck.

Euler’s method uses y′=y, y₀=1 and h=0.1. What is y₁?

Hint 1 · Find a starting point

Euler takes one step along the current slope.

Hint 2 · Take the next step

Use y₁=y₀+h f(t₀,y₀).

Show the reasoning

Answer: 1.1

1+0.1×1=1.1. This approximates, but is not exactly, e⁰·¹.

Before moving on: what would make one of the other answers wrong? Saying why is part of understanding.

Practice

  1. Take one Euler step for y′=t+yy'=t+y from (0,1)(0,1) with h=0.1h=0.1.
  2. What is the decay amplification factor for y′=−kyy'=-ky?
  3. How many equal steps of 0.050.05 reach t=1t=1 from zero?
Show worked solutions
  1. y1=1+0.1(0+1)=1.1y_1=1+0.1(0+1)=1.1.
  2. 1−kh1-kh, so yn+1=(1−kh)yny_{n+1}=(1-kh)y_n.
  3. 2020 steps.

Further study

MIT OpenCourseWare: Differential Equations provides a full university course with additional lectures and exercises.

MAKE IT YOURS

Pause before the next idea.

Can you explain how the visualization connects to this lesson’s goal? If a step still feels uncertain, put this lesson on your review list and try the check again another day.

Optional marks, not a grade. Saved in this browser only. Open notebook →