Text
At a dinner guests leave their hats at the cloakroom. On leaving, each picks up one at random. In how many ways can it happen that no one picks up their own hat (a derangement)?
Solution
We seek the number of permutations of objects in which no element stays in its own place. The inclusion-exclusion formula holds: For :