Power set
2.9. THE PRINCIPLE OF INCLUSION 133 Of these six permutations, the derangements, that is, permuta-
tions with no fixed elements are: p = 231;q = 312. That is, p(1) = 2, p(2) = 3, p(3) = 1 and q(1) = 3, q(2) = 1, q(3) = 2.
Hence the number of derangements of a 3-set is 2.
In cycle notation p = (123) and q = (132) and we see p and q have no singleton cycles. Hencepand qare the only two derange- ments.
Theorem 2.9.2 (Formula for the number of derangements): The number of derangements dn onn elements is
dn =n!
( 1− 1
1!+ 1
2! − · · ·+ (−1)n1 n!
)
Proof. Let S be the set of all n! permutations of the n-set {1,2, . . . , n}. For i = 1,2, . . . , n let Si be the subset of S con- sisting of all permutations on 1,2, . . . , n for which the element i is a fixed element. In other words,Si consists of all permutations written in cycle notation for which the elementiforms a singleton cycle.
Therefore, the number of derangements dn is the number of elements of S which are in none of the subsets S1, S2, . . . , Sn. By Corollary 2.9.1.1, the number of elements of S which are in none of the subsets S1, S2, . . . , Sn is
E(0) =A0− (1
0 )
A1+ (2
0 )
A2− · · ·+ (−1)n (n
0 )
An
Our problem reduces to calculatingAr for r= 1,2, . . . , n.By defi- nition ofSi,Ar=∑
1≤i1<i2<···<ir≤n|Si1∩Si2∩· · ·∩Sir|is the num- ber of permutations in the setS in which the elementsi1, i2, . . . , ir form singleton cycles/fixed elements. In order to calculateAr, we first calculate the general term ofAr which is|Si1∩Si2∩ · · · ∩Sir|. To find |Si1 ∩ Si2 ∩ · · · ∩Sir|, fix the r elements i1, i2, . . . , ir in their respective positions. The remaining (n−r) elements may be permuted in (n−r)! ways. Hence |Si1∩Si2 ∩ · · · ∩Sir|= (n−r)!
Since there are(n
r
)terms in the sumAr, we haveAr =(n
r
)(n−r)!.
SubstitutingAr for r= 0,1, . . . , n in E(0) =A0−
(1 0
) A1+
(2 0 )
A2− · · ·+ (−1)n (n
0 )
An, we get
E(0) = (n
0 )
(n−0)!− (n
1 )
(n−1)! + (n
2 )
(n−2)!
− (n
3 )
(n−3)! +· · ·+ (−1)n (n
n )
(n−n)!
= n!
0! − n!
(n−1)! + n!
(n−2)! − n!
(n−3)!
+· · ·+ (−1)n n!
(n−n)! using (n
k )
= n!
k!(n−k)!
= n!
( 1− 1
1!+ 1 2!− 1
3!+· · ·(−1)n 1 n!
)
Remark 2.9.1 (Number of derangements):
ByTheorem 2.9.2, the number of derangements dn on n symbols is
dn =n!
( 1− 1
1! + 1
2! − · · ·+ (−1)n1 n!
)
But we know that the inverse of the number e is given by the alternating infinite series
e−1 = 1− 1 1! + 1
2! − 1
3! +· · ·(−1)n1
n! + (−1)n+1 1
(n+ 1)! +· · · Multiplying both sides byn! we get,
n!e−1 = n!
( 1− 1
1! + 1 2! − 1
3! +· · ·(−1)n1 n!
)
+(−1)n+1 1
n+ 1 + (−1)n+2 1
(n+ 1)(n+ 2) +· · ·
= dn+ (−1)n+1 1
n+ 1 + (−1)n+2 1
(n+ 1)(n+ 2) +· · ·
2.9. THE PRINCIPLE OF INCLUSION 135 Ifn is sufficiently large, the sum (−1)n+1n+11 + (−1)n+2(n+1)(n+2)1 +
· · · can be made arbitrarily small. Hence we may take n!e as a good approximation for the number of derangements. In fact,⌊n!e⌉, the nearest integer to the number n!e is the exact value of dn. (For example,⌊5.5⌉=⌊5.9⌉= 6 whereas⌊5.4⌉= 5.)
Notation for the number of derangements on n symbols. This number is called n subfactorial in the book (see [6]) and denoted by n followed by the exclamation symbol inverted like factorial inverted.
Example 2.9.5:
Find the number of derangements on 3 symbols and on 4 symbols.
Solution: The number of derangements on 3 symbols is 3!(1−
1
1!+ 2!1 − 3!1) = 6−6 + 3−1 = 2.
By Remark 2.9.1, the number of derangements on 4 symbols is⌊4!e⌉=⌊2.724⌉=⌊8.8⌉= 9 (since the real number e≈2.7).
Example 2.9.6 (A problem in probability):
(SeeChapter 6 for more details.) Considern gentlemen attending a party. Their n hats are placed in a checkroom. Then the n hats are mixed and returned at random to the gentlemen after the party is over. Find the probability that no one receives his own hat.
Solution: By definition
The probability = The number of favorable cases The total number of possible cases The total number of possible cases is the total number of ways in which the n hats can be mixed which is the number of per- mutations of n hats. Hence the total number of possible cases is n!.
The number of favorable cases is the number of ways in which no gentleman gets his own hat, which is nothing but the num- ber of permutations of n hats in which the i-th man will not get his own hat for all i = 1,2, . . . , n. This is the number of derangements of n hats, which by Theorem 2.9.2 is the number
dn = n!(
1− 1!1 +2!1 − · · ·+ (−1)nn!1)
. Hence the required proba- bility is dn!n = 1− 1!1 + 2!1 − · · ·+ (−1)nn!1 ≈ 1e by Remark 2.9.1, if n is sufficiently large.
Example 2.9.7 (A chess board problem):
Consider the usual 8×8 chess board. Suppose we are given eight rooks. Find the number of ways in which these eight rooks can be placed on the board in such a way that no rook can attack another (that is, no two rooks are in the same row (line) or in the same column) and the second main diagonal/the black diagonal (diagonal from the bottom left square to the top right square) is free of rooks.
Solution: (Bijective proof)
Let the eight rooks be 1,2, . . . ,8. Consider a derangement i1i2· · ·i8 on the 8-set {1,2, . . . ,8} where ik ̸= k for each k = 1,2, . . . ,8. To this derangement, we associate a board position for 8 rooks as follows:
We place the rookk in the j-th line of the k-th column of the chess board, if ik = j for k = 1,2, . . . ,8. (For example, if the derangement is 87654321, then we place the rook 1 in the 8th line of the first column, the rook 2 in the 7th line of the second column, etc.) Since ik ̸=k, no rook will occupy the main diagonal and no rook will attack another (8 rooks are placed in different lines and different columns).
Conversely, consider a position of 8 rooks in the board accord- ing to the condition imposed in the example. We construct a derangementi1i2· · ·i8 from the given position of rooks as follows:
ik is equal to the integer j if the rook in the kth column occupies the jth line. Since no two rooks are in the same column, ik is well defined. Then i1i2· · ·i8 is a derangement, since ik ̸= k (be- cause the second main diagonal is free of rooks) andi1i2· · ·i8 is a permutation of 1,2, . . . ,8 (because no two rooks are in the same line.)
Thus we have established a bijection between the derange- ments on the 8-set {1,2, . . . ,8} and the set of possible posi- tions of 8 rooks on the board such that no rook can attack an- other with the second main diagonal being free of rooks. There-
2.9. THE PRINCIPLE OF INCLUSION 137