
Comments: "The Monty Hall Problem"
http://www.techinterview.org/Puzzles/fog0000000045.html
Reading this problem, common sense tells you that you have 50/50 odds, regardless of your first selection. So when I saw your solution, I was intrigued. On the surface it looks correct, so I wanted to know why it was that my common sense failed me.
So, aha! I think I've found a flaw in your solution.
You start off correctly showing the three possible scenarios:
door 1 door 2 door 3
case 1 $$ goat goat
case 2 goat $$ goat
case 3 goat goat $$
However, where the logic falls down is that once Monty has selected to show you a goat, there are now FOUR possible situations, vaguely related to your original three cases.
For the sake of illustration, let's assume you picked door 3 (it works out identically, regardless of which door you select, as you'll see):
In both case #1 and #2, Monty has a predescribed path he must follow; that is, to show you the _other_ door with a goat, since your door also has a goat.
However, in case #3, Monty has _two_ paths he may elect to take: he can open either door. Case #3 has become #3a and #3b, as such:
door 1 door 2 door 3
case 1 $$ <goat> [goat]
case 2 <goat> $$ [goat]
case 3a goat <goat> [$$]
case 3b <goat> goat [$$]
[] = my door choice, <> is what Monty showed me.
Now you can see that your chances really are 50/50.
To sum up: it doesn't matter which door you selected first: Monty has at least one goat to show you. That means you're left with one good and one bad door, and from a statistical point of view, the past is irrelevant: it doesn't matter whether you selected the good door first or the bad door first. You're left with a 50/50 decision between good door and bad door.
Brad Wilson
Saturday, November 17, 2001
By the way, in response to Michael's suggestion, I google'd for "The Monty Hall Problem" and had a bunch of hits. The result is that, on average, people agree with the solution posted to TechInterview, and not mine.
Since this is supposed to be a statistics problem, there's nothing better than a nice little bit of statistics to prove what's going on. Make the run size large enough, and the statistics won't lie to you.
I wrote a C# console program that uses a runsize of at least one million. It performs the exact steps outlined in the original problem, namely:
 A door is randomly selected as "correct"
 A door is randomly selected as "contestant choice"
 If contestant's choice is wrong, then Monty MUST by definition show the OTHER wrong door (no choice for Month); if the contestant's choice is right, then I randomly select a door from the remaining two doors
I ran the test in two ways; in one, the contestant always switches, and in the other, the contestant never switches.
Both runs yield identical results: virtually 50% of the time the contestant picks the right door.
If you'd like the C# code, please contact me at http://www.quality.nu/contact.aspx and I'll email it to you (it should be trivial to convert to Java or C++ if you want to run it yourself and don't have the .NET Runtime & command line compilers).
Brad
Brad Wilson
Saturday, November 17, 2001
D'oh!
Don't you know that ... just when you think you have the thing solved, you find something stupid. :p
In my C# code, I called the Next method on the Random object, like so:
int CorrectChoice = rand.Next(1,3);
Of course, the simple docs for Next() docs weren't clear that the upper bound is never reached... yielding integers between 1 and 2. I wasn't printing out every choice, since I was running millions of iterations. I happened to find it out indirectly.
Turns out the original math (66 2/3% success when always switching doors) was indeed correct. My bad!
Brad Wilson
Saturday, November 17, 2001
You are correct that there are 4 cases, but 3a and 3b each occur with probability 1/6.
Larry Rosenstein
Tuesday, November 20, 2001
Recent Topics
Fog Creek Home
