I have an interesting problem in the context of the hat matching problem: There are $n$ people with hats at a party. Each person randomly grabs a hat. A match occurs if a person gets his own hat.
I'd like to know three things:
i) The probability that no one gets their hat
ii) How often we expect someone to get their hat
iii) If we let the n men choose their hats every minute, how much time do we expect until the first match (that is at minute 1, man 1 picks his hat, at minute 2, man 2 picks his hat, etc...)
I got number i) using inclusion exclusion, and ii) using linearity of expectation but I'm stuck on iii)
Here's what I've done so far.
Essentially we're trying to find the number of random permutations $\{x_1 , ... , x_n\}$ of $\{1, ... , n\}$ such that :
$x_i = i\;$ AND $\;x_j != j$ for all $j < i$
Since if we know this, then we know the probability of match occurring at any given time.
Intuitively, this is the same number of ways of getting $x_1 = 1, x_2 != 2, ..., x_i != i$
But I can't see how to compute this since the number of ways of having $x_k != k$, for example, depends on wether or not $k$ was placed earlier in our permutation.
Thanks!
Here is how to solve this problem. Let $p_k$ be the probability that there are $k$ matches, given that there is at least one. We can estimate these probabilities as a Poisson random variable with expectation 1 conditioned on being positive. Given that there are $k$ matches, the matches are distributed uniformly, and the expected minimal match is known; it is roughly $n/(k+1) $. So your expectation is roughly $$ n\sum_{k\geq1} \frac{p_k}{k+1} \approx \frac{n}{e-1}\sum_{k\geq1} \frac{1}{(k+1)!}=\frac{e-2}{e-1}n.$$