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?

### Comments (25)

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.

Answer is 4

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.

I guess the answer would be about 11

(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

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%.  