Derangements: A Discussion Sparked by an Error

Words: 334

I have seen the derangement problem many times
and every time I felt there was no place to start
But this time I found some time to study it specifically

【HDU】[2048] God, God, and the Heavenly Father

Baidu Baike:
Complete Derangement — Baidu Baike
Derangement Formula — Baidu Baike
Derangement — Baidu Baike

Core recurrence formula
f(n)=(n-1) {f(n-1)+f(n-2)}

Method 1:
For n ordered elements there should be n! different permutations. If in a permutation none of the elements is in its original position, then the permutation is called a derangement. Given any n, find the total number of derangements Dn of 1,2,…,n.
The recurrence relation is: D(n)=(n-1)(D(n-1)+D(n-2))
D(1)=0,D(2)=1
We can obtain:
The derangement formula is f(n) = n![1-1/1!+1/2!-1/3!+……+(-1)^n1/n!]
where n!=1
23…..*n,
In particular, 0!=0,1!=1.
Explanation:
A derangement of n distinct elements can be completed in the following two steps:
Step one, “derange” element 1 (place element 1 in one of positions 2 through n), for which there are n - 1 ways.
Step two, “derange” the remaining n - 1 elements in the following order. Depending on the result of the first step, if element 1 falls into position k, then in the second step first derange element k properly. Different arrangements of element k lead to two different cases:

  1. Element k is placed in position 1, and the remaining n - 2 elements are deranged on the set of positions equal to their index set, for which there are f(n -2) ways;
  2. Element k is not placed in position 1. In this case, position 1 can be “regarded as” position k (that is, the element originally intended for position k can be placed in position 1). Thus a derangement is formed of the n - 1 elements (including element k), for which there are f(n - 1) ways. By the addition principle, there are f(n - 2)+f(n - 1) ways to complete the second step.
    By the multiplication principle, the number of derangements of n distinct elements is
    f(n) = (n-1)[f(n-2)+f(n-1)] (n>2) .

Q.E.D.

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...