Tutorials › Stochastic Calculus › Euler-Maruyama Pitfalls in Scaling and Error Measurement

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

Euler-Maruyama Pitfalls in Scaling and Error Measurement

Diagnose three common Euler–Maruyama simulation errors by checking increment variances, path coupling, and the precise error statistic being reported.

Intermediate 10 min read

What You'll Learn

  • Scale a Brownian increment by the square root of the time step.
  • Compare the variance produced by correct and incorrect increment scaling.
  • Distinguish a coupled strong-error comparison from an uncoupled path comparison.
  • Compute mean-square error and root-mean-square error without confusing them.
  • Check how scaling mistakes affect the Euler–Maruyama approximation over a full time interval.

Three Checks Before Trusting an Euler–Maruyama Error

Euler–Maruyama simulations can produce plausible-looking paths while measuring the wrong quantity. A common cause is assigning the wrong variance to a Brownian increment. Another is comparing an approximate solution with an exact solution generated from an independent Brownian path, even though strong error concerns their difference when driven by the same noise. A third is reporting the mean-square error while labelling it the root-mean-square error, or vice versa.

Work on a filtered probability space \((\Omega,\mathcal{F},(\mathcal{F}_t)_{t\ge0},\mathbb{P})\) carrying a standard Brownian motion \(B_t\). For a scalar SDE, write \(dX_t=\mu(t,X_t)\,dt+\sigma(t,X_t)\,dB_t\), where \(\mu\) is the drift and \(\sigma\) is the diffusion coefficient. The Ito integral \(\int_0^t H_s\,dB_s\) is defined for progressively measurable integrands \(H\) in \(\mathcal{L}^2\), meaning \(\mathbb{E}\int_0^T H_s^2\,ds<\infty\). The integral form of the SDE is \(X_t=X_0+\int_0^t\mu(s,X_s)\,ds+\int_0^t\sigma(s,X_s)\,dB_s\).

For general existence and convergence statements below, assume the coefficients satisfy global Lipschitz and linear growth conditions in the state variable, and that \(\mathbb{E}|X_0|^2<\infty\). These standard conditions ensure a unique strong solution on a finite time interval. The examples use constant coefficients, for which the required integrability holds directly.

On a uniform grid \(t_n=nh\), with \(h=T/N\), Euler–Maruyama uses the update

$$ X_{n+1}^{h}=X_n^{h}+\mu(t_n,X_n^{h})h+\sigma(t_n,X_n^{h})\Delta B_n,\qquad \Delta B_n=B_{t_{n+1}}-B_{t_n}. $$

Each increment satisfies \(\Delta B_n\sim N(0,h)\). Equivalently, if \(Z_n\) are independent standard normal random variables, then \(\Delta B_n=\sqrt{h}\,Z_n\). The square root, rather than \(h\), is essential.

Brownian Scaling: Match the Variance to the Time Step

Proposition: If \(Z\sim N(0,1)\) and \(h>0\), then \(\sqrt{h}Z\sim N(0,h)\), whereas \(hZ\sim N(0,h^2)\). Thus \(hZ\) has too little variance for \(0<h<1\), too much variance for \(h>1\), and the correct variance only when \(h=1\).

Proof. Scaling a normal random variable by a constant \(a\) multiplies its variance by \(a^2\). Since \(\operatorname{Var}(Z)=1\), \(\operatorname{Var}(\sqrt{h}Z)=(\sqrt{h})^2=h\), while \(\operatorname{Var}(hZ)=h^2\). For \(h>0\), \(h^2<h\) exactly when \(h<1\), \(h^2>h\) exactly when \(h>1\), and \(h^2=h\) when \(h=1\). Both scaled variables are centered normal, so their variances determine the stated distributions. \(\square\)

Worked Example: The Wrong Scaling Shrinks Brownian Motion

Consider \(dX_t=dB_t\), \(X_0=0\), on \([0,1]\), and use four equal steps. Compare the correct Euler increments with the incorrect choice \(hZ_n\).

Here \(h=1/4\). The correct increment is \(\sqrt{1/4}Z_n=\tfrac12Z_n\), with variance \((1/2)^2=1/4\). The incorrect increment is \((1/4)Z_n\), with variance \((1/4)^2=1/16\). The correct terminal approximation is the sum of four independent increments, so its variance is \(4(1/4)=1\), matching \(\operatorname{Var}(B_1)=1\). With the incorrect scaling, the terminal variance is \(4(1/16)=1/4\).

More generally, if \(N\) steps cover \([0,T]\), then \(h=T/N\). Summing \(N\) incorrectly scaled independent increments \(hZ_n\) gives terminal variance \(Nh^2=N(T/N)^2=T^2/N=Th\), which tends to zero as \(N\) increases. The correct sum has variance \(Nh=T\) for every \(N\).

Check: for the specified \(h=1/4\), the incorrect variance \(1/16\) per step is smaller than the correct \(1/4\). If instead \(h=2\), the two variances would be \(h^2=4\) and \(h=2\), so the same mistake would give too much variance. The direction of the error depends on whether \(h\) is below or above \(1\).

A related bookkeeping error is to scale the Brownian increment correctly but apply the time-step factor to the diffusion term as well. In the update, the drift contribution is \(\mu h\), while the noise contribution is \(\sigma\sqrt{h}Z\). Their variances and typical sizes are different: the drift is of order \(h\), and the Brownian increment is of order \(\sqrt{h}\).

Worked Example: Drift and Diffusion Use Different Factors

For \(dX_t=2\,dt+3\,dB_t\), take one step of length \(h=1/4\). The drift increment is \(2(1/4)=1/2\). The diffusion increment must be \(3\sqrt{1/4}Z=\tfrac32Z\), with mean \(0\) and variance \((3/2)^2=9/4\). Thus \(X_1^h-X_0^h=\tfrac12+\tfrac32Z\), which has mean \(1/2\) and variance \(9/4\).

If one mistakenly uses \(3hZ\), the update becomes \(\tfrac12+\tfrac34Z\), whose variance is \((3/4)^2=9/16\). The exact solution over this step is \(X_h-X_0=2h+3(B_h-B_0)\), with mean \(2h=1/2\) and variance \(9h=9/4\), confirming the correct update.

Check: both updates give the same drift mean \(1/2\), but the wrong one gives variance \(9/16\), one quarter of \(9/4\). This agrees with the factor-of-four variance loss from replacing \(\sqrt{h}=1/2\) by \(h=1/4\).

Strong Error Requires a Shared Brownian Path

A strong solution is a solution constructed on the given probability space and driven by its specified Brownian motion. A strong-error comparison therefore uses the same Brownian path for the exact and numerical solutions. At a fixed time \(T\), the root-mean-square strong error is \(\big(\mathbb{E}|X_T-X_N^h|^2\big)^{1/2}\). A weak comparison instead concerns expectations of functions of the solutions, such as \(\mathbb{E}f(X_T)\) and \(\mathbb{E}f(X_N^h)\); it does not measure pathwise agreement.

Proposition: If \(U\) and \(V\) are independent, square-integrable random variables with the same mean \(m\) and variance \(v\), then \(\mathbb{E}|U-V|^2=2v\). In particular, independent copies of a nondegenerate solution need not be close, even if they have exactly the same distribution.

Proof. Expand the square and use independence: \(\mathbb{E}(U-V)^2=\mathbb{E}U^2+\mathbb{E}V^2-2\mathbb{E}(UV)\). Since each variable has variance \(v\) and mean \(m\), \(\mathbb{E}U^2=\mathbb{E}V^2=v+m^2\). Independence gives \(\mathbb{E}(UV)=\mathbb{E}U\,\mathbb{E}V=m^2\). Substitution yields \(2(v+m^2)-2m^2=2v\). \(\square\)

Worked Example: Uncoupled Paths Do Not Measure Strong Error

For \(dX_t=dB_t\), \(X_0=0\), on \([0,1]\), the exact terminal value is \(X_1=B_1\). Euler–Maruyama is exact at grid points if it uses the increments of this same Brownian motion: summing its updates gives \(X_N^h=\sum_{n=0}^{N-1}\Delta B_n=B_1\). Thus the coupled squared error is zero for every \(N\).

Now generate an independent Brownian motion \(\widetilde B_t\) for the numerical path and compare \(B_1\) with \(\widetilde B_1\). These are independent \(N(0,1)\) variables. The proposition gives \(\mathbb{E}|B_1-\widetilde B_1|^2=2\), so the root-mean-square difference is \(\sqrt{2}\), not zero. Refining the grid does not change this calculation: both endpoint variables still have variance \(1\).

Check: the difference \(B_1-\widetilde B_1\) is centered and has variance \(1+1=2\), because the two variables are independent. Its mean-square error is \(2\), and its root-mean-square error is \(\sqrt{2}\). The comparison fails as a strong-error test because the two paths are not driven by the same noise.

For a nontrivial approximation, coupling still matters: construct the exact solution and the numerical scheme from the same Brownian increments, aggregating fine increments consistently when comparing different resolutions. This isolates discretization error from the unrelated variation between independent Brownian paths. The strong convergence rate concerns the resulting coupled error, under the hypotheses of the relevant convergence result; it is not inferred from two paths merely having the right marginal distributions.

Mean-Square Error Is Not Root-Mean-Square Error

For errors \(e_j\), the mean-square error is the average of the squared errors, while the root-mean-square error is the square root of that average. For random error \(E\), the corresponding population quantities are \(\mathbb{E}|E|^2\) and \((\mathbb{E}|E|^2)^{1/2}\). Squaring and taking a square root are not interchangeable labels: the first quantity has squared units, and the second has the same units as the solution.

Definition: Given \(M\ge1\) computed errors \(e_1,\ldots,e_M\), their mean-square error is \(\frac1M\sum_{j=1}^M e_j^2\), and their root-mean-square error is \(\left(\frac1M\sum_{j=1}^M e_j^2\right)^{1/2}\). These are different statistics unless the mean-square error happens to be \(0\) or \(1\).

Worked Example: Convert the Error Statistic Before Reporting It

Suppose four coupled path comparisons give errors \(e_1=1/2\), \(e_2=-1/2\), \(e_3=1\), and \(e_4=0\). The squared errors are \(1/4\), \(1/4\), \(1\), and \(0\). Their sum is \(1/4+1/4+1=3/2\). Dividing by four gives mean-square error \((3/2)/4=3/8\). Taking the square root gives root-mean-square error \(\sqrt{3/8}\).

Check: the mean-square error is approximately \(0.375\), while the root-mean-square error is approximately \(0.6124\). Squaring \(\sqrt{3/8}\) returns \(3/8\). Reporting \(3/8\) as the root-mean-square error would omit the required square root.

When errors come from simulated paths, the average over paths is a sample estimate of the corresponding expectation; it is not itself the exact expectation. This distinction is separate from the distinction between mean-square and root-mean-square error. First identify whether the target is a population quantity or a finite-sample estimate, then identify whether it is squared or square-rooted.

Common Pitfalls and a Reliable Diagnostic

Wrong calculation: “A Brownian increment over a step \(h\) is \(hZ\), since the step has length \(h\).” This gives variance \(h^2\), not \(h\). Correction: use \(\sqrt{h}Z\); the variance is then \(h\). For \(0<h<1\), the wrong scaling has too little variance; for \(h>1\), it has too much.

Wrong comparison: “The exact and approximate endpoints have the same distribution, so their difference measures a small strong error.” Equal marginal distributions do not ensure small differences. Strong error requires a coupling using the same Brownian motion; independent copies can differ by an amount that does not decrease with the time step.

Wrong label: “The average squared error is the root-mean-square error.” It is the mean-square error. Take a square root only when reporting root-mean-square error.

1
Check each noise increment.
For a step of length \(h\), verify that its variance is \(h\), typically by writing \(\Delta B_n=\sqrt{h}Z_n\).
2
Check the coupling.
For strong error, construct the exact and approximate paths from the same Brownian increments.
3
Check the reported statistic.
State whether the quantity is the mean of squared errors or the square root of that mean.

Check Your Understanding

For each question, keep the variance, coupling, and error statistic distinct.

  1. For \(h=1/9\), compare the variances of \(\sqrt{h}Z\) and \(hZ\). Is the incorrect variance too large or too small?
  2. For \(N\) steps of length \(h=T/N\), what is the terminal variance obtained by summing independent increments \(hZ_n\)?
  3. Why does an independent exact Brownian endpoint fail to provide the strong-error comparison for an Euler path driven by another Brownian motion?
  4. If the mean-square error is \(9/16\), what is the root-mean-square error?
  5. For the SDE \(dX_t=dt+2\,dB_t\), write the correct Euler drift and diffusion increments for a step of length \(h\).