# Number of socks?

This same problem also appears here: http://perplexus.info/show.php?pid=9271

A drawer contains a mixture of red socks and blue socks, at most $2014$ in total. It so happens that, when two socks are selected randomly without replacement, there is a probability of precisely $\frac23$ that both are red or both are blue.

What is the maximum possible number of red socks in the drawer that is consistent with this data?

• When you say precisely, that is indeed an exact value? And 2/3 is the chance of (Blue/Blue OR Red/Red)? – oerkelens Nov 7 '14 at 10:47
• @oerkelens, here is a possible solution as an example: You could have 20 red socks and 5 blue socks. The prob of both red = 20*19/25*24 plus prob of both blue = 5*4/25*24 = 2/3. – Kenshin Nov 7 '14 at 10:49

The answer is $1065$ red and $285$ blue socks.
Probability of getting same colours = $\frac{1065 \times 1064 + 285 \times 284}{1350 \times 1349} = \frac23$
$r + b \le 2014$
$r \ge 0, b \ge 0$
$3 \times (r^2 - r + b^2 - b) = 2(n^2 - n)$
Solving all, $r = 1065$, $b = 285$ and $n = 1350$