Probability of drawing a same color pair of socks “blindly” (in a dark room)

probability

This is a variation of a probability problem I had in college.

Suppose there are 10 different colored socks in a sock drawer in no particular arranged order, call the colors a,b,c,d,e,f,g,h,i and j. The quantities of each of those colored socks are 1,2,3,4,5,6,7,8,9 and 10 respectively. So for example, 1 sock of color a, 5 socks of color e, 10 socks of color j.

It is dark in a room so a person just grabs 2 socks at random without being able to see any of the colors of them. However, because the person cannot see if the first pair is a match, he draws a 2nd pair of socks in an attempt to increase his chances of getting a matched pair.

Part 1) What is the probability that the person grabbed a pair of matching color socks if a match can only be made between socks 1 and 2, and/or socks 3 and 4. For example, if the 4 socks drawn are b, c, b, d, then that is NOT a match since (b,c) and (b,d) are different pairs without a match within each pair. It would have to be something like (b,b) and (c,d). Also the and/or part covers situations such as (b,b) (c,c) which counts as 1 match (not 2).

Secondly, if ANY match counts (even across pairs), what then is the probability of getting at least one matched colored pair of socks in the 4 drawn? In our previous b,c,b,d example, that WOULD be considered a matched pair because we have (b,b). We are allowed to match any same colored socks of the 4 drawn, regardless of the order drawn.

I am not yet sure how to solve this mathematically, however a computer simulation of the first part of the question is showing about $21$% and the 2nd part is showing about $53.74$%

F.Y.I. 28 lines of code, about 10 million iterations (simulated random draws of 4 socks from 55 possible), to get the probabilities.

Also, one thing I noticed to help solve the first part… if we simplified it to be just drawing 2 socks and checking for a match, the correct answer should be 1/9 which is ($1 \choose 2$ + $2 \choose 2$ + … + $10 \choose 2$) / $55 \choose 2$. Then if we draw 2 more socks, we have the a similar expression, except over $53 \choose 2$, so that is $165/1378$. If you add those 2 together, you get about 23% which is pretty close to the simulation which gave 21%. You would only have to subtract out the cases where you would get a matched pair in both the first and 2nd pair (so as to only count that match once, not twice). For example, (b,b) (c,c) counts as a single match, not a double.

To approximate the 2nd part, we can again look at the much simpler example of only drawing 2 socks and get 1/9th probability of a match which is about 11%. However if we instead draw 4 socks and allow any matched pair of them to count as a match, now we have $4 \choose 2$ different pairs to examine for that match, so a VERY rough approximation would be 6 times 11% = 66%. Again we have to subtract out the cases where more than one match can occur (such as b,c,b,c or d,d,e,e… Since more than one matched pair is more likely this way, the roughly 10% "correction factor" in the first part should be approximately doubled to 20% to account for this.

So using those we get 0.23 – 10% = 20.7% for the first part (pretty close) and .67 (rounded) – 20% = 53.6% for the 2nd part (even closer).

These correction factors are not mathematical calculated, however they are more of a "feel" of how the numbers should be reduced.

Best Answer

For the first one (I am using Wolframalpha to simplify sums):

We have the following possibilities that yield positive outcomes:

  1. We have four of the same color - No matter what order the socks are chosen, this yields a positive outcome
  2. We have two distinct color socks - We can have a breakdown of 3 and 1 or 2 and 2. If the breakdown is 3 and 1, every outcome is positive. If the breakdown is 2 and 2, then only orders where we wind up with two pairs work.
  3. We have three distinct colors of socks. Here, we need a matching pair plus a non-matching pair.

Suppose instead of 10 colors, we have $n$ colors, and we have $k$ socks of the $k$-th color. This means we have a total of $\dbinom{n+1}{2}$ socks. And the total number of ways to pick four socks is $$\dbinom{\binom{n+1}{2}}{4}4!$$

So, the total number of solutions in case 1:

$$\sum_{k=1}^n \dbinom{k}{4}4! = \dbinom{n+1}{5}4!$$

Case 2(a): 3 socks of 1 color, 1 sock of a second color:

$$\sum_{j=1}^{n-1}\sum_{k=j+1}^n\left( \dbinom{j}{1}\dbinom{k}{3}+\dbinom{j}{3}\dbinom{k}{1} \right)4! = \dbinom{n}{2}\dfrac{5n^4-8n^3-13n^2+12n+12}{5}$$

Case 2(b): 2 socks of 2 colors each:

$$\sum_{j=1}^{n-1}\sum_{k=j+1}^n \left(\dbinom{j}{2}\dbinom{k}{2}2!2!\right)2! = \dbinom{n}{3}\dfrac{2(5n^3+6n^2-2n-3)}{15}$$

Case 3: Choose two of 1 color and one of each other color, choose the position of the matching pair, then permute the two socks in each pair:

$$\sum_{i=1}^{n-2}\sum_{j=i+1}^{n-1}\sum_{k=j+1}^n \left(\dbinom{i}{2}\dbinom{j}{1}\dbinom{k}{1}+\dbinom{i}{1}\dbinom{j}{2}\dbinom{k}{1}+\dbinom{i}{1}\dbinom{j}{1}\dbinom{k}{2}\right)2!2!2! = \dbinom{n}{3}\dfrac{15n^4+10n^3-33n^2-34n-6}{15}$$

So, the total probability would be:

$$\dfrac{8 (3 n^3 + 10 n^2 - 7 n - 24)}{9 (n + 2) (n + 3) (n^2 + n - 4)}$$

Plugging in $n=10$ gives $$\dfrac{434}{2067} \approx 0.21$$

For the second problem, we have similar solutions for Case 1 and Case 2(a). For Case 2(b) and 3, instead of multiplying by 8, we multiply by $4!$. This gives a total probability (again, I just plugged the formulas into Wolframalpha) of:

$$\dfrac{8 (15 n^3 + 20 n^2 - 29 n - 48)}{15 (n + 2) (n + 3) (n^2 + n - 4)}$$

And plugging in $n=10$ gives:

$$\dfrac{5554}{10335} \approx 0.537$$

Note: Any time that I give a simplified sum, I just typed the original sum into Wolframalpha and it gives me a simplification. I am not justifying it beyond that.