# Probability - Interview Question [closed]

Hi I recently got this question in an interview and would like help solving it.

There were 2 boys and 3 girls in a room. A new baby entered the room whose gender was unknown (but equally likely to be a boy/girl). A nurse came into the room and picked one baby randomly and it turned out to be a boy. What’s the probability that the new baby was a boy?

## closed as off-topic by Henrik, Saad, drhab, StubbornAtom, Jyrki LahtonenDec 22 '18 at 12:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please provide additional context, which ideally explains why the question is relevant to you and our community. Some forms of context include: background and motivation, relevant definitions, source, possible strategies, your current progress, why the question is interesting or important, etc." – Henrik, Saad, drhab, StubbornAtom, Jyrki Lahtonen
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to the site! What are your thoughts on this? – Easymode44 Dec 22 '18 at 10:08
• Did you try using Bayes' theorem? – littleO Dec 22 '18 at 10:20
• Welcome to math.SE. Questions that just contain the statement of a problem without contain the author's own thoughts/work are very unpopular here and tend to get closed for lack of context. So please edit the question to include that. – Henrik Dec 22 '18 at 10:22
• I think it is noteworthy that you have now three different answers with three different results :) – Card_Trick Dec 22 '18 at 11:36
• State of mathematics education... And as the world evolves and loses its ability to reality check itself, we now relegate ourselves to finding answers by popular voting... – player100 Dec 22 '18 at 11:50

## 7 Answers

Let $$bg$$ denote the event that the new child is a boy, and the randomly chosen child is then a girl. Label other events similarly viz. $$P(bb)=P(bg)=\frac{1}{4},\,P(gb)=\frac{1}{6},\,P(gg)=\frac{1}{3}$$. Then $$P(\text{new boy}|\text{boy chosen})=\frac{P(bb)}{P(bb)+P(gb)}=\frac{\frac{1}{4}}{\frac{1}{4}+\frac{1}{6}}=\frac{3}{5},$$where to simplify I've multiplied numerator and denominator by $$12$$.

As an existing answer that reached this value has been downvoted, I double-checked my answer with the Python here. In one run, the conditional probability estimate was $$0.602380952381$$, which is close enough to $$0.6$$ for the purposes of a sanity check.

I won't spoil the answer for you, but think of what happens(intuitively) in extreme cases:

Suppose there were 1000 girls in that room and 1 boy. The nurse goes in and picks up a boy. What's the probability that the newborn was a boy?

Suppose there were 1000 boys and 1 girl. The nurse goes in and picks up a boy. What's the probability the newborn was a boy?

Use conditional probability to formalize your intuition.

$$p(new\ baby=boy|picked\ baby=boy)=\frac{p(new\ baby=boy\ and \ picked\ baby=boy)}{p(picked\ baby=boy | new\ baby=boy)p(new\ baby=boy)+p(picked\ baby=boy | new\ baby=girl)p(new\ baby=girl)}$$ $$p(new\ baby=boy|picked\ baby=boy)=\frac{1/2x1/2}{1/2x1/2+1/3x1/2}=3/5$$

• Interestingly, if you had a room of, say, a million boys and no girls, the odds that the new baby is a boy is capped at 0.5! On the other hand, if you had a million girls and no boys, the odds that the new baby is a boy is 1, as expected. – player100 Dec 22 '18 at 11:47

Note that first a new baby entered the room (there became $$6$$ babies in total) and then the nurse randomly picked up a boy from among them. Hence: $$P(B_1)=\frac12; P(G_1)=\frac12;\\ P(B_2|B_1)=\frac36; P(G_2|B_1)=\frac36; P(B_2|G_1)=\frac26; P(G_2|G_1)=\frac46.$$ Now you want to find (using Bayes' theorem): $$P(B_1|B_2)=\frac{P(B_1\cap B_2)}{P(B_2)}=\frac{P(B_1)\cdot P(B_2|B_1)}{P(B_1)\cdot P(B_2|B_1)+P(G_1)\cdot P(B_2|G_1)}=\\ \frac{\frac12\cdot \frac12}{\frac12\cdot \frac12+\frac12\cdot \frac26}=\frac3{5}.$$

The answer is $$\boxed{3/5}$$

Bayes' Rule asserts that the conditional probability of event $$A$$ happening given that event $$B$$ occurred is given by

$$P(A\mid B) = \frac{P(A \cap B)}{P(B)} = \frac{P(B \mid A) \cdot P(A)}{P(B)}$$

Here, your event $$A$$ is the event that the new child is a boy. Your event $$B$$ is the event of selecting one child and it being a boy.

$$P(A) = 1/2$$ as you mentioned.

To compute $$P(B)$$, note that there's a $$1/2$$ chance of having a boy. Moreover, if the new child is a boy, the probability of choosing a boy becomes $$1/2$$. Now, the probability that both of these events occur is given by

$$1/2 \cdot 1/2 = 1/4.$$

Now, consider the case where the child is a girl. This happens again with probability one half, and if it is a girl the probability of choosing a boy becomes $$2/6$$. Putting these together, we get

$$1/2 \cdot 2/6= 1/6.$$

So, $$P(B) = 1/4 + 1/6= 5/12$$.

Finally, $$P(B \mid A)$$ is the chance of choosing a boy given that the newborn is a boy, which occurs with probability $$1/2$$. Plugging these into our equation provided by Bayes' Rule, we get $$P(A \mid B) = 3/5.$$

• P(A) = 1/2 right? but how do i figure out P(B)? – Abhishek Damaraju Dec 22 '18 at 10:44
• You are correct about $P(A)$. You can compute $P(B)$ by considering the two cases (case one: the new child is a boy, and case two: the new child is a girl). – Ekesh Kumar Dec 22 '18 at 10:45
• Im sorry do you mind explaining a little further? thanks – Abhishek Damaraju Dec 22 '18 at 10:49
• Sure. Check my edit. – Ekesh Kumar Dec 22 '18 at 10:53
• Thanks. since the events are conditional P(A∩B) wouldnt be as simple as P(A) * P(B).. in order to find out P(A|B) how would u compute the intersection. – Abhishek Damaraju Dec 22 '18 at 11:08

I would like someone to verify this, since my confidence isn't high. This is a method that helps corroborate chances. If something doesn't quite add up, you'd generally notice, since then one or more of the equations would be wrong.

cube chart

The description explains several events with 4 conditions; the chance a boy or a girl is added, and the chance the nurse picks a boy or a girl.

What you're asking is basically, what are the odds something happens, given that we know that thing already happened. In this case it's "What are the odds a boy was added, given that we know the nurse picked a boy". You can see the events cross together with the answer being $$1/4$$

Let:

A - chosen child is a boy

N - new child is a boy

You are asked $$P(N|A)$$

Which is by using the bayes theorem:

$$P(N|A) = \frac{P(A|N)P(N)}{P(A)} = \frac{3/6 * 1/2}{1/2*3/6 + 1/2*2/6} = 0.6$$

We know $$P(A|N)$$ = 3/6 because if the new child is a boy we would have 6 childs and 3 boys, we can do the same for $$P(A|!N) = 2/6$$

We can calculate $$P(A)$$ as $$P(N)P(A|N) + P(!N)P(A|!N)$$ basically the probability that A happens if N happens or !N happens.