**The Zorganian Republic has some very strange customs. Couples only wish to have female children as only females can inherit the family's wealth, so if they have a male child they keep having more children until they have a girl. If they have a girl, they stop having children. What is the ratio of girls to boys in Zorgania?**

The ratio of girls to boys in Zorgania is 1:1. This might be a little counter-intuitive at first. Here are some ways of tackling this problem.

### 1. Monte Carlo Simulation:

Although, Monte Carlo simulation does not necessarily show why the result is 1:1, it is appropriate because of the very counter-intuitive nature of the problem. At the very least, it helps us see that the result is indeed 1:1. Therefore, this is a good start.

The following R code estimates the probability of a child being a boy in Zorgania.

couples <- 100000 boycount <- 0 for (i in 1:couples){ # 0: boy while (sample(c(0,1),1) == 0) { boycount=boycount+1 } } probability <- boycount/(couples+boycount)

Result:

### 2. Understanding the question better:

Here is another question: What is the probability of getting a tail in a fair coin toss, if all seven previous tosses resulted in heads? Since coin flips are independent events, the probability is still going to be 0.5. Similarly in this case, the child births are independent. It does not matter if the couples stop giving birth after they have a baby-girl. The expected value is unchanged.

For example, consider five couples: C1, C2, C3, C4 and C5.

If B-> Boy and G-> Girl. Using R's sample().

For C1: {B, G}

For C2: {G}

For C3: {B, B, G}

For C4: {B, G}

For C5: {G}

Now, ignore the couples and only consider the children. The children are {B, G, G, B, B, G, B, G, G}. The only thing happening here is simply the generation of either a B or a G with equal probability for each generation. At this point, it is quite obvious that the part that has to do with "couple...." in the question is to mislead and confuse similar to the "previous seven tosses.." example that I mentioned in the beginning of 2.

###
**3. Counting:**

If we start with 512 couples (hence 512 first borns), half of them are going to have a girl as their first. Those couples will stop having children. Among, the other half couples who had a son as their first child, half of them are going to have a girl as their second child and so on. At every step there is an equal numbers of boys and girls. Therefore, the expected ratio is 1:1.