No history yet

Stochastic Calculus Foundations

The Random Walk of Markets

To model asset prices, we need a way to describe randomness that unfolds over time. The fundamental building block for this is the Wiener process, often called Brownian motion. It's the mathematical formalization of a continuous random walk.

A standard WtW_t is defined by three key properties:

  1. It starts at zero: W0=0W_0 = 0.
  2. Its movements over non-overlapping time intervals are independent. The path it takes from today to tomorrow has no memory of the path it took from yesterday to today.
  3. The change over any time interval, WtWsW_t - W_s, is normally distributed with a mean of 0 and a variance equal to the time elapsed, tst-s. In notation, WtWsN(0,ts)W_t - W_s \sim \mathcal{N}(0, t-s).

These properties lead to some strange and powerful results. The path of a Wiener process is continuous everywhere, but differentiable nowhere. It’s a line so jagged that you can't draw a tangent to it at any point. This feature makes it a much better model for volatile market prices than the smooth curves of traditional calculus.

A New Kind of Calculus

Because the Wiener process isn't differentiable, the familiar rules of calculus don't apply. If you have a function f(Wt)f(W_t) that depends on this random process, you can't use the standard chain rule to find its differential, dfdf. We need a new tool.

This is where Itô's Lemma comes in. It's the chain rule of stochastic calculus, designed specifically for functions of stochastic processes like the Wiener process.

The key insight comes from how infinitesimals behave. In standard calculus, terms like (dx)2(dx)^2 are considered so small they become zero. In stochastic calculus, they are not. Because the variance of a change in WtW_t is dtdt, we have a crucial, non-intuitive relationship: (dWt)2=dt(dW_t)^2 = dt. This random term's squared change doesn't vanish; it's proportional to the change in time. accounts for this by adding an extra term to the standard chain rule.

df(t,Xt)=ftdt+fXdXt+122fX2(dXt)2\begin{aligned} \\ df(t, X_t) &= \frac{\partial f}{\partial t} dt + \frac{\partial f}{\partial X} dX_t \\ &+ \frac{1}{2} \frac{\partial^2 f}{\partial X^2} (dX_t)^2 \\ \end{aligned}

This extra term, involving the second derivative (like convexity), captures the impact of the process's inherent randomness. It fundamentally changes how we model the evolution of functions of random variables.

Modeling Stock Prices

Now we can build a realistic model for a stock price, StS_t. We don't model the price directly, but rather its percentage change. We assume the price has a deterministic drift (its expected return) and a random, volatile component. This gives us a Stochastic Differential Equation (SDE).

dStSt=μdt+σdWt\frac{dS_t}{S_t} = \mu dt + \sigma dW_t

This is the SDE for Geometric Brownian Motion (GBM), the workhorse model for equity prices. To find an equation for the stock price StS_t itself, we need to solve this SDE. We can't just integrate it like a normal differential equation; we must use Itô's Lemma.

By applying Itô's Lemma to the function f(St)=ln(St)f(S_t) = \ln(S_t), we can derive the solution for StS_t:

St=S0exp((μσ22)t+σWt)S_t = S_0 \exp\left( \left( \mu - \frac{\sigma^2}{2} \right)t + \sigma W_t \right)

This equation is powerful. It gives us a way to describe the entire future path of a stock price based on its initial price, expected return, volatility, and a source of randomness.

Simulating Price Paths

While the equation for GBM gives us the exact price at a future time tt, it's often more useful to simulate the entire price path. We can do this by discretizing the SDE. We'll simulate small, discrete time steps and build the path step-by-step. The random shocks for each step will be drawn from a normal distribution.

import numpy as np
import matplotlib.pyplot as plt

def simulate_gbm(S0, mu, sigma, T, N):
    """
    Simulates Geometric Brownian Motion price paths.

    S0: Initial stock price
    mu: Expected annual return (drift)
    sigma: Annual volatility
    T: Time horizon in years
    N: Number of time steps
    """
    dt = T / N  # Time step size
    t = np.linspace(0, T, N+1)
    
    # Generate random shocks from a standard normal distribution
    # W = sqrt(dt) * Z, where Z ~ N(0, 1)
    W = np.random.standard_normal(size=N+1)
    W = np.cumsum(W) * np.sqrt(dt)
    
    # GBM formula
    exponent = (mu - 0.5 * sigma**2) * t + sigma * W
    St = S0 * np.exp(exponent)
    return t, St

# --- Simulation Parameters ---
S0 = 100       # Initial price
mu = 0.05      # 5% expected return
sigma = 0.20   # 20% volatility
T = 1.0        # 1 year horizon
N = 252        # Number of trading days in a year

# --- Run and Plot Simulation ---
plt.figure(figsize=(10, 6))
for _ in range(5):
    t, St = simulate_gbm(S0, mu, sigma, T, N)
    plt.plot(t, St)

plt.title('GBM Price Path Simulations')
plt.xlabel('Time (Years)')
plt.ylabel('Stock Price')
plt.grid(True)
plt.show()

This Python code uses NumPy to generate multiple possible price paths. Each simulation run produces a different path because the random shocks drawn from the normal distribution are unique each time. This technique, known as Monte Carlo simulation, is essential for pricing complex derivatives and managing risk.

Ready to test your understanding? This quiz covers the core ideas of stochastic calculus we've discussed.

Quiz Questions 1/6

A standard Wiener process, WtW_t, is a fundamental model for random movement over time. According to its definition, what is the statistical distribution of an increment WtWsW_t - W_s (for t>st > s)?

Quiz Questions 2/6

Which of the following statements best describes the path of a Wiener process?

Mastering these concepts—the Wiener process, Itô's Lemma, and GBM—provides the essential mathematical machinery for modern quantitative finance.