There are 100 seats on a plane.
If each of the 100 passengers randomly take a seat,
how many people will have his/her own seat on average?
There is a classic way to solve this problem,
which is to decompose a (complicated) random variable into a sum of simple random variables.
This is an important trick.
See this post
for the use of this trick to calculate the covariance
of observastions in two categories in a multinomial distribution.
Let’s generalize this problem to assume that
there are n seats and n passengers.
Let Yi=I(passenger i takes its seat), 1≤i≤n,
where I is an indicator function.
Yi’s are exchangeable,
which means that for a fixed k (1≤k≤n),
any subset of Yi:1≤i≤n with k elements has the same distribution.
Specially,
it’s easy to see that
Surprisingly, both the mean and the variance of Xn is 1,
which suggests that we can predict Xn,
i.e. the number of integers that have the same position as their
original position very well.
The above solution is elegant.
However,
I’d like to try to solve this problem using my preferred universal procedure.
Let Yi and Xi, 1≤i≤n, be as defined above.
Conditioning Xn on Y1 gives us a recursive/differtial equation.
If Y1=1 (with probability n1),
i.e., the first passenger sits on its seat,
then Xn=1+Xn−1;
It’s a little tricky when Y1=0 (with probability 1−n1),
i.e., the first passenger sits on other people’s seat.
Assume the first passenger takes kth (2≤k≤n) passenger’s seat.
If we pretend that seat 1 is the kth passenger’s seat,
then we have Xn=Xn−1.
However, seat 1 is not kth passenger’s seat,
and we cannot count it into Xn−1.
Let Ek≡I(passenger k sits on seat 1).
We only miss count Xn−1 by extra 1 when Ek=1,
so when Y1=0 we have
where EX1=1.
This is the simplest recursive/differential equation.
Anyone can immediately see that EXn=1,∀n≥1 is the solution to this recursive/differential equation.