# Simple 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?

So I've narrowed it down (taking the number of girls to be $n$) to:

\begin{align*} &P(\text{woman had a boy} \mid \text{nurse picked up boy)}\\ &\qquad= \frac{P(\text{nurse picked up boy} \mid \text{woman had a boy}) P(\text{woman had boy})}{P(\text{nurse picked up boy})}\\ &\qquad=\frac{\frac{4}{(4+n)}\cdot0.5}{3/(3+n)}\;, \end{align*}

but there's no way for me to get an analytical answer that makes sense. The correct answer is $\frac{4}{7}$.

-

Your denominator would be $P(\text{nurse picked up a boy})$ before the new baby was ever born. You need the probability that the nurse picked up a boy marginalized across both genders that the new baby could be, which is to say $$.5\frac{3}{4+n}+.5\frac{4}{4+n}$$ This should be the denominator since there are definitely $4+n$ children in the nursery now, and either $3$ or $4$ of them are boys.

Now to get $4/7$ is just to cancel the $.5/4+n$ from numerator and denominator.

-

Let $E_1$ and $E_2$ be two events defined as

$E_1:$ boy is born

$E_2:$ girl is born

Let say that initially there were $n$ girls.

$B:$ boy picked up by nurse

$G:$ girl picked up by nurse

$P(E_1|B)=\frac{P(E_1)P(B|E_1)}{P(E_1)P(B|E_1)+P(E_2)P(B|E_2)}=\frac{\frac{1}{2}\frac{4}{4+n}}{\frac{1}{2}\frac{4}{4+n}+\frac{1}{2}\frac{3}{4+n}}=\frac{2}{2+\frac{3}{2}}=\frac{2}{\frac{7}{2}}=\frac{4}{7}$

-