Euler's method

The simplest one-step method: advance with the slope at the current node. Full derivation along three routes (Taylor, incremental quotient and integration), order, a worked example and the implicit variant.

The idea: advance with the current slope

At node tkt_k we know the approximation yky_k and, with it, the slope f(tk,yk)f(t_k,y_k) that the equation assigns to the solution at that point. Euler's method advances in a straight line with that slope across the whole subinterval:

yk+1=yk+hf(tk,yk),k=0,1,,N1y_{k+1}=y_k+h\,f(t_k,y_k),\qquad k=0,1,\dots,N-1
Explicit Euler method.
tₖtₖ₊₁yₖyₖ₊₁current slopey(t)
Euler replaces the exact curve by the tangent line leaving (tk,yk)(t_k,y_k); across the whole step it uses a single slope.
Expand diagram

Euler replaces the exact curve by the tangent line leaving (tk,yk)(t_k,y_k); across the whole step it uses a single slope.

It is an explicit method: yk+1y_{k+1} is computed directly from yky_k. Its interest is not accuracy (it is the lowest-order method) but that it condenses the three techniques used to design almost every method: Taylor expansions, derivative approximation and quadrature.

Derivation

The complete derivation, along all three routes and with the error analysis that fixes the order of the method, is the following:

DerivationDerivation: Euler's method and its orderView as its own page →

Route 1: Taylor expansion

tₖtₖ₊₁yₖyₖ₊₁current slopey(t)
The geometric reading of first-order Taylor: keeping only the linear term means advancing along the tangent.
Expand diagram

The geometric reading of first-order Taylor: keeping only the linear term means advancing along the tangent.

  1. Expand the solution yy by Taylor around tt, with the Lagrange form of the remainder (ξ\xi between tt and t+ht+h):

    y(t+h)=y(t)+hy(t)+h22y(ξ)y(t+h)=y(t)+h\,y'(t)+\frac{h^2}{2}y''(\xi)
  2. The differential equation provides the derivative: y(t)=f(t,y(t))y'(t)=f(t,y(t)). Substituting:

    y(t+h)=y(t)+hf(t,y(t))+h22y(ξ)y(t+h)=y(t)+h\,f(t,y(t))+\frac{h^2}{2}y''(\xi)
  3. Discard the remainder h22y(ξ)\frac{h^2}{2}y''(\xi) (the terms of order at least 2) and evaluate at the nodes t=tkt=t_k, with yky(tk)y_k\approx y(t_k): Euler's scheme remains.

    yk+1=yk+hf(tk,yk)y_{k+1}=y_k+h\,f(t_k,y_k)

Route 2: incremental quotient

  1. The derivative is the limit of the incremental quotient; for small hh, that quotient approximates it. This gives the first-order forward difference:

    y(t)=limh0y(t+h)y(t)h    y(t)y(t+h)y(t)hy'(t)=\lim_{h\to 0}\frac{y(t+h)-y(t)}{h}\;\Rightarrow\; y'(t)\approx\frac{y(t+h)-y(t)}{h}
  2. Substituting the approximation into the equation y=f(t,y)y'=f(t,y) and solving for y(t+h)y(t+h) recovers the same formula:

    y(t+h)y(t)hf(t,y)    y(t+h)y(t)+hf(t,y)\frac{y(t+h)-y(t)}{h}\approx f(t,y)\;\Rightarrow\; y(t+h)\approx y(t)+h\,f(t,y)

Route 3: integration

tₖtₖ₊₁h f(tₖ, yₖ)left rectanglef(τ, y(τ))
In integral form, explicit Euler approximates the area under f(τ,y(τ))f(\tau,y(\tau)) by a rectangle with left height f(tk,yk)f(t_k,y_k).
Expand diagram

In integral form, explicit Euler approximates the area under f(τ,y(τ))f(\tau,y(\tau)) by a rectangle with left height f(tk,yk)f(t_k,y_k).

  1. Before using the Fundamental Theorem of Calculus, write the ODE with the dummy variable τ\tau and integrate both sides over [tk,tk+1][t_k,t_{k+1}]:

    tktk+1y(τ)dτ=tktk+1f(τ,y(τ))dτ\int_{t_k}^{t_{k+1}} y'(\tau)\,d\tau=\int_{t_k}^{t_{k+1}} f\bigl(\tau,y(\tau)\bigr)\,d\tau
  2. Now the Fundamental Theorem of Calculus turns the integral of yy' into the exact difference of the solution:

    y(tk+1)=y(tk)+tktk+1f(τ,y(τ))dτy(t_{k+1})=y(t_k)+\int_{t_k}^{t_{k+1}} f\bigl(\tau,y(\tau)\bigr)\,d\tau
  3. Approximate the integrand by its value at the left endpoint. In other words, interpolate it with the constant polynomial p0(τ)=f(tk,y(tk))p_0(\tau)=f(t_k,y(t_k)) and integrate that rectangle of base hh:

    tktk+1f(τ,y(τ))dτ    (tk+1tk)f(tk,y(tk))=hf(tk,y(tk))\int_{t_k}^{t_{k+1}} f\bigl(\tau,y(\tau)\bigr)\,d\tau\;\approx\;(t_{k+1}-t_k)\,f(t_k,y(t_k))=h\,f(t_k,y(t_k))
  4. Substituting into the integral identity yields Euler's scheme again. Approximating the integrand with higher-degree polynomials produces, along this same route, Heun (trapezoid), RK4 (Simpson) and the Adams methods.

Local error, global error and order

  1. The local error of one step is the Taylor remainder discarded in Route 1 (ξk]tk,tk+1[\xi_k\in\,]t_k,t_{k+1}[):

    ek+1=y(tk+1)(y(tk)+hy(tk))=h22y(ξk)=O(h2)e_{k+1}=y(t_{k+1})-\bigl(y(t_k)+h\,y'(t_k)\bigr)=\frac{h^2}{2}y''(\xi_k)=\mathcal{O}(h^2)
  2. For the global error, sum the NN local errors. Since yy'' is continuous, the intermediate value theorem lets us collect the sum at a single point ξ[a,b]\xi\in[a,b]:

    k=0N1h22y(ξk)=h22Ny(ξ)\sum_{k=0}^{N-1}\frac{h^2}{2}y''(\xi_k)=\frac{h^2}{2}N\,y''(\xi)
  3. With N=bahN=\frac{b-a}{h}, one power of hh cancels and the first-order global error remains: Euler's method is first order.

    h22bahy(ξ)=ba2y(ξ)h=O(h)\frac{h^2}{2}\,\frac{b-a}{h}\,y''(\xi)=\frac{b-a}{2}\,y''(\xi)\,h=\mathcal{O}(h)

Order of the method

The global error loses one unit with respect to the local one: N=bahN=\frac{b-a}{h} local errors are committed, and their accumulation multiplies by a factor proportional to 1/h1/h. The precise definition of both errors and the numerical estimation of the order are covered in Convergence, consistency and order.

Worked example

ExampleTwo Euler steps on the Verhulst model

Approximate with two Euler steps the solution of y(t)=(30.1y(t))y(t)y'(t)=(3-0.1\,y(t))\,y(t) on [0,2][0,2] with y(0)=10y(0)=10, whose exact solution is y(t)=301+2e3ty(t)=\frac{30}{1+2e^{-3t}}.

  1. With N=2N=2 the step is h=1h=1. First step, from t0=0t_0=0, y0=10y_0=10: the slope is f(0,10)=(31)10=20f(0,10)=(3-1)\cdot 10=20.

    y1=y0+hf(t0,y0)=10+120=30y_1=y_0+h\,f(t_0,y_0)=10+1\cdot 20=30
  2. Second step, from t1=1t_1=1, y1=30y_1=30: now f(1,30)=(33)30=0f(1,30)=(3-3)\cdot 30=0, so the numerical solution does not move.

    y2=y1+hf(t1,y1)=30+0=30y_2=y_1+h\,f(t_1,y_1)=30+0=30

Comparing with the exact solution, y(1)=27.2833y(1)=27.2833 and y(2)=29.8517y(2)=29.8517, the maximum error is 27.283330=2.7167|27.2833-30|=2.7167: the first row of the table in the order estimation exercise.

Implicit Euler

If instead of the slope at the start of the subinterval one uses the slope at the end, the implicit Euler method is obtained:

yk+1=yk+hf(tk+1,yk+1)y_{k+1}=y_k+h\,f(t_{k+1},y_{k+1})
Implicit Euler method.
tₖtₖ₊₁h f(tₖ₊₁, yₖ₊₁)right rectanglef(τ, y(τ))
Implicit Euler uses the right-hand rectangle: the height depends on the new point, which is why an equation must be solved.
Expand diagram

Implicit Euler uses the right-hand rectangle: the height depends on the new point, which is why an equation must be solved.

DerivationDerivation: implicit EulerView as its own page →
tₖtₖ₊₁h f(tₖ₊₁, yₖ₊₁)right rectanglef(τ, y(τ))
The integral derivation of implicit Euler uses the right endpoint: the rectangle height contains the unknown yk+1y_{k+1}.
Expand diagram

The integral derivation of implicit Euler uses the right endpoint: the rectangle height contains the unknown yk+1y_{k+1}.

  1. Instead of approximating the derivative at tkt_k looking forward, approximate it at tk+1t_{k+1} looking backward, with the backward difference:

    y(tk+1)y(tk+1)y(tk)hy'(t_{k+1})\approx\frac{y(t_{k+1})-y(t_k)}{h}
  2. Substitute into the differential equation evaluated at the new node, y(tk+1)=f(tk+1,y(tk+1))y'(t_{k+1})=f\bigl(t_{k+1},y(t_{k+1})\bigr), and solve:

    yk+1=yk+hf(tk+1,yk+1)y_{k+1}=y_k+h\,f(t_{k+1},y_{k+1})
  3. The same scheme follows from the integral form of the IVP, approximating the integrand by its value at the right endpoint (right-hand rectangle), in exact parallel to Route 3 of the explicit Euler derivation.

  4. Since yk+1y_{k+1} appears inside ff, each step requires solving an (in general nonlinear) equation in the unknown yk+1y_{k+1}, for instance with the Newton-Raphson method:

    g(yk+1)=yk+1ykhf(tk+1,yk+1)=0g(y_{k+1})=y_{k+1}-y_k-h\,f(t_{k+1},y_{k+1})=0

Since yk+1y_{k+1} appears on both sides, each step requires solving the equation g(yk+1)=yk+1ykhf(tk+1,yk+1)=0g(y_{k+1})=y_{k+1}-y_k-h\,f(t_{k+1},y_{k+1})=0, often with the Newton-Raphson method. The method has a larger stability region: it works with large steps where the explicit one blows up, as the stability exercise shows and as studied in general in Stiff problems and stability.