# Intuitive explanation for a constant answer in a Bayes theorem question

You know there are 3 boys and an unknown number of girls in a nursery at a hospital. Then a woman gives birth a baby, but you do not know its gender, and it is placed in the nursery. Then a nurse comes in a picks up a baby and it is a boy. Given that the nurse picks up a boy, what is the probability that the woman gave birth to a boy?

Assume that - in this question's universe - the unconditional probabiilty that any newly born baby is a boy or a girl is exactly half.

Short solution

Let number of girls be $$k$$. Event A is the newborn is a boy, Event B is that nurse picks up a boy. So, we are asked $$P(A|B)$$.

$$P(A|B) = \frac{P(B|A)P(A)}{P(B)} = \frac{\frac 4{k+4}\frac 12}{\frac 4{k+4}\frac 12 + \frac 3{k+4}\frac 12} = \frac 47$$

My question

Why is the probability constant? I would have expected the probability to change with respect to the number of girls. More specifically, I would have expected the probability to increase as the value of $$k$$ increases, and decrease if $$k$$ was less. Why so? Because we are already given the claim that we have selected a boy. If we have infinite girls, then the newborn has to almost surely be a boy to help support that observed claim. Because initially there are only three boys, the more help they could get in supporting the claim, the better.

Of course, this is not a very rigorous argument, but the point here is that in many such questions there is a natural expectation for the probability to vary with the variable. And it does do in many, say for example the generalized monty hall problem.

I do know that technically the $$k$$ does not matter because it gets cancelled out in the denominator, but intuitively that is not a very helpful explanation. Can anyone give an intuitive explanation for why the probability answer in this question is a constant?

• I think that in your intuition there is too much accent on the fact that a boy is picked up by the nurse. Uptil how far would this have influence on the question whether a boy or a girl is born? Would that not just be a 50-50 chance? Surprisingly not ($4/7\neq1/2$) but also not too far away from it. Commented Sep 4, 2020 at 10:34
• The solution (spoiler) clearly assumes that the (unconditional) odds of the baby being born as a boy is $1/2$, so let's assume that it is a given thing, and not dwell on it. The real question: the conditional probability is then $4/7$ ... and this does not depend on $k$. Why?
– user700480
Commented Sep 4, 2020 at 10:43
• In the Monty-hall problem (I only consdider the original version here) , the probability that the candidate has chosen the right door at the beginning is always $\frac{1}{3}$. But : a changing candidate wins if and only if the wrong door was chosen. This is the reason why changing pays out so massively. Commented Sep 4, 2020 at 10:43
• @Peter In my comment I take the stand that $0.5$ is the probability of getting a boy. The difference with $\frac47$ is IMV not so large (and almost vanishes if some more boys would be present in the nursery at first hand). The probability is actually $\frac{b+1}{2b+1}$ where $b$ denotes the number of boys originally present. Commented Sep 4, 2020 at 10:48
• @drhab I noticed that I misinterpreted the comment after having read the exercise more carefully. Commented Sep 4, 2020 at 10:54

I imagine the argument may go like this...

Let's assume you have two identical wards A and B in the hospital, both having nurseries, in each nursery there are $$3$$ boys and $$k$$ girls. Then a woman in ward A gives birth to a boy and another woman in ward B gives birth to a girl. Now there are $$4$$ boys in ward A's nursery, but still $$3$$ boys in ward B's.

Imagine now you (not having the wards clearly labelled, as it often happens in hospitals) randomly (with probabilities $$50\%$$ each) enter one of the wards and see a nurse holding a boy from the nursery. What is the probability you'd entered ward A?

This is the same problem as the original one, but has the obvious solution $$4/7$$. Namely, each child (out of all $$8+2k$$ children) is picked with equal probability, so knowing that it was a boy, it could've been one of $$7$$ equally likely boys. However, $$4$$ of them are from ward A, so the odds that you'd strolled into ward A are $$4/7$$.

• I would like to dedicate this answer to all those "quantum theory many worlds interpretation" philosophers who believe that, when a random event occurs (such as the birth of a baby which may be a boy or a girl, or opening a box, where Schrodinger's cat may be dead or alive), the whole universe splits into two, each with its own outcome. (Luckily, here I am splitting only the hospital maternity ward into two!)
– user700480
Commented Sep 4, 2020 at 11:11
• Thanks, this interpretation of the question is certainly very helpful to look at! Commented Sep 4, 2020 at 11:23
• This is the intuitive answer, in my opinion. Note that if there are a million babies in each ward, picking a boy is phenomenally unlikely in either case, so you're looking at a phenomenally "lucky" selection no matter what the sex of the new baby is. The key fact is that you're just exactly $\frac43$ times as likely to choose a boy if the last baby is a boy than if the last baby is a girl. Commented Sep 5, 2020 at 15:49

Wow this one was a doozy. For brevity's sake, I will refer to the three other boys as "boy 1," "boy 2" and "boy 3," and to the child in question as just "the child."

There are seven different possible outcomes:

If the child is female: (1) Boy 1 is chosen, (2) Boy 2 is chosen, (3) Boy 3 is chosen.

If the child is male: (4) Boy 1 is chosen, (5) Boy 2 is chosen, (6) Boy 3 is chosen, (7) the child is chosen.

Essentially, each of these seven events have equal probability, which is pretty counter intuitive. This is because 4/7 of the time the nurse will pick the second category since there are four children instead of three. In fact, this is where the probability that the child is male comes from. Note that this has nothing to do with the .5 chance of any child being male, since the nurse is more likely to pick from the pool of males if there are more males.

It might be a bit easier to consider if you consider the case with 1 known male. You are twice as likely to pick a male if the child is male, which means that 2/3 times, you will pick from the second pool, which is synonymous to saying the child is male.

You could also think about it as if the child has half the "weight" of the other children, if that would help.

If you want some numbers to convince you: if any of the three other boys is chosen, which happens 6/7 of the time, this has no bearing on the gender of the child. However, 1/7 of the time, when the child is chosen, he is guaranteed to be male.

Then the calculation is $$(\frac12) \frac67 + (1)\frac17 = \frac47$$

If you realize this extremely counter intuitive way of looking at it, this problem is pretty much immediate and requires no calculation. I apologize if this is a convoluted explanation.

• Hmm, I not really able to derive a lot of intuition out of this one, but thanks anyway, as it's important to keep looking at different ideas until finally one of them clicks Commented Sep 4, 2020 at 11:25
• Your claim that "this has nothing to do with the .5 chance of any child being male" is either confusingly phrased or outright wrong. In particular, the answer to the original problem does depend on the prior probability of the child being male (and equals $\tfrac{4p}{3+p}$, where $p$ is the prior probability that the child is a boy). Commented Sep 4, 2020 at 19:57

The two-wards answer is so intuitive that I hardly expect to improve upon it. So instead I will generalize to find the answer given in one of the comments.

Note that the phrase "given that the nurse picks up a boy" indicates that we're restricting ourselves to just the cases where that happens. Bayes' Theorem tells us that the chance we are observing a case of Event $$A$$, given that we are observing Event $$B$$, is just the relative portion of all the cases of Event $$B$$ in which Event $$A$$ occurs.

That is, knowing that $$P(B\mid A) P(A) = P(A \cap B)$$ and $$P(B\mid A^\complement) P(A^\complement) = P(A^\complement \cap B),$$

Bayes' Theorem says that

$$P(A\mid B) = \frac{P(B\mid A) P(A)} {P(B\mid A) P(A) + P(B\mid A^\complement) P(A^\complement)}.$$

So suppose the prior probability that the woman gave birth to a boy is $$p,$$ which might or might not be $$\frac12.$$ That is, $$P(A) = p$$ and $$P(A^\complement) = 1 - p.$$

There is some probability, $$P(C)$$, that the nurse picks up the new baby. Any other particular baby in the ward has an equal chance to be picked up. Since there are four boys in the ward in the event $$A$$, it follows that $$P(B\mid A) = 4 P(C).$$ In the event $$A^\complement,$$ there are only three boys, so $$P(B\mid A^\complement) = 3 P(C).$$

So now we have

$$P(A\mid B) = \frac{4 P(C) P(A)}{4 P(C) P(A) + 3 P(C) P(A^\complement)}.$$

Cancel the common factor $$P(C)$$: $$P(A\mid B) = \frac{4 P(A)}{4 P(A) + 3 P(A^\complement)}.$$

Plug in $$P(A) = p$$ and $$P(A^\complement) = 1 - p$$: $$P(A\mid B) = \frac{4 p}{4 p + 3 (1 - p)} = \frac{4 p}{3 + p}.$$

This works out to $$\frac47$$ when $$p = \frac12,$$ but approaches zero as $$p$$ approaches zero and approaches $$1$$ as $$p$$ approaches $$1.$$

• I think "Note that the phrase "given that the nurse picks up a boy" indicates that we're restricting ourselves to just the cases where that happens." is the real kernel of the intuitive answer. The quantity of girls $k$ doesn't matter because we're not in a universe where the nurse picked up a girl. More girls would make $B$ unlikely but has no effect on us once given $B$ Commented Sep 5, 2020 at 17:10

Revised answer: It may be helpful to refer to my original answer below in order to follow this revised answer. Some of the context I give there is relevant, but I'd rather not repeat it here. (Nothing in that answer is incorrect, as far as I know, but it fails to get to the key point.)

Having thought about the bigger picture, I'm convinced that the only intuitive explanation is essentially the algebraic explanation: the number of girls does not affect the conditional probability because it only enters in the common denominator of the terms in Bayes' formula, and therefore cancels out.

Consider a modified version of the problem where the number of girls ends up mattering: in the hospital there are currently $$k$$ newborn girls and $$\ell$$ newborn boys plus one woman in labor who is known (say from ultrasound) to be having a boy. The probability that she will give birth in the next hour is $$p$$. At the end of the hour a nurse holds up a random newborn and it is seen to be a boy. What is the probability the baby has been born?

The answer is \begin{align} \frac{\frac{\ell+1}{k+\ell+1}p}{\frac{\ell+1}{k+\ell+1}p+\frac{\ell}{k+\ell}(1-p)}&=\frac{(\ell+1)(k+\ell)p}{(\ell+1)(k+\ell)p+\ell(k+\ell+1)(1-p)}\\ &=\frac{p(\ell^2+k\ell+\ell+k)}{\ell^2+k\ell+\ell+pk}\\ &=p+\frac{kp(1-p)}{\ell^2+k\ell+\ell+pk}. \end{align} When $$k=0$$ this reduces to $$p$$; as $$k$$ grows, the conditional probability grows and approaches $$\frac{\ell p+p}{\ell+p}$$, the same answer as in the original problem. This makes sense: if $$k=0$$ there are no girls in the story and so seeing a boy provides no information. When $$k$$ is large, the small difference in the denominators of the terms in Bayes' formula becomes negligible.

The explanations that have been given for the answer to the original problem focus on the fact that (in the $$p=0.5$$, $$\ell=3$$ version of the problem) the three boys in the universe where a girl was born and the four boys in the universe where a boy was born all have the same probability of being held up by the nurse. When one conditions on a boy being held up, it becomes clear that the number of girls is not going to enter. In this modified problem, the four boys in the universe where the birth has occurred each have a slightly lower probability of being held up by the nurse. So even when we condition on a boy being held up, the number of girls affects the probability that a boy is held up differently depending on which universe you are in, and so the number of girls is going to enter.

Original answer: There is something very right about the intuition you expressed in your question, which I think is worth emphasizing. Before I get to that, let me rephrase your question as "Why does the conditional probability not depend on the number of girls (or equivalently, on the total number of children)?" I think this is better than "Why is the conditional probability constant?" since the latter leads to the question "Constant with respect to what?" I realize that you meant constant with respect to the number of girls, as that's the only variable in the problem, but it is enlightening to let other quantities vary as well. So let $$\ell$$ be the number of boys and let $$p$$ be the probability that a birth results in a boy. With these changes, $$\Pr(A\vert B)=\frac{\frac{\ell+1}{k+\ell+1}p}{\frac{\ell+1}{k+\ell+1}p+\frac{\ell}{k+\ell+1}(1-p)}=\frac{\ell p+p}{\ell+p}.$$ So the conditional probability does depend on two of the parameters, $$\ell$$ and $$p$$. It just doesn't depend on $$k$$.

Looking at this expression, we can now see what was right about your intuition: seeing the nurse pick up a boy is much more significant when the original number of boys is low than it is when the original number of boys is high. So $$\Pr(A|B)$$ is $$100\%$$ when $$\ell=0$$, but decreases toward $$p$$ when $$\ell$$ gets large. The only place you went astray was in thinking that the number of boys relative to the total number of children was significant, rather than the absolute number of boys. Added: To pinpoint the error, you say "we are already given the claim that we have selected a boy", but you follow this with "If we have infinite girls, then the newborn has to almost surely be a boy to help support that observed claim." The claim needs no support, since it is an assumption, no matter how probable or improbable. A place where support actually would be needed is if you wanted to claim the newborn was a boy. Seeing a boy would provide some support for that claim, but the support would be rather weak if there were lots of other boys that might have been the boy that was seen. If there were very few, or even no other boys, then support for the claim would get much stronger.

For good measure, let's compute $$\Pr(A\vert B')$$, the probability the birth resulted in a boy given that the child picked up by the nurse was a girl: $$\Pr(A\vert B')=\frac{\frac{k}{k+\ell+1}p}{\frac{k}{k+\ell+1}p+\frac{k+1}{k+\ell+1}(1-p)}=\frac{kp}{k+1-p}.$$ In this case, the original number of boys is irrelevant; only the original number of girls matters. The explanation is that given by Joshua Malco (although I do agree with Ilmari Karonen's criticism). I'll try to formulate that explanation slightly differently: we can solve the problem in such a way that the only numbers that are relevant are those that relate to the gender of the child you see (both $$k$$ and $$p$$ relate to this) and the gender of the new child ($$p$$ relates to this). We saw a girl; a fraction $$p$$ of the time this will have been one of the $$k$$ original girls; a fraction $$1-p$$ of the time it will have been one of the $$k$$ original girls or the new child. In a sense, there are $$k+(1-p)$$ girls that the nurse could have picked, where the fractional weight $$1-p$$ has been attached to the new child because their gender is uncertain. The portion of this quantity associated with the case where the new child is a boy is $$pk$$. This accounts for our final expression without needing to consider any of the original boys.

The same idea can be applied to the original problem: there are effectively $$\ell+p$$ boys, which breaks down as $$p(\ell+1)+(1-p)\ell$$. The portion of the quantity associated with the case where the new child is a boy is $$p(\ell+1)$$, hence the final probability expression.

To say this again, slightly differently, the gender of the new child is independent of the genders of the children already in the nursery—the probability it's a boy is always $$p$$. If you see the nurse pick a boy, you need only consider whether the child you saw could be the new child; it's already ruled out that it was one of the original girls, and they can be ignored, but it might have been one of the original boys, so their number will have an effect.

If you change the problem so that the nurse picks up two children and condition on the event that one girl and one boy get picked up, then the probability depends on both of the parameters $$k$$ and $$\ell$$: $$\frac{\frac{(\ell+1)k}{\binom{k+\ell+1}{2}}p}{\frac{(\ell+1)k}{\binom{k+\ell+1}{2}}p+\frac{\ell(k+1)}{\binom{k+\ell+1}{2}}(1-p)}=\frac{\ell kp+kp}{kp+\ell k+\ell-\ell p}.$$