Probability problem involving inclusion-exclusion principle

600 Views Asked by At

Let's say there are $n$ people who threw their hats in a box where they mixed up and each one of them randomly takes one hat from the box. What's the probability that nobody got the right hat?

I'm not sure how to define the events in this problem that will lead us to the solution.
For example, if I define the following events:
$A_i$ - $i$-th person took the wrong hat and
$A$ - nobody got the right hat

Does that mean that: $A=\bigcap\limits_{i=1}^{n}A_i$?
How can we then find $P(A)$ using the inclusion-exclusion principle: $$P(A)=\sum_{i=1}^nP(A_i)-\sum_{1\leq i\leq j \leq n}P(A_i\cap A_j)+\sum_{1\leq i\leq j \leq k \leq n}P(A_i\cap A_j\cap A_k)-\cdot\cdot\cdot+(-1)^{n-1}P(A_1\cap A_2\cap \cdot\cdot\cdot\cap A_n)$$

1

There are 1 best solutions below

0
On

By way of enrichment we compute the expectation and the variance. We have for permutations with fixed points marked the combinatorial class

$$\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}} \textsc{SET}(\mathcal{U}\mathcal{Z} + \textsc{CYC}_{\ge 2}(\mathcal{Z})).$$

This gives the mixed generating function

$$G(z, u) = \exp\left(uz + \sum_{q\ge 2} \frac{z^q}{q}\right) = \exp\left(uz-z + \log\frac{1}{1-z}\right) \\= \frac{1}{1-z} \exp(uz-z).$$

The expectation of the number of fixed points is then given by (the term $u^k z^n/n!$ representing a permutation of $n$ elements with $k$ fixed points should contribute $k z^n/n!$ and here $n\ge 1$)

$$\mathrm{E}[X] = [z^n] \left. \frac{\partial}{\partial u} G(z, u) \right|_{u=1} \\ = [z^n] \left. \frac{1}{1-z} \exp(uz-z) z \right|_{u=1} \\ = [z^n] \frac{z}{1-z} = 1.$$

We get for the second factorial moment when $n\ge 2$

$$\mathrm{E}[X(X-1)] = [z^n] \left. \left(\frac{\partial}{\partial u} \right)^2 G(z, u) \right|_{u=1} \\ = [z^n] \left. \frac{1}{1-z} \exp(uz-z) z^2 \right|_{u=1} \\ = [z^n] \frac{z^2}{1-z} = 1.$$

Using that

$$\mathrm{Var}[X] = \mathrm{E}[X(X-1)] + \mathrm{E}[X] - \mathrm{E}[X]^2$$

we obtain

$$\mathrm{Var}[X] = 1.$$