ExplorationsA fair bet is not a safe one when the casino has more money than you do
The Gambler’s Ruin
You start with 10 units and the casino with 10. Each round you stake one unit on a coin that wins with probability 1/2 or loses, and you play until one of you holds all 20. The chance you end ruined is exactly 50%. Keep the bet fair but give the casino 90 units instead, and the chance you are ruined rises to 90%, about as high as for a bet that wins only 45% of rounds against an equal bankroll, which is 88%. On average a fair bet loses nothing, yet who ends with everything depends on how the bankrolls compare. The average hides how the ending splits.
Interactive laboratory
round 358 of 358 · ruined 9 · broke the bank 11 · still playing 0
Each line is one game. The exact chance of ruin for this bet is 50.0%, and these twenty games are a small sample that can sit well away from it. The games are drawn from seed 20,261,018 and describe those twenty histories only.
How each of the twenty games ended
| Game | Rounds played | Final bankroll | How it ended |
|---|---|---|---|
| 1 | 90 | 20 | broke the bank |
| 2 | 244 | 20 | broke the bank |
| 3 | 64 | 0 | ruined |
| 4 | 170 | 20 | broke the bank |
| 5 | 70 | 0 | ruined |
| 6 | 28 | 0 | ruined |
| 7 | 78 | 0 | ruined |
| 8 | 358 | 20 | broke the bank |
| 9 | 20 | 0 | ruined |
| 10 | 70 | 0 | ruined |
| 11 | 36 | 20 | broke the bank |
| 12 | 250 | 20 | broke the bank |
| 13 | 14 | 0 | ruined |
| 14 | 130 | 20 | broke the bank |
| 15 | 104 | 20 | broke the bank |
| 16 | 66 | 20 | broke the bank |
| 17 | 172 | 20 | broke the bank |
| 18 | 88 | 0 | ruined |
| 19 | 26 | 20 | broke the bank |
| 20 | 138 | 0 | ruined |
- a ruined game
- ended on the lower wall at 0
- a game that broke the bank
- ended on the upper wall
- a game still playing
- has not reached a wall yet
- the walls
- the solid lines at 0 and at the total
- the start
- dotted line at the starting bankroll
The horizontal axis counts rounds and the vertical axis is your bankroll. The lower solid line is ruin at 0 and the upper solid line is the total, where the casino is ruined. Each thin line is one game: up a unit on a win and down a unit on a loss. A game that ends ruined turns red and one that breaks the bank turns blue. The dotted line is the starting bankroll.
A fair bet, with 10 units against a casino holding 10. After 358 of 358 rounds, 9 of the 20 seeded games have ruined the player, 11 have broken the bank and 0 are still playing. The exact chance of ruin is 50.0%; these 20 games are a small sample and describe those histories only.
- Bankrolls
- 10 vs 10
- Ruin chance
- 50.0%
- Ruined so far
- 9 of 20
Try this
With a fair bet and a bankroll of 10, raise the total from 20 up to 100 in steps of 20. How does the chance of ruin change, and can you state a rule that gives each value?
What is going on
Each explanation begins with a worked example and follows the same operation through intuition, formal statements and proofs. Later sections distinguish what is established from questions that remain open, so you can follow the level of detail useful to you.
- how much likelier a loss is than a win(3/5) ÷ (2/5)3/2the ratio q/p of losing to winning, which the closed form raises to the power of the bankroll
- the chance of ruin from 1 unit((3/2) − (3/2)³) ÷ (1 − (3/2)³)15/19the closed form for a total of 3 units: the ratio to the power of your bankroll, less the ratio to the power of the total, over one less the ratio to the power of the total
- a check from the first round alone3/5 + (2/5) × (9/19)15/19a loss ruins you at once, and a win leaves you with 2 units, where ruin has chance 9/19; the same answer from a different route
- the expected length of the game1 ÷ (1/5) − (3 ÷ (1/5)) × (1 − 3/2) ÷ (1 − (3/2)³)35/19the second closed form, with q − p = 1/5; a little under two rounds, because one loss ends the game at once
What you are seeing
Two bankrolls, one coin, and a game that stops at a wall
You hold some units of money and the casino holds some more. Each round you stake one unit on a bet: you win it with a fixed chance, say a half, and otherwise lose it. Your bankroll goes up by one when you win and down by one when you lose, and the casino's moves the other way. The game stops the first time either of you has nothing, so it stops when your bankroll reaches 0, which is ruin, or when it reaches the total of both bankrolls, which is the casino's ruin.
The picture follows twenty games from the same start. Each thin line is one game, a bankroll wandering up and down between two walls until it touches one. Lines that touch the lower wall turn red and lines that touch the upper wall turn blue. Count them. At the opening setting, ten units each and a fair coin, about half should end in each colour, and the exact chance of ruin is printed beside the picture: 50%.
Now give the casino more money and keep the coin fair. Nothing about a single round has changed, and yet the red lines multiply.
Why it starts to make sense
A fair game only breaks even on average
A fair bet is worth exactly nothing on average: you are as likely to win a unit as to lose one. So over any number of rounds your expected bankroll is the one you started with. That sounds like safety, but an average can be made of very different endings. If you start with 10 units against a casino holding 90, you finish either with 0 or with 100. The only way the average can stay at 10 is for you to finish with 100 about one time in ten, and with 0 the other nine.
That is the whole effect for a fair bet. Your chance of ending ruined is the casino's share of the money, and your chance of taking everything is your own share. The walls are absorbing: once the bankroll touches one it stays there, so every game ends in one of two ways and the only question is how the probability splits between them.
The picture of the chance of ruin shows the split for every starting bankroll with the same total. With a fair bet it is a straight line sloping from certain ruin at 0 units to no ruin at the total.
The key idea
Fair is a statement about one round, and the ending depends on the walls
Whether a bet is fair is a statement about a single round. Who ends up with everything is a statement about the whole game, and that depends on the walls. A gambler with a modest bankroll against a large casino is close to the lower wall and far from the upper one, so a random walk with no lean either way is far more likely to reach the near wall first.
If the bet tilts toward the casino, the tilt works on top of that. A bet that wins 45% of rounds loses only a tenth of a unit per round on average, which looks like nothing, yet against an equal bankroll of ten units it ruins you 88% of the time, because the tilt acts on every one of the many rounds that the game lasts. A tilt of one point, 49% against 51%, ruins a gambler with 50 units against 50 about 88% of the time too.
So both things matter, and they trade off. Fair against a richer casino ruins you almost as surely as a slightly unfair bet against an equal one: 90% for ten units against ninety, and 88% for ten against ten at 45%. The laboratory lets you move each separately and see the other change.
Formal statement
A random walk between two absorbing walls
Let a gambler hold units and the casino , so the total is . Each round the gambler wins one unit with probability and loses one with probability . Let be the probability that the bankroll reaches before it reaches when starting from , and let be the expected number of rounds until it reaches either. Put .
For ,
and for the fair bet ,
The expected final bankroll is , which equals exactly when the bet is fair.
Against a casino with no limit, letting , the ruin probability tends to when and to when .
Proof
One equation, a telescoping sum, and a check by hand
Look at the first round. With probability the bankroll moves to and with probability it moves to , and after that the game starts afresh from there, so for
Since this is . Write . Then , so . The differences add up to , so . For this gives , and then
For every is the same, equal to , and .
One thing needs saying: the game must end. From any bankroll, wins in a row reach the upper wall, and that has probability at least . So the chance that the game is still going after rounds is at most , which tends to 0, and ruin and breaking the bank are the only two endings. That is why is the chance of taking everything.
For the duration, the first round gives with . For the fair bet, substitute : . For , solves the equation with the , since , and the solutions of the same equation without the are . The two boundary values fix and and give the formula above.
The check on the fair bet's average: the gambler finishes with units with probability and with otherwise, so the average is , the starting bankroll.
The kernel evaluates each formula in exact rational arithmetic. The tests compare it, case by case, with the first-step equations solved as a linear system, with an exhaustive enumeration of every sequence of rounds up to a length, and with seeded simulations within four standard errors for the ruin share and five for the mean length. These are checks on the code. The formulas themselves are proved above.
Limits and further questions
What the model leaves out, and what an average hides
The model is the simplest one. The stake is always one unit, the chance of winning never changes, and the walls are fixed. A gambler who stakes a larger share of the bankroll when ahead, or who may stop at any time, is playing a different game, and the page says nothing about it. What carries over, for fair bets, is that no rule for choosing stakes changes the average final bankroll. That is the optional stopping theorem for martingales, a standard result that is cited rather than proved here.
The expected length of a game is an average and a misleading one. For ten units against ten at a fair bet it is 100 rounds, yet individual games range from ten rounds to several hundred, and a few run far longer. The twenty seeded games show that spread directly. A game that has not ended yet is still exposed to both walls, so a long game is not a safer one.
Real casinos do not offer fair bets. In the laboratory an edge of a few points is harmless to a short session and ruinous to a long one, which is why the exact curves matter more than a twenty-game sample. Against a casino with no upper limit, even a favourable bet has a positive chance of ruin that does not depend on how long you keep playing, which the dotted line shows: at 55% and a bankroll of ten units it is about 13.4%.
The page proves the formulas for the model it states and checks them against independent computations. It does not claim that any betting system beats a casino, and it does not model a bankroll that can go below zero.
What is actually established
Every statement on this page, with its status, its exact scope, and the date that status was last checked.
You hold i units and the casino holds N − i. Each round you win a unit with probability p and lose one with probability q = 1 − p. The chance you are ruined before holding all N units is (ρ^i − ρ^N) ÷ (1 − ρ^N), where ρ = q/p, when p is not 1/2, and 1 − i/N when it is.
- Scope
- Unit stakes, a fixed win chance on every round, and two absorbing walls at 0 and N, with N and i whole numbers and 0 ≤ i ≤ N. The page offers win chances in whole percent from 30 to 70 and totals up to 100; the proof does not need those limits.
- Why
- The ruin chance r_i satisfies r_i = p·r_{i+1} + q·r_{i−1} for 0 < i < N, with r_0 = 1 and r_N = 0, since the first round decides which neighbour the walk moves to. Writing p(r_{i+1} − r_i) = q(r_i − r_{i−1}) shows the differences grow by the factor ρ each step, and summing them from 0 to N, which must come to −1, fixes the first difference and so every value. The game ends with probability 1, because N wins in a row have probability at least p^N and can start from any bankroll, so ruin and breaking the bank are the only endings. The kernel computes the formula in exact rational arithmetic and its tests compare it with the same equations solved as a linear system.
- Status checked
- Sources
- An Introduction to Probability Theory and Its Applications, Volume 1 citation unresolved; Introduction to Probability citation unresolved
The expected number of rounds until the game ends is i(N − i) for a fair bet, and i/(q − p) − (N/(q − p))·(1 − ρ^i)/(1 − ρ^N) otherwise.
- Scope
- The same game as above: unit stakes, a fixed win chance, absorbing walls at 0 and N. The value is an average over every way the game could go and says nothing certain about any one game, whose length varies a great deal around it.
- Why
- The expected length D_i satisfies D_i = 1 + p·D_{i+1} + q·D_{i−1} with D_0 = D_N = 0. For a fair bet, substituting i(N − i) gives 1 + ½(i+1)(N−i−1) + ½(i−1)(N−i+1) = i(N − i), and the equations have only one solution with these walls. Otherwise i/(q − p) is a particular solution, the solutions of the homogeneous equations are A + Bρ^i, and the two boundary values fix A and B. The kernel computes the formula exactly and its tests check it against the linear system.
- Status checked
- Sources
- An Introduction to Probability Theory and Its Applications, Volume 1 citation unresolved
For a fair bet, the chance of ruin is the casino’s share of the total, 1 − i/N, while the expected final bankroll is exactly the starting bankroll i. With 10 units against a casino holding 90, ruin has chance 90% and you still finish with 10 units on average.
- Scope
- A fair bet, p = 1/2, with unit stakes and absorbing walls at 0 and N. The statement about the average is exact; it does not say what any single game does.
- Why
- The first claim is the ρ = 1 case of the ruin formula. For the average, you finish with N units with probability 1 − (1 − i/N) = i/N and with 0 otherwise, so the expected final bankroll is N · i/N = i. A bet whose average gain is zero therefore leaves the average where it started, and the only freedom left is how the weight splits between the two walls, which is set by the bankrolls alone.
- Status checked
- Sources
- Introduction to Probability citation unresolved
Against a casino with no limit, the chance of ruin is 1 whenever the chance of winning a round is at most 1/2, and (q/p)^i when it is more than 1/2. At 55% and a bankroll of 10 the chance of ruin is about 13.4%.
- Scope
- The limit as the casino’s bankroll, and so N, grows without bound, for a fixed whole-percent win chance and a fixed starting bankroll. The laboratory’s dotted line is this limit drawn from the same closed form.
- Why
- Let N grow in the ruin formula. If ρ < 1 then ρ^N tends to 0 and the formula tends to ρ^i. If ρ > 1 the numerator and the denominator are both dominated by ρ^N, and the formula tends to 1. If ρ = 1 it is 1 − i/N, which tends to 1. For a favourable bet the limit is positive, so a gambler with a favourable bet and a bankroll of ten units still has a fixed chance of being wiped out.
- Status checked
- Sources
- An Introduction to Probability Theory and Its Applications, Volume 1 citation unresolved
The closed forms agree exactly with the first-step equations solved as a linear system, for every whole-percent win chance from 30 to 70, every total of 2, 3, 7 and 12 units and every starting bankroll, and with a wide case at a total of 40. Enumerating every sequence of rounds up to 14 for eight small walls brackets them, and seeded simulations agree within four standard errors for the ruin share and five for the mean length.
- Scope
- Only the cases listed. The enumeration gives lower and upper bounds, not equality, since a game can run past any cut-off, and the simulations are seeded samples that support the formulas without proving them. The proof of the formulas is given in the proof layer.
- Why
- The linear system shares no algebra with the formula, and the enumeration shares no algorithm with either, so agreement is a check on the kernel and not on the page’s reasoning. The unfinished weight in the enumeration is reported with the bounds, and the simulation tolerances, four standard errors for the ruin share and five for the mean length, are stated in the tests that apply it.
- Computation (exact)
- Exact rational comparison of both closed forms with Gaussian elimination on the first-step equations, for each win chance 30 to 70 and totals 2, 3, 7 and 12; exhaustive path enumeration to 14 rounds for eight walls with totals 3 to 6; four thousand seeded games for each of six walks. Algorithm gamblers-ruin-1.
- Status checked
The twenty thin lines are one seeded set of games and describe those games only.
- Scope
- The twenty games actually drawn at the seed printed beside the figure, for the chosen bankrolls and bet. A different seed draws different games around the same exact chance of ruin.
- Why
- The games come from a seeded generator and never from the browser’s own randomness, so a shared link replays the identical histories. The exact chance of ruin is printed beside them for comparison; the sample is not offered as evidence for it, and twenty games can easily sit several games away from the expected count.
- Status checked
Sources
Review notes show which bibliographic details Mathomaly has checked and which remain unresolved. Checking a publication record does not independently verify its proof.
- William Feller, An Introduction to Probability Theory and Its Applications, Volume 1, Wiley, 3rd edition, 1968. Link
The classical treatment of the ruin problem for a random walk with absorbing barriers, including the probability of ruin and the expected duration of the game. Cited for where the closed forms are treated in general; the page proves them from the first-step equations and recomputes every value it prints.
Citation details remain unresolved after review by Mathomaly.
Bibliographic review:
AI-assisted bibliographic audit. Evidence type: unresolved.
The Open Library work record gives the title, the author William Feller and a first publication in 1950. That the third edition is dated 1968, and which chapter treats random walks and ruin, rests on the citation as given here and was not checked against the book, whose text was not inspected.
- Charles M. Grinstead, J. Laurie Snell, Introduction to Probability, American Mathematical Society, 2nd revised edition, 1997. Link
An undergraduate text with a section on the gambler’s ruin inside its chapter on random walks, giving the fair-bet result that the chance of ruin is the other player’s share of the total. Cited as a readable second treatment, not for any value computed on this page.
Citation details remain unresolved after review by Mathomaly.
Bibliographic review:
AI-assisted bibliographic audit. Evidence type: unresolved.
The Open Library work record gives the title Introduction to probability, the author Charles M. Grinstead and a first publication in 1997; a second record, which includes J. Laurie Snell as co-author, gives a later date. The book’s text was not inspected, so the section it is cited for rests on this page’s own derivation and not on the record.
Related by mechanism
Connected by how they work, not by sharing a topic label.