A stochastic differential equation gives you a recipe for what happens over the next tiny step, but it does not yet give you a price you can use. The one on this page is Geometric Brownian motion (GBM), dS=μS dt+σS dW\dS = \mu S \,\dt + \sigma S \,\dW: over the next dt\dt the price moves by μS⋅dt\mu S \cdot \dt for certain and by σS⋅dW\sigma S \cdot \dW at random. This is a modelling choice, not something derived: it says the percentage move over the next dt\dt is μ dt+σ dW\mu \,\dt + \sigma \,\dW — 2.2's Brownian motion with a drift, applied to returns rather than to the price — so that a doubling of the price doubles the size of every move and the price can never go below zero. 2.11 is where that choice is tested. To turn that recipe into simulated prices, a developer has to make three decisions: whether to draw the final price directly or build a path step by step, how fine a grid to use if stepping is needed, and how to check that the simulation is actually correct. Each decision has an answer that looks reasonable and produces convincing numbers, yet is wrong, so the point of this page is to show what the right choices are and how to recognise the mistakes. The one piece of maths it needs, 2.5 already did.

What this page shows, and how

The page follows the three decisions in the order a developer meets them.

First, draw or step. If the payoff only depends on the final price, there is no grid at all: the model has a solution, and one normal number per path gives the final price exactly. The first table shows what that distribution looks like — Gaussian log-returns, a mean price of S0eμTS_0 e^{\mu T} and a median price below it — and shows the one way to get it wrong, which is to leave the −12σ2-\tfrac12\sigma^2 out of the exponent and make every price 8 % too high.

Second, if you step, what it costs. A payoff that looks at the path needs the path. For this model you can still step exactly, because the solution holds between any two grid points; the approximate step — Euler's, the recipe read literally — is what you are left with when a model has no solution, and this is the one model where its error can be measured against the truth. The second table does that: about 1 % per path at 100 steps, shrinking like 1/n1/\sqrt{n}, with mean zero — so a price, which is an average over paths, barely feels it, while a spread across paths keeps it.

Third, how you know the simulator is right. Three numbers a correct simulation must reproduce — the realised volatility of each path, the mean of the final price, its median — and the one common bug they catch, σZ⋅dt\sigma Z \cdot \dt written in place of σZ⋅dt\sigma Z \cdot \sqrt{\dt}, which leaves the mean untouched and shrinks the volatility a hundredfold at ten thousand steps.

The why comes last and is short: 2.5's lemma on log S gave a line with no SS on the right, and adding up its steps is the solution. Nothing new is proved on this page; the three tables put numbers on what 2.5 already said.

The experiment — what was done

Every number on this page comes from one experiment. First, we generated 10610^6 exact GBM terminal prices by drawing a single normal random number for each path and evaluating the closed-form solution at T=1T = 1, once for the working case μ=0.1\mu = 0.1 and again for the comparison case μ=0\mu = 0. With the same parameters, S0=100S_0 = 100 and σ=0.4\sigma = 0.4, we then drew 1,000 Brownian paths once on a very fine grid of 10610^6 steps and read those same paths on five nested grids, from 100 to 10610^6 steps. On each grid, the terminal price produced by Euler was compared with the exact solution built from exactly the same Brownian increments, while the common σZ⋅dt\sigma Z \cdot \dt bug was run alongside on those same paths and grids. A second simulation generated 20,000 fresh Euler paths at 10,000 steps, for both values of μ\mu, so that the mean and median of the Euler prices could be measured with no closed-form solution anywhere inside the simulation; the comparison with the exact STS_T on the same normals was made afterwards. Finally, a separate mean-reversion (Ornstein–Uhlenbeck) experiment was run inside the same seeded experiment (seed 20261001). Its results are recorded in the JSON file but are not used on this page.

D4·one path, two step rules

path 1 of the experiment · n = 100 · μ = 0.1 · σ = 0.4 · S₀ = 100

What you are looking at. One Brownian path — the experiment’s path 1, 100 random draws Z₁ … Z₁₀₀ — fed through two different rules for moving the price one step. Both rules get the same draw on every step, so the two lines share every turn. They drift apart only because the rules differ at second order: the exact rule multiplies the price by e^((μ − ½σ²)·dt + σ·√dt·Z), the Euler rule by 1 + μ·dt + σ·√dt·Z. Summed over the path, Euler’s correction is −½σ²·Σ(ΔW)² where the exact rule’s is −½σ²·T; on this path Σ(ΔW)² = 1.44 against T = 1, so Euler sits below and ends 3.42 % lower. μ moves both lines together; on this path the gap goes from −3.38 % at μ = 0 to −3.46 % at μ = 0.2 — it is set by σ and Σ(ΔW)², not by μ.

  • exact step — multiply by e^((μ − ½σ²)dt + σ√dt·Zᵢ)
  • Euler step — multiply by 1 + μ dt + σ√dt·Zᵢ
  • the bug — σ·dt·Zᵢ in place of σ·√dt·Zᵢ (toggle)

S_T over 10⁶ exact draws — mean 110.5, median 102.0; your live sample overlaid

exact S_T
170.78
Euler S_T, same draws
164.94
gap, Euler − exact
−3.42 %
Σ(ΔW)² on this path (T = 1)
1.438
rms gap over 1,000 paths
1.15 %
paths at T
2,0000 off the bins
mean S_T
111.28 ± 1.07correct: 110.52
median S_T
101.10correct: 102.02
realised vol
0.3991correct: 0.40
10⁶ exact: mean
110.47 ± 0.05median 102.05
10⁶ exact: below mean
57.9 %0.34 % are past 300
Path
Increment
fitted slope, against dt
0.495R² 0.9982
the experiment’s, against n
−0.501n = 100 … 10⁶

Generate draws new paths on this site’s generator, which is not numpy’s. The distribution’s line is a fresh sample stepped with the chosen increment; the bars are the committed histogram, drawn at σ = 40% only, because that is where it was run. The convergence chart always measures the correct step: its fitted slope is 0.495 over 300 paths at seven step counts, against a theoretical ½.

Draw STS_T directly

The first decision is whether you need a path at all. If the payoff depends only on the final price, there is no reason to build a grid and step through time. The solution of GBM gives the terminal price directly from a single normal random variable, so one draw produces one exact sample of STS_T. This is the distribution that later pages use inside Monte Carlo pricing and that 2.9 integrates analytically. The question for this section is therefore simple: if we draw terminal prices directly, what does the distribution actually look like, and what mistakes matter?

Exact terminal draws, both drifts

One normal per path, 10610^6 paths for each of the two drifts, S0=100S_0 = 100, σ=0.4\sigma = 0.4, T=1T = 1. Seed 20261001, from the committed experiments/2_6_sdes_and_gbm.json (exact.{log_return,S_T} for μ=0.1\mu = 0.1, exact_p1.{log_return,S_T} for μ=0\mu = 0). The expected columns are the formulas, not measurements.

10610^6 exact drawsμ=0.1\mu = 0.1expectedμ=0\mu = 0expected
log⁡(ST/S0)\log(S_T/S_0): mean0.0198 ± 0.0004(μ−12σ2)T=0.0200(\mu - \tfrac12\sigma^2)T = 0.0200−0.0800 ± 0.0004−0.0800
log⁡(ST/S0)\log(S_T/S_0): variance0.1596 ± 0.0002σ2T=0.1600\sigma^2 T = 0.16000.1603 ± 0.00020.1600
log⁡(ST/S0)\log(S_T/S_0): skewness−0.005 ± 0.0020+0.002 ± 0.0020
log⁡(ST/S0)\log(S_T/S_0): excess kurtosis+0.001 ± 0.0050+0.002 ± 0.0050
mean STS_T110.47 ± 0.05S0eμT=110.52S_0 e^{\mu T} = 110.52100.02 ± 0.04100.00
median STS_T102.05 ± 0.05S0e(μ−12σ2)T=102.02S_0 e^{(\mu - \frac12\sigma^2)T} = 102.0292.30 ± 0.0592.31
paths ending below the mean57.9 %Φ(12σT)=57.9\Phi(\tfrac12\sigma\sqrt{T}) = 57.9 %57.9 %57.9 %

The table shows that the log-return behaves exactly as the theory predicts. Across one million paths, its mean is 0.0198 ± 0.0004 (± is one standard error, here and throughout) against the theoretical value 0.0200 and its variance 0.1596 against 0.1600; its skewness is −0.005 ± 0.002, 1.9 standard errors from zero, and its excess kurtosis +0.001 ± 0.005 — both inside the 5-s.e. tolerance the checks use, and the independent μ=0\mu = 0 run gives +0.002 for the skewness — the opposite sign — and +0.002 for the kurtosis, which is what sampling noise looks like. In other words, the log-return is Gaussian. The price distribution inherited from that Gaussian also lands where it should. For the working case μ=0.1\mu = 0.1, the mean terminal price is 110.47 ± 0.05 against the theoretical 110.52, while the median is 102.05 against 102.02. For the comparison case μ=0\mu = 0, the mean comes back at 100.02, essentially equal to S0S_0, while the median falls to 92.30. The final row provides perhaps the clearest picture of the shape of the distribution: 57.9 % of all paths finish below the mean.

The most common mistake is to use the exponent that would come from ordinary calculus and omit the volatility-drag term. If that happens, every simulated terminal price is multiplied by e12σ2Te^{\frac12\sigma^2 T}. With σ=0.4\sigma = 0.4 and T=1T = 1, that factor is e0.08≈1.083e^{0.08} \approx 1.083. In the μ=0\mu = 0 case, the mean price then becomes 108.3 instead of 100. The error is not random and does not disappear as more paths are added. Every draw is wrong in the same direction, so every price computed from those draws is roughly 8 % too high.

The median deserves its own row because it answers a different question from the mean. The log-return is Gaussian, and the median of a Gaussian is its mean. Since the exponential function preserves ordering, the median price is obtained by exponentiating the mean log-return. The mean price, however, receives additional support from the relatively rare but very large outcomes in the right tail. That is why a single path is more likely than not to finish below the expected price. The proportion of paths below the mean is Φ(12σT)\Phi(\tfrac12\sigma\sqrt{T}) — Φ\Phi is the probability that a standard normal is below its argument — which here is Φ(0.2)=0.579\Phi(0.2) = 0.579, independent of μ\mu. The median tells you the point a single path is as likely to finish above as below; the mean tells you where the average of many paths lands. The gap between them is the numerical footprint of volatility drag.

If you step, know what it costs

The second decision appears when the payoff depends on the path rather than just the final price. A barrier option, an average-price option, or the hedging simulator in 2.7 all need prices along the way, so you must step and choose a grid size. For GBM, however, stepping does not mean approximating: the model can be stepped exactly,

Si+1=Si⋅e(μ−12σ2)dt+σΔWi.S_{i+1} = S_i \cdot e^{(\mu - \frac12\sigma^2)\dt + \sigma \Delta W_i}.

That is how 2.7 will generate paths. Euler,

Si+1=Si(1+μ dt+σdt⋅Zi),S_{i+1} = S_i(1 + \mu \,\dt + \sigma\sqrt{\dt} \cdot Z_i),

is the method you use when a model has no closed-form solution. GBM is valuable because it lets us measure Euler's error against the truth.

Euler's gap from exact, against n

The 1,000 nested paths, each read on all five grids, Euler against the exact solution on the same increments, from grids[*] of the same file: gap_rel.rms, gap_log.rms_expected (the formula, not a measurement), first_paths.{sum_dW_sq,gap_rel}[0], gap_log.{mean,se_of_mean}. The last column is the gap in log⁡ST\log S_T; the rms and path-1 columns are the relative gap in STS_T. The rms gap is Euler vs exact, on 1,000 paths.

nnrms gap in STS_T12σ2T2/n\tfrac12\sigma^2 T\sqrt{2/n}path 1: ∑(ΔW)2\sum (\Delta W)^2path 1: gap in STS_Tmean of the gap ± s.e.
1001.15 %1.13 %1.438−3.42 %−0.02 % ± 0.04 %
1,0000.361 %0.358 %1.041−0.32 %−0.01 % ± 0.01 %
10,0000.109 %0.113 %1.002−0.014 %+0.002 % ± 0.003 %
100,0000.034 %0.036 %0.9975+0.020 %−0.0002 % ± 0.001 %
1,000,0000.012 %0.011 %0.9994+0.005 %−0.0003 % ± 0.0004 %

That error is not small on a single path. Using the same Brownian increments, the rms gap between Euler and the exact STS_T is 1.15 % at 100 steps, then 0.36 %, 0.11 %, 0.034 %, and 0.012 % as the grid is refined from 10210^2 to 10610^6 steps. Every 100× increase in the number of steps buys about a 10× reduction in the error, giving a measured slope of −0.501. On path 1 at n=100n = 100, the gap is 3.4 %. That path happened to have

∑(ΔW)2=1.44,\sum (\Delta W)^2 = 1.44,

well above its limiting value of 1, so the Euler path drifted noticeably below the exact one.

The important result is that this error is a noise, not a bias. Its mean is zero on every grid, with −0.02 % ± 0.04 % at n=100n = 100. That leads to the practical rule for simulation work:

Means ignore it; spreads keep it.

A price is an average across paths, so a zero-mean error largely cancels out. A spread, variance, hit-rate, or P&L distribution keeps the extra noise because variances add. Even with no −12σ2-\tfrac12\sigma^2 term in any step, 20,000 Euler paths at n=104n = 10^4 produce a mean of 110.62 ± 0.32 against 110.52, and a median of 101.99 ± 0.36 against 102.02. The averages come out right because the stepping error averages away (for the mean of STS_T it is also exact algebra: E[STE]=S0(1+μ dt)n=110.517\E[S^E_T] = S_0(1 + \mu \,\dt)^n = 110.517 at n=104n = 10^4, STES^E_T being the Euler path's terminal price).

The reason is visible from the same (ΔW)2(\Delta W)^2-versus-dt\dt effect that appeared in 2.5. Taylor's formula for log along the Euler path gives

log⁡(STE/S0)=μT+σWT−12σ2∑(ΔW)2+O(1/n),\log(S^E_T/S_0) = \mu T + \sigma W_T - \tfrac12\sigma^2 \sum (\Delta W)^2 + O(1/n),

while the exact solution has

log⁡(ST/S0)=μT+σWT−12σ2T.\log(S_T/S_0) = \mu T + \sigma W_T - \tfrac12\sigma^2 T.

Their difference is therefore

−12σ2(∑(ΔW)2−T).-\tfrac12\sigma^2\left(\sum (\Delta W)^2 - T\right).

The whole leading error is the residual randomness in ∑(ΔW)2\sum (\Delta W)^2. On path 1,

−0.08×(1.438−1)=−0.0350,-0.08 \times (1.438 - 1) = -0.0350,

against a measured gap of −0.0348. Euler's error is simply the finite-grid version of quadratic variation not yet having settled down to TT. That is why it behaves like a zero-mean noise, why it shrinks like 1/n1/\sqrt{n}, and why means largely ignore it while spreads do not.

Test the simulator

The third decision is whether to trust the paths you have generated. GBM gives three properties that are cheap to measure and precise enough to fail when something is wrong: the realised volatility of each path should be σ\sigma, the mean terminal price should be S0eμTS_0 e^{\mu T}, and the median terminal price should be S0e(μ−12σ2)TS_0 e^{(\mu - \frac12\sigma^2)T}. Together these tests check both the distribution and the stepping rule. The mean and median catch mistakes involving the −12σ2-\tfrac12\sigma^2 term. The realised-volatility test catches mistakes in the simulation itself.

The most common example is writing the noise term as σZ⋅dt\sigma Z \cdot \dt instead of σZ⋅dt\sigma Z \cdot \sqrt{\dt}. Nothing crashes. The paths still look like prices. The mean terminal price still passes, because it is driven by the drift term μ dt\mu \,\dt, which is unchanged. Looking only at the mean therefore gives false confidence that everything is working.

Realised vol, correct and σZ·dt steps

The same 1,000 paths on the same grids, from grids[*]. The correct-step column is realised_vol.demeaned_mean and the σZ⋅dt\sigma Z \cdot \dt column is realised_vol_bug.demeaned_mean, the per-step sd form the text below defines; then realised_vol_bug.{demeaned_expected,factor_too_small} and log_bug.{sd,sd_correct_expected}. The σdt\sigma\sqrt{\dt} and σT\sigma\sqrt{T} columns are formulas, not measurements. The sd⁡\sd of log⁡ST\log S_T is across paths.

nnrealised vol, correct steprealised vol, σZ⋅dt\sigma Z \cdot \dt stepσdt\sigma\sqrt{\dt}factor too smallsd⁡\sd of log⁡ST\log S_T, σZ⋅dt\sigma Z \cdot \dt stepcorrect: σT\sigma\sqrt{T}
1000.39980.03990.0400100.03850.400
1,0000.40020.01270.012631.60.01220.400
10,0000.39990.00400.00401000.003850.400
100,0000.40000.001260.001263160.001220.400
1,000,0000.40000.000400.000401,0000.0003850.400

The realised volatility immediately exposes the problem. Measured as

n/T×sd⁡ of the path’s per-step log-returns,\sqrt{n/T} \times \sd \text{ of the path's per-step log-returns},

it should return σ\sigma whatever grid is used. The correct simulation gives 0.3998 at n=100n = 100, 0.3999 at n=104n = 10^4, and 0.4000 at n=106n = 10^6. The buggy simulation instead gives 0.0399, 0.0040, and 0.00040. The volatility is too small by a factor of n\sqrt{n}, and the error becomes worse as the grid is refined. The spread of terminal outcomes collapses with it: at n=104n = 10^4, the standard deviation of log⁡ST\log S_T is only 0.00385 instead of 0.40.

The reason is the same dt\sqrt{\dt} scaling introduced in 2.1. The volatility is independent of the grid because nn kicks of size σdt\sigma\sqrt{\dt} contribute a total variance of

n⋅σ2dt=σ2T,n \cdot \sigma^2 \dt = \sigma^2 T,

independent of the grid. Replacing dt\sqrt{\dt} by dt\dt changes that to

n⋅σ2dt2=σ2T⋅dt,n \cdot \sigma^2 \dt^2 = \sigma^2 T \cdot \dt,

which tends to zero as the grid is refined. The simulation becomes less random precisely when it should not.

There is a second visual tell. In a correct step, the random kick σdt\sigma\sqrt{\dt} is much larger than the drift increment μ dt\mu \,\dt. At n=104n = 10^4, they are roughly 4×10−34 \times 10^{-3} and 10−510^{-5} respectively. With the bug, both become dt\dt-sized. The drift is now about a quarter of each random kick, so the path climbs steadily with very little jitter. It looks smoother, not noisier. That apparent smoothness is the warning sign that the dt\sqrt{\dt} has been lost.

Solving the SDE: from a one-step rule to a formula for STS_T

The price model is dS=μS dt+σS dW\dS = \mu S \,\dt + \sigma S \,\dW, so its drift is a=μSa = \mu S and its volatility b=σSb = \sigma S, both proportional to the price.

The mathematics behind this page begins with the last line of 2.5. Applying the general result to f(S)=log⁡Sf(S) = \log S, with drift a=μSa = \mu S and volatility b=σSb = \sigma S, gave

d(log⁡S)=(μ−12σ2) dt+σ dW.\dd(\log S) = (\mu - \tfrac12\sigma^2) \,\dt + \sigma \,\dW.

The −12σ2-\tfrac12\sigma^2 comes from the curvature term 12b2⋅∂2f/∂x2\tfrac12 b^2 \cdot \partial^2 f/\partial x^2: b2b^2 contributes σ2S2\sigma^2 S^2, ∂2f/∂x2\partial^2 f/\partial x^2 contributes −1/S2-1/S^2, and the S2S^2 cancels.

The crucial thing to notice is what has disappeared. The original price equation contains SS on the right-hand side, so the next step depends on where the price is now. The equation for log⁡S\log S does not. Its drift is constant and its volatility is constant. That is the whole reason for taking the logarithm: it turns a state-dependent equation into one that can be added up directly.

Once that happens, the next step is simple. Add the equation over the nn intervals of a grid. The left-hand side telescopes:

∑Δ(log⁡S)=log⁡ST−log⁡S0.\sum \Delta(\log S) = \log S_T - \log S_0.

The right-hand side adds just as easily. The drift terms produce (μ−12σ2)T(\mu - \tfrac12\sigma^2)T, while the Brownian increments add to WTW_T:

log⁡(ST/S0)=(μ−12σ2)T+σWT.\log(S_T/S_0) = (\mu - \tfrac12\sigma^2)T + \sigma W_T.

No limit is needed. Once SS has vanished from the right-hand side, the sum is exact.

The final step is to exponentiate:

ST=S0⋅e(μ−12σ2)T+σWT.S_T = S_0 \cdot e^{(\mu - \frac12\sigma^2)T + \sigma W_T}.

This is the solution of GBM. No path was stepped and no approximation was made. The stochastic differential equation has been turned into a formula for the terminal price.

Using the result from 2.2,

WT=T⋅Z,W_T = \sqrt{T} \cdot Z,

where ZZ is a standard normal random variable, the solution becomes

ST=S0⋅e(μ−12σ2)T+σT⋅Z.S_T = S_0 \cdot e^{(\mu - \frac12\sigma^2)T + \sigma\sqrt{T} \cdot Z}.

One normal draw therefore produces one exact sample of STS_T.

This is what it means to solve an SDE: not to simulate it step by step, but to write the random variable of interest directly as a formula involving the underlying Brownian motion. Most SDEs cannot be solved in this way. GBM is special because taking logs removes the dependence on SS, leaving constant coefficients that can be summed exactly. That solvability is the reason closed-form results exist later in the course, including the formulas used in 2.9.

Why the mean and the median differ

The mean and the median differ because exponentials do not preserve averages. Starting from the solution,

ST=S0e(μ−12σ2)T+σWT,S_T = S_0 e^{(\mu - \frac12\sigma^2)T + \sigma W_T},

the mean is

E[ST]=S0e(μ−12σ2)T⋅E[eσWT].\E[S_T] = S_0 e^{(\mu - \frac12\sigma^2)T} \cdot \E[e^{\sigma W_T}].

From 2.5, E[eWt]=et/2\E[e^{W_t}] = e^{t/2}. Replacing WW by σW\sigma W gives

E[eσWT]=e12σ2T,\E[e^{\sigma W_T}] = e^{\frac12\sigma^2 T},

which cancels the −12σ2T-\tfrac12\sigma^2 T exactly. The result is

E[ST]=S0eμT.\E[S_T] = S_0 e^{\mu T}.

The volatility drag does not lower the mean price. It appears in the log-return and is exactly offset when the exponential is averaged.

The median is different. The log-return is Gaussian with mean (μ−12σ2)T(\mu - \tfrac12\sigma^2)T, and the median of a Gaussian is its mean. Since the exponential function preserves order, the median price is

S0e(μ−12σ2)T.S_0 e^{(\mu - \frac12\sigma^2)T}.

The mean sits above it because a small number of very large outcomes pull the average to the right. This is 2.5's observation that the mean of an exponential is not the exponential of the mean, now attached to a price distribution. The same asymmetry explains why more than half the paths finish below the mean:

ST<S0eμT  ⟺  Z<12σT.S_T < S_0 e^{\mu T} \iff Z < \tfrac12\sigma\sqrt{T}.

For σ=0.4\sigma = 0.4 and T=1T = 1, this threshold is 0.2, so the fraction below the mean is Φ(0.2)=0.579\Phi(0.2) = 0.579. The expected price and the point a single path is as likely to finish above as below are therefore different numbers, separated by the volatility drag.

Into 2.7

Into 2.7, the focus shifts from the price SS itself to an option value V(t,S)V(t, S) and to a portfolio that holds the option together with a position in the underlying. The general form from 2.5 is applied for the first time to a function of both time and price, using this page's drift and volatility, a=μSa = \mu S and b=σSb = \sigma S, giving

dV=(∂V∂t+μS⋅∂V∂S+12σ2S2⋅∂2V∂S2)dt+σS⋅∂V∂S dW.\begin{aligned} \dd V = {} & \left( \frac{\partial V}{\partial t} + \mu S \cdot \frac{\partial V}{\partial S} \right. \\ & \quad \left. {} + \tfrac12\sigma^2 S^2 \cdot \frac{\partial^2 V}{\partial S^2} \right) \dt \\ & {} + \sigma S \cdot \frac{\partial V}{\partial S} \,\dW. \end{aligned}

The key idea is to choose a hedge ratio Δ=∂V/∂S\Delta = \partial V/\partial S, which cancels the dW\dW term and removes the randomness from the portfolio. What remains is locally risk-free and therefore must earn the risk-free rate rather than the stock's drift. In the process, μ\mu disappears entirely. The result is the Black–Scholes partial differential equation, which 2.7 derives; this page only supplies the GBM model and the calculus needed to get there.

Check

dS = μS dt + σS dW with μ = 0, σ = 0.4, T = 1. Which is true of S_T?

You simulate S_T = S₀e^(μT + σ√T·Z) — the chain rule’s exponent, no −½σ² — and price a European option from 10⁶ draws. The price is:

Euler steps and the exact solution are built from the same normals. At n = 100 steps, and then at n = 10,000, how far apart are the two S_T?

Same Euler simulator, n = 100, 10⁵ paths. You read off (a) the mean of S_T — a price — and (b) the spread of S_T across paths. The 1 % per-path stepping error shows up:

A simulator writes the step as S_{i+1} = S_i(1 + μ dt + σZ·dt). At n = 10⁴, which test fails, and how?