Steven Landsburg at the Big Questions posted and answered this frequently-asked math puzzle:
There’s a certain country where everybody wants to have a son. Therefore each couple keeps having children until they have a boy; then they stop. What fraction of the population is female?
This is an interesting puzzle because as you proceed from an initial reaction to naive arithmetic to a more rigorous mathematical calculation, you get different answers. The initial gut-level reaction, without doing any sort of analysis, is that the fraction would be way less than 50% because everyone has a boy, or it would be way more because people continue having girls.
If you do a little rudimentary calculation, you find out that this assumption is wrong and it looks like the ratio is 50:50. A back-of-the-envelope calculation would go like this: Suppose you have 16 families and you start calculating what happens at each step.
8 families have sons and stop; the rest have daughters. Total = 8 sons, 8 daughters.
Of the remaining 8 families, 4 have sons, 4 have daughters. Total = 12 s, 12 d.
Of the remaining 4 families, 2 have sons, 2 have daughters. Total = 14 s, 14 d.
Of the remaining 2 families, 1 have a son, the other a daughter. Total = 15 s, 15 d.
So, it seems that at each step, the ratio remains 50-50. And you can repeat this for larger numbers and still get similar results for each step. Unfortunately, there is a mistake here, which is that we don’t think what happens to the last family that has a daughter and will want to continue having children until they have a boy.
When you consider that family, there is a 50% chance that they will have a son or a daughter. So that initially seems to make no difference to the overall 50%. But the problem is that while half of the remaining possibilities is a son (dead end), the other half of the remaining possibilities include 1 or more daughters and a son. Which means that there is more than 50% probability of having a son for the last family.
If you take one family, this makes a huge difference to the overall probability.
50% chance that there is a boy. (Stop)
25% chance that there is a daughter and then a boy. (Stop)
12.5% chance that there are 2 daughters and then a boy. (Stop)
… and so on.
Adding this up, you get roughly around 31% for girls.
But when there are more families, this effect decreases. You can see the mathematical discussion at Math Overflow. Suffice it to say, that as the number of families approaches infinity, the ratio approaches 50-50. When you talk about “countries”, a country with a population of 1 million (which should be a reasonable enough estimate) yields a fraction of 49.999975%. Even a country with only 1000 families yields 49.975%.
So, for all practical purposes, the ratio is 50:50. And that apparently is the “officially correct” answer in Google interviews. I think that is right if your intention is to evaluate the candidate’s logical thinking as supposed to mathematical skills that includes an understanding of probability theory. Because the question, as phrased, contains several problems that lead to misunderstanding:
- The use of the “country” term. Everyone associates countries with large populations. So instead of using 1 or 2 families as a starting point for the solution, they use larger numbers which using the generation-step calculation show a 50% result while reducing the effect of the last family’s possibilities.
- Human beings die and do not have unlimited number of children.
- Despite the question specifically stating otherwise, people also tend to assume that people stop having children at some point and they apply this assumption to the last family. Or even if they don’t, they use the 50% probability of having a son and a daughter for the next step with a single family, which is where things go wrong.
A more mathematically correct question may phrase it as:
Assume you have 4 coins. The probability of a head or a tail coming up is the same. Toss each coin until a head comes up. What is the probability of observed tails?
This takes out the population, mortality and fertility problems out of the question and casts it as a probability problem. Of course, that also removes the “trick”, if you want people to recognize that it is indeed something that needs to use probability theory. But if you are interested in helping people learn, that is the way to go.
Which brings me to Landsburg’s conduct. He posted the question, and then claimed that the 50% answer was totally wrong, when in reality, it is only way off for small values of the number of families and then approximates 50%. He then provides a misleading example that confused many of his readers:
let me tell you about the families who live on my block. There are 3 families with four girls each (and no boys), and one family with 12 boys (and no girls). Altogether, that makes 12 girls and 12 boys — equal numbers! On average, each family has three girls and three boys. Nevertheless, the fraction of girls in the average family is not 50%. It’s 75% (the average of 100%, 100%, 100%, and 0%).
This example violates the rules of the original problem (not more than 1 boy, etc.) But what was particularly problematic was that it introduced the concept of “the fraction of girls in the average family” as opposed to “the fraction of girls in the overall population and please remember the number of families matter“. Not only is the former concept easy to check manually, it is also easy to see the ratio being different working it out in the generation-step method. So many Landsburg readers spent an enormous time arguing this in the comments section, specifically pointing out the numbers in this example. Landsburg, unfortunately, failed to understand this and worsened the situation by using the “countries” and “families” terminology in very confusing ways. Only when you understood what he was talking about and realized that the example was related to the problem only with respect to the statistical principle, things made sense.
A better example would have been as follows:
Consider 4 families following the rule. Let’s consider one possibility: B, B, GB, GGB -> 4 sons, 3 daughters. Another possibility is: B, B, GB, GGGB -> 4 s, 4 d, or B, B, GB, GGGGB -> 4s, 5d. You can therefore see that even though the probability of having a daughter is 50%, the actual set of completed families may have a different fraction of daughters. Now what would happen if we considered all the possibilities and used the probability of their occurrence. We would find that the fraction of daughters is less than 50%. (see detailed math, etc.)
I don’t think one example with different families would cut it. The example you need is the same set of families under different conditions.
Anyway, finally Landsburg ends with a challenge explaining that he is right and he can prove it via a simulation. There are all kinds of problems with this approach. Above all, this is math, not science – it is not a theory that has to be proved empirically. Either your answer is right or wrong, and if it differs from someone else, there is a mistake in interpretation or understanding of the solution.
My feeling is that Landsburg felt that he had hit upon something counter-intuitive like the Monty Hall problem which many people get wrong. But this particular puzzle is not that sophisticated and the common answer is approximately correct and only significantly wrong for a smaller number of families. All in all, a big fail in helping people appreciate and understand math.