Interview Question

Software Engineering and Quantitative Research Interview New York, NY

The first question he gave me was not hard. 1. You call to

  someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children is a boy. The answer happens to be yes again. What's the probability that the second child is a boy? 2. (Much harder) You call to someone's house and asked if they have two children. The answer happens to be yes. Then you ask if one of their children's name a William. The answer happens to be yes again.(We assume William is a boy's name, and that it's possible that both children are Williams) What's the probability that the second child is a boy?
Answer

Interview Answer

7 Answers

0

the second ans should be 1/3

Anonymous on Jul 8, 2014
0

Actually the asnwer is 3/4.

Lets go through the conditional probabilities.

If the first child is named William and the second is NOT: the prob. of the second child being a boy is 1/2.

If the second child is named William and the first is NOT: the prob. of the second child being a boy is 1.

If both children are named William: the prob. of the second child being a boy is 1.

Now, assuming equal probs. of the first, second, or both children being named William, the total probability of the second child being a boy is (1/3)(1/2)+(1/3)(1)+(1/3)(1)= 5/6

Brandon on Jul 18, 2014
0

^^^^^^^^^^^^^

Correction... I meant to write the answer is 5/6

Brandon on Jul 18, 2014
0

You're both incorrect. The first answer is 2/3 and the second answer is 4/5.

Let B stand for boy (not named William), Bw be a boy named William, and G be a girl.

1. The sample space is:
(B,B)
(B,G)
(G,B)
It's easy to see that two of these cases have a boy as the second child so the probability is 2/3.

2. The sample space is:
(Bw, Bw)
(Bw, G)
(G, Bw)
(Bw, B)
(B, Bw)
4 of the 5 cases have a boy as the second child, and therefore the probability is 4/5.

I hope I do well on this interview in a few hours on Sep 17, 2014
1

The first answer is 2/3, as mentioned. But the second question hasn't been answered correctly here.

Given a person X, define e = P[X's name = William | X = boy]. Then, note that P[X's name = William] = P[X's name = William | X = boy] * P[X = boy] = e / 2 (the problem states that William is a boy's name).

Letting C1 be child 1 and C2 be child 2, we are asked to find P[C2 = boy | Y], where for notational simplicity, Y denotes the event "C1's name = William or C2's name = William." By Bayes' rule, we have:

P[C2 = boy | Y] = P[C2 = boy, Y] / P[Y]

==
Denominator: P[Y] = 1 - P[C1's name != William AND C2's name != William] = 1 - e/2 * e/2 = 1 - e^2/4.
==

==
Numerator: P[C2 = boy, Y] = P[Y | C2 = boy] * P[C2 = boy] = 1/2 * P[Y | C2 = boy] = 1/2 * P[C1's name = William or C2's name = William | C2 = boy].

To compute P[C1's name = William or C2's name = William | C2 = boy], there are 3 cases.

Case 1: C1's name is William, C2's name isn't William (given C2 is a boy).
This is e/2 * (1- e).

Case 2: C2's name is William, C1's name isn't William (given C2 is a boy).
This is e * (1 - e/2).

Case 3: both names are William (given C2 is a boy).
This is e/2 * e.

Summing these 3 cases gives e/2 - e^2/2 + e - e^2/2 + e^2 / 2 = 3e/2 - e^2/2, which is the numerator.
==

Dividing, we have (3e/2 - e^2/2) / (1 - e^2/4) = e * (3 - e) / (4 - e^2).

As a sanity check, note that setting e = 1 implies that all boys are named William, and our probability is 2/3, as in the first question. Setting e = 0 implies that no boys are named William, in which case our probability is 0.

Anonymous on Sep 28, 2014
0

unless William's prior distribution is provided. The only information we got is that William is a boy name. Thus the event is equal to at least one of them is a boy = 2/3. Becareful when you guys calculate probability with outcomes UNEQUAL LIKELY.

Anonymous on Dec 28, 2014
0

1. BB, BG, GB, GG 1/4 each, which later reduced to only BB, BG, GB with 1/3 probability each. So the probability of BB is 1/3
2. Let w is the probability of the name William. Probability to have at least one William in the family for BB is 2w-w^2, For BG - w, GB - w, GG - 0. So the probability of BB with at least one William is (2w-w^2)/(2w+2w-w^2) ~ 1/2

snsokolov on Feb 5, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.