Martingale: math review and calculations

Winner for sure! but at what cost ?!
A martingale is a betting strategy in games of chance. The objective is to adapt one's behavior (one's bets) according to previous results.
In theory , a martingale ensures a sure win in a game of chance. In theory only, because practice turns out to be less utopian. This is precisely what we are going to see on this page.


Classic martingale

Let's take a game of chance, for which we have a probability of winning p with the rule: when we actually win we double our stake whereas in the event of a loss, we simply lose our stake.
The bet is, by definition, risky. We can think of a coin toss with p = 1/2 = 50%, or roulette in a casino with p = 18/37, or any other game of chance.

The classic martingale, the best known, is the following strategy.
We initially bet 1 euro.

If we continue, possibly tirelessly, this strategy, we necessarily gain 1 euro. We can represent this strategy by a probability tree

Expected value for the martingale

The expectation is then calculated according to:
E = 1×p + 1×(1−p)p + 1(1−p)2p + … = p +∞ k=0 (1−p)k
We recognize here the geometric series, convergent for |x|<1,
S(x) = +∞ k=0 xk = 1/1 − x
So we find the expected value
E = pS(1−p) = p1/1 − (1−p) = p1/p = 1
and we calculate and clearly demonstrate the obvious result from the beginning: with this martingale, this strategy, we definitely earn 1 euro.
We earn 1 euro every time, IF we are ready to never stop the martingale: this means in particular that we have infinite capital to bet.

Imaginons qu'on ait au contraire un capital fini, et qu'on sache donc dès le début qu'on ne pourra pas miser plus que ce capital. Que devient l'espérance ?

Expected value for the truncated martingale

Let's say for example, to begin with, that we have capital of 10 euros. With a starting bet of 1 euro, you cannot lose more than 3 times consecutively, i.e. the loss of 1+2+4 = 7 euros, and this happens with probability p = 1/23 = 1/8 In all other cases, we earn 1 euro as we saw before.
We therefore have the law of probability, with a capital limited to 10 euros:
Gain1−7
Probabilité7/81/8
and we easily calculate the expectation:
E = 1×7/8 + (−7)×1/8 = 0
and the expected value is therefore the same with the martingale or by simply playing the game once.
Well, limiting yourself to 3 games in the martingale may be a little too limited. After all, the probability of losing decreases rapidly with the number of games in the martingale. And if our starting capital allowed us to bet for at least 10 successive games, or 100 games, wouldn't the math expectation be closer to 1 euro which is the expectation of the infinite martingale?
Here we go, let's calculate.
Let n therefore be the number of games on which one can bet successively in the martingale. The probability of losing (which decreases with the number n of games) is then
p = 1/2n
while you can win 1 euro either in the 1st game with the probability 1/2 or to the 2nd with the probability 1/22, or to the 3rd,…, up to the n−th with the probability 1/2n.
In summary, my probability of winning 1 euro before n games is therefore the geometric sum
pn = n k=1 1/2k = 1/2 n−1 k=0 1/2k = 1/2× 1 − 1/2n / 1 − 1/2 = 1 − 1/2n
and we therefore have the law of probability, limiting to n successive losses
Gain1−2n+1
Probabilité1 − 1/2n 1/2n
and we then calculate again that the expectation is zero:
En = 1 − 1/2n + (−2n+1)×1/2n = 1 − 1/2n + −1 + 1/2n = 0


Ultimately therefore, if we know from the start that we will not be able to continue the martingale indefinitely, the average gain will be the same, over a large number of games, by playing at random each time, or by implementing a strategy of martingale: the martingale does not change expectation!.
This result is not necessarily intuitive, since a martingale is constructed to lead to a sure gain (expectation equal to 1) and we therefore have the impression that by increasing the number of successive games the expectation will also increase to get closer to 1. This is false, and we have just demonstrated in mathematical terms that the expectation En for a martingale limited to n games verifies the properties:
nN , En = 0
and
 limn+∞ En = 1
This last result shows that, even more than non-intuitive, this result is even false… It is mathematically impossible for a constant sequence equal to 0 to tend towards 1…

Back to the expectation of the infinite martingale

The calculation of the for the infinite, untruncated martingale was in fact incorrect. We take it again here. To calculate the expectation of the infinite martingale, it is necessary to mathematically calculate the expression of the expectation En then make n tend towards infinity.
With the previous probability tree, we have for n where the loss in the event of n consecutive defeats is −2n+1
En = 1/2 + 1/22 + … + 1/2n−1 + 1/2n×(−2n+1)
The first part is again the sum of the terms of a geometric sequence of ratio 1/2, and we then find, as in the preceding calculation of expectation, that for any integer n
En = 0
which ends up showing how counter-intuitive this is: even if in the martingale we "must end up winning", inevitably, at some point, the expectation remains zero: the martingale brings nothing compared to the fact of playing several times independently at this game.

Back to the expected value of the infinite non-equiprobable martingale

The calculation in the previous paragraph corrects the calculation of the expectation for the infinite and equiprobable martingale, that is to say where the probability of winning, and losing, in each round is p =1/2.
What about with any probability 0<p<1.
Here too, by resuming the calculation of the expectation En, with the probability tree, we calculate this time that
En = p + p(1−p) + p(1−p)2 + … + p(1−p)n−1 + (1−p)n(−2n+1)
where we find again the sum of the first terms of a geometric sequence of common ratio (1−p):
En = p 1−(1−p)n/1−(1−p) + (1−p)n(−2n+1)
either
En = 1−(1−p)n + (1−p)n(−2n+1)
or, by expanding the last parenthesis and simplifying,
En = 1−[2(1−p)]n
and so, Let us therefore interpret these latest results, especially by comparing with the simple game, a game of chance without any particular strategy or martingale.

Interpretation of expectation and interest, or no, of a martingale

By betting on this game n times: bet of 1 euro and probability p of winning 2 euros and the rest of losing your bet, and always the same bet of 1 euro, without any strategy, the number of successes over the n games is in average E = np (expectation for a binomial law with parameters n and p precisely).
Thus, we expect to win the net gain, over n games:
G = 2npn = 2np1/2
This result is compared to the expectation calculated in the previous paragraph with a martingale.
In case the previous calculations are not yet sufficiently convincing, "we know that in general" what limits the use of martingales is the risk taken of a black series: a chain of losses, which although in theory necessarily ultimately compensate by the very mechanism of the martingale (do you still believe in it after the previous calculations?), requires having the necessary funds to be able to continue the martingale to the end.
Let's now focus, no longer on the winnings, but on the bets that we will have to invest on average. These are directly related to the number of games. More precisely, in the nth game you must bet 2n euros.
It remains to know how many games we should expect to play before winning, that is to say also the stake we should prepare to invest.

Average number of games and stake invested

This involves counting the number of games played, on average, before winning and therefore stopping.
If we denote X as the random variable equal to the stop rank, that is to say the rank of the first success, we then have the probability law
stop rank
X = i
123
Probability
P(X=i)
pp(1−p)p(1−p)2
and expectation is then
E(X) = p + 2×(1−p)p + 3(1−p)2p + … = +∞ k=1 kp(1−p)k−1
The random variable X thus defined and used follows the geometric probability law with parameter p. As such, we know that his expectated value is
E(X) = 1/p
This expected value represents the average number of games played before winning.

Now, in the k−th game we bet 2k−1 euros, and therefore, if we win in the n−th game , we will have bet in total on the n successive games

Mn = 1 + 2 + 22 + … + 2n−1
which is again a geometric sum equal to
Mn = 1 − 2n/1 − 2 = 2n − 1
It is this bet, for n = E(X) = 1/p, which quickly becomes dizzying and can render this martingale unusable in practice.
Let's see this with some numerical values.

Numerical applications

There is only one parameter here: the probability p of victory in each game.

p = 1/2: case of equiprobability

For p=1/2, we have the expectation of the number of games played before the first success, therefore before winning our euro profit and stopping, which is
E(X) = 1/p = 2
that is to say that we will win on average every two games.
You should expect to invest stakes of on average
M = 2E(X)−1 = 3
or 3 euros, it's playable.

p = 1/10: unfavorable case

Likewise, the expectation of the number of games played before the first success, therefore before earning our euro of winnings and stopping, which is
E(X) = 1/p = 10
that is to say that we will win on average every 10 games.
You should expect to invest stakes of on average
M = 2E(X)−1 = 1023
i.e. 1023 euros, that is to say also 1023 times the starting stake of 1 euro, and therefore also 1023 times the gain obtained (which is still as safe, of course, but for an amount of only one euro).

p = 1/20: very unfavorable case

The expectation of the number of games played increases further (logical since we win more rarely) before the first success, and is
E(X) = 1/p = 20
that is to say that we will win on average every 20 games.
You should expect to invest stakes of on average
M = 2E(X)−1 ≃ 106
or around 1 million euros…

The stake to be invested increases considerably with each lost game, and even if you are sure to compensate for it at one point or another, you must be able to afford it!
We also focused on the expectation, but the probability of having a number of consecutive losing draws which exceeds this is not negligible.

Probability of significantly exceeding the expected average

We recall that for a geometric law with parameter p and with q = 1 − p the probability of failure, we have the probability
P(X > k) = qk
For example, for p = 1/2, we saw that, on average, we expect to play 2 games before winning. It's playable, the investment is low.
On the other hand, in this same case, we have for example
P(X > 6) = 0,56 ≃ 0,016
i.e. approximately 1.6% chance (negligible?) of having to make at least 7 successive draws to win, and therefore 1.6% chance of having to invest the stake
M = 27 − 1 = 127
i.e. 127 times the initial stake and 127 times the winnings…

With a slightly more risky game, for p = 1/4 for example, the expectation is
E(X) = 1/p = 4
and the average stake to invest
M = 2E(X)−1 ≃ 15
or around 15 euros… it's 15 times the initial stake, but playable (?).
On the other hand, the probability, for example, of having at least 12 draws before winning is
P(X > 11) = 0,7511 ≃ 0,04
or around 4% chance (negligible?)
In this case, the stake to invest is
M = 212 − 1 = 4095
i.e. more than 4000 times the initial stake and therefore also 4000 times the winnings… The profitability is more than questionable!

Conclusion

This martingale, like many others, is therefore clearly effective in theory: a sure gain guaranteed.
On the other hand, in practice, the stakes to be invested quickly become dizzying and make its use illusory: it would require having an infinite sum to invest, which is of course not the case for a real human player.

We have studied martingales for games of pure chance here, and the conclusion is now obvious: this strategy should not be used.
What about games that aren't just about pure chance? There, adding information about possible outcomes can turn martingales into an effective strategy. See for example the martingale on a loser or the martingale on draws.