Fog Creek Software
Discussion Board

boys and girls revisited

The posted solution of the "boys and girls" problem is incorrect when it says "with perhaps a few more boys than girls because the sum isn't actually infinite".  Here's why:

The formula (call it f) for the number of children for any particular couple can be expressed as
f = b/2 + (g/2 + f)

which is to say, it's equal to a 50% chance of having a boy and a 50% chance of (having a girl and rolling the dice again).  Solve this for f, and you'll get an equal proportion of (b)oys and (g)irls.

Not happy just solving for f?  Well, addition is commutative, so you could just as validly rearrange the brackets on the formula above and turn it into
f = (b/2 + f) + g/2
If nothing else this should suggest that having more kids makes no difference to the existing proportions.

Still not convinced?  Try flipping coins, it's a lot less effort than having to deal with a surly teenager:

I'm going to flip a coin twice at most.  If I get a head, I'll stop, otherwise I'll flip again.  What is the proportion of heads I'll get if I do this a thousand times, and record the results?

Here's what could happen each time:
50% Head
25% Tail, then Head
25% Tail, then Tail

So out of my thousand attempts:
500 x 1 Head only
250 x (1 Tail, 1 Head)
250 x (2 Tails)

Total 750 of each, for a 1 to 1 proportion if I only flipped twice.  But what if I had flipped a third time if I had got two tails?  Well, then I'd have had yet another 50% chance between a head or tail.  My 250 lots of (2 tails) above is broken down into 125 lots of (3 Tails) and 125 lots of (2 Tails, 1 head), for a grand total of 875 of each, once again in a 1 to 1 proportion.

Continue in this vein and it should soon become obvious that you'll never change the overall proportion of heads and tails by flipping again, no matter how often and under what conditions you allow yourself to try again before you give up.  Ditto for kids.

Carl Reynolds
Thursday, February 14, 2002

Consider an impossibly small town with only two childless families (couples):

Each couple decides to have a child and at the end of gestation, one couple has a bouncing baby boy while the other has darling little girl.

One couple is now done, while the other is not, so they try again and have boy on the second try.  Now they're done too.

In total, 1 girl and 2 boys, for a 2:1 ratio of boys to girls.

In practice, the numbers aren't perfect.  That's all the slight disclaimer meant.

Chad Hulbert
Friday, March 1, 2002

In your two-family scenario, however, it's just as likely that the second couple would've had another girl.  Imagine infinitely many parallel universes with two-family scenarios, where one family had a boy, and the other had a girl and is still trying.  In half the universes, the second family has a boy and stops (2:1 boy:girl ratio).  In the other half, they have a girl.  In half of those, their third child is a boy (2:2 ratio); in the other half, it's a girl.  And so on.  In the limit, it works out to 1:1.

Paul Brinkley
Friday, March 1, 2002

Yes, in the long (infinite) term, the ratio is a perfect 1:1.  I don't think I disagreed with that, or at least I didn't mean to.

Chad Hulbert
Friday, March 1, 2002

Hi Chad, I agree with you in that it's only a perfect ratio in the theoretical sense.  If you flip a coin an infinite number of times, the ratio of heads to tails will be a perfect 1:1, but yes, if you "only" flip a finite number of times then there will (probably) be more of one than another.  I think the question probably meant to ask about the average ratio rather than the actual ratio, which is random.  Unless it wanted me to think about that. :-]

Re-reading all this, there's still some scope for confusion.  I was trying explain why it would definitely be wrong to think that you will always get more boys than girls unless you take the result to its infinite sum, and I think I can do that better now.

The confusion lies back in the original solution, which said "So suppose there are N couples. There will be N boys", and (sum from 2 to X, X->infinity, of N/X) girls.

It's easy to see that the average number of girls will be less than N if you don't carry the sum to infinity.  What's less clear is that the average number of boys is less than N as well.  Unless the sum is infinite, you always have to deduct from the N boys the fraction of cases where a couple never manage to have a boy, no matter how many times (as long as it's finite) that they try.

Carl Reynolds
Tuesday, March 5, 2002

I think we all agree that in the long term, the ratio tends towards 1:1.

At first, also I thought that for any finite number of couples, the number of girls should be a little less than the number of boys but in fact that isn't true. There's a randomness there, so you could get more girls than boys just like you can flip a coin and get 3 heads before getting a tail (and stop flipping) - 3:1 ratio

I even went and wrote a short Perl program to simulate the problem :-). Running it for a large number of couples, I got very close numbers of boys and girls but with no guarantee of more boys than girls.

Andrew Francis
Thursday, March 7, 2002


But the couples cannot try forever.  They die.  Before that they get infertile.  Or the girls grow up and may have children of their own before their parents finish trying for a boy.

I think your Perl program may have forgotten that a couple can't have 100 kids.

Shawn Steele
Thursday, March 14, 2002

*  Recent Topics

*  Fog Creek Home