Find the number of derangements of {1, 2, ..., n} using inclusion-exclusion principle

Answer: Dn=n!∑k=0n(−1)kk!=n!(1−11!+12!−13!+⋯+(−1)n1n!)D_n = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!} = n! \left( 1 - \frac{1}{1!} + \frac{1}{2!} - \frac{1}{3!} + \dots + (-1)^n \frac{1}{n!} \right)

Step-by-step solution

Step 1: Define Derangements and Total Permutations

A derangement is a permutation of the elements of a set, such that no element appears in its original position. We want to find the number of such permutations for a set of nn elements. First, let's recall that the total number of permutations of nn distinct elements is n!n!.

Step 2: Define Properties for Inclusion-Exclusion

To use the inclusion-exclusion principle, we define properties. Let AiA_i be the set of permutations where the ii -th element is in its original position. We are looking for the number of permutations where *none* of the elements are in their original positions, which is n!−∣A1∪A2∪⋯∪An∣n! - |A_1 \cup A_2 \cup \dots \cup A_n|.

Step 3: Calculate Sizes of Intersections

If element ii is in its original position, the remaining n−1n-1 elements can be permuted in (n−1)!(n-1)! ways. Similarly, if kk specific elements are in their original positions, the remaining n−kn-k elements can be permuted in (n−k)!(n-k)! ways. There are (nk)\binom{n}{k} ways to choose which kk elements are fixed.

Step 4: Apply Inclusion-Exclusion Principle

Now we apply the inclusion-exclusion principle to find the size of the union of all sets AiA_i. We substitute the expressions for the sums of the sizes of intersections we found in the previous step.

Step 5: Simplify the Sum

We simplify the term (nk)(n−k)!\binom{n}{k}(n-k)! to n!k!\frac{n!}{k!}. This allows us to factor out n!n! from the sum, making the expression more compact.

Step 6: Calculate Number of Derangements

The number of derangements DnD_n is the total number of permutations minus the number of permutations where at least one element is in its original position. We substitute the simplified sum into this formula and factor out n!n!.

More from this chapter

All Permutations and Combinations solutions →

Solve your own maths question free →