This is a problem from an exam that I took a while back, so I might not be remembering it completely correct. I checked other questions on the forum but I didn't find anything that answers my question.
Problem:
Upon entering a restaurant, each customer leaves their coat on a coat hanger uniformly at random. A total of 12 customers arrive at the restaurant and leave their coat there. After finishing their meal, each customer (one at a time, no order in particular), will take their coat at random and leave.
- What is the probability that everyone gets their own coat?
- What is the expected number of people who get their own coat?
I think it's the fact that each customer is leaving one by one that is confusing me the most.
My attempt:
Define a variable $X_i$, for $i=1,...,12$ such that
$$ X_i :=\begin{cases} 1 &\text{if person $i$ gets coat $i$},\\ 0 &\text{otherwise}. \end{cases} $$
Then, initially, the probability that any person gets their own coat is
$$P(X_i = 1) = \frac{1}{12}.$$ However, after the first person picks up a coat, we have $11$ people and coats left, and we don't know whether the previous customer took their own coat or not. So I thought about finding the conditional probability $$P(X_i = 1 \vert X_\text{prev}) = \frac{P(X_i = 1, X_\text{prev} = 1)}{P(X_\text{prev})}$$but I'm not sure how to evaluate it.
On the other hand, if we consider all 12 people taking a coat from the coat hanger at the same time, we could find the probability that each person took their own coat (thus, $X_i \sim \text{Bernoulli}\left(\frac{1}{12}\right)$).
We could compute the probability that the $k$ coats are given to the correct customers by considering the derangement of $k$ coats $$P(\mathcal{C}_k) = 1 - \frac{!k}{12!},$$where we define $\mathcal{C}_k := \{X_i : X_i = 1, i = 1,...,k\}$ to be the $k$-set of $X_i$'s such that a coat is given to the correct person. Then, all 12 people get their own coat with probability $$P(\mathcal{C}_{12}) = 1 - \frac{!12}{12!} = 1 - \frac{1}{12!}\cdot\left[\frac{12!}{e}\right] \approx 1 - \frac{1}{e} \approx 1 - 0.3678794413 = 0.6321205587.$$
For the expected number of customers that get their own coat, we need to compute $$\mathbb{E}[X_1 + X_2 + ... + X_{12}] = \sum_{i = 1}^{12} \mathbb{E}[X_i] = \sum_{i =1}^{12} P(X_i = 1).$$But I'm not sure how to proceed here because it changes whether we consider that the customers pick the coats up one at a time or simultaneously.
If they all pick it up simultaneously, then we would just have that $$\mathbb{E}[X_1 + X_2 + ... + X_{12}] = 1$$since it is equally likely that they pick up their own coat. (Although, I can't make sense of the result, as to why the expected number of people who pick up the correct coat is just 1, for any $n$).
However, if they take one at a time, the probability $P(X_i = 1)$ would change as the coats are taken and I don't know how to approach this computation.
I guess what I need help with is how to compute (1) and (2) considering that only one customer leaves at a time (randomly), instead of all of them leaving together. But I'm also wondering whether there is even enough information to find that out.