That said, I made a simulation of it where it does the following: 1. Assign random locations behind doors, 2. Player randomly chooses door, 3. Host excludes door (random if both are goats, goat if one is a car), 4. Player either switches, or doesn't switch based on what's chosen for that simulation (the full set gets one or the other)
After running 50,000,000 then dividing success/tries, my number is nearly exactly the same between the two. Is my simulation working incorrectly?
Do you switch? Or do you stick with your original guess? As the parent mentioned, switching gives you a 99/100 chance of being correct, staying gives you a mere 1/100 chance.
Keep in mind I made my choice before we started, and it hasn't changed.
Do you want to change your guess to 437, or stick with 2?
The key to this problem is the behavior of the game host as he will never reveal the door with the car. So, after he reveals the contents of one of the doors, if you choose not to switch, you still only have a 1/3 chance of having chosen the door with the car.
On the other hand, if you choose to switch, 2/3 of the time you will have chosen incorrectly initially, and under the switching strategy, those 2/3ds of the time you are guaranteed to win the car. Hence, you have a 2/3ds chance of winning under the switching strategy, vs a 1/3d chance of winning under the "staying" strategy.
Hope this clarifies things.
Look at it this way: 1/3 of the time, you pick the right door up front. If you switch, you lose.
2/3 of the time, you didn't pick the right door. If you switch, you win.
So switch.
The key observation is that the problem states that Monty Hall opens an empty door. It's not clear whether Monty knows which doors are empty, but it doesn't actually matter, since the problem states that he will always open an empty door.
As others have said, your choice as a contestant is whether to take one door (the one you initially pointed at), or to take the other two doors (at least one of which is obviously empty). Stated that way, it's pretty obvious that taking 2 doors is better than taking 1 door.
The location of the prize and the player choice of door are independent events. Monty's choice is dependent on whether the player choice and the prize location are the same. Monty will never open the door the player picked. Monty will never reveal the prize. Those rules generate exploitable information for the player.
Here is the complete probability tree, and two possible strategies of play:
Prize behind door A; P = 1/3 ALWAYS STAY strategy:
Player picks door A; P = 1/3 * 1/3 = 1/9 P(WIN) = 1/18 + 1/18 + 1/18 + 1/18 + 1/18 + 1/18
Monty shows Door B; P = 1/3 * 1/3 * 1/2 = 1/18 = 6/18
Player stays with A; WIN = 1/3
Player switches to C; LOSS P(LOSS) = 1/9 + 1/9 + 1/9 + 1/9 + 1/9 + 1/9
Monty shows Door C; P = 1/3 * 1/3 * 1/2 = 1/18 = 6/9
Player stays with A; WIN = 2/3
Player switches to B; LOSS
Player picks door B; P = 1/3 * 1/3 = 1/9 ALWAYS SWITCH strategy:
Monty shows Door C; P = 1/3 * 1/3 * 1/1 = 1/9 P(WIN) = 1/9 + 1/9 + 1/9 + 1/9 + 1/9 + 1/9
Player stays with B; LOSS = 6/9
Player switches to A; WIN = 2/3
Player picks door C; P = 1/3 * 1/3 = 1/9 P(LOSS) = 1/18 + 1/18 + 1/18 + 1/18 + 1/18 + 1/18
Monty shows Door B; P = 1/3 * 1/3 * 1/1 = 1/9 = 6/18
Player stays with C; LOSS = 1/3
Player switches to A; WIN
Prize behind door B; P = 1/3
Player picks door A; P = 1/3 * 1/3 = 1/9
Monty shows Door C; P = 1/3 * 1/3 * 1/1 = 1/9
Player stays with A; LOSS
Player switches to B; WIN
Player picks door B; P = 1/3 * 1/3 = 1/9
Monty shows Door A; P = 1/3 * 1/3 * 1/2 = 1/18
Player stays with B; WIN
Player switches to C; LOSS
Monty shows Door C; P = 1/3 * 1/3 * 1/2 = 1/18
Player stays with B; WIN
Player switches to A; LOSS
Player picks door C; P = 1/3 * 1/3 = 1/9
Monty shows Door A; P = 1/3 * 1/3 * 1/1 = 1/9
Player stays with C; LOSS
Player switches to B; WIN
Prize behind door C; P = 1/3
Player picks door A; P = 1/3 * 1/3 = 1/9
Monty shows Door B; P = 1/3 * 1/3 * 1/1 = 1/9
Player stays with A; LOSS
Player switches to C; WIN
Player picks door B; P = 1/3 * 1/3 = 1/9
Monty shows Door A; P = 1/3 * 1/3 * 1/1 = 1/9
Player stays with B; LOSS
Player switches to C; WIN
Player picks door C; P = 1/3 * 1/3 = 1/9
Monty shows Door A; P = 1/3 * 1/3 * 1/2 = 1/18
Player stays with C; WIN
Player switches to B; LOSS
Monty shows Door B; P = 1/3 * 1/3 * 1/2 = 1/18
Player stays with C; WIN
Player switches to A; LOSS
If your simulation does not conform with the mathematically derived result, your simulation is incorrect.[1] https://en.wikipedia.org/wiki/Monty_Hall_problem#Simple_solu...
Another useful exercise is to stretch the number of doors to some large N and suppose the choice was posed repeatedly with a decreasing number of doors. If you can have anywhere from 2 to N guesses and as N decreases the number of bad doors decreases, it seems more obvious that you should always switch.
4 doors, in 8ths to simplify fractions.
2/8,2/8,2/8,2/8 => initial conditions, choose leftmost
2/8,3/8,3/8 => random bad door removed, choose a random 3/8
3/8,5/8 => remove another door.
Next choice is only 5/8, whereas if we had waited it would have been 6/8.> That's the common misunderstanding of the problem...
You've got a choice here... you can either interpret "The probabilities change" as meaning the probabilities of a given door being correct at the start (which would be a misunderstanding) or you could interpret it from the pragmatic angle; the probability of success if you switch doors after one is taken away.
Given the context I'm inclined to believe that wrsh07 intended the latter.
P(my first choice was right) = P(my first choice was right | given that I've been shown a goat in another door)
It's my second-favorite probability puzzle; my favorite is the one in which the new information has no relevance at all but still changes the probabilities, the "not both daughters" problem.
Your friend tells you that she has two children. They're not both boys, she adds. What are the odds that they're both girls? (Obviously 1/3).
When she tells you that one child is named Mary, the odds that they're both girls change (to 1/2)! Even though you knew that at least one of the children was a girl, and the name might as well be arbitrary, and the new information seems useless... the odds have changed.
It's nontrivial to work this one out; exercise for the reader.
Presuming A and B to be independent events
(first child is a girl, second child is a girl)
P(A) = 1 - P(!A) = 1/2
P(B) = 1 - P(!B) = 1/2
P(A and B) = P(B|A) * P(A) = 1/2 * 1/2 = 1/4
P(A and !B) = P(!B|A) * P(A) = 1/2 * 1/2 = 1/4
P(!A and B) = P(B|!A) * P(!A) = 1/2 * 1/2 = 1/4
P(!A and !B) = P(!B|!A) * P(!A) = 1/2 * 1/2 = 1/4
Good so far.But the probability later on depends on how you find out that at least one of your friend's children is a girl. If your friend tells you a random fact about her whole family, the probability is 1/3. If she tells you a fact about a randomly chosen child, the probability is 1/2.
You can presume from "they're not both boys" that the statement is equivalent to "there is at least one girl". When she tells you the name, you now know "a specific child of mine is a girl".
"Not both boys" gives you the precondition "!(!A & !B)" which equates to "A or B".
P(A or B) = P(A and B) + P(A and !B) + P(!A and B) = 3/4
P(A and B|A or B) = P(A or B|A and B) * P(A and B) / P(A or B) = 1 * 1/4 / 3/4 = 1/3
"Mary is a girl" gives you either the precondition "A" or the precondition "B" P(A and B|A) = P(A|A and B) * P(A and B) / P(A) = 1 * 1/4 / 1/2 = 1/2
P(A and B|B) = P(B|A and B) * P(A and B) / P(B) = 1 * 1/4 / 1/2 = 1/2
These are both the same number, so that works out fine.Between pregnancies, I had an accident that resulted in an odd medical condition. The doctors said that after it happened, 50% of boy fetuses that otherwise would have resulted in pregnancy would simply fail to implant, and I wouldn't even know about it.
Now there's an all new ambiguity. How do you decide whether your friend was planning on having two children all along, or if she has two children because that's how many times she got pregnant?
Given the number of ways to mishear "Mary" and the dialectical variant in pronunciation characterized by the Mary-marry-merry merger, I'd tentatively assign the following values:
25% One child is a girl. (Heard correctly)
25% One child is a boy. (Heard incorrectly)
50% No new information. (Incomprehensible or ambiguous)
In the first case P(A and B|A) = P(A and B|B) = 1/2
In the second, P(A and B|!A) = P(A and B|!B) = 0
In the third, P(A and B|A or B) = 1/3
In any case, you're just guessing at the probability you might mishear something, so there's no definitive answer. The mere possibility that I might have heard a boy's name means that the overall probability could be anywhere between 0 and 1/2. By the above, my new odds are 5/12.So the odds do change, based on your confidence in what you heard (and your confidence that your friend isn't the kind of parent to name her son "Meriadoc" or something similar).
You could run (ed:a similar game with different rules) such that the odds go 1/3,1/3,1/3 to 1/2, 1/2 if you flipped a coin to chose the second door and sometimes show the prize. Alternatively, if you chose when to open the second door, you could make swapping a very good (100%) or very poor choice (0%).
Worse, you could swap what's behind the doors after they chose.
Which IMO is why people find this so confusing. In the real world the odds presented may or may not line up with the actual odds. aka unknown unknowns.
Flipping a coin to "to chose the second door and sometimes show the prize." has no impact on the probabilities. The parent is correct - there is a 2/3 chance the prize exists under one of the other two doors, and if one of them is shown not to have the prize (through random flipping, deliberate selection, whatever) - then the final door now has a 2/3 chance to have the prize.
I'll run the trials here. Assume the first two doors have the goat, and the third door has the car.
Pick Reveal Switch? Outcome
---- ------ ------- -------
1 2 Y 3 Car
2 1 Y 3 Car
3 1 N 3 Car
3 2 N 3 Car
1 2 N 1 Goat
2 1 N 2 Goat
3 1 Y 2 Goat
3 2 Y 1 Goat
1 3 - No chance to switch
1 3 - No chance to switch
2 3 - No chance to switch
2 3 - No chance to switch
Meaning, given that you've made it to the point that an offer to switch doors is presented, there is no advantage to do so (or not do so). You Pick Car Switch?
------- ----- ------
1 1 N
2 1 Y
3 1 Y
1 2 Y
2 2 N
3 2 Y
1 3 Y
2 3 Y
3 3 N
Without knowing anything else, switching means that you win 2/3 of the time.http://c2.com/cgi/wiki?NotTheMontyHallProblem
The switching strategy is effective because it relies on Monty's avoidance of the car. When Monty isn't trying to avoid the car, his revelation doesn't help you out at all. It just tells you that you either (A) now have a slightly better chance (50%), or (2) you've already lost. (0%).
EDIT: Also see the table on this wikipedia article. It lists probabilities for all the different variants of the MHP. Your scenario is referred to as the Monty Fall or Ignorant Monty variant.
https://en.wikipedia.org/wiki/Monty_Hall_problem#Other_host_...
"Monty Fall" or "Ignorant Monty": The host does not know
what lies behind the doors, and opens one at random that
happens not to reveal the car
(Granberg and Brown, 1995:712) (Rosenthal, 2005a) (Rosenthal, 2005b).
Switching wins the car half of the time.Let us take your approach, and have Monty flip a coin, revealing ANY door at random.
If he flips your door, and you have the prize - You have a 100% chance of winning. If he flips your door, and you have the goat, 0% chance of winning. Those two scenarios are easy, and we can ignore them.
Likewise, if he flips the coin, and shows one of the other two doors, and they have the prize - then, once again - easy - 0% chance of winning. We can ignore these scenarios.
I think up to this point, we can agree on all of the above scenarios. (They are win/lose)
Where it gets complex, he flips a coin, selects one of the doors you aren't on, and reveals a goat.
Given that you had a 1/3 chance originally of winning, and a 2/3 chance of not winning, and given that Monty has now revealed that one of the other two doors (By chance) does not have the car, your 2/3 chance of not winning is still the same, but now it applies to only a single door - I.E. You have a 66% chance of winning by selecting that other door - and the fact that Monty selected that door by chance, is irrelevant.
Unfortunately, despite my (flawed) apparently logical argument - I'm completely wrong, and you are correct.
from random import *
def putPrizeInDoor():
doors=[0,0,0]
door_winner=randint(0,2)
doors[door_winner]=1
return doors
trials=100000
testCount=0
win=lose=0
for x in range(trials):
doors=putPrizeInDoor()
userSelects=randint(0,2)
montyReveals=randint(0,2)
if montyReveals==userSelects: # Monty reveals the door user is on
pass
else:
if doors[montyReveals]==1: # Monty Revealed the prize.
pass
else: # this is where it's interesting - Monty reveals, at random, door not winning that user not on.
revealedDoors=set([montyReveals,userSelects])
newUserChoice=list(set([0,1,2])-revealedDoors)[0]
testCount+=1
if doors[newUserChoice]==1:
win+=1
else:
lose+=1
print ("Tested: {} Wins: {} Lost: {} Percentage: {:.2f}".format(testCount,win,lose,win/testCount))
Tested: 44484 Wins: 22220 Lost: 22264 Percentage: 0.50It's interesting that the deliberate selection by Monty of the goat, increases my chance from 33% to 66% if I switch, but the random selection by Monty of the goat, only increases my chance from 33% to 50% if I switch. I'm not really sure where the argument I made breaks down, but, empirically, it's clearly broken. I'll have to meditate on it a bit to see where I've gone awry.
1/3 of the time you picked correct: 100% of those worlds he shows a goat. 1/3 of the time you picked wrong and he shows a goat. 1/3 of the time you picked wrong and he shows a car.
So your overall odds are 1/3 of winning if you don't change AND 1/3 of the time you don't get the chance to change.
Thus, your overall chances of winning in this case is 1/3. But, if he shows you a goat your odds are bumped to 1/3: 1/3 or 50/50.
I was searching for online simulators that let me tweak the rules of the game, but I could only find those that follow the original rules of the puzzle.
In thinking more about the Ignorant Monty scenario, I realized it's equivalent to having 3 contestants pick doors:
Me
Montgomery
Switchy McSwitcherson
First I pick a door. Then Montgomery picks a door. Finally Switchy McSwitcherson gets the remaining door. Once all the picking is done, Montgomery opens his door first, and is saddened to see a goat. At this point, who is more likely to win? Me or Switchy McSwitcherson? Since we both had 1/3 initial odds, there's symmetry there, and one of us can't reap all the odds-boosting.But the classic puzzle is more like a 2-contestant game, where I pick a door, the host selects a goat to reveal (and reveals it), then Switchy McSwitcherson is assigned the remaining door. In that scenario, I'm mad that they made me pick first before the host eliminated a door for Switchy. Switchy enjoys all the odds boosting.
That's the common misunderstanding of the problem. Most people think that the probabilities go fro 1/3, 1/3, 1/3 to 1/2, 1/2, after choosing a door and having Monty Hall open one of the others. The probabilities don't change.
The probabilities are 1/3, 1/3, 1/3 at the start. After you choose a door, they're still 1/3, 1/3, 1/3. Or a put a different way: 1/3 (your choice) 2/3 (what you didn't choose). When Monty Hall opens one of the other doors, the probabilities don't change. It's still 1/3 (your choice) 2/3 (what you didn't choose).
However, because he's removed one of the doors from the problem, the 2/3 probability is now applied to the remaining door.
That can be viewed as "probabilities changing" for the remaining door, but it's better described as the probabilities being shared between the doors you didn't choose.