This section is an experimental addition and is optional material for MATH 551. It is included to give a glimpse of how the ideas from this chapter extend to stochastic settings, but it is not part of the core curriculum or assessments.
Euler–Maruyama extends forward Euler to stochastic differential equations (SDEs): at each step we add a deterministic contribution (the drift) and a random contribution (the diffusion). The method is
where with . Each simulation produces one possible sample path, and convergence is measured in expectation rather than pointwise. Setting recovers forward Euler exactly.
Why Stochastic?¶
Many systems we want to model are not purely deterministic:
Finance: Stock prices fluctuate due to unpredictable market forces. The Black–Scholes model for asset prices is an SDE, specifically geometric Brownian motion.
Biology: Populations are subject to environmental noise. Deterministic logistic growth becomes stochastic when we add to model random environmental fluctuations.
Physics: A pollen grain suspended in water gets buffeted by water molecules, the original Brownian motion observed by Robert Brown in 1827. An ODE for the grain’s position would predict it stays still (no net force). The actual path is a random, jittery curve.
Brownian Motion¶
The Drunkard’s Walk¶
Imagine a person standing at the origin on the real line. At each tick of a clock (spaced apart), they step right by or left by , each with probability . Let denote the -th step. The steps are independent, and by symmetry each has
Here denotes the expected value (or mean) of a random variable : the average over all possible outcomes, weighted by their probabilities. Since , the variance is .
After steps the position is . Since , we can ask: if the walker is currently at position , what is the expected position after one more step? In general, the conditional expectation of a random variable given that another random variable takes the value is
the average of restricted to only those outcomes where . In our case , , and . Given , the only two possible values of are and , each with conditional probability . So:
This says: no matter where the walker currently stands, the expected position after one more step is unchanged. To get the unconditional expectation, we average over all possible values of , weighting each by its probability. Write for the probability that the walker is at position after steps. Then
In the second equality we used the conditional result above: . The final sum is the definition of : recall that takes the values with probabilities , so . (This argument is an instance of the law of total expectation.) Since , unrolling gives .
For the mean-square displacement (the average squared distance from the origin, taken over many realizations), square and average over the two cases:
The cross term cancels between the two cases. Taking expectations gives the recursion , so starting from :
After time we have , so the mean-square displacement is
For this to have a well-defined limit as the discretization is refined, we need to remain constant, i.e. . The natural choice is , giving .
This is precisely what is observed experimentally: if you track a pollen grain suspended in water under a microscope, the mean-square displacement grows linearly with time. Einstein (1905) explained this by the argument above, connecting the microscopic randomness of molecular collisions to the macroscopic diffusion rate.
The Drunkard’s Walk (General Version)¶
Imagine a person standing at the origin who, at regular time intervals , takes a step of random size. Let denote the -th step, drawn from a probability distribution with density (so that ). Suppose the steps are independent with mean zero and variance :
Here denotes the expected value (or mean) of a random variable : the average over all possible outcomes, weighted by their probabilities.
After steps the position is . What are the mean and variance of ? Writing out the expected value against the joint density :
The integral is linear in the sum. Since the steps are independent, the joint density factors as , and the cross-integrals collapse: for . This gives
For the variance, independence is essential. Recall that . Since , the variance reduces to , the mean-square displacement: the average of the squared distance from the origin, taken over many realizations of the walk. Expanding :
Independence means for , so all cross terms vanish and
After time the mean-square displacement is . For this to depend only on and not on the discretization , we need , i.e. each step has standard deviation proportional to .
This is precisely what is observed experimentally: if you track a pollen grain suspended in water under a microscope, the mean-square displacement grows linearly with time. Einstein (1905) explained this by the argument above, connecting the microscopic randomness of molecular collisions to the macroscopic diffusion rate.
Why Gaussian? The Central Limit Theorem¶
Nothing in the drunkard’s walk argument used the shape of the step distribution — only that the steps are independent with mean zero and finite variance. The coin flip, a uniform distribution, or any other zero-mean, finite-variance law all give the same linear growth of mean-square displacement. So why does Brownian motion have Gaussian increments?
The answer is the Central Limit Theorem (CLT): if are i.i.d. with mean 0 and variance , then the normalized sum converges in distribution to a Gaussian,
Equivalently, . In our setting steps of variance give , regardless of the step distribution. The Gaussian emerges as the universal limit of many small independent kicks — a coin-flip walk, a uniform walk, or molecular collisions all produce the same Gaussian in the continuum limit.
This universality is made precise by Donsker’s theorem (the functional CLT): the rescaled random walk converges to Brownian motion as a continuous process, not just at a single time. Brownian motion is the unique scaling limit of every finite-variance random walk, in the same way the Gaussian is the universal limit for sums of independent random variables. Using Gaussian increments from the start simply gives exact Brownian increments at every scale, rather than only in the limit.
From the Random Walk to Continuous Noise¶
Setting and taking the steps to be Gaussian with , the random walk updates as
The scaling is precisely what Einstein’s argument requires. When , this random walk converges to a continuous random function called Brownian motion (or a Wiener process).
Definition 1 (Brownian Motion)
A stochastic process is a (standard) Brownian motion if it satisfies:
.
Independent increments: is independent of for .
Normal increments: .
Continuous paths: is a continuous function of , with probability 1.
Remark 1 (Properties and computation)
Simulation. Property 3 tells us exactly how to simulate on a computer. If we want the increment over a time step of size , we generate where . Each increment is one call to the random number generator, scaled by .
Increment statistics. From property 3, the increment is a Gaussian random variable with mean 0 and variance :
The second property also follows directly from the drunkard’s walk calculation: the variance of position grows linearly in time.
Independence. By property 2, consecutive increments are independent: knowing one tells you nothing about any other.
Computing with Stochastic Processes¶
A stochastic process like gives a different function on every realization. The best we can do is describe statistics of the process: expected values, variances, and correlations across realizations. When we solve an SDE numerically, the solution at each time step is itself a random variable that depends on all the random increments .
In practice, we rarely know the density of explicitly, so we cannot evaluate as an integral. Instead, we approximate it by Monte Carlo sampling: run independent simulations and average the results,
This is a quadrature rule for the integral , where the sample points are drawn from the distribution rather than placed on a deterministic grid. See the companion notebook Monte Carlo Methods for Monte Carlo integration examples, importance sampling, and the Metropolis--Hastings algorithm.
From Euler’s Method to Euler–Maruyama¶
The Integral Form of an ODE (Duhamel’s Principle)¶
Start from . Integrate both sides from to :
This is Duhamel’s principle. Euler’s method approximates the integral by freezing the integrand at the left endpoint (a rectangle rule):
The SDE and Its Integral Form¶
Definition 2 (Stochastic Differential Equation)
A stochastic differential equation (SDE) has the form
where is the drift, is the diffusion, and is Brownian motion.
This notation is shorthand for an integral equation, Duhamel’s principle with two integrals. Over one time step :
We approximate both integrals by the rectangle-rule logic:
Deterministic integral: . This is Euler’s approximation.
Stochastic integral: . We freeze at the left endpoint; what remains is .
The Euler–Maruyama Scheme¶
Algorithm 1 (Euler–Maruyama Method)
Input: Drift , diffusion , initial value , step size , number of steps .
Output: Approximations .
Set .
For :
Generate .
Set .
Set .
Example 1 (Geometric Brownian Motion)
The SDE
where are constants, is called geometric Brownian motion (GBM). Both drift and diffusion are proportional to . This is the SDE underlying the Black–Scholes model for asset prices.
Modelling interpretation. The relative change in price over a short interval has two components:
A deterministic trend (expected rate of return).
A random fluctuation (volatility).
So , i.e. . The multiplicative noise ensures prices stay positive and fluctuations scale with price level.
Euler–Maruyama: With and :
Exact solution. This is one of the rare SDEs with a closed-form solution, making it an ideal test problem: we can compare the Euler–Maruyama approximation against the true solution on the same Brownian path. The exact solution is
The correction is a mathematical consequence of the Itô correction term (see Theorem 3 below), not a modelling choice. The derivation uses Itô’s formula, the stochastic chain rule derived in the next section: set and apply Itô’s formula with (so , ). Here and , so
This has constant coefficients. Integrating from 0 to :
Exponentiating () gives the result.
Convergence of Euler–Maruyama¶
Both (numerical) and (exact) are random variables. On any particular run, the error depends on the Brownian path. We need convergence concepts that account for randomness. Now that we have the expected value at our disposal, there are two natural ways to measure the error.
Strong Convergence: Mean of the Error¶
Strong convergence asks: how close is each numerical path to the true path, on average? We compute the pathwise error on each realization, then take the expected value across all realizations. This matters when individual trajectories are important, for example when simulating a specific stock price path or a particular particle trajectory.
Definition 3 (Strong Convergence)
Theorem 1 (Strong Convergence of Euler–Maruyama)
Under global Lipschitz conditions on the drift and diffusion , Euler–Maruyama has strong order .
Proof 1
We work with the scalar SDE assuming and are globally Lipschitz with constant and satisfy a linear growth bound. Define .
Stage 1: Local error. Suppose we start exactly at and take one EM step. The local error is
Using , Cauchy–Schwarz on the deterministic integral, and the Itô isometry (Property 1) on the stochastic integral:
Deterministic integral contribution: in mean-square.
Stochastic integral contribution: in mean-square.
The stochastic term dominates: .
Stage 2: Global error accumulation. Over one step:
Since is independent of and has zero mean, cross-terms vanish. Using Lipschitz bounds:
By the discrete Grönwall inequality, unrolling from :
By Jensen’s inequality :
Remark 2 (Why Order ?)
The bottleneck is the stochastic integral’s local error: in mean-square vs for the deterministic part. The Itô isometry converts into , gaining only one power of instead of two. This is a direct consequence of .
Contrast with Euler for ODEs: order 1 (halve the step, halve the error). For EM: order (halve the step, reduce error by factor ).
Weak Convergence: Error of the Means¶
Strong convergence is demanding: it requires every individual path to be accurate. Often we only care about statistics of the solution, for instance the expected payoff of a financial derivative or the mean concentration of a chemical species. Weak convergence asks a different question: how well does the method reproduce the expected value? Rather than averaging the error, we look at the error of the average: .
Definition 4 (Weak Convergence)
Theorem 2 (Weak Convergence of Euler–Maruyama)
Under sufficient smoothness of and , Euler–Maruyama has weak order .
Proof 2
Local error. Fix . The exact solution satisfies
(the term comes from the drift’s variation over ). The Euler--Maruyama step gives , so
since . The local weak error is .
The pathwise error is dominated by the term ( in magnitude), but this has zero mean and washes out.
Global accumulation. Summing local errors of size :
Remark 3 (Why Weak Order Is Higher)
Strong convergence pays the full price of the noise; weak convergence only pays for the systematic bias. The leading pathwise error has zero mean and cancels in expectation, giving a full order improvement: strong , weak 1.
More generally, weak convergence holds for for any smooth test function . Taking gives convergence of higher moments; the identity is the case stated above.
Stochastic Calculus and Itô’s Formula¶
To understand where the exact GBM solution comes from, and in particular the correction, we need a stochastic version of the chain rule. This requires first making sense of integration with respect to Brownian motion.
The Itô Stochastic Integral¶
We have already seen that the integral form of an SDE involves an expression , where is some process. The Itô integral defines this as the limit of left-endpoint Riemann sums:
Definition 5 (Itô Integral)
For a process that is adapted (i.e., depends only on information up to time ), the Itô integral is
where is a partition with mesh going to zero, and the integrand is evaluated at the left endpoint of each subinterval.
The left-endpoint choice is what makes this the Itô integral (as opposed to a midpoint or right-endpoint convention). It is also the choice that Euler–Maruyama naturally implements.
Two properties of the Itô integral are essential for everything that follows:
Property 1 (Properties of the Itô Integral)
Zero mean (martingale property): .
Itô isometry: .
Itô’s Formula¶
Now we can derive the stochastic chain rule. Suppose satisfies the SDE , and let be a twice continuously differentiable function. We want the SDE satisfied by .
Theorem 3 (Itô’s Formula)
If and , then
This is the ordinary chain rule plus a correction term that has no deterministic analogue.
Proof 3
Partition into subintervals of width . On each subinterval, write and Taylor-expand :
Sum over all subintervals:
The first sum is a left-endpoint Riemann sum for . Since , this converges to
The second sum requires care. From the SDE,
The first two terms are and respectively, both vanishing in the limit. The third term involves . Since each has mean (from the Brownian increment properties), converges to (not zero!). Therefore:
The higher-order terms involve , so .
Combining, and writing the result in differential form:
which gives the stated formula.
Remark 4 (The Itô Correction)
In ordinary calculus, the chain rule is ; the second-order Taylor term is negligible. For SDEs, contains a piece that is first order and survives. This produces the correction .
This is the origin of the term in the GBM solution (Example 1): applying gives , and the correction is .
Summary¶
Euler–Maruyama extends Euler’s method to SDEs.
Numerical solutions are random variables; each simulation gives one sample path.
The scaling of Brownian increments is why , why the chain rule gains a correction (Itô’s formula), and why strong convergence is order instead of 1.
Strong order , weak order 1.
The companion notebook The Euler–Maruyama Method contains computational experiments: Brownian motion simulation, Itô vs Stratonovich integrals, Euler–Maruyama for geometric Brownian motion, and strong/weak convergence verification. For the underlying algorithms, see Higham (2001).
- Higham, D. J. (2001). An Algorithmic Introduction to Numerical Simulation of Stochastic Differential Equations. SIAM Review, 43(3), 525–546. 10.1137/S0036144500378302