the setup: $N$ people arrive at a party all of whom are wearing hats. We collect all the hats and then redistribute them. What is the probability that exactly $k$ of the party members receive their own hats back?
let $E_i$ denote the probability that the $i^{th}$ man receives his own hat back. Then, $\space\space E_{i_1}E_{i_2}\dots E_{i_n} \space\space$ is the event that men labelled $i_1 , i_2 , \dots i_n$ get their own hats back. which implies...
$P(E_{i_1}E_{i_2}\dots E_{i_n}) = \frac{(N-n)!}{N!}$ and $\color{red}{\sum\limits_{i_1<i_2<\cdots <i_n}}P(E_{i_1}E_{i_2}\cdots E_{i_n}) = \binom{N}{n}\frac{(N-n)!}{N!} = \frac{1}{n!}$
question1: are the above two formulas correct?
The probability that at least $k$ of the party members receive their own hats back (using the inclusion-exclusion principle) is $$\sum_{i_1 < i_2<\dots<i_k}P(E_{i_1}E_{i_2}\dots E_{i_k}) - \sum_{i_1 < i_2<\dots<i_{k+1}}P(E_{i_1}E_{i_2}\dots E_{i_{k+1}}) + \dots + (-1)^{n-k}\sum_{i_1 < i_2<\dots<i_n}P(E_{i_1}E_{i_2}\dots E_{i_n}) + \dots + (-1)^{N-k}\sum_{i_1 < i_2<\dots<i_N}P(E_{1}E_{2}\dots E_{N})$$
question2: is the above formula correct?
Assuming that the above formulas are correct, the probability that at least $k$ of the party members receive their own hats back, comes out to be $$\sum_{i=k}^N \frac{(-1)^{i-k}}{i!} = \frac{1}{k!} - \frac{1}{(k+1)!} + \frac{1}{(k+2)!} - \dots +(-1)^{N-k} \cdot \frac{1}{N!}$$
question 3: is this correct?
$ \text{ the probability that exactly k of the party members receive their own hats back is} $
$$||$$
$$\text{(the probability that at least k of the party members receive their own hats back)}$$ $$-$$ $$\text{(the probability that at least k+1 of the party members receive their own hats back)}$$
question4: is the above formula correct?
Assuming everything until now is correct, the probability that exactly $k$ of the party members receive their own hats back, comes out to be $$= \bigg[\frac{1}{k!} - \frac{1}{(k+1)!} + \frac{1}{(k+2)!} - \dots +(-1)^{N-k} \cdot \frac{1}{N!} \bigg] - \bigg[ \frac{1}{(k+1)!} - \frac{1}{(k+2)!} + \dots +(-1)^{N-(k+1)} \cdot \frac{1}{N!} \bigg]$$ $$= \frac{1}{k!} - \frac{2}{(k+1)!} + \frac{2}{(k+2)!} - \dots +(-1)^{N-k} \cdot \frac{2}{N!}$$
but the given answer is $$\frac{1}{k!} \cdot \sum_{i=0}^{N-k}\frac{(-1)^i}{i!}$$
so something is definitely wrong
What I want to ask: could you please answer questions 1, 2, 3 and 4?
edit: I know that a simple way to answer the question is to use the concept of derangements, which gives the answer as $$\frac{\binom{N}{k} D_{N - k}}{N!}$$, where $D_n = n! \cdot \sum_{i=0}^{n}\frac{(-1)^i}{i!}$