<s>[INST] Probability using indicator function There are 10 pairs of different socks in a drawer. You take 5 pairs out of it. What is the expected value of matching socks?
Is it OK to use the indicator function as follows?
Let $X$ be the number of pairs that match. Let $I_i$ be the indicator function that takes $1$ if the the $i$ pair matches, and $0$ if it doesn't.
This allows to express $X$ as $X=I_1 + I_2 + ... + I_5$.
To calculate $I_i$, we use the probability of a random pair being a match, that is $I_i={10\over{20 \choose 2}}$.
Now we can use the linearity of the expectation to compute the result.
Edit: Fix probability
 [/INST] I am not familiar with the method of indicator functions, but we may check your solution using basic counting methods. We count cases for each specific number of matching pairs. We will use derangements in our solution, which is notated by $!n.$
The total number of ways to draw the socks is $\frac{\dbinom{10}{2}\dbinom{8}{2}\dbinom{6}{2}\dbinom{4}{2}\dbinom{2}{2}}{5!} = 945.$
Case 1: $0$ matching pairs
Notice that since there are $0$ matching pairs, we can neglect this case in our expected value calculation.
Case 2: $1$ matching pair
$P(1) = \frac{5 \cdot !4}{945} = \frac{45}{945} = \frac{1}{21}.$
This contributes $1 \cdot \frac{1}{21}$ to the expected value.
Case 3: $2$ matching pairs
$P(2) = \frac{\dbinom{5}{2} \cdot !3}{945} = \frac{20}{945} = \frac{4}{189}.$
This contributes $2 \cdot \frac{4}{189}$ to the expected value.
Case 4: $3$ matching pairs
$P(3) = \frac{\dbinom{5}{3} \cdot !2}{945} = \frac{10}{945} = \frac{2}{189}.$
This contributes $3 \cdot \frac{2}{189}$ to the expected value.
Case 5: $5$ matching pairs
$P(5) = \frac{!0}{945} = \frac{1}{189}.$
This contributes $5 \cdot \frac{1}{189}$ to the expected value.
Our expected value is $\boxed{\frac{8}{63}}.$
</s>