We use the Inclusion-Exclusion Principle to enumerate derangements.

(problem 1) Show that and by explicitly listing all possible derangements of and respectively.

We now use the Inclusion-Exclusion Principle to count the number of derangements of the set in which the number is not in the position for each from to .

Proof
For each from to , let be the set of permutations of that has in the position. Then and for each . Furthermore, and . We see that the number of elements in the intersection of of these sets will be .
We seek By De Morgan’s Law (for sets), the Rule for Complements and the Inclusion-Exclusion Principle, we have
(problem 2) Use the formula for given in the theorem to compute and .

It is also possible to use combinatorial reasoning to obtain a recursive formula for derangement numbers, .

Proof
Let and consider the derangements of where the is in the first position. These derangements can be partitioned into two sets- those permutations for which is in the position and those for which is not in the position.
Case 1) is in the first position and is in the position. The number of such derangements is simply since the remaining elements can be permuted among themselves in ways in order to obtain a derangement.
Case 2) is in the first position and is not in the position. The number of derangements in this case is the number of ways to permute , (the 1 is in the position) such that 2 is not first, 3 is not second, ..., is not , ..., and the is not last. This is the number of derangements of the symbols and hence it is .
The result follows by noting that there are possibilities for the choice of .
(problem 3) Use the recursive formula to compute and .
(problem 4) Find the limit as of the probability in the hat check problem.
(problem 5) Seven people check their hats at an establishment. In how many ways can the hats be returned so that
a) no person receives their own hat?
b) at least one person receives their own hat?
c) at least two people receive their own hat?
d) exactly six people receive their own hat?

There is a second, slightly simpler recursion formula for the derangement numbers that can be derived from the recursion formula in the proposition above.

(problem 6) Verify that the recursion relation holds for and . Then, use mathematical induction to prove that it holds for all .
(problem 7) Use the recursion relation in problem 6 and your result for from problem 3 to compute and .

Permutations can be partitioned into the number of objects which are not moved from their original position.

(problem 8) Use a counting argument to establish the identity: