2D Random Walk Simulator — Explore Diffusion and Brownian Motion

simulator intermediate ~8 min
Loading simulation...
D ~ sqrt(n) — displacement grows as the square root of the number of steps, not linearly

In a 2D random walk, the expected displacement from the origin after n steps is proportional to the square root of n, not n. This sqrt(n) scaling governs diffusion in physics and the behavior of stock prices.

Formula

E[|displacement|] ~ step_size * sqrt(n)
E[displacement^2] = n * step_size^2

The Drunkard's Walk

The random walk — sometimes called the drunkard's walk — is one of the most fundamental models in probability theory. Imagine a person taking steps in random directions: after many steps, how far are they from where they started? Surprisingly, the answer is not proportional to the number of steps but to its square root. Ten thousand steps take you only 100 step-lengths from the origin on average.

Einstein and the Atom

In 1905, Albert Einstein published his theory of Brownian motion, explaining the erratic jittering of pollen grains in water as the result of random molecular bombardment. His prediction that displacement scales as sqrt(t) was confirmed experimentally by Jean Perrin, providing the first definitive evidence for the existence of atoms and earning Perrin the Nobel Prize.

Diffusion: Random Walks at Scale

The macroscopic consequence of molecular random walks is diffusion — the process by which ink spreads in water, heat conducts through metal, and scents travel through air. The diffusion equation, a partial differential equation derived from random walk statistics, is one of the fundamental equations of physics. Its solutions are Gaussian distributions that spread with sqrt(t).

From Physics to Finance

In 1900, five years before Einstein, Louis Bachelier modeled stock prices as random walks in his doctoral thesis. This insight — that price changes are fundamentally unpredictable — became the foundation of modern quantitative finance. The Black-Scholes option pricing model, Markowitz portfolio theory, and the efficient market hypothesis all rest on random walk assumptions.

FAQ

What is a random walk?

A random walk is a path consisting of successive random steps. At each step, the walker moves in a random direction by a fixed distance. Despite the randomness, random walks have highly predictable statistical properties, such as the square-root scaling of displacement.

Why does displacement grow as sqrt(n)?

Each step is independent and random. When you sum many random vectors, their squared magnitudes add (by the Pythagorean theorem in expectation), so the total squared displacement grows linearly with n, meaning displacement itself grows as sqrt(n).

Where do random walks appear in the real world?

Brownian motion of particles in fluids, stock price movements, animal foraging patterns, and the diffusion of molecules all follow random walk dynamics. Einstein's 1905 paper on Brownian motion used random walks to prove the existence of atoms.

Will a 2D random walk return to the origin?

Yes! In 1921, Polya proved that a random walk on a 2D lattice returns to the origin with probability 1 — it is recurrent. In 3D, however, a random walker has only about a 34% chance of ever returning. This is one of the most surprising results in probability theory.

Sources

Embed

<iframe src="https://homo-deus.com/lab/mathematics/random-walk/embed" width="100%" height="400" frameborder="0"></iframe>