๐Ÿงฎ Brain Teaser

The Gambler's Ruin: A Fair Game with a Surprising Exit

A gambler starts with \kandplaysafaircoinโˆ’flipgame:winand plays a fair coin-flip game: win$1withprobabilitywith probability\frac{1}{2},lose, lose $1withprobabilitywith probability\frac{1}{2}.Thegameendswhenthegamblereitherreaches. The game ends when the gambler either reaches $N$ (success) or goes broke (ruin).

(a) What is the probability the gambler reaches \N$ before going broke?

(b) Here is the surprising part: what is the expected number of steps until the game ends?

The answer to (b) might feel impossible at first โ€” can you guess it before computing?

martingaleoptional stoppingrandom walkgambler's ruinexpected hitting time

Answer: Gambler's Ruin: Probability and Expected Duration

Key Idea / Intuition

For part (a), since the game is fair, the gambler's fortune is a martingale โ€” its expected value never changes. So the probability of reaching NN before 00 must be exactly k/Nk/N, the only linear interpolation consistent with boundary values 00 and 11.

For part (b), the surprise: the expected duration is k(Nโˆ’k)k(N - k). This is the product of the two "distances to the walls." Intuitively, the gambler wanders diffusively, and diffusion takes time proportional to (distance)ยฒ. The quantity Xt2โˆ’tX_t^2 - t is also a martingale, and applying optional stopping to it gives the answer without solving a recursion directly.


Formal Proof / Solution

Part (a): Probability of Reaching NN

Let pk=P(reachย Nโˆฃstartย atย k)p_k = P(\text{reach } N \mid \text{start at } k), with p0=0p_0 = 0, pN=1p_N = 1.

The balance equation is: pk=12pk+1+12pkโˆ’1p_k = \frac{1}{2} p_{k+1} + \frac{1}{2} p_{k-1}

This says pk+1โˆ’pk=pkโˆ’pkโˆ’1p_{k+1} - p_k = p_k - p_{k-1}, so pkp_k is linear in kk. With boundary conditions:

pk=kN\boxed{p_k = \frac{k}{N}}

Martingale view: XtX_t (the fortune at time tt) is a martingale. By the Optional Stopping Theorem (the game ends in finite time a.s., and โˆฃXtโˆฃ|X_t| is bounded by NN): E[XT]=X0=kE[X_T] = X_0 = k Nโ‹…pk+0โ‹…(1โˆ’pk)=kโ€…โ€ŠโŸนโ€…โ€Špk=kN.โœ“N \cdot p_k + 0 \cdot (1 - p_k) = k \implies p_k = \frac{k}{N}. \checkmark


Part (b): Expected Duration

Let ฯ„\tau = stopping time. We use the second martingale:

Claim: Mt=Xt2โˆ’tM_t = X_t^2 - t is a martingale.

Proof of claim: E[Xt+12โˆฃXt]=12(Xt+1)2+12(Xtโˆ’1)2=Xt2+1E[X_{t+1}^2 \mid X_t] = \frac{1}{2}(X_t + 1)^2 + \frac{1}{2}(X_t - 1)^2 = X_t^2 + 1

So E[Mt+1โˆฃFt]=Xt2+1โˆ’(t+1)=Xt2โˆ’t=MtE[M_{t+1} \mid \mathcal{F}_t] = X_t^2 + 1 - (t+1) = X_t^2 - t = M_t. โœ“

Apply Optional Stopping to Mt=Xt2โˆ’tM_t = X_t^2 - t: E[Xฯ„2โˆ’ฯ„]=E[X02โˆ’0]=k2E[X_\tau^2 - \tau] = E[X_0^2 - 0] = k^2

Therefore: E[ฯ„]=E[Xฯ„2]โˆ’k2E[\tau] = E[X_\tau^2] - k^2

Now compute E[Xฯ„2]E[X_\tau^2]: at stopping, Xฯ„=NX_\tau = N with probability k/Nk/N and Xฯ„=0X_\tau = 0 with probability 1โˆ’k/N1 - k/N: E[Xฯ„2]=N2โ‹…kN+02โ‹…(1โˆ’kN)=NkE[X_\tau^2] = N^2 \cdot \frac{k}{N} + 0^2 \cdot \left(1 - \frac{k}{N}\right) = Nk

Therefore: E[ฯ„]=Nkโˆ’k2=k(Nโˆ’k)\boxed{E[\tau] = Nk - k^2 = k(N - k)}


Why This Is Surprising

  • The expected duration depends on both the starting point and the target.
  • Starting at k=N/2k = N/2 (the middle) gives the longest expected game: E[ฯ„]=N2/4E[\tau] = N^2/4.
  • A gambler starting with \1facingacasinowithfacing a casino with$999(so(soN = 1000,, k = 1)hasanexpectedgameofonly) has an expected game of only 999stepsโ€”butwinswithprobabilityonlysteps โ€” but wins with probability only1/1000$. A very short doomed journey!
  • The shape k(Nโˆ’k)k(N-k) is a discrete parabola, symmetric in kk and Nโˆ’kN-k, reflecting the symmetry between the two absorbing barriers.

Source: Fifty Challenging Problems in Probability with Solutions (Frederick Mosteller) โ€” classic folklore problem

Type: ProbabilitySource: Fifty Challenging Problems in Probability with Solutions (Frederick Mosteller) โ€” classic folklore problemEdit on GitHub โ†—