Updated
In this lesson
Wide tables, equations, and code scroll sideways. Swipe, or Tab to focus them and use the left and right arrow keys.
Gambler’s ruin
You will learn: Compare finite-time outcomes with eventual ruin under stated boundaries and drift.
Start with: Random walk
You have 5 chips and your opponent has 15. On each independent round a fair coin moves one chip from the loser to the winner. You stop when someone has all 20. Is winning still a fifty-fifty proposition?
No: your chance is 5/20 = 25%. A fair round does not mean an equal chance of reaching unequal targets. This lesson separates three questions: winning a round, winning eventually, and winning within a limited time.
Make a prediction
If both players double their stakes, does your eventual winning probability change?
Show a hint
Keep your fraction of all chips in view.
Explore the answer
With a fair coin it stays 25%: 10/40 equals 5/20. But games typically take longer. The probability of finishing within a fixed time can change even when the eventual winning probability does not.
Experiment: a target and a time limit
Choose your starting stake k, the total chips N, and your chance p of winning each round. The paths all follow the same model. The exact table propagates probabilities one step at a time; the simulation estimates them with a finite number of paths.
Eventual chance of reaching 20 chips: 50.00%. The table below instead stops after 500 steps. Every simulated path is counted.
| Outcome by step 500 | Exact probability | Simulation (30 paths) |
|---|---|---|
| Target reached · solid | 49.87% | 15 / 30 |
| Ruined · dashed | 49.87% | 15 / 30 |
| Still playing · dotted | 0.26% | 0 / 30 |
Dotted paths are unfinished. A path that is still playing has not lost. Counting wins only among completed paths answers a different, conditional question and can mislead when one kind of outcome takes longer to arrive.
Why the fair answer is k/N
Let uₖ denote the probability of reaching N before zero, starting with k chips. From k, the first step reaches k+1 with probability p or k−1 with probability q. The rest of the game starts from that new state, giving:
For a fair coin, uₖ is the average of its two neighbors. The values therefore lie on a straight line between u₀ = 0 and uₙ = 1:
The assumptions matter: constant unit stakes, independent rounds with fixed p, a finite total N, and stopping at 0 or N. A changing bet size is a different process.
A small disadvantage, worked through
When p differs from 1/2, solving the same recurrence gives:
Set p = 0.49, k = 50, and N = 100. Here q/p = 0.51/0.49. Because N = 2k, the ratio simplifies to 1 / (1 + (q/p)⁵⁰), about 0.119175, or 11.92%. The chance of eventual ruin is about 88.08%.
A one-percentage-point difference in the chance of each round compounds over many rounds. It does not mean every run loses, and a finite simulation can still differ visibly from the theoretical proportion.
p, k, total = 0.49, 50, 100
ratio = (1 - p) / p
win = (1 - ratio**k) / (1 - ratio**total)
print(f"{100 * win:.2f}%") # 11.92%
Time changes the question
Lower the stopping horizon to a few steps. Most paths may still be inside the interval. The eventual formula cannot tell you how many have already reached the target; the table can.
For a fair game, the expected number of steps until absorption is k(N−k). Starting at 10 of 20 gives 100 steps on average; 50 of 100 gives 2,500. That is an expectation over complete games, not a deadline by which every game finishes. A 2,000-step display can therefore contain many unfinished paths.
What if the opponent has unlimited capital?
Let the opponent’s target move farther away while your starting stake stays fixed. In the independent unit-step model:
Ruin is certain for a fair or unfavorable game, but not when you have positive drift. At p = 0.6 and k = 10, ruin probability is (2/3)¹⁰ ≈ 1.73%. A finite reserve alone does not prove inevitable failure in every stochastic model.
This is a model for studying hitting probabilities, not a forecast of a particular bank, insurer, or trading strategy. Real applications may include changing stakes, dependent losses, time limits, or external cash flows.
Check your understanding
Make a prediction
You see 8 wins, 12 losses, and 80 unfinished paths. Is your estimated chance of winning by the horizon 40%?
Show a hint
Which denominator includes every path that started?
Explore the answer
No. Eight of all 100 paths won by the horizon, so the estimate is 8%. The 40% figure is 8/20: the winning proportion conditional on having finished. Neither number by itself estimates the eventual winning probability when the unfinished paths are omitted.
Continue exploring
A random walk removes the two absorbing boundaries. Markov chains generalize the first-step recurrence to more states. The gambler’s fallacy explains why a losing streak does not alter p in this independent-round model.
References
- Lancaster University: simple random walks and ruin, including the infinite-opponent result.
- Random Services: the simple random walk, for the Bernoulli construction and hitting-time context.