Random Walks

Animated 1D and 2D random walks converging to Brownian motion

Random Walks

A random walk is a path formed by successive random steps. Despite being built from pure randomness, random walks exhibit deep mathematical structure -- from the square-root scaling of displacement to their convergence to Brownian motion in the continuous limit. They appear throughout physics (diffusion, polymer chains), finance (stock price models), and computer science (randomized algorithms).

In this section, you will explore 1D and 2D random walks, observe how the distribution of positions evolves over time, and see how discrete random walks give rise to continuous Brownian motion as the step size shrinks to zero.

One-Dimensional Random Walk

The simplest random walk: at each time step, a particle moves +1 or -1 with equal probability. Run multiple walkers simultaneously and watch the histogram of final positions take shape. After n steps, the expected displacement is zero but the typical distance from the origin grows as sqrt(n).

Step: 0 / 300

Each walker independently steps +1 or -1 with equal probability at each time step. The histogram on the right shows the distribution of final positions.

Key insight: Although the expected position E[X_n] = 0 at every step, the variance grows linearly: Var(X_n) = n. This means the standard deviation is sqrt(n), so walkers drift further from the origin over time despite having no bias. The histogram of final positions approaches a normal distribution by the Central Limit Theorem.

Two-Dimensional Random Walk

Extend the walk to two dimensions: at each step the particle moves up, down, left, or right with equal probability. The trails create intricate fractal-like patterns. A remarkable result by George Polya (1921) states that a 2D random walker will return to the origin with probability 1 -- but in 3D and higher, this is no longer true.

Step: 0 / 500

Each walker steps in one of four cardinal directions with equal probability. The dashed amber circle shows the expected distance from the origin: E[r] = sqrt(n).

Key insight: The expected distance from the origin after n steps scales as sqrt(n), shown by the dashed circle. The 2D walk is recurrent (returns to the origin infinitely often), which is why the trails appear to revisit areas repeatedly. This property makes 2D random walks fundamentally different from their higher-dimensional counterparts.

From Random Walk to Brownian Motion

Brownian motion (the Wiener process) is the continuous-time limit of a random walk. As the step size shrinks and the number of steps grows, the discrete path converges to a continuous but nowhere-differentiable curve. Adjust the step size slider to see this transition: large steps produce a jagged staircase, while tiny steps yield a smooth-looking path that is actually infinitely rough at every scale.

Steps: 0
As step size → 0, random walk → Brownian motion

With large step sizes, the walk is visibly discrete. Shrink the step size and the path becomes smoother, converging to a continuous Brownian motion (Wiener process). The dashed lines show the +/- sqrt(t) standard deviation envelope.

Key insight: The Donsker invariance principle (functional CLT) states that a properly scaled random walk converges in distribution to Brownian motion. The key scaling: if each step has size delta and takes time delta squared, then in the limit as delta approaches 0, we get a Wiener process with variance equal to t at time t. The dashed envelope shows the +/- sqrt(t) standard deviation boundary.

Key Takeaways

  • Square-root scaling -- after n steps, the typical displacement from the origin is proportional to sqrt(n), not n
  • Normal distribution emerges -- the distribution of positions after many steps converges to a Gaussian by the Central Limit Theorem
  • Recurrence in low dimensions -- random walks in 1D and 2D return to the origin with probability 1 (Polya's recurrence theorem); in 3D+ they escape
  • Brownian motion as a limit -- shrinking step size and accelerating step rate yields Brownian motion (Donsker's theorem), the foundation of stochastic calculus and modern mathematical finance