# Google question: In a country in which people only want boys [closed]

Hi all!

Google published recently questions that are asked to candidates on interviews. One of them caused very very hot debates in our company and we're unsure where the truth is. The question is:

In a country in which people only want boys every family continues to have children until they have a boy. If they have a girl, they have another child. If they have a boy, they stop. What is the proportion of boys to girls in the country?

Despite that the official answer is 50/50 I feel that something wrong with it. Starting to solve the problem for myself I got that part of girls can be calculated with following series:

$$\sum_{n=1}^{\infty}\frac{1}{2^n}\left (1-\frac{1}{n+1}\right )$$

The official solution is:

This one caused quite the debate, but we figured it out following these steps:

• Imagine you have 10 couples who have 10 babies. 5 will be girls. 5 will be boys. (Total babies made: 10, with 5 boys and 5 girls)
• The 5 couples who had girls will have 5 babies. Half (2.5) will be girls. Half (2.5) will be boys. Add 2.5 boys to the 5 already born and 2.5 girls to the 5 already born. (Total babies made: 15, with 7.5 boys and 7.5 girls.)
• The 2.5 couples that had girls will have 2.5 babies. Half (1.25) will be boys and half (1.25) will be girls. Add 1.25 boys to the 7.5 boys already born and 1.25 girls to the 7.5 already born. (Total babies: 17.5 with 8.75 boys and 8.75 girls).
• And so on, maintianing a 50/50 population.

Where the truth is?

• As is almost always the case with these sorts of things it's not that "the usual explanation is wrong" or anything, it's simply that the question is ambiguously stated. – Kevin Buzzard Mar 12 '10 at 11:10
• The answer to the question "what is the proportion...?" is "it's whatever the proportion is". The question should perhaps say something like "what is the average proportion" and this is ambiguous already. Imagine for example there were just 1 boy-girl family, and they produced offspring until they got a boy and then stopped. Then the proportion #boys/#girls is 2/1 with probability 1/2, 2/2 with probability 1/4, 2/3 with probability 1/8,... , meaning the "average proportion" is something like 1.386... . Now people will say "well that's not what the question meant" and that's exactly my point. – Kevin Buzzard Mar 12 '10 at 11:40
• @tom: if you look at the question here, clearly the sum I've done is what the questioner does more formally above. The issue is how one works out an "average proportion"---is it "average # boys" / "average # girls" or is it "average of #boys/#girls". These are visibly going to be different. There may be other ambiguities too. It's always the same with these sorts of questions. I'm tempted to vote to close as not a real question. – Kevin Buzzard Mar 12 '10 at 11:47
• @Chris: The question is "interesting" in the same way that the Monty Hall problem is "interesting", and the question is generating a lot of noise, just as Monty Hall always does. @Douglas: I will happily accept that you are highlighting a different issue with the question. – Kevin Buzzard Mar 12 '10 at 14:23

The proportion of girls in one family is a biased estimator of the proportion of girls in a population consisting of many families because you are underweighting the families with a large number of children.

If there were just 1 family, then your formula would be wrong, but the average of the percentage of girls you would observe would be

$$\sum_{n=0}^\infty \frac{1}{2^{n+1}} \bigg(\frac{n}{n+1}\bigg) = 1-\log2 = 30.69\%.$$

Half of the time, you would observe $0\%$ girls.

If you have multiple families, the average of the observed percentage of girls in the population will increase.

For 2 families, the average percentage of girls would be

$$\sum_{n=0}^\infty \frac{n+1}{2^{n+2}} \bigg(\frac{n}{n+2}\bigg) = \log 4 - 1 = 38.63\%.$$

More generally, the average percentage for $k$ families is

$$\sum_{n=0}^\infty \frac{n+k-1 \choose k-1}{2^{n+k}} \bigg(\frac{n}{n+k}\bigg) = \frac{k}{2}\bigg(\psi(\frac{k+2}2)-\psi(\frac{k+1}2)\bigg)$$

where $\psi$ is the digamma function which satisfies

$$\psi(m) = -\gamma + \sum_{i=1}^{m-1} \frac1i = -\gamma + H_{m-1}$$ $$\psi(m+\frac12) = -\gamma -2\log 2 + \sum_{i=1}^m \frac{2}{2i-1}.$$

With a little work, one can verify that this goes to $1/2$ as $k\to \infty$. So, for a large population such as a country, the official answer of $1/2$ is approximately correct, although the explanation is misleading. In particular, for $10$ couples, the expected percentage of girls is $10 \log 2 - 1627/252 = 47.51\%$ contrary to what the official answer suggests. With $k$ families, the expected proportion is about $1/2 - 1/4k$.

It is not enough to argue that the expected number of boys equals the expected number of girls, since we want $E[G/(G+B)] \ne E[G]/E[G+B].$ Expectation is linear, but not multiplicative for dependent variables, and $G$ and $G+B$ are not independent even though $G$ and $B$ are.

• This is really nice! I voted to close because this is an old chestnut, but you have found new life in it. – David E Speyer Mar 12 '10 at 14:10
• You've changed the question by assuming that the population (i.e., the set of births whose G/(G+B) we are interested in) is a union of families that have stopped reproducing. All we know is that in $k$ families, some number $n$ of births have occurred through time $t$, each birth equivalent to a fair coin toss. This of course implies a symmetrical distribution of $(G,B)$ and consequently an expected value of exactly 1/2 for $G/(G+B)$ --- independent of $n, k$ and $t$. The difference in answers between the original problem and the completed-families problem is the "bias" you calculated. – T.. Jul 9 '10 at 0:28
• @T, you are right that the bias depends on the formalization of the problem, but not that its existence depends on this particular one. If you assume that some families have not stopped reproducing, there is still a bias. If the size of the population is not constant, and larger populations tend to have more girls, then girls tend to be underweighted when you compute G/(G+B), and the expected value of G/(G+B) is under 1/2. I do not see a reasonable way to interpret the problem so that the population size is fixed or does not depend on the sexes of the children, but feel free to point one out. – Douglas Zare Jul 10 '10 at 3:53
• @Steve Landsburg: There were some very interesting and thoughtful comments on your post. However, since each argument continues until the participants finally agree, I expected that the fraction of thoughtful comments would be just over half. Sadly this seemed not to be the case... – Tom Church Jan 5 '11 at 4:26
• I want to make clear that the upvote for Rhett Butler's comment "You have found a roulette winning strategy..." is mine and was cast in error when I was trying to flag this comment as spam. – Steven Landsburg May 17 '13 at 21:51

There is a closely related puzzle about cards. I was told it by Vin de Silva, who said he was told it by Imre Leader, but I have no idea what the original source is.

An ordinary deck of cards, face down, is placed in front of you in a stack. A dealer turns the top card of the stack face up and puts it on a separate pile, and does this repeatedly until you say "now". At that point he turns over the next card and stops. You can say "now" at any time from the very beginning (before the first card is turned over) until almost the very end (just before the last card is turned over). You win if the last card turned over --- the one turned over just after you say "now" --- is red. What is the winning strategy?

You can get yourself into all sorts of convolutions trying to solve this. For example, you might think that it's good to wait until lots of the cards revealed so far are black, because then the probability that the next card will be red is relatively high.

But the solution is that it makes no difference at all what you do. Your probability of winning is always 0.5. To see this easily, imagine that after you say "now", the dealer turns over not the top card of the stack, but the bottom one. Clearly this game is equivalent to the original one, and clearly your probability of winning is 0.5 no matter what you do.

I'd like to take this easy solution and translate it into an equally compelling solution to the boy/girl puzzle, but right now I can't see how.

• It's funny that you mention that. I just discussed that puzzle in the StoxPoker.com forums (private), and was thinking of posting here to ask for the source. I learned of it on the TwoPlusTwo.com poker forums. – Douglas Zare Mar 12 '10 at 13:57
• I also posted a variant in the ProjectEuler forums. forum.projecteuler.net/viewtopic.php?f=4&t=1445 Besides the symmetry argument, the probability of success in that puzzle is a martingale. – Douglas Zare Mar 12 '10 at 14:19
• For the history of this problem, you could try asking Peter Winkler (at Dartmouth), who calls the bottom card of the deck the "Predestination Card." – Timothy Chow Apr 5 '10 at 17:58
• It is not so clear to me why the answer is 0.5. So I understand that the dealer could have pulled out any card form the remaining deck and the game is equivalent. However, if a lot of black cards had been pulled already from the deck, then the number of black cards remaining in the deck would be low so it would be sensible to say any card pulled from the deck would have a high probability of being red. – Sandeep Silwal Dec 13 '15 at 4:22
• @Sandeep: I think you are biased toward the favourable scenario where you've just seen X (say 5) black cards in a row and are thinking you should yell 'now'. You are dicounting the equallly probable scenario where you start by seeing X red cards in a row which is equally likely. For every favourable scenario there is an equally unfavourable one to counter-balance the average. So when you start playing, you might as well take your 50-50 chances and yell 'now'. – Alexandros Dec 2 '16 at 1:10

Let $X$ be the number of daughters of a certain couple. The probability that the first son of this couple is the $n$-th kid is $\frac{1}{2^{n}}$ and so $\mathbb E (X)=\sum_{n=0}^{\infty}\frac{n}{2^{n+1}}=1$. On the other hand the couple will have exactly one son so the expected proportion is 50-50.

• E[A/(A+B)] is not E(A)/(E(A+B)). Showing that E(A)/E(A+B) = 1/2 is not enough. You need another assumption. – Douglas Zare Mar 12 '10 at 9:42
• I was finding E(A/B), since B=1 this reduces to E(A). – Gjergji Zaimi Mar 12 '10 at 9:49
• aha! So there are really two questions here: expected proportion of girls to total population and expected proportion of boys to girls. Tricky! – zeb Mar 12 '10 at 9:56
• I guess there is some ambiguity about what number is meant by a proportion A:B. I read it as A/(A+B), which has the nice property that B:A is the complement so that computing E[A:B] is essentially the same as E[B:A]. If you interpret the proportion A:B as A/B, then this may be infinite, and E[A:B] can be 1 while E[B:A] is not 1, and may not exist. This calculation shows E[A/B]=1, but it does not compute E[B/A]. – Douglas Zare Mar 12 '10 at 11:07
• Of course I agree, both in the ambiguity of the question and in your argument, which is why I gave you a +1. Your answer is more complete, and I took the lazy man's approach :-) – Gjergji Zaimi Mar 12 '10 at 11:21

For those who still don't get it, it might help to consider this ultrasimplified example:

A certain family has a 3/4 chance of having 1 girl and a 1/4 chance of having 3 boys.

What is the expected number of girls in this family? 3/4. What is the expected number of boys? 3/4. What is the expected difference between the number of girls and the number of boys? Zero.

But what is the expected fraction of girl-births? There's a 3/4 chance that it's 100%, and a 1/4 chance that it's 0%. Therefore the expected fraction is 75%. Which, notably, is not 50%.

Moral: Just because the expected difference is zero, you can't conclude that the expected ratio is one.

(There is of course nothing new here beyond what Douglas Zare has already made crystal clear, but I'm thinking the starkness of the example might help.)

• Ratios versus differences doesn't address the main point, which is whether the family reproduction rule can break boy/girl symmetry in the underlying distribution of $(B,G)$. [It does gender-asymmetrize the allocation of boys and girls into sets called "families", but this extra structure does not play a role in the calculation requested by Google.] If the distribution is symmetrical then the proportion of girls will have expected value 1/2, because the random variables "proportion of girls" and "proportion of boys" will have the same probability distribution, and their sum is equal to 1. – T.. Jan 4 '11 at 5:40
• You ask: "But what is the expected fraction of girl-births?" Why should this number interest anyone who cares whether familiy planning can influence the population equilibrium? or "what fraction of the population is female?". Even if it is made crystal clear that average of fractions is not equal to the fraction of average, this does not entitle anybody to chose the wrong number. – Rhett Butler May 13 '13 at 20:02
• Rhett Butler: The question asks about the ratio of boys to girls, not about the ratio of expected boys to expected girls. You ask why the ratio should interest anyone. I suggest you address that query to the person who posed the question, not the people who answered it. PS. Since it's been well established elsewhere that you're not the least bit interested in the question that was posed, or any of the interesting subsidiary questions that it raises, but only in blustering and hurling insults, I won't be responding to any followups. – Steven Landsburg May 13 '13 at 20:19
• The question asks about the ratio of boys and girls and not about the mean value of averages in families. My own treatment and my recognition of this fact should show anybody that I am very interested in this question. I attribute your insulting manner to the fact that you recognize to have lost against Lubos Motl (who, as a Harvard string theorist, is certainly not less than you able to understand the simple error made by Douglas and accepted by you). – Rhett Butler May 13 '13 at 20:47

I think this is already implicit in the heavily up-voted answer, but it may be worth clarifying: there are two kinds of expectations that we can talk about.

The first is the distribution of G/B, G/(G + B), B/G, B/(B + G), values for the entire population (along with its expected value, standard deviation, etc.). Here, the distribution is over all possible "runs of history", so to speak, in the sense that we average over all possible ways history could turn out. If the population is large enough (thousands? millions?), then the expected values of all these quantities are what you would expect from a 50:50 split, and the standard deviations are near zero. Thus, as far as demographic estimations of the overall population are concerned, 50:50 is the way to go. In fact, at the population level, the ratio of girls to boys cannot be influenced by stopping strategies; any influence must either (i) affect the relative probability of conception of male versus female fetus (ii) adopt a post-conception filtering mechanism, such as induced abortion or infanticide).

The second is the expected G/B, G/(G + B), B/G, B/(B + G), etc., values over families. More generally, we may be interested in the distribution of different (G,B) values for different families. If we are interested in understanding family dynamics more thoroughly, we may also be interested in the birth orders, i.e., in what order girls and boys arise. Here, family stopping strategies could affect the distribution of (G,B) values and also of the birth orders. In particular, the strategy here ("stop as soon as you have a boy") gives 50% of the families with a single boy, 25% with one (older) girl and one (younger) boy, 12.5% with two older girls and one younger boy, and so on (assuming the complication of twins and triplets does not arise). This could have important demographic implications in the long term, when mating is done for the next generation (since birth order and the age gaps between children and their parents all play a role in mating and the creation of chlidren). However, that is getting beyond the current question.

For this second sense, it is not just the expected value per family that matters, but rather, the specific distribution of families. As already pointed out, since the variables are not independent, E[G/B] is not the same thing as E[G]/E[B], so what variable we choose to average over affects what answer we get. Looking at the whole distribution conveys more information.

When demographers are making short-term population estimates, it is the first sense (expected values for the population over runs of history) that is relevant, so stopping strategies can be discounted unless they are accompanied by post-conception selective strategies or strategies that affect conception probabilities. A deeper understanding of society would require knowing things in both the first and the second sense.

Another way to look at the "official" solution is to notice that for statistical purposes it does not matter which couple gets the next child. You "request" children from the couples in whatever manner you want, you always get a 1:1 expected ratio in boys and girls, regardless of the pattern in which you choose the next couple to produce another child.

• Suppose you make a financial instrument which pays the proportion heads/(heads+tails) for a sequence of fair coin flips whose stopping point I control, with at most 20 flips. I'll pay 0.6 for this. Deal? The expected payoff for my stopping rule will not be 1/2. – Douglas Zare Mar 12 '10 at 14:27
• @Douglas: You answered the false question. The ratio B/G of boys to girls in a population is (nearly) 1. And by a birth that has same probabilities b = 0.5, g = 0.5, b/g = 1, it is impossible to change this ratio. It has been asked whether the ratio B/G can be subject to manipulations. It can not. And as Thorny says and as I also few minutes ago found myself: It is completely irrelevant which couple decides to cease fire and which will continue. Therefore the independent variables will remain equal within the statistical margin. – Rhett Butler May 12 '13 at 16:42

It doesn't make much sense to compute the expected proportion of girls per family. Take two families, one with just a single boy, and another with eight girls and a boy. The average number of girls (resp. boys) per family is four (resp. one); and indeed, four times as many girls as boys were born. But the average proportion, which is what you are calculating, is (0 + 8/9) / 2 = 4/9, which is less than 1/2! So although your calculation may be correct, the answer doesn't really mean very much.

When I posted this problem on my blog, one commenter (who prefers to remain anonymous but gave me permission to repost here) noted a cool way to estimate the expected value of $B/(B+G)$.

Write $f(G)=B/(B+G)$ and expand in a Taylor series around $B$:

$$f(G)=f(B)+f'(B)(G-B)+(1/2)f''(B)(G-B)^2+...$$

Now take expected values: We have $E(G-B)=0$ and $E(G-B)^2=2B$, so

$$E[f(G)]=f(B)+(1/2)f''(B)(2B)+...$$ $$=(1/2)+1/(4B)+...$$

Now the number of boys is equal to the number of families, so for $k$ families, the proportion of boys is well estimated by

$$(1/2)+(1/4k)$$

and of course it's easy to get better estimates by going to higher terms in the Taylor series.

My commenter also adds the following (in my opinion, quite insightful) remarks:

Independence (or, more precisely, correlation) isn’t the only issue. Even for independent variables, the expected value of a ratio is not equal to the ratio of the expected values. (The expected value of a product of uncorrelated variables is the product of the expected values, though.) This is one of the most important keys to understanding this problem, I believe. And this is why I suggested the Taylor series to expand the ratio about its mean. I also think it is a little easier to find the expected proportion of boys because the random part (G) only appears in the denominator. Also, B is equal to the number of mothers, so I don’t believe B and G are independent because I don’t believe the number of girls is independent of the number of mothers.
• Steven, that is incorrect. The issue is whether the proportion of boys, denoted $f(B,G)$ above, is convex as a function of two variables so that $E[f(B,G)] > f(E[B],E[G]) = 1/2$. It isn't convex, as simple calculations demonstrate. (See the comments on convexity and Jensen's inequality under Douglas Zare's posting). It is convex if you condition on B (i.e., restrict f to lines B=constant), and concave if you condition on G. Such conditioning is foreign to the Google problem and imposed artificially in Doug's model. – T.. Jan 4 '11 at 6:05
• I'm not assuming any specific model, but pointing out that differences between your answer and 1/2 arise from artificial (i.e., gender-asymmetric) conditioning of the problem. Assuming $k$ families as in Zare's model or your present suggestion, is equivalent to assuming "at most $k$ boys in population", or exactly $k$ boys if it is also assumed the families complete their reproduction. No such asymmetric conditioning was part of the Google problem. Your calculations show that a symmetrical distribution can be approximated by asymmetric ones, not that the Google problem is asymmetric. – T.. Jan 4 '11 at 7:20
• T.: If you're not assuming any specific model, I don't see how you can be getting a specific answer. I think it would help me understand your point if you could give an explicit example (specifying number of families, mortality rates, fertility of the chidren, etc) in which the answer is 1/2. – Steven Landsburg Jan 4 '11 at 14:58
• ... but this is only apparent, because $k$ is not a quantity which is independent of the stopping rule, but is in fact being influenced by the stopping rule (it is related to the growth of the population, which as Vipal note's will potentially be affected by the stopping rule). Does this make any sense? – Emerton Jan 5 '11 at 14:22
• Although Matthew has bowed out, I just want to say what a pleasure it is to read his comments generally, not only for their erudition but for their wonderful civility. Too bad not all comments under this question in particular are so civil... – Todd Trimble May 17 '13 at 13:05

Of course, in the real world the sex ratio of a couple's offspring is a random variable with mean near 0.5. If a couple contains to product offspring until a boy is produced, the couples who tend to produce more girls will have larger families, and the proportion of girls will be higher than 50%.

A colleague, Eugene Salamin, came up with what I would consider the "Book" solution:

Phooey, this isn't at all a mathematical puzzle. A social convention cannot override biology, so the proportion of boys and girls is the biologically determined one, nominally 1/2, 1/2.

I didn't immediately understand his reasoning. But if all families are enumerated 1,2,3,... and you imagine each family's sequence of children placed in numerical order to make one infinite (or very long) sequence, then the resulting sequence of B's and G's is statistically identical to one you would get by repeatedly flipping a fair coin.

Viewed this way, the rule for stopping when the first B is reached is clearly a red herring! And clearly the proportion of boys and girls will be equal. (At least asymptotically, with probability 1, by the Strong Law of Large Numbers.)

(Likewise, if the original question is varied so that Prob(B) = p and Prob(G) = q, p+q=1, then by the same reasoning the ultimate proportions of boys and girls are p and q, respectively.)

P.S. On the other hand, this does not work for each possible stopping rule. Say we're back to the usual assumption of each birth having an equal chance of being a boy or girl. In an imaginary world, suppose each family stopped having children when the proportion of the girls in their family first exceeded 2/3. Then the ratio of girls to boys in the population will clearly be greater than 2.

• The stopping rule matters because the ratio G/(G+B) for the population becomes a biased estimator of the probability that each child is a girl. Just as it is biased for 1 family, it is biased for 2, 10, or any finite number of families. Each boy or girl is weighted by 1/(population size), and girls tend to belong to larger populations. I'm not sure what you mean by "a social convention cannot override biology" or "clearly a red herring." If a family stops when there are at least twice as many girls as boys, then with positive probability (I believe 1/2 phi^-1) the family will not stop. – Douglas Zare Jul 8 '10 at 19:33
• If you modify that example, then each family can stop with at least as many boys as girls with probability 1. That means with probability 1, the country's population will have at least as many boys as girls, and some populations will have more boys than girls. – Douglas Zare Jul 8 '10 at 19:37
• Douglas, if every family uses a stopping rule that enforces B > G (with probability 1, such as "reproduce until B > G") this obviously does not and cannot enforce a surplus of boys in the population. It is especially clear if you replace families/children by the isomorphic setup of gamblers/cointosses. If every gambler follows a "play until ahead" strategy that in no way implies a loss for a casino offering fair games. It does alter the allocation of tosses (children) to gamblers (families) but for the casino (population) the allocation is irrelevant. – T.. Jul 9 '10 at 16:46
• @T: What follows "obviously" in your response is false. With probability 1, the families can stop with a surplus of boys. The optional stopping theorem has a finiteness assumption which is necessary and which is violated in this case, so the conclusion does not hold. It is possible to choose a stopping rule on a stream of fair coin flips so that you stop with probability 1, and when you stop, there are more heads than tails. The expected number of tosses for this stopping rule must be infinite. Again, the proportion of girls is not a martingale, so you can't expect the OST to apply anyway. – Douglas Zare Jul 10 '10 at 4:12
• @Douglas: what followed "obviously" was the observation that it is not possible for stopping to enforce a surplus of boys in the population, although it can certainly enforce this, eventually, within each family. If you define "population" (i.e., the set of coin flips over which G/(G+B) is calculated) in terms of the stopping rule, as you did with your model with completed families only, then of course what is true for the stopping rule can be true of the population, but it would be hard to argue that the problem corresponds to any such model. – T.. Jul 11 '10 at 17:42

Caveat: This is not an entirely serious answer.

There has been some (heated?) discussion as to the sensitivity of the various answer to the particular model. I thought, for my own amusement, that I would do some Monte-Carlo experiments with a "plausible" model involving Pilgrims traveling to the New World. However, in thinking about possible models, I came up with the following issue. Suppose we assume that:

1. Once Pilgrims marry, they stay married, and do not re-marry if their spouse dies.
2. No living Pilgrim has a direct living ancestor older than their grandparents.

Under these assumptions, it follows that if there were N male Pilgrims in the first settlement, then, at any given time, there are at most 3N male Pilgrims. Moreover, the probability of the settlement dying out over several generations (because all the children are girls) is non-zero. By Kolmogorov's zero-one law (overkill), it follows that almost surely the Settlement will die out, and not become the kick-ass country it may well have been.

• Assuming current cosmological models are reasonably accurate, we can confidently claim that the USA will die out in finite time. It seems the end result is consistent with your model. – S. Carnahan Jan 6 '11 at 6:24

Perhaps I am missing something here but it seems quite intuitive to me that it has to be 50-50.
Think of it as coin tosses: As the resulting distribution is completely independent of the stopping time the proportion will in the limit always converge to the original distribution which is supposed to be 50-50. That is because the resulting stochastic process is markovian and a martingale
Or put another way: It doesn't matter when you stop tossing, the outcome will always add up to 50-50 because the coin doesn't have a memory.

It is a little bit like trying to invest in the stock market and getting out every time you are in the plus (sitting out negative phases) and after that beginning all over again. This seems like a clever infallible strategy - alas it doesn't work and you will stay at zero in the long run (here minus transaction costs of course)

(BTW: This reminds me of some friends of ours who desperately wanted a boy - now they have three girls and stopped "trying"... ;-)

• It seems wholly intuitive to me too. However a couple decides whether to make another baby --- prayer, quality of the moonlight, desire to have a boy --- the proportion of babies born will always be 50-50. – Tom Leinster Mar 12 '10 at 11:34
• The difference between the count of girls and boys is a martingale, but the proportion of girls in the population is NOT a martingale. You can't apply the optional stopping theorem for martingales because the proportion is not a martingale. – Douglas Zare Mar 12 '10 at 14:01
• Hmmm, could you give some reference for an explanation or a proof? Thank you! – vonjd Mar 12 '10 at 15:01
• The Strong Law of Large Numbers means the proportion returns (in fact, converges) to the mean almost surely. Martingales have no restoring force. Given that there have been 3 flips, and there have been 3 heads and no tails (proportion 3/(3+0) = 1), then the expected proportion after the 4th flip is 7/8, not 1. – Douglas Zare Mar 12 '10 at 16:02
• Ah, ok... so I should change my answer by taking out the martingale and stopping time part, adding the Strong Law of large numbers and keeping the rest, right? – vonjd Mar 12 '10 at 16:15

The correct answer has nothing to do with the number of families. This is a very tricky problem, and many people fall into the trap of trying to average each possible fraction of girls, weighted only by the probability of that outcome. But in fact they would need to be weighted also by the size of the population, if that strategy is used to find the answer.

Google's reasoning is perfectly correct, but here is another route to the same result. We just find the expected number of boys and the expected number of girls for one family.

The number of boys is obviously 1 for any outcome (of the form GnB), and so its expectation is 1.

The expected number of girls is given by the summation of n·p(n) for n = 0 to ∞, where p(n) = the probability of the outcome GnB, which is 1/2n+1. This sum is perhaps surprisingly also 1, which is easy to verify.

Thus each family's expected number of children is 1+1 = 2, and for N families, this just becomes N+N = 2N. And so on average, the population will have an equal number of children of each sex.

P.S. I will agree that Google's phrasing could have been more precise. But that is the case with virtually any math problem that is phrased as a problem in the real world, and I believe Google's intended problem is sufficiently clear that there is no real value in debating all its possible meanings.

• Daniel, it looks like you haven't studied Douglas Zare's answer very carefully. He has made a very striking new observation about this old chestnut. – Timothy Chow Jul 6 '10 at 1:31
• Zare falls into exactly the trap I mention in my first paragraph. – Daniel Asimov Jul 6 '10 at 23:12
• Daniel, I think you still don't understand Zare's insight. It matters exactly what quantity you're asking for. If G is the number of girls and B is the number of boys then "the proportion of girls in the population" is naturally interpreted as G/(B+G). The fact that E[G] = E[B] doesn't imply that E[G/(B+G)] = 1/2. – Timothy Chow Jul 8 '10 at 19:06
• Timothy, it only matters what quantity you ask for if you change the problem from the original to the one solved in Zare's much-upvoted answer. See my reply to his posting. – T.. Jul 9 '10 at 0:31
• @Timothy: E[G/(B+G)] is not interesting in order to find "the fraction of female population". For that sake we need E[G]/E(B] and that is 1 because the sex of a child does not depend on the history of the mother. – Rhett Butler May 13 '13 at 17:22

My way to look it is a bit different. The possibile sequence and the respective probabilty of new born can be:

• B - 1/2
• GB - 1/2*1/2
• GGB - 1/2*1/2*1/2
• GGGB - 1/2*1/2*1/2*1/2
• ...
• ...

After Summing it up. Total Number of Boys is: 1/2 + 1/2*1/2 + 1/2*1/2*1/2 + ... = 1 On the same lines, Total number of Girls is: 0 + 1/2*1/2 + 2 * 1/2*1/2*1/2 + 3 * 1/2*1/2*1/2 + ... Which also, give 1 on summing up.

## So the ratio remains equal.

• I was with you right up "So the ratio remains equal". Your calculations are relevant to the difference, not to the ratio. – Steven Landsburg Dec 20 '10 at 21:41
• @Steven Landsburg: DZ calculated the difference for 10 couples: 47.5 grils and 52.5 boys. Here comes my receipe for your gambling: Put everytime 1 million bucks on black. If black comes don't stand up but start your next series. During 10 series there will be less reds than blacks. It is really ridiculous that nobody ever thought about this simple method of making money! But what happens, if another player will bet on red everytime also always stopping a series, when red comes (not standing up then but starting the nexts series)? 52.5% red and simultaneously 52.5 % black? Overflow??? – Rhett Butler May 15 '13 at 10:17
• It would be nice if this thought experiment with two players with symmetrically opposite strategies could be turned into a simple explanation why the EV of the ratio $G/(B+G)$ \emph{cannot} be $1/2$. I don't quite see how to do it, but it seems only one player can gain money, and the loser will sit longer at the table than the winner does. – Dag Oskar Madsen May 15 '13 at 19:49

Maybe this is off topic (since it is applied statistics). But why not look at the problem as "What is the expected number of failure X till there is as success?" This corresponds to a negative binomial distribution which has an expected value of E[X] = r*(1-theta)/theta. r is the number of success, in this case it is r = 1. So, the expected number of failure (girls, sorry!) are 1*(1-0.5)/0.5= 1. The proportion girls/boys is 1:1.

I think we may summarize as follow:

We have infinite (countable) number of families. Each family stops to have children when the first boy appears.

We have a number of questions...

What is the expected: a) Ratio girls/boys in a given family?

b) Ratio boys/girls in a given family?

c) Ration boys/children in a given family?

d) Ratio girls/boys in the country?

e) Ratio boys/girls in the country?

f) Ration boys/children the country?

Some more: g) Number of children in a given family?

h) Probability of exactly one child in a given family?

And answers: Each family has exactly one boy. So:

a) $E(G1/B1)=E(G1)=1$ (one may do the sum $\sum_{i}0.5^{i}(i-1)=1$, or remark that $x=0.5\cdot 0+0.5\cdot(x+1)$ and obtain $x=1$)

b) Is not defined as $P(G1=0)=1/2$

c) $E(B1/(B1+G1))=E(B1/(B1+1))=E(1-\frac{1}{B1+1})=1-\sum_{i}0.5^{i}\frac{1}{i+1}=1-log(2)$

d) Let $R_{n}$ be the ratio for the first $n$ families, $R_{n}=\frac{G1+G2+...+Gn}{n}$. By the SLLN $R_{n}$ converges to $E(G1)$ a.s. So that (as) $lim R_{n}=1$

e) Honestly speaking, $1/R_{n}$ is not defined with probability $0.2^{n}$, so it is not correct to speak about $\lim 1/R_{n}$. But $1/lim R_{n}$ is defined a.s. and is equal to 1.

f) Let $Q_{n}$ be the ratio for the first $n$ families, $Q_{n}=\frac{n}{n+G_{1}+...+G_{n}}=\frac{1}{1+R_{n}}$. It is well defined and converges as. to 0.5

g) $E(G1+B1)=2$ (one may do the sum $\sum_{i}0.5^{i}(i+1)=1$, or remark that $x=0.5\cdot 1+0.5\cdot(x+1)$ and obtain $x=2$)

h) $0.5$

The answer is simply the same as in the coin tossing experiment, and there is a one word proof of it, Martingale, which gives 50-50. The first time one stops giving birth is based on an event that is known at the time, hence the associated stopping rule is adapted to the natural filtration and by optional stopping theorem, E(X_tau) = E(X_0) for a stopping time tau and martingale X_t, which in this is the number of male children minus female children after each birth. This also shows why killing babies is wrong.

• It's amazing how many people post wrong solutions after the correct one has been up-voted so many times that it's hard to miss. – rgrig Mar 23 '10 at 21:36
• The expected value of G/(G+B) is 1/2, not 3/8, under that stopping rule for a population in the ordinary sense of that term, i.e., one where the set of families is changing over time and without an artificial exclusion of incomplete families. By symmetry, E[G/(G+B)]=1/2 for any set of births that is defined without reference to concepts that (given the stopping rule) break gender symmetry, such as boys, girls, completed families, or siblinghood. This includes "all people born since 1920" but not "eldest children" or your definition of population "all children from completed families". – T.. Jul 10 '10 at 5:22
• @DZ: $k=1$ is no counterexample unless one defines population (the set of births for which G/(G+B) is calculated) to be a set of families that have reached the STOP state. It's quite clear that the one-completed-family (B,G) distributions can be asymmetrical under a stopping rule, that this asymmetry can be reflected in the proportion of girls, and that it is dampened (the girl proportion tends to 1/2) when convolving many such distributions. What is not clear is whether any bias exists in models not of that form. – T.. Jul 11 '10 at 18:06
• @Rhett Butler: That is clearly false and insulting. I hope that when you realize your mistake, you post apologies with the enthusiasm you are using to spam your errors and lies. – Douglas Zare May 13 '13 at 22:11
• @Rhett Butler: Here is a difference. When you bet on roulette, you don't get paid $B/(B+G)$. If you make bet $1$ at each step, you get paid $B-G$, say. Your payoff is a martingale. You do not get paid $B/(B+G)$. $B/(B+G)$ is not a martingale. Stop pretending that recognizing the fact that $B/(B+G)$ does not have expected value $1/2$ under some stopping rules means that we have a roulette strategy which wins on average. Your statement that "my" strategy (which is not mine) must win at roulette is mathematically wrong. It does not become right by spamming it or being increasingly rude. – Douglas Zare May 14 '13 at 17:04