Microsoft Interview Question
Just consider what the possible cases are and what are the associated probabilities. Let B denote boy and G girl:
B - 0 girl, 1 boy and stop, with prob 0.5, total 1 kid
GB - 1 girl, 1 boy and stop, with prob 0.5^2, total 2 kids
GGB - 2 girl, 1 boy and stop, with prob 0.5^3, totals 3 kids
You get the idea for the remaining infinite cases. So what is the expected number of kids? It is just 0.5(1) + 0.5^2(2) + ... This is not exactly a geometric series, but rather the sum of infinitely many of them:
1/2 + 1/4 + 1/8 + 1/16 + ... = 1
1/4 + 1/8 + 1/16 + ... = 1/2
1/8 + 1/16 + ... = 1/4
1/16 + ... = 1/8
...
After summing each of them, you are left with a geometric series on the right, which sums to 2. So there are an average of 2 kids per household. But one boy is always present, so we expect one girl. So same proportion.
The average number of children in a family is 2 (1/2^1+2/2^2+3/2^3...)
Since there is exactly one boy in a family then the ratio is 1.
out of x couple in the village, x/2 would have boy and x/2 would have girl. Therefore the x/2 would got for another child and there would be x/4 boy and x/4 girl. The process goes on. Mathematically you can write as:
no of boys: x/2 + x/2^2 + x/2^3.....
no of girls: x/2 + x/2^2 + x/2^3....
So the ration will always be one
Expected value of boys in one family=1
- wolverine August 28, 2009Expected value of girls in one family=1*.5*.5+2*.5*.5*.5+3*.5*.5*.5*.5+...
which is a AGP,
on solving this you will get E(girls in one family)=1
Ratio of boys to girls in village=expected value of boys divided by expected value of girls=1/1=1