I had a first round phone interview for a quant trader position with D.E. Shaw today, and got stumped on what seems like a pretty simple probability question (see below). Do any of you know how to figure it out? I think it deals with combinations.

There are n socks in a closet, and 3 of them are purple. What is the value of n such that when 2 socks are taken randomly from the drawer, the probability that they are both red is 0.5?

#### Relevant Interview Data

New York, NY - 2019

New York, NY - 2019

New York, NY - 2019

New York - 2019

New York, NY - 2019

New York, NY - 2019

Not certain but I think it's n = 11 total (assuming the 8 non-purple ones are all red) - though this answer does not come out with a clean 0.5 probability, the probability for my answer is actually .5090

There's an 8/11 probability of picking a red one on your first grab, and a 7/10 probability of picking a red one on your second draw. = 8/11 * 7/10 = .5090

To find the solution, I used combinations as you suggested with the numerator being: Combination (n - 3, 2)
Choose 2 out of the total number of red socks = total socks - purple socks = n - 3
and the denominator being: Combination (n, 2)
Choose 2 out of the total number of socks = n

Combin (n - 3, 2) / Combin (n, 2) = approx .5

For my choice of n I just did an iteration of integers upwards from 5 till I got in the ballpark.

Once again, I'm not sure if it's right since it's not exactly .5 but let me know your thoughts.

3/ N * 2/ (N-1) = 0.5

Solve for that and you get 4

3/4 - first sock
2/3 - second sock

= 0.5

• 1

Wait, did he want to know the probability of getting a purple sock or a red sock?

Actually you're right. I totally misread the question.

(N-3)/N * (N-4)/(N-1) = 0.5

• 2

So, like all math questions we need to break it down.
Are the variables independent are dependent(you should have asked this), I'm going to guess dependent. You also should have asked are there any other colors.

We are trying to solve for N which is the total number of socks in the closet

So, how many red socks are in the drawer? Well we know that 3 out of N are are purple so N -3 can't be purple.

Thus on the first pick the probility is P(N-3) = (N-3)/N.

Ok, so after the first pick what is remaining? Well, the amount of scoks left would be N -1, because one sock got taken off. The numerator would also have to have one more sock missing N-4 because N-3 -1 = N-4.

Thus on the second pick the probibility is P(N-4| N-3) = (N-4 )/(N-1)

Use the General Rule of Multiplication to solve this problem we have

P( N-3 and N-4) = P(N-3) * P(N-4| N-3) = (N-3)/N * (N-4)/(N-1) = (n^2 -7n +12)/n^2 = (-7n +12)/n^2 = -.5

= -7n+12 = -.5n^2 = .5n^2 - 7n +12 = 0

So, N = aprox 11

lol i made an algebra mistake some where in that long txt

• 2

814 questions across 165 hedge funds. 10+ Sample Pitches (Short and Long) with Template Files. The WSO Hedge Fund Interview Prep Course has everything you'll ever need to land the most coveted jobs on the buyside. Learn more.

wait that can't be right

blastoise:

wait that can't be right

Lol... that was impressive however, all the diagnostics/breaking down whatnot.

It's what you put into it

814 questions across 165 hedge funds. 10+ Sample Pitches (Short and Long) with Template Files. The WSO Hedge Fund Interview Prep Course has everything you'll ever need to land the most coveted jobs on the buyside. Learn more.

you simplified the denominator to N^2 when it should be N^2-N

You can also think about it another way:

The number of possible dual red combinations assuming only red and purple socks and R as number of red socks-
(R)(R-1)/2

The number of total combinations of socks with T as total number of socks should be-
(T)(T-1)/2

Since you know that T=R+3 and the probability of dual red is .5, all you need to do is put it together.

((R)(R-1)/2) / ((T)(T-1)/2) = .5
->
(R)(R-1) / (R+3)(R-2) = .5
->
R^2-7n-6=0
->
R~8
T~11

Instead of having of having to do the quadratic u could just guess and check. Since .7 squared is.49 u know that the two fractions have to b around there. Obviously the odds of the first sock being red is higher thN the second so were looking for a fraction just larger than 7/10...so u guess 8/11and then it checks out

• 1

....

Yea 11's probability should be 56/110 or 1/110 over our goal of .50

Assuming no replacement, the equation you're solving is:

(n-3)/n * (n-4)/(n-1) = 0.5

Rearranging, you get:

(n-3)(n-4) = 0.5n(n-1)

Foiling and multiplying by 2:

2(n^2 - 7n + 12) = n^2 - n
2n^2 - 14n + 24 = n^2 - n

Simplifying and collecting terms on one side:

n^2 -13n + 24 = 0

Apply quadratic_formula(1, -13, 24) and you get ~10.8 and ~2.2 as solutions.

• 1

^^ that is correct answer i forgot how to do quadratic forumla lololol

if the question is right, then you can't know because you dont know how many red socks there are, just purple

lifeofpurpose:

if the question is right, then you can't know because you dont know how many red socks there are, just purple

sure, if you want to be pedantic about it. or be a reasonable person and just assume that red = non-purple.

dabanobo:
lifeofpurpose:

if the question is right, then you can't know because you dont know how many red socks there are, just purple

sure, if you want to be pedantic about it. or be a reasonable person and just assume that red = non-purple.

When reading the question, that never even occurred to me, I was thinking the same exact thing as lifeofpupose was.

I'm sure the question was asked in a clearer way than the way the OP paraphrased it.

• 1

The answers to date have missed the point completely.
If there are k red socks among n socks, the probability of picking two red socks at random is (k/n), the chance of getting a red sock on the first pick, times (k-1)/(n-1), the chance of getting a red sock on the second pick given that you got a red sock on the first pick. So we need to solve k(k-1)/[n(n-1)]=0.5 or n^2 - n - 2k^2 + 2k = 0.
The quadratic formula tells us we need 2n - 1= sqrt(8k^2-8k+1), so 8k^2-8k+1 must be an odd perfect square.
The first solution is k = n = 1, which is inadmissible since the probability of picking two red socks is undefined, 0/0.
The next solution is k = 3, n = 4 which is inadmissible since there can't be three purple socks if there is only one non-red sock.
The next solution is k = 15, n = 21, which works. 15 red socks, 3 purple socks and three non-red, non-purple socks. There are also solutions at k = 85, n = 120, and k = 493, n = 697.
I suspect you get a pretty good score by setting things up properly and realizing that n = 1 and n = 3 don't work. If you can come up with n = 21 in your head during an interview, that's great, but most people would likely explain how to get the answer with a short computer program or how they would do it by mental trial and error in ten minutes or so. You don't have to try every number since you know k/n has to be near sqrt(.5)+1/(7n).

• 1

Your answer is wrong and overly complicated... There are 3 purple socks not at least 3 purple socks.

Yes, three purple socks and an unknown number of socks that are neither red nor purple.
You may be right about overly complicated, there may be a simpler way to find the answers. But The answer are correct in that they meet both stated conditions: there are three purple socks and if you pick two at random the probability they are both red is 50%.

I see what you are saying and can admit you're answer is better. I was putting myself in the situation and assuming the interviewee confirmed that the rest of the socks were red. In a trading position it's important to gather all the information you can and try to quantify what you don't/can't know.

I partly agree. I use brain teasers a lot in my interviews, and the main think I look for is attitude. People who are used to thinking things through and getting things right attack problems with confidence. They don't always get the answer right, but they take reasonable approaches and explain them. Yes, they ask questions, but the type of question is important.

Most people fail the test, but not for getting the wrong answer or even for not seeing how to approach the problem. They ask random questions to stall. They are overly suspicious about tricks (e.g. "you said it was dark, but am I able to feel the difference between the different sock colors?").

They don't appreciate that the problem was carefully crafted and tells you all you need to know, and is hard enough to be interesting, but not impossible. Starting from that assumption, you can answer most questions for yourself. Just asking questions without thinking about the problem makes you seem unaware of the situation.

Rather than asking, "Are all the socks either red or purple?" it's better to say, "Well, the straightforward solution is to assume there are only purple and red socks, so I need to solve 2K(K-1)=(K+3)(K+2), which reduces to K^2-7K-6=0 which has no integer roots since 49+24 is not a perfect square. So are are at least three colors, right?" Right there you've shown you've understood the problem and have some idea how to solve it. Asking the question without thinking about whether it could be true is lazy or stalling.

Another popular way to fail is to say random stuff and look at the interviewer's face hoping to see if you're close; or to get him or her to give you hints.

Remember your goal is not to solve the problem, but to get the job. To do that you should demonstrate confidence about solving problems like this. If you're not confident, it's probably because you're not good at it. You should look for ways to show intelligence--like explaining why there must be some non-red/non-purple socks--you don't need to get the right answer to do that.

• 4