Financial Mathematics · Lecture 7 of 12
Stochastic Differential Equations
Add a noise term to an ODE and you get an SDE. What dX = μ dt + σ dW actually means, how to simulate it, and the model Black–Scholes assumes for stock prices.
From ODE to SDE
An ODE says "change = rate × time". An SDE adds "+ noise × Brownian increment":
Here $a$ is the drift and $b$ the diffusion or volatility coefficient. Because $W$ isn't differentiable (Lecture 6), the equation is shorthand for an integral equation:
The first integral is ordinary. The second is an Itô integral, defined as a limit of sums that always evaluate the integrand at the left endpoint:
Left endpoints mean the integrand is decided before the next random shock arrives, exactly like a trader who picks a position and then watches the market move. Two key properties follow:
Geometric Brownian motion
Black–Scholes assumes the stock's percentage changes have constant drift and volatility:
Over a small step $\Delta t$, the return is roughly $\mathcal N(\mu\Delta t,\sigma^2\Delta t)$. Proportional noise keeps prices positive and makes a ₹1 move on a ₹10 stock as significant as a ₹10 move on a ₹100 stock.
Simulation: Euler–Maruyama
Discretise exactly as in Lecture 5, but replace $dW$ by $\sqrt{\Delta t}\,Z$ with $Z\sim\mathcal N(0,1)$:
import numpy as np
def gbm_paths(S0, mu, sigma, T, n, m, seed=0):
rng = np.random.default_rng(seed)
dt = T / n
Z = rng.standard_normal((m, n))
S = np.empty((m, n + 1)); S[:, 0] = S0
for k in range(n):
S[:, k + 1] = S[:, k] * (1 + mu * dt + sigma * np.sqrt(dt) * Z[:, k])
return S
The average of the simulated paths follows $S_0e^{\mu t}$ (red), but individual paths fan out and most finish below the mean: the lognormal skew from Lecture 2. Push σ up and watch it happen.
Other SDEs you will meet
- Ornstein–Uhlenbeck / Vasicek: $dr=\kappa(\theta-r)\,dt+\sigma\,dW$. Mean-reverting interest rates (it appears in the Vasicek post in the Finance in Banks series).
- CIR: $dr=\kappa(\theta-r)\,dt+\sigma\sqrt r\,dW$. Rates stay non-negative.
- Heston: stochastic volatility, $dv=\kappa(\theta-v)dt+\xi\sqrt v\,dW^{(2)}$, correlated with the stock. One way to fix Black–Scholes' constant-σ assumption (Lecture 12).
Key takeaways
- An SDE dX = a dt + b dW is shorthand for an ordinary integral plus an Itô integral.
- Itô integrals use left endpoints (non-anticipating), have mean zero, and obey the Itô isometry.
- GBM dS = μS dt + σS dW is the Black–Scholes stock model. Simulate it with Euler–Maruyama.
Exercises
- Use the Itô isometry to compute Var(∫₀ᵗ s dW_s).
- Simulate 10,000 GBM paths with μ = 10%, σ = 30%, T = 1. Compare the sample mean and median of S_T with Lecture 2's formulas.
- For the OU process, guess E[r_t] by taking expectations of the SDE (the dW term has mean zero).