Google Interview Question about a town where if a couple has a girl born, they can't have more children... [duplicate]
Today I was reading about Google Interview math puzzles and I couldn't solve the following puzzle.
Imagine a town where there is a law:
If a couple have a girl born, then they can't have more children. If they have a boy born, then they can have more children. They keep having children until a girl is born.
Question is: What is the portion of girls to boys in town.
I'm trying to solve it using mathematics. Here is my approach but I'm not getting anywhere. I'm using probabilities to model this world.
Probability that a new couple has 1 boy is 1/2.
Probability that a new couple has 1 girl is 1/2.
Probability that a couple with 1 boy has 2 boys is 1/4.
Probability that a couple with 1 boy has 2 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 1 boy has 1 boy and 1 girl is 1/4.
Probability that a couple with 2 boys has 3 boys is 1/8.
Probability that a couple with 2 boys has 3 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 2 boys has 2 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 2 boys has 2 boys and 1 girl is 1/8.
Probability that a couple with 3 boys has 4 boys is 1/16.
Probability that a couple with 3 boys has 4 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 3 boys has 3 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 3 boys has 2 girls is 0. (You can only have 1 girl by law.)
Probability that a couple with 3 boys has 3 boys and 1 girl is 1/16.
At this moment I'm starting to see a pattern. If couple has a boy, then with equal probability they can have a girl as well.
So I sum all the probabilities of all couples in town (infinite number of couples), and I multiply probability by number of boys:
$Boys in Town = 1*1/2 + 2*1/4 + 3*1/8 + 4*1/16 + ...$
I get infinite series:
$ 1/2 + 1/2 + 3/8 + 4/16 + 5/32 + ...$
I sum it up and I get:
$ 1 + 3/8 + 4/16 + 5/32 + ...$
(I don't know how to sum this)
So there will be more than 1 boy for sure!
So I think in this town the ratio will be that there are more boys than girls.
In particula there wil be $ 3/8 + 4/16 + 5/32 + ...$ boys more than girls in town.
There will be 1 girl and 1 + $ 3/8 + 4/16 + 5/32 + ...$ boys.
Please let me know what you think of my analysis. Thanks!
Every birth is an independent event.
Thus regardless of who is allowed to procreate the ratio will be $1:1$.
In order to change that ratio you will have to start killing babies.
Say there are $16$ couples. That is $8$ girls and $8$ boys. The latter $8$ couples have a second round of children. That is $4$ more girls and $4$ boys. The latter $4$ couples have more children $2$ girls and $2$ more boys. The last $2$ couples have another girl, and one boy. This final couple can have some boys until they get a girl, but again the ratio to a close approximation will be $1:1$.