# Random Walks: From Discrete Steps to Continuous Processes
#random-walk #stochastic-process #sde #wiener-process #brownian-motion
## Overview
[Random walks](https://en.wikipedia.org/wiki/Random_walk) form the foundation of stochastic processes, bridging discrete probabilistic systems to continuous-time phenomena like [Brownian motion](https://en.wikipedia.org/wiki/Brownian_motion). This synthesis combines formal mathematical development with physical intuition and computational perspectives.
---
## 1. Definition and Basic Structure
### Formal Definition
Let $S_n$ be a random variable representing the position after $n$ steps:
$S_n = S_0 + \sum_{i=1}^n X_i$
where:
- $S_0$: Initial position (starting location)
- $X_i$: Independent and identically distributed (i.i.d.) random variables representing steps
- Each $X_i$ has the same distribution and is independent of all other steps
### Simple Random Walk
The simplest case involves binary choices at each step:
- Step values: $X_i \in \{-L, L\}$
- Move left by length $L$ with probability $P_1 = 1-p$
- Move right by length $L$ with probability $P_2 = p$
- State space: $\Omega_X = \{\text{left}, \text{right}\}$
- Probability constraint: $P_1 + P_2 = 1$
> [!note] Physical Intuition
> Think of a particle that "jumps" at regular time intervals $\Delta t$, moving either left or right by a fixed distance. This models everything from [molecular diffusion](https://en.wikipedia.org/wiki/Molecular_diffusion) to the infamous "[drunkard's walk](https://en.wikipedia.org/wiki/Random_walk#Lattice_random_walk)."
>
> **Video Reference:** [Parrondo Part 2 - Random Walks and Wiener Process](https://youtu.be/vRsfjcXBGuI)
> - [1:30](https://youtu.be/vRsfjcXBGuI?t=90) - Visual demonstration of random walks
> - [4:00](https://youtu.be/vRsfjcXBGuI?t=240) - The drunkard's walk analogy
> - [7:15](https://youtu.be/vRsfjcXBGuI?t=435) - Binary choice model
> - [11:00](https://youtu.be/vRsfjcXBGuI?t=660) - Connection to diffusion
---
## 2. Statistical Properties
### Expected Value (Mean Position)
For a single step:
$\mathbb{E}[X] = \mu_X = -L \cdot P_1 + L \cdot P_2 = L(P_2 - P_1) = L(2p - 1)$
For the walk after $n$ steps:
$\mathbb{E}[S_n] = S_0 + n \cdot \mathbb{E}[X] = S_0 + n \cdot L(2p - 1)$
**Key Insights:**
- When $p = 1/2$ (symmetric walk): $\mathbb{E}[S_n] = S_0$ (no drift)
- When $p > 1/2$: Positive drift (rightward bias)
- When $p < 1/2$: Negative drift (leftward bias)
- Drift velocity (average displacement per unit time): $v = L(2p-1)/\Delta t$
### Variance (Spread of Positions)
For a single step:
$\text{Var}(X) = \mathbb{E}[(X - \mu_X)^2] = L^2[1 - (2p-1)^2] = 4L^2 p(1-p)$
For the walk after $n$ steps (using independence):
$\text{Var}(S_n) = n \cdot \text{Var}(X) = n \cdot 4L^2 p(1-p)$
**Special Case - Symmetric Walk ($p = 1/2$):**
$\text{Var}(S_n) = n \cdot L^2 = \frac{L^2}{\Delta t} \cdot t$
where $t = n \cdot \Delta t$ is the total time.
> [!important] Bienaymé Identity
> The variance formula relies on the **[Bienaymé identity](https://en.wikipedia.org/wiki/Bienaym%C3%A9%27s_identity)**: for independent random variables, the variance of their sum equals the sum of their variances.
---
## 3. Distribution: Two Paths to Understanding
> [!info] Galton Board (Plinko) Demonstration
> Imagine beads falling through a board of pegs, bouncing left or right at each level. This physical model perfectly captures the random walk, with the final distribution of beads showing the binomial distribution that emerges from many individual binary choices.
### The Binomial Distribution
After $n$ steps, the position can be written as:
$S_n = S_0 + (2k - n)L$
where $k$ is the number of rightward steps (binomial random variable).
$P(S_n = S_0 + (2k - n)L) = \binom{n}{k} p^k (1-p)^{n-k}$
### Two Approaches to the Limit
#### Approach 1: Statistical (Central Limit Theorem)
As $n \to \infty$, by the **Central Limit Theorem**, the binomial distribution converges to Gaussian:
$\frac{S_n - \mathbb{E}[S_n]}{\sqrt{\text{Var}(S_n)}} \xrightarrow{d} \mathcal{N}(0, 1)$
This gives us:
$S_n \xrightarrow{d} \mathcal{N}\left(S_0 + nL(2p-1), \, 4nL^2p(1-p)\right)$
#### Approach 2: Applied (Continuum Limit → PDE)
In applied settings, we consider the **continuum limit** using finite difference approximations:
1. Approximate derivatives using Taylor expansions
2. Derive the diffusion-advection PDE
3. Solution involves convolution with heat kernel (Gaussian)
4. This independently confirms the CLT result
Both approaches lead to the same Gaussian distribution, but the continuum limit provides deeper physical insight and connects to PDEs.
---
## 4. The Continuum Limit
### From Discrete to Continuous: The Master Equation
Consider walkers at position $x$ and time $t$, with density $U(x,t)$. The [master equation](https://en.wikipedia.org/wiki/Master_equation):
$U(x, t+\Delta t) = P_R U(x-\Delta x, t) + P_0 U(x, t) + P_L U(x+\Delta x, t)$
where:
- $P_L$: probability of moving left by $\Delta x$
- $P_0$: probability of staying in place
- $P_R$: probability of moving right by $\Delta x$
- Conservation: $P_L + P_0 + P_R = 1$
### Taylor Expansion Approach
Expanding both sides using Taylor series:
**Time expansion:**
$U(x, t+\Delta t) = U(x, t) + \frac{\partial U}{\partial t} \Delta t + O((\Delta t)^2)$
**Space expansions:**
$U(x \pm \Delta x, t) = U(x, t) \pm \frac{\partial U}{\partial x}\Delta x + \frac{\partial^2 U}{\partial x^2}\frac{(\Delta x)^2}{2} + O((\Delta x)^3)$
Substituting and rearranging:
$\frac{U(x, t+\Delta t) - U(x, t)}{\Delta t} = \frac{P_R + P_L}{2} \frac{(\Delta x)^2}{\Delta t} \frac{\partial^2 U}{\partial x^2} - \frac{P_R - P_L}{2} \frac{\Delta x}{\Delta t} \frac{\partial U}{\partial x}$
### The [Diffusion-Advection Equation](https://en.wikipedia.org/wiki/Advection%E2%80%93diffusion_equation)
In the limit as $\Delta t, \Delta x \to 0$ with $(\Delta x)^2/\Delta t$ finite:
$\frac{\partial U}{\partial t} = D \frac{\partial^2 U}{\partial x^2} - C \frac{\partial U}{\partial x}$
where:
- **[Diffusion coefficient](https://en.wikipedia.org/wiki/Mass_diffusivity):** $D = \frac{P_R + P_L}{2} \frac{(\Delta x)^2}{\Delta t}$
- **[Advection](https://en.wikipedia.org/wiki/Advection) velocity:** $C = \frac{P_R - P_L}{2} \frac{\Delta x}{\Delta t}$
### Solution via Heat Kernel
The fundamental solution (Green's function) is:
$U(x, t) = \frac{1}{\sqrt{4\pi D t}} \exp\left(-\frac{(x - Ct)^2}{4Dt}\right)$
This is a Gaussian with:
- **Mean:** $\mu(t) = Ct$ (drift due to advection)
- **Variance:** $\sigma^2(t) = 2Dt$ (spread due to diffusion)
- **Standard deviation:** $\sigma(t) = \sqrt{2Dt}$
### Key Insight: The Critical Scaling
For a non-trivial limit:
- Must have $\frac{(\Delta x)^2}{\Delta t} = 2D = \text{finite}$
- This requires $\Delta x \propto \sqrt{\Delta t}$
- Physical interpretation: fluctuations scale with square root of time
### Connection to Wiener Process
For symmetric walk ($P_L = P_R = 1/2$, $P_0 = 0$):
- Advection vanishes: $C = 0$
- Pure diffusion: $D = \frac{(\Delta x)^2}{2\Delta t}$
- The limiting process is the **Wiener process** $W(t)$ with $W(t) \sim \mathcal{N}(0, 2Dt)$
## 5. Properties of the Random Walk
### Fundamental Properties
#### Mean Square Displacement
For symmetric random walk:
$\langle (S_n - S_0)^2 \rangle = nL^2$
This shows **subdiffusive spreading**: displacement grows as $\sqrt{n}$, not linearly.
#### Correlation in Time
For the walk at times $n$ and $n+k$:
$\text{Corr}(S_{n+k}, S_n) = \sqrt{\frac{n}{n+k}}$
- As $k \to 0$: correlation → 1 (perfect correlation)
- As $k \to \infty$: correlation → 0 (independence)
### Examples and Special Cases
#### Recurrence vs. Transience
A random walk is **recurrent** if it returns to the origin infinitely often.
**Pólya's Theorem:**
- **1D and 2D:** Random walks are recurrent
- **3D and higher:** Random walks are transient
**Mathematical criterion:** Expected number of returns to origin:
$E\left[\sum_{n=1}^{\infty} \mathbf{1}_{S_n=0}\right] = \sum_{n=1}^{\infty} P(S_n = 0) \propto \sum_{n=1}^{\infty} \frac{1}{n^{d/2}}$
This series diverges for $d \leq 2$ (recurrent) and converges for $d \geq 3$ (transient).
> [!note] Physical Interpretation
> "A drunk person will eventually find their way home in 1D or 2D, but a drunk bird in 3D may be lost forever!"
#### First Passage Times
Time to first reach position $m$:
$\tau_m = \min\{n : S_n = m\}$
For symmetric walk starting at origin:
- Mean first passage time to $\pm m$: $E[\tau_m] = m^2/L^2$
- Distribution has heavy tails (power law decay)
#### Gambler's Ruin
Walk with absorbing barriers at $0$ and $N$:
- Probability of reaching $N$ before $0$ starting from $k$:
- Symmetric: $P = k/N$
- Biased: $P = \frac{r^k - 1}{r^N - 1}$ where $r = (1-p)/p$
#### Maximum Displacement
For symmetric walk over $n$ steps:
$E[\max_{0 \leq k \leq n} |S_k|] \sim \sqrt{\frac{2n}{\pi}} \cdot L$
The maximum grows as $\sqrt{n}$, same scaling as typical displacement.
> [!info] Historical Context
> - **1826-1827:** Robert Brown observes irregular motion of pollen particles
> - **1900:** Louis Bachelier models stock prices using random walks
> - **1905:** Einstein explains Brownian motion via molecular collisions
> - **1923:** Norbert Wiener provides rigorous mathematical construction
> - **1926:** Jean Perrin's experiments verify Einstein's theory (Nobel Prize)
---
🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧 🚧
---
## 5. Computational Implementation
### Simple Random Walk Simulation
```python
import numpy as np
import matplotlib.pyplot as plt
def simple_random_walk(n_steps, p=0.5, L=1, S0=0):
"""
Simulate a simple random walk
Parameters:
-----------
n_steps : int - number of steps
p : float - probability of moving right
L : float - step size
S0 : float - initial position
Returns:
--------
positions : array of positions at each step
"""
# Generate random steps: +L with prob p, -L with prob (1-p)
steps = np.random.choice([L, -L], size=n_steps, p=[p, 1-p])
# Calculate cumulative position
positions = np.concatenate([[S0], S0 + np.cumsum(steps)])
return positions
# Example: Symmetric random walk
np.random.seed(42)
n_trials = 5
n_steps = 1000
plt.figure(figsize=(10, 6))
for i in range(n_trials):
positions = simple_random_walk(n_steps, p=0.5)
plt.plot(positions, alpha=0.7, linewidth=0.8)
plt.axhline(y=0, color='k', linestyle='--', alpha=0.3)
plt.xlabel('Step Number')
plt.ylabel('Position')
plt.title('Symmetric Random Walk: Multiple Realizations')
plt.grid(True, alpha=0.3)
plt.show()
# Verify theoretical predictions
n_simulations = 10000
final_positions = np.array([
simple_random_walk(n_steps, p=0.5)[-1]
for _ in range(n_simulations)
])
print(f"Theoretical mean: 0")
print(f"Empirical mean: {np.mean(final_positions):.3f}")
print(f"Theoretical std: {np.sqrt(n_steps):.3f}")
print(f"Empirical std: {np.std(final_positions):.3f}")
```
### Approximating Brownian Motion
```python
def random_walk_to_brownian(T=1, n_steps=1000, n_paths=1):
"""
Approximate Brownian motion via scaled random walk
Parameters:
-----------
T : float - final time
n_steps : int - number of steps
n_paths : int - number of paths to simulate
"""
dt = T / n_steps
dx = np.sqrt(dt) # Critical scaling!
times = np.linspace(0, T, n_steps + 1)
paths = np.zeros((n_paths, n_steps + 1))
for i in range(n_paths):
# Generate symmetric random walk with proper scaling
steps = np.random.choice([dx, -dx], size=n_steps)
paths[i, 1:] = np.cumsum(steps)
return times, paths
# Demonstrate convergence to Wiener process
fig, axes = plt.subplots(1, 3, figsize=(15, 4))
for ax, n_steps in zip(axes, [10, 100, 1000]):
times, paths = random_walk_to_brownian(T=1, n_steps=n_steps, n_paths=5)
for path in paths:
ax.plot(times, path, alpha=0.7)
ax.set_title(f'n_steps = {n_steps}')
ax.set_xlabel('Time')
ax.set_ylabel('Position')
ax.grid(True, alpha=0.3)
plt.suptitle('Random Walk → Brownian Motion as n → ∞')
plt.tight_layout()
plt.show()
```
---
## 6. Applications and Extensions
### Physical Applications
- **Molecular Diffusion:** Heat equation emerges from random walk limit
- **Polymer Physics:** Random walk models for polymer chain configurations
- **Population Genetics:** Genetic drift as random walk in allele frequency
### Financial Applications
- **Stock Prices:** Bachelier's model (additive) vs. Black-Scholes (multiplicative)
- **Options Pricing:** Binomial tree models discrete approximation
### Extensions
#### Continuous-Time Random Walk (CTRW)
Allow random waiting times between jumps, leading to anomalous diffusion.
#### Random Walk on Graphs
Extend to arbitrary network structures, with applications in:
- PageRank algorithm
- Electrical networks
- Social network analysis
#### Connection to PDEs
The continuum limit connects random walks to:
- **Heat equation:** $\partial_t u = D\nabla^2 u$
- **Fokker-Planck equation:** For probability evolution
- **Feynman-Kac formula:** Connecting PDEs to path integrals
---
## 7. Exercises
### Conceptual Understanding
1. **Variance Growth:** Explain why variance grows linearly with time for a random walk but the standard deviation grows as $\sqrt{t}$.
2. **Scaling Intuition:** Why must $\Delta x \propto \sqrt{\Delta t}$ for a non-trivial continuum limit?
### Analytical Problems
3. **Biased Walk:** For $p = 0.6$, calculate:
- Expected position after 100 steps (with $L=1$, $S_0=0$)
- Probability that $S_{100} > 20$
4. **Return Probability:** For symmetric random walk starting at origin, show that:
$P(S_{2n} = 0) = \binom{2n}{n} \left(\frac{1}{2}\right)^{2n} \sim \frac{1}{\sqrt{\pi n}}$
### Computational Exercises
5. **CLT Verification:** Simulate 10,000 random walks of length 100. Plot histogram of final positions and compare with theoretical Gaussian.
6. **First Passage Time:** Simulate the distribution of first passage times to reach $x = 10$ for symmetric random walk.
### Advanced Problems
7. **Reflection Principle:** Use the reflection principle to derive:
$P(\max_{0 \leq k \leq n} S_k \geq m) = 2P(S_n \geq m) \text{ for } m > 0$
8. **Arcsine Law:** Investigate computationally the fraction of time a symmetric random walk spends positive. Compare with theoretical arcsine distribution.
---
## Cross-References
- [[Wiener-Process]]: Continuous-time limit and properties
- [[SDE-Fundamentals]]: How random walks motivate stochastic differential equations
- [[Ito-Formula]]: Stochastic integration for continuous processes
- Fokker-Planck: evolution equations for probability densities (see [[SDE-Fundamentals#7. Connection to Partial Differential Equations]])
- Numerical methods for SDEs: discrete approximations come full circle (see [[Ito-Formula#6. Computational Implementation]])
---
## Video Resources
### Parrondo's Stochastic Differential Equations Series
**1. [Part 1: Introduction to SDEs](https://youtu.be/vcGpD7nZ3UM)**
- [3:00](https://youtu.be/vcGpD7nZ3UM?t=180) - Historical context and motivation
- [8:45](https://youtu.be/vcGpD7nZ3UM?t=525) - Deterministic vs stochastic systems
- [15:20](https://youtu.be/vcGpD7nZ3UM?t=920) - White noise introduction
- [21:00](https://youtu.be/vcGpD7nZ3UM?t=1260) - Setting up SDEs
- [28:30](https://youtu.be/vcGpD7nZ3UM?t=1710) - Overview of course topics
**2. [Part 2: Random Walks and Wiener Process](https://youtu.be/vRsfjcXBGuI)**
- [0:00](https://youtu.be/vRsfjcXBGuI?t=0) - Introduction to random walks
- [5:30](https://youtu.be/vRsfjcXBGuI?t=330) - Variance calculation and scaling
- [12:15](https://youtu.be/vRsfjcXBGuI?t=735) - The continuum limit
- [18:45](https://youtu.be/vRsfjcXBGuI?t=1125) - Connection to Brownian motion
- [25:00](https://youtu.be/vRsfjcXBGuI?t=1500) - Mathematical properties
**3. [Part 3: Stochastic Integrals](https://youtu.be/9zfw_CoPYNE)**
- [2:30](https://youtu.be/9zfw_CoPYNE?t=150) - Why stochastic integrals are needed
- [8:15](https://youtu.be/9zfw_CoPYNE?t=495) - Riemann sums don't work
- [14:00](https://youtu.be/9zfw_CoPYNE?t=840) - Itô integral construction
- [22:45](https://youtu.be/9zfw_CoPYNE?t=1365) - Stratonovich integral
- [28:30](https://youtu.be/9zfw_CoPYNE?t=1710) - Comparison and applications
**4. [Part 4: Itô's Formula](https://youtu.be/h1eNpKDOa2c)**
- [4:15](https://youtu.be/h1eNpKDOa2c?t=255) - Why the chain rule fails
- [9:30](https://youtu.be/h1eNpKDOa2c?t=570) - Deriving Itô's formula
- [16:00](https://youtu.be/h1eNpKDOa2c?t=960) - The extra term
- [23:45](https://youtu.be/h1eNpKDOa2c?t=1425) - Examples
- [31:00](https://youtu.be/h1eNpKDOa2c?t=1860) - Applications to SDEs
**5. [Part 5: Applications and Examples](https://youtu.be/7J82tcLynaU)**
- [2:00](https://youtu.be/7J82tcLynaU?t=120) - Financial models
- [10:30](https://youtu.be/7J82tcLynaU?t=630) - Population dynamics
- [18:15](https://youtu.be/7J82tcLynaU?t=1095) - Physical systems
- [25:00](https://youtu.be/7J82tcLynaU?t=1500) - Numerical simulation
- [32:45](https://youtu.be/7J82tcLynaU?t=1965) - Advanced topics
## References
### Primary Sources
- Einstein, A. (1905). "Über die von der molekularkinetischen Theorie der Wärme geforderte Bewegung von in ruhenden Flüssigkeiten suspendierten Teilchen"
- Bachelier, L. (1900). "Théorie de la spéculation"
- Wiener, N. (1923). "Differential Space"
### Course Materials
- MATH310 F21 Notes: Sections on symmetric random walk and continuum limits
- MATH310 F24 Notes: Random walk fundamentals
- Parrondo Lecture Series: Parts 1-2 on stochastic processes
- Evans, L.C. "An Introduction to Stochastic Differential Equations" (to be integrated)