Published on

Game Show Problem

Authors
  • avatar
    Name
    Ryan Talley
    Twitter

Motivation

This problem is well known and has been asked on TV and in movies. It's a simple puzzle designed to trick your intuition, which makes it fun and approachable. And that is exactly why I'm tired of convincing others that the correct answer is in fact correct (since it's such a fun puzzle to talk about). Because only nerds read Wikipedia, this is my attempt at a nice tldr for the interested reader.

Problem

Imagine you're on a game show, and there are three doors. Behind one of the doors is a pile of gold, and behind the other two doors are calculus textbooks. You get to pick one door, and the show will send you home with whatever is behind that door.

So you pick a door, say door 1. The host then opens up door 3, and shows you a used Larson Calculus 15e, market value 2 kidneys. Then the host will ask you, do you want to keep the door you first picked, or switch to the last remaining door, door 2? So, which is the right choice and why?

Answer

Switch to door 2. Great, argument settled. Enjoy your gold.

But Why??

The answer is obvious if you ask the question differently. Instead what if the host asked you, 'are you more likely to pick the right or wrong door?' Now it's easy to see you're right 1/3 of the time and wrong 2/3 of the time. So we should assume we are right about being wrong.

When the host asks if you would like to switch they're asking 'do you think you picked the wrong door?'. We can say with certainty, that we make poor choices 66% of the time, and would like to revise our door choice.

It Should be 50/50!

Ah! You fell for the trap. I understand why you feel this way, but that is a different game you're playing. If instead of first letting you choose, the host just revealed Stewart Calculus 35bce, then there would only be two doors. All of the information has been revealed before your choice and so it is pure and informed. This is a game where the odds are 50/50, because you are equally likely to be right or wrong.

But, if you pick a door before the host reveals a textbook, once the book is revealed the likelihood that you're wrong remains 1/3. So the likelihood that the other door has the gold is 2/3, since you know it's not the revealed door.

Simulations

Of course you don't have to believe me. Let's make a simple program to simulate the game and see what the results are.

Let's start by creating a store of the game show's state. We'll use a class, so that we can wrap the game show's itinerary inside it's methods. Each door will be an unsigned non-zero integer.

class Show:
    doors: bool = [0, 0, 0]
    door_picked = 0   
    door_revealed = 0 
    door_remaining = 0 
    door_switched: bool = 0
    prize_found: bool = 0

    def assign_prize(self):
        prize_door = randrange(3)
        self.doors[prize_door] = 1

Casting is ready and the commercial break is almost over. Lights, camera, action, it's time to pick a door. Any door, 1, 2, or 3.

    def pick_door(self):
        self.door_picked = randint(1, 3)

But was that the right door. Let's see what's behind one of these curtains.

    def reveal_door(self):
        if (self.door_picked == 0):
            raise ValueError("You must pick a door before revealing")
        bad_doors = [1, 2, 3]
        del bad_doors[self.door_picked - 1]
        if self.doors[bad_doors[0] - 1]:
            self.door_revealed  = bad_doors[1]
            self.door_remaining = bad_doors[0]
        else:
            self.door_revealed  = bad_doors[0]
            self.door_remaining = bad_doors[1]

The stage is set and it's time to decide and let fate take the wheel.

    def decide_switch(self):
        switched: bool = randrange(2)
        self.door_switched = switched
        if switched:
            self.door_picked = self.door_remaining

    def open_doors(self):
        self.prize_found = self.doors[self.door_picked - 1]

The results? Exactly as expected. If you switch you win 66% of the time. If you stay you win 33% of the time. Try it yourself.

Conclusion

People hate admitting they're wrong. This is why they stay when they should switch doors.

The code for the simulations can be found here.