How do I calculate the pmf of $X_N$, where $X$ is the number of people out of $N$ getting back their own hat after a random hat exchange?
How can I calculate it without listing all the possible outcomes?
How do I calculate the pmf of $X_N$, where $X$ is the number of people out of $N$ getting back their own hat after a random hat exchange?
How can I calculate it without listing all the possible outcomes?
Hint: For $0\leq n\leq N$ : $P(X_{N}=n)$ is the probability that exactly $n$ people got their hat back.
In how many ways this can be done ?
If want to fix some $n$ hats in their place (in how many ways can we choose them ?) and dearrange the other $N-n$ hats (in how many ways can you do that ?)