The Permutation That Avoids Its Own Position
Let be the set of all permutations of . For a permutation , say that is a fixed point if .
Now consider all permutations and look at .
Compute this sum. Then use it to find the expected number of fixed points of a uniformly random permutation of .
Does the answer surprise you?
Answer: Expected Fixed Points of a Random Permutation
Key Idea / Intuition
Instead of thinking about each permutation as a whole, swap the order of summation: count, for each position , how many permutations fix . This linearity trick turns a complicated global count into identical easy counts. The surprise is that the expected number of fixed points is exactly , regardless of — even as .
Formal Proof / Solution
Step 1: Swap the sum.
\sum_{\sigma \in S_n} (\text{# fixed points of } \sigma) = \sum_{\sigma \in S_n} \sum_{i=1}^n \mathbf{1}[\sigma(i) = i] = \sum_{i=1}^n \sum_{\sigma \in S_n} \mathbf{1}[\sigma(i) = i].
Step 2: Count permutations fixing a given .
For a fixed , the number of with is , since the remaining elements can be arranged freely.
Step 3: Compute the total.
\sum_{\sigma \in S_n} (\text{# fixed points of } \sigma) = \sum_{i=1}^n (n-1)! = n \cdot (n-1)! = n!.
Step 4: Expected value.
Since there are permutations total, the expected number of fixed points of a uniformly random permutation is:
\mathbb{E}[\text{# fixed points}] = \frac{n!}{n!} = \boxed{1}.
Why is this beautiful?
The same argument via linearity of expectation is even slicker: let . Then , and
The are not independent — if fixes 1 and 2, it cannot fix if it must be a derangement of the rest — yet their expectations add linearly anyway, giving exactly 1 for all . The answer is independent of : whether you shuffle 3 cards or 3 million, on average exactly one card lands in its original position.
This is also the starting point for the derangement formula: the probability of no fixed points approaches as , yet the mean never moves from 1.
Source: Mathematical folklore / Putnam warmup