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?**
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 [1] or something.
“Coding Horror: The Problem of the Unfinished Game [2]”
That, and the follow-up post [8], plus a few threads on various commentary sites can be summed up with the following result:
The odds are 1/2, except, of course, when it's 2/3.
A lot of virtual ink has been spilled over this, but I think I have this down now. I wrote a program to simulate this problem and doing so has clarified the result (nothing like picking a few million pairs of virtual kids and seeing actual numbers).
It goes like this. Assume a spherical cow [9] … oh wait, wrong problem. Assume an even 50% chance of having a boy or a girl. Take 100 families with two kids. There are four cases to contend with, boy/boy (25%, or 25 out of a 100 families), boy/girl (25%, or again, 25 out of 100 families), girl/boy (25%) and girl/girl (the remaining 25%). But in three of the four cases (75%) there is at least one girl. And out of those 75 families, 50 of them (or 66% of 75, or 2/3) will have a boy.
And thus, that's how we end up with 1/2 of a 2/3 spherical cow.
[1] http://www.codinghorror.com/blog/archives/000850.html
[2] http://www.codinghorror.com/blog/archives/001203.html
[3] http://www.codinghorror.com/blog/archives/001203.html
[4] http://www.codinghorror.com/blog/archives/001204.html
[5] http://www.reddit.com/r/programming/comments/7msca/coding_horror_fini
[6] http://news.ycombinator.com/item?id=415416
[7] http://news.ycombinator.com/item?id=416402
[8] http://www.codinghorror.com/blog/archives/001204.html