The Problem of the Unfinished Game

December 30, 2008

Today's post is a simple question.

Let's say, hypothetically speaking, you met someone who told you they had two children, and one of them is a girl. What are the odds that person has a boy and a girl?

baby boy and girl

Consider your answer carefully, without doing a web search, or reading the comments to this post. Don't cheat -- but be prepared to explain your reasoning, because the solution might surprise you.

It's almost like some kind of conspiracy or something.

Posted by Jeff Atwood
908 Comments

50%. It's always 50%. There is no dependancy between the two. Having one girl doesn't mean you have a higher chance on the second attempt of having either. It's still 50%.

Same as tossing a coin. If you throw 99 heads in a row, the chance of a head (or tail) on the next throw is still - and always will be - 50%.

Nic Wise on December 31, 2008 3:33 AM

How you learned this fact affects the outcome.

Assume the probability of being born a girl or boy is exactly 1/2 (it's not but let's keep it simple.)

Scenario #1:

You're sitting enjoying coffee with your new friend who has just told you she has two children. You don't know their genders. A small child enters the room, walks up to your friend who explains this is her daughter Lisa.

The probability that the other child is male is 1/2.

Scenario #2:

You're sitting enjoying coffee with your new friend who has just told you she has two children. You ask, Is at least one of them a girl? She looks a little puzzled but replies, Yes.

The probability that the other child is male is 2/3.

David Stafford on December 31, 2008 3:34 AM

Lets also rephrase the question:

Let's say, hypothetically speaking, you met someone who told you they had ONE CHILD. What are the odds that person has a boy?

:)

Nic Wise on December 31, 2008 3:35 AM

It depends on what they mean by one is a girl. Let's assume they said at least one is a girl, except nobody would say that if they weren't a character in a puzzle. More realistically, imagine they mentioned two children and later on that they were organising a birthday party for my daughter, which lets you deduce the same thing, that there's at least one girl.

When they mentioned two children, there were four possible pairings: two girls; older girl and younger boy; older boy and younger girl; two boys. When they mention a daughter that rules out them having two boys, but the other pairings have equal probability. So the answer is 2/3.

Andrew Turner on December 31, 2008 3:35 AM

1/3rd chance that the other child will be a boy.

Here is my reasoning:

There can be two cases here:

1) Two girls
2) One girl and one boy.

In case 1 there are two sub cases:
1.1) He was talking about the first girl
1.2) He was talking about the second girl

In case 2 there is only one sub case (beacuse he is talking about the only girl)

So among these three cases only one gets you one girl and one boy.

Niyaz PK on December 31, 2008 3:36 AM

I would say 50%, but since you are implying there's a catch here, it might be 1/3, like that game show doors problem.

Lerxst on December 31, 2008 3:36 AM

To all the statisticians above: how is boy+girl different from girl+boy? The order doesn't matter, the only information you have is that one of them is a girl.

John Rothlisberger on December 31, 2008 3:37 AM

@david stafford.

The probability should be the same. the physical child doesn't change the problem.

Kieth on December 31, 2008 3:37 AM

66%?

Tuna Toksoz on December 31, 2008 3:40 AM

John Rothlisberger: Depends on culture. See China or Thailand for example.

mannu on December 31, 2008 3:40 AM

@Therac-25

You tell me the right one is heads.

Poor wording on my part. I should have said, I tell you which one in heads.

Chase Seibert on December 31, 2008 3:41 AM

Mannu: you're talking about selective abortion or selective in-vitro conception -- I wouldn't factor that in to this simple, undoubtedly trick question.

John Rothlisberger on December 31, 2008 3:43 AM

If you are talking with parent and he/she tells you, that there are 2 children and one of them is a girl then there is a 100% probability that other is boy. So the answer to the question What are the odds that person has a boy and a girl? is 100%.

If the person you are talking with is not a parent of children in this case, then I can agree with people who say who say 2/3.

Aarne on December 31, 2008 3:43 AM

@Kieth

Again, appeal to authority is a logical fallacy. Besides, stop appealing to wikipedia. Remember that people who erroneously think it is 2/3 could easily be editing that article. If you read the discussion there it is far from unanimously agreed upon.

Practicality on December 31, 2008 3:43 AM

if he says ONE of them is a girl, I think he's meaning the other one is a boy. so 100% chance, I'd say... or 99.99999999% to be on the safe side :-)
if he had two girls, he would speak differently.

Daniele Muscetta on December 31, 2008 3:44 AM

By the way, I agree with Nic Wise. In the absence of external influence, a coin toss doesn't know what the results of previous coin tosses were.

John Rothlisberger on December 31, 2008 3:44 AM

@john rothlisberger - because having a boy and then a girl is a different event to having a girl then a boy. We're working out the probability of each child pair occurring. There are four possible events (BB, BG, GB, GG) of which we're discounting one (the BB pairing) leaving us three remaining possibilities.

jammus on December 31, 2008 3:45 AM

Since he already as a girl, possible pairs are:

BG
GB
GG

so the odds of having a boy and a girl = 66.67%

Vadakkoodan on December 31, 2008 3:46 AM

@john - it would be the same with a coin toss.

I flipped a coin twice. One of the results was a head. What is the probability that the other result was tails?

H/H
H/T
T/T - NO!
T/H

Still 2/3.

jammus on December 31, 2008 3:48 AM

BootLace:
To the 66%ers mentioning that the possible combinations are BB, GB, BG, GG, and that knowing one is a girl removes the BB option, you do realise that knowing one is a girl also removes one of the BG/GB options as well?

No, if I was told My first child is a girl _or_ My younger child is a girl then it would remove one of the options. That's the crucial piece of information that makes it 66% rather than 50% -- I can't remove either of those options without knowing which child it is.

Trevel on December 31, 2008 3:49 AM

To the comenters above me.

In this particular problem BG and GB is the same. So only there are 2 remainig options. 50/50

LBO on December 31, 2008 3:50 AM

read my first line as since he already has a girl...

Vadakkoodan on December 31, 2008 3:51 AM

@John Rothlisberger

The four outcomes are the ways in which children could have been born. You could have

boy then boy
boy then girl (i.e. the boy is older)
girl then boy (i.e. the girl is older)
girl then girl

Alex on December 31, 2008 3:51 AM

Thanks to Trace for an excellent diatribe on the mental process of the uber-engineer.

50/50.

Each time a coin is tossed, there is a 50 percent chance it will come up tails, NO MATTER WHAT CAME BEFORE.

Each time conception occurs in the human womb, the same rule applies (give or take a percentage point or two).

Wombat on December 31, 2008 3:51 AM

Hey Now Jeff,

50%

Coding Horror Fan,
Catto

Catto on December 31, 2008 3:53 AM

Two coins add up to 30c, one of them isn't a nickel.

What are the two coins?

If you think the answer to Jeff's puzzle is 50% consider this riddle and try again.

Andy on December 31, 2008 3:53 AM

I'm going with 2/3. Same sort of reasoning as Monty Hall : http://en.wikipedia.org/wiki/Monty_Hall_problem

Greg on December 31, 2008 3:54 AM

@jammis: no we are not working out the combinations. we are working out the probability of ONE INDEPENDENT event (we know the other already), which has 2 outcomes. 1/2 = 50%.

or if you want to work it out with sets:

BG
GB
BB
GG

#3 is eliminated, 'cos we know we have one girl, leaving:

BG
GB
GG

As they didn't say that the first - or second - is a girl, BG and GB are the same (it's not order dependant), so we have:

BG (or GB, doesn't matter)
GG

Hence 50%.

Nic Wise on December 31, 2008 3:54 AM

It's closer to 100% but not there.

Reasoning: in general population boys outborn girls by 51.4%. So if we gave a 2-child general family then to keep up the statistic girl already has a smaller chance to also be the second child.

If it were 50% then situation would become, for N of 2-children families already N children are girls and the rest are N/2 girls and N/2 boys. which makes 1.5N girls and .5N boys (which contradicts statistics).

Pasi Savolainen on December 31, 2008 3:54 AM

BTW, @Daniele Muscetta has a VERY good point :)

Is 2008 over yet? please?

Nic Wise on December 31, 2008 3:56 AM

Conditional probability and Bayes' theorem.

What are the odds that person has a boy and a girl?
(the *usual* problem)

but combined with an extra information
...and one of them is a girl.

we have a different problem.

http://en.wikipedia.org/wiki/Conditional_probability#The_conditional_probability_fallacy

http://en.wikipedia.org/wiki/Bayes%27_theorem

Nikos on December 31, 2008 3:56 AM

What's wrong with the world!! It's a simple probability question. There are only 4 posibilities. One of 'em is a girl. So, you are left with the other three options which makes it 1/3.

Saj on December 31, 2008 3:56 AM

Breaking down the possibilities is a good approach, albeit everybody took the wrong turn at the first intersection. The possibilities have nothing to do with gender distribution or coin toss. They hinge entirely upon who the person you met is.

1. Normal person: Nobody in their right minds would say that they have two kids, one of which is a girl and mean anything other than I have a boy and a girl. They also wouldn't see B-G and G-B as two different options. Resulting figure: 100%.

2. Abnormal person: The kind that like to mess with other people's minds for no apparent reason. It would be fun in parties to follow up the initial statement with ...and the other is a girl too! haw haw haw! Figure made up on the spot: 28%.

3. Really abnormal person: The kind that like to tell lies for no apparent reason. They could actually have three boys (or no kids) and you couldn't be any the wiser. Figure range: 0%-100%.

4. Cyborg: They always tell the truth, but are very literal about it. They tend to enumerate the children/gender pairs one by one so the figure remains 50%.

PS. I could just say the question is wrong as asked and leave it at that, but I like to think I'd fall into the second category.

PPS. If you think cyborgs cannot have children, you are a discriminating technophobe and will answer to Skynet when the revolution comes.

Ishmaeel on December 31, 2008 3:58 AM

66%

Gullit on December 31, 2008 3:58 AM

66%

If you disagree you fail at bayes theorem and logic. Have a nice day.

Waffle on December 31, 2008 3:58 AM

I'm only interested in _if_ people who answered wrong will admit that they are wrong after the right answer is revealed. :-)

Zizzencs on December 31, 2008 3:59 AM

Damn typo mistake!

You are left with 2/3 indeed.

Saj on December 31, 2008 3:59 AM

@Practicality

Honestly, the answer 2/3 has been explained enough, that I just gave up. I hoped that would help to answer this debate, considering 2/3 is documenting in several of the textbooks on my bookself almost word for word.

Kieth on December 31, 2008 3:59 AM

@jammus -- you've convinced me. I agree, the question isn't an independent what is the probability of the first of the two children being a boy in the absence of all other information?. Knowing that one of the children is a girl changes the question (and the answer).

The first question would have an answer of:

GG - No
BB - Yes
BG - Yes
GB - No

= 50%

The question what probability of at least one boy, would be:

GG - No
BB - Yes
BG - Yes
GB = Yes

= 75%

COOL!!

John Rothlisberger on December 31, 2008 4:00 AM

OK, so there's this aeroplane and it's on this treadmill right...

jammus on December 31, 2008 4:00 AM

@jon Ericson

You still haven't removed bg. There is no way to say she doesn't have a teenage boy or a baby boy with his father.

Kieth on December 31, 2008 4:00 AM

Google/Yahoo also asks to compare yourself with a tree! Why the hell I'd compare myself with a tree???!!!

Zig on December 31, 2008 4:01 AM

The problem: What are the odds that person has a boy and a girl? can be reworded as What are the odds of having two children of opposite genders?

{BB, GG} vs. {BG, GB}

50%


pellea72 on December 31, 2008 4:01 AM

I notice a lot of people mention the following combinations:

BB
BG
GB
GG

Isn't BG and GB the same combo? That means there are only three possible combinations... right?

Luke on December 31, 2008 4:01 AM

Without a lot of thought, I'd say 66%

Having two boys is out, so your are left with 3 possibilities of which only 2 satisfies boy AND girl

But there may be some probability catch just because of how the question is presented (it can't be that easy)

Juan on December 31, 2008 4:02 AM

For all the people who are arguing semantics and questioning Jeff's motives, Jeff didn't make this problem up. This is a very well-known problem:
http://en.wikipedia.org/wiki/Boy_or_Girl_paradox#Second_question
http://www.physicsforums.com/showthread.php?t=233255
http://www.cut-the-knot.org/bears.shtml
http://mathforum.org/library/drmath/view/52186.html
http://www.cut-the-knot.org/carroll.shtml

The details differ from scenario to scenario, but the basic setup is always something like this: I have two WIDGETS. Each WIDGET is either BLACK or WHITE. At least one WIDGET is BLACK. What is the probability that the other WIDGET is WHITE? (Or the opposite question would be, What is the probability that the other WIDGET is BLACK?) For WIDGETS, you can substitute any object in the world that has a boolean property. For BLACK and WHITE, you can substitute some boolean property of whatever WIDGET you chose. It doesn't matter, as long as P(WIDGET is BLACK) = P(WIDGET is WHITE) = 0.5.

And, I am not listing those links as an appeal to authority. In fact, both answers (1/2 and 2/3) appear in those sources.

I am simply pointing out that the question has been asked before in many forms, so there's no need to wonder if it's a trick question, to question Jeff's motives, to dissect the semantics or to argue the real-world plausibility of the scenario.

If anything, Jeff should've written the question more clearly and precisely to avoid all of that, but too late for that, I guess.

BTW, if anyone is interested, here is a source which originally claimed the answer was 2/3, and has now revised its answer to 1/2:
http://www.quantdec.com/envstats/notes/class_04/prob_sim.htm#sibling

Will on December 31, 2008 4:02 AM

I think you can go two ways with this question, depending on what it says to you. Take these two different, but similarly-phrased questions, and see which direction your mind goes with them:

You met someone who told you they had two children. One of them is a boy and one of them is a girl. What are the odds that person has a boy and a girl?

You met someone who told you they had two children. Both of them are boys. What are the odds that person has a boy and a girl?

Do you answer the questions using different implied information, even though they're phrased the same way?

Matt Gibson on December 31, 2008 4:03 AM

@luke

That list shows that there are 4 equal possibilities. If you collapse gb and bg that now has a higher weight than the others.

Kieth on December 31, 2008 4:03 AM

@Nic Wise: You're wrong. You're not working out the probability of a single independent event - you don't know which child you're talking about, so you must consider both. The probability that the first child is born a boy is 50%. The probability that the second child is born a boy is 50%. The probability that ONE CHILD OUT OF TWO is a boy when you know that ONE OF THE TWO is a girl is not 50% - it is 66% as explained so patiently many times above. You have it exactly backwards.

Fred on December 31, 2008 4:05 AM

after seeing the wikipedia link, i'm going back to 2/3 since my card analogy is not quite correct. For the card analogy to work, it would have to be P[(first side = green and second side = red) or (first side = red and second side = green)] = 1/3 + 1/3 = 2/3

arturo on December 31, 2008 4:06 AM

@Zizzencs happy to. Of course, if I did admit it (or not admit it), that would reveal the answer. So....

Nic Wise on December 31, 2008 4:07 AM

no Bayes' theorem here: the first child is already a girl, so the chance that the second one will be a boy is not related

50% (or the orginal percentage of boy over girl)

Motocarota on December 31, 2008 4:08 AM

Here we go again, any bets on how many people we can get this time to insist that the answer is 2/3, and that anybody who disagrees with them is a moron?

P.S. You all should have learned this problem in your CS education, around the same time as you did Monty Hall.

pantsgolem on December 31, 2008 4:08 AM

All the children learned probability theory and forgot how to think normally! Why would you care if the first one is a boy or a girl..they didn't tell that their first child was a Girl, now did they? So, you have three choices:

Boy-Boy
Girl-Boy
Girl-Girl

One of 'em is a girl. So, drop the Boy-Boy option. How many you got now?

Saj on December 31, 2008 4:10 AM

For an intellectual blog about something as complicated as programming, there are a surprising number of blatantly wrong answers presented here. Oddly enough, they also seem to defend their argument the fiercest. Maybe a sign of the problems in our trade ?

J. Stoever on December 31, 2008 4:11 AM

@Kieth,

Jon Ericson explains it.

To put it another way: How you sample the data can bias the result.

David Stafford on December 31, 2008 4:11 AM

This post is going to be followed up by one about seemingly simple problems that are inadequately specified. The bold part at the bottom of the next post will read something like As developers we have the duty to seek out and understand the unspoken assumptions of our customers and fellow developers, to seek common ground, and HUGS!

This is similar to .999... == 1 and airplane on a treadmill debates, as mentioned in the Stack Overflow podcast.

Problems like this result in the kind of arguing above, people make an assumption about the spec and then cling to it while shouting that people who made the other assumption are crazy.

Aidan on December 31, 2008 4:12 AM

@fred. see previous comment :)

Nic Wise on December 31, 2008 4:12 AM

You! Sheldon Coopers of teh intertubes! One of them is a girl doesn't mean a frak about the other one.

Stop being such language nitpickers!

And have a happy year change.

maeghith on December 31, 2008 4:13 AM

Luke, the BG GB distinction is introduced only to demonstrate that the probability of one boy and one girl is 50% while the probability of two boys or two girls are 25% each.

BB - 25%
BG/GB - 50%
GG - 25%

Since BB is eliminated (at least one is a girl)

BG/GB - 50%/75% = 66.7%
GG - 25%/7% = 33.3%

Naturally, if the statement was the first is a girl it would be

GB - 25%/50% = 50%
GG - 25%/50% = 50%

Which is the question answered by most 50%ists.

Trevel on December 31, 2008 4:13 AM

@Isaac. You have been told that they have two children. Maybe you are TOLD that one is a girl but it is also possible that you SEE one child and that you SEE that that one child is a girl.

There is by the way also the possibility that that person isn't telling the truth.

Theo on December 31, 2008 4:16 AM

@Nic Wise: I have seen a lot of similar threads on various mailing lists/forums/discussion boards/etc. and there are always some people who do not accept they couldn't solve the problem.

BTW some statistics so far:

33% -- 3
45% -- 1
50% -- 10
66% -- 11
100% -- 5

I'm glad that probability theory doesn't work as statistics for this problem :-p

Zizzencs on December 31, 2008 4:16 AM

2/3, for reasons explained above (BB BG GB GG). To those that are saying order of BG or GB doesn't matter, or comparing it to a coin flip, you are incorrect. If the question was rephrased as

You met someone who has 1 child, a girl, and they are now pregnant. What are the odds that the new baby is a girl?

Now the answer is 50/50 because the event has not occurred. This is similar to the 99 heads question. Since the children have already both been born, the order does matter.

Matthew Truesdell on December 31, 2008 4:18 AM

I still haven't seen anyone give a good explanation why BG/GB are seperate cases. The questions does not ask about the order in which the children appear, only whether there is a girl and a boy (in whatever order and of whatever ages). To me, it makes just as much sense to consider the color of the children's eyes as to consider the order of the children.

Morten Christiansen on December 31, 2008 4:19 AM

This is not the Monty Hall problem. In MH, the hosts picks one of the two remaining doors after the player has picked one. The pick depends on what the player chose, or, in other word, the host can't decide which door to open before the player decides, because otherwise there'd be 1/3 chance that he'd pick the same door and that wouldn't work, would it?

Now, assuming that the odds of having a boy is 50% (for various biological reasons it's a little more, even though there are more women in the population, but women live longer), and assuming that this is not a semantic trick (you met someone who told you they had two children, and one of them is a girl is not the same as you met someone who told you they had two children, and THAT one of them is a girl), then the odds are 50%.

Are you doubting me?

Okay, try this little experiment. Change the question to: what are the odds that the children are both girls. Why should the probability be different?

NM on December 31, 2008 4:19 AM

it's either 50/50 or 2/3 depending on whether the parent picked the child they told you the sex of randomly or not.

If they picked it randomly and then said hey look - it's a girl then the probability of a boy being left is 50-50, as the picking of the first child was independent of the sex of the second child.

However, if they deliberately picked a girl to tell you the sex of, then they are skewing the probabilities in favour of leaving a boy behind, hence increasing the probability to 2/3.

Rhys on December 31, 2008 4:20 AM

100% No explanation needed. All the information is there.

jim maida on December 31, 2008 4:20 AM

It is both a boy and a girl until you see it.

Chambered on December 31, 2008 4:21 AM

It's not a probability question after all
I'd say the second kid is a boy for sure (100%), otherwise they'd have a third kid.

Peter on December 31, 2008 4:22 AM

@Morten,

For the explaination why the BG GB cases are different, see my answer above.

Niyaz PK on December 31, 2008 4:23 AM

Luke wrote: Isn't BG and GB the same combo? That means there are only three possible combinations... right?

This has been explained many, many, many times. BG and GB are listed separately because it's easier to do so and assign a 25% probability to each of them (same as GG and BB). If BG was treated the same as GB, you would have to assign a 50% probability to BG, which is slightly harder to explain. Of course, all of those probabilities are calculated without the constraint that one child is a girl.

Consider two independent coin flips (I don't care whether they are successive or simultaneous). There are 2 x 2 possible outcomes:
HH
HT
TH
TT

When the outcomes are listed that way (with HT and TH being distinct, even if I don't CARE which coin came up heads), then each outcome has an EQUAL probability of occurring. That way I can easily calculate the probability of {HT, TH} (1 H, 1 T, order isn't important) by counting the specified outcomes (2) and dividing by the size of the sample space (4), so the answer is 0.50.

In the same way, I can answer the question, What's the probability that at least one coin came up heads?. The answer is the size of the solution set {HH, HT, TH} (3), divided by the the size of sample space (4), or 0.75.

Now imagine we apply the faulty logic of combining the HT and TH outcomes and asking the question What's the probability of getting 1 head and 1 tail? (Notice I did not put any other constraints in the question, for simplicity's sake). If you do that, then you get:
TT
HH
HT/TH (Incorrect!)

And using the faulty math employed by many here, you would get 1/3 for your answer.

If you start combining outcomes (e.g. BG = GB), then you can no longer figure out probabilities by simply counting outcomes and dividing in this way.

Another way of looking at it is this: Just because we don't CARE which kid is a girl doesn't mean that BG is the same outcome as GB. It means we have to include both BG and GB in our solution set.

Will on December 31, 2008 4:23 AM

Theo and Matteo are both correct.

Chambered on December 31, 2008 4:23 AM

you met someone who told you they HAD two children, and one of them is a girl. What are the odds that person HAS a boy and a girl?

For me the way you phrased your question raises the question whether that person still has two children. However, English is not my native language so I might be totally wrong about this...

Thom on December 31, 2008 4:24 AM

I would say there's a 90% chance they have a boy and a girl. If both were one sex or the other, most people would say, We have two girls or We have two boys.

We had 3 boys, who are young men now. We always put that out front: We have 3 boys to which the reply would come God bless your wife. She must be a saint. She is. I need to brew the saint's coffee now. Bye.

Jeff Schwandt on December 31, 2008 4:24 AM

Monty Hall? But there aren't three doors.

So I say 50%. Just because one is a girl, doesnt mean exactly one is a girl.

Mr Bones on December 31, 2008 4:25 AM

Can't see any other answer than 2/3 assuming 50% split between boy/girl:

A person having 2 children has 3/4 chance to have at least 1 girl.

A person having 2 children has 1/4 chance to have 2 girls.

Chance of having only a girl given at least one girl:
chance of 2 girl / chance of at least one girl = (1/4) / (3/4) = 1/3

Chance of having a boy given at least one girl:
1 - chance of having two girls given at least one girl = 1 - 1/3 = 2/3


This is different from the question My first child is a girl, what gender will my next child be? then obviously the answer is 50%.

This is is the same as saying what is the chance of me having a boy as a second child, given that my first child is a girl

Possible outcomes for two children are BG GB GG BB. Chance of first being a girl is 1/2, chance of second being a boy if the first is a girl is 1/4.

So, chance of being a boy is
Chance of boy if first is girl / Chance of first is a girl = (1/4) / (1/2) = 1/2 as expected.

Christoffer Lern on December 31, 2008 4:26 AM

I'm with the 50/50 crowd, I do not for the life of me see why the order BG and GB should be two things. No mention of order was made just one of the two is a G what are the changes that the one left is a B? So I get to 50%.

Marthinus on December 31, 2008 4:28 AM

2/3. here is a proof everyone should be able to understand.

import java.util.Random;


public class Monte {

public static void main(String[] args) {
Random random = new Random();
int samples = 0;
int boySamples = 0;

for (int i = 0; i 1000; ++i) {
Sample sample = new Sample(random);
if (sample.hasGirl()) {
++samples;

if (sample.hasBoy()) {
++boySamples;
}
}
}

System.out.println(boySamples/(float)samples);
}

public static class Sample {
private Gender first;
private Gender second;

public Sample(Random r) {
first = nextGender(r);
second = nextGender(r);
}

private Gender nextGender(Random r) {
if (r.nextBoolean()) {
return Gender.Boy;
} else {
return Gender.Girl;
}
}

public boolean hasGirl() {
return first == Gender.Girl || second == Gender.Girl;
}

public boolean hasBoy() {
return first == Gender.Boy || second == Gender.Boy;
}
}

public enum Gender {
Girl, Boy
}
}

drscroogemcduck on December 31, 2008 4:28 AM

If this person lives in China, the probability is 0. He/she lied to you telling you he/she had two children. Please be careful speaking with people you don't know.

splattne on December 31, 2008 4:29 AM

I'd say 50%. When we hear that the person has two children, the probability is 33%, as we don't know anything further, so it could be GG, BB, or GB. However, with the revelation of the fact that one is a girl, that changes everything and the possibilities are now GG or GB, making the probability of a GB combination 1/2, or 50%.

DH on December 31, 2008 4:30 AM

BTW, this puzzle reminds me this other one:

The three door puzzle is an interesting and unusual probability question. Here's how it works. You are a contestant in a game show, and the game show host tells you there is a prize behind one of the three doors you face. You have to guess which door to open.

But when you make your guess, instead of opening the door you picked, the game show host opens a different door...one that he knows has nothing behind it. So now you're down to two doors. And the game show host says, I'll let you change your choice, if you want to.

And the question is, do you change your guess? Or keep your original choice?

Solution here: http://www.theproblemsite.com/treasure_hunt/door_hint.asp

splattne on December 31, 2008 4:31 AM

Here's another variation on the question to help put away those silliness about not being 50%:

Your pet cat just gave birth to 10 kitten. You find out that at least 9 of them are female, but the 10th ran away before you could examine it. What is the probability that the 10th is a boy?

Now your pet rat just gave birth to 10 little rats. Your neighbour is holding 9 of them in her hands, she knows their gender but she won't tell you. You're going to inspect the 10th. What are the odds that it's a boy?

Wait! Before you have a chance to look, she tells you the surprising news: they're all girls! Have the odds changed?

Another one: you organize a costume party for your kid's birthday, he's turning 6. All the kids wear mask. One of the parents introduces herself as the mother of John. Or did she say Joan? You're not sure. She mentions she has two kids. You really can't tell if Joan or John is a boy or a girl, with the mask and all. What are the odds that her/his sibling is a boy? A girl?

She tells you John is, in fact, a boy. What are the odds now? Did they change?

Wait! She actually meant that Joan acts LIKE a boy. What are the odds?

NM on December 31, 2008 4:35 AM

@DH:
If you know someone has two children, there is a 50% chance they have a boy and a girl (ignoring order), a 25% chance they have two boys, and a 25% chance they have two girls. Your initial 33% figure is mistaken.

P(FirstBornSon) = 0.5
P(SecondBornSon) = 0.5
P(TwoSons) = 0.5 * 0.5 = 0.25

Fred on December 31, 2008 4:37 AM

According to Dr. House, everyone is lying. So i have to assume that this person told me nothing truthful about the sex of his two children.

Hence, the odds that this person has a boy AND a girl is:

GG - Possibly
BB - Possibly
BG or GB (order is irrelevant) - Possibly

In conclusion: the probability of that person having a boy and a girl would be 33%. But since you also can not rely on the person being truthful about the number of kids he has, we have to assume that the odds of this person having a boy and a girl can only be deduced from population statistics and the average odds of any one person (of which we know nothing in particular, not even his/her sex) having two kids of which one is a girl and one is a boy.

Hence the solution is beyond our reach and we can only come up with a statistic probability, or an estimate. The only thing you can certainly say is that the chance must be less than the percentage of people having exactly two kids in the first place.

steffenj on December 31, 2008 4:38 AM

Here's why it's NOT 50% :
If the FIRST one were a girl, the probability that the second is also a girl is 50%.

HOWEVER that's not what the problem says! There are already TWO children, and the parent gets to see the end result before responding. The parent has more information than you do (which is not the case in all these coin toss scenarios people keep making up).

So, since the probabilities of the four scenarios are equal, BUT knowing that the selection of the first child is BIASED by the parent toward girls, this actually biases the remainder towards boys.

answer: 2/3

sep332 on December 31, 2008 4:39 AM

Two ways of looking at this:

1) Since we know one of two kids is a girl, there are two options: They have Boy/Girl or they have Girl/Girl. Ergo, chance of Boy/Girl is 50%.

2) When having two kids, one of four scenario's can happen: GG, GB, BG and BB. We know one child is a girl, so it was either GG, GB or BG, two of which contain a B, so it's 2/3, or ~66%.

I'm leaning towards 2), but couldn't articulate why 1) would not be a completely valid way of treating the problem.

@NM:
Change the question to: what are the odds that the children are
both girls. Why should the probability be different?

Because when you have two kids, you have 50% of having a boy and a girl, 25% of having two boys, and 25% of having two girls.


Jeroen on December 31, 2008 4:40 AM

Here are two more questions:

You meet a woman who tells you that she has two children. Being a logician and fond of puzzles, she is quite precise in her wording and tells you that one or more of her children is a girl. What is the probability that the other is a boy?

You meet a woman who tells you that she has two children. Being a logician and fond of puzzles, she is quite precise in her wording and tells you that the eldest child is a girl. What is the probability that the other is a boy?

Do you get the same answer for each?

Note: assume 50-50 chance of boy/girl birth to keep simple.

Charles Darke on December 31, 2008 4:41 AM

Now here's a question:

What is Jeff up to given he has managed to distract 150K+ developers on new years eve (tho, if you happen to be in New Zealand (and shortly Australia), it's happened)??

Is this what he does when he needs a window to redeploy stackoverflow or something?

Bait-and-switch, people. Bait and switch.

Nic Wise on December 31, 2008 4:44 AM

@drscroogemcduck,

Your program is wrong!!!

You have not included the most important information in the problem in your program.

told you they had two children, and one of them is a girl

He told that one of them is a girl.

The question is not about the probailty of having one girl and one boy.

The question is about the probability of having one girl and one boy after the guy told you one of the children is a girl.

Does the fact that he TOLD this change the probabilty?

YES!!!!

That is the beauty of this question.

Niyaz PK on December 31, 2008 4:45 AM

We can consider that conceiving two children are independent events (this is not valid for twins), thus means that there is no correlation between one conception and the other conception. :P

So the probability of the other child to be a boy is the same probability of having a boy. It doesn't matter if we know if he has 2 or 22 children.

In ststistics everything relies on HOW we ask a question. It is not the same if we ask wich is the prob. of having 3 girls than if we ask which is the prob. of having 2 girls the third is also a girl.

Happy new year!!

jaume on December 31, 2008 4:48 AM

If they said one of their children is a girl, doesn't necessarily mean the other is not a girl. Therefore, since we know one of them is a girl, there is a 50% chance they have one girl and one boy (or whatever the scientific percentage is for boy vs. girl).

Jeff Layton on December 31, 2008 4:49 AM

Another way to think about this:

Suppose these people have 1000 children, and you know ONE of them is a girl. What is the probability ALL the other ones are girls? That's pretty minuscule, right? So what is the probability the remaining 999 are about evenly split between boys and girls? That's a lot more likely! So intuitively, 50/50 distributions are more likely. This holds true, even when you only have 2 kids.

The same method helped me understand the Monty Hall problem: Suppose there's 1000 doors, you pick one, and then Monty opens 998 doors, leaving only your original pick and one other door closed. Should you switch? Hell yeah, because the chance that you initially picked the right door was so small.

Jeroen on December 31, 2008 4:49 AM

Ok,

I'm going for 50%*, and here are my reasonings:

There are actually 6 combinations (if we are giving each combination equal probablility):

B1-B2
B2-B1
G1-G2
G2-G1
B-G
G-B

Note that we've doubled the B-B and G-G combinations to take account of order, in the same way that we take account of order in the B-G cominations.

So we've ruled out the B-B combinations and are left with:

G1-G2
G2-G1
B-G
G-B

half of these have a Boy AND a Girl.

Another (possibly more intuitive) way of explaining it: the second child is independent of the first, and has a 50% change of being a Boy.

-Perros-

*For all my calculations I'm assuming the following:
- Boys and Girls have a 50/50 split.
- The fact that they've told us that one is a girl doesn't implicitly state that the other is a boy.

Perros on December 31, 2008 4:50 AM

33%

labilbe on December 31, 2008 4:51 AM

Mathematically it is 2/3, as others have explained. But as someone said one of my children is a girl and we can assume that someone is not a Cmdr. Data of some kind, we can probably assume the percentage is higher - close to 100%

Daniel Lehmann on December 31, 2008 4:51 AM

The answer depends on what 'distribution' of two-child families you assume you're sampling from, which in turn depends on how you interpret the information 'one of the children is a girl'.

The possibile interpretations of this statement are:

1) The parent is saying that *only* one of the children is a girl - the distribution is {gb, bg} - the probability of a boy is 100%

2) The parent randomly selected one of their children, and told you what sex it was (it just happened to be a girl) - the distribution is {gg, gg, gb, bg} ('gg' is counted double because 'gg' parents would make these 'one girl' statements twice as often as each of the 'bg' and 'gb' parents) - the probability of a boy is 50%

3) The parent is effectively answering yes to the specific question 'do you have at least one girl'? - the distribution is {gg, bg, gb} ('gg' only counts once here because parents with two girls wouldn't answer yes to this question 'more often' the 'bg' or 'gb' parents) - the probably of a boy is 2/3

Of course, if you reckoned that either one of these interpretations might actually hold, with probabilities p1, p2 and p3, then you could estimate the the total probability of a boy as p1 + p2 * 1/2 + p3 * 2/3.


Henry Buckley on December 31, 2008 4:51 AM

You guys are only considering the case of two kids!

What if someone has five boys and one girl? Wouldn't that also work? That person has a boy and a girl.

For only two kids: As others pointed out:

BB
BG
GB
GG

Thus with two kids, there is a 50% chance in combinations that there is one boy and one girl. As for Charles' question:

We know at least one child is a girl, therefore we can throw out the BB combination:

BG
GB
GG

Thus, the odds are 2/3 that she has one boy and one girl. If she specified a particular child (the one on the left is a girl), the odds change again since we can throw out the BG combination since the Boy is on the left:

GB
GG

Thus, it is a 50% chance that each child is of a different sex.

Of course, all these assume that a boy or girl is a 50% chance. If we say that a child has a 55% chance of being a girl and only a 45% chance of being a boy, the odds must be adjusted.

David W. on December 31, 2008 4:52 AM

One other thing: Statistical reasoning becomes fundamentally and utterly DIFFERENT depending on whether you're asking what the odds are something WILL HAPPEN, or whether something HAS HAPPENED.

Jeroen on December 31, 2008 4:52 AM

@Jeff Layton:
You're right, there is a 50% chance they have a boy and a girl. The point is that by saying they have a girl, they eliminate from consideration the 25% chance that they have two boys. The probability of a boy and a girl is now 50% / (the new total probability of) 75% = 2/3.

Fred on December 31, 2008 4:53 AM

Jeff,
what is the answer? we are all going crazy here!
firstly, the guy who mentioned conditional probability,
well, that is a crock of... gender of one has no influence
on the other. the are called mutaully exclusive events.
so bayes theorem doesn't fly.
leaving aside the grammar, the chances are clearly 50%.

now jeff, be a good daddy to be and tell us all what you think
is the answer because clearly there isn't one.

jake on December 31, 2008 4:53 AM

«Back | More comments»

The comments to this entry are closed.