Suppose we shuffle a deck of cards; what is the probability that no card is in its original location? More generally, how many permutations of have none of the integers in their "correct'' locations? That is, 1 is not first, 2 is not second, and so on. Such a permutation is called a derangement of .
Let be the set of all permutations of and be the permutations of in which is in the correct place. Then we want to know .
For any , : once is fixed in position , the remaining integers can be placed in any locations.
What about ? If both and are in the correct position, the remaining integers can be placed anywhere, so .
In the same way, we see that . Thus, by the inclusion-exclusion formula, in the form of Equation 2.1.1,
The last sum should look familiar: Substituting gives The probability of getting a derangement by chance is then and when is bigger than 6, this is quite close to So in the case of a deck of cards, the probability of a derangement is about 37%.
Let . These derangement numbers have some interesting properties. The derangements of may be produced as follows: For each , put in position 1 and 1 in position . Then permute the numbers in all possible ways so that none of these numbers is in the correct place. There are ways to do this. Then, keeping 1 in position , derange the numbers , with the "correct'' position of now considered to be position 1. There are ways to do this. Thus, .
We explore this recurrence relation a bit:
It appears from the starred lines that the pattern here is that If this continues, we should get to Since and , this would give since . Indeed this is true, and can be proved by induction. This gives a somewhat simpler recurrence relation, making it quite easy to compute .
There are many similar problems.
Example
How many permutations of contain no instance of followed by ?
Solution
By a similar use of the inclusion-exclusion formula, it turns out that this is Note that the limits on the two sums are not identical.