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?
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] &lt; \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 &amp; \text{ if the player goes bankrupt before winning once} \\
 X_0 + 1 &amp; \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 &lt; \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 &amp;&amp; \text{ if the player goes bankrupt} \\
Y_0 + k &amp;&amp; \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.
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.