# help me solve the puzzle

Show 80 post(s) from this thread on one page
Page 1 of 3 123 Last
• 08-29-2009
BEN10
help me solve the puzzle
Here is the puzzle:
In a village in each family they give birth to children till they get a boy, if girl child they try again. What is the ratio of boys to girls?

I've thought of it over 100 times but still not getting in the right way. So please help.
• 08-29-2009
novacain
My guess would be that this has no effect on the ratio of boys to girls.

Each birth has the same probability of a girl versus boy (which may not be 1:1).

This just changes the number of children each family has, not the ratio.
• 08-29-2009
EVOEx
It does have effect...
1/2 of the families have 1 boy
1/4 of the families have 1 boy 1 girl
1/8 of the families have 1 boy 2 girls...

Don't have time to think it out now, but try like that...
• 08-29-2009
novacain
Damm you OP! This one has stuck in my head.

if
B == prob of a boy
C == number of children in a family
F == number of families in the village

Number of boys will always be equal to the number of families (F).

the number of girls in a family is [C-1]
the number of families in the village with this number of children is [(1-B)^C * F]

this gives the number of girls as the (1 to infinite) sum of

(1-B)^C * F * (C-1)

If we assume B == 1/2 we get

G == ((C-1) * F ) / 2^C

This is a rapidly diminishing sequence.

My calcs show it tends to 'F' but I can not prove it.
• 08-29-2009
Elysia
This is an interesting question, and I don't know if it has a real answer, since it depends on statistical luck.
I'm poised to say it's 1:1, but that might be off.
We can say for sure that there are 100 boys that are born in the end. The interesting this is that there will be about 100 girls, +/- 2/3 or so, as indicated by this algorithm:
Code:

```#include <iostream> int main() {         int Boys = 0, Girls = 0;         int BoysTemp = 0;         int FamiliesLeft = 100;         while (FamiliesLeft != 0)         {                 BoysTemp = FamiliesLeft / 2;                 if (BoysTemp == 0)                         BoysTemp = 1;                 Boys += BoysTemp;                 Girls += FamiliesLeft - BoysTemp;                 FamiliesLeft -= BoysTemp;         }         std::cout << "Number of boys: " << Boys << "\nNumber of girls: " << Girls << std::endl; }```
Remember that the problem comes when the families that are left is an odd number. Then there cannot be born a similar number of boys and girls. From there, we can transcend into different paths and get different answers.
• 08-29-2009
BEN10
@Elysia
Can you explain the algorithm. Why are you dividing by 2?
@novacain
Even I was also hitting my head on the wall to get the answer. I have few more puzzles like that, which I'm trying hard to get to the answer.
• 08-29-2009
Elysia
Quote:

Originally Posted by BEN10
@Elysia
Can you explain the algorithm. Why are you dividing by 2?

50/50. Half get boys. Half get girls.
• 08-29-2009
BEN10
Quote:

Originally Posted by Elysia
50/50. Half get boys. Half get girls.

Why half? Why not all of them get a boy first? Or any other situation like that.
• 08-29-2009
cyberfish
I believe it will be 50/50. It doesn't matter what they do, as long as they don't start killing people, every newborn has 50% chance of being a boy or a girl. Every birth is an independent event.
• 08-29-2009
Elysia
Quote:

Originally Posted by BEN10
Why half? Why not all of them get a boy first? Or any other situation like that.

Why not defy mathematics?
Because it clearly says that if there are two things that can happen, there is a 1/2 to get one of those things. Since there are two genders: boys and girls, there is a 50% chance to get either of them.
This may or may not be realistic, but we don't have any better mathematical ways to calculate chance.
• 08-29-2009
EVOEx
Let's say n people, everybody has at least a boy (I'll assume they are all in a "finished" state as there is no answer otherwise).
That means there are n boys.

1/2 of the families had 1 girl first.
1/4 of the families had 2 girls first.
1/8 of the families had 3 girls first.
1/16 of the families had 4 girls first.
etc.

So the number of girls:
1*(n/2) + 2*(n/4) + 3*(n/8) + 4*(n/16) + ...
= n*(1/2 + 2/4 + 3/8 + 4/16 + ...)

So the ratio is n:n*(1/2 + 2/4 + 3/8 + 4/16 + ...)
or:
1:(1/2 + 2/4 + 3/8 + 4/16 + ...)

A program I quickly wrote shows (doesn't proof; I still don't have time to look into it well enough) that that term converges to 2 when the number of families goes to infinity.

Code:

```#include <iostream> using namespace std; int main() {   double a, b, s;   a = 1;   b = 2;   s = 0;   while(1) {     s += (a/b);     a += 1.0;     b *= 2.0;     cout << s << endl;   } }```
• 08-29-2009
cyberfish
1/2 - boy
1/4 - girl + boy
1/8 - girl + girl + boy
1/16 - girl + girl + girl + boy
...

Number of boys will obviously be 1 in each family, so we can try to prove that the average will also be 1 girl.
Code:

```# girls = SUM_i=1_to_inf { 1/2^i * (i-1) } => SUM_i=1_to_inf { i/2^i } - SUM_i=1_to_inf { 1/2^i }```
The second term is 1, so we need to prove that the first term converges to 2.

(lol, the system won't let me post that without using code tags)
• 08-29-2009
cyberfish
Quote:

Originally Posted by EVOEx
1/2 of the families had 1 girl first.
1/4 of the families had 2 girls first.
1/8 of the families had 3 girls first.
1/16 of the families had 4 girls first.

should be
1/2 of the families had 0 girl first.
1/4 of the families had 1 girls first.
1/8 of the families had 2 girls first.
1/16 of the families had 3 girls first.

So there is 1 less girl in each family, and the ratio is 1:1.

The answer to this question is easy, but hard to prove (if you don't accept the common sense proof).
• 08-29-2009
Mario F.
Quote:

Originally Posted by cyberfish
I believe it will be 50/50. It doesn't matter what they do, as long as they don't start killing people, every newborn has 50% chance of being a boy or a girl. Every birth is an independent event.

In other words, they didn't change the actual event. So ratios stay the same. A family that has a lot of girls before they have their first boy will be offset by those events in which a boy was the firstborn on a 50/50 ratio.

Curiously, by killing people one isn't changing the ratio. Newborns, even stillborns, should still be accounted for. That's the event. Or better... the moment of conception is the event.

Similarly, by forcing a boy to be born one isn't changing anything. It's the actual event that needs to be tampered with if one wants to change the ratio used to measure it.

EDIT: and you just proved it mathematically.
• 08-29-2009
Elysia
Quote:

Originally Posted by EVOEx
Code:

```#include <iostream> using namespace std; int main() {   double a, b, s;   a = 1;   b = 2;   s = 0;   while(1) {     s += (a/b);     a += 1.0;     b *= 2.0;     cout << s << endl;   } }```

This is technically unfeasable.
One family cannot have half a child, nor can there be 12.5 families left that needs to have a boy.
Plus the variable names are utterly poor.

cyberfish: It's usually because you use { and }. Post the reply with code tags around them or the entire post, then edit and remove them. It will work.
Show 80 post(s) from this thread on one page
Page 1 of 3 123 Last