|
Introduction
In a recent episode of Numb3rs, the television drama sometimes involving the theoretical use of mathematics to solve real world crime problems "Charlie" the Mathematician gave a public seminar demonstrating some math's puzzles. One of those demonstrated was the "Monty Hall Paradox" Wikipedia describes this puzzle as:
"The Monty Hall problem is a puzzle involving probability loosely based on the American game show Let's Make a Deal. The name comes from the show's host, Monty Hall. A widely known, but problematic (see below) statement of the problem is from Craig F. Whitaker of Columbia, Maryland in a letter to Marilyn vos Savant's September 9, 1990, column in Parade Magazine (as quoted by Bohl, Liberatore, and Nydick).
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. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?"
The question in a nutshell is, after the host removes one of the wrong doors, is there any advantage to changing your answer. Is it now a 50/50 chance? Or does staying or changing your selection increase OR decrease your odds of winning?
The Experiment
I wrote a simple console application that run 1 million iterations of The Monty Hall gameshow segment. The proof carries out the following process:
- Randomly choose 1 of 3 doors for the initial contestant's pick
- Randomly pick one of the wrong doors to remove (the host knows which one has the car, and removes an INCORRECT choice)
- Change the contestant's picked door
- Determine if the contestant WON or LOST!
Did the contestant win after switching?
Result when SWITCHING your choice after the host has removed one incorrect answer:
Wins: 666576 Losses: 333424 Total: 1000000
If you initially think that there is no advantage in switching doors, or your probability is 50/50, or your probability remains at 1 out of 3 - you are in great company, but still INCORRECT.
Switching your initial choice after the host has disclosed one incorrect door DOUBLES your chances of winning to 2 out of 3.
I must admit, until I wrote this proof I wasn't exactly confident. It clearly demonstrates that approximate 66% of the time you would WIN if you SWITCHED your answer, and only win 33% of the time if you kept your initial choice.
I was also amazed at the almost perfect ratio 66.6 / 33.3 which matched the theoretical 2 out of 3 win/loss prediction. Kudos to the authors of the built-in .NET Random class. I didn't initially believe the results because the numbers worked out so nice, but I've double-checked my code and made certain that I've used random decisions for all moving parts. I'd be interested if anyone can point-out anything wrong with my code though.
The Code
using System;
namespace MontyHall
{
class Program
{
static void Main(string[] args)
{
Random random = new Random();
int wins = 0;
int losses = 0;
for (int i = 0; i < 1000000; i++)
{
int changeDoor = 1;
bool result = MontyHallPick(random.Next(3), changeDoor,
random.Next(3), random.Next(1));
if (result)
wins++;
else
losses++;
}
Console.WriteLine("Wins: {0} Losses: {1} Total: {2}",
wins, losses, wins+losses);
Console.ReadLine();
}
public static bool MontyHallPick(int pickedDoor, int changeDoor,
int carDoor, int goatDoorToRemove)
{
bool win = false;
int leftGoat = 0;
int rightGoat = 2;
switch (pickedDoor)
{
case 0: leftGoat = 1; rightGoat = 2; break;
case 1: leftGoat = 0; rightGoat = 2; break;
case 2: leftGoat = 0; rightGoat = 1; break;
}
int keepGoat = goatDoorToRemove == 0 ? rightGoat : leftGoat;
if (changeDoor == 0)
{
win = carDoor == pickedDoor;
}
else
{
win = carDoor != keepGoat;
}
return win;
}
}
}
| You must Sign In to use this message board. |
|
| | Msgs 1 to 25 of 32 (Total in Forum: 32) (Refresh) | FirstPrevNext |
|
 |
|
|
The maths is rather simple, the statistical testing fine, I understand it well.
But what if you actually wanted a goat? 
Troft not lest ye be sponned on the nurg! (Milligan)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Help me, I cannot how to work any Solution Explorer from Microsoft Visual C# 2005 Express Edition, how to work and running Programmer.cs. Cannot how to know to write/run Recent Project. Help from hohsen@hotmail.com
How to get and run for new Progammer.cs from my C# Recent Projects??? hohsen88@yahoo.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Help me, I cannot how to work any Solution Explorer from Microsoft Visual C# 2005 Express Edition, how to work and running Programmer.cs. Cannot how to know to write/run Recent Project. Help from hohsen@hotmail.com
How to get and run for new Progammer.cs from my C# Recent Projects??? hohsen88@yahoo.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Help me, I cannot working any Solution Explorer from Microsoft Visual C# 2005 Express Edition, how to work and running Programmer. Cannot how to know to write/run Recent Project
How to get and run for new Progammer.cs from my C# Recent Projects??? hohsen88@yahoo.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I first saw this in a book (curious incident...) and have pondered it many times. After doing some virtual simulators online, it makes so much sense that the chances double. Here is my best attempt at explaining...
You have a 1/3 chance of choosing the car from the start. Everyone agrees there. 33.3% chance if you stick with it. But we are changing. Of course you will lose if you change. This represents the one instance where you lose out of three.
You have a 2/3 chance of choosing a goat from the start. Monte shows goat#2 in either case. Switch to the car! You will win every time you choose a goat - 66.6% of the time. This represents the 2 out of three chances where you will change from a goat to a car.
Hope this helped... I can explain in many other ways but that was the simplest. Since there are two bad and one good, there are two instances to switch from bad to good and one to switch from good to bad.
Vinny
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Sorry - Maybe I could have done simpler...
Instance of Not Changing... 33% of winning. Everyone agrees.
Instances of Changing...
1/3 of selecting car first. Every time you will switch to a goat. 2/3 of selecting goat first. Every time you will switch to a car.
Therefore, if you set your mind to switching... you will lose if your inital choice was right. You will win if your initial choice was wrong. Do you feel lucky?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Now that I have read everyone else, let me come at the problem a different way. We should still finish up with 50%.
Suppose the doors are labeled 1, 2 and 3 and that the car is behind Door 1. (If you are unhappy with these initial conditions, change them to suit yourself - the argument does not turn on those initial conditions).
The game can play out in any one of the following ways:
(C is the contestant, M is Monty - and remember the car is behind Door 1)
C chooses 1, M chooses 2. If (C switches to 3) then lose. C chooses 1, M chooses 3. If (C switches to 2) then lose.
C chooses 2, M chooses 3. If (C switches to 1) then win
C chooses 3, M chooses 2. If (C switches to 1) then win
--------------------------------------------------------------------------------
C chooses 1, M chooses 2. If !(C switches to 3) then win. C chooses 1, M chooses 3. If !(C switches to 2) then win.
C chooses 2, M chooses 3. If !(C switches to 1) then lose
C chooses 3, M chooses 2. If !(C switches to 1) then lose
All of these 8 scenarios are equally probable - 4 represent wins, 4 losses.
Winning odds are 50%.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I believe your logic is flawed. You are basing your statistical analysis off what the outcome is, not what the probability of each choice is. When C chooses 1, M can only choose one time, either door 2 or 3. Your logic is counting each of the two possible choices M has as a different path through the decision tree, when it should be counted only as a single outcome.
Your scenarios should look like this
C chooses 1, M chooses 2 or 3. If (C switches to 2 or 3) then lose. C chooses 2, M chooses 3. If (C switches to 1) then win C chooses 3, M chooses 2. If (C switches to 1) then win
-----
C chooses 1, M chooses 2 or 3. If !(C switches to 2 or 3) then win. C chooses 2, M chooses 3. If !(C switches to 1) then lose C chooses 3, M chooses 2. If !(C switches to 1) then lose
The accepted solution is well documented at http://en.wikipedia.org/wiki/Monty_Hall_problem.
Greg
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I offer the following comment, without having read anyone else's comments and without having looked at the code, because I don't want to be influenced by the author's or other members' opinions.
My reasoning requires that it can be safely assumed by the contestant that the door which will be removed has certainly got a goat behind it (I am not familiar with the game format).
It follows from that that once that door for removal has been nominated, the car is behind one or the other of the remaining doors. It cannot matter which door the contestant has first nominated, because she is allowed to choose afresh. The question "Do you want to pick door No. x?" is the same as asking the contestant to nominate one of only two doors available. One hides the car, the other doesn't. It is irrelevant what choice had been made earlier. The probability of winning is 50%.
Putting it in quite another way - suppose there are thirty three doors when the contestant arrives on the stage and it is known that they conceal thirty two goats and one car. Suppose too that someone simply walks onto the stage and removes thirty one doors. The contestant can have as many choices and changes of minds as she likes, before settling on one - she has a 50% chance of winning as long as there are only ever two doors to choose from.
Now I will have a look at what others have written!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I was struggling with this becuse I couldn't see how the contestant's first choice influenced the result. I think I see now that it doesn't - directly - but it influences the host's choice and since that decision relies on prior knowledge, that's where the influence occurs.
I'm going for a lie down now.
Dave Cross
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Your MontyHallPick function has a flaw. In your function there is a chance that Monty Hall picks the room with the car and says that it contains the goat and, thus, your "switch (pickedDoor)" part should be replaced with "switch (carDoor)" with the same content in brackets, followed by "if (pickedDoor == leftGoat) leftGoat = rightGoat; if (pickedDoor == rightGoat) rightGoat = leftGoat; int chosenDoor; if (leftGoat == rightGoat) chosenDoor = carDoor; else chosenDoor = goatDoorToRemove == 1 ? rightGoat : leftGoat;
// would the contestent win with the switch or the stay? if (changeDoor == 0) { // not changing the initially picked door win = carDoor == pickedDoor; } else { // changing picked door to the other door rememaining win = carDoor == chosenDoor; }"
but the results remain the same so it's not that big of a deal!
_____________________________ There are 10 types of people, those who read binary, and those who don't!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I'll look closer, but I use a 0 or 1 random number to pick either the leftmost GOAT, or the RIGHTMOST goat and a switch statement to NEVER remove the CAR door.
I think that is what you are taking issue with?
As long as we agree that Monty knows the car door and never chooses that one to remove, we are on the same page.
The switch statement means that the picked door is excluded from the "Removal" process, only the leftmost or rightmost goat doors are up for grabs by Monty.
switch (pickedDoor) { case 0: leftGoat = 1; rightGoat = 2; break; case 1: leftGoat = 0; rightGoat = 2; break; case 2: leftGoat = 0; rightGoat = 1; break; }
Did I get it wrong?
Thanks, Troy http://aspiring-technology.com/blogs.troym
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Yes, we agree that Monty should never remove the car door, but in your code, that could happen.
For example, if pickedDoor is door number 2, and carDoor is door number 0, then your leftGoat would be 0 and rightGoat would be 1. In your case, depending on the random variable goatDoorToRemove, your keepGoat variable would be either 0 or 1, and after that variable win could become true if keepGoat is 1, and false if keepGoat is 0.
But if you look logicaly in true life, Monty would *always* open the door number 1 and when you change your selection you would always end up getting the door number 0 with a car, and in that case, your function would always have to return true.
_____________________________ There are 10 types of people, those who read binary, and those who don't!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
This is a demonstration, not a mathematical proof.
My explanatory skills aren't sufficient to do so without recourse to maths, but this is a simple conditional probabilities problem - take a look at http://en.wikipedia.org/wiki/Bayes'_theorem
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Guilty.....
Sorry, I'll change the title when I get a chance!
Troy Magennis http://aspiring-technology.com/blogs/troym
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Ironically I rediscovered this problem yesterday and have become fascinated with it. I thought it was cool to see this tool on CP today.
My question is, after having written the program to statistically prove the results, are you any closer to understanding why? If so, I think it would be a good improvement to your article, if not, I think I can sufficiently explain why if you were interested.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Explain away dude!! I want to know!!
"a fool will not learn from a wise man, but a wise man will learn from a fool" "It is hard to fail, but it is worse never to have tried to succeed." - Theodore Roosevelt "Success is going from failure to failure without losing your enthusiasm." - Winston Churchill My Website || My Blog
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I think I can explain why, although I'd be interested to see if you think the same way Paul
When the game starts and you pick a box, there is a 1/3 chance that the prize is in that box. Therefore there is a 2/3 chance that the prize is in one of the other two boxes. When the host opens one of the incorrect boxes, there must then be a 2/3 chance that the prize is in the remaining closed box not chosen by the contestant. So choosing to switch boxes at this point effectively doubles your chances of winning.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I at first had some problems realizing why too, but after I thought of the problem in the following fashion it's very easy to understand.
Let's exaggerate it just a little in order to see it more clearly. Let's say that you're on a gameshow with a thousand closed doors. Behind 999 of these doors there's a goat and behind one of the doors there's a car, now you're asked to pick one of the doors. Once you've picked a door the game show host opens 998 out of the other doors, each of the opened doors hid a goat, NOW, would you pick the door you opened first or the other un-opened door?
This is exactly what happens in the case of three doors too, you pick ONE door, the host open ALL the other doors but one, but in the case of three doors "ALL the other doors but one" amounts to only one door which makes it a bit harder too see why you should switch doors.
Hope this helps, and excuse me for my semi-poor english (hey, I'm just a stupid Swede)
Cheers, Patrik
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
This is a great explaination. I'm going to forward it my University stats proff who I believe led us in the wrong direction on this classic math question.
If you always had the strategy "I'm going to switch my door" then in reality (for your first pick) you're trying to pick the door that DOESN'T have the car. You're odd's of correctly doing this are n-1/n (since there's only one door that has the car and all the others have donkeys).
You do this KNOWING that Monty is about to show you the other n-2 doors that also have donkeys. After he does so you switch since your original plan and guess was "I'm going to pick the door that DOESN'T have the car". I guess this means that if you switch you should always have an n-1/n likely hood of getting the car (after Montey opens up all the n-2 other wrong doors).
The thinking about it as an 1000 door contest really helps to shed some light on it. Nice moves Patrik. The same thoughts could be applied to "Deal or No Deal"!
Thanks guys, Homerbush
|
| Sign In·View Thread·PermaLink | 4.00/5 (1 vote) |
|
|
|
 |
|
|
homerbush wrote: The same thoughts could be applied to "Deal or No Deal"!
For clarification, the Monty Hall problem is NOT anything like Deal or No Deal. The host (Howie) nor the banker have any insider information. They don't know what values are in what cases. If you make it to the end with 2 cases left and Howie asks if you want to switch cases, it makes no difference statistically if you switch. You still have a 50% of winning. But you'll make a fool out of yourself on TV if you switch and are wrong 
The real reason the "Monty Hall problem" works is that the host KNOWS what is behind the curtains and he uses that knowledge to show you a goat. That knowledge of where the goats are changes the statistics.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Joel has it basically right, although I don't think he was as clear as he could have been.
First thing to remember is that, on your initial selection, you have a 1-in-3 chance of having picked the right curtain, and if you do not switch nothing that happens will affect that.
Then, once the goat is revealed, your decision boils down to: - If you picked the winner at first, and you switch, you will lose. - If you picked a loser at first, and you switch, you will win.
So, your odds of winning if you switch are the same as your odds of picking the wrong curtain initially, which is 2 in 3.
Truth, James
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
General News Question Answer Joke Rant Admin
|