Suppose $n$ people each have a hat which they check at a hat room. Suppose that hats are returned randomly. Let $Y$ be the number of people who get their own hats. Find $E(Y)$ and $Var(Y)$.
After few hours, I use some formula in combinatorics and generalize the event as
$f(y)$=(Number of ways of $y$ people get their hat)*(Number of ways of $n-y$ people derangement their hats)/(Total Possibilities)
$$\therefore f(y)=\frac{{n\choose y}*(n-y)!\bigg(1-1+\frac{1}{2!}+...+(-1)^y\frac{1}{(n-y)!}\bigg)}{n!}$$
Simplify $f(y)$, $$f(y)=\frac{1}{y!}\bigg(1-1+\frac{1}{2!}+...+(-1)^y\frac{1}{(n-y)!}\bigg)$$ where $0\leq y\leq n$
Then I applied this information which is $$\sum^n_{y=0}P(Y=y)=1$$
After 3 pages of working, then I get answer of
$$E(Y)=Var(Y)=1$$
Although I solved this problem, but new problems arise from my mind:
- Is there other ways to get the answers without have the knowledge of derangement formula?
- Any shorter and simpler ways to answer this question? (I feel my way of solving quite dumb)
- And how to show that $\sum^n_{y=0}P(Y=y)=1$ according to my $f(y)$?
$Y = \sum_{i=1}^n Z_i$ where $Z_i = 1_{\{\text{i-th person went home with correct coat}\}}$
$E(Y) = \sum_{i=1}^n E(Z_i) = n\times 1/n=1$
For $Var(Y)$, note
$E (Y^2) = \sum_{i=1,j=1} E(Z_iZ_j) $.
Note that $E(Z_i^2)=\frac{1}{n}$, and $E(Z_iZ_j)= \frac{1}{n(n-1)}$ for $i,j$ distinct, then use
$Var(Y) = E(Y^2)-E(Y)^2$.
Note that the only thing I used here is linearity of expectation. I am sure this is the simplest way of doing this question (and probably the intended way for a probability course).