First-Return Probabilities of a Random Walk
For a fair coin-flip random walk starting at zero, the probability of returning to zero for the first time after exactly n steps — and the surprising fact that the walk is certain to return eventually, yet the expected wait is infinite.
Prerequisites: The Random Walk
The problem. Start at position 0. Flip a fair coin repeatedly; step on heads, on tails. What's the probability the walk returns to 0 for the very first time exactly at step ? And a follow-up that surprises most people: is the walk guaranteed to eventually return to 0, and if so, what's the expected number of steps until it does?
Why "first return" is different from "any return"
It's straightforward to compute the probability of being back at 0 at step (returns can only happen at even steps, since parity has to match): that's , just the probability of exactly heads and tails in flips. But "first return" is stricter — it excludes any path that touched 0 earlier and came back a second time. Counting only paths that avoid 0 in between requires the reflection principle, a symmetry trick from combinatorics for counting paths that avoid a barrier.
The formula and what it says
The probability of first return to 0 exactly at step works out to:
In plain English: it's the plain "back at zero at step " probability, scaled down by a factor of to account for excluding paths that already visited zero earlier. As grows, decays like — slower than exponential, which is the source of the walk's strange long-run behavior.
Worked example: first return at step 2 vs step 4
At (step 2): . Check directly: the only two paths of length 2 are and — both return to 0 at step 2, and neither could have returned earlier (there's no earlier even step), so is exactly right, matching the direct count of 2 out of 4 equally likely 2-flip sequences.
At (step 4): . So 1 in 8 walks makes it away from zero and returns for the very first time exactly at the fourth flip — noticeably rarer than an immediate step-2 return, consistent with the walk "wandering off" more often as time passes before finally coming back.
The surprising punchline: certain to return, but the average wait is infinite
Summing over all gives exactly 1 — the walk is certain (probability 1) to eventually return to 0, no matter how far it wanders in the meantime. Yet the expected first-return time, , diverges to infinity, because only decays like , which isn't fast enough for that sum to converge. This is the classic "certain but infinite expectation" phenomenon: you're guaranteed to come home eventually, but there's no finite number of steps you should bet on it taking, because rare, very-long excursions contribute enough to the average to blow it up.
Watch a handful of sample paths above: most cross back near zero fairly quickly, but occasionally one wanders far and stays away for a long stretch — those rare long excursions are exactly what makes the average return time infinite even though a return is certain.
For a symmetric random walk starting at 0, the probability of returning to 0 for the first time at step is , which sums to 1 (return is certain) but whose mean diverges (expected wait is infinite) — a genuine example where "certain to happen" doesn't mean "happens within a predictable timeframe."
Don't conflate "the walk returns to 0 with probability 1" with "the walk returns to 0 quickly." Both statements sound reassuring, but only the first is true in a strict sense — the tail of the first-return distribution is heavy enough that the expected waiting time is infinite.
Practice in interviews
Further reading
- Feller, An Introduction to Probability Theory, vol. 1, ch. 3