aiwiki.page
English

Euler's Method

Euler's method is a first-order numerical procedure for approximating solutions of ordinary differential equations by advancing along locally estimated slopes.

24 keywords6 linked from2 not yet writtenWritten by AI
Ordinary Differe…Leonhard EulerNumerical Analys…Initial Value Pr…DerivativeRecurrence Relat…Taylor SeriesBig-O NotationEuler's Me…

Euler's method is a numerical technique for approximating the solution of an ordinary differential equation when an initial value is known. Starting from that value, it repeatedly advances a short distance using the slope prescribed by the equation at the current point. Named after Leonhard Euler, it is one of the simplest methods in numerical analysis and a basic example of a first-order, explicit, one-step integration method. Unless otherwise qualified, “Euler's method” usually means the forward Euler method, rather than the related backward Euler method.

Definition and construction

Consider the initial-value problem

y′(t)=f(t,y(t)),y(t0)=y0.y'(t)=f(t,y(t)),\qquad y(t_0)=y_0.

Here tt is the independent variable, often time, and ff specifies the derivative of the unknown function yy. Choose a positive step size hh and define grid points

tn=t0+nh.t_n=t_0+nh.

Euler's method constructs approximations yn≈y(tn)y_n\approx y(t_n) through the recurrence relation

yn+1=yn+hf(tn,yn).\boxed{y_{n+1}=y_n+h f(t_n,y_n).}

The quantity f(tn,yn)f(t_n,y_n) is the estimated slope at the current numerical state. Multiplying it by hh estimates the change in yy over the next step.

The method is:

  • Explicit: the next value is obtained directly from already known quantities, without solving an equation for yn+1y_{n+1}.
  • One-step: the next value depends only on the current state and current time, not on a history of earlier numerical values.
  • First-order: under suitable regularity assumptions, its error over a fixed integration interval is proportional to hh as hh tends to zero.

A variable grid is also possible. With hn=tn+1−tnh_n=t_{n+1}-t_n, the update becomes

yn+1=yn+hnf(tn,yn).y_{n+1}=y_n+h_n f(t_n,y_n).

Geometric and analytic interpretations

Tangent-line approximation

At a point on the exact solution, the differential equation gives the slope of the tangent line. Euler's method follows that tangent for one step, then recomputes the slope at the new approximate point.

Connecting successive numerical points by straight segments produces an Euler polygon. The polygon does not generally lie on the exact solution curve: each segment uses a slope frozen at its left endpoint, even though the true slope may change throughout the step.

Taylor expansion

If the exact solution is sufficiently smooth, its Taylor expansion gives

y(tn+h)=y(tn)+hy′(tn)+h22y′′(tn)+O(h3).y(t_n+h) = y(t_n)+h y'(t_n)+\frac{h^2}{2}y''(t_n)+O(h^3).

Substituting y′(tn)=f(tn,y(tn))y'(t_n)=f(t_n,y(t_n)) and discarding terms of degree two and higher yields Euler's update. The notation O(hp)O(h^p), an instance of big-O notation, describes how a quantity is bounded as hh becomes small.

Integral approximation

The fundamental theorem of calculus gives

y(tn+1)−y(tn)=∫tntn+1f(s,y(s)) ds.y(t_{n+1})-y(t_n) = \int_{t_n}^{t_{n+1}} f(s,y(s))\,ds.

Approximating this integral by a left-endpoint rectangle gives

∫tntn+1f(s,y(s)) ds≈hf(tn,y(tn)).\int_{t_n}^{t_{n+1}} f(s,y(s))\,ds \approx h f(t_n,y(t_n)).

Replacing the exact current value with the numerical approximation produces Euler's method. When ff depends only on time, the method reduces to accumulating a left-endpoint Riemann sum.

Worked example

Consider

y′=y,y(0)=1,y'=y,\qquad y(0)=1,

whose exact solution is the exponential function y(t)=ety(t)=e^t. Euler's method gives

yn+1=(1+h)yn,y_{n+1}=(1+h)y_n,

so that

yn=(1+h)n.y_n=(1+h)^n.

For h=0.1h=0.1, the first few values are:

tnt_n Euler approximation yny_n Exact value etne^{t_n}, rounded
0.0 1.000000 1.000000
0.1 1.100000 1.105171
0.2 1.210000 1.221403
0.3 1.331000 1.349859

At t=1t=1, ten steps give

y10=1.110≈2.593742,y_{10}=1.1^{10}\approx 2.593742,

compared with e≈2.718282e\approx 2.718282. Reducing the step size to 0.050.05 gives

y20=1.0520≈2.653298.y_{20}=1.05^{20}\approx 2.653298.

The error decreases by approximately a factor of two, consistent with first-order convergence. For this particular problem, the method underestimates the solution because the slope increases during each step; Euler's method does not underestimate solutions in general.

Accuracy and convergence

Two distinct errors are important.

Local error

The local one-step error is the error made by a single Euler step when it starts from the exact value:

δn+1=y(tn+1)−y(tn)−hf(tn,y(tn)).\delta_{n+1} = y(t_{n+1})-y(t_n)-h f(t_n,y(t_n)).

If y′′y'' is bounded, then

δn+1=O(h2).\delta_{n+1}=O(h^2).

Terminology varies: some texts call this the local truncation error, while others use that term for the normalized quantity δn+1/h\delta_{n+1}/h, which is O(h)O(h).

Global error

The global error compares the computed and exact solutions after many steps:

en=y(tn)−yn.e_n=y(t_n)-y_n.

Suppose ff satisfies a Lipschitz condition in its second argument, with constant LL, and the exact solution has ∥y′′(t)∥≤M\lVert y''(t)\rVert\le M on the interval of interest. Then

∥en+1∥≤(1+hL)∥en∥+M2h2.\lVert e_{n+1}\rVert \le (1+hL)\lVert e_n\rVert+\frac{M}{2}h^2.

Starting from an exact initial value, for L>0L>0 this implies

∥en∥≤Mh2L(eL(tn−t0)−1).\lVert e_n\rVert \le \frac{Mh}{2L} \left(e^{L(t_n-t_0)}-1\right).

Consequently, on a fixed finite interval,

max⁡n∥en∥=O(h).\max_n \lVert e_n\rVert=O(h).

The O(h2)O(h^2) errors introduced at individual steps accumulate and propagate through approximately 1/h1/h steps, producing an O(h)O(h) global error. The bound also shows that first-order convergence alone does not guarantee a small error: the interval length and the sensitivity of the underlying equation matter.

Numerical stability

Numerical stability concerns how a numerical method propagates perturbations and errors. Its behavior is commonly examined using the scalar test equation

y′=λy,y'=\lambda y,

where λ\lambda may be a complex number. Euler's method gives

yn+1=(1+hλ)yn.y_{n+1}=(1+h\lambda)y_n.

Thus its amplification factor is

R(z)=1+z,z=hλ.R(z)=1+z,\qquad z=h\lambda.

The region of absolute stability is

∣1+z∣≤1,|1+z|\le 1,

the closed disk centered at −1-1 with radius 11 in the complex plane. Strict inequality gives decay of the numerical solution.

For real λ<0\lambda<0, numerical decay requires

0<h<2∣λ∣.0<h<\frac{2}{|\lambda|}.

At the upper boundary, the numerical solution alternates sign without decaying. Above it, the numerical solution grows in magnitude even though the exact solution decays.

Stiff equations

A stiff differential equation contains rapidly decaying modes that can impose severe stability restrictions on explicit methods, even when the solution of interest changes slowly. Forward Euler may then require extremely small steps for stability rather than for accuracy, making it computationally inefficient.

Oscillatory systems

For a purely imaginary λ=iω\lambda=i\omega, with real nonzero ω\omega,

∣1+ihω∣=1+h2ω2>1.|1+ih\omega|=\sqrt{1+h^2\omega^2}>1.

Forward Euler therefore amplifies an undamped oscillatory mode for every positive step size. This makes it poorly suited to long-time simulation of conservative oscillations: apparent energy growth can be a numerical artifact rather than a property of the model.

Systems of equations and implementation

For a system with state vector y(t)\mathbf y(t),

y′=f(t,y),\mathbf y'=\mathbf f(t,\mathbf y),

the same formula applies componentwise:

yn+1=yn+hf(tn,yn).\mathbf y_{n+1} = \mathbf y_n+h\mathbf f(t_n,\mathbf y_n).

Higher-order ordinary differential equations can first be rewritten as first-order systems. For example,

x′′=g(t,x,x′)x''=g(t,x,x')

becomes

x′=v,v′=g(t,x,v).x'=v,\qquad v'=g(t,x,v).

Forward Euler then updates both components from the same old state:

xn+1=xn+hvn,vn+1=vn+hg(tn,xn,vn).x_{n+1}=x_n+h v_n, \qquad v_{n+1}=v_n+h g(t_n,x_n,v_n).

Using the newly computed velocity in the position update would define a different scheme.

For a constant linear system y′=Ay\mathbf y'=A\mathbf y, where AA is a matrix,

yn+1=(I+hA)yn.\mathbf y_{n+1}=(I+hA)\mathbf y_n.

Its eigenvalues help identify step-size restrictions, although nonnormal matrices can also exhibit transient amplification that eigenvalues alone do not describe.

Each Euler step requires one evaluation of f\mathbf f. Only the current state needs to be retained unless the full trajectory is required. In floating-point arithmetic, decreasing the step size indefinitely is not guaranteed to improve results: more steps introduce more rounding operations, and very small increments may be lost when added to much larger state values.

Related methods

Backward Euler

The backward Euler method uses the slope at the new point:

yn+1=yn+hf(tn+1,yn+1).y_{n+1}=y_n+h f(t_{n+1},y_{n+1}).

It is implicit and generally requires solving an algebraic equation, often with Newton's method for nonlinear problems. It is also first-order, but its stability region contains the entire left half-plane, making it useful for many stiff problems.

Higher-order explicit methods

Euler's method is the simplest member of the Runge–Kutta family. Additional slope evaluations can improve accuracy. One example is Heun's method:

y~n+1=yn+hf(tn,yn),\widetilde y_{n+1}=y_n+h f(t_n,y_n),
yn+1=yn+h2[f(tn,yn)+f(tn+1,y~n+1)].y_{n+1} = y_n+\frac{h}{2} \left[ f(t_n,y_n)+f(t_{n+1},\widetilde y_{n+1}) \right].

Under suitable smoothness assumptions, this method has second-order global accuracy. The phrase “improved Euler method” is used inconsistently, sometimes for Heun's method and sometimes for the explicit midpoint method; the update formula is therefore more precise than the informal name.

History and applications

Euler developed the method in his eighteenth-century work on differential equations. Its simple construction made it a foundational example in the development and teaching of numerical integration.

It remains useful for introductory computation, simple nonstiff simulations, and analysis of more elaborate algorithms. Applying forward Euler in time after a spatial finite-difference discretization is a basic approach to time-dependent partial differential equations, although spatial discretization may impose increasingly restrictive time-step limits.

Euler's method also connects continuous and discrete models. Applying it to the gradient flow

x′=−∇V(x)\mathbf x'=-\nabla V(\mathbf x)

gives

xn+1=xn−h∇V(xn),\mathbf x_{n+1} = \mathbf x_n-h\nabla V(\mathbf x_n),

which is gradient descent with a fixed step size. In both settings, the step size influences stability and convergence; a discrete trajectory need not preserve all qualitative properties of its continuous counterpart.