# Martingale Strategy

The Martingale Strategy is a gambling strategy for Roulette, whereby you double your bet every time you lose, such that when you eventually win, your winning bet covers all of your losses until that point plus a small profit.

E.g. suppose you bet $$1$$ on Red and win, you get back $$2$$ for a profit of $$1$$. Suppose you bet $$1$$ on Red and lose, the next time you bet $$2$$ on Red. If you win, you get $$4$$ back, which covers the $$1$$ and $$2$$ you bet for a profit of $$1$$. You can continue like this:

Outcome Bets Winnings Profit
R $$1$$ $$2$$ $$1$$
BR $$1 + 2 = 3$$ $$4$$ $$1$$
BBR $$1 + 2 + 4 = 7$$ $$8$$ $$1$$
BBBR $$1 + 2 + 4 + 8 = 15$$ $$16$$ $$1$$

No matter the outcome you seemingly always end up with a profit of $$1$$. However, this doesn’t take into account the fact that you have finite money. Suppose you only have a bankroll of $$10$$, if BBBR comes up, you’ll be wiped out before you get the chance to make your money back! How much money do you need to minimise the chances of getting wiped out?

If you have a bankroll size of $$x$$, consider what has to happen to double your bankroll size to $$2x$$. You need to have $$x$$ reds come up, but between each red you will have a run of blacks that could be of any length with the following probabilities:

#blacks Chance Spend
$$0$$ $$0.5000$$ $$1$$
$$1$$ $$0.2500$$ $$2$$
$$2$$ $$0.1250$$ $$4$$
$$3$$ $$0.0625$$ $$8$$
$$n$$ $$2^{-(n+1)}$$ $$2^{n}$$

If $$2^{n}$$ is greater than our bankroll $$x$$ then we go bankrupt after a run of $$n$$ blacks. We therefore, need $$\lfloor \operatorname{log_{2}} (x + 1) + 1 \rfloor$$ blacks in a row to bankrupt us. For large enough $$x$$, we can approximate this expression to $$\operatorname{log_{2}} x$$, meaning the probability of bankrupting between any pair of reds is:

\begin{align} & \frac{1}{2}^{log_{2} x} \\ = & \frac{1}{x} \end{align}

Or, alternatively, the chance of it not bankrupting us is

$1 - \frac{1}{x}$

So to double our money from $$x$$ to $$2x$$, we’d have to have the blacks not bankrupt $$x$$ times in a row, with a probability of:

$(1 - \frac{1}{x})^{x}$

As our bankroll gets larger and larger, this expression tends towards $$0.367$$ or $$e^{-1}$$, i.e. with the Martingale Strategy, the chance of us doubling our money is only $$0.367$$, worse than just putting it all on red on the first spin!

Here’s the results of a Monte Carlo simulation to show how your chances of successfully doubling your money decrease as your bankroll increases:

Code to generate above graph:

Sub Main()

Randomize(Timer)

Dim total As Integer = 0
Dim wins As Integer = 0
Dim ratio As Double

For j As Integer = 1 To 25
For i As Integer = 0 To 1000000
total += 1
If Martingale(j) Then wins += 1
Next

ratio = CDbl(wins) / CDbl(total)

Console.WriteLine(j & ", " & ratio)

j = j + 1

Next

End Sub

''' <summary>
''' Runs single simulation of Martingale strategy
''' </summary>
''' <param name="startRoll">Initial bankroll</param>
''' <returns>True if bankroll doubles, false if we go bankrupt.</returns>
Function Martingale(startRoll As Integer) As Boolean

Dim bankroll As Integer = startRoll
Dim betSize As Integer = 1

Do

bankroll -= betSize

If bankroll < 0 Then Return False

If Rnd() > 0.5 Then
bankroll += betSize * 2
If bankroll >= startRoll * 2 Then Return True
betSize = 1
Else
betSize *= 2
End If

Loop

End Function