Home▸Articles▸Financial Models & Markets

The 2D Geometric Brownian Motion Stock Simulator: Understanding Drift, Volatility, and Random Walks

Geometric Brownian motion (GBM) is a cornerstone model in financial mathematics, used to describe the evolution of stock prices over time.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What Geometric Brownian Motion Is

Geometric Brownian motion (GBM) is a stochastic process used to model the evolution of asset prices over time. It assumes that stock price movements are log-normally distributed, meaning the logarithm of the returns follows a normal distribution.

The GBM equation can be written as dS = μS dt + σS dW, where S represents the stock price, μ is the drift (expected return), σ is the volatility, and dW denotes the increment of a Wiener process (Brownian motion).

Why It Matters in Finance

GBM is crucial for financial modeling because it allows us to estimate future stock prices based on historical data. This model underpins many financial derivatives pricing models, such as the Black-Scholes-Merton option pricing formula.

Moreover, GBM helps in risk management by providing a framework to assess potential losses and gains in portfolios.

live demo · related simulation● LIVE

The Euler-Maruyama Method

To numerically solve the stochastic differential equation (SDE) of GBM, we use the Euler-Maruyama method. This is a simple yet effective technique that approximates the solution by discretizing time into small steps and using random increments to simulate the Wiener process.

The method updates stock prices at each step as S(t+dt) = S(t) + μS(t) dt + σS(t) dW, where dW is a normally distributed random variable with mean 0 and variance dt.

Empirical Mean and Variance Analysis

The simulator tracks the empirical mean and variance of stock prices across many simulated paths. These values converge to theoretical lognormal distributions as more paths are considered, illustrating the law of large numbers.

By comparing these empirical results with exact lognormal formulas, we can validate the accuracy of our numerical method.

Frequently asked questions

How does GBM differ from simple Brownian motion?

GBM incorporates a drift term (μ) that represents the expected return, whereas simple Brownian motion assumes no drift and only captures random fluctuations.

Why is volatility important in financial modeling?

Volatility measures the degree of variation in stock prices over time. It is crucial for risk assessment and pricing financial derivatives like options.

Can GBM be used to predict exact future stock prices?

No, while GBM provides a probabilistic framework to model stock price movements, it cannot predict exact future values due to the inherent randomness in the process.

What are some limitations of using GBM for financial modeling?

GBM assumes constant drift and volatility over time, which may not reflect real-world market conditions. Additionally, it does not account for jumps or other non-continuous price movements.

Try it live

Everything above runs in your browser — open 2D Stock Price Simulator — GBM (Euler-Maruyama) and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open 2D Stock Price Simulator — GBM (Euler-Maruyama) simulation

What did you find?

Add reproduction steps (optional)