Question
Question: A drawer contains a mixture of red socks and blue socks, at most 17 in all. It so happens that when ...
A drawer contains a mixture of red socks and blue socks, at most 17 in all. It so happens that when two socks are selected randomly without replacement, there is a probability of exactly 1/2 that both are red or both are blue. The largest possible number of red socks in the drawer that is consistent with this data is.

10
Solution
Let R be the number of red socks and B be the number of blue socks. The total number of socks is N=R+B. We are given that N≤17.
The number of ways to select two socks from N is (2N)=2N(N−1).
The number of ways to select two red socks is (2R)=2R(R−1).
The number of ways to select two blue socks is (2B)=2B(B−1).
The probability that both socks are red or both socks are blue is given as 1/2.
This probability is P(both red)+P(both blue)=(2N)(2R)+(2N)(2B).
2N(N−1)2R(R−1)+2B(B−1)=21
N(N−1)R(R−1)+B(B−1)=21
2[R(R−1)+B(B−1)]=N(N−1)
Substitute B=N−R:
2[R(R−1)+(N−R)(N−R−1)]=N(N−1)
2[R2−R+(N2−NR−N−NR+R2+R)]=N2−N
2[2R2−2NR+N2−N]=N2−N
4R2−4NR+2N2−2N=N2−N
4R2−4NR+N2−N=0
We can solve this quadratic equation for R:
R=2(4)−(−4N)±(−4N)2−4(4)(N2−N)=84N±16N2−16(N2−N)
R=84N±16N2−16N2+16N=84N±16N=84N±4N=2N±N
For R to be an integer, N must be a perfect square, and N±N must be even. If N=k2, then R=2k2±k=2k(k±1). Since k(k±1) is always even, R is an integer if N is a perfect square.
Also, we must have N≥2 for the selection of two socks to be possible, so (2N)>0.
The possible perfect squares for N≤17 are 1,4,9,16. Since N≥2, we consider N∈{4,9,16}.
Case 1: N=4. R=24±4=24±2. R1=24+2=3. If R=3, B=N−R=4−3=1. (R,B)=(3,1). R2=24−2=1. If R=1, B=N−R=4−1=3. (R,B)=(1,3). Both solutions are valid since R,B≥0. The possible values for R are 1 and 3.
Case 2: N=9. R=29±9=29±3. R1=29+3=6. If R=6, B=N−R=9−6=3. (R,B)=(6,3). R2=29−3=3. If R=3, B=N−R=9−3=6. (R,B)=(3,6). Both solutions are valid since R,B≥0. The possible values for R are 3 and 6.
Case 3: N=16. R=216±16=216±4. R1=216+4=10. If R=10, B=N−R=16−10=6. (R,B)=(10,6). R2=216−4=6. If R=6, B=N−R=16−6=10. (R,B)=(6,10). Both solutions are valid since R,B≥0. The possible values for R are 6 and 10.
The possible values for the number of red socks R are {1,3,6,10}.
We are looking for the largest possible number of red socks.
The largest value in the set {1,3,6,10} is 10.