Tutorials › Stochastic Calculus › Euler-Maruyama Updates for Scalar SDEs

Simulating SDEs: Euler-Maruyama and Milstein · Tutorial 513 of 600

Euler-Maruyama Updates for Scalar SDEs

Learn to construct and verify scalar Euler–Maruyama updates, and to distinguish a simulated path approximation from an exact SDE solution.

Intermediate 10 min read

What You'll Learn

  • Derive the Euler–Maruyama recursion for a scalar Ito SDE on a possibly nonuniform time grid.
  • Identify the drift and diffusion evaluations used at each left endpoint.
  • Check when the frozen stochastic integrand is admissible in the Ito integral.
  • Compute path approximations from supplied Brownian increments or standardized normal draws.
  • Verify an update by summing its drift and diffusion contributions.
  • Recognize common mistakes in time-step scaling and coefficient evaluation.

From an Ito SDE to a Discrete Update

Numerical simulation replaces a continuous-time stochastic process by values on a finite time grid. For a scalar SDE, Euler–Maruyama uses the simplest local approximation: over a short interval, evaluate the drift and diffusion at the left endpoint and hold those values fixed for that step. The Brownian increment is not replaced by a deterministic quantity; it remains a random input whose variance equals the step length.

Work on a filtered probability space \((\Omega,\mathcal{F},(\mathcal{F}_t)_{t\ge0},\mathbb{P})\) carrying a standard Brownian motion \(B_t\). Consider the scalar Ito SDE \(dX_t=\mu(t,X_t)\,dt+\sigma(t,X_t)\,dB_t\), with initial value \(X_0\). Here \(\mu\) is the drift coefficient and \(\sigma\) is the diffusion coefficient. Unless another measure is explicitly specified, all expectations and Brownian increments in this tutorial are under \(\mathbb{P}\).

For definiteness, assume \(X_0\) is \(\mathcal{F}_0\)-measurable with \(\mathbb{E}[X_0^2]<\infty\), and that \(\mu,\sigma\) are measurable in time and globally Lipschitz in the state, uniformly in time, with linear growth. Thus, for some finite constant \(C\) and all \(t,x,y\),

$$ |\mu(t,x)-\mu(t,y)|+|\sigma(t,x)-\sigma(t,y)|\le C|x-y|, \qquad |\mu(t,x)|+|\sigma(t,x)|\le C(1+|x|). $$

These are standard sufficient conditions for a square-integrable solution of the SDE and for the finite-grid recursion below to be well defined. They are not necessary for every possible simulation problem. A numerical recursion can also be written for other coefficients, but its integrability and stability then need to be checked separately.

Choose a deterministic grid \(0=t_0<t_1<\cdots<t_N=T\), set \(h_n=t_{n+1}-t_n\), and write \(\Delta B_n=B_{t_{n+1}}-B_{t_n}\). Brownian motion gives \(\Delta B_n\sim N(0,h_n)\), independent of \(\mathcal{F}_{t_n}\). Euler–Maruyama starts at \(X_0^{\mathrm{EM}}=X_0\) and updates by

Definition: The scalar Euler–Maruyama recursion for the Ito SDE is \(X_{n+1}^{\mathrm{EM}}=X_n^{\mathrm{EM}}+\mu(t_n,X_n^{\mathrm{EM}})h_n+\sigma(t_n,X_n^{\mathrm{EM}})\Delta B_n\), for \(n=0,\ldots,N-1\). Both coefficients are evaluated at the current grid value and at the left endpoint \(t_n\).

Equivalently, one can generate independent standard normal variables \(Z_n\sim N(0,1)\), independent of the information at the start of the step, and set \(\Delta B_n=\sqrt{h_n}Z_n\). The factor is \(\sqrt{h_n}\), not \(h_n\), because \(\operatorname{Var}(\sqrt{h_n}Z_n)=h_n\).

Why the Recursion Has This Form

On the interval \([t_n,t_{n+1}]\), freeze the coefficients at the known value \(X_n^{\mathrm{EM}}\). Integrating those frozen coefficients gives the drift contribution \(\mu(t_n,X_n^{\mathrm{EM}})h_n\) and the stochastic contribution \(\sigma(t_n,X_n^{\mathrm{EM}})\Delta B_n\). The second identity is an Ito-integral identity, so its integrability hypothesis matters.

Proposition: Suppose \(X_n^{\mathrm{EM}}\) is \(\mathcal{F}_{t_n}\)-measurable and \(\mathbb{E}[\sigma(t_n,X_n^{\mathrm{EM}})^2]<\infty\). Then the frozen process \(H_s=\sigma(t_n,X_n^{\mathrm{EM}})\) for \(t_n\le s\le t_{n+1}\) is progressively measurable and satisfies \(\mathbb{E}\int_{t_n}^{t_{n+1}}H_s^2\,ds<\infty\). Consequently, \(\int_{t_n}^{t_{n+1}}H_s\,dB_s=\sigma(t_n,X_n^{\mathrm{EM}})\Delta B_n\) in \(L^2(\mathbb{P})\), and hence almost surely after choosing versions of the two equal random variables.

Proof. The random variable \(\sigma(t_n,X_n^{\mathrm{EM}})\) is \(\mathcal{F}_{t_n}\)-measurable. A process constant on this interval with that value is adapted and progressively measurable there. Its square-integrability is verified directly: \(\mathbb{E}\int_{t_n}^{t_{n+1}}H_s^2\,ds=h_n\mathbb{E}[\sigma(t_n,X_n^{\mathrm{EM}})^2]<\infty\). For a simple predictable integrand constant on \((t_n,t_{n+1}]\), the Ito integral is defined as its value times the Brownian increment. Applying that definition gives the stated identity. Equality in \(L^2\) means the squared difference has expectation zero, so the random variables agree almost surely. \(\square\)

The square-integrability condition cannot be replaced by mere finiteness almost surely: an almost surely finite coefficient can have infinite second moment and then fail to belong to the \(\mathcal{L}^2\) class used to define the Ito integral. Under the Lipschitz and linear-growth assumptions above, the condition holds at every step. Indeed, if \(\mathbb{E}[(X_n^{\mathrm{EM}})^2]<\infty\), linear growth implies \(\mathbb{E}[\mu(t_n,X_n^{\mathrm{EM}})^2]<\infty\) and \(\mathbb{E}[\sigma(t_n,X_n^{\mathrm{EM}})^2]<\infty\). The update then has a finite second moment: use \(|a+b+c|^2\le3(a^2+b^2+c^2)\), \(\mathbb{E}[(\Delta B_n)^2]=h_n\), and independence of \(\Delta B_n\) from \(\mathcal{F}_{t_n}\). Starting from the assumed square-integrable \(X_0\), induction proves the claim for every grid index.

In continuous-time notation, the associated piecewise-frozen approximation is \(Y_t=X_0+\int_0^t\mu(t_n,X_n^{\mathrm{EM}})\,ds+\int_0^t\sigma(t_n,X_n^{\mathrm{EM}})\,dB_s\), where on each subinterval the index \(n\) is chosen with \(t_n\le s<t_{n+1}\). The stochastic integrand is progressively measurable and has finite \(\mathbb{E}\int_0^T H_s^2\,ds\) under the assumptions just stated. At grid points, this representation gives exactly the recursion. It is an approximation to the SDE, not generally its exact solution.

Worked Scalar Updates

Worked Example: Constant Drift and Diffusion

Take \(X_0^{\mathrm{EM}}=1\), \(\mu(t,x)=2\), \(\sigma(t,x)=3\), and three steps of length \(h_n=\tfrac14\). Suppose the supplied Brownian increments are \(\tfrac12,-\tfrac14,\tfrac14\). Compute the grid path.

At the first step, the drift contribution is \(2\cdot\tfrac14=\tfrac12\), and the diffusion contribution is \(3\cdot\tfrac12=\tfrac32\). Therefore \(X_1^{\mathrm{EM}}=1+\tfrac12+\tfrac32=3\).

At the second step the coefficients are still \(2\) and \(3\). The contributions are \(\tfrac12\) and \(3(-\tfrac14)=-\tfrac34\), so \(X_2^{\mathrm{EM}}=3+\tfrac12-\tfrac34=\tfrac{11}{4}\).

At the third step the contributions are \(\tfrac12\) and \(3(\tfrac14)=\tfrac34\). Hence \(X_3^{\mathrm{EM}}=\tfrac{11}{4}+\tfrac12+\tfrac34=4\).

Check: Summing all increments gives \(X_3^{\mathrm{EM}}=1+2(\tfrac34)+3(\tfrac12-\tfrac14+\tfrac14)=1+\tfrac32+\tfrac32=4\), agreeing with the step-by-step calculation.

Worked Example: State-Dependent Drift and Diffusion

Use \(\mu(t,x)=1-x\), \(\sigma(t,x)=x/2\), initial value \(X_0^{\mathrm{EM}}=2\), and two steps of length \(h_n=\tfrac12\). Let the Brownian increments be \(\tfrac12\) and \(-\tfrac14\). Evaluate the coefficients anew at each left-endpoint value.

For step 0, \(\mu(0,2)=1-2=-1\) and \(\sigma(0,2)=2/2=1\). Thus the drift increment is \(-1\cdot\tfrac12=-\tfrac12\), while the diffusion increment is \(1\cdot\tfrac12=\tfrac12\). They cancel, giving \(X_1^{\mathrm{EM}}=2\).

For step 1, the state is again 2, so the coefficients are again \(-1\) and 1. The drift increment is \(-\tfrac12\), and the diffusion increment is \(1\cdot(-\tfrac14)=-\tfrac14\). Therefore \(X_2^{\mathrm{EM}}=2-\tfrac12-\tfrac14=\tfrac54\).

Check: The sum of the two drift increments is \(-\tfrac12-\tfrac12=-1\), and the sum of the diffusion increments is \(\tfrac12-\tfrac14=\tfrac14\). Adding these to the initial value gives \(2-1+\tfrac14=\tfrac54\), as above.

Worked Example: Time-Dependent Drift on a Nonuniform Grid

Let \(X_0^{\mathrm{EM}}=0\), \(\mu(t,x)=t\), and \(\sigma(t,x)=1\). Use the grid \(t_0=0,t_1=\tfrac14,t_2=\tfrac34\), so the step lengths are \(h_0=\tfrac14\) and \(h_1=\tfrac12\). Suppose \(\Delta B_0=\tfrac12\) and \(\Delta B_1=-\tfrac12\).

At \(t_0=0\), the drift contribution is \(0\cdot\tfrac14=0\), and the diffusion contribution is \(\tfrac12\). Thus \(X_1^{\mathrm{EM}}=\tfrac12\).

At \(t_1=\tfrac14\), the drift contribution is \(\tfrac14\cdot\tfrac12=\tfrac18\), and the diffusion contribution is \(-\tfrac12\). Hence \(X_2^{\mathrm{EM}}=\tfrac12+\tfrac18-\tfrac12=\tfrac18\).

Check: The total drift is \(0+\tfrac18=\tfrac18\); the total diffusion is \(\tfrac12-\tfrac12=0\). Starting at zero therefore gives the final value \(\tfrac18\), confirming the recursion. The unequal step lengths show why each drift contribution uses its own \(h_n\).

Interpretation and Common Mistakes

The update uses Ito increments. It is not a Stratonovich update: under sufficient smoothness, the scalar conversion is \(\int_0^t \sigma(s,X_s)\circ dB_s=\int_0^t\sigma(s,X_s)\,dB_s+\tfrac12\int_0^t\sigma_x(s,X_s)\sigma(s,X_s)\,ds\). Thus a Stratonovich SDE has a drift correction when rewritten in Ito form; applying an Ito scheme without that conversion generally simulates a different equation.

For an Ito step, \(\Delta B_n\) has conditional mean zero given \(\mathcal{F}_{t_n}\), and variance \(h_n\). When the coefficient is square-integrable, independence gives \(\mathbb{E}[\sigma(t_n,X_n^{\mathrm{EM}})\Delta B_n\mid\mathcal{F}_{t_n}]=0\). This conditional statement about one step does not assert that the whole Euler path is a martingale: the drift contribution is present. Nor does writing a stochastic integral by itself establish a true martingale property; the relevant integrability conditions must be checked. Strong convergence concerns approximation of paths on the same Brownian probability space, whereas weak convergence concerns expectations of test functions of the approximation. The recursion alone establishes neither convergence rate; those are separate error questions.

A frequent scaling error is to use \(h_n Z_n\) for the random term. For the constant-coefficient first step of the first example, \(h_n Z_n=\tfrac14\cdot2=\tfrac12\) would be the Brownian increment only if \(Z_n=2\), but it would have variance \(h_n^2\), not \(h_n\), for a standard normal draw. The correct draw is \(\sqrt{h_n}Z_n\), whose variance is \(h_n\). With \(h_n=\tfrac14\) and \(Z_n=1\), the correct increment is \(\tfrac12\), while the incorrect one is \(\tfrac14\). Multiplying by diffusion coefficient 3 gives respective noise contributions \(\tfrac32\) and \(\tfrac34\), a factor-of-two error.

A second common error is to evaluate coefficients at the newly computed state. In the second worked example, the first update must use \(\mu(0,2)=-1\) and \(\sigma(0,2)=1\), not the coefficients at a future value. Euler–Maruyama is explicit precisely because the current approximation \(X_n^{\mathrm{EM}}\) determines both coefficients before the next update is calculated. Keep the drift scaling \(h_n\), the noise scaling \(\Delta B_n\), and the left-endpoint coefficient evaluations distinct.

Check Your Understanding

For each question, use the left-endpoint recursion and state the step length or Brownian increment you use.

  1. For \(X_0^{\mathrm{EM}}=0\), \(\mu(t,x)=1\), \(\sigma(t,x)=2\), \(h_0=\tfrac14\), and \(\Delta B_0=-\tfrac12\), compute \(X_1^{\mathrm{EM}}\).
  2. Explain why an almost surely finite value of \(\sigma(t_n,X_n^{\mathrm{EM}})\) alone does not justify the frozen Ito-integral identity used in the proposition.
  3. For a standard normal draw \(Z_n\), what is the variance of \(\sqrt{h_n}Z_n\), and why is \(h_nZ_n\) not the Brownian scaling?
  4. State the difference between strong and weak convergence of a numerical SDE scheme.
  5. In the update, which terms use \(h_n\), which use \(\Delta B_n\), and at what state are the coefficients evaluated?