Concept 06 / 09Permutations and Combinations
Derangements and the Inclusion-Exclusion Principle in Counting
Counting with inclusion-exclusion over properties, the derangement formula D(n) = n! (1 - 1/1! + 1/2! - ... ), its recurrence, partial derangements (exactly k objects in place), and the limit D(n)/n! approaching 1/e.
Inclusion-exclusion counts the objects with none of several properties. If are the sets of objects having properties , then the number with none of the properties is
.
Each object with exactly properties is counted times, while objects with no property are counted once. The method is powerful when the intersections are easy to count, which usually happens because of symmetry: every intersection of sets has the same size.
Derangements. A derangement is a permutation in which no object is in its original position: letters in wrongly addressed envelopes, hats returned to the wrong owners, and so on. Let be the arrangements with object in its own place. Fixing specific objects leaves arrangements, and there are ways to choose which . So
.
Small values are worth memorising: , , , , , .
Recurrence: . Reason: object goes to some position ( choices). Either object goes to position (a swap), leaving a derangement of the other objects ( ways), or it does not, which is equivalent to deranging objects where is forbidden from position ( ways). Another form: .
The limit: the series in brackets is the start of the expansion of , so . For , is the integer nearest to . So the probability that a random permutation has no fixed point is about , almost independent of .
Partial derangements. The number of permutations of objects with exactly objects in their original places is : choose which are fixed, then derange the rest. 'At least in place' requires summing, or using the complement.
Other inclusion-exclusion applications: onto functions (see the Functions chapter), integers not divisible by any of a set of primes (leading to Euler's totient ), arrangements with forbidden adjacent pairs, and seating problems where certain couples must not sit together.
Key Takeaways:
- None of the properties: , where sums the sizes of the -fold intersections.
- ; .
- .
- Exactly fixed: .
- is the integer nearest to .
- Euler's totient: .
- Pitfall: 'exactly correct' computed as , which ignores that the rest must all be wrong.
Brain-Teaser 1: letters are placed at random in addressed envelopes. In how many ways are exactly letters in the correct envelopes? At least one in the correct envelope?
Solution: Exactly correct: choose the correct pair in ways, and the other must all be wrong: . Total . At least one correct: . As a check, the counts with exactly correct are , , , , (four correct forces the fifth to be correct) and ; they add to .
Brain-Teaser 2: How many arrangements of have no even number in its own position (odd numbers may be anywhere)?
Solution: Only the three even numbers have forbidden positions. Let be arrangements with the even number in position . By inclusion-exclusion, . This is not , because only some of the objects are restricted. Inclusion-exclusion adapts naturally; the derangement formula is just the special case where every object is restricted.
Brain-Teaser 3: Using the recurrence, find , and estimate it using .
Solution: . Alternatively . Estimate: , whose nearest integer is . The two recurrences and the approximation form a triple check that is useful under exam conditions.