Cover image for D. E. Shaw & Co. - Investment Firm
Logo

D. E. Shaw & Co. - Investment Firm

Engaged Employer

D. E. Shaw & Co. - Investment Firm

Add an Interview

Interview Question

Software Engineering and Quantitative Research Interview

-

D. E. Shaw & Co. - Investment Firm

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?

Interview Answers

12 Answers

3

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

1

The answer by Anonymous poster on Sep 28, 2014 gets closest to the answer. However, I think the calculation P[Y] = 1 - P[C1's name != William AND C2's name != William] should result in 1 - (1- e /2) ( 1- e / 2) = e - (e ^ 2 ) / 4, as opposed to poster's answer 1 - (e^2) / 4, which I think overstates the probability of Y. For e.g. let's assume that e (Probability [X is William | X is boy]) is 0.5, meaning half of all boys are named William. e - (e ^ 2) / 4 results in probability of P(Y) = 7/16; Y = C1 is William or C2 is William 1 - (e ^ 2) / 4 results in probability of P(Y) = 15/16, which is way too high; because there is more than one case possible in which we both C1 and C2 are not Williams, for e.g. if both are girls or both are boys but not named William etc) So in that case the final answer becomes: (3e/2 - (e^2)/2) * 0.5 / (e - (e ^ 2) / 4) = 3e - e^2 / 4e - e^2 = (3 - e) / (4 - e) One reason why I thought this might be incorrect was that setting e = 0, does not result in P(C2 = Boy | Y) as 0 like Anyoymous's poster does. However I think e = 0 is violates the question's assumptions. If e = 0, it means no boy is named William but question also says that William is a Boy's name. So that means there can be no person in the world named William, but then how did question come up with a person named William!

indosaurabh on

0

I think second child refers the other child (the one not on the phone) In this case answer to first is 1/3 and second is (1-p)/(2-p) where p is total probability of the name William. For sanity check if all boys are named William the answers coincide.

Anonymous on

0

i think you guys are doing way too much and this is a trick question, these are completely independent events, i could name my child william, i could name it lollipop - the chances of it being a boy are still .5, regardless of its brothers name as well . (im going with .5 for both questions) keep in mind this is a quick phone interview question so they wont give anything thats too calculation heavy, involving e^2 exponents fractions etc, because you're supposed to be able to do it in your head

Anonymous on

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

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

1

1. P[C2 = boy | C1 = boy ] = 0.5 since these are independent events 2. P[C2 = boy | C1 = boy and is called William ] = 0.5 since these are independent events

Anonymous on

2

the second ans should be 1/3

Anonymous on

0

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

Brandon on

2

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

0

Answer by indosaurabh is correct, i go to harvard

Anonymous on

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

Add Answers or Comments

To comment on this, Sign In or Sign Up.