Question

In: Computer Science

Part 2. Monty Hall problem: Given below is the description of the problem. Suppose you're on...

Part 2. Monty Hall problem:

Given below is the description of the problem.

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. The car and the goats were placed randomly behind the doors before the show.

The rules are:

After you have chosen a door, the door remains closed for the time being. The game show host, Monty Hall, who knows what is behind the doors, now has to open one of the two remaining doors, and the door he opens must have a goat behind it. If both remaining doors have goats behind them, he chooses one randomly.

After Monty opens a door with a goat, he will ask you to decide whether you want to stay with your first choice or to switch to the last remaining door. Imagine that you chose Door 1 and the host opens Door 3, which has a goat. He then asks you "Do you want to switch to Door Number 2?" Is it to your advantage to change your choice?

NOTES:

  1. The player may initially choose any of the three doors (not just Door 1).
  2. The host opens a different door revealing a goat (not necessarily Door 3).
  3. The host gives the player a second choice between the two remaining unopened doors.
  • Write Python code to solve the Monty Hall problem. Simulate at least a thousand games using three doors for each strategy and show the results in such a way as to make it easy to compare the effects of each strategy.

Solutions

Expert Solution

Using Bayes’ Theorem to Solve the Monty Hall Problem

Credit goes to Christopher Long for this interesting solution. I’m going to assume that you are familiar with Bayes’ Theorem, which is a way to figure out conditional probability (if event A happens, what’s the probability event B will happen?).

The basis for the solution is the same as in the above scenario. There are three doors, one has the car behind it. You pick a door, then Monty opens one of the other doors to reveal a goat.

Let’s assume you pick door 1 and then Monty shows you the goat behind door 2. In order to use Bayes’ Theorem we need to first assign an event to A and B.

  • Let event A be that the car is behind door number 1.
  • Let event B be that Monty opens up door 2 to show the goat.

Here’s the Bayes’ solution

:


Pr(A) is pretty simple to figure out. There is a 1/3 chance that the car is behind door 1. There are two doors left, and each has a 1/2 chance of being chosen — which gives us Pr(B|A), or the probability of event B, given A.
Pr(B), in the denominator, is a little trickier to figure out. Consider that:

  1. You choose door 1. Monty shows you a goat behind door 2.
  2. If the car is behind door 1, Monty will not choose it. He’ll open door 2 and show a goat 1/2 of the time.
  3. If the car is behind door 2, Monty will always open door 3, as he never reveals the car.
  4. If the car is behind door 3, Monty will open door 2 100% of the time.

As Monty has opened door 2, you know the car is either behind door 1 (your choice) or door 3. The probability of the car being behind door 1 is 1/3. This means that the probability of the car being behind door 3 is 1 – (1/3) = 2/3. And that is why you switch.


Related Solutions

(Monty Hall problem) Suppose you’re on a game show, and you’re given the choice of three...
(Monty Hall problem) Suppose you’re on a game show, and you’re given the choice of three doors, say Door 1, Door 2, and Door 3. Behind one door there is a car; behind the others, goats. Assume it is equally likely that the car is behind any door, i.e., P(D1) = P(D2) = P(D3). You will win whatever is behind the door you choose. (a) If you pick Door 1, what is your probability of winning the car? [2 point]...
2. (Monty Hall) Suppose you are on a game show and are presented with three closed...
2. (Monty Hall) Suppose you are on a game show and are presented with three closed doors marked door 1, 2, and 3. Behind one door is a prize and behind the other two are goats. Suppose the host allows you to select one door, but the following two rules apply: • Before it is opened the host opens one of the two unselected doors that has a goat behind it. • The host then allows you to switch your...
(a) In the Monty Hall problem with 100 doors, you pick one and Monty opens 98...
(a) In the Monty Hall problem with 100 doors, you pick one and Monty opens 98 other doors with goats. What is the probability of winning (assuming you would rather have a car than a goat) if you switch to the remaining door? Explain your answer. (b) Suppose Monte opens 98 doors without checking for cars. What is the probability that, once the doors are open, changing your choice will not change your chances of winning.
The Monty Hall problem solved on Matlab. Please show code. You are given a choice between...
The Monty Hall problem solved on Matlab. Please show code. You are given a choice between three doors. Behind one door is a new car and behind the other two doors is a goat. You first pick one of the doors at random. Then, a door with a goat is opened for you. You are then given the option to switch your door to the other unopened door. Should you do this? What are your odds of winning if you...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are 8 boxes, of which 1 box contains the prize and the other 7 boxes are empty. You select one box at first. Monty, who knows where the prize is, then opens 6 of the remaining 7 boxes, all of which are shown to be empty. If Monty has a choice of which boxes to open (i.e. if the prize is in the box you...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are...
1. (a) Consider a modified version of the Monty Hall problem. In this version, there are 8 boxes, of which 1 box contains the prize and the other 7 boxes are empty. You select one box at first. Monty, who knows where the prize is, then opens 6 of the remaining 7 boxes, all of which are shown to be empty. If Monty has a choice of which boxes to open (i.e. if the prize is in the box you...
Monty hall Problem Explain the statistical probabilities associated with the game show
Monty hall Problem Explain the statistical probabilities associated with the game show
The Monty Hall problem is a famous problem loosely based on the game show Let's Make...
The Monty Hall problem is a famous problem loosely based on the game show Let's Make a Deal. You are a contestant on the game show. There are 3 doors in front of you. Behind one door is a prize, and behind the other two doors are goats. Assume the door with the prize is picked uniformly at random from the three doors. First, you pick a door. Then, Monty Hall will open one of the other two doors that...
Recall the Monty Hall problem as presented in class. There are three caves, two of which...
Recall the Monty Hall problem as presented in class. There are three caves, two of which contain dragons and one of which is a hiding princess. The prince chooses a cave and a wizard (truthfully) reveals to the prince that one of the other caves has a dragon. 2 The prince now has the option to switch to the other cave (the one he didn’t choose and wasn’t revealed to have a dragon), and try his luck finding the princess...
Recall the Monty Hall problem as presented in class. There are three caves, two of which...
Recall the Monty Hall problem as presented in class. There are three caves, two of which contain dragons and one of which is a hiding princess. The prince chooses a cave and a wizard (truthfully) reveals to the prince that one of the other caves has a dragon. 2 The prince now has the option to switch to the other cave (the one he didn’t choose and wasn’t revealed to have a dragon), and try his luck finding the princess...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT