
Coding Horror: Finishing The Game - Anon84
http://www.codinghorror.com/blog/archives/001204.html
======
fhars
The question is ill posed, because the anwser is highly dependent on how the
couple told you that they have one girl.

If they tell you "we have two kids", you ask them if at least one of them is a
girl and they answer "yes", then indeed the probability of the other kid
beeing a boy is 2/3.

If they tell you "we have two kids, and one of them is a girl", then by all
rules of rational discourse the probability for the other kid being a boy is
1.

Things start to get interesting if the talking member of the couple is a
mathematician (so the rules of ordinary discourse do not apply) and he says
"We have two kids, and at least one of them is a girl". Now you might say that
this is equivalent two the first case. But you could also go bayesian and look
at the possible conversations with couples containing at least one
mathematician that have two kids. Say you have 100 couples. On average, 25 of
these will have two boys and tell you "We have two kids, and at least one of
them is a boy", another 25 will have two girls and tell you "We have two kids,
and at least one of them is a girl". The remaining 50 couples will have one
boy and one girl. Assuming no gender bias on behalf of the speaking
mathematician (ha!), 25 of these will tell you "We have two kids, and at least
one of them is a boy", while the remaining 25 will say "We have two kids, and
at least one of them is a girl." So out of the 50 couples that tell you "We
have two kids, and at least one of them is a girl," 25 will have two girls,
and 25 will have a boy and a girl. So in this case, the correct answer is 1/2.

(This is essentially the argument from the intro on this page that was linked
from the discussion on coding horror:
<http://www.overcomingbias.com/2008/10/my-bayesian-enl.html> )

~~~
brfox
Yes! Here is more agreement:

[http://paulbuchheit.blogspot.com/2009/01/question-is-
wrong.h...](http://paulbuchheit.blogspot.com/2009/01/question-is-wrong.html)

(and also my own comment from earlier:)
<http://news.ycombinator.com/item?id=416576>

------
brfox
I think that people are debating between 3 choices: (a) 100% chance that there
is a boy and girl, (b) 2/3 chance that it is a boy and a girl, or (c) 50%
chance that it is a boy and a girl.

It depends very much on the exact wording of the problem.

Like many people in the comments of Jeff's post said that if the person says
that "one of my kids is a girl," then common sense makes it sound like ONLY
one kid is a girl and the other must be a boy (case a).

If the question is worded precisely like question #2 in this wikipedia
article: <http://en.wikipedia.org/wiki/Boy_or_Girl#Second_question> (where you
have a population of families and you randomly pick a family which has a
girl), then you use the Bayesian approach to conclude that there is a 66%
chance that the other kid is a boy (case b).

Finally, I think that for case c, if you are just walking around and you're
not specifically looking for a family with a girl, and you strike up a
conversation and you hear that the person randomly decides to talk about his
daughter, then I think the odds are 50% that this person's other kid is a boy.
This is because you did not require that you choose a family with a specific
gender (like in the wikipedia #2 scenario). First you picked a person to talk
to, and then this person just happened to mention he had a daughter.
Basically, we did not require that the person has a girl (case b), we only
learned that he has a girl (case c).

~~~
brfox
[http://paulbuchheit.blogspot.com/2009/01/question-is-
wrong.h...](http://paulbuchheit.blogspot.com/2009/01/question-is-wrong.html)

------
pchristensen
Sorry Jeff, I understand the problem, but the language of the setup was wrong.
Since a _PERSON_ told you they have one girl, the GB and BG are equivalent and
collapse to one case instead of two _in the way that normal people talk_.

If you had said that a mathematician or a statistician said they have one
girl, that would be a different story.

~~~
barrkel
I don't think you do understand the problem. The thing you're taking issue
with - GB vs BG - is the vitally important to the statistics, and is the thing
that "normal" people get wrong when they see this kind of problem for the
first time.

The only real objection to the problem as it's posed is that it's pretty
unlikely that anyone would say that one of their children was a girl when both
of their children are girls. For a normal conversation, the ambiguity wouldn't
be present; "two children" combined with "one is a girl" means the chances of
one boy and one girl are 100%.

It's a bit like the old joke about "which month of the year has 28 days?" -
answer being, they all have 28 days, just some have more.

However, in other less contrived situations, this is important. People risk
discounting permutations, and only considering combinations, when the
permutations are necessary to get a correct view of the odds.

~~~
seano
His point is that a person telling you they have one girl would be accepted as
referring to a particular child. Thus, BG and GB merge and the odds are 50% of
a boy and a girl.

~~~
DougBTX
Pedantically, they don't merge, you just rule out GB or BG. So, initial
conditions:

    
    
        1) X: G, Y: G
        2) X: G, Y: B
        3) X: B, Y: G
        4) X: B, Y: B
    

If you are told, "at least one is a girl," as in the posted question, you can
only rule out case (4). If you are told more specifically that X is a girl,
you can rule out (3) and (4), giving the 50-50 chance.

Which still seems a little weird to me, that knowing which is a girl,
regardless of which one you know about, changes the chances.

~~~
seano
Exactly - the difference is between "at least one is a girl" and pointing out
a specific child as a girl.

------
spolsky
Jeff didn't phrase the question carefully enough. In English if you say, "I
have two children, one is a girl" that CANNOT mean both are girls. If both
were girls you would never say that. Saying you have 1 girl implies that you
have 1 boy. Or maybe 1 girl and one hermaphrodite.

100% was the right answer.

It's easy to get people to argue when you give them an almost-ambiguous word
problem; they're not arguing about the math, they're arguing about the mapping
from ambiguous words to math.

~~~
dinosaur
I don't agree; Jeff was not giving a quote. Instead it is just the relevant
information abstracted from whatever the person said. By choosing the quote
you did, you have added more information to the problem (at least when reading
it with conversational English).

I think this would be a better quote of what the person might have said:"Both
of my kids are driving me crazy! Just yesterday I had to pick one of them up
from the police station--I grounded her for a month!" Pulling out the
information corresponding to gender and family size would give only the
information given in Jeff's post.

When applying math to the real world, you have to pull out the important
information and deal with just that information. But here you are doing the
opposite--trying to find a real world situation that applies to the math
problem. In my opinion, your example does not quite apply.

(I don't know how the probabilities change when you account for
hermaphrodites, but if it changes significantly enough so that approximately
66% is a bad answer, I would find that very interesting!)

~~~
seano
"Both of my kids are driving me crazy! Just yesterday I had to pick one of
them up from the police station--I grounded her for a month!" - given just the
information in your quote, the odds are 50% of a boy and a girl.

~~~
dinosaur
Can you give me your reasoning? I think the only conclusions you can get from
that quote is that the person has two children, and at least one of those is a
girl. Do you disagree with that?

If I am correct about that, then it matches the conditions discussed in the
article and the answer would be 2/3 for a boy and a girl.

~~~
seano
The difference is that you have specified that the child picked up from the
police station is a girl, thus only the sex of the other child is unknown.
This other child is either a boy or a girl, presumably with a 50/50 chance
either way, resulting in a 50% chance of one being a boy and one being a girl.
Concretely, using a capital letter to denote the sex of the child picked up
from the station, there are only two possible permutations Gg and Gb, each of
equal probability, and 50% of those are girl and boy (Gb). On the other hand
if we only know that at least one is a girl we have the permuations, gg, gb,
bg - resulting in the 66% chance.

~~~
DougBTX
How much do you need to know about the person to know which child is which?

I don't quite understand it, but apparently anything which can be used to
distinguish the children will do.

Possibilities with two children:

    
    
        Gg, Bg, Gb, Bb
    

If one of them has a distinguishing mark, they have an apostrophe: (in jail,
has red hair, or born first)

    
    
        G'g, B'g, G'b, B'b, Gg', Bg', Gb', Bb'
    

Then note that the marked one is a girl:

    
    
        G'g, G'b, Gg', Bg'
    

So, there is a 50% change that the children are a boy and a girl. Only if
there is no way to distinguish them, do you get the 66% behaviour, where the
set is:

    
    
        Gg, Bg, Gb

~~~
seano
No, that is not it. With G'g and Gg' you are repeating the same permutation in
your set above!

It makes no difference if they have distinguishing marks or not. It matters if
you are told that a particular child is a girl (50%) or if you are only told
that at least one child is a girl (66%).

~~~
DougBTX
How can you be told information about a particular child if you have no way to
distinguish them?

I partially understand your point about G'g vs Gg' now: if having a prime is
the only way to distinguish the children, then G and g must be
indistinguishable, so G = g.

~~~
seano
Think about it this way: I take two coins out of my pocket and hold them
inside my hand so that neither of us has seen them. I show you the coin in my
left hand and you see that it is tails, what are the odds of the coin in the
other hand being heads? 50%. This is the chance of a head/tail combo in this
case.

I now put the coins back into my pocket, shuffle them about, and again take
them out inside my hands. This time I look inside both my hands, not letting
you see, and tell you (truthfully) that at least one is tails. Given that
information, you can deduce three mutually exclusive possibilities each of
equal probability - both are tails, only the coin in my right hand is tails or
only the coin in my left hand is tails. Hence we have the odds in this
situation of 2/3 for a head/tail combo.

It is easy to see that the first situation is akin to knowing that a
particular child is female, whilst the second is akin to knowing that at least
one of the children is female. Also, in either case it does not matter if the
coins are distinguishable - one could be a euro and the other a pound.

------
lyesit
Saying "A person has two children, at least one of which is a girl. What is
the probability that both of the children are girls?" would more clearly
explain the problem.

------
snowbird122
This kind of problem comes up all the time in a poker tournament. Each person
has a different number of chips in front of them, and when they reach the
final table, since so much money is at stake, they want to make a deal. How do
you determine a fair deal when each person has a different number of chips and
prizes are radically different for first, second, and third place. Fun
problem. Answer: The independent chip model

Gambling to the rescue

~~~
raganwald
It is very clearly mirrored in backgammon theory, where touneament players
memorize "match equity" tables and use them to govern their use of the
doubling cube.

------
pfedor
This can be used as a warm-up question for another fun problem (which a friend
of mine was asked during a phone screen for a position at DE Shaw): What if
instead of telling you that they have two children at least one of them a
girl, someone told you that they have two children at least one of them named,
say, Linda? The assumption is that there are no boys named Linda, that the
likelihood for a girl to be named Linda is not affected by having an older
brother or sister, etc. It's not a trick question, nor a sociological problem
requiring any knowledge about names, it's a purely mathematical puzzle. And,
as you may have guessed, the solution is not the same as in the previous case
(with two children at least one of them girl).

~~~
vlad
I'm not sure what you mean. Is the question still the same? Then why wouldn't
the result be 2/3rds in either case?

~~~
pfedor
It is not the same question, they only seem that way. The information given is
different. The answer in the second case depends on the popularity of the name
Linda.

------
ynd
# The hard part: THIS IS AN 'A POSTERIORI' PROBLEM.

# The fact as ALREADY happened.

# BG/GB being DIFFERENT is NOT THE TWIST.

# Whether they are or not it will amount to 50% total.

# TWIST: BB is not possible.

    
    
      def boy_girl_problem():
        from random import choice
    
        families = {}
        for i in range(1000):
          families[i] = []
          families[i].append(choice(['BOY', 'GIRL']))
          families[i].append(choice(['BOY', 'GIRL']))
      
        had_both_sex = filter(lambda f: set(f) == set(['BOY', 'GIRL']), families.values())
        had_two_boys = filter(lambda f: 'GIRL' not in f, families.values())
    
        return len(had_both_sex) / float(len(families) - len(had_two_boys))
    

# average(boy_girl_problem) == 2/3

~~~
ynd
# Here's a less crude rewrite

# It reflects conditional probability better

    
    
      def boy_girl_problem():
        from random import choice
    
        families = {}
        for i in range(1000):
          families[i] = []
          families[i].append(choice(['BOY', 'GIRL']))
          families[i].append(choice(['BOY', 'GIRL']))
      
        had_both_sex = filter(lambda f: set(f) == set(['BOY', 'GIRL']), families.values())
        had_one_girl = filter(lambda f: 'GIRL' in f, families.values())
    
        return len(had_both_sex) / float(len(had_one_girl))

------
oscardelben
Interesting theory, I'd never thought of every possibility, especially in this
context, where we are talking about a person, I was thinking about human
psychology or behavior when I first read that article.

------
chime
URGH! I just lost :(

~~~
chime
Aw come on... I was just following Rule#3:
<http://en.wikipedia.org/wiki/The_Game_(mind_game)>

