Monty Hall Problem in the Multiple Chamber / Door

Bagus Kharismawan
5 min readAug 18, 2022

--

Suppose you’re on a game show and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say no.1, and the host, who knows what’s behind the doors, opens another door, say no.3, which has a goat. He then says to you, “Do you want to pick door no.2?” Is it to your advantage to switch your choice? — Craig F. Whitaker’s letter quoted in “Ask Marilyn” column in Parade magazine

Introduction

It’s been many years since I first getting introduced of this problem and the answer itself is always still fascinating for me. Yes, maybe some of you are already know the answer for this problem showing that we can increase our chance to win the car to 2/3 by switching our choice to another door (James May even proved it by doing it manually in a show that I forgot). However, Is the magic still existing even when the number of doors increased?

Suppose the number of doors on the game show now is increased to 10, with the same algorithm rule and additional necessary clause below;

(1) The host must always open doors that was not picked by the contestant [until there is one door left. — new]
(2) The host must always open a door which reveal a goat and never the car.
(3) The host must always offer the chance to switch between the originally chosen door and the remaining closed door.

Would the chance of winning car by switching our choice would increase to 9/10? Or is it still the same as previously ‘3 doors’ condition (2/3)?

We will try to tested it by making a simulator on Python that allow us to create more than three doors to see the results.

Brief Solution for Three Chambers Problem

Brief explanation for Monthy Hall’s Solution

When I first heard the problem, like the majority of people I tend to believe that the probability of winning the car whether choosing between staying or leaving the previous chosen door is same (0.5 for each door), which is… unfortunately not right. When you choose a door between three of them on the first move, the probability of winning the car is still uniform (1/3). But somehow AFTER you done doing that first move, then the chances between the doors now is not equally distributed; probability of car is behind the 1st door that you choose is still 1/3, while the probability of car is behind the remaining door that you’re not choose is now 2/3.

When the host is opens a door that contains goat, the statistical probability of that opened door would be reduced to 0. When this happened, rather than the winning chance is properly distributed to the remaining door (fifty-fifty) The 1/3 chances of the already opened door is now transferred to unopened door that not chosen by us on first pick. Leaving the remain unchosen door to 2/3 chance of winning. Maybe you can see the bigger understanding on this probability table:

Probability Table by choosing to stay at door vs switching

Simulator on Python (for more than three doors)

For answering whether the probability of winning the car is still 2/3 or (n-1/n) when we always choose to switch the door whether there is total n door, let’s make a simple simulation using python console.

For this simulation we can use the simple random libraries to run the thing (don’t need numPy at all since we can easily do this on form of list). I use two-layer list in order to make it feels like real simulation, one layer is supposed to replicate game participant’s perspective that cannot see behind the door (front_door), and the other is from ‘behind the scene’ perspective that can be seen by host (behind_door). The number of chambers can be inputted manually and we put the car on 1st door (don’t worry it would be shuffled anyway on each game), Please don’t forget to put the win/lose tracker for each game iteration

front_door = [0] * total_chamber;behind_door = ['goat'] * total_chamber;behind_door[0]='car';win = 0;lose= 0;

After putting the number of numbers of chamber and iteration the car will be shuffled to random door on behind_door layer for each game. On this simulation we will always choose the first door on first move since we agree (and can be proved) that the probability for winning car for this early move is always 1/3 for each door so it does not create any problem at all. After the first move the host will be reveal the ‘not-chosen-by-participant’ doors that always contains the goat until there is one room left. Create a new variable with FALSE in default and will be turn into TRUE in case that the car is ACTUALLY on the first chamber, so the host can leave 1 door left in random after revealing goat(s) in other door to be chose by participant.

for x in range (t):    rand.shuffle(behind_door);    winner_on_unpicked=0;    for y in range (1,total_chamber):        if behind_door[y] == 'car':            front_door[y]='tochoose';            winner_on_unpicked = 1;        else:            front_door[y] = 'openlose'    print('Game {}:'.format(t));    print(behind_door);    print(front_door);    if winner_on_unpicked==0:        front_door[rand.randint(1,total_chamber-1)]='tochoose';

Finally, we will compare the win ratio when we switching the door versus when staying on the same door.

if behind_door[final_pick]=='car':    print('you win!!');    win=win+1;    print(win);    print("\n");else:    print('you lose!!');    lose = lose + 1;    print(lose);    print("\n");

Result

After numbers of trial, for simulation in any amounts of doors (n) and inputting any high number of iterations, actually we will consistently get around (n-1/n) winning ratio compared with insisting the bet for staying on the same door (1/n).

In conclusion, whatever the number of doors as long as more than three doors, we can improve the chance to win the car just by to switch our choice. If we spend some time thinking about the rule of this game (three rules mentioned on earlier paragraph), actually the combination of these rules can be refactored into one simple question: “Suppose you’re given the opportunity to win a car by choosing one of three doors on a game show, would you choose the only one door that you will pick, or all the rest of unpicked doors?”

Nevertheless, it understandable if it’s difficult for people to implement cause there is psychological mechanism on this Monty Hall Problem called cognitive illusion, that often used to demonstrate people’s resistance and deficiency in dealing with uncertainty in decision-making problems.

Code: (here)

--

--

Responses (2)