Tutorials › Calculus I › A Worked Comparison of Euler Step Sizes

Euler's Method and Numerical Solutions · Tutorial 1456 of 1495

A Worked Comparison of Euler Step Sizes

Work through one initial-value problem at several step sizes to see how Euler’s endpoint accuracy changes as the computation requires more steps.

Advanced 9 min read

What You'll Learn

  • Set up forward Euler on a fixed interval using a uniform step size.
  • Compute endpoint estimates for the same initial-value problem at four step sizes.
  • Compare each Euler estimate with the exact endpoint value.
  • Distinguish observed error reduction from a guaranteed exact halving of error.
  • Count the updates and slope evaluations required at each step size.

Why Compare Step Sizes?

Forward Euler gives an approximate solution to an initial-value problem by repeatedly using the slope at the current point to estimate the next value. A smaller step usually gives a more accurate approximation, but it also requires more updates. Comparing step sizes makes this trade-off concrete: it shows how much the estimate changes and what extra computational work is involved.

We will use the same initial-value problem and the same time interval throughout, changing only the uniform step size. Because this problem has an exact solution, we can also measure the endpoint error rather than judging accuracy from the Euler estimates alone.

Uniform Forward Euler Steps

Definition: For an initial-value problem \(y'=f(t,y)\), \(y(t_0)=y_0\), choose a uniform step size \(h>0\). At step \(k\), forward Euler uses $$ t_k=t_0+kh,\qquad y_{k+1}=y_k+h f(t_k,y_k). $$ The slope is evaluated at the current point \((t_k,y_k)\); the resulting update estimates the solution at \(t_{k+1}\). To reach a specified endpoint \(T\) with equal steps, choose an integer \(n\) and set \(h=(T-t_0)/n\).

Here \(y_k\) denotes the Euler estimate at time \(t_k\), not necessarily the exact value \(y(t_k)\). Each step requires one evaluation of \(f\), followed by one update. We will estimate the solution at \(T=1\), starting from \(t_0=0\), and compare \(n=1,2,4,\) and \(8\) equal steps.

The Initial-Value Problem and Benchmark

Consider

$$ y'=y,\qquad y(0)=1,\qquad 0\le t\le 1. $$

The exact solution is \(y(t)=e^t\): its derivative is \(e^t\), which equals \(y(t)\), and its initial value is \(e^0=1\). Thus the exact endpoint value is \(y(1)=e\), approximately \(2.718281828\). We will use this value as a benchmark for the Euler estimates.

For this particular equation, the Euler update at any step is especially simple:

$$ y_{k+1}=y_k+h y_k=(1+h)y_k. $$

Each update multiplies the current estimate by the same factor, \(1+h\). That makes it possible to show all the intermediate values and to compare computations of different sizes directly.

Worked Example: One Step Across the Interval

Worked Example: One Step Across the Interval

Take \(n=1\), so \(h=(1-0)/1=1\). Begin with \(t_0=0\) and \(y_0=1\). The slope at the initial point is \(f(0,1)=1\), so the single Euler update gives

$$ y_1=y_0+h f(t_0,y_0) =1+1(1) =2. $$

The endpoint estimate is therefore \(y_1=2\) at \(t_1=1\). Compared with the exact endpoint value \(e\), its absolute error is

$$ |e-2|=e-2\approx 0.718281828. $$

Check the update: the step starts at \((0,1)\), uses slope \(1\), and moves one time unit, giving \(1+1=2\), as computed. This computation uses one slope evaluation and one update.

Worked Example: Two Uniform Steps

Worked Example: Two Uniform Steps

Take \(n=2\), so \(h=(1-0)/2=1/2\). The initial estimate is \(y_0=1\). At \(t_0=0\), the slope is \(f(0,1)=1\), giving

$$ y_1=1+\frac12(1)=\frac32. $$

Now \(t_1=1/2\), and the current estimate is \(y_1=3/2\). Since \(f(t,y)=y\), the slope at this point is \(3/2\). The second update is

$$ y_2=\frac32+\frac12\left(\frac32\right) =\frac32+\frac34 =\frac94 =2.25. $$

The endpoint estimate is \(9/4=2.25\). Its absolute error is

$$ \left|e-\frac94\right| =e-\frac94 \approx 0.468281828. $$

Check by applying the update factor twice: \((1+h)^2y_0=(3/2)^2(1)=9/4\), which agrees with the two individual steps. This computation uses two slope evaluations and two updates.

Worked Example: Four Uniform Steps

Worked Example: Four Uniform Steps

Take \(n=4\), so \(h=1/4\). The multiplier at each step is \(1+h=5/4\). Starting from \(y_0=1\), the successive estimates are

$$ \begin{aligned} y_1&=1\left(\frac54\right)=\frac54,\\ y_2&=\frac54\left(\frac54\right)=\frac{25}{16},\\ y_3&=\frac{25}{16}\left(\frac54\right)=\frac{125}{64},\\ y_4&=\frac{125}{64}\left(\frac54\right)=\frac{625}{256}=2.44140625. \end{aligned} $$

The four times are \(0,1/4,1/2,3/4,1\), so \(y_4\) is the endpoint estimate. Its absolute error is

$$ \left|e-\frac{625}{256}\right| =e-\frac{625}{256} \approx 0.276875578. $$

Check the endpoint by multiplying the initial estimate by the update factor four times: \((5/4)^4(1)=625/256\), as found by the step-by-step calculation. The computation requires four slope evaluations and four updates.

Worked Example: Eight Uniform Steps

Worked Example: Eight Uniform Steps

Take \(n=8\), so \(h=1/8\). Each update multiplies the current value by \(9/8\). The full sequence of estimates is

$$ \begin{aligned} y_0&=1,\\ y_1&=\frac98,\\ y_2&=\frac{81}{64},\\ y_3&=\frac{729}{512},\\ y_4&=\frac{6561}{4096},\\ y_5&=\frac{59049}{32768},\\ y_6&=\frac{531441}{262144},\\ y_7&=\frac{4782969}{2097152},\\ y_8&=\frac{43046721}{16777216} \approx 2.565784514. \end{aligned} $$

Thus the endpoint estimate is \(y_8=43046721/16777216\). Its absolute error is

$$ \left|e-\frac{43046721}{16777216}\right| \approx 0.152497315. $$

As a check, eight applications of the same Euler multiplier give \(y_8=(9/8)^8y_0=43046721/16777216\), matching the listed updates. This calculation uses eight slope evaluations and eight updates.

Comparing Accuracy and Computational Effort

The estimates and errors below are rounded to nine decimal places for display. The calculations above retain exact fractions where practical. Each choice reaches the same endpoint, \(t=1\), and uses \(n\) slope evaluations and \(n\) updates.

Steps \(n\) Step size \(h\) Euler estimate at \(t=1\) Absolute endpoint error Slope evaluations
1 1 2.000000000 0.718281828 1
2 0.5 2.250000000 0.468281828 2
4 0.25 2.441406250 0.276875578 4
8 0.125 2.565784514 0.152497315 8

For this example, halving the step size lowers the endpoint error each time, while the number of slope evaluations doubles. The reduction is not an exact factor of two: the error changes from about \(0.4683\) to \(0.2769\), then to \(0.1525\). In general, it is unsafe to assume that halving a step size will halve the error exactly. The observed changes depend on the problem and on the step sizes being compared.

Why These Estimates Approach the Exact Value

For \(n\) uniform steps over the interval from \(0\) to \(1\), \(h=1/n\). Since every step multiplies the estimate by \(1+1/n\), the endpoint estimate is

$$ y_n=\left(1+\frac1n\right)^n. $$

This formula explains the pattern in the examples: increasing \(n\) changes the multiplier but also applies it more times. It also gives a direct justification that these estimates lie below \(e\) and converge to it.

Derivation: For \(x>0\), define \(\phi(x)=x-\ln(1+x)\). Since \(\phi(0)=0\) and $$ \phi'(x)=1-\frac{1}{1+x}=\frac{x}{1+x}>0, $$ we have \(\ln(1+x)<x\). Also define \(\psi(x)=\ln(1+x)-x+x^2/2\). It satisfies \(\psi(0)=0\) and $$ \psi'(x)=\frac{1}{1+x}-1+x=\frac{x^2}{1+x}\ge 0. $$ Therefore \(x-x^2/2\le \ln(1+x)<x\) for \(x>0\). Substituting \(x=1/n\) and multiplying by \(n\) gives $$ 1-\frac{1}{2n}\le n\ln\left(1+\frac1n\right)<1. $$ Exponentiating yields $$ e^{\,1-1/(2n)}\le \left(1+\frac1n\right)^n<e. $$ As \(n\) increases, the lower bound approaches \(e\), while the upper bound is \(e\). Hence these endpoint estimates approach \(e\) from below.

This argument establishes convergence for this particular initial-value problem. It does not say that every Euler computation behaves this way: the equation, interval, and step size matter. It does explain why the four estimates in our table are below the exact endpoint and move closer to it as the steps become finer.

A Practical Comparison

A step-size comparison is useful when choosing between computational cost and accuracy. Keep these points in view:

  • Compare the same endpoint. Otherwise, differences in estimates may reflect different intervals rather than different step sizes.
  • Count the steps. On a fixed interval of length \(T-t_0\), using \(n\) uniform steps requires \(n\) updates and, ordinarily, \(n\) evaluations of \(f\).
  • Use a benchmark when one is available. Here the exact value \(e\) lets us calculate actual endpoint errors.
  • Do not mistake a trend for an exact rule. Smaller steps improve the estimates in this example, but the listed errors do not halve exactly when the step size is halved.
Common pitfall: A smaller step size does not mean fewer computations. For example, on the unit interval, \(h=1/8\) requires eight steps, not one. Nor should the last Euler value be treated as the exact solution: for \(h=1/8\), it is \(2.565784514\) to nine decimal places, while the exact endpoint is approximately \(2.718281828\). The error is the difference between these values, about \(0.152497315\).

The comparison therefore has two parts: how close the endpoint estimate is to the target value, and how many steps it took to produce that estimate. Reporting both makes a numerical result more informative than reporting an endpoint approximation alone.

Check Your Understanding

Use the problem \(y'=y,\ y(0)=1\) on \(0\le t\le 1\) to answer the following questions.

  1. For \(n=2\), what is the step size, and what slope is used at the second step?
  2. Write the endpoint estimate for \(n\) uniform steps as a power of \(1+1/n\).
  3. How many Euler updates and slope evaluations are required when \(n=8\)?
  4. For \(n=4\), calculate the absolute endpoint error using the exact value \(e\).
  5. Why does halving the step size not guarantee that the endpoint error is exactly halved?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon