# Stochastic Differential Equations: Fundamentals
*A synthesis of handwritten notes (F21) and lectures by Juan MR Parrondo*
---
## 1. Introduction and Motivation
### The Ubiquity of Noise
> "Tune your television to any channel it doesn't receive and about 1% of the dancing static you see is accounted for by an ancient remnant of the Big Bang. The next time you complain there is nothing on, remember you can always watch the birth of the universe." - Bill Bryson (2003)
Noise is fundamental to our understanding of nature. Whether we're observing:
- Cosmic microwave background radiation from the Big Bang
- Radio signals from astronomical sources
We find that randomness and fluctuations are not merely nuisances to be filtered out, but essential components of physical reality.
### From Deterministic to Stochastic
Consider the evolution of a scalar quantity $y: \mathbb{R} \to \mathbb{R}$ governed by simple exponential decay:
$\dot{y} = -\alpha y, \quad \alpha \in \mathbb{R}^+$
The solution $y(t) = Ce^{-\alpha t}$ approaches zero as $t \to \infty$, yielding a stable observable state.
But real systems are subject to fluctuations. We modify our equation:
$\frac{dy}{dt} = -(\alpha + \varepsilon(t))y \tag{1}$
where $\varepsilon(t)$ represents **[white noise](https://en.wikipedia.org/wiki/White_noise)** - a maximally random process with absolutely no temporal correlations.
### Key Insight: The Markov Property
Since $\varepsilon$ is uncorrelated with itself at different times, $y$ at the next moment can only depend on its current value. The process becomes **[Markovian](https://en.wikipedia.org/wiki/Markov_property)** - memoryless in its evolution.
> [!info] Video Explanation
> [Parrondo Part 1 - Introduction to SDEs](https://youtu.be/vcGpD7nZ3UM)
> - [2:00](https://youtu.be/vcGpD7nZ3UM?t=120) - Transition from deterministic to stochastic equations
> - [3:30](https://youtu.be/vcGpD7nZ3UM?t=210) - The Markov property
---
## 2. White Noise and the Wiener Process
### The Problem with White Noise
Equation (1) is problematic because white noise is:
- Not a function in the classical sense
- Has infinite variance
- Is nowhere differentiable
We need a more careful mathematical framework.
### From Discrete to Continuous: The [Random Walk](https://en.wikipedia.org/wiki/Random_walk)
> [!info] Video Explanation
> [Parrondo Part 1 - Random Walk Construction](https://youtu.be/vcGpD7nZ3UM)
> - [5:00](https://youtu.be/vcGpD7nZ3UM?t=300) - Discrete random walk setup
> - [6:30](https://youtu.be/vcGpD7nZ3UM?t=390) - Statistical properties
Consider a discrete-time [symmetric random walk](https://en.wikipedia.org/wiki/Random_walk#Symmetric_random_walk):
$y(t) = \sum_{i=1}^n \eta_i$
where:
$\eta_i = \begin{cases}
+\Delta y & \text{with probability } 1/2 \\
-\Delta y & \text{with probability } 1/2
\end{cases}$
and $n = t/\Delta t$.
The time average: $\langle y(t) \rangle = 0$
The variance:
$\sigma_y^2 = V[y] = \langle y(t)^2 \rangle = n(\Delta y)^2 = \frac{t(\Delta y)^2}{\Delta t}$
### The Continuum Limit
To obtain a well-defined limit as $\Delta t \to 0$, we must scale $\Delta y$ appropriately:
$\Delta y = \sqrt{D \Delta t}$
where $D$ is the [diffusion coefficient](https://en.wikipedia.org/wiki/Mass_diffusivity). This yields:
$\sigma_y^2 = Dt$
The variance grows linearly with time - the hallmark of **[diffusive behavior](https://en.wikipedia.org/wiki/Diffusion)**.
### The Wiener Process
> [!info] Video Explanation
> [Parrondo Part 2 - Wiener Process](https://youtu.be/vRsfjcXBGuI)
> - [0:00](https://youtu.be/vRsfjcXBGuI?t=0) - Mathematical properties
> - [5:00](https://youtu.be/vRsfjcXBGuI?t=300) - Independence of increments
> - [8:00](https://youtu.be/vRsfjcXBGuI?t=480) - Gaussian distribution
In the limit, we obtain the **[Wiener process](https://en.wikipedia.org/wiki/Wiener_process)** $W(t)$ with properties:
1. $W(0) = 0$
2. Independent increments: $W(t) - W(s)$ is independent of $W(r)$ for all $r \leq s < t$
3. Gaussian increments: $W(t) - W(s) \sim \mathcal{N}(0, t-s)$
4. Continuous paths (almost surely)
### White Noise as a Formal Derivative
> [!info] Video Explanation
> [Parrondo Part 2 - White Noise](https://youtu.be/vRsfjcXBGuI)
> - [10:00](https://youtu.be/vRsfjcXBGuI?t=600) - White noise as derivative
> - [12:00](https://youtu.be/vRsfjcXBGuI?t=720) - Why the derivative doesn't exist classically
Formally, white noise is the "derivative" of the Wiener process:
$\xi(t) = \frac{dW}{dt}$
But this derivative doesn't exist in the classical sense! Instead, we work with differentials:
$dW = \xi(t)dt$
---
## 3. The Stochastic Integral
### From Differential to Integral Form
If $y(t_0) = y_0$ is known, Equation (1) becomes:
$y(t) = y_0 - \int_{t_0}^t \alpha y(\tilde{t}) d\tilde{t} - \int_{t_0}^t \varepsilon(\tilde{t}) y(\tilde{t}) d\tilde{t}$
The second integral is a **stochastic integral** - it requires special interpretation.
### The [Itô Integral](https://en.wikipedia.org/wiki/It%C3%B4_calculus)
> [!info] Video Explanation
> [Parrondo Part 3 - Stochastic Integrals](https://youtu.be/9zfw_CoPYNE)
> - [7:00](https://youtu.be/9zfw_CoPYNE?t=420) - Itô integral definition
> - [10:00](https://youtu.be/9zfw_CoPYNE?t=600) - Left endpoint evaluation
> - [12:00](https://youtu.be/9zfw_CoPYNE?t=720) - Properties of the Itô integral
For a stochastic process $f(t)$, the [Itô integral](https://en.wikipedia.org/wiki/It%C3%B4_calculus#It%C3%B4_integral) is defined as:
$\int_0^t f(s) dW(s) = \lim_{n \to \infty} \sum_{i=0}^{n-1} f(t_i)[W(t_{i+1}) - W(t_i)]$
where the integrand is evaluated at the **left endpoint** of each interval.
### Key Properties
1. **Linearity**: $\int (af + bg) dW = a\int f dW + b\int g dW$
2. **Zero mean**: $E[\int f dW] = 0$
3. **Itô isometry**: $E[(\int f dW)^2] = E[\int f^2 dt]$
4. **[Martingale](https://en.wikipedia.org/wiki/Martingale_(probability_theory)) property**: The integral is a martingale
## 6. Solving the First-Order Linear SDE
### The Problem
Consider the linear SDE with multiplicative noise:
$\frac{dy}{dt} = -(\alpha + \xi(t))y, \quad y(0) = y_0 \tag{3}$
where $\xi(t) = dW/dt$ is white noise.
### Converting to Integral Form
In differential form:
$dy = -\alpha y \, dt - y \, dW$
### Solution via [Itô's Lemma](https://en.wikipedia.org/wiki/It%C3%B4%27s_lemma)
> [!info] Video Explanation
> [Parrondo Part 4 - Solving SDEs](https://youtu.be/h1eNpKDOa2c)
> - [8:00](https://youtu.be/h1eNpKDOa2c?t=480) - Logarithmic transformation technique
> - [10:00](https://youtu.be/h1eNpKDOa2c?t=600) - Applying Itô's formula
> - [12:00](https://youtu.be/h1eNpKDOa2c?t=720) - The Itô correction term
Let $u = \ln(y)$. Using Itô's lemma:
$du = \frac{du}{dy}dy + \frac{1}{2}\frac{d^2u}{dy^2}(dy)^2$
With $\frac{du}{dy} = \frac{1}{y}$ and $\frac{d^2u}{dy^2} = -\frac{1}{y^2}$:
$du = \frac{1}{y}(-\alpha y \, dt - y \, dW) + \frac{1}{2}\left(-\frac{1}{y^2}\right)y^2\sigma^2 dt$
$du = -\alpha dt - dW - \frac{\sigma^2}{2}dt$
$du = -\left(\alpha + \frac{\sigma^2}{2}\right)dt - dW$
### The Solution
Integrating:
$u(t) - u(0) = -\left(\alpha + \frac{\sigma^2}{2}\right)t - W(t)$
Since $u = \ln(y)$:
$\ln(y(t)) - \ln(y_0) = -\left(\alpha + \frac{\sigma^2}{2}\right)t - W(t)$
Therefore:
$\boxed{y(t) = y_0 \exp\left[-\left(\alpha + \frac{\sigma^2}{2}\right)t - W(t)\right]}$
### Key Insights
1. **The Itô Correction**: The extra $\sigma^2/2$ term appears due to the quadratic variation $(dW)^2 = \sigma^2 dt$
2. **Decay is Preserved**: Despite the noise, the mean still decays exponentially:
$E[y(t)] = y_0 e^{-\alpha t}$
3. **Stratonovich vs Itô**: Using Stratonovich interpretation (which preserves the chain rule):
$y_{\text{Strat}}(t) = y_0 e^{-\alpha t - W(t)}$
### Application: Mathematical Finance
In the context of stock prices:
- $S(t) = y(t)$: Stock price (random)
- $\mu = -\alpha > 0$: Drift (expected return)
- $\sigma$: Volatility
The solution becomes:
$S(t) = S_0 \exp\left[\sigma W(t) + \left(\mu - \frac{\sigma^2}{2}\right)t\right]$
This is the famous **geometric Brownian motion** model used in the Black-Scholes formula.
---
🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧
---
## 4. Stochastic Differential Equations
### General Form
A stochastic differential equation takes the form:
$dx = f(x,t)dt + g(x,t)dW \tag{2}$
where:
- $f(x,t)$ is the **drift** coefficient
- $g(x,t)$ is the **diffusion** coefficient
- $dW$ is the Wiener process increment
### Interpretation as an Integral Equation
Equation (2) is shorthand for:
$x(t) = x(0) + \int_0^t f(x(s),s)ds + \int_0^t g(x(s),s)dW(s)$
### Example: Ornstein-Uhlenbeck Process
> [!info] Video Explanation
> [Parrondo Part 1 - OU Process](https://youtu.be/vcGpD7nZ3UM)
> - [15:00](https://youtu.be/vcGpD7nZ3UM?t=900) - Ornstein-Uhlenbeck setup
> - [16:30](https://youtu.be/vcGpD7nZ3UM?t=990) - Physical interpretation
The SDE:
$dx = -\alpha x dt + \sigma dW$
describes a particle in a harmonic potential with thermal noise. This models:
- Velocity of a Brownian particle
- Interest rate fluctuations
- Neural membrane potentials
Solution:
$x(t) = x_0 e^{-\alpha t} + \sigma \int_0^t e^{-\alpha(t-s)} dW(s)$
### Example: Geometric Brownian Motion
> [!info] Video Explanation
> [Parrondo Part 4 - Geometric Brownian Motion](https://youtu.be/h1eNpKDOa2c)
> - [6:00](https://youtu.be/h1eNpKDOa2c?t=360) - GBM equation
> - [7:30](https://youtu.be/h1eNpKDOa2c?t=450) - Financial applications
> - [9:00](https://youtu.be/h1eNpKDOa2c?t=540) - Black-Scholes connection
The SDE:
$dx = \mu x dt + \sigma x dW$
models stock prices, population growth with environmental stochasticity, and more.
---
## 5. Physical Interpretations
### Brownian Motion
> [!info] Video Explanation
> [Parrondo Part 1 - Physical Motivation](https://youtu.be/vcGpD7nZ3UM)
> - [18:00](https://youtu.be/vcGpD7nZ3UM?t=1080) - Historical background
> - [19:30](https://youtu.be/vcGpD7nZ3UM?t=1170) - Einstein's analysis
> - [21:00](https://youtu.be/vcGpD7nZ3UM?t=1260) - Connection to molecular theory
Einstein's 1905 analysis of pollen grains in water:
$\frac{dx}{dt} = -\gamma x + \eta(t)$
where:
- $\gamma$ is the friction coefficient
- $\eta(t)$ represents random molecular collisions
The fluctuation-dissipation theorem relates noise intensity to temperature:
$\langle \eta(t)\eta(t') \rangle = 2\gamma k_B T \delta(t-t')$
### The [Langevin Equation](https://en.wikipedia.org/wiki/Langevin_equation)
> [!info] Video Explanation
> [Parrondo Part 2 - Langevin Equation](https://youtu.be/vRsfjcXBGuI)
> - [16:40](https://youtu.be/vRsfjcXBGuI?t=1000) - General Langevin equation
> - [18:00](https://youtu.be/vRsfjcXBGuI?t=1080) - Overdamped limit
> - [19:30](https://youtu.be/vRsfjcXBGuI?t=1170) - Fluctuation-dissipation theorem
General form for a particle in a potential $V(x)$:
$m\ddot{x} = -\gamma \dot{x} - \nabla V(x) + \sqrt{2\gamma k_B T} \xi(t)$
In the overdamped limit ($m \to 0$):
$\dot{x} = -\frac{1}{\gamma}\nabla V(x) + \sqrt{\frac{2k_B T}{\gamma}} \xi(t)$
---
## 7. Connection to Partial Differential Equations
### The [Fokker-Planck Equation](https://en.wikipedia.org/wiki/Fokker%E2%80%93Planck_equation)
> [!info] Video Explanation
> [Parrondo Part 2 - Fokker-Planck Equation](https://youtu.be/vRsfjcXBGuI)
> - [20:00](https://youtu.be/vRsfjcXBGuI?t=1200) - Derivation from SDE
> - [22:00](https://youtu.be/vRsfjcXBGuI?t=1320) - Probability density evolution
> - [24:00](https://youtu.be/vRsfjcXBGuI?t=1440) - Connection to diffusion
For the SDE:
$dx = f(x)dt + g(x)dW$
The probability density $p(x,t)$ evolves according to:
$\frac{\partial p}{\partial t} = -\frac{\partial}{\partial x}[f(x)p] + \frac{1}{2}\frac{\partial^2}{\partial x^2}[g(x)^2 p]$
This is the **forward Kolmogorov** or **Fokker-Planck** equation.
### Example: Pure Diffusion
For $dx = \sigma dW$, we get:
$\frac{\partial p}{\partial t} = \frac{\sigma^2}{2}\frac{\partial^2 p}{\partial x^2}$
This is the [heat equation](https://en.wikipedia.org/wiki/Heat_equation) with diffusion coefficient $D = \sigma^2/2$.
---
## 8. Numerical Methods
### The [Euler-Maruyama Method](https://en.wikipedia.org/wiki/Euler%E2%80%93Maruyama_method)
> [!info] Video Explanation
> [Parrondo Part 5 - Numerical Methods](https://youtu.be/7J82tcLynaU)
> - [10:00](https://youtu.be/7J82tcLynaU?t=600) - Euler-Maruyama scheme
> - [12:00](https://youtu.be/7J82tcLynaU?t=720) - Implementation details
> - [14:00](https://youtu.be/7J82tcLynaU?t=840) - Convergence properties
For the SDE $dx = f(x)dt + g(x)dW$:
```python
import numpy as np
def euler_maruyama(f, g, x0, T, N):
"""
Simulate SDE using Euler-Maruyama method.
Parameters:
f: drift function
g: diffusion function
x0: initial condition
T: final time
N: number of time steps
"""
dt = T/N
t = np.linspace(0, T, N+1)
x = np.zeros(N+1)
x[0] = x0
# Generate Brownian increments
dW = np.sqrt(dt) * np.random.randn(N)
for i in range(N):
x[i+1] = x[i] + f(x[i], t[i])*dt + g(x[i], t[i])*dW[i]
return t, x
```
### Convergence
- **Strong convergence**: $E[|X_N - X(T)|] = O(\sqrt{\Delta t})$
- **Weak convergence**: $|E[h(X_N)] - E[h(X(T))]| = O(\Delta t)$ for smooth $h$
---
## 9. Key Takeaways
1. **SDEs extend ODEs** to include random fluctuations
2. **White noise** is formalized through the Wiener process
3. **Stochastic integrals** require special interpretation (Itô calculus)
4. **Physical systems** naturally lead to SDEs (Brownian motion, Langevin equation)
5. **PDEs emerge** from SDEs through the Fokker-Planck equation
6. **Numerical methods** enable practical simulation and analysis
---
## Exercises
### Conceptual Understanding
1. Explain why $\varepsilon(t) = dW/dt$ cannot exist as a classical function.
2. Show that the variance of a Wiener process grows linearly with time.
3. Derive the Fokker-Planck equation for the Ornstein-Uhlenbeck process.
### Computational Exercises
1. Simulate multiple paths of Brownian motion and verify that $\langle x^2(t) \rangle = 2Dt$.
2. Compare Euler-Maruyama and Milstein methods for geometric Brownian motion.
3. Solve the Fokker-Planck equation numerically and compare with Monte Carlo simulations.
### Advanced Problems
1. Prove that the Itô integral is a martingale.
2. Derive the Black-Scholes equation from geometric Brownian motion.
3. Show the connection between the Feynman-Kac formula and SDEs.
---
## Further Reading
- [[Random-Walks|Random Walks: From Discrete to Continuous]]
- [[Wiener-Process|The Wiener Process in Detail]]
- [[Ito-Formula|Itô's Formula and Stochastic Calculus]]
- Evans, L.C. (2013). *An Introduction to Stochastic Differential Equations*
- Øksendal, B. (2003). *Stochastic Differential Equations: An Introduction with Applications*
---
## Video Lectures
- [Part 1: Overview and Motivation](https://youtu.be/vcGpD7nZ3UM)
- [2:00](https://youtu.be/vcGpD7nZ3UM?t=120) - Introduction to noise in differential equations
- [7:00](https://youtu.be/vcGpD7nZ3UM?t=420) - From random walks to Wiener process
- [13:00](https://youtu.be/vcGpD7nZ3UM?t=780) - Examples of SDEs
- [18:00](https://youtu.be/vcGpD7nZ3UM?t=1080) - Physical motivation
- [Part 2: The Wiener Process](https://youtu.be/vRsfjcXBGuI)
- [0:00](https://youtu.be/vRsfjcXBGuI?t=0) - Mathematical properties
- [8:00](https://youtu.be/vRsfjcXBGuI?t=480) - Brownian motion connection
- [15:00](https://youtu.be/vRsfjcXBGuI?t=900) - Sample path properties
- [Part 3: Stochastic Integrals](https://youtu.be/9zfw_CoPYNE)
- [0:00](https://youtu.be/9zfw_CoPYNE?t=0) - Why we need stochastic integrals
- [7:00](https://youtu.be/9zfw_CoPYNE?t=420) - The Itô integral definition
- [15:00](https://youtu.be/9zfw_CoPYNE?t=900) - Itô's lemma
- [Part 4: Itô Calculus](https://youtu.be/h1eNpKDOa2c)
- [0:00](https://youtu.be/h1eNpKDOa2c?t=0) - Review of Itô's formula
- [6:00](https://youtu.be/h1eNpKDOa2c?t=360) - Solving SDEs
- [12:00](https://youtu.be/h1eNpKDOa2c?t=720) - Applications to finance
- [Part 5: Applications](https://youtu.be/7J82tcLynaU)
- [0:00](https://youtu.be/7J82tcLynaU?t=0) - Physical applications
- [10:00](https://youtu.be/7J82tcLynaU?t=600) - Numerical methods
- [18:00](https://youtu.be/7J82tcLynaU?t=1080) - Advanced topics