Math paradoxes

Glossary / Random walk

Glossary · random walk

Will someone walking at random ever find their way home?

A man leaves a bar and at every crossroads turns whichever way he likes. Mathematics guarantees that sooner or later he will be standing at his own door. But a bird flying just as randomly forward, sideways, up or down may never come back. The only difference is one dimension. George Pólya proved it in 1921, and the mathematician Shizuo Kakutani summed it up: "A drunk man will eventually find his way home, but a drunk bird may get lost forever."

In plain wordspictures, analogies, small numbers

“In plain words” is hidden on all puzzles.

The drunk bird paradox

Each walker starts at home, in the centre, and at every step moves to a neighbouring cell at random: left or right on a line, one of four directions on a plane, and also up or down in space. Whoever steps on home is back. Release 100 walkers into each world and give them 10,000 steps each.

Got home · line–
Got home · plane–
Got home · space–

Why space is different

On a line there is nowhere to go: the walker shuffles around home and sooner or later steps on it. On a plane there is more room and the return takes longer, but it is still certain, you just wait longer. In space there are so many directions that a walker who has wandered off mostly reaches new places rather than old ones. So a third come back quickly, and the rest most likely never do.

Pólya became interested during walks in the woods outside Zurich. He kept running into the same student and his fiancée, felt embarrassed that it looked like snooping, and wondered: how often do people who wander at random meet?

Rigoroustables, charts, formulas

“Rigorous” is hidden on all puzzles.

A step left, a step right

A random walk on a line: start at zero, and each step is +1 or −1 with probability 1/2, independently of the earlier ones. The position after n steps is just the sum of those steps. For example, two steps give four equally likely outcomes:

+ +position +2
+ −position 0
− +position 0
− −position −2

On average the walker stays put: the mean position is 0. But the squared distance averages (4 + 0 + 0 + 4) / 4 = 2, exactly the number of steps. That is no coincidence, and everything else follows from it.

Distance grows like √n, not n

It seems twice as many steps should take you twice as far. No: the steps mostly cancel each other out. The typical distance from the start after n steps is about √n. After 100 steps that is roughly 10, after 10,000 steps only about 100. Below are 200 walkers on a line: time runs to the right, position goes up or down.

Steps n0
Typical distance · simulation–
√n–

The typical distance here is the square root of the mean squared distance of all 200 walkers. The dashed lines are ±√n.

Who is ahead in the game

Olena and Bohdan toss a coin 1,000 times: heads is a point for Olena, tails for Bohdan. The score between them is exactly a random walk. It seems the lead should keep changing hands and each of them should be ahead for about half the game. In fact an even split is the least likely outcome, and most often one of them leads nearly all the time.

Olena ahead in the last game–
Games where someone leads ≥ 90% of the time–
Games split between 40 and 60%–

Histogram: the share of tosses during which Olena is ahead, over all games played. A toss on which the score becomes level or stops being level goes to whoever leads at its other end.

Where chance goes walking

  • DiffusionA drop of ink in a glass of water spreads because water molecules keep knocking every dye molecule. Hence the √n rule: for the stain to get ten times wider you have to wait a hundred times longer.
  • Brownian motionIn 1827 the botanist Robert Brown saw under a microscope that tiny particles in water jiggle aimlessly. In 1905 Einstein explained it by the knocks of molecules, and in 1908 Jean Perrin measured the motion and so convinced scientists that atoms really exist. He received the Nobel Prize in 1926.
  • Share prices as a modelIn 1900 Louis Bachelier described price moves on the Paris exchange as a random walk. It is a model, not a forecast and not advice: real prices have trends, jumps and crashes more often than the simple model allows.
  • Mosquitoes and the nameThe words "random walk" were coined by the statistician Karl Pearson in a 1905 letter to Nature. He wanted to know how far mosquitoes carrying malaria spread.
  • When it isn't a random walkIf the steps depend on each other (once you speed up you keep going) or something pulls one way, like wind or a slope, distance grows like n rather than √n. The √n rule holds only for independent steps with no bias.
Deepergeneralisations, theory, history

“Deeper” is hidden on all puzzles.

Why exactly √n

Sn = X₁ + X₂ + … + Xn,   E[Sn²] = Σ E[Xi²] + Σi≠j E[XiXj] = n · 1 + 0 = n

Each squared step equals 1, so the first sum gives n. The cross products XiXj are +1 and −1 equally often, because the steps are independent, and they vanish on average. So the variance of the position is n, and the typical distance is √n. The plain average distance is a bit smaller: E|Sn| ≈ √(2n/π) ≈ 0.8 √n.

Take some steps in the simulation with 200 walkers, and their numbers will appear here.

The arcsine law

P(ahead for 2k of 2n tosses) = C(2k, k) · C(2n − 2k, n − k) / 2²ⁿ

P(share of time ahead ≤ x) → (2/π) · arcsin √x

The first formula is exact for a game of 2n tosses. The largest probabilities belong to the extremes k = 0 and k = n, the smallest to the middle. The second formula is its limit for long games, hence the name. The probability that someone leads at least 90% of the time tends to 2 · (1 − (2/π) · arcsin √0.9) ≈ 0.410, and for exactly 1,000 tosses it is 0.413. A balanced split between 40 and 60% happens with probability only ≈ 0.129.

Play some games in the simulation above, and your shares will appear here.

Pólya's theorem

Probability of ever getting home: line 1, plane 1, space ≈ 0.3405

Let p be the probability of ever coming back. After each return the walk starts afresh, so the average number of visits home, counting the start, is 1/(1 − p). On the other hand, it is the sum of the probabilities of being home at each step. After 2n steps that probability is about:

line 1/√(πn)  ·  plane 1/(πn)  ·  space 2 · (3/(4πn))3/2

The first two sums are infinite, so 1/(1 − p) is infinite and p = 1. The second grows only like a logarithm, which is why the plane brings walkers back so slowly: within 10,000 steps only about 74%. The third sum is finite, equal to 1.516…, so p = 1 − 1/1.516 ≈ 0.3405. Within 10,000 steps about 33.7% come back in space, nearly everyone who will ever return. In four or more dimensions walkers return even less often.

Release walkers in the first simulation, and your totals will appear here.

Where it shows up

Other terms