How to win almost every time to heads or tails.

Humanicus
9 min readJul 7, 2019
Photo by Chris Liverani on Unsplash

Disclaimer: I decline any responsibility in case of loss of money having been led by the reading of this article. As you continue reading, you agree that it is possible to lose to a game of chance, even when the odds are in your favor. You also agree to donate me half of your personal fortune.

Before I start, I’d like to clarify things about the throwing coin game: If you throw a well-balanced coin (not faked, whatever you want), you’ll always have a chance in two (50%) to guess the side of the coin that will come out. Everyone knows that. So how do you rip off your friends by playing Heads or Tails if you can not, anyway, ever change the probability of appearance of each of the faces?

What everyone does not know is that there is a variant of “Heads or Tails” which is unfair. And that’s what I’ll show you below …

Place to play!:

The game we are going to play is a game in which two players will compete and that will consist of throwing a coin several times in a row. Before the game, each player chooses a sequence of 3 results (each result being Head or Tail). Then, you throw the coin as many times as you need (noting each time the result) until one of the two sequences appears.

For example, before starting the play, player 1 chooses the HTH (Head-Tail-Head) sequence and player 2 chooses the HTT (Head-Tail-Tail) sequence. We then launch the piece several times in a row and here are the issues successively obtained:

T H T T H T T T H H

As you can see, this part lasted 10 shots and the first outing sequence is that of Player 2, who is then declared the winner. Of course, you can spice up the game by deciding to put a small (or big) starting bet, the winner winning the pot …

There are 2³ = 8 possible choices of sequences for each player. A priori, the choice of sequences is random, so both players should be expected to have the same chance to win … in any case, this is what intuition lets us think. But we will see that this is not the case (hence the scam!), And above all, we will try to understand why.

A first simulation

To fully understand this game and understand why our intuition is in default, the first thing we will do is a party simulation.

For example, we imagine that your opponent chooses the TTH sequence and that you choose the HTT sequence. We also imagine that you and your opponent are not in a hurry and that you decide to make 10,000 games (!). Precision: for each part, your opponent will always have the TTH sequence, and you the HTT sequence.

I simulated this situation using a program and here are the results obtained at the end of the 10,000 parts:

In this simulation, your opponent has won 2526 times and you have won 7474 times. Suffice to say that you put your opponent shabby.

You notice with surprise (and greediness) that you win very predominantly — by sight, in about 3 out of 4 cases. Since we have done a lot of simulations, the law of large numbers allows us to think that your probability of winning is 3/4, so well above one chance out of two!

Simulations of all possible choices of the opponent:

You may tell me that if my opponent had chosen another sequence than FFP, then he might have been able to win. We will simulate the 8 possible cases, corresponding to the eight sequences that your opponent can choose at the start: TTT, TTH, THT, THH, HTT, HTH, HHT, HHH. And for each choice of your opponent, I put a very precise choice of sequence that will make you win …

Here are the simulations (this time, I put the frequencies of victories, rather than the numbers). Each diagram corresponds to a simulation of 10,000 parts:

So you see that, whatever the choice of sequence of your opponent, there is a sequence that can make you win more often on average!

The winning strategy

Here is the strategy to follow to win this game (with the passage a very nice mnemonic):

1-Wait for your opponent to choose a sequence first. This is important because your optimal choice will depend on the choice of the opponent.

2-If your opponent chooses the A-B-C sequence (where A, B and C are Head or Tail), choose the (anti-B) -A-B sequence where anti-B is the opposite face of the B side.

For example, if your opponent chooses the HTH sequence, choose the sequence (anti-T)HT ie HHT.

If you choose your sequence exactly as shown, then you are guaranteed to have a higher probability of winning than your opponent. Here is more precisely the table of probabilities:

table of probabilities

As you can see, your probability of winning can range from 2 chances out of 3 to 7 chances out of 8 if your opponent has the misfortune to choose a winning sequence like TTT … We now have to understand why some sequences beat other sequences and see how we can calculate these probabilities.

Analysis of two cases

We will study two examples: a first case in which we will not make any calculation but which will serve us to understand why one sequence can prevail on the other; and a second case where we will see how we can calculate the probabilities of winning that we have given above.

Example 1: Your opponent chooses TTT and you choose HTT.
Let’s start with an obvious remark: in order for your opponent to win, you have to be shot at one point in the Tail game (T) and then Tail shot again (TT) and finally Tail shot (TTT). On the other hand, for you to win, it is necessary that at a moment of the game, Head is shot (H) then it is Tail who leaves (HT) and finally that Tail is still shot just after (HTT). A very convenient way to represent this is to use what is called a graph of a Markov chain:

Here, each arrow represents a throw. Depending on where the arrow is pointing, you can tell if it was Head or Tail.

This graph clearly shows the asymmetry of the sequences. We note in particular that from the moment when a single Head is out, we definitely leave the bottom branch and therefore your opponent has no chance to win. This is what gives a distinct advantage to the HTT sequence compared to the TTT sequence.

Example 2: Your opponent chooses HTT and you choose TTH.

Here again, we can trace the Markov graph associated with this situation:

We see that once the sequence ‘Head-Head’ out, your opponent has no chance to win, which gives you a greater probability of winning. But how much exactly is this probability? That’s what we will calculate. For that, we will first complete the previous graph:

This graph should read from your point of view (and not your opponent’s): the goal is to arrive at the node HHT. Beside each node, we have placed a letter (p, x, y) or a number (1, 0). This corresponds to the probability of arriving at the node HHT knowing that we start from this node.

For example, the probability of starting from the Start node and arriving at the HHT node is P(so it’s the probability that you win the game!). Another example, imagine that at a time of the game, the HT sequence is output: the probability that you win the game knowing that this HT sequence has just been drawn is noted y. (Well, in the end, “y” it will not be used in this article but it should serve us to show you a second method of calculating this probability, but as the article starts to become too long …)

You notice that next to the node HHT we put 1, because once this sequence out, you are sure to have won the game since you won the game!I think you now understand why there is 0 next to the HTT node …

Let us now turn to the calculation of your probability of winning the game, that is to say, the calculation of H. We will use the same rules as for probability trees (which you are probably more used to).

First of all, it is clear that H=x because, as we see on the graph, the game really starts from the moment when we joined the node H.

To compute x, the total probabilities formula tells us that we have to sum the probabilities of all the paths that go from H to HHT. And as for probability trees, the probability of one of these paths is the product of the transition probabilities (which are all of 1/2 here).

A path from H to HHT breaks down (in order) into:

1-A number of times n the H-HT cycle, which has probability:

2- Once the path H-HH, which has probability 1/2.
3- A number of times the loop HH-HH, which has probability 1/(2^m).
4- Once the final path HH-HHT (which I personally call the path of glory) that has probability 1/2.

Such a path, therefore, has for probability:

In the end, to find x (and therefore p), we must sum up all these probabilities (this is the formula of the total probabilities!):

We recognize nice geometric series that we can easily calculate. So we have

We thus find a result that we saw in the table of the probabilities higher: if your opponent plays HTT and that you play HHT then you have 2 chances on 3 to win.

A variant to play in practice

As we have seen, whatever your opponent’s choice, you have a choice of sequence that gives you a greater probability of winning. But that’s still a probability and if you only play one game, your opponent can always win.

In order to maximize your winnings, it would be nice to play several games in a row and rely on the law of large numbers (which says that your winning frequency tends to be closer to your probability of winning … consider the simulations of 10 000 parts that we saw above). So the more games you do, the better for you!

However, in practice, throwing a coin dozens of times can be tedious … So why not use playing cards instead of a coin? This is what two mathematicians, Yutaka Nishiyama, and Steve Humble, imagined.

Take a pack of 52 cards. Each player chooses a sequence, not of Head or Tail, but of Red or Black (the colors of the cards!). Flip each card one at a time until a sequence appears. And as long as there are still cards in the package, keep turning them over!

This variant with cards can play on average about 7 games before having exhausted all the cards, which, as mentioned above, is advantageous for the player who has chosen a sequence that has a higher probability. to win. But there is better: this variant is not exactly identical to a coin toss (because for example, at a given moment of the game, it can remain in the deck more Red cards than Black cards or vice versa), can actually show that the probabilities of winning are greater than those obtained for playing with coins! (see reference at the end of the article).

If you want to get rich, start by taking a pack of cards!

--

--

Humanicus

Please follow me since now we need 100 min follower on medium