skip to content

In gambler's ruin on a fair game, why is the chance of reaching N before 0 from k equal to k/N?

level: seniorimportance: nice to knowfreq 26%

answer

  1. condition on the very next bet
  2. each value averages its two neighbours
  3. equal differences means a straight line
  4. the two boundaries pin the line down
  5. duration is a product, not a ratio

basics

~20 s

Conditioning on the next bet gives P(k) = 0.5P(k-1) + 0.5P(k+1), so each value is the average of its neighbours — a straight line. The boundaries P(0) = 0 and P(N) = 1 force P(k) = k/N.

solid answer

~40 s

Condition on the first bet. From fortune `k`, one step takes you to `k+1` or `k-1` with probability 1/2 each, so `P(k) = 0.5*P(k-1) + 0.5*P(k+1)` for `0 < k < N`, with boundary conditions `P(0) = 0` and `P(N) = 1`. That recursion says every interior value is the average of its two neighbours, which forces constant successive differences — a straight line. The line through `(0, 0)` and `(N, 1)` is `P(k) = k/N`. There is a second route: in a fair game your fortune is a martingale, so the expected final fortune equals the starting fortune, giving `N*P + 0*(1-P) = k` and the same answer. Expected duration comes from the same one-step conditioning with a `+1` per bet, and solves to `k(N - k)` bets.

go deeper

for a junior

Know the shape of the answer — the chance of reaching the target in a fair game is the ratio of your bankroll to the target — and that it comes from a one-step recursion with two boundary conditions.

for a middle

Derive k/N yourself: write the interior recursion, notice that equal successive differences mean a straight line, and fit it with P(0) = 0 and P(N) = 1.

for a senior

Handle the biased case and the expected duration k(N - k) without floundering, and explain why a small per-bet edge destroys the odds over a long walk rather than shaving them slightly.

for a principal

Draw the general lesson: absorbing-boundary problems are decided by the ratio of resource to target and by drift, so the strategic levers are bankroll, target distance and number of bets — not the outcome of any single bet.

## The set-up A gambler starts with `k` units and bets one unit at a time on a fair coin. The fortune performs a random walk on the integers `0, 1, ..., N`. Play stops at `0` (ruin) or at `N` (target reached); both are **absorbing** states. Write `P(k)` for the probability of reaching `N` before `0`, starting from `k`. ## One-step conditioning Condition on the outcome of the very next bet. From `k` you land on `k+1` with probability 1/2 and on `k-1` with probability 1/2, and from wherever you land the problem looks exactly the same with a new starting fortune — the walk has no memory of how it got there. So for every interior state: ``` P(k) = 0.5 * P(k+1) + 0.5 * P(k-1), 0 < k < N P(0) = 0, P(N) = 1 ``` The boundary conditions are not decoration — they are what pins the solution down, and forgetting them is the most common failure. ## Solving the recursion Rearrange: `P(k+1) - P(k) = P(k) - P(k-1)`. The successive differences are all equal, so `P` is an **arithmetic sequence** — a straight line in `k`. Write `P(k) = a + b*k`. The boundary `P(0) = 0` forces `a = 0`; the boundary `P(N) = 1` forces `b = 1/N`. Hence ``` P(k) = k / N ``` So a player starting with 30 units aiming for 100 has probability 0.30 of getting there before going broke, and 0.70 of ruin. Doubling your money — target `N = 2k` — is exactly a 50/50 proposition, which is the one case where fairness of the game translates directly into fairness of the outcome. ## The martingale reading There is a one-line argument that is worth having ready. In a fair game the expected fortune never changes, so the expected fortune at the moment play stops equals the starting fortune. At stopping, the fortune is either `N` or `0`, so by the law of total expectation `N * P(k) + 0 * (1 - P(k)) = k`, giving `P(k) = k/N` immediately. This is the same conditioning idea applied to the *value* rather than to the probability. ## Expected duration Let `D(k)` be the expected number of bets before absorption. Condition on the first bet again, remembering to charge one bet for the step taken: ``` D(k) = 1 + 0.5 * D(k+1) + 0.5 * D(k-1), D(0) = D(N) = 0 ``` The solution is `D(k) = k * (N - k)`. Verify by substitution: `0.5*(k-1)(N-k+1) + 0.5*(k+1)(N-k-1) + 1` simplifies to `kN - k^2 = k(N-k)`. From 30 against a target of 100 that is `30 * 70 = 2100` bets on average — a fair game with a distant target takes a very long time to resolve, and the mean duration is maximised in the middle at `k = N/2`. ## The unfair game With win probability `p` per bet, `q = 1 - p` and ratio `r = q/p`, the same conditioning gives `P(k) = p*P(k+1) + q*P(k-1)`, whose solution for `p != 1/2` is ``` P(k) = (1 - r^k) / (1 - r^N) ``` The geometric form is brutal. A tiny edge against the player compounds over the many bets required to travel a long distance, so the chance of reaching a distant target collapses far below `k/N`. If instead `p > 1/2` and the target is removed entirely (`N -> infinity`), the gambler avoids ruin forever with probability `1 - r^k`, which is strictly positive — an edge plus a bankroll buys genuine survival. Against an infinitely rich opponent in a fair game, `k/N -> 0` as `N -> infinity`: ruin is certain. Fairness per bet does not protect a finite bankroll against an unbounded one. ## Bet sizing The state space is measured in units of the bet. Betting 2 units instead of 1 rescales both `k` and `N` by a half, so in a fair game the ruin probability is unchanged while the expected number of bets drops by a factor of 4. In an *unfavourable* game, larger bets improve the chance of reaching a target, because they reduce the number of bets over which the edge can grind you down — a genuinely counterintuitive consequence of the geometric solution. ## What interviewers are checking 1. That you condition on one step instead of trying to enumerate paths. 2. That you state and use the boundary conditions. 3. That you can read the result: `k/N` is a statement about the *ratio* of bankroll to target, not about either alone. 4. That you know a small edge and a long walk do not combine linearly. ## Sanity checks - `P(0) = 0` and `P(N) = 1` must come straight out of your formula. - `P` must increase in `k` and decrease in `N`. - `D(k)` must be zero at both boundaries and symmetric about `N/2`.

  • How does the recursion change when each bet is unfavourable?
    The step is the same one-step conditioning, `P(k) = p*P(k+1) + q*P(k-1)`, but the differences now form a geometric rather than arithmetic sequence. With `r = q/p` the solution is `P(k) = (1 - r^k)/(1 - r^N)`. Because `r^N` grows fast, even a slight edge against the player makes a distant target nearly unreachable.
  • What happens to the ruin probability as the opponent's bankroll grows without bound?
    In a fair game `P(k) = k/N` tends to 0 as `N` grows, so ruin against an infinitely rich opponent is certain. With a per-bet edge in the player's favour it is different: the probability of never being ruined tends to `1 - (q/p)^k`, which is strictly positive and rises with the starting bankroll.
  • Does raising the bet size change the chance of hitting the target?
    In a fair game, no: doubling the stake halves both `k` and `N` in bet units, leaving `k/N` unchanged, though expected duration falls by a factor of four. In an unfavourable game larger bets actually help, because fewer bets are needed and the edge has less opportunity to compound against you.
  • Why is the expected duration k(N - k) rather than something proportional to N?
    Duration is driven by how far you are from *both* absorbing barriers, so it is largest in the middle and zero at either edge. Substituting `k(N-k)` into `D(k) = 1 + 0.5*D(k+1) + 0.5*D(k-1)` reproduces the recursion exactly, and it satisfies `D(0) = D(N) = 0`.

saying these in an interview costs you the question

  • Solves the recursion without imposing the two boundary conditions
  • Claims a fair game gives a 50% chance of reaching any target
  • Assumes a fair game eventually reaches any target with certainty
  • Thinks a tiny per-bet edge barely changes the survival odds
  • Tries to enumerate winning paths instead of conditioning on one step
  • Forgets the +1 per bet when computing expected duration

context