Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Created August 23, 2016 10:11
Show Gist options
  • Save mafintosh/cc8e486844bf3d35cae99e626b1d2ef6 to your computer and use it in GitHub Desktop.
Save mafintosh/cc8e486844bf3d35cae99e626b1d2ef6 to your computer and use it in GitHub Desktop.

Monty Hall

https://en.wikipedia.org/wiki/Monty_Hall_problem

The game

We have a card game with 3 cards. 2 blue cards (B) and 1 red card (R).

The game has two players. A host and a contestent. The host lays out the 3 cards infront of the contenstent, knowing which one is R. The goal is for the contestent to find R. The game two rounds.

  1. In the first round the contestent picks a card among the 3 which they think is R.
  2. In the second round the host will point another card that isn't R and disclose this to the contestent. The contestent now has the option of re-picking a card which they think is R amont the 2 remaining ones.

Playthrough

Here is an example playthrough

The host lays out the cards in the following order (unknown to the contestent ofcourse)

1 2 3
R B B

The contestent picks card number 2 (by random choice). The host then points to 3 and discloses that is B. The contestent now has the option of changing their pick to 1 or stay on 2. They choose to switch to 1 and win the game since it was R.

Strategy

The best strategy in the game is to always change your pick when giving the choice in round 2. This gives you a 2/3 chance of winning the game (!) vs 1/3 if not. Let us look at why.

In the 1st round the contestent looks at 3 random cards.

1 2 3

If they pick 1, there is a 1/3 probability that, that is R. This corresponds to a 2/3 probability that either 2 or 3 is R. as well.

In the 2nd round the host will disclose that either 2 or 3 is B. Since we know from before that there is a 2/3 probability that 2 or 3 is R and now we know which of 2 or 3 is definitely B (the host just told us) this means that there is a 2/3 probability that the card the host did not pick is R.

If we change our pick we therefore up our chances from 1/3 to 2/3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment