[Math] Hat-Matching Problem, Probability of exactly 1

probability

A group of n professors attend a meeting, all wearing hats. At the beginning of the meeting, they put their hats away. At the end of the meeting, each picks a hat at random. The probability that none of them gets the right hat is:

$\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!\:}-…+\frac{\left(-1\right)^n1}{n!}$

The probability that at least one professor will get the right hat is:

$1-\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!\:}-…+\frac{\left(-1\right)^n1}{n!}$

What is the probability that exactly one of them gets the right hat?

Best Answer

Let $E_i$ be the event that professor $i$ gets their hat back. First find $P(E_1\cap E_2^c\cap E_3^c\cap \dots\cap E_n^c)$, the probability that the first professor gets their hat back and no one else does. The final answer is $n$ times this probability. $$ \begin{align} P(E_1\cap E_2^c\cap E_3^c\cap \dots\cap E_n^c) =P(E_2^c\cap \dots \cap E_n^c|E_1)P(E_1) \end{align} $$ Now, given that $E_1$ has occurred, we are just down to the $n-1$ professor situation, so $$ P(E_2^c\cap \dots \cap E_n^c|E_1)= \frac1{2!}-\frac1{3!}+\dots +\frac{(-1)^{n-1}}{(n-1)!} $$ Putting this all together gives you your answer.