Euler–Maruyama method
Euler–Maruyama is the simplest standard numerical method for generating approximate trajectories of an Itô stochastic differential equation.
Start with ordinary Euler's method
For the deterministic differential equation
\[\frac{dX}{dt}=a(X,t),\]Euler's method uses
\[\boxed{X_{n+1}=X_n+a(X_n,t_n)\Delta t}.\]The quantity \(a(X_n,t_n)\Delta t\) is the approximate deterministic change during one short interval.
Now start with an SDE
Consider
\[\boxed{dX_t=a(X_t,t)dt+b(X_t,t)dW_t}.\]Over a short interval from \(t_n\) to \(t_{n+1}\), Euler–Maruyama approximates the change by
\[\Delta X_n\approx a(X_n,t_n)\Delta t+b(X_n,t_n)\Delta W_n.\]Therefore
\[\boxed{X_{n+1}=X_n+a(X_n,t_n)\Delta t+b(X_n,t_n)\Delta W_n}.\]Where does \(\Delta W_n\) come from?
A Brownian increment over an interval of length \(\Delta t\) satisfies
\[\Delta W_n\sim N(0,\Delta t).\]To generate this using a standard normal random variable, write
\[\boxed{\Delta W_n=\sqrt{\Delta t}\,Z_n,\qquad Z_n\sim N(0,1)}.\]Hence the practical update formula is
\[\boxed{X_{n+1}=X_n+a(X_n,t_n)\Delta t+b(X_n,t_n)\sqrt{\Delta t}\,Z_n}.\]What exactly is random?
The current value \(X_n\) is already known when a step begins. We evaluate the drift and diffusion there, then generate a new independent standard normal number \(Z_n\).
That random draw determines the Brownian fluctuation for this particular step.
Why a new random number at every step?
Brownian motion has independent increments over non-overlapping time intervals. Therefore each numerical interval requires a new independent normal draw.
One step very slowly
Suppose
\[dX_t=0.4\,dt+0.3\,dW_t,\qquad X_0=2,\qquad\Delta t=0.01.\]Assume the first random draw is
\[Z_0=-1.2.\]First calculate the Brownian increment:
\[\Delta W_0=\sqrt{0.01}(-1.2)=-0.12.\]The deterministic contribution is
\[0.4(0.01)=0.004,\]and the stochastic contribution is
\[0.3(-0.12)=-0.036.\]Therefore
\[X_1=2+0.004-0.036=\boxed{1.968}.\]The next step starts from the new value
At the next time point, \(X_1=1.968\) becomes the current state. If \(a\) or \(b\) depends on \(X\), both coefficients are recalculated at this new state. Then a new independent \(Z_1\) is generated.
The procedure is repeated until the final time is reached.
How one trajectory is constructed
Important: the numerical line is not the exact Brownian path between points
Euler–Maruyama computes values at discrete times
\[t_0,t_1,t_2,\ldots.\]A plotting program usually joins these points with straight line segments. Those segments are only a visual interpolation. They do not mean that the true SDE solution moves linearly between grid points.
A state-dependent example
Consider
\[dX_t=rX_tdt+\sigma X_tdW_t.\]Here
\[a(X)=rX,\qquad b(X)=\sigma X.\]Euler–Maruyama gives
\[\boxed{X_{n+1}=X_n+rX_n\Delta t+\sigma X_n\sqrt{\Delta t}\,Z_n}.\]Both the drift and the size of the random fluctuation are recalculated from the current state \(X_n\) at every step.
Why the noise contains \(\sqrt{\Delta t}\), not \(\Delta t\)
The deterministic contribution scales like
\[\Delta t,\]but Brownian increments have variance \(\Delta t\), so their standard deviation is
\[\sqrt{\Delta t}.\]Therefore the stochastic contribution must scale as
\[b\sqrt{\Delta t}\,Z.\]Replacing \(\sqrt{\Delta t}\) by \(\Delta t\) would simulate the wrong stochastic process.
What happens when \(\Delta t\) is reduced?
A smaller step gives more numerical points and usually improves the approximation. But the individual Brownian increments do not simply become a smooth deterministic curve.
The standard deviation of each increment becomes \(\sqrt{\Delta t}\), while the number of increments increases.
Same Brownian path, different step sizes
One simulation is only one possible history
Changing the random numbers \(Z_0,Z_1,\ldots\) produces another trajectory even when all parameters and the initial condition remain unchanged.
Therefore stochastic modelling usually requires many simulations when we want quantities such as means, variances, threshold probabilities or distributions of epidemic peaks.
Euler versus Euler–Maruyama
| Euler method | Euler–Maruyama |
|---|---|
| ODE | Itô SDE |
| \(X_{n+1}=X_n+a_n\Delta t\) | \(X_{n+1}=X_n+a_n\Delta t+b_n\Delta W_n\) |
| same result for fixed inputs | different paths from different random draws |
| deterministic increments | deterministic + Brownian increments |
Accuracy: what does convergence mean?
For stochastic numerical methods there are different notions of accuracy. Two important ones are strong convergence and weak convergence.
Strong convergence concerns how closely a simulated numerical path follows the corresponding SDE path when driven by the same Brownian motion. Weak convergence concerns quantities such as expectations and distributions.
Under standard regularity conditions, Euler–Maruyama has strong order \(1/2\) and weak order \(1\).
Biological boundaries need care
A basic Euler–Maruyama step can sometimes produce an impossible value such as a negative population or a compartment larger than the total population.
This does not automatically mean the SDE is useless, but it may indicate that the time step, model formulation, approximation or numerical scheme needs reconsideration.
Euler–Maruyama for several variables
For
\[d\mathbf X_t=\mathbf a(\mathbf X_t,t)dt+B(\mathbf X_t,t)d\mathbf W_t,\]the update becomes
\[\boxed{\mathbf X_{n+1}=\mathbf X_n+\mathbf a(\mathbf X_n,t_n)\Delta t+B(\mathbf X_n,t_n)\Delta\mathbf W_n}.\]Here \(\Delta\mathbf W_n\) is a vector of Brownian increments. This form is used for multi-compartment stochastic biological models such as SIR and SEIR systems.
Practical algorithm
What Euler–Maruyama does not do
It does not remove randomness, predict one guaranteed future path, or turn Brownian motion into a differentiable curve. It generates an approximation to one possible stochastic trajectory on a chosen numerical grid.