HomeFinanceGeometric Brownian Motion: Stock Price Formula & Python

Geometric Brownian Motion: Stock Price Formula & Python

Last updated: December 3, 2026 · History and formulas checked against the original papers on 3 December 2026. Simulations and S&P 500 statistics: DTF calculations (Python, fixed seed, FRED data to 2 December 2026).

Geometric Brownian motion (GBM) is the standard model in which a stock price moves by random percentage changes. Its equation is dS = μS dt + σS dW, and its exact solution is St = S0 exp((μ − σ²/2)t + σWt), so the price is lognormal and never negative. GBM underpins Black-Scholes. It badly underestimates crashes: it expects one −5% S&P 500 day in about 1,000 years, while the last decade had six.

GBM formulavolatility dragPython simulationfat tails

On 16 March 2020 the S&P 500 closed 12.0% lower. A week earlier, on 9 March, it had fallen 7.6%; on 12 March, 9.5%; and on 18 March, two days later, it dropped another 5.2%. Four daily losses of 5% or more in eight trading days.

Now take the model in almost every quant textbook, the one your options pricer and the Monte Carlo tutorial you just copied both assume: geometric Brownian motion. Fit it to the same index over the last ten years and it says a −5% day should turn up about once every 1,080 years.

So why does everyone still start here? Because GBM gets a surprising amount right, fits in one line of code, and fails in ways specific enough to fix. It also started with pollen.

What is Brownian motion? From pollen to prices

In June, July and August 1827 the Scottish botanist Robert Brown watched tiny particles released from pollen grains (the first plant was Clarkia pulchella) jiggle in water under his microscope. Then he went looking for the same motion in dead matter and found it in dust, soot, pulverised rock and even a fragment of the Great Sphinx. His 1828 report in the Philosophical Magazine says so in its title: “active molecules in organic and inorganic bodies”. Henri Poincaré later summed up the episode: the biologist “believed at first that it is a vital phenomenon, but soon he saw that inanimate bodies did not dance with less fervor than the others, so he handed it over to physicists.”

The explanation took 78 years. In 1905 Albert Einstein argued that the particle is kicked around by invisible water molecules, and that its average squared displacement grows in proportion to time: ⟨x²⟩ = 2Dt. Distance travelled grows with the square root of time, not with time. Einstein gave a worked example: a particle with a radius of about 1 micrometre, in water at 17 °C, should drift about 6 micrometres in a minute. Measure that, and you can count molecules.

Jean Perrin did, in experiments in 1908 and 1909, and used Brownian motion to estimate Avogadro’s number. He received the 1926 Nobel Prize in Physics “for his work on the discontinuous structure of matter”. The mathematical object (continuous paths, independent Gaussian increments, variance growing linearly in time) was built rigorously by Norbert Wiener in 1923, which is why mathematicians call it the Wiener process and write it Wt.

Bachelier 1900 and Osborne 1959: Brownian motion in the stock market

Here is the odd part. One of the first people to write down the mathematics of Brownian motion was not a physicist. On 29 March 1900, five years before Einstein, Louis Bachelier defended a thesis at the Sorbonne called Théorie de la spéculation, with Henri Poincaré as his advisor. Bachelier modelled prices on the Paris market with Gaussian changes whose variance grows linearly with time, derived the heat equation for their probabilities and priced options with it. Bachelier, as his St Andrews biography puts it, “was ahead of his time and his work was not appreciated in his lifetime.”

Bachelier’s prices followed arithmetic Brownian motion: a stock moves up or down by a random number of francs. In 1959 M. F. M. Osborne, a physicist at the U.S. Naval Research Laboratory, published “Brownian Motion in the Stock Market” in Operations Research and changed one thing. He applied the Brownian distribution not to the price but to its logarithm, Y = loge[P(t + τ)/P(t)], and argued that stock prices behave like “an ensemble of particles in statistical mechanics”. His justification included the Weber–Fechner law from psychology: people perceive proportional changes, not absolute ones. A $1 move means something different on a $5 stock and on a $500 one.

Hold on to one more line from Osborne’s abstract; it returns below.

Arithmetic vs geometric Brownian motion

The difference is whether randomness adds dollars or multiplies the price.

Arithmetic BM (Bachelier)Geometric BM (Osborne, Black-Scholes)
EquationdS = μ dt + σ dWdS = μS dt + σS dW
SolutionSt = S0 + μt + σWtSt = S0 exp((μ − σ²/2)t + σWt)
Distribution of Stnormallognormal
Can the price go negative?yesno
Size of movessame in dollars at any priceproportional to the price
Natural fit forquantities that can cross zero, such as spreadsstocks, indices, Black-Scholes

Proportional moves and limited liability (a share cannot be worth less than zero) both point to GBM for stocks.

The geometric Brownian motion stock price formula

GBM is a stochastic differential equation:

dSt = μ St dt + σ St dWt

Read it as: over a short time dt, the percentage change dS/S is a deterministic drift μ dt plus noise σ dW, where dW is normal with mean 0 and variance dt. μ is the expected return per year, σ the volatility per year.

To solve it you cannot use ordinary calculus, because W has no derivative. Kiyosi Itô’s 1944 stochastic integral and the rule now called Itô’s lemma handle it. Apply the lemma to ln S and the second-order term, which would vanish in ordinary calculus, survives because (dW)² behaves like dt:

d(ln St) = (μ − σ²/2) dt + σ dWt

That is arithmetic Brownian motion for the log price. Integrate both sides and exponentiate:

St = S0 · exp((μ − σ²/2) t + σ Wt)

Since Wt is normal with variance t, ln St is normal with mean ln S0 + (μ − σ²/2)t and variance σ²t. Two consequences follow, and they are the ones to remember:

mean price E[St] = S0 eμt · median price = S0 e(μ − σ²/2)t

Why the −σ²/2? Volatility drag, mean vs median

Lose 20% and gain 20% and you are at 0.8 × 1.2 = 0.96: down 4%, although the average of the two returns is zero. Percentages compound, and volatility costs growth. In GBM that cost is exactly σ²/2 per year on the typical (median) path. The mean is pulled up by a long right tail of lucky paths, so it keeps growing at the full μ.

Fix μ = 7% a year, start at 100, look 10 years ahead and change only volatility:

Volatility σMedian growth μ − σ²/2Mean after 10 yearsMedian after 10 yearsP(below start after 10 years)
10%6.5%2011922.0%
20%5.0%20116521.5%
30%2.5%20112839.6%
50%−5.5%2015863.6%
80%−25%201883.9%

Every row has the same expected value. At 80% volatility the median investor keeps 8% of the stake while the average says they doubled it. The average is not lying; it describes a handful of paths you are unlikely to be on.

Now the line from Osborne. In 1959 he noted that, in his model, the expected price “increases, with increasing time interval τ, at a rate of 3 to 5 per cent per year, with increasing fluctuation”, and that this “has nothing to do with long-term inflation, or the growth of assets in a capitalistic economy”. That is the σ²/2 gap between mean and median, spotted 14 years before Black and Scholes; a gap of 3–5% a year corresponds to volatility of roughly 25–32%. The same arithmetic sits under the Kelly criterion: maximising the median growth rate μ − σ²/2 of a levered position gives Merton’s fraction f* = (μ − r)/σ².

Monte Carlo: 10,000 GBM stock price paths

Assumptions: a stock or index at 100, μ = 7% and σ = 20% a year, 10 years in monthly steps, 10,000 paths, exact solution, seed 20261203. Round illustrative numbers, not a forecast.

Fan chart of 10,000 GBM stock price paths over 10 years10,000 simulated geometric Brownian motion paths, start 100, drift 7% a year, volatility 20% a year, monthly steps, 10 years. After 10 years the 5th percentile is 59, the 25th 107, the median 163, the 75th 249 and the 95th 472. The mean path ends at 200, above the median.Fan chart of 10,000 GBM stock price paths over 10 yearsDecodeTheFuture.orggeometric-brownian-motion-stock-priceChartimage/svg+xml© DecodeTheFuture.org5–95%25–75%medianmeanprice (start = 100)01002003004005000246810years95th: 472mean 200median 1635th: 59
10,000 simulated GBM paths: bands show the 5th–95th and 25th–75th percentiles of the price at each month, with four individual paths in grey. The mean (dashed) rises faster than the median. Source: DTF Monte Carlo (calc.py).
After 10 years, start 100SimulationExact formula
Mean price199.7201.4
Median price162.7164.9
Paths ending below the mean62.8%62.4%
Ending below the start, after 1 / 5 / 10 years40.0% / 29.4% / 21.3%40.1% / 28.8% / 21.5%
Ending below 50 (halved)2.9%3.0%
5th / 95th percentile58.8 / 471.7
At least one month-end 20% below the start45.9%

Almost two paths in three finish below the average path. A positive drift still leaves a 40% chance of being down after one year and 21% after ten; it falls slowly because drift grows like t and noise like √t (a refresher: our lesson on probability rules). And nearly half of all paths sit 20% under water at some month-end, though most end well up.

Distribution of the simulated price after 10 yearsHistogram of the price after 10 years for 10,000 simulated GBM paths (start 100, drift 7%, volatility 20%). The distribution is right-skewed and lognormal: most common outcome 100 to 120, median 163, mean 200. 62.7% of paths end below the mean, 21.3% below the start. 2.1% end above 600 (not shown).Distribution of the simulated price after 10 yearsDecodeTheFuture.orggeometric-brownian-motion-stock-priceChartimage/svg+xml© DecodeTheFuture.orgsimulated pathslognormal formulapaths per bin of 2002505007501,0000100200300400500600price after 10 years (start = 100)median 163mean 200start
Distribution of the price after 10 years across the 10,000 paths, with the lognormal density from the formula. The peak is near 100 to 120, the median at 163 and the mean at 200; 2.1% of paths end above 600. Source: DTF Monte Carlo (calc.py).

That right-skewed shape is the lognormal distribution Black and Scholes assumed: a bell curve in logs, a floor at zero and no ceiling in prices.

Geometric Brownian motion in Python: exact vs Euler

The exact method simulates the log price, which has normal increments, then exponentiates. This is the code behind the chart (same seed, same numbers):

import numpy as np

def gbm_paths(S0, mu, sigma, T, steps, n_paths, seed=0):
    """Exact GBM paths: S0 * exp((mu - sigma^2/2) t + sigma W_t)."""
    rng = np.random.default_rng(seed)
    dt = T / steps
    z = rng.standard_normal((n_paths, steps))
    log_inc = (mu - 0.5 * sigma**2) * dt + sigma * np.sqrt(dt) * z
    log_paths = np.cumsum(log_inc, axis=1)
    return S0 * np.exp(np.hstack([np.zeros((n_paths, 1)), log_paths]))

S = gbm_paths(S0=100, mu=0.07, sigma=0.20, T=10, steps=120,
              n_paths=10_000, seed=20261203)
ST = S[:, -1]
print(ST.mean(), np.median(ST), (ST < 100).mean())
# 199.7  162.7  0.2132

def gbm_euler(S0, mu, sigma, T, steps, n_paths, seed=0):
    """Euler-Maruyama: multiply by (1 + mu*dt + sigma*dW) each step."""
    rng = np.random.default_rng(seed)
    dt = T / steps
    S = np.full(n_paths, float(S0))
    for _ in range(steps):
        S *= 1 + mu * dt + sigma * np.sqrt(dt) * rng.standard_normal(n_paths)
    return S

Many tutorials use Euler because it mirrors the equation. We drove both methods with the same daily Brownian increments over 10 years and measured Euler’s error on each path:

Euler stepSteps in 10 yearsMean error per path95th percentile errorMean final price
1 year106.8%16.6%196.1
1 month1202.0%5.0%200.5
1 trading day2,5200.45%1.1%200.9
Exactany00200.9

With annual steps Euler compounds discretely, so its expected value is 100 × 1.0710 = 196.7 instead of 100 × e0.7 = 201.4. The error shrinks roughly with the square root of the step size. For GBM there is no reason to accept any of it; Euler earns its place once you add features with no closed form, such as stochastic volatility.

How GBM underpins Black-Scholes

Fischer Black and Myron Scholes listed their “ideal conditions” in 1973. The key one: the stock price follows a random walk in continuous time with a variance rate proportional to the square of the stock price, so prices at any future date are lognormal. That is GBM. Robert Merton’s 1973 paper reached the same formula by a different route.

The surprise is what happens to μ. Because an option can be hedged continuously with the stock, the expected return drops out of the price; under the pricing (“risk-neutral”) measure μ is replaced by the risk-free rate r. Only σ remains, which is why traders quote options by implied volatility. Our guide to call vs put options prices a 30-day call and put on a $100 stock this way, at 35% volatility. If σ or the lognormal shape is wrong, so is the price.

Estimating μ and σ from real data

Take daily closes P0, …, Pn, compute log returns ri = ln(Pi/Pi−1), then:

σ̂ = std(r) × √252 · μ̂ = mean(r) × 252 + σ̂²/2

(252 is the usual count of trading days in a year.) On the S&P 500 price index from FRED, 5 December 2016 to 2 December 2026 (2,511 daily returns, dividends excluded):

ParameterEstimateStandard error
Volatility σ18.3% a yearabout 0.3 points
Log growth μ − σ²/212.2% a year5.8 points
Drift μ13.8% a year5.8 points (95% range: 2.5% to 25.2%)

Volatility is pinned down to a fraction of a point. The drift is not, and more data at higher frequency will not help: under GBM the standard error of μ̂ is σ/√(years), however finely you sample. Ten years of data cannot tell a 5% stock market from a 20% one. If a backtest’s edge rests on an estimated drift, our guide on backtesting a trading strategy covers what else can go wrong.

Where GBM fails: fat tails, volatility clustering, jumps

Use the same ten years to check the shape, not just the two numbers. If GBM were right, daily log returns would be normal with excess kurtosis near 0. They show 16.1.

Daily S&P 500 falls: what happened vs what GBM and a fat-tailed model expectNumber of days with a daily fall of at least the given size, S&P 500, 2016-12-05 to 2026-12-02 (2,511 trading days). 3% fall or worse: observed 34, GBM expects 9.26, fitted Student-t expects 27.8; 4% fall or worse: observed 15, GBM expects 0.437, fitted Student-t expects 13.8; 5% fall or worse: observed 6, GBM expects 0.00923, fitted Student-t expects 7.8; 7% fall or worse: observed 3, GBM expects 0, fitted Student-t expects 3.3; 10% fall or worse: observed 1, GBM expects 0, fitted Student-t expects 1.3. GBM values below 0.001 are drawn at the left edge.Daily S&P 500 falls: what happened vs what GBM and a fat-tailed model expectDecodeTheFuture.orggeometric-brownian-motion-stock-priceChartimage/svg+xml© DecodeTheFuture.orgactualGBM (normal)Student-t fitdays in 10 years, log scale0.0010.010.1110100≤ −3%34≤ −4%15≤ −5%6≤ −7%≈ 03≤ −10%≈ 01actual
Days with a fall of at least 3%, 4%, 5%, 7% and 10% in the S&P 500, 5 Dec 2016 – 2 Dec 2026: actual count, the count GBM expects with the fitted σ, and the count a Student-t distribution fitted to the same returns expects (ν ≈ 2.6). Data: FRED SP500; calculation: DTF (calc.py).
Daily fall, S&P 500Actual daysGBM expectsStudent-t fit expects
−3% or worse349.327.8
−4% or worse150.4413.8
−5% or worse60.009 (once in ~1,080 years)7.9
−7% or worse3about 3 in 10 million3.3
−10% or worse1effectively 01.3

A cleaner test, with the same variance and different tails: ten years of daily returns at 20% volatility, once normal (GBM) and once Student-t with 3 degrees of freedom scaled to the same 20%. GBM produces a −5% day 0.06 times per decade, the t model 7.4 times (1,000 simulated decades gave 0.07 and 7.5). The Dow’s 22.6% fall on 19 October 1987 is a −20 standard deviation event for GBM at 20% volatility, probability around 10−91. The fitted t says roughly once in 80 years.

None of this is news. In 1963 Benoit Mandelbrot studied cotton prices and proposed replacing Bachelier’s Gaussian with “stable Paretian” laws. Rama Cont’s 2001 survey of “stylized facts” lists heavy tails “with a tail index which is finite, higher than two and less than five” and volatility clustering: “high-volatility events tend to cluster in time”. A 2023 replication on Dow 30 stocks confirmed eight of his eleven facts.

Clustering shows in our data too. Under GBM a big move today says nothing about tomorrow. In the S&P 500 the correlation of daily returns 20 days apart is −0.01, inside the noise band of ±0.04; for absolute returns it is 0.19, and 0.37 a day apart. Four of the six −5% days fell within eight sessions. Robert Engle’s ARCH model (1982) was built for this. Then there are jumps, prices that move with no trading in between, like the weekend gaps in our CFD weekend gap risk study; Merton added a jump process to GBM in 1976.

And yet. Cont’s list also contains “aggregational Gaussianity”: over longer horizons returns get closer to normal. In our data the excess kurtosis falls from 16.1 for daily returns to 2.2 for non-overlapping 21-day returns. So the model that misses the crash by 90 orders of magnitude is a fair first sketch of where a portfolio might be in ten years, and a dangerous tool for sizing a leveraged position overnight. If you size trades from a volatility estimate, our guide to position sizing and risk per trade turns accepted risk into a position; the table above is why a stop that assumes “4 sigma never happens” will be tested.

Frequently asked questions

What is geometric Brownian motion in simple terms?

A model in which a price changes each instant by a small random percentage, with an average drift μ and a volatility σ. Because changes are proportional, the price can never fall below zero and its future value is lognormally distributed.

What is the geometric Brownian motion stock price formula?

The equation is dS = μS dt + σS dW. Its solution is S_t = S_0 · exp((μ − σ²/2)t + σW_t), where W_t is normal with mean 0 and variance t. The mean price grows as S_0·e^(μt), the median as S_0·e^((μ − σ²/2)t).

Why is there a −σ²/2 term in GBM?

Because percentage gains and losses compound: +20% then −20% leaves you 4% down. Itô’s lemma shows the log price drifts at μ − σ²/2, so the typical path grows more slowly than the average, which is lifted by rare very good paths. This gap is called volatility drag.

What is the difference between arithmetic and geometric Brownian motion?

Arithmetic Brownian motion (Bachelier, 1900) adds normally distributed dollar changes, so the price is normal and can go negative. Geometric Brownian motion (Osborne, 1959; Black-Scholes, 1973) applies the randomness to the log price, so changes are proportional and the price stays positive.

How do you simulate geometric Brownian motion in Python?

Draw standard normals z with NumPy, build log increments (μ − σ²/2)dt + σ√dt·z, take the cumulative sum and exponentiate. This exact method has no discretisation error; the Euler scheme was about 2% off per path with monthly steps over 10 years in our test.

Do stock prices really follow geometric Brownian motion?

Only roughly. Daily returns have fat tails, volatility clusters in time, and prices jump. Over the last decade the S&P 500 had six daily falls of 5% or more where GBM expects 0.009. Over longer horizons returns are closer to normal, so GBM is more useful for years than for days.

Who first applied Brownian motion to the stock market?

Louis Bachelier, in his 1900 thesis Théorie de la spéculation, five years before Einstein’s paper on Brownian motion. M. F. M. Osborne’s 1959 paper “Brownian Motion in the Stock Market” applied it to the logarithm of prices, which led to geometric Brownian motion.

This article is educational and not investment advice; simulated paths are not forecasts. If you rerun calc.py with next year’s data, look at the −5% row first: one more March 2020 would add four days to the actual column and almost nothing to the GBM one.

Sources

  1. Brown, R. (1828). A brief account of microscopical observations made in the months of June, July and August 1827, on the particles contained in the pollen of plants; and on the general existence of active molecules in organic and inorganic bodies. The Philosophical Magazine 4(21), 161–173.
  2. Einstein, A. (1905). Über die von der molekularkinetischen Theorie der Wärme geforderte Bewegung von in ruhenden Flüssigkeiten suspendierten Teilchen. Annalen der Physik 322(8), 549–560.
  3. The Nobel Prize in Physics 1926: Jean Baptiste Perrin. NobelPrize.org.
  4. Duplantier, B. (2006). Brownian Motion, “Diverse and Undulating”. In: Einstein, 1905–2005, Poincaré Seminar 2005, Progress in Mathematical Physics 47, 201–293. arXiv:0705.1951.
  5. Wiener, N. (1923). Differential-Space. Journal of Mathematics and Physics 2, 131–174.
  6. Bachelier, L. (1900). Théorie de la spéculation. Annales scientifiques de l’École Normale Supérieure, 3e série, 17, 21–86.
  7. O’Connor, J. J. & Robertson, E. F. Louis Bachelier (biography). MacTutor History of Mathematics, University of St Andrews.
  8. Osborne, M. F. M. (1959). Brownian Motion in the Stock Market. Operations Research 7(2), 145–173.
  9. Itô, K. (1944). Stochastic integral. Proceedings of the Imperial Academy 20(8), 519–524.
  10. Black, F. & Scholes, M. (1973). The Pricing of Options and Corporate Liabilities. Journal of Political Economy 81(3), 637–654.
  11. Merton, R. C. (1973). Theory of Rational Option Pricing. The Bell Journal of Economics and Management Science 4(1), 141–183.
  12. Merton, R. C. (1976). Option pricing when underlying stock returns are discontinuous. Journal of Financial Economics 3(1–2), 125–144.
  13. Mandelbrot, B. (1963). The Variation of Certain Speculative Prices. The Journal of Business 36(4), 394–419.
  14. Cont, R. (2001). Empirical properties of asset returns: stylized facts and statistical issues. Quantitative Finance 1(2), 223–236.
  15. Ratliff-Crain, E., Van Oort, C. M., Bagrow, J., Koehler, M. T. K. & Tivnan, B. F. (2023). Revisiting Cont’s Stylized Facts for Modern Stock Markets. arXiv:2311.07738.
  16. Engle, R. F. (1982). Autoregressive Conditional Heteroscedasticity with Estimates of the Variance of United Kingdom Inflation. Econometrica 50(4), 987–1007.
  17. S&P Dow Jones Indices via FRED, Federal Reserve Bank of St. Louis. S&P 500 (SP500), daily close, 2016-12-05 to 2026-12-02.
  18. Federal Reserve History. Stock Market Crash of 1987.

Sources checked on 3 December 2026; simulations, S&P 500 statistics and tables calculated by DTF (calc.py, seed 20261203).

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments