Paths to a distribution
The model assumes the underlying follows geometric Brownian motion, the same process drawn on the home page. Pricing happens under the risk-neutral measure, where the drift is the risk-free rate:
Every path ends somewhere, and the endpoints pile up into a lognormal distribution.
Payoff, average, discount
A call pays \((S_T - K)^+\) at expiry: nothing for the paths that finish below the strike, the excess for the rest. Its price today is the risk-neutral expectation of that payoff, discounted at the risk-free rate:
Averaging the simulated payoffs and discounting gives a Monte Carlo price. The closed form does the same integral exactly.
Hedge away the randomness
Why is the price an expectation under the risk-free drift? Itô's lemma gives the change in an option's value \(V(S, t)\) when \(S\) follows GBM with any drift \(\mu\):
Hold the option and sell \(\Delta = \partial V/\partial S\) shares. The \(dW\) terms cancel, and so does \(\mu\):
The figure runs it on one path that drifts at 8%, not 4%: the option alone swings by dollars while the hedged book barely moves. What's left is the cost of rebalancing only once a day, and it grows when the hedge is adjusted weekly.
The Black-Scholes equation
A riskless portfolio has to earn the risk-free rate, \(d\Pi = r\Pi\,dt\). Setting the two expressions equal gives the Black-Scholes partial differential equation:
Each term has a meaning: time decay, the value of convexity in a moving market, growth at the risk-free rate, and the cost of financing the position. They cancel exactly at every point, which the waterfall checks as \(S\) sweeps across. The real-world drift never appears, which is why pricing can use \(r\) in its place.
Solving it backward
The payoff fixes the value at expiry, \(V(S, T) = (S - K)^+\), and the equation carries it back to today. In time to expiry \(\tau = T - t\) it's a diffusion, close cousin of the heat equation, so the payoff's sharp kink smooths out as \(\tau\) grows.
The figure solves it with Crank-Nicolson: on a grid in \(S\) and \(\tau\), each new value comes from three neighbours one step back, averaging an explicit and an implicit step, which leaves a tridiagonal system to solve at every step:
The closed form
The equation can also be solved exactly. Its solution is the discounted risk-neutral expectation, and with \(S_T = S e^{(r - \sigma^2/2)T + \sigma\sqrt{T}Z}\) the payoff is positive exactly when \(Z > -d_2\). The integral splits in two:
The second piece is the strike times \(N(d_2)\), the risk-neutral probability of exercise. In the first, \(e^{-rT}S_T\,\varphi(z) = S\,\varphi(z - \sigma\sqrt{T})\): weighting by the stock price slides the bell curve right by \(\sigma\sqrt{T}\), and the same region's area becomes \(N(d_1)\).
Puts follow from put-call parity, which the implementation satisfies to better than \(10^{-10}\).