Fog Creek Software
Discussion Board




boys and girls puzzle

The wording of the "boys and girls" puzzle is incomplete as is.
The ratio of boys to girls is indeterminate unless it is assumed
that, in any generation, exactly half the couples will have boys
and half will have girls. This assumption itself provides the
answer since each generation will have an equal number of
boys and girls. No mathematics is needed. In fact, the ratio
will be exactly 1. We don't need to go to infinity. Whichever
generation you stop at, there will be an equal number of boys
in that and all the previous generations.

- Ajoy

Ajoy Bhatia
Wednesday, March 31, 2004

oops... in the previous message, the last sentence should be:
"Whichever generation you stop at, there will be an equal
number of boys and girls in that and all previous generations.
- Ajoy

Ajoy Bhatia
Wednesday, March 31, 2004

You are correct.

If you solve the problem as proposed in the official solution, you have an implicit assumption that the last child of any couple with children will be a boy. If parents are allowed to stop after a finite number of children, however, there is a nonzero chance that they have only girls. Which means the assumption doesn't hold. Now if you stop evaluating the sum after a finite amount of terms (without taking into account the remaining probability that they have only girls), you get a small error because the assumption (always exactly one boy) is false. The author of the "official" solution didn't realise his/her error, but concluded that the ratio is different from 1:1. Duh.

Vigor
Sunday, April 04, 2004

"If you solve the problem as proposed in the official solution, you have an implicit assumption that the last child of any couple with children will be a boy."

That is a valid assumption given by the problem itself.  The problem states "every family continues to have children until they have a boy."  We assume that there is no limit on how many children a family can have, i.e. if a family (one man, one woman) have one milliion children and all those children are female, then they would continue to have children until they get a male.  We assume the parents will not die and can continue to have children, unrealistic in real life, but that is our assumption.

We also implicitly assume that the chance of have a child of a particular gender is fifty percent.

In the official solution, the sum is finite (not taken to infinity) because the terms of the summation are taken to be integers, otherwise you would be dealing with a fraction of a couple and a fraction of a boy.  Nevertheless, our assumption that "the last child of any couple with children will be a boy" still holds.

JHY
Sunday, April 04, 2004

The error in the solution is the implicit assumption that "the chance of have a child of a particular gender is fifty percent."
By this assumption and the given situation in the problem that all couples stop having children when they have a boy, observe what happens.

1. We start with an equal number of girls and boys, because there are only couples - no singles (duh!)

2. In the 1st generation, we have half the couples with boys, and the other half have girls. => This generation also has an equal number of boys & girls. Ratio = 1:1

3. In the 2nd generation, the couples that had girls have children - half of them have girls & the other half have boys. => This generation too has an equal number of boys & girls. Ratio = 1:1

... and so on for future generations..

In fact, EVERY generation will have an equal number of boys and girls (ratio = 1:1) because of the implicit assumption in the solution that "the chance of have a child of a particular gender is fifty percent."

I hope I am clear now. :-)

- Ajoy

Ajoy Bhatia
Thursday, April 08, 2004

Just because we assume that the chance of having a child of a particular gender is fifty percent does not automatically guaranteed that the boys to girls ratio will be one to one.  The couples' choice of when to stop having more children also comes into play.

For example, if all couples decided that they would continue to have children until they have more girls than boys (i.e. when a couple stops, it means the couple have one more girl than boys), then the boys to girls ratio would not be one to one anymore, but the chance to have a particular gender is still fifty percent.

So to solve this puzzle, one would need to mathematically show that the ratio converges to some number for sufficiently large N, where N equals the number of couples (since it is a country, N should be large).  How large is sufficiently large?  That remains to be answered.

I believe the official solution considers only the first generation.  It never mentions anything beyond the first generation.  But if after the first generation the ratio is one to one, then inductive reasoning would dictate that the ratio is one to one after the k-th generation, where k>0.  In other words, the ratio is one to one after any number of generations.

JHY
Friday, April 09, 2004

The choice of the couples when they stop having children does not matter _at all_ if we assume that the births are statistically independent of each other (the chance for couple to get a girl is the same no matter how many children they already have or what the gender of their children is).

"For example, if all couples decided that they would continue to have children until they have more girls than boys (i.e. when a couple stops, it means the couple have one more girl than boys), then the boys to girls ratio would not be one to one anymore, but the chance to have a particular gender is still fifty percent."

That's wrong. Basically, you are mixing infinities and get wrong results(*). You have to view the ratio *per birth*, not *per couple*, because (as I said) births are independent of each other. Using clever mathematics, you try to trick nature to give birth to more girls than boys, but nature isn't interested in your mathematics.

(*) One correct way to calculate the ratio would be this one: Calculate the ratio of boys to girls when all couples are following this plan BUT are only allowed to have up to n children (where n is finite). Then let n go to infinity. You will see that the ratio converges to 1:1.

Vigor
Friday, April 09, 2004

You are right.  What I said was erroneous.  It doesn't matter what the couples wanted; nature ultimately wins.  Thanks for the correction.

JHY
Saturday, April 10, 2004

In my last post, I wrote about multiple generations. Instead, I should have said "order of birth". The puzzle does not track multiple generations - only all the children of the existing population. So, the correct way to put it is:

1. Consider the 1st child of each couple. Half of them will be boys and the other half will be girls, due to our implicit assumption. Doesn't really matter how many couples have a child. The ratio, at this point, is 1:1.

2. Now, move on to the 2nd child of all couples that have them. There are an equal number of boys & girls here, too.

.... and so on to the 3rd, 4th, ... nth child.

You can stop at any number of children. The ratio of boys:girls will be 1:1.

I think I got it right this time. :-)
- Ajoy

Ajoy Bhatia
Wednesday, April 14, 2004

Let's say you can go to the casino with a quarter. and make an even-money bet over a coin toss. If you win, you will make the same bet with two quarters, and keep doubling your money until you lose.

At the end of the day, what's the average amount of money you expect to have won or lost?

Ham Fisted
Friday, April 16, 2004

Actually there are a lot of people who apply this gambling strategy except, instead, they only stop once they win. In fact, once the game stops, they will always win whatever was the initial bet (in your case: 1 quarter). Since 2^N = Sum(i=0,N-1){2^i} + 1, for all N.

Unfortunately, N can go to infinity and the betting strategy can turn very dangerous! Not to mention that it is very rare to find a perfect 50/50 game in a casino.

Manish
Tuesday, April 20, 2004

*  Recent Topics

*  Fog Creek Home