Skip to content
Vamshi Jandhyala

Books · The Fiddler: Solutions

Chapter 70

Can You Hop to the Lily Pad?

A frog starts on pad 22 among four pads. Pad 11 is a permanent home; pad 44 is a permanent trap. From pad 22 it jumps to 11 or 33, each with probability 12\tfrac12; from pad 33 it jumps to 22 with probability 13\tfrac13 or to 44 with probability 23\tfrac23. What is the probability it ends up home on pad 11?

The Fiddler, Zach Wissner-Gross, January 24, 2025(original post)

Solution

Let hkh_k be the probability of reaching pad 11 from pad kk. Then h2=12+12h3h_2=\tfrac12+\tfrac12 h_3 and h3=13h2h_3=\tfrac13 h_2 (a jump to pad 44 loses). Substituting, h2=12+1213h2    56h2=12    h2=35.h_2=\tfrac12+\tfrac12\cdot\tfrac13 h_2 \implies \tfrac56 h_2=\tfrac12 \implies h_2=\boxed{\tfrac35}.

The computation

Hop the actual frog: start a large batch on pad 22 and let each one jump under the stated rules until it is absorbed at pad 11 (home) or pad 44 (trap); the home fraction lands on 35\tfrac35.

import numpy as np
rng = np.random.default_rng(0)
pad = np.full(2_000_000, 2)
while np.isin(pad, (2, 3)).any():
    at2, at3 = pad == 2, pad == 3
    pad[at2] = np.where(rng.random(at2.sum()) < 0.5, 1, 3)        # 2 -> 1 or 3
    pad[at3] = np.where(rng.random(at3.sum()) < 1 / 3, 2, 4)      # 3 -> 2 or 4
print((pad == 1).mean())          # ~0.6  (= 3/5)

Extra Credit

Now the pond has pads 1,2,3,1,2,3,\dots forever, and from pad kk the frog jumps down to k1k-1 with probability 1k\tfrac1k and up to k+1k+1 with probability k1k\tfrac{k-1}{k}. Starting on pad 22, what is the probability it ever reaches pad 11?

Solution

With Δk=hk+1hk\Delta_k=h_{k+1}-h_k, the balance pk(hkhk1)=qk(hk+1hk)p_k(h_k-h_{k-1})=q_k(h_{k+1}-h_k) and pk/qk=1k1p_k/q_k=\tfrac1{k-1} give Δk=Δ1/(k1)!\Delta_k=\Delta_1/(k-1)!, so hn=1+Δ1m=0n21m!.h_n=1+\Delta_1\sum_{m=0}^{n-2}\frac1{m!}. The upward drift (qk1q_k\to1) makes the walk transient, so h=0h_\infty=0, forcing Δ1=1/e\Delta_1=-1/e and h2=11e0.6321.h_2=1-\frac1e\approx\boxed{0.6321}. (The official extra-credit value is paywalled; this closed form is my own.)

The computation

Walk the infinite-pond frog directly: from pad kk step down with probability 1k\tfrac1k, else up, and record whether it ever touches pad 11 before drifting off (capped at a high pad). The reached fraction matches 11/e1-1/e.

import numpy as np
rng = np.random.default_rng(0)
k = np.full(2_000_000, 2); reached = np.zeros_like(k, bool); alive = np.ones_like(k, bool)
for _ in range(4000):
    reached |= alive & (k == 1); alive &= k != 1
    i = alive
    step = np.where(rng.random(i.sum()) < 1.0 / k[i], -1, 1)
    k[i] += step; alive &= k <= 3000
    if not alive.any(): break
print(reached.mean(), 1 - 1 / np.e)        # 0.6324  0.63212