Problem #99 MEDIUM
The Drunkard's Walk Home
Paradox Probability Diffusion Limits
Problem Statement
A man stumbles out of a bar and takes random steps — each step equally likely to go left or right by 1 metre. After n steps, how far from the bar is he on average? More precisely, what is his expected distance (root mean square distance) from the starting point? Now suppose he takes steps in 2D — equally likely to go North, South, East, or West. What is his expected distance after n steps? What about 3D?
Answer & Quick Explanation
Think you've got it? Click below to check your answer.
RMS distance after n steps = √n in any dimension. After 100 steps: 10m. After 10,000 steps: 100m. Bonus: in 1D and 2D the walk returns to the origin with probability 1 (recurrent). In 3D it escapes with probability ~66% (transient).
WOW Moment:
- After 1 step: 1m from bar.
- After 100 steps: 10m from bar.
- After 10,000 steps: 100m from bar.
- After 1,000,000 steps: 1,000m = 1 km from bar.
- To be 10x farther, you need 100x more steps. To be 100x farther, you need 10,000x more steps.
- This is why oxygen molecules in a room take minutes to diffuse across it even though they travel at 500 m/s. Their random collisions cancel most progress.
- In 1D, will the drunkard EVER return to the bar? YES — with probability 1. In 2D? Also YES — probability 1. In 3D? NO — probability of return is only 34%. A 3D random walk escapes to infinity with 66% probability. 'A drunk man will find his way home, but a drunk bird may get lost forever.' — Shizuo Kakutani
Detailed Editorial Solution
Want to see the step-by-step breakdown? Click below to reveal the editorial.
The random walk (or Drunkard's Walk) is a fundamental mathematical model for diffusion, brownian motion, and statistical mechanics. It reveals how random, uncorrelated movements lead to a slow, square-root expansion over time.
The Mathematical Proof for RMS Distance:
Let the steps be represented by independent and identically distributed (i.i.d.) random variables X1, X2, ..., Xn.
In 1D:
- Each step Xi is either +1 or -1, with P(Xi = +1) = 0.5 and P(Xi = -1) = 0.5.
- The expected value of a single step is E[Xi] = 0.
- The variance of a single step is E[Xi^2] = 0.5*(1)^2 + 0.5*(-1)^2 = 1.
The position after n steps is S_n = X1 + X2 + ... + Xn.
1. The expected position is E[S_n] = E[X1] + ... + E[Xn] = 0.
2. The expected squared distance is:
E[S_n^2] = E[(X1 + X2 + ... + Xn)^2]
E[S_n^2] = E[Σ Xi^2 + 2 * Σ_{i < j} Xi * Xj]
By linearity of expectation:
E[S_n^2] = Σ E[Xi^2] + 2 * Σ_{i < j} E[Xi * Xj]
3. Since the steps are independent, E[Xi * Xj] = E[Xi] * E[Xj] = 0 * 0 = 0.
4. Therefore:
E[S_n^2] = Σ E[Xi^2] = n * 1 = n.
5. The Root Mean Square (RMS) distance is:
RMS = √E[S_n^2] = √n.
This result generalizes to any dimension d. If we take steps of length 1 along the coordinate axes, the sum of the variances along each dimension still adds up to n, giving an RMS distance of √n.
To explain the WOW part:
- The √n scaling explains why diffusion is extremely slow over long distances. If a molecule takes 10^12 collisions (steps) per second, it will travel 1 million steps (1 mm) in 1 second. To travel 2 mm (double the distance), it must travel 4 million steps, which takes 4 seconds. The time required scales quadratically with distance.
- The recurrence of random walks (Pólya's Theorem) is another mind-blowing result. Shizuo Kakutani summarized it beautifully: "A drunk man will find his way home, but a drunk bird may get lost forever."
- In 1D and 2D, the random walk is recurrent. The probability that the walk returns to the starting point is exactly 1.
- In 3D (and higher), the walk is transient. The extra degrees of freedom allow the walk to escape. The probability of returning to the origin in 3D is only about 34.05%, meaning there is a 65.95% chance the walker never returns.