Monty hall problem extended.

64.8k Views Asked by At

I just learned about the Monty Hall problem and found it quite amazing. So I thought about extending the problem a bit to understand more about it.


In this modification of the Monty Hall Problem, instead of three doors, we have four (or maybe $n$) doors, one with a car and the other three (or $n-1$) with a goat each (I want the car).

We need to choose any one of the doors. After we have chosen the door, Monty deliberately reveals one of the doors that has a goat and asks us if we wish to change our choice.

So should we switch the door we have chosen, or does it not matter if we switch or stay with our choice?

It would be even better if we knew the probability of winning upon switching given that Monty opens $k$ doors.

14

There are 14 best solutions below

4
On BEST ANSWER

I decided to make an answer out of my comment, just for the heck of it.


$n$ doors, $k$ revealed

Suppose we have $n$ doors, with a car behind $1$ of them. The probability of choosing the door with the car behind it on your first pick, is $\frac{1}{n}$.

Monty then opens $k$ doors, where $0\leq k\leq n-2$ (he has to leave your original door and at least one other door closed).

The probability of picking the car if you choose a different door, is the chance of not having picked the car in the first place, which is $\frac{n-1}{n}$, times the probability of picking it now, which is $\frac{1}{n-k-1}$. This gives us a total probability of $$ \frac{n-1}{n}\cdot \frac{1}{n-k-1} = \frac{1}{n} \cdot \frac{n-1}{n-k-1} \geq \frac{1}{n} $$

No doors revealed
If Monty opens no doors, $k = 0$ and that reduces to $\frac{1}{n}$, which means your odds remain the same.

At least one door revealed
For all $k > 0$, $\frac{n-1}{n-k-1} > 1$ and so the probabilty of picking the car on your second guess is greater than $\frac{1}{n}$.

Maximum number of doors revealed
If $k$ is at its maximum value of $n-2$, the probability of picking a car after switching becomes $$\frac{1}{n}\cdot \frac{n-1}{n-(n-2)-1} = \frac{1}{n}\cdot \frac{n-1}{1} = \frac{n-1}{n}$$ For $n=3$, this is the solution to the original Monty Hall problem.

Switch.

1
On

You should switch. By picking one of the doors first, the probability of getting a car is 1/4. Once Monty opens one door with the goat, the probability that the car is in one of the other 2 remaining doors is 1/2 * 3/4 = 3/8 > 1/4. So you should switch. The wikipedia article http://en.wikipedia.org/wiki/Monty_Hall_problem is a good read by the way.

6
On

By not switching, you win a car if and only if you chose correctly initially. This happens with probability $\frac{1}{4}$. If you switch, you win a car if and only if you chose incorrectly initially, and then of the remaining two doors, you choose correctly. This happens with probability $\frac{3}{4}\times\frac{1}{2}=\frac{3}{8}$. So if you choose to switch, you are more likely to win a car than if you do not switch.

You never told me whether you'd prefer to win a car or a goat though, so I can't tell you what to do.

xkcd #1282

6
On

Let's reason in the case of $n$ windows and just $1$ car.

When Monty gives you the opportunity to modify your initial choice, it is definitely better to take it. Here's a way to see it:

The probability of finding the car with the first choice is just $\frac{1}{n}$, and this is the same probability that you have of winning if you keep your initial choice.

Of course you will win by changing your choice if the intersection of two events will happen:

  1. You didn't choose the car with the first choice ( $P(A) = \frac{n-1}{n}$ )

  2. You are lucky and you find the car with your second choice ( $P(B\mid A) = \frac{1}{n-2}$ )

So the probability of winning by changing your mind is the product $$ P(A\cap B) = P(A)\cdot P( B\mid A ) = \frac{n-1}{n}\cdot \frac{1}{n-2} = \frac{n-1}{n(n-2)} > \frac{1}{n} $$ Since $ \frac{n-1}{n-2} \to 1 $ when $n\to \infty$, we notice that Monty's help is not that useful in the case of many many windows.

0
On

Increasing the number of doors is a common extension of the problem, and is analytically useful for giving people an intuition about why switching is optimal. This is not, strictly speaking, the situation you're describing (since your question is about adding a single door and Monty still only opening one door), but it's a similar case.

Consider a Monty Hall Problem of 100 doors: Let's say you choose one, then Monty opens 98 other doors. Which probability is higher: the probability that you picked the right one from the beginning (1%), or the probability that you didn't and thus the one door that Monty left unopened is the real winner (99%)?

4
On

Here is an example a friend of mine once told me that I think really makes the monty hall problem really clear. Suppose there are one million doors, one with a golden Bugatti and the rest with an assortment of goats from all parts of the world.

At first you chose a random door. Then Monty opens all the other doors except for the one you have and one other. Then even your intuition tells you you should change the door.(this is different from the one you asked, but it's a great border-case example that is really intuitive).

0
On

The paradox changes only slightly when you increase the number of doors. The three-door model is most popular because it's the simplest statement of the problem (and the one normally seen on "Let's Make A Deal").

Basically, the reasoning behind the MHP is that, with $N$ doors, your original choice has a $\dfrac{1}{N}$ chance of being the car, which is relatively small. That means the chance that the car is elsewhere is $\dfrac{N-1}{N}$ (or $1 - \dfrac{1}{N}$, same thing). By opening one of these doors to reveal a goat, you don't change the math in the way you expect; the chance that you didn't pick the car (and thus it's behind another unopened door) is still N-1/N, but now that probability is evenly distributed between N-2 unopened doors, so the chance of any one unopened, unchosen door having the car is $\dfrac{N-1}{N(N-2)}$, which will be greater than $\dfrac{1}{N}$ for all $N > 2$.

So, with four doors, the probability that your original pick was correct is .25 ($1/4$), meaning the probability that you didn't pick the car (and that it's behind one of the three other doors) is .75 ($3/4$). Open a door to reveal a goat, and now, there is that same 75% chance that the car is behind either of the two remaining unchosen doors, so switching to either of them gives you a 37.5% chance of choosing correctly ($3/(4(2)) = 3/8$), while staying with your original choice gives you only the same 25% chance.

As you can see, the advantage (the percentage increase in probability of winning) starts shrinking pretty quickly; in the 3-door scenario, switching from your original choice gives you double the probability of winning, but with 4 doors the advantage is only 50% (.375/.25). With five doors, the winning probability of not switching is .2 while the winning probability of choosing any other unopened door is 4/15 = .2666, for a 33% advantage. With 6 doors, you have a 16.6% chance of guessing correctly on the first try and a 20.8% chance of winning if you switch, for a 25% advantage. We can project from this that the advantage of switching versus staying is $\dfrac{1}{N-2}$ for any $N>2$.

1
On

Another way to explain it based on your "gut feeling".

Although this is the "psychological" way of viewing it (so no hard proof like already given above).

Imagine there were 100 doors, one prize is behind one of the doors. Now pick one door. Monty knows behind which of the doors the prize is and now opens all doors except two: your door and another one. Now you get the option to switch, your original door or the one door left closed... You see where I am going?

If you picked, say, door 15. Then all doors go open except 15 and e.g. 63. Doesn't that make 63 really suspicious for containing the prize, whereas your door remained closed only because you picked it initially?

I think this is a beautiful way to "explain" this problem without getting into the math too much. This way, you can convince people of the better option: switch, because you're getting better information. If you then explain the math behind it, then it will become an easy problem!

0
On

Last time I came across a Monty Hall question I wrote my own tester in Java. Here it is - with the number of doors set to 4:

public class MontyHall {

    // How many doors.
    static final int Doors = 4;

    // Prizes.
    enum Prize {

        Goat,
        Car;
    }

    public static void main(String[] args) throws InterruptedException {
        // The number of times we would have won if we switched.
        int winWhenSwitched = 0;
        // The number of times we would have won if we didn't switch.
        int winWhenNotSwitched = 0;
        // The number of times we would have lost both ways.
        int lost = 0;

        // n doors.
        Prize doors[] = new Prize[Doors];
        // N Tests
        for (int i = 0; i < 100000; i++) {
            // Put a car behind just one door.
            pickRandomDoorForCar(doors);
            // Make my first choice.
            int firstChoice = randomDoor();
            // Open one remaining goat door. 
            int goatDoorOpened = openOneGoatDoor(doors, firstChoice);
            // What would have been my second choice - if I switched?
            int secondChoice = makeSecondChoice(doors, firstChoice, goatDoorOpened);
            // Count wins/losses.
            if (doors[firstChoice] == Prize.Car) {
                // We would have won without switching!
                winWhenNotSwitched += 1;
            } else {
                // We win if we switched to the car!
                if (doors[secondChoice] == Prize.Car) {
                    // We picked right!
                    winWhenSwitched += 1;
                } else {
                    // Bad choice.
                    lost += 1;
                }
            }
        }
        System.out.println("Wins when switched = " + winWhenSwitched);
        System.out.println("Wins when not switched = " + winWhenNotSwitched);
        System.out.println("Lost = " + lost);
        System.out.println("Proportion = " + ((double) winWhenSwitched / (double) winWhenNotSwitched));
    }

    // Open one door exposing a Goat.
    private static int openOneGoatDoor(Prize doors[], int firstChoice) {
        for (int j = 0; j < Doors; j++) {
            // Not the one already picked and must contain goat.
            if (j != firstChoice && doors[j] == Prize.Goat) {
                // Can only be one of them.
                return j;
            }
        }
        // Should never get here - TODO - Throw an exception here.
        return -1;
    }

    // Make a second choice - avoid first choice and opened door.
    private static int makeSecondChoice(Prize[] doors, int firstChoice, int goatDoorOpened) {
        int secondChoice = randomDoor();
        while (secondChoice == firstChoice || secondChoice == goatDoorOpened) {
            // Try again.
            secondChoice = randomDoor();
        }
        return secondChoice;
    }

    // Pick a random door and put a Car there.
    private static void pickRandomDoorForCar(Prize[] doors) {
        // Start all goats.
        Arrays.fill(doors, Prize.Goat);
        // Pick a random for the car.
        doors[randomDoor()] = Prize.Car;
    }
    // Start my random number generator.
    static final Random random = new Random(System.currentTimeMillis());

    // Pick a random door.
    private static int randomDoor() {
        return random.nextInt(Doors);
    }
}

The results print:

Wins when switched = 37483
Wins when not switched = 24888
Proportion = 1.5060671809707489

I hope this is helpful.

0
On

To add a bit to this discussion, there is a good book, "The Monty Hall Problem: The Remarkable Story of Math’s Most Contentious Brain Teaser" by Jason Rosenhouse (published in 2009), which covers all these variants and includes a variety of explanations for understanding them. The book also gives a nice history of the problem. Unfortunately it does not include the xkcd cartoon.

0
On

The correct answer is, the problem isn't defined clearly enough to arrive at the "correct answer." Let's ignore the n doors, and k doors revealed for a moment, because they aren't essential for realizing that we don't know enough information to solve the question.

We need to choose any one of the doors. After we have chosen the door, Monty deliberately reveals one of the doors that has a goat and asks us if we wish to change our choice.

So should we switch the door we have chosen, or does it not matter if we switch or stay with our choice?

One of the problems with this question, is the motivations of the host are unknown. You specifically said that he revealed one of the doors, but not whether:

  • He always reveals a door.

  • He always reveals a losing door.

Without knowing that information, it is impossible to know if you should switch, not switch, or it doesn't matter.

0
On

The Monty Hall problem always confused me. And so, I coded it up in Matlab (2013a) to better understand it. In this version, the number of games played and N, the number of doors per game, are user settable parameters. I found 100,000 games gives relatively stable win/loss distributions for N = 100.

Code:

%Monty Hall problem assuming N doors, and N-2 doors
%opened prior to the final door choice.

clear;clc
rng('shuffle');

%    USER INPUT PARAMETERS
%------------------------------------------------------------
games = 100000;     %number of Monty Hall games (experiments)
N = 100;            %number of doors in each Monty Hall game
%------------------------------------------------------------

always_losses = 0;  %number of losses for always switch strategy
always_wins = 0;    %number of wins for always switch strategy
never_losses = 0;   %number of losses for never switch strategy
never_wins = 0;     %number of wins for never switch strategy

for ii = 1:games

    prize = randi(N);
    initial_choice = randi(N);

    %(N-2 doors opened prior to final choice)
    if initial_choice == prize
        always_losses = always_losses + 1;  %always switch strategy
        never_wins = never_wins + 1;        %never switch strategy
    else
        always_wins = always_wins + 1;      %always switch strategy
        never_losses = never_losses + 1;    %never switch strategy
    end

end

fprintf('\nWin fraction -- never switch:  %4.3f',never_wins/games);
fprintf('\nWin fraction -- always switch:  %4.3f\n\n',always_wins/games);

Results (for games = 100,000 and N = 100):

Win fraction -- never switch:  0.010
Win fraction -- always switch:  0.990

The computational results support Abramo's observation, namely, that Monty's help is not all that useful as the number of doors increases: The probability of winning approaches 1.0 for the "always switch" strategy as the number of doors approaches infinity.

Letting N = 3 reduces to the familiar Monty Hall game, and, produces the correct answer for that case.

0
On

My twist on explaining the Monty Hall problem:-

You pick one door.

Monty, instead of revealing a goat behind one of the other doors, offers you BOTH of them if you switch from your initial choice. Of course you switch, since this will absolutely double your chances.

And of course, at least one of the two doors that you switch to must have a goat, Monty just didn't show it to you. So what if he does or doesn't show it? We all know that it's there.

Choice wise, this is exactly the same as the original problem. The illusion is that you don't get the door that Monty opens. But effectively you do, it's just that you disregard it because it has no value.

0
On

@DwB

Your explanation would work if you chose your door AFTER you were shown a door that had a goat behind it.

Since you make your choice while there are 3 choices, the probability you choose the right door is 1/3 no matter if he shows you a goat or not.

If you choose one of the goats at first, you have a probability of 2/3 of choosing one of those right? So the beauty of this problem is that if you choose a goat first, and switch you will always get the car.

Think about it, if you choose one of the goats first, then the other goat will always get shown. If you switch then you will always switch to the car.

You want to choose a goat first to win this game by SWITCHING.(2/3) You want to choose a car fiRst to win this game by NOT SWITCHING.(1/3)

4 doors...

You choose a car at first(1/4) You choose a goat at first(3/4)

He opens 2 doors with a goat behind them, so your first choice and the last door is left.

If you chose the car first and switched now, you would lose.

If you chose any of the 3 goats initially, and now switched, you would win the car.

It just comes down to the fact you have a better chance of picking one of the goats initially, so assuming he shows all the other "bad choices" to you, it is better to switch your answer you chose originally.

The probabilities you win by switching your choice, assuming that Monty opens all the other doors accept for the original one you picked and one other one.

3 doors (2/3) 4 doors (3/4) 5 doors (4/5) 6 doors (5/6) 7 doors (6/7) 8 doors (7/8)

n doors [(n-1)/n] = 1 - 1/n

as n approaches infinity 1/n becomes 0, and the general probability = 1 - 0 = 1.

So if we were to play this game with an infinite amount of doors, and switch our choice, we would win 100% of the time!