Tutorials › Calculus II › Local and Global Error in Euler Integration

Taylor Methods in Computation · Tutorial 891 of 998

Local and Global Error in Euler Integration

Distinguish Euler’s one-step error from its accumulated error, prove the global first-order bound, and test it on solvable initial-value problems.

Advanced 10 min read

What You'll Learn

  • Define Euler’s one-step local error and distinguish it from global error at a mesh point.
  • Use a bound on the solution’s second derivative to estimate the local Taylor remainder.
  • Derive a global error bound using a Lipschitz condition on the differential equation.
  • Explain why a local error of order h squared leads to a global error of order h.
  • Check Euler error calculations against exact solutions of initial-value problems.

Why Local Error Is Not the Whole Error

Euler’s method advances a numerical solution one step at a time. At each step, it uses the slope at the left endpoint to estimate the solution at the right endpoint. The difference between that one-step estimate and the exact solution is a local error. But after many steps, the numerical value being advanced is already approximate, so each new slope is evaluated at an approximate solution.

For a fixed time interval, Euler’s local error is typically proportional to the square of the step size, while its accumulated global error is proportional to the step size itself. Understanding the distinction explains why halving the step size usually reduces the final error by about a factor of two, not four.

Consider the initial-value problem \(y'=f(t,y)\), \(y(0)=y_0\), on an interval \([0,T]\). For a constant step size \(h=T/N\), where \(N\) is a positive integer, Euler’s method defines

$$ t_n=nh,\qquad y_{n+1}=y_n+h f(t_n,y_n),\qquad n=0,\ldots,N-1. $$

Here \(y_n\) is the numerical approximation at \(t_n\), while \(y(t_n)\) denotes the exact solution at that same time.

Definition: The one-step local error at \(t_n\) is the difference between the exact solution after one step, starting from the exact value \(y(t_n)\), and the Euler step starting from that same exact value: $$ r_n=y(t_{n+1})-y(t_n)-h f(t_n,y(t_n)). $$ The global error at \(t_n\) is \(e_n=y(t_n)-y_n\). Its magnitude is \(|e_n|\). The local error measures one step with an exact starting value; the global error measures all the effects of the numerical steps taken so far.

How the One-Step Remainder Arises

Suppose the exact solution is twice continuously differentiable and satisfies \(|y''(t)|\le M\) throughout \([0,T]\). Since \(y'=f(t,y(t))\), the fundamental theorem of calculus gives

$$ r_n =\int_{t_n}^{t_{n+1}}\bigl(y'(s)-y'(t_n)\bigr)\,ds. $$

The mean value theorem applied to \(y'\) gives \(|y'(s)-y'(t_n)|\le M(s-t_n)\). Integrating this bound shows that

$$ |r_n| \le \int_{t_n}^{t_{n+1}} M(s-t_n)\,ds =\frac{M h^2}{2}. $$

This is the one-step Taylor remainder bound. It says that the local error is at most a constant times \(h^2\), provided the second derivative stays bounded. This estimate alone does not yet bound the error after \(N\) steps: the numerical solution does not start each step from the exact value.

Worked Example: The Local Error for an Exponential Solution

Consider \(y'=y\), \(y(0)=1\). The exact solution is \(y(t)=e^t\), because its derivative is \(e^t\) and it satisfies the initial condition. At \(t=0\), take one Euler step of size \(h=0.1\).

The exact value after the step is \(e^{0.1}\approx 1.105170918\). The Euler value, starting from the exact initial value \(1\), is \(1+0.1(1)=1.1\). Therefore the one-step local error is

$$ r_0=e^{0.1}-1.1\approx 0.005170918. $$

The Taylor expansion gives \(e^h=1+h+\frac{h^2}{2}+\cdots\), so \(r_0=\frac{h^2}{2}+\cdots\). At \(h=0.1\), the leading term is \(0.1^2/2=0.005\), close to the computed local error. The exact solution check is \(y'=e^t=y\) and \(y(0)=1\), as required.

From Local Error to Global Error

To relate the two errors, assume \(f\) is Lipschitz continuous in its second argument on a region containing the exact solution and the Euler approximations. This means there is a constant \(L\ge 0\) such that

$$ |f(t,u)-f(t,v)|\le L|u-v| $$

for all relevant \(t,u,v\). The Lipschitz condition controls how much the slope can change when its \(y\)-value is perturbed.

Theorem: Suppose \(y(0)=y_0\), the exact solution is twice continuously differentiable on \([0,T]\), \(|y''(t)|\le M\), and \(f\) is Lipschitz in \(y\) with constant \(L\) on a region containing the exact and numerical solution values. If Euler’s method starts from the exact initial value, then, for \(L>0\), $$ |e_n|\le \frac{Mh}{2L}\bigl((1+Lh)^n-1\bigr) \le \frac{Mh}{2L}\bigl(e^{LT}-1\bigr),\qquad 0\le n\le N. $$ In particular, for fixed \(T\), the global error is bounded by a constant times \(h\). If \(L=0\), the corresponding bound is \(|e_n|\le nMh^2/2\le MTh/2\).

Here is the argument. Write the exact solution’s step as \(y(t_{n+1})=y(t_n)+h f(t_n,y(t_n))+r_n\). Subtract the Euler update and apply the triangle inequality and the Lipschitz condition. This gives the recurrence

$$ |e_{n+1}| \le (1+Lh)|e_n|+|r_n| \le (1+Lh)|e_n|+\frac{Mh^2}{2}. $$

Since Euler starts at the exact initial value, \(e_0=0\). Repeatedly applying the recurrence yields

$$ |e_n| \le \frac{Mh^2}{2}\sum_{j=0}^{n-1}(1+Lh)^j =\frac{Mh^2}{2}\frac{(1+Lh)^n-1}{Lh} =\frac{Mh}{2L}\bigl((1+Lh)^n-1\bigr). $$

The equality for the sum is the finite geometric-series formula, valid here because \(Lh>0\). Since \(nh\le T\) and \(1+x\le e^x\) for \(x\ge 0\), we have \((1+Lh)^n\le e^{Lnh}\le e^{LT}\). Substitution gives the stated uniform bound. If \(L=0\), the recurrence instead adds at most \(Mh^2/2\) per step, so \(|e_n|\le nMh^2/2\). In either case, with \(T\) fixed, the bound is proportional to \(h\).

Key takeaway: A local error of order \(h^2\) accumulates over roughly \(T/h\) steps on a fixed interval. The resulting global error is generally of order \(h\), provided the solution and the method satisfy the stated smoothness and Lipschitz conditions.

Checking the Accumulation on Exact Solutions

Worked Example: Accumulated Error for \(y'=t\)

Consider \(y'=t\), \(y(0)=0\), on \([0,1]\). The exact solution is \(y(t)=t^2/2\), since its derivative is \(t\) and it has initial value \(0\). Use Euler’s method with \(h=1/4\), so there are four steps.

The update is \(y_{n+1}=y_n+\frac14 t_n\), with \(t_0=0\), \(t_1=1/4\), \(t_2=1/2\), and \(t_3=3/4\). Step by step,

$$ \begin{aligned} y_0&=0,\\ y_1&=0+\frac14(0)=0,\\ y_2&=0+\frac14\left(\frac14\right)=\frac1{16},\\ y_3&=\frac1{16}+\frac14\left(\frac12\right)=\frac3{16},\\ y_4&=\frac3{16}+\frac14\left(\frac34\right)=\frac6{16}=\frac38. \end{aligned} $$

The exact endpoint value is \(y(1)=1/2\), so the global error at \(t_4=1\) is \(1/2-3/8=1/8\). At every step the local error, when starting from the exact value, is \(h^2/2=1/32\): the exact solution is quadratic, and its second derivative is \(1\). Four such local errors add to \(4/32=1/8\), matching the endpoint error. More generally, summing the Euler increments gives \(y_N=h^2\sum_{k=0}^{N-1}k=T^2/2-Th/2\) when \(h=T/N\). Thus the endpoint global error is exactly \(Th/2\), proportional to \(h\). The exact solution check is \(y'=t\) and \(y(0)=0\).

Worked Example: Halving the Step for \(y'=y\)

Return to \(y'=y\), \(y(0)=1\), but now integrate to \(T=1\). The exact solution has endpoint \(e\approx 2.718281828\), as checked by \(y'=e^t=y\) and \(y(0)=1\). Euler’s recurrence is \(y_{n+1}=(1+h)y_n\), so after \(N=1/h\) steps, \(y_N=(1+h)^N\).

For \(h=0.1\), the successive values are

$$ 1,\ 1.1,\ 1.21,\ 1.331,\ 1.4641,\ 1.61051,\ 1.771561,\ 1.9487171,\ 2.14358881,\ 2.357947691,\ 2.5937424601. $$

The endpoint error is \(e-2.5937424601\approx 0.124539368\). If the step is halved to \(h=0.05\), there are \(20\) steps and \(y_{20}=1.05^{20}\approx 2.653297705\). The error is then \(e-2.653297705\approx 0.064984123\). The ratio of the first error to the second is approximately \(0.124539368/0.064984123\approx 1.916\), close to \(2\). This is consistent with first-order global error; the ratio approaches \(2\) as the steps become smaller.

The calculation also verifies the method’s recurrence: each Euler step multiplies the current value by \(1+h\). The exact solution is not the Euler value at a finite step size, but it provides a direct reference for measuring the accumulated error.

Worked Example: A Decaying Solution and Its Error

Consider \(y'=-y\), \(y(0)=1\), on \([0,0.2]\), with \(h=0.1\). The exact solution is \(y(t)=e^{-t}\), since its derivative is \(-e^{-t}=-y(t)\) and \(y(0)=1\). Euler’s update is \(y_{n+1}=y_n-0.1y_n=0.9y_n\). Therefore

$$ y_0=1,\qquad y_1=0.9,\qquad y_2=0.9(0.9)=0.81. $$

The exact value at \(t=0.2\) is \(e^{-0.2}\approx 0.818730753\), so the endpoint error is \(0.818730753-0.81\approx 0.008730753\). To check the one-step errors, starting from the exact value at \(t=0\) gives the Euler value \(0.9\), compared with \(e^{-0.1}\approx0.904837418\); the local error is approximately \(0.004837418\). Starting from the exact value at \(t=0.1\) gives the Euler value \(0.9e^{-0.1}\approx0.814353676\), compared with \(e^{-0.2}\approx0.818730753\); the local error is approximately \(0.004377077\). The endpoint discrepancy reflects both local defects and the effect of using approximate values in later steps.

A Common Error in Reasoning

A common mistake is to conclude that the global error remains order \(h^2\) because each local error is order \(h^2\). That ignores the number of steps. On a fixed interval of length \(T\), the number of steps is \(N=T/h\), not a constant independent of \(h\). A rough accumulation estimate is therefore

$$ N\cdot O(h^2)=\frac{T}{h}\,O(h^2)=O(h). $$

This multiplication is only a useful first estimate; the global error proof also accounts for how errors affect subsequent slopes. The Lipschitz recurrence provides that control. It does not say local errors always add with identical signs, but it establishes an upper bound on their accumulated effect.

Conditions matter: The first-order bound is a fixed-interval result. Its constant depends on \(T\), the bound on \(y''\), and the Lipschitz constant. If the solution is not sufficiently smooth, the second-derivative bound may fail. If the slope function is not Lipschitz in \(y\) on a region containing the relevant values, this error argument does not apply as stated.

Check Your Understanding

Use the definitions and error argument above to answer these questions.

  1. In what precise way does the one-step local error differ from the global error at a mesh point?
  2. Why does a bound \(|y''(t)|\le M\) imply \(|r_n|\le Mh^2/2\)?
  3. In the global error recurrence, what role does the Lipschitz constant \(L\) play?
  4. For fixed \(T\), why does a local error of order \(h^2\) lead to a global bound of order \(h\)?
  5. For \(y'=t\), \(y(0)=0\), explain why the endpoint Euler error with step \(h=T/N\) is \(Th/2\).