Financial Mathematics · Lecture 5 of 12
Differential Equations: From Compounding to the Heat Equation
How quantities evolve: ordinary differential equations, how to solve them by hand and by computer, and a first look at the partial differential equation Black–Scholes turns into.
Ordinary differential equations
An ODE relates a function to its own rate of change. The money-market account grows in proportion to its size:
Separation of variables: $\frac{dB}{B}=r\,dt\Rightarrow \ln B=rt+c\Rightarrow B(t)=B_0e^{rt}$. That's continuous compounding again, now as the solution of an equation.
A second classic is mean reversion (it reappears as the Vasicek and Ornstein–Uhlenbeck models):
The gap to the long-run level θ decays exponentially at speed κ, with half-life $\ln 2/\kappa$.
Numerical solution: Euler's method
Most equations have no closed form. Euler's method replaces $dt$ by a small step $h$:
With $h=T/n$ this is exactly discrete compounding, and it converges to $e^{rT}$ as $n\to\infty$. The error is proportional to $h$.
Keep Euler in mind: the stochastic version (Euler–Maruyama, Lecture 7) is how we'll simulate stock prices, and it's the engine behind most Monte Carlo pricers.
Linear ODEs and integrating factors
For $\frac{dy}{dt}+a(t)y=b(t)$, multiply by $e^{\int a}$:
The same trick, "multiply by an exponential to make the left side a total derivative", solves the Ornstein–Uhlenbeck SDE and underlies discounting $e^{-rt}V$.
Partial differential equations
When a quantity depends on two variables, say time and position, its evolution is a PDE. The most important one for us is the heat (diffusion) equation:
Think of $u(\tau,x)$ as temperature along a rod. Heat flows from hot to cold, smoothing out bumps, and the curvature $u_{xx}$ drives the change. Its fundamental solution is a Gaussian that spreads like $\sqrt{\tau}$:
Boundary and terminal conditions
A PDE needs side conditions. For options we know the value at expiry (the payoff) and solve backwards in time to today. That's why we'll write time-to-expiry τ = T − t, which turns a backward problem into a standard forward heat equation.
Key takeaways
- dB = rB dt ⇒ B = B₀e^{rt}. Mean reversion dx = κ(θ − x)dt ⇒ exponential decay to θ.
- Euler's method is discrete compounding, with error O(h). Its stochastic sibling simulates prices.
- The heat equation u_τ = ½u_xx smooths by Gaussian averaging. Black–Scholes reduces to it.
Exercises
- Solve dx/dt = 2(5 − x), x(0) = 1. When is x within 1% of 5?
- Use Euler with h = 0.5 on dB/dt = 0.1B from t = 0 to 2. Compare with e^{0.2}.
- Verify that u(τ,x) = (2πτ)^{−1/2} e^{−x²/(2τ)} satisfies the heat equation.