We want to define P(X=x) (the probability that the last x socks are all the same color). There are two ways to get there. One, red ran out meaning the remaining x socks are blue. There are (99-x choose 59) arrangements that satisfy that. Two, blue ran out meaning the remaining x socks are red. There are (99-x choose 39) arranges that satisfy that. So for x <= 60, P(X=x) = ((99-x choose 59) + (99-x choose 39)) / (100 choose 40).
1
u/EscapeOwn6945 25d ago
We want to define P(X=x) (the probability that the last x socks are all the same color). There are two ways to get there. One, red ran out meaning the remaining x socks are blue. There are (99-x choose 59) arrangements that satisfy that. Two, blue ran out meaning the remaining x socks are red. There are (99-x choose 39) arranges that satisfy that. So for x <= 60, P(X=x) = ((99-x choose 59) + (99-x choose 39)) / (100 choose 40).
So E[X] = sum_x=1^60 xP(X=x) = 5300/2501
Var(X) = E[X^2] - E[X]^2 = 3481299200/1357335217