That Annoying Brainteaser
Dean
Yes, you really should switch, and no, it's not a trick question. If you still don't believe it, you should click here and read.
If you still don't believe it: work it out with a friend.
It's counter-intuitive. That doesn't make it wrong.









However, the choice of the two doors is a 50/50 choice but the statistics on if you chose the correct door the first time still put it out of your favor. Both events must be considered at that point to understand the reason behind the statistic.
I have a feeling I'm not making it any easier for anyone, am I?
/*
Monte Carlo simulation of the Let's Make a Deal three-door
conundrum.
N.B. A good quality random number generator is required.
System-supplied rand() will not do as low-order bits are
being masked and standard LCG's are correlated in low-order
bits. The rand48 routines are better but are still LCG's at
heart. Suggestion: read Numerical Recipes (Press, Teukolsky,
Flannery and Vetterling) or Knuth II (Seminumerical Algorithms).
Compile:
g++ monty.c -o monty
If you have Bill Chambers' ranyyc library:
g++ monty.c -DHAVE_RANYYC -lranyyc -o monty
Usage: monty [-i
[-v|—verbose]
e.g. monty -sv -i 300
David Gillies 2003
Placed in the public domain.
*/
#include
#include
#include
#include
#include
#ifdef HAVE_RANYYC // which you probably don't
#include
#define RANDOM_SEED srandomm
#define RANDOM_DRAW randomm
#else
/* need a better RNG here - lrand48() not really good enough */
#define RANDOM_SEED srand48
#define RANDOM_DRAW lrand48
#endif
int main(int argc,char *argv[])
{
char doors[4]={0},
switcharr1[4][2]={{0,0},{2,3},{1,3},{1,2}},
switcharr2[7]={0,0,3,2,0,0,1};
int i,c;
unsigned long ran1=0,ran2,ran3,final,wins=0,iters=1000;
bool switchdoor=false,verbose=false;
// get command-line switches
while(1)
{
int optix=0;
static struct option longopts[]=
{{"iterations",required_argument,0,0},
{"switch",no_argument,0,0},
{"verbose",no_argument,0,0},
{0,0,0,0}};
c=getopt_long(argc,argv,"i:sv",longopts,&optix);
if(c==-1)
break;
switch(c)
{
case 0:
{
switch(optix)
{
case 0:
{
iters=strtoul(optarg,(char**)0,10);
if(iters==0)
iters=1000;
break;
}
case 1:
{
switchdoor=true;
break;
}
case 2:
{
verbose=true;
break;
}
}
break;
}
case 'i':
{
iters=strtoul(optarg,(char**)0,10);
if(iters==0)
iters=1000;
break;
}
case 's':
{
switchdoor=true;
break;
}
case 'v':
{
verbose=true;
break;
}
default:
{
printf("Usage: monty [-i
exit(1);
break;
}
}
};
RANDOM_SEED(time(0));
for(i=0;i
// pick door with prize
doors[ran1]=0;
ran1=RANDOM_DRAW();
ran1%=3;
ran1++;
doors[ran1]=1;
if(verbose)
printf("Door %d has prize\n",ran1);
// generate contestant's choice
ran2=RANDOM_DRAW();
ran2%=3;
ran2++;
if(verbose)
printf("Picked door %d\n",ran2);
// pick door to be opened by host
/* N.B. if the first choice is the prize door, then either of
the two others can be opened. If not, then only one
can be (this is the heart of the solution) */
if(doors[ran2]==1)
ran3=switcharr1[ran1][RANDOM_DRAW()&1];
else
ran3=switcharr2[ran1*ran2];
if(verbose)
printf("Opened door %d\n",ran3);
// switch or not depending on policy
if(switchdoor)
final=switcharr2[ran2*ran3];
else
final=ran2;
if(verbose)
{
if(switchdoor)
printf("Switch to door %d\n",final);
else
printf("Stick with door %d\n",final);
}
if(final==ran1)
{
wins++;
if(verbose)
printf("WIN\n\n");
}
else
{
if(verbose)
printf("LOSE\n\n");
}
}
printf("TOTAL WINS: %d/%d\n",wins,i);
}
There is another brainteaser that has always fascinated me just as much as the Monty Hall problem. It involves an island of blue-eyed and brown-eyed people.
Here's the background. There is an isolated island with 200 inhabitants. 100 of them have brown eyes, and 100 have blue eyes.
Blue eyes are considered a sign of the Devil, and if anyone learns he has blue eyes, he is obliged to kill himself at midnight that night.
In general, however, people don't know their own eye color. There are no mirrors or reflective surfaces on the island, and the subject is taboo.
Also, we assume it's a close-knit community, where everyone sees everyone else every day. We also assume that everyone is honor-bound to follow tradition and custom.
So one day an anthropologist comes to the island to study them for a time. His stay on the island is uneventful until the day he leaves. Then, as he's getting on the boat to leave, he casually mentions to the islanders "I saw a blue-eyed person today." Then he leaves.
The question is, what happens as a consequence of the anthropologist's remarks, and when, and why?
I have to confess that I'm less satisfied/convinced of the answer to this one than I am the Monty Hall problem, but it still makes for great discussion. Has anyone heard this? I'll post the answer (ROT13'd) in a follow-up post.
My roommate and I are going to test it with three doors. If it works, and I'm sure it will, it's going to drive me crazy. I really don't like it when I can't figure out logic and math questions.
I'm not sure what that says about me considering the point of the first post.
Ba zvqavtug bs gur uhaqerqgu avtug nsgre gur naguebcbybtvfg yrnirf, nyy 100 oyhr-rlrq crbcyr pbzzvg fhvpvqr. Jul?
Yrg'f svefg ybbx ng gur yvzvgvat pnfr. Yrg'f fnl gurer'f bayl bar oyhr-rlrq crefba ba gur vfynaq, naq uvf anzr vf Wbua. Nf sne nf Wbua xabjf, gurer ner *ab* oyhr-rlrq crbcyr ba gur vfynaq. Jura ur urnef gur naguebcbybtvfg'f erznex gung ur fnj n oyhr-rlrq crefba, ur'f qvfgenhtug, orpnhfr ur xabjf ur zhfg or gur bar. Gung avtug ng zvqavtug, ur qbrf uvzfrys va.
Abj yrg'f ybbx ng gur pnfr jurer jr unir *gjb* oyhr-rlrq crbcyr: Wbua naq Ovyy. Nf sne nf rnpu bs gurz xabj, gur bgure bar vf gur bayl oyhr-rlrq crefba ba gur vfynaq. Jura Wbua urnef gur naguebcbybtvfg'f erznex, ur guvaxf, "Cbbe Ovyy! Gung fhpxf sbe uvz. V thrff ur'yy xvyy uvzfrys gbavtug." Ovyy, bs pbhefr, unf gur fnzr gubhtug nobhg Wbua. Gurl obgu ernpg va ubeebe gur arkg zbeavat, ubjrire, jura gurl frr gur bgure crefba vf fgvyy nyvir. Gur bayl ernfba gung pbhyq or vf gung gurer jnf npghnyyl n *frpbaq* oyhr-rlrq crefba ba gur vfynaq. Fvapr obgu Wbua naq Ovyy bayl frr bar oyhr-rlrq crefba, gurl pbapyhqr, pbeerpgyl, gung gurl ner gur bgure, naq gurl obgu xvyy gurzfryirf ba zvqavtug bs gur frpbaq avtug.
Vaqhpgviryl, lbh pna frr ubj guvf jbexf. Vs gurer jrer guerr oyhr-rlrq crbcyr, gurl'q haqretb gur fnzr cebprff naq gur guerr bs gurz (Wbua, Ovyy naq Grq) jbhyq nyy xvyy gurzfryirf ba zvqavtug bs gur guveq qnl.
Frr? Ner l'nyy pbaivaprq? V'ir fgvyy tbg fbzr vffhrf jvgu guvf bar. :-)
BTW, that's a great explination.
http://mathforum.org/dr.math/faq/faq.monty.hall.html
http://math.ucr.edu/~jdp/Monty_Hall/Monty_Hall.html
Think of it this way. It's a variation on the old three shell &pea game, played on a glass table. The dealer puts the pea, you both shuffle the shells about, and you chose one but don't lift. You have a 1:3 chance of being right. The dealer looks, and reveals one of the shells as empty. Should you switch?
Wait a mo, though. Instead of his looking and then chosing to show one, how about you can instead choose the other two shells? You'd have 2:3 odds -- what the dealer had.
But that's what the reveal does; it collapses the 2:3 probability into the remaining shell, because it's not possible for it to be in the empty shell, it's more likely to be in the "change to" shell.
Chance of picking correct door equals 1 minus the product of the chances of NOT picking the correct door. First choice has a 2/3 chance of being wrong. If you don't switch doors, that chance remains the same. However, if you switch doors, you now have an separate 1/2 chance of picking correctly(or incorrectly). The odds work out this way:
1 - (2/3)(1/2) = 1 - (1/3) = 2/3 chance of picking the correct door if you switch your choice.
Here was an easier way for me to get it using 1000 talbes with 2 black and 1 red card instead of doors.
Actually I was still having a problem picturing it in my mind untill I realized that of the 6000 were not marked with a 1 (2000 red and 4000 black), the dealer removed 1000 black leaving 2000 red and 3000 black (2/3), which is much better than those marked with a '1' of which 1000 red and 2000 black (1/3).
Ok, so I am slow, but now I understand perfectly. :)
You must switch whenever you are asked to, the later the better. By the time 98 consequitive choices have turned up negative, you really must switch. {Does the remaining choice-to-switch-to have a 1 - [1/100 - 1/98!] chance of being correct, ! = factorial? I don't know. Anyway the remaining choice you can switch to is almost assured of being correct.}
By inference or analogy, Monty removing one [wrong] choice of 2 from the pool of remaining choices increases the still remaining choice which you did not choose originally to a stronger chance of being correct than your original choice, regardless of what the exact chances turn out to be. The other choice-pool remaining is always more valuable than your original choice if at least some possibility of the other choice-pool being correct, or containing the correct choice, has increased over its initial chance, which was the same as yours. Turning up negatives or incorrect choices within the remaining set of choices always makes the chance of it containing the correct choice greater than your initial choice. The probablility of each choice in the remaining set or pool of choices being correct is always greater than your original choice.
Surely you must use a Monty Hall simulation!
When Monty opens one door, and allows you to choose again, he is now allowing you to pick two doors, in effect allowing you two chances -- which, naturally, didn't help me either at first. You originally had a 1/3 chance, which didn't change until another door was opened and you took the second option, two doors.