Far down the original 1990 post, is the problem of a family with two children. A reliable report comes to you that one of the two children is a girl. What is the sex of the other child in this family? Cecil claims that the probability is 2/3 that it is a boy. In other words, if you visit the family after receiving such a report, you would find in two of three visits: Mom and Dad, and a brother and sister. Unfortunately, this answer is false.
In the big, wide world, the family with two daughters will generate two reports of “This family has a daughter” for every one report generated by a family with one daughter and one son. Why? Because they have two daughters running around and being observed whereas the family with one daughter and one son has only one daughter running around. However, there are two families with one daughter and one son for every family with two daughters (the “odds” structure. See ^^^ below). So, families with two daughters, and families with one daughter and one son, end up generating the same number reports.
As an “intelligence analyst” all you get are the reports. Half those reports come from families with two daughters and half come from families with one daughter and one son. If you get such a report and then visit the family, half the time that family will have two daughters and half the time that family will have a daughter and a son.
When you account for report frequency, the report that a family with two children has a daughter tells you nothing about the sexual identity of the other child. This is exactly what we would expect and it is exactly the point being made by Adam Martin and Anna Davlantes of Evanston, Illinois way back when.
^^^^When we look only at sex and two children families there are only four types: g/g, g/b, b/g, b/b. When you eliminate “b/b”, only three remain and two of the these three family types have a boy. The odds that one of these families has a boy is 2 in 3. We use these odds to calculate the distribution of reports. However, the odds of a boy are not the same as the predictive power of the report. And it is predictive power that interests people.
The problem as stated is “There is a family with two children. You have been told this family has a daughter. What are the odds they also have a son, assuming the biological odds of having a male or female child are equal?”
The sentence italicised and in bold is crucial to calculating the answer. The probability of being told the family has a daughter for each family type is:
If BB then Prob(“told family has a daughter”) = 0
If BG then Prob(“told family has a daughter”) = 1/2
If GB then Prob(“told family has a daughter”) = 1/2
If GG then Prob(“told family has a daughter”) = 1
This makes the answer to the problem as stated = 1/2
2/3 is the answer to a different problem, unless you’re making assumptions that are neither specified nor implied in the problem.
For what it’s worth, I’ve written a small C# command line application to let you play this game repeatedly. Having done it myself, there’s a clear disadvantage to not switching doors.
Yes, it is crucial, but not in the way you claim. It says “You have been told.” Calculating the odds of what you were already told is irrelevant to answering the question as stated. It’s a given. You have been told, so the probability is 1. Given that you have been told this family has a daughter, then what are the odds they also have a son?
You can disregard this program until I’ve fixed it. There’s a problem with the algorithm I made. For some reason, you can get a 100% win chance if you always pick door 3 and always elect to switch doors. Obviously, something is wrong.
Thanks for looking that up for me. I figured it was something like that. (“It’s probably some “greater than/equal to” bug. But there’s no way they would do it that way–it’s too stupid. I don’t have time for this; I need to get back to work.” - Me after I found the bug). I thought my numbers seemed off when I was getting a 75% success rate.
It’s not a given, if it was the problem would be stated “Given that I have 2 children of which at least one is a boy etc…”
Presumably if I’d been told instead that “at least one was a girl” I’d have to calculate the probability that both were girls as 1/3 also. So whatever I’m told I’m supposed to calculate the probability that both children are of the same gender as 1/3?
Apply your logic to the Monty Hall Problem. According to you it’s a “given” that Monty opens Door3 (since calculating the odds of what door has already been opened is irrelevant), if that’s the case there’s no advantage in switching - it’s 50/50, but you and I both know that’s the wrong answer.
Just because something didn’t happen doesn’t mean it couldn’t happen. Just because you’ve been told “at least one is a boy” doesn’t mean you couldn’t have been told “at least one is a girl”
Here we go. I fixed the program and made it much better overall. It now uses truly random numbers from Random.org and is also much more robust than before. Requires an Internet connection to play.
Full disclosure code:
using System;
using System.Text;
using System.Net;
using System.IO;
namespace monty
{
class Program
{
static int Main(string[] args)
{
int[] rand;
rand = GetRandomNumbers(2000, 1, 3);
if (rand == null)
return 1;
Console.WriteLine("");
Console.WriteLine("**************************************");
Console.WriteLine("* Welcome to Monty *");
Console.WriteLine("**************************************");
Console.WriteLine("");
bool keepPlaying = true;
int winningDoor;
int montysChoice;
int usersChoice;
double totalCount = 0;
double winCount = 0;
int next = 0;
String userInput;
while (keepPlaying == true)
{
usersChoice = 0;
montysChoice = 0;
winningDoor = rand[next];
next++;
Console.WriteLine("There are three doors. Please enter your choice (1, 2, or 3): ");
userInput = Console.ReadLine();
usersChoice = Convert.ToInt32(userInput);
Console.WriteLine("Monty will now pick a door of the remaining two.");
if (usersChoice == 1)
{
if (usersChoice != winningDoor)
{
if (winningDoor == 2) { montysChoice = 3; }
else { montysChoice = 2; }
}
else
{
montysChoice = rand[next];
next++;
while (montysChoice == 1)
{
montysChoice = rand[next];
next++;
}
}
}
else if (usersChoice == 2)
{
if (usersChoice != winningDoor)
{
if (winningDoor == 1) { montysChoice = 3; }
else { montysChoice = 1; }
}
else
{
montysChoice = rand[next];
next++;
while (montysChoice == 2)
{
montysChoice = rand[next];
next++;
}
}
}
else //Assume user picked number 3
{
if (usersChoice != winningDoor)
{
if (winningDoor == 1) { montysChoice = 2; }
else { montysChoice = 1; }
}
else
{
montysChoice = rand[next];
next++;
while (montysChoice == winningDoor)
{
montysChoice = rand[next];
next++;
}
}
}
Console.WriteLine("Monty has chosen door number " + montysChoice + ". And revealed it to be a dud.");
Console.WriteLine("Do you want to switch doors? (y or n) ");
userInput = Console.ReadLine();
if (userInput == "y")
{
if (usersChoice == 1 && montysChoice == 2)
usersChoice = 3;
else if (usersChoice == 1 && montysChoice == 3)
usersChoice = 2;
else if (usersChoice == 2 && montysChoice == 1)
usersChoice = 3;
else if (usersChoice == 2 && montysChoice == 3)
usersChoice = 1;
else if (usersChoice == 3 && montysChoice == 1)
usersChoice = 2;
else if (usersChoice == 3 && montysChoice == 2)
usersChoice = 1;
}
if (usersChoice == winningDoor)
{
Console.WriteLine("Congratulations! Door " + usersChoice + " was the winning door!");
winCount++;
totalCount++;
}
else
{
Console.WriteLine("Sorry. Door " + usersChoice + " was not the winning door.");
totalCount++;
}
Console.WriteLine("Wins: " + winCount + " Total Games: " + totalCount + " Win %: " + winCount / totalCount);
Console.WriteLine("Play again? (y or n) ");
userInput = Console.ReadLine();
if (userInput == "n") { keepPlaying = false; }
}
return 0;
}
static int[] GetRandomNumbers(int quantity, int lowerBound, int upperBound)
{
Console.WriteLine("Retrieving random numbers from Random.org...");
Console.WriteLine("Checking quota...");
bool quotaExceeded = false;
quotaExceeded = CheckQuotaIsExceeded();
if (quotaExceeded == true)
{
Console.WriteLine("Quota for this IP address has been met or exceeded. Stopping.");
int[] failure = null;
return failure;
}
else
{
Console.WriteLine("Quota check OK.");
}
String strRequestURL = "http://www.random.org/integers/?num=" + quantity +
"&min=" + lowerBound + "&max=" + upperBound + "&col=1&base=10&format=plain&rnd=new";
WebRequest webRequest = WebRequest.Create(strRequestURL);
int[] results = new int[quantity];
try
{
Stream objStream = webRequest.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
string line = "";
for (int i = 0; line != null && i < quantity; i++)
{
line = objReader.ReadLine();
results* = Convert.ToInt32(line);
}
}
catch (Exception ex)
{
Console.WriteLine("Retrieval of random numbers failed.");
Console.WriteLine("Exception: " + ex.Message);
}
Console.WriteLine("Numbers retrieved successfully.");
return results;
}
static bool CheckQuotaIsExceeded()
{
String strRequestURL = "http://www.random.org/quota/?format=plain";
WebRequest webRequest = WebRequest.Create(strRequestURL);
Stream objStream = webRequest.GetResponse().GetResponseStream();
StreamReader objReader = new StreamReader(objStream);
String strQuota = objReader.ReadLine();
if (Convert.ToInt32(strQuota) <= 0)
return true;
else
return false;
}
}
}
There are other ways to establish something as a given without using the word “given.” Putting it in the past tense, for example.
No. but it does mean that it didn’t happen. Unless you’re a time traveler, something that already happened has a probability of 1, and something that didn’t happen has a probability of 0.
I don’t understand what you’re trying to say here. But in the Monty Hall problem, the given is that Monty opened a door that he knew didn’t have the prize behind it. The player, knowing this, now has new information that changes the odds.
Let’s play 2 games, both involve me flipping 2 fair coins and then telling you how 1 of them landed
Game1: If both coins land heads I tell you “one of the coins landed heads”. If both coins land tails I tell you “one of the coins landed tails”. If the coins land mixed sides I pick a coin at random and tell you either “one of the coins landed heads” or “one of the coins landed tails”. I flip both coins and tell you “one of the coins landed heads”. What is the probability that both coins landed heads?
Game2: If both coins land heads I tell you “one of the coins landed heads”. If both coins land tails I flip the coins again. If the coins land mixed sides I tell you “one of the coins landed heads”. I flip both coins and tell you “one of the coins landed heads”. What is the probability that both coins landed heads?
In both games you have been told exactly the same information, and yet the answer to Game1 is 1/2 and the answer to Game2 is 1/3.
The reason for the different answers lies in the calculation of prior probabilities (and doesn’t involve time-travelling). In Game1 the probability that I tell you “one of the coins landed heads” is 1/2. In other words I could have told you “one of the coins landed tails” but I didn’t
In Game2 the probability that I tell you “one of the coins landed heads” is 1. In other words I couldn’t have have told you any thing else - it’s a “given”.
You choose to interpret the 2 children problem as Game2, and yet you have to interpret the MHP as Game1 in order to arrive at the correct answer.
In an old Monty thread I wrote a similar short program in Java:
It doesn’t let you play, but it simulates about a million games (controllable with a variable). As I say in that post: the crux is that Monty is omniscient and always picks the correct door if it’s available. As you set NUM_DOORS to successively higher numbers, the game becomes increasingly impossible to win without switching.
Jragon, I like that approach. If you don’t pick the winning door on your first pick, the the host picks the winning door for himself. So if you want to switch with the host, you get the door he picked. That is a much clearer demonstration of why the odds are in your favor to switch.
Helping someone understand that it is the logical equivalent might still be a problem.
Making the program (more or less) exactly equivalent is even really that hard. You just make an array of <n> doors and iterate through it, marking all the ones except the winner as “open” and selecting the winner (or a random one if the user picked the winner).
I probably should have done that as it’d be more illustrative, but it felt like overkill at the time.
Instead of the 3 doors of Let’s Make a Deal, how about the 30 cases for Deal or No Deal? Since you can open the million dollar case, I’m assuming the odds are based upon how many cases are left? So if you got down to the last 2 cases without eliminating the million dollar case, when they give you the option to swap cases, is it 50/50 at that point, or is your case 1/30 & the other case 29/30?
My immediate intuition is that the problem is different and that the swap is 50/50. The key difference, by my reasoning, is that the Host doesn’t always pick the winning case and throw away all the others. Rather, all the cases are opened (effectively) randomly until only one remains. It’s that added element that the winning case isn’t selected omnisciently that changes the probability.
The key element that makes the Monty Hall problem work isn’t “possibilities are eliminated until only two remain” so much as “possibilities are eliminated in a systematic fashion by an entity who deliberately and knowingly ensures a certain outcome if it’s possible.”
But I’m definitely not certain and willing to be shown I’m wrong.
ETA: As I see it, in Deal or No Deal the elimination of the cases one by one only affects the buyer’s offers. The game is effectively equivalent to picking a single case out of a set of 26 if you eliminate the “buyer” portion, the switch is a red herring.