# Why did my friend lose all his money?

Not sure if this is a question for math.se or stats.se, but here we go:

Our MUD (Multi-User-Dungeon, a sort of textbased world of warcraft) has a casino where players can play a simple roulette.

My friend has devised this algorithm, which he himself calls genius:

• Bet 1 gold
• If you win, bet 1 gold again
• If you lose, bet double what you bet before. Continue doubling until you win.

He claimed you will always win exactly 1 gold using this system, since even if you lose say 8 times, you lost 1+2+4+8+16+32+64+128 gold, but then won 256 gold, which still makes you win 1 gold.

He programmed this algorithm in his favorite MUD client, let it run for the night. When he woke up the morning, he was broke.

Why did he lose? What is the fault in his reasoning?

• The last clause should read "continue doubling until you win or have no money". – Chris Eagle Aug 28 '12 at 8:31
• It's called a martingale betting strategy and it works well if you have infinite wealth which was probably not the case... – johnny Aug 28 '12 at 8:33
• To make the claim "you will always win exactly 1 gold" approximately true (almost certainly, and assuming no limit on funds and height of bets), your second clause should be "if you win, stop" – Marc van Leeuwen Aug 28 '12 at 9:49
• Assume you keep doing this, say, 30 times in a row. Where do you take 2^30 money from? Heck, I'm not partiucularly poor, but I don't usually have that much in my pocket... – Damon Aug 28 '12 at 13:30
• It's a shame that we're at a place where a MUD has to be described as a "text-only World of Warcraft" – Gareth Aug 28 '12 at 19:25

Suppose, for simplicity, that the probability of winning one round of this game is $\frac{1}{2}$, and the probability of losing is also $\frac{1}{2}$. (Roulette in real life is not such a game, unfortunately.) Let $X_0$ be the initial wealth of the player, and write $X_t$ for the wealth of the player at time $t$. Assuming that the outcome of each round of the game is independent and identically distributed, $(X_0, X_1, X_2, \ldots)$ forms what is known as a martingale in probability theory. Indeed, using the bet-doubling strategy outlined, at any time $t$, the expected wealth of the player at time $t + 1$ is $$\mathbb{E} \left[ X_{t+1} \middle| X_0, X_1, \ldots, X_t \right] = X_t$$ because the player wins or loses an equal amount with probability $\frac{1}{2}$ in each case, and $$\mathbb{E} \left[ \left| X_t \right| \right] < \infty$$ because there are only finitely many different outcomes at each stage.

Now, let $T$ be the first time the player either wins or goes bankrupt. This is a random variable depending on the complete history of the game, but we can say a few things about it. For instance, $$X_T = \begin{cases} 0 & \text{ if the player goes bankrupt before winning once} \\ X_0 + 1 & \text{ if the player wins at least once} \end{cases}$$ so by linearity of expectation, $$\mathbb{E} \left[ X_T \right] = (X_0 + 1) \mathbb{P} \left[ \text{the player wins at least once} \right]$$ and therefore we may compute the probability of winning as follows: $$\mathbb{P} \left[ \text{the player wins at least once} \right] = \frac{\mathbb{E} \left[ X_T \right]}{X_0 + 1}$$ But how do we compute $\mathbb{E} \left[ X_T \right]$? For this, we need to know that $T$ is almost surely finite. This is clear by case analysis: if the player wins at least once, then $T$ is finite; but the player cannot have an infinite losing streak before going bankrupt either. Thus we may apply the optional stopping theorem to conclude: $$\mathbb{E} \left[ X_T \right] = X_0$$ $$\mathbb{P} \left[ \text{the player wins at least once} \right] = \frac{X_0}{X_0 + 1}$$ In other words, the probability of this betting strategy turning a profit is positively correlated with the amount $X_0$ of starting capital – no surprises there!

Now let's do this repeatedly. The remarkable thing is that we get another martingale! Indeed, if $Y_n$ is the player's wealth after playing $n$ series of this game, then $$\mathbb{E} \left[ Y_{n+1} \middle| Y_0, Y_1, \ldots, Y_n \right] = 0 \cdot \frac{1}{Y_n + 1} + (Y_n + 1) \cdot \frac{Y_n}{Y_n + 1} = Y_n$$ by linearity of expectation, and obviously $$\mathbb{E} \left[ \left| Y_n \right| \right] \le Y_0 + n < \infty$$ because $Y_n$ is either $0$ or $Y_{n-1} + 1$.

Let $T_k$ be the first time the player either earns a profit of $k$ or goes bankrupt. So, $$Y_{T_k} = \begin{cases} 0 && \text{ if the player goes bankrupt} \\ Y_0 + k && \text{ if the player earns a profit of } k \end{cases}$$ and again we can apply the same analysis to determine that $$\mathbb{P} \left[ \text{the player earns a profit of k before going bankrupt } \right] = \frac{Y_0}{Y_0 + k}$$ which is not too surprising – if the player is greedy and wants to earn a larger profit, then the player has to play more series of games, thereby increasing his chances of going bankrupt.

But what we really want to compute is the probability of going bankrupt at all. I claim this happens with probability $1$. Indeed, if the player loses even once, then he is already bankrupt, so the only way the player could avoid going bankrupt is if he has an infinite winning streak; the probability of this happening is $$\frac{Y_0}{Y_0 + 1} \cdot \frac{Y_0 + 1}{Y_0 + 2} \cdot \frac{Y_0 + 2}{Y_0 + 3} \cdot \cdots = \lim_{n \to \infty} \frac{Y_0}{Y_0 + n} = 0$$ as claimed. So this strategy almost surely leads to ruin.

• A link to martingale (betting system) is probably also in order. – hmakholm left over Monica Aug 28 '12 at 11:40
• @HenningMakholm Oh wow, this actually is a thing? Thanks! – Konerak Aug 28 '12 at 12:18
• Yes This is called the gambler's ruin problem. So even for a fair game if you play long enough you will lose all your money. If the game favors the house you will lose faster. See Feller's probability theory books for a more detailed account of the problem. – Michael R. Chernick Aug 28 '12 at 12:25
• It's really amazing that the probability of infinite profit, before bankrupt, is zero. Indeed, Except controlling your thirst of winning a big money, there's no additional way to maximize your profit ! – Fardad Pouran Jun 18 '14 at 10:53

This betting strategy is very smart if you have access to infinite wealth or can go into infinite debt. In reality however, you will eventually lose all or most of your money.

Say your friend had $k$ gold at the beginning. I assume that this simple roulette has a probability of both win and loss equal to $0.5$.

First, let's see how many times you need to lose in a row in order to lose all your wealth.

\begin{align} 1 + 2 + 2^2 + 2^3 + ... + 2^n &\geq k \\ 2^{n+1} - 1 &\geq k \\ n &\geq \log_{2}(k+1) - 1 \end{align}

So even if you start with $10000$ gold, after $13$ lost bets you are broke and in debt. Continuing this example, the probability of this happening in a one shot-game is a mere $0.02$%. However, if you keep the algorithm running all night for $8$ hours betting every $5$ seconds, your chances of having a losing streak of $13$ in a row go up to $29.61$%.

Assuming that you cannot go into debt and $12$ losses is the most you can handle, then with the same data the chance of losing most of your money goes up to $50.5$%.

• I think I get this! So, the probability of losing 13 times is low (1/2^13), but since the other (1-1/2^13) times where he won, he only won 1 gold, and the one time he lost, he lost all his gold, the expected value is low? – Konerak Aug 28 '12 at 9:15
• Not exactly. If you try this strategy right now only once until first win or all money lost, the probability that you lose is $\frac{1}{2^{13}}$. However if you start an algorithm, all that matters is the probability of losing $13$ times in a row while your algorithm is running and the probability of this happening is much higher. – johnny Aug 28 '12 at 9:23
• Somehow you have to factor in the effect that if you do manage to win $2^{13}$ times without going bankrupt, then your tolerance for runs of bad luck goes up to fourteen. I don't think that it changes the verdict, but it would be nice to see how to take that into account. – Jyrki Lahtonen Aug 28 '12 at 9:24
• That is a fair point! I'm glad @ZhenLin worked out the formal details for that. – johnny Aug 28 '12 at 9:40

Repeated bets in roulette is a random walk on the wealthy variable. Since there is a dead end, when you can't continue the walk (when you're broke), the probability of losing everything is greater than zero.

I suppose he was betting on a red/black or even/odd system. Now, there is a "0" which is green/not even or odd, so if you hit that zero, you lose.

There are 36 numbers you can hit, plus that 0 . Even if you chose red or black, even or odd, there are bigger chances to lose than win.

• Roulette tables have a zero and a double-zero, to give the casino its only mathematical advantage. Are you sure this answer true for the MUD as given? Keep in mind, one wasn't given. – Joshua Shane Liberman Aug 28 '12 at 15:56