This question already has an answer here:

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?


marked as duplicate by Marc van Leeuwen, Carl Mummert, Shobhit, Jack D'Aurizio, PhoemueX Feb 22 '15 at 19:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ (Assume everyone got a hat before exchange.) $\endgroup$ – RHS May 18 '13 at 10:53
  • $\begingroup$ How many people do you have ? if $X$ is discrete then he doesn't have a density function, maybe you are looking for the distribution ? $\endgroup$ – Belgi May 18 '13 at 10:55
  • $\begingroup$ Right it should be pmf. $\endgroup$ – RHS May 18 '13 at 10:59
  • $\begingroup$ OK, but The answer still depends on how many people you have $\endgroup$ – Belgi May 18 '13 at 11:02
  • $\begingroup$ Yes, I will change the $X$ to $X_N$, where $X_n$ could integers be from 0 to N. $\endgroup$ – RHS May 18 '13 at 11:03

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 ?)

  • $\begingroup$ Thank you. But I think what you just did was rewriting my question. Also n is from 0. Means no one getting there own hat. $\endgroup$ – RHS May 18 '13 at 11:42
  • $\begingroup$ I think maybe you could show how to get the pmt of N=4 as an example. $\endgroup$ – RHS May 18 '13 at 12:06
  • $\begingroup$ @RHS - this is not a rewrite to your question. the hints are in the last paragraph. Note that the word "dearrange" is a link to guide you do find the number of permutations without fixed points $\endgroup$ – Belgi May 18 '13 at 12:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.