Hacker News new | past | comments | ask | show | jobs | submit login

The Monty Hall problem is actually a bit more subtle than this article makes out. The exact wording of the problem can change the answer. For example, in this version

> There are two doors with goats and one with a car. You choose one door from the three. The host selects one of the doors with a goat from the remaining two doors, and opens it. Should you switch doors if given the chance?

has a different answer than this one

> There are two doors with goats and one with a car. You choose one door from the three. The host chooses one of the remaining two doors at random and opens it, showing a goat. Should you switch doors if given the chance?

In the first example the hosts choice is either forced (if you chose a goat initially) or doesn't make a difference (if you chose a car).

In the second example, the host could have opened a door with a car because he was choosing the doors at random. Given that he didn't, your estimate of the probability that you have chosen the car should increase - in fact, it should increase to 1/2, and switching doesn't make any difference.

To me, this is the really interesting thing about the Monty Hall problem - the knowledge and intentions of the host are important in the correct solution to the problem! So there are two ways to come up with the answer "it doesn't matter if you switch" -

1. You understand the problem in the first sense above, and your intuition leads you to an incorrect answer.

2. You understand the problem in the second sense above, and you are correct that it doesn't matter whether you switch or not.




This is exactly right. It drives me nuts that most explanations gloss over this.

If you're a mathematician you don't tend to introduce any additional assumptions unless they are stated. Assuming the host has knowledge of what is behind all of the doors (or at least where the car is) changes everything. Some wordings of the question include it, others don't.

Of course a non-mathematician might assume things about the game show host based on their knowledge of game show hosts but a mathematician is entirely correct to simply take the question at face value and not inject additional unstated assumptions. Otherwise what is preventing them from putting in other completely wacky assumptions like "the host wants you to win the car and knows you know about the monty hall problem and is using reverse psychology"?


And then there's this version

> There are two doors with goats and one with a car. You choose one door from the three. The host may select one of the doors with a goat from the remaining two doors, and open it. Should you switch doors if given the chance?

Now the probability can be anything from 0 to 1, depending on what makes the host tick...

Considering the usual ambiguity in the problem formulation, the only safe reply is "It depends".


It's definitely fascinating! Though I feel like attributing this to the intentions of the host is misleading, because it implies something mystical or quantum might be going on. It's more straightforward to just say it depends on the actions of the host.

Specifically, the host in the first formulation never reveals a car, even if she wants to. The host in the second formulation reveals a car roughly 1/3 of the time, even if she'd rather not. Thus, intuitively, it makes sense that the former leaks information about the place of the car, and the latter doesn't. [0]

Of course that's just a rewording of your point, based on my sense that "knowledge and intentions" are concepts that apply readily to game show hosts, but awkwardly to rule-following systems in general.

[0] To the extent that revealing something can not leak information about it...

Edit: To elucidate my quibble further, as a third formulation: "The host chooses one of the two remaining doors at random, which, by coincidence, is always a goat." I assert we should always switch: The intention of the host is the same as in the second case, but the behavior of the system, magically known to us, is that of the first. We make decisions based on that.


Lots of quantum things are surely going on...

But really, it has to do with the information content of the actions of the host.


Just speaking for me, I'm not confident there's a "really" about this, so I'm not too concerned with finding it. I'm just trying to find the easiest way for our co-commenters to understand why the correct answer is, in fact, correct :)


Right. My point was just that the actions of the host, as far as we observe, can be the same in both cases.


Sure, I see what you're saying. In a technical sense the information in the host's head does "matter". My comment is more along the lines that "information content in a system" is a sufficiently abstracted idea from "knowledge of a human being" that, especially if you equivocate them, it's not a useful metaphor for someone who doesn't already get why the right answer is right.


Yeah, it's not even strictly "does Monty know?" It's whether his action embodied that knowledge or not. Obviously (I hope) Monty knowing but still picking based on a coin flip is the same as Monty not knowing.


Which would explain why Erdos might be confounded by the answer. He was an expert at numbers, not psychology.

Proofs are built with an adversarial mind set. Always assuming the worst possible case and proving that a theorem holds in all conditions. The "hand of god" (or in this case the game show host) doesn't move to make theorems easier to prove. That isn't the universe works!


Hmm.. I don't think there's a difference. In two out of three cases, one of the remaining two doors contains a car. If the host opens the one that does, ok, bummer, you lost. But if not, there's a good chance that the other door contains a car. Remember that you always had only one in three chances of choosing the right door, this doesn't change.


There is a difference. Write a simulation in your favorite language. You'll be forced to decide whether the door with the car ever gets revealed to the contestant. In those cases does the contestant get to switch and win the car? Or did you just throw those cases out in your code? If so, you made an assumption that isn't aways stated clearly in the problem.


But your question was if the host chooses a door at random and reveals a goat. Which means it doesn't matter if he had knowledge or not. You told us the outcome. If you were writing a computer simulation there would be no rgn for the host picking his door. The host would always open the door with the goat, same as if he knew since you already told us he opens the door with the goat.


See my cousin comment[0] about this, I think you're getting tripped up with the idea of the host's "knowledge" mattering. That's a distraction here, what's important is the probabilities.

Two game shows, two hosts, both reveal a goat. The random host revealed a goat with 1/3 probability; the canonical host revealed a goat with 1 probability.

We know that both hosts revealed a goat. We also know (for the purposes of this problem) that they had different likelihoods of doing so before the fact.

Does it make intuitive sense to you that the prior probability of an event could affect how you react to it? That's all that's going on here.

[0] https://news.ycombinator.com/edit?id=8664771


The premises of the riddle in both cases is that the host reveals a goat. There is no randomness. The fact that there was a chance the host might show a car doesn't matter. He showed a goat. The probability of the host showing a goat in both cases is 1.

I understand the math. I know what the op was trying to say. But they worded it wrong. The 2nd riddle is the same as the first.


There are two separate things here. First, the premise of the riddle. Second, the procedure of the game show (as fictionalized within the riddle).

If "... and shows you a goat" is a part of the procedure of the game show, there is additional information imparted by the host's selection compared to the situation where "... and shows you a goat" is an artifact of the particular play through the game that is being described in the riddle and the procedure by which that situation was arrived at did not incorporate knowledge of where the car was.


The question is phrased ad-hoc. We know the host picked a goat in both scenarios. Decision time. Do we switch or no? It didn't ask: "On an infinite timeline where the host might not always pick the goat, should we switch and if so when?" Which I think is what op was trying to say.


It matters why the host picked the goat. (Or, more precisely, what the odds were of him doing otherwise when he picked). That we're looking at a goat doesn't tell us everything.

Again, write the simulation. Either the switch strategy will win 2/3 of the time or 1/2 of the time, depending on how you write Monty. Only one of those approaches matches the results we saw IRL - Monty never revealed the car (so far as I'm aware) - but either is consistent with many phrasings of the question, and OP correctly specified the other case above.


you keep telling me to write a simulation. It won't matter. the code is the same for both questions since they are asking the same thing.


That's not true, but we'll pick it up under the code jayvanguard supplied.


No. Even in the case of a single trial, it matters.

If the host picks randomly, and the host picks a goat, and you switch, your odds of a car are 1/3, just as if you'd stuck. There's no point.

If the host always chooses a goat, and the host picks a goat, and you switch, your odds are 2/3 in favor of now having a car. You should always switch.

Intuition suggests this. Statistics proves it. If you implement this in software, you will see it happening to you in black and white, right before your eyes.


"If the host picks randomly, and the host picks a goat, and you switch, your odds of a car are 1/3, just as if you'd stuck. There's no point."

1/2, once you see the goat. One of 1/3, 2/3, and 1/2 beforehand, depending on what happens when Monty shows a car: whether you automatically win, automatically lose, or start over from the top, respectively.


Right, to be clear, that's your total chance of walking away from the show with a car. Switching doesn't change it.


Right.


> The probability of the host showing a goat in both cases is 1.

Are you familiar with the concept of prior probability? The premise of the meta-riddle is that both hosts showed a goat, but one host could have not shown a goat. So there must be a difference in the information conveyed by that goat.

Again, there isn't anything special about this problem, it's just how probabilities work. Respectfully-- there are a number of different people trying to explain this to you in different ways, and you can verify it on Wikipedia. Are you positive you do understand the math?


He does in this single instance, but in order to calculate the probably you need to consider all the possible cases. Does the case where opens the door with the car calculate in? Why or why not? Seriously, write the simulation to calculate the probabilities. It makes the assumptions very obvious.


You don't need to because you're asking what is the probability of winning by switching once the goat has been revealed. We want to know:

(# of possible worlds in which we win after switching) / (all possible worlds in which we are shown a goat after the initial pick)

vs

(# of possible worlds in which we win without switching) / (all possible worlds in which we are shown a goat after the initial pick)

in this case 2/3 vs 1/3. We are only considering the cases where a goat has been shown so what happens when a goat isn't shown or what the host's intentions are when a goat is show is irrelevant.


But 1 in 3 times the host opens a door with a car. That changes the probabilities. Or are you assuming this never happens? Why?


Let's suppose we are doing a computer simulation.

1. We simulate a million trials where the contestant chooses one of three door, one of which has a car and two a goat

2. We simulate the host randomly choosing one of the remaining doors to open.

3. We discard all trials that resulted in a car. We are left with the number of trials that resulted in a goat and store that number in a variable 'total'

4. In the remaining trails we switch and reveal what was behind the door. We store the number of times we saw a car in a variable called 'wins'.

5. The probability of winning after switching is 'wins' / 'total'

It doesn't matter how many times the host shows a car because those trials are discarded.


Did you actually write that simulation? Because once up on a time (many years ago) I followed the same line of reasoning, wrote a simulation to show that I was right, and that simulation showed me I was wrong.

If the host picks randomly and you discard rounds with a car, your odds switching are 50/50. If the host uses knowledge of where the car is to definitely reveal a goat, your odds switching are better.


@dllthomas

I've written the simulation, and you're right. It is 50% when the host chooses randomly!


You told us he opens the door with the goat. All cases consist of the host opening the door with a goat after you have picked.


But it matters whether you have the guarantee or not.

If the host picked at random and happened to get a goat, it is 1/2 vs 1/2. If the host picked a door he knew had a goat, it's 2/3 vs 1/3.

Again, write the simulation. It shouldn't take you 5 minutes.


You do have a guarantee. The premises of #2 above is that the host shows a goat.


Yes, _this time_. But how on earth are you evaluating probabilities without considering all the priors and/or doing multiple trials? Is this some new kind of mathematics you've invented?

The hidden assumption is that the odds that he opens a door containing a car is zero. That is what changes the odds in the second step. Without that they don't change.

Seriously. Write the simulation.


Read your second question again. It says that the host shows a goat. Then asks if you would switch. Yes, you would switch.

I understand what you were trying to ask but you worded the second question wrong. You can't tell the listener that the host picks a goat. That defeats the purpose of the "randomness" which is meaningless since we know the host picks a door with a goat.


I found this on the internet and modified it so you can just change the commented out options to run it under the different scenarios.

  car = wins = 0
  many = 100000
  actual = 0

  many.times do
    choice1 = rand(3)
    car = rand(3)
    #host_opts = [0, 1, 2] - [choice1, car]  # host knows what is behind
    host_opts = [0, 1, 2] - [choice1]  # host doesn't know what is behind
    #choice2 = [choice1]  # don't switch
    choice2 = [0, 1, 2] - [choice1, host_opts.first]  # switch
    if host_opts.first == car then
        # Discard? Automatic win? It doesn't actually matter!
        # It only changes the denominator.
    else 
        # According to the puzzle, it is decision time!
        wins += 1 if choice2.first == car 
        actual += 1
    end
  end
puts "#{(wins * 100) / actual}%"


I believe it doesn't change the result, but this is technically Monty always picking "the lower (leftmost?) door you didn't pick" not "a random door you didn't pick", right?

Also, "it only changes the denominator" may be misleading, as it does not change the only denominator actually visible in the code. It changes the total numbers of wins and losses, but not the total numbers of wins and losses given that you saw a goat.


Re: first pick, right it doesn't affect things, but here is the code anyways using Ruby Array.sample().

  open_door = host_opts.sample
  choice2 = [0, 1, 2] - [choice1, open_door]  # switch
  if open_door == car then
As for the denominator, good point.


> if host_opts.first == car then

That is false 100% of the time given the parameters that the outcome of the host's choice is a goat (as the question states)


Yes, and we don't bump the wins or the number of tries for that case. The question is your odds if you switch in the other branch of the if, and that's what we are calculating.

Edited to add:

I think there may be a different misunderstanding here...

Set aside, for the moment, whether the above implements the originally posed question or the variant. Imagine a gameshow that runs the above code, but the switch/stay code is moved below the "decision time!" line and the decision is made based on a prompt rather than hard coded. When you hit that prompt, "Monty" has already picked his door, and we've checked that it's not a car.

Do you expect your chance to win, on answering "switch" at that prompt, to depend on which line above is commented out?


WRITE THE SIMULATION


No doubt. See seriuslyguys post above. He did it and now agrees.


You didn't write the simulation.


On top of this, if you're at all unsure about the wording, you can apply the meta-solution that it's best to switch, because the chance of it giving you the car is always at least 1/2 and has a non-zero probability of being 2/3. That gives an expected cross-universe probability of more than 1/2.


This is true but it isn't really a mathematical question then with a single correct answer.

If I was in a culture where gameshow hosts behaved differently the question would have different priors and a different answer.

What if all gameshow hosts shot contestants immediately after they won? Would you be better of switching? No, you'd be dead, so you didn't "win" the car. Completely silly example but it shows why this can't be taken seriously as a mathematical question with probabilities without injecting additional assumptions (unless of course it is stated clearly but then I bet few mathematicians would get tripped up).


My favorite overview of this is a New York Times article that asked Monty Hall himself about the problem [1]. I think I first saw it linked from from his biographical page on Wikipedia.

[1] http://www.nytimes.com/1991/07/21/us/behind-monty-hall-s-doo...


My understanding is that in both situations as you described above you should switch. You are still in a new conditional state. Telling you that the host opened another door by chance and it is a goat removes the possibility that he opened the door with the car behind it by chance. You have eliminated one of the options and you have the 2/3 chance of winning by switching.


No. In the first case, the fact that the host shows you a goat has not put you in any new state of the world (the host was going to show you a goat regardless of what happened).

In the second case, you now know that you are not in one of the states of the world where the host accidentally opened a door that had a car behind it. They could have opened a door with a car, but they didn't. That gives you some information - it stands to reason that since they didn't open a door with a car, it was probably a bit more likely that they would pick a door with a goat, which makes it more likely that there are two goats than that there is one car and one goat, which is equivalent to saying that it's a bit more likely that you have already chosen the car.


Okay, yes. Had to work it out on paper to convince myself that is works out to 1/2 in the second case. Thank you.


Wow. As many others here, i was sure there wouldn't be a difference if Monty picked at random AND we ignored the cases where he picks the door with the car. But after reading "write the damn simulation!" too many times, i wrote one, being sure it would prove me right.

Of course, i was wrong :D

The simulation testing the four possible scenarios:

  #!/usr/bin/env ruby
  
  def run_games(monty_knows:, change_choice:)
    options = [:goat1, :goat2, :car]
    total_games = 0
    wins = 0
  
    100000.times do
      choice = options.sample
      monty_choice = (options - [choice, (:car if monty_knows)]).sample
  
      # Don't consider cases where Monty shows a car.
      next if monty_choice == :car
  
      if change_choice
        choice = (options - [monty_choice, choice]).first
      end
  
      total_games += 1
      wins += 1 if choice == :car
    end
  
    wins / total_games.to_f
  end
  
  puts 'Monty knows & keep choice: %.2f' %
         run_games(monty_knows: true, change_choice: false)
  puts 'Monty knows & change choice: %.2f' %
         run_games(monty_knows: true, change_choice: true)
  puts 'Monty ignores & keep choice: %.2f' %
         run_games(monty_knows: false, change_choice: false)
  puts 'Monty ignores & change choice: %.2f' %
         run_games(monty_knows: false, change_choice: true)
Sample output:

  Monty knows & keep choice: 0.33
  Monty knows & change choice: 0.67
  Monty ignores & keep choice: 0.50
  Monty ignores & change choice: 0.50
So, in the case of Monty picking at random, even if we ignore the cases where he picks the car, your chances of winning do not improve by changing your first choice or not.

After verifying that the simulation makes sense, i tried to figure out why it makes sense.

In an information theory kinda way, it makes sense that if Monty picks at random then he is not providing any new information: you are just being shown what was behind a random door you didn't choose and you can't choose now. But that explanation is not intuitive to my brain.

I found it more intuitive to actually draw a decision tree with the possibilities and their probabilities. The tree is actually very simple:

With the Always Change Door strategy:

               car (1/3) -> LOSE (Monty always reveals goat,
              /                   we change and we always lose)
  first choice
              \                            goat (1/2) -> WIN (we change to the
               \                          /                   car door)
                goat (2/3) -> Monty choice
                                          \
                                           car (1/2) -> IGNORE
The probability of winning is 1/3 (2/3 * 1/2).

With the Always Keep Door strategy:

               car (1/3) -> WIN (doesn't matter what Monty chooses)
              /
  first choice
              \                            goat (1/2) -> LOSE (we keep our
               \                          /                    goat-hiding door)
                goat (2/3) -> Monty choice
                                          \
                                           car (1/2) -> IGNORE 
Same tree, but with win and lose cases inverted. The probability of winning is also 1/3.

In conclusion, my intuition sucks. Thanks for showing me so!


Kudos for having enough doubt that your intuition was correct to actually write the simulation!

Self-doubt is a quantity often found wanting among smart people, computer programmers, and especially among the intersection ;)


Nice write-up.


[deleted]


No, he didn't. See the article linked in my other comment. He had many more options, including opening the contestant's door, offering money if the contestant abandoned the door, offering money to switch, etc.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: