Answer:
E[X] = 1
Var[X] = 1
Explanation:
We are told that n people enter the restaurant and put their hats at the reception.
This means that there are n hats.
Also, we are told that eeach person gets a random hat back when going back after having dinner.
Thus, each person will pick a hat uniformly at random and will get a right hat back with the probability: 1/n.
The expectation is linear even though the random variables are dependent. Thus, the expected mean of the total number of persons who get their right hat back is: E[X] = n × 1/n = 1
Now, the variance in hat problem is given by;
Var[X] = E[X²] - E[X]²
This gives;
Var[X] = E[X²] - 1
Now, E[X²] is expressed as;
E[X²] = n(1/n) + n(n - 1)•(1/n)•(1/(n - 1))
E[X²] = 1 + 1
E[X²] = 2
Thus;
Var[X] = 2 - 1
Var[X] = 1