Closed form of pairing probability This situation happened to me at home today, and now it is bugging me. I didn't put all my clothes in the washing machine, and I retrieved 7 sockets, 2 pairs of socks and 3 unpaired ones.
I wanted to come up with the most likely number of pairs but I couldn't. I assume it is close to a binomial distribution but the pairing has made my life miserable.
My random variables are:


*

*$\Theta$ pairs of socks

*$n$ drawn socks

*$2\cdot k$ paired socks


Is there a way to derive the close- form for $P(y|2\cdot \Theta)$?
 A: $$ P(2k, n-2k| \Theta) = \frac{2^{n-2k}  \binom{\Theta-k}{n-2k} \binom{\Theta}{k}}{\binom{2\Theta}{n}}.$$

Denominator - Unconstrained no. ways to choose socks
This is given exactly by the binomial coefficient to choose $n$ objects from $2\Theta$:
$$\binom{2\Theta}{n}.$$

Numerator - No. ways to choose $k$ pairs
This is again a binomial coefficient: we want to choose $k$ pairs out of a set of $\Theta$:
$$\binom{\Theta}{k}$$

Numerator - No. ways to choose the single socks
There remain $\Theta - k$ pairs of socks ,and we want to to choose $n-2k$ of these: as before the number of ways to choose the types of socks will be $\binom{\Theta-k}{n-2k}$.
However we now need to account for the fact that for each pair of socks there were two possible choices (eg. left/right foot). So for each type of sock we need to multiply by a factor of $2$, giving:
$$2^{n-2k}  \binom{\Theta-k}{n-2k}$$

Notes
The above assumes that all of your socks go into the wash in pairs: note that this differs from Baath's assumption in the link that Tim provided, where he supposes that its possible that there are some single socks in the wash.
(Edited) As discussed in the comments when $k = 0$ the likelihood will be maximised as $\Theta \rightarrow \infty$. To get around this case you may wish to regularise by making assumptions about the reasonable expectations of the maximum (eg. what's the maximimum no. socks your machine could hold) - this is well suited to a Bayesian analysis where you would place a prior on $\Theta$. Again, Baath's post gives a good introduction.
Here's a blog post I wrote on the explicit calculation for Baath's analysis.
