Uploaded by Thái Vũ Hải Nam

Inclusion-Exclusion 4

advertisement
Week 8-9: The Inclusion-Exclusion Principle
April 19, 2011
1
The Inclusion-Exclusion Principle
Let S be a finite set, and let A, B, C be subsets of S. Then
|A ∪ B| = |A| + |B| − |A ∩ B|,
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|.
Let P1 , P2 , . . . , Pn be properties referring to the objects in S. Let Ai be the set of all elements of S that have the
property Pi , i.e.,
Ai = {x ∈ S | x has the property Pi }, 1 ≤ i ≤ n.
The elements of Ai may possibly have properties other than Pi . In many occasions we need to find the number of
objects having none of the properties P1 , P2 , . . . , Pn .
Theorem 1.1. The number of objects of S which have none of the properties P1 , P2 , . . . , Pn is given by
X
X
X
|Ā1 ∩ Ā2 ∩ · · · ∩ Ān | = |S| −
|Ai | +
|Ai ∩ Aj | −
|Ai ∩ Aj ∩ Ak | + · · ·
i
i<j
i<j<k
n
· · · + (−1) |A1 ∩ A2 ∩ · · · ∩ An |.
(1)
Proof. The left side of (1) counts the number of objects of S with none of the properties. We establish the identity
(1) by showing that an object with none of the properties makes a net contribution of 1 to the right side of (1), and
for an object with at least one of the properties makes a net contribution of 0.
Let x be an object having none of the properties. Then the net contribution of x to the right side of (1) is
1 − 0 + 0 − 0 + · · · + (−1)n 0 = 1.
Let x be an object of S having exactly r properties of P1 , P2 , . . . , Pn . The net contribution of x to the right side of
(1) is
³r´
³r´ ³r´ ³r´ ³r´
= (1 − 1)r = 0.
+
−
+ · · · + (−1)r
−
3
r
2
0
1
Corollary 1.2. The number of objects of S which have at least one of the properties P1 , P2 , . . . , Pn is given by
X
X
X
|A1 ∪ A2 ∪ · · · ∪ An | =
|Ai | −
|Ai ∩ Aj | +
|Ai ∩ Aj ∩ Ak | − · · ·
i
i<j
n+1
· · · + (−1)
i<j<k
|A1 ∩ A2 ∩ · · · ∩ An |.
(2)
Proof. Note that the set A1 ∪ A2 ∪ · · · ∪ An consists of all those objects in S which possess at least one of the
properties, and
|A1 ∪ A2 ∪ · · · ∪ An | = |S| − |A1 ∪ A2 ∪ · · · ∪ An |.
Then by the DeMorgan law we have
A1 ∪ A2 ∪ · · · ∪ An = Ā1 ∩ Ā2 ∩ · · · ∩ Ān .
Thus
|A1 ∪ A2 ∪ · · · ∪ An | = |S| − |Ā1 ∩ Ā2 ∩ · · · ∩ Ān |.
Putting this into the identity (1), the identity (2) follows immediately.
1
2
Combinations with Repetition
Let M be a multiset. Let x be an object of M and its repetition number is larger than r. Let M 0 be the multiset
whose objects have the same repetition numbers as those objects in M , except that the repetition number of x in
M 0 is exactly r. Then
#{r-combinations of M } = #{r-combinations of M 0 }.
Example 2.1. Determine the number of 10-combinations of the multiset M = {3a, 4b, 5c}.
Let S be the set of 10-combinations of the multiset M 0 = {∞a, ∞b, ∞c}. Let P1 be the property that a 10combination of M 0 has more than 3 a’s, let P2 be the property that a 10-combination of M 0 has more than 4 b’s,
and let P3 be the property that a 10-combination of M 0 has more than 5 c’s. Then the number of 10-combinations
of M is the number of 10-combinations of M 0 which have none of the properties P1 , P2 , and P3 . Let Ai be the
sets consisting of the 10-combinations of M 0 which have the property Pi , 1 ≤ i ≤ 3. Then by inclusion-exclusion
principle the number to be determined in the problem is given by
³
´ ³
´
|Ā1 ∩ Ā2 ∩ Ā3 | = |S| − |A1 | + |A2 | + |A3 | + |A1 ∩ A2 | + |A1 ∩ A3 | + |A2 ∩ A3 | − |A1 ∩ A2 ∩ A3 |.
Note that
|S|
=
­3®
=
¡ 3+10−1 ¢
10
|A1 |
=
­3®
|A2 |
=
­3®
|A3 |
=
­3®
|A1 ∩ A2 |
=
­3®
|A1 ∩ A3 |
=
­3®
|A2 ∩ A3 |
=
0,
|A1 ∩ A2 ∩ A3 | =
0.
=
¡ 12 ¢
10
=
¡ 3+6−1 ¢
6
=
¡8¢
6
=
¡ 3+5−1 ¢
5
=
¡7¢
5
=
¡ 3+4−1 ¢
4
=
¡6¢
4
=
¡ 3+1−1 ¢
1
=
¡3¢
1
0
=
¡ 3+0−1 ¢
0
=
¡2¢
10
= 66,
6
= 28,
5
= 21,
4
= 15,
1
=
3,
0
=
1,
Putting all these results into the inclusion-exclusion formula, we have
|Ā1 ∩ Ā2 ∩ Ā3 | = 66 − (28 + 21 + 15) + (3 + 1 + 0) − 0 = 6.
The six 10-combinations are listed as follows
{3a, 4b, 3c},
{3a, 3b, 4c},
{3a, 2b, 5c},
{2a, 4b, 4c},
{2a, 3b, 5c},
{a, 4b, 5c}.
Example 2.2. Find the number of integral solutions of the equation
x1 + x2 + x3 + x4 = 15
which satisfy the conditions
2 ≤ x1 ≤ 6,
−2 ≤ x2 ≤ 1,
0 ≤ x3 ≤ 6,
3 ≤ x4 ≤ 8.
Let y1 = x1 − 2, y2 = x2 + 2, y3 = x3 , and y4 = x4 − 3. Then the problem becomes to find the number of
nonnegative integral solutions of the equation
y1 + y2 + y3 + y4 = 12
subject to
0 ≤ y1 ≤ 4,
0 ≤ y2 ≤ 3,
0 ≤ y3 ≤ 6,
0 ≤ y4 ≤ 5.
Let S be the set of all nonnegative integral solutions of the equation y1 + y2 + y3 + y4 = 12. Let P1 be the
property that y1 ≥ 5, P2 the property that y2 ≥ 4, P3 the property that y3 ≥ 7, and P4 the property that y4 ≥ 6.
2
Let Ai denote the subset of S consisting of the solutions satisfying the property Pi , 1 ≤ i ≤ 4. Then the problem is
to find the cardinality |Ā1 ∩ Ā2 ∩ Ā3 ∩ Ā4 | by the inclusion-exclusion principle. In fact,
¿ À µ
¶ µ ¶
4
4 + 12 − 1
15
|S| =
=
=
= 455.
12
12
12
Similarly,
|A1 | =
|A2 | =
|A3 | =
|A4 | =
¿ À µ
¶ µ ¶
4
4+7−1
10
=
=
= 120,
7
7
7
¿ À µ
¶ µ ¶
4
4+8−1
11
=
=
= 165,
8
8
8
¿ À µ
¶ µ ¶
4
4+5−1
8
=
=
= 56,
5
5
5
¿ À µ
¶ µ ¶
4
4+6−1
9
=
=
= 84.
6
6
6
For the intersections of two sets, we have
¿ À µ
¶ µ ¶
4
4+3−1
6
|A1 ∩ A2 | =
=
=
= 20,
3
3
3
|A1 ∩ A3 | = 1,
|A1 ∩ A4 | = 4,
|A2 ∩ A3 | = 4,
|A2 ∩ A4 | = 10,
|A3 ∩ A4 | = 0.
For the intersections of more sets,
|A1 ∩ A2 ∩ A3 | = |A1 ∩ A2 ∩ A4 | = |A1 ∩ A3 ∩ A4 | = |A2 ∩ A3 ∩ A4 | = |A1 ∩ A2 ∩ A3 ∩ A4 | = 0.
Thus the number required is given by
|Ā1 ∩ Ā2 ∩ Ā3 ∩ Ā4 | = 455 − (120 + 165 + 56 + 84) + (20 + 1 + 4 + 4 + 10) = 69.
3
Derangements
A permutation of {1, 2, . . . , n} is called a derangement if every integer i (1 ≤ i ≤ n) is not placed at the ith
position. We denote by Dn the number of derangements of {1, 2, . . . , n}.
Let S be the set of all permutations of {1, 2, . . . , n}. Then |S| = n!. Let Pi be the property that a permutation
of {1, 2, . . . , n} has the integer i in its ith position, and let Ai be the set of all permutations satisfying the property
Pi , where 1 ≤ i ≤ n. Then
Dn = |Ā1 ∩ Ā2 ∩ · · · ∩ Ān |.
For each (i1 , i2 , . . . , ik ) such that 1 ≤ i1 < i2 < · · · < ik ≤ n, a permutation of {1, 2, . . . , n} with i1 , i2 , . . . , ik fixed at
the i1 th, i2 th, . . ., ik th position respectively can be identified as a permutation of the set {1, 2, . . . , n}−{i1 , i2 , . . . , ik }
of n − k objects. Thus
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = (n − k)!.
By the inclusion-exclusion principle, we have
|Ā1 ∩ Ā2 ∩ · · · ∩ Ān | = |S| +
= n! +
n
X
(−1)k
=
X
(−1)k
(−1)k
³n´
k
n
X
(−1)k
k=0
(n − k)!
i1 <i2 <···<ik
k=0
= n!
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik |
i1 <i2 <···<ik
k=1
n
X
k=1
n
X
X
k!
3
(n − k)!
'
n!
(when n is large.)
e
Theorem 3.1. For n ≥ 1, the number Dn of derangements of {1, 2, . . . , n} is
µ
¶
1
1
1
n 1
Dn = n! 1 − + − + · · · + (−1)
.
1! 2! 3!
n!
(3)
Corollary 3.2. The number of permutations of {1, 2, . . . , n} with exactly k numbers displaced is
³n´
Dk .
k
Here are a few derangement numbers:
D0 ≡ 1,
D1 = 0,
D2 = 1,
D3 = 2,
D4 = 9,
D5 = 44.
Proposition 3.3. The derangement sequence Dn satisfies the recurrence relation
Dn = (n − 1)(Dn−1 + Dn−2 ),
n≥3
with the initial condition D1 = 0, D2 = 1. The sequence Dn satisfies the recurrence relation
Dn = nDn−1 + (−1)n ,
n ≥ 2.
Proof. The recurrence relations can be proved without using the formula (3). Let Sk be the set of derangements
ka2 a3 · · · an of {1, 2, . . . , n} that have k at the beginning, k = 2, 3, . . . , n. The derangements in each Sk can be
partitioned into two types:
ka2 a3 · · · ak · · · an (ak 6= 1) and ka2 a3 · · · ak−1 1ak+1 · · · an
We may think of that the right position for the integer k is the first position, and the right position for the integer
1 is the kth position. Then there are Dn−1 derangements of the first type and Dn−2 derangements of the second
type. We thus obtain the recurrence relation
Dn = (n − 1)(Dn−1 + Dn−2 ).
Let us rewrite the recurrence relation as
³
´
Dn − nDn−1 = − Dn−1 − (n − 1)Dn−2 ,
Applying this recurrence formula continuously, we have
¡
¢
Dn − nDn−1 = (−1)i Dn−i − (n − i)Dn−i−1 ,
n ≥ 3.
1 ≤ i ≤ n − 2.
Thus Dn − nDn−1 = (−1)n−2 (D2 − D1 ) = (−1)n . Hence Dn = nDn−1 + (−1)n .
4
Surjective Functions
Let X be a set with m objects and Y be a set with n objects. Then the number of functions of X to Y is nm . The
number of injective functions from X to Y is
³n´
m! = P (n, m).
m
Let C(m, n) denote the number of surjective functions from X to Y . What is C(m, n)?
Theorem 4.1. The number C(m, n) of surjective functions from a set of m objects to a set of n objects is given by
C(m, n) =
n
X
(−1)k
k=0
4
³n´
k
(n − k)m .
Proof. Let S be the set of all functions of X to Y . Write Y = {y1 , y2 , . . . , yn }. Let Ai be the set of all functions f
such that yi is not assigned to any element of X by f , i.e., yi 6∈ f (X), where 1 ≤ i ≤ n. Then
C(m, n) = |Ā1 ∩ Ā2 ∩ · · · ∩ Ān |.
For each (i1 , i2 , . . . , ik ) such that 1 ≤ i1 < i2 < · · · < ik ≤ n, the set Ai1 ∩ Ai2 ∩ · · · ∩ Aik can be identified to the set
of all functions f from X to the complement Y − {i1 , i2 , . . . , ik }. Thus
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = (n − k)m .
By the inclusion-exclusion principle, we have
n
X
|Ā1 ∩ Ā2 ∩ · · · ∩ Ān | = |S| +
= nm +
(−1)k
k=1
n
X
=
(−1)k
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik |
i1 <i2 <···<ik
(−1)k
X
(n − k)m
i1 <i2 <···<ik
k=1
n
X
X
³n´
k
k=0
(n − k)m .
Note that C(m, n) = 0 for m < n; we have
n
X
(−1)k
k=0
³n´
k
(n − k)m = 0 if m < n.
Corollary 4.2. For integers m, n ≥ 1,
X
i1 +···+in =m
i1 ,...,in ≥1
µ
m
i1 , . . . , in
¶
=
n
X
(−1)k
³n´
k
k=0
(n − k)m .
Proof. The integer C(m, n) can be interpreted as the number of ways to place the objects of X into n distinct boxes
such that no one is empty. We then have
µ
¶
X
m
C(m, n) =
.
i1 , . . . , in
i +···+in =m
1
i1 ,...,in ≥1
5
The Euler Phi Function
Let n be a positive integer. We denote by φ(n) the number of integers of [1, n] which are coprime to n. For example,
φ(1) = 1,
φ(2) = 1,
φ(3) = 2,
φ(4) = 2,
φ(5) = 4,
φ(6) = 2.
The integer-valued function φ is defined on the set of positive integers, and is called the Euler phi function.
Theorem 5.1. Let n be a positive integer factorized into the form n = pe11 pe2r · · · perr , where p1 , p2 , . . . , pr are distinct
primes and e1 , e2 , . . . , er ≥ 1. Then the Euler function φ(n) is given by
φ(n) = n
r µ
Y
i=1
5
1
1−
pi
¶
.
Proof. Let S = {1, 2, . . . , n}. Let Pi be the property that an integer of S has pi as a factor, and let Ai be the set of
all integers in S that have the property Pi , where 1 ≤ i ≤ r. Then φ(n) is the number of integers that have none of
the properties P1 , P2 , . . . , Pr , i.e.,
φ(n) = |Ā1 ∩ Ā2 ∩ · · · ∩ Ār |.
Note that
½
Ai =
µ
pi , 2pi , 3pi , . . . ,
n
pi
¶ ¾
pi ,
More generally, if 1 ≤ i1 < i2 < · · · < ik ≤ r, then
½
µ ¶ ¾
n
Ai1 ∩ Ai2 ∩ · · · ∩ Aik = q, 2q, 3q . . . ,
q ,
q
Thus
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | =
1 ≤ i ≤ r.
where q = pi1 pi2 · · · pik .
n
.
pi1 pi2 · · · pik
By the inclusion-exclusion principle, we have
|Ā1 ∩ Ā2 ∩ · · · ∩ Ār | = |S| +
r
X
(−1)k
= n+
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik |
i1 <i2 <···<ik
k=1
r
X
X
(−1)k
X
i1 <i2 <···<ik
k=1
n
pi1 pi2 · · · pik
¶
·
µ
1
1
= n 1−
+ ··· +
p1
pr
µ
¶
1
1
1
+
+
+ ··· +
p1 p2 p1 p3
pr−1 pr
µ
¶
1
1
1
−
+
+ ··· +
p1 p2 p3 p1 p2 p4
pr−2 pr−1 pr
¸
1
+ · · · + (−1)r
p1 p2 · · · p r
¶
µ
r
Y
1
= n
.
1−
pi
i=1
Example 5.1. For the integer 36, since 22 32 we have
µ
¶µ
¶
1
1
φ(36) = 36 1 −
1−
= 12.
2
3
The following are the twelve specific integers of [1, 36] that are coprime to 36:
1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35.
Corollary 5.2. For any prime number p,
φ(pk ) = pk − pk−1 .
Proof. The result can be directly proved without Theorem 5.1. An integer a of [1, pk ] that is not coprime to pk
must be of the form a = ip, where 1 ≤ i ≤ pk−1 . Thus the number of integers of [1, pk ] that is coprime to pk equals
pk − pk−1 . Therefore φ(pk ) = pk − pk−1 .
Lemma 5.3. Let m = m1 m2 . If gcd(m1 , m2 ) = 1, then the function
f : {1, 2, . . . , m} −→ {1, 2, . . . , m1 } × {1, 2, . . . , m2 },
a 7→ f (a) = (r1 , r2 ),
is a bijection, where a = q1 m1 + r1 = q2 m2 + r2 , 1 ≤ r1 ≤ m1 , 1 ≤ r2 ≤ m2 . Moreover, the restriction
©
ª
©
ª ©
ª
f : a ∈ [1, m] : gcd(a, m) = 1 −→ a ∈ [1, m1 ] : gcd(a, m1 ) = 1 × a ∈ [1, m2 ] : gcd(a, m2 ) = 1
is also a bijection.
6
Proof. It suffices to show that f is surjective. Since gcd(m1 , m2 ) = 1, there are integers x and y such that
xm1 + ym2 = 1. For each (r1 , r2 ) ∈ [1, m1 ] × [1, m2 ], set r = r2 xm1 + r1 ym2 . Then
r = (r2 − r1 )xm1 + r1 (xm1 + ym2 ) = (r1 − r2 )ym2 + r2 (xm1 + ym2 ).
Putting xm1 + ym2 = 1 into the above expression, we have
r = (r2 − r1 )xm1 + r1 = (r1 − r2 )ym2 + r2 .
Modify r by adding an appropriate multiple qm of m to obtain a number a := qm + r so that 1 ≤ a ≤ m. We thus
have f (a) = (r1 , r2 ). Hence f is surjective. Since [1, m] and [1, m1 ] × [1, m2 ] have the same cardinality, it follows
that f must be a bijection.
The second part follows from the fact that an integer a is coprime to m1 m2 if and only if a is coprime to both
m1 and m2 .
Theorem 5.4. If gcd(m, n) = 1, then
φ(mn) = φ(m)φ(n).
Moreover, if n = pe11 pe22 · · · perr with e1 , e2 , . . . , er ≥ 1, then
φ(n) = n
r µ
Y
i=1
1
1−
pi
¶
.
Proof. The first part follows from Lemma 5.3. The second part follows from the first part, i.e.,
µ
¶
¶
r
r µ
r
r ³
´ Y
Y
Y
¡ ei ¢ Y
1
1
ei
ei −1
ei
pi − pi
=
pi 1 −
=n
1−
.
φ(n) =
φ pi =
pi
pi
i=1
6
i=1
i=1
i=1
Permutations with Forbidden Positions
Let S = {1, 2, . . . , n}, and let X1 , X2 , . . . , Xn be subsets (possibly empty) of S. We denote by P (X1 , X2 , . . . , Xn )
the set of all permutations a1 a2 · · · an of S such that
a1 6∈ X1 ,
a2 6∈ X2 ,
...,
an 6∈ Xn .
In other words, a permutation of S belongs to P (X1 , X2 , . . . , Xn ) provided that no element of X1 occupy the
first place, no element of X2 occupy the second place, ..., and no element of Xn occupy the nth place. We use
p(X1 , X2 , . . . , Xn ) to denote the number of permutations in P (X1 , X2 , . . . , Xn ), i.e.,
p(X1 , X2 , . . . , Xn ) := |P (X1 , X2 , . . . , Xn )|.
It is known that there is a one-to-one correspondence between permutations of {1, 2, . . . , n} and the placement
of n non-attacking, indistinguishable rooks on an n-by-n board. The permutation a1 a2 · · · an of {1, 2, . . . , n} corresponds to the placement of n rooks on the board in the squares with coordinates (1, a1 ), (2, a2 ), . . ., (n, an ). The
permutations in P (X1 , X2 , . . . , Xn ) corresponds to placements of n non-attacking rooks on an n-by-n board in which
certain squares are not allowed to be put a rook.
Let S be the set of all placements of n non-attacking rooks on an n × n-board. A rook placement in S is said
to satisfy the property Pi provided that the rook in the ith row is in a column that belongs to Xi (i = 1, 2, . . . , n).
As usual let Ai denote the set of all rook placements satisfying the property Pi (i = 1, 2, . . . , n). Then by the
Inclusion-Exclusion Principle we have
p(X1 , X2 , . . . , Xn ) = |Ā1 ∩ Ā2 ∩ · · · ∩ Ān |
X
X
= |S| −
|Ai | +
|Ai ∩ Aj | − · · · + (−1)n |A1 ∩ A2 ∩ · · · ∩ An |.
i
i<j
7
Proposition 6.1. Let rk (1 ≤ k ≤ n) denote the number of ways to place k non-attacking rooks on an n × n-board
where each of the k rooks is in a forbidden position. Then
X
1
rk =
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
(4)
(n − k)!
1≤i1 <i2 <···<ik ≤n
Proof. Fix 1 ≤ i1 < i2 < · · · < ik ≤ n. Let r(i1 , i2 , . . . , ik ) be the number of ways to place k non-attacking rooks on
the i1 th row, the i2 th row, . . ., the ik th row such that the i1 th rook is not in Xi1 , the i2 th rook is not in Xi2 , . . .,
the ik th rook is not in Xik . For each such k rook arrangement, delete the rows and columns they located (for the
other n − k rooks cannot be arranged in those rows and columns), the leftover is an (n − k) × (n − k)-board, and
the other n − k rooks can be arranged there in (n − k)! ways. So
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = r(i1 , i2 , . . . , ik ) (n − k)!.
Since rk =
P
1≤i1 <i2 <···<ik ≤n r(i1 , i2 , . . . , ik ),
it follows that
X
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = rk (n − k)!.
1≤i1 <i2 <···<ik ≤n
Theorem 6.2. The number of ways to place n non-attacking rooks on an n × n-board with forbidden positions is
given by
n
X
p(X1 , X2 , . . . , Xn ) =
(−1)k rk (n − k)!,
k=0
where rk is the number of ways to place k non-attacking rooks on an n × n-board where each of the k rooks is in a
forbidden position.
Example 6.1. Let n = 5 and X1 = {1, 2}, X2 = {3, 4}, X3 = {1, 5}, X4 = {2, 3}, and X5 = {4, 5}.
× ×
× ×
×
×
× ×
× ×
Note that r1 =
1
4!
P
i |Ai |
= 5 × 2 = 10. So r1 4! =
P
i |Ai |
= 10 · 4!. Since
|A1 ∩ A2 | = |A2 ∩ A3 | = |A3 ∩ A4 | = |A4 ∩ A5 | = |A1 ∩ A5 | = 4 · 3!,
P
|A1 ∩ A3 | = |A1 ∩ A4 | = |A2 ∩ A4 | = |A2 ∩ A5 | = |A3 ∩ A5 | = 3 · 3!,
then r2 = 3!1 i<j |Ai ∩Aj | = 5×4+5×3 = 35. Using the symmetry between A1 , A2 , A3 , A4 , A5 and A5 , A4 , A3 , A2 , A1
respectively, we see that
|A1 ∩ A2 ∩ A3 | = |A1 ∩ A2 ∩ A5 | = |A1 ∩ A4 ∩ A5 |
= |A2 ∩ A3 ∩ A4 | = |A3 ∩ A4 ∩ A5 |
= 6 · 2!,
|A1 ∩ A2 ∩ A4 | = |A1 ∩ A3 ∩ A4 | = |A1 ∩ A3 ∩ A5 |
= |A2 ∩ A3 ∩ A5 | = |A2 ∩ A4 ∩ A5 |
= 4 · 2!.
These can be obtained by considering the following six patterns
× ×
× ×
× ×
×
×
× ×
× ×
× ×
8
× ×
× ×
× ×
×
× ×
×
× ×
×
× ×
×
× ×
×
×
× ×
We then have r3 = 5 · 6 + 5 · 4 = 50. Using symmetry again, we see that
|A1 ∩ A2 ∩ A3 ∩ A4 | = |A1 ∩ A2 ∩ A3 ∩ A5 | = |A1 ∩ A2 ∩ A4 ∩ A5 |
= |A1 ∩ A3 ∩ A4 ∩ A5 | = |A2 ∩ A3 ∩ A4 ∩ A4 | = 5 · 1!.
Thus r4 = 5 × 5 = 25. Finally, r5 = |A1 ∩ A2 ∩ A3 ∩ A4 ∩ A5 | = 2. The answer is given by
5! − 10 × 4! + 35 × 3! − 50 × 2! + 25 × 1! − 2 = 13.
A permutation of {1, 2, . . . , n} is said to be nonconsecutive if 12, 23, . . ., (n − 2)(n − 1), (n − 1)n do not occur.
We denote by Qn the number of nonconsecutive permutations of {1, 2, . . . , n}.
Theorem 6.3. For n ≥ 1, the number of nonconsecutive permutations of {1, 2, . . . , n} is given by
Qn =
n−1
X
µ
k
(−1)
k=0
n−1
k
¶
(n − k)!.
Proof. Let S be the set of all permutations of {1, 2, . . . , n}. Let Pi be the property that in a permutation the pattern
i(i + 1) does occur, and let Ai be the set of all permutations satisfying the property Pi , 1 ≤ i ≤ n − 1. Then Qn is
equal to the number of permutations satisfying none of the properties, i.e., Qn = |Ā1 ∩ Ā2 ∩ · · · ∩ Ān |. Note that
|Ai | = (n − 1)!,
i = 1, 2, . . . , n − 1.
Similarly,
|Ai ∩ Aj | = (n − 2)!,
i < j.
More generally,
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | = (n − k)!.
Thus by the inclusion-exclusion principle,
Qn = |S| +
n−1
X
k=1
k
(−1)
X
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik | =
1≤i1 <i2 <···<ik ≤n−1
n−1
X
k=0
µ
k
(−1)
n−1
k
¶
(n − k)!.
Example 6.2. Suppose 8 persons line up in one column in such a way that every person except the first one has
a person in front. What is the chance when the 8 persons reline up after a break so that everyone has a different
person in his/her front?
We assign numbers 1, 2, . . . , 8 to the 8 persons so that the number i is assigned to the ith person (counted from
the front). Then the problem becomes to find the number of permutations of {1, 2, . . . , 8} in which the patterns 12,
23, . . ., 78 do not occur. For instance, 31542876 is an allowed permutation, while 83475126 is not.
The answer is given by
µ ¶
7
Q8 X
7 (8 − k)!
P =
=
.
(−1)k
8!
8!
k
k=0
Example 6.3. There are n persons seating at a round table. The n persons left the table and reseat after a break.
How many seating plans can be made in the second time so that each person has a different person seating on
his/her left comparing to the person before the break?
This is equivalent to finding the number of circular nonconsecutive permutations of {1, 2, . . . , n}. A circular
nonconsecutive permutation of {1, 2, . . . , n} is circular permutation of {1, 2, . . . , n} such that 12, 23, . . ., (n − 1)n,
n1 do not occur in the counterclockwise direction.
9
Let S be the set of all circular permutations of {1, 2, . . . , n}. Let Ai denote the subset of all circular permutations
of {1, 2, . . . , n} such that i(i + 1) does not occur, 1 ≤ i ≤ n. We understand that An is the subset of all circular
permutations that n1 does not occur. Then the answer is |Ā1 ∩ Ā1 ∩ · · · ∩ Ān |. Note that
|Ai | = (n − 1)!/(n − 1) = (n − 2)!.
More generally,
|Ai1 ∩ · · · ∩ Aik | = (n − k)!/(n − k) = (n − k − 1)!,
1 ≤ k ≤ n − 1;
|S| = (n − 1)! and |A1 ∩ A2 ∩ · · · ∩ An | = 1. We thus have
|Ā1 ∩ · · · ∩ Ān | =
n−1
X
(−1)k
³n´
k
k=0
(n − k − 1)! + (−1)n .
Theorem 6.4.
Qn = Dn + Dn−1 ,
n ≥ 2.
Proof.
Dn + Dn−1 = n!
n
X
(−1)k
k=0
+ (n − 1)!
k!
Ã
n−1
X
k=0
= (n − 1)! n + n
n
X
(−1)k
k=1
= n! + (n − 1)!
k!
n
X
(−1)k
k=1
k!
(−1)k
k!
+
n
X
(−1)k−1
k=1
!
(k − 1)!
(n − k)
¶
n−1
(n − k)!
= n! +
(−1)
k
k=1
µ
¶
n−1
X
k n−1
(−1)
(n − k)! = Qn .
=
k
n−1
X
µ
k
k=0
7
Rook Polynomials
Definition 7.1. Let C be a board. Each square of C is referred as a cell. Let rk (C) be the number of ways to
arrange k rooks on the board C so that no one can take another. We assume r0 (C) = 1. The rook polynomial of
C is
∞
X
R(C, x) =
rk (C)xk .
k=0
We refer an arrangement of k rooks on a board C as a k-rook arrangement on C.
Proposition 7.2. Let C be a board. For each cell σ of C, let Cσ denote the board obtained from C by deleting all
cells on the row and column that contains the cell σ, and let C − σ denote the board obtained from C by deleting the
cell σ. Then
rk (C) = rk (C − σ) + rk−1 (Cσ ).
Equivalently,
R(C, x) = R(C − σ, x) + xR(Cσ , x).
Proof. The k rook arrangements on the board C can be divided into two kinds: the rook arrangements that the
square σ is occupied and the rook arrangements that the square is not occupied, i.e., the k-rook arrangements on
the board C − σ and the (k − 1)-rook arrangements on the board Cσ . Thus rk (C) = rk (C − σ) + rk−1 (Cσ ).
10
Two boards C1 and C2 are said to be independent if they have no common rows and common columns.
Independent boards must be disjoint. If C1 and C2 are independent boards, we denote by C1 + C2 the board that
consists of the cells either in C1 or in C2 .
Proposition 7.3. Let C1 and C2 be independent boards. Then
rk (C1 + C2 ) =
k
X
ri (C1 ) rk−i (C2 ).
i=0
Equivalently,
R(C1 + C2 , x) = R(C1 , x)R(C2 , x).
Proof. Since C1 and C2 have disjoint rows and columns, then each i-rook arrangement of C1 and each j-rook
arrangement of C2 will constitute a (i + j)-rook arrangement of C1 + C2 , and vice versa. Thus
X
rk (C1 + C2 ) =
ri (C1 )rj (C2 ).
i+j=k
i,j≥0
¤¤
Example 7.1. Find the rook polynomial of the board ¤¤¤ . We use ¡ (a square with dot) to denote a selected
¤¤¤
square when applying the recurrence formula of rook polynomial.
¶
¶
µ
³
´
¤¤
¤¤
,
x
= R ¤¤¡ , x + xR ¤¤
R ¤¤¤ , x
¤¤¡
¤¤
¤¤¡
¶
· µ
³
´¸
h ³
´
i
¤¤
¤¡
¤¤ , x + xR (¤¤ , x)
,
x
+
x
R
= R ¤¤ , x + xR
¤
¤¤
¡¤
¸
¶
½· µ
´
i¾
´
h ³
³
¤¤
¤
¤
=
R ¤¤ , x + xR ¤ , x + x R
¤ , x + xR(∅, x)
¤
h ³
´
i
+x R ¤¤
,
x
+
xR
(¤¤
,
x)
¤¤
nh
i
£
¤o
=
(1 + 4x + 2x2 )(1 + x) + x(1 + 2x) + x (1 + x)2 + x
h
i
+x (1 + 4x + 2x2 ) + x(1 + 2x)
µ
= 1 + 8x + 16x2 + 7x3 .
8
Weighted Version of Inclusion-Exclusion Principle
Let S be a set. The characteristic function of a subset A of S is a real-valued function 1A defined on S by
½
1 if x ∈ A
1A (x) =
0 if x ∈
6 A.
For real-valued functions f, g and a real number c, we define functions f + g, cf , and f g on S as follows:
(f + g)(x) = f (x) + g(x),
(af )(x) = af (x),
(f · g)(x) = f (x)g(x).
For a function f : S → R, we consider the value f (x) as the weight of f at x. The total weight of f is the sum
X
w(f ) :=
f (x).
x∈S
11
Clearly, for functions fi and constants ci (1 ≤ i ≤ n), we have
à n
!
n
X
X
w
ci fi =
ci w(fi ).
i=1
i=1
Let A and B are subsets of S. Then
(1) 1A∩B = 1A · 1B ,
(2) 1Ā = 1S − 1A ,
(3) 1A∪B = 1A + 1B − 1A∩B ,
(4) 1S · f = f for any function f on S.
Proposition 8.1. Let Pi be some properties about the elements of a set S, and let Ai be the set of all elements of
S that satisfy the property Pi , 1 ≤ i ≤ n. Then the inclusion-exclusion principle can be stated as
1Ā1 ∩Ā2 ∩···∩Ān
= 1S +
n
X
X
(−1)k
1Ai1 ∩Ai2 ∩···∩Aik .
(5)
1≤i1 <i2 <···<ik ≤n
k=1
Proof.
1Ā1 ∩Ā2 ∩···∩Ān
= 1Ā1 1Ā2 · · · 1Ān = (1S − 1A1 )(1S − 1A2 ) · · · (1S − 1An )
X
=
f1 f2 · · · fn (where fi = 1S or −1Ai , 1 ≤ i ≤ n)
X
= 1S · · · 1S +
1S · · · 1S (−1Ai1 ) · · · (−1Aik )
| {z }
| {z }
i1 <···<ik
1≤k≤n
n
= 1S +
n
X
n−k
X
(−1)k
1Ai1 ∩Ai2 ∩···∩Aik .
i1 <i2 <···<ik
k=1
Applying the weight w to both sides, we obtain
|Ā1 ∩ Ā2 ∩ · · · ∩ Ān | = |S| +
n
X
X
(−1)k
|Ai1 ∩ Ai2 ∩ · · · ∩ Aik |.
i1 <i2 <···<ik
k=1
Let w be a real-valued function on a set S. Then w can be extended to a function on the power set P(S) of S
by
w(A) =
X
w(x),
A ⊆ S;
w(∅) ≡ 0.
x∈A
Let S = {1, 2, . . . , n}. We introduce two functions α and β on
¢
½ ¡T
w i∈I Ai
α(I) =
0
¢
½ ¡S
w i∈I Ai
β(I) =
0
the power set P(S) of S as follows: For I ⊆ S,
if I 6= ∅
if I = ∅,
if I 6= ∅
if I = ∅.
Theorem 8.2. Let α and β be functions defined above. Then
X
β(J) =
(−1)|I|−1 α(I),
I⊆J
if and only if
α(J) =
X
(−1)|I|−1 β(I).
I⊆J
12
P
P
Proof. Set f (I) = (−1)|I|−1 α(I) for I ⊆ S. Then β(J) = I⊆J (−1)|I|−1 α(I) is the same as β(J) = I⊆J f (I). By
the Möbius inversion, it is equivalent to
X
f (J) =
(−1)|J−I| β(I),
I⊆J
which is the same as α(J) =
9
P
|I|−1 β(I).
I⊆J (−1)
Möbius inversion
Let (X, ≤) be a locally finite poset, i.e., for each x ≤ y in X the interval [x, y] := {z ∈ X | x ≤ z ≤ y} is a finite
set. Let I(X) be the set of all functions f : X × X → R such that
f (x, y) = 0 if x 6≤ y;
such functions are called incidence functions on the poset X. When we give or define an incidence function f ,
we only give or define the values f (x, y) for the pairs (x, y) such that x ≤ y because f (x, y) = 0 for all pairs (x, y)
such that x 6≤ y.
The convolution product of two incidence functions f, g ∈ I(X) is a function f ∗ g : X × X → R, defined by
X
(f ∗ g)(x, y) :=
f (x, z)g(z, y).
z∈X
In fact, (f ∗ g)(x, y) = 0 if x 6≤ y and
X
(f ∗ g)(x, y) =
f (x, z)g(z, y) if x ≤ y.
x≤z≤y
The convolution product satisfies the associative law:
f ∗ (g ∗ h) = (f ∗ g) ∗ h,
where f, g, h ∈ I(X). Indeed, for x ≤ y, we have
X
(f ∗ (g ∗ h))(x, y) =
f (x, z1 )(g ∗ h)(z1 , y)
x≤z1 ≤y
X
=
f (x, z1 )
x≤z1 ≤y
g(z1 , z2 )h(z2 , , y)
z1 ≤z2 ≤y
X
=
X
f (x, z1 )g(z1 , z2 )h(z2 , y).
x≤z1 ≤z2 ≤y
Likewise, for x ≤ y, we have
((f ∗ g) ∗ h))(x, y) =
X
f (x, z1 )g(z1 , z2 )h(z2 , y).
x≤z1 ≤z2 ≤y
For x 6≤ y, we automatically have (f ∗ (g ∗ h))(x, y) = ((f ∗ g) ∗ h))(x, y) = 0. The vector space I(X) together with
the convolution ∗ is called the incidence algebra of X.
Example 9.1. Let [n] = {1, 2, . . . , n} be the poset with the natrual order of natural numbers. An incidence function
f : [n] × [n] → R can be viewed as a upper triangular n × n matrix A = [aij ] given by aij = f (i, j). The convolution
is just the multiplication of upper triangular matrices.
There is a special function δ ∈ I(X), called the delta function of the poset (X, ≤), defined by
½
1 if x = y,
δ(x, y) :=
0 if x 6= y.
13
The delta function δ is the identity of the algebra I(X), i.e., for all f ∈ I(X),
δ ∗ f = f = f ∗ δ.
Indeed, for x ≤ y,
X
(δ ∗ f )(x, y) =
δ(x, z)f (z, y) = f (x, y);
x≤z≤y
X
(f ∗ δ)(x, y) =
f (x, z)δ(z, y) = f (x, y).
x≤z≤y
Given an incidence function f ∈ I(X). A left inverse of f is a function g ∈ I(X) such that
g ∗ f = δ.
Analogously, a right inverse of f is a function h ∈ I(X) such that
f ∗ h = δ.
If f has a left inverse g and a right inverse h, then g = h. In fact,
g = g ∗ δ = g ∗ (f ∗ h) = (g ∗ f ) ∗ h = δ ∗ h = h.
If f has both a left and right inverse, we say that f is invertible; the left or right inverse of f must be unique and
is called the inverse of f .
The constant function of value 1 on Int(X) is known as the zeta function ζ of the poset (X, ≤), i.e.,
ζ(x, y) := 1 for all x ≤ y.
Let f ∈ I(X) and f (x, x) 6= 0 for all x ∈ X. We inductively define a function g ∈ I(X) by first letting
g(x, x) :=
1
for all x ∈ X;
f (x, x)
for x < y, when g(x, z) are defined for all z such that x ≤ z < y, we define
g(x, y) := −
X
1
g(x, z)f (z, y).
f (y, y)
x≤z<y
Then for x ≤ y, we have
X
g(x, z)f (z, y) = δ(x, y).
x≤z≤y
This means that g is a left inverse function of f with respect to the convolution product ∗. Similarly, one can
show that f has a right inverse function h so that f ∗ h = δ. Since the associativity, we have
g = g ∗ δ = g ∗ (f ∗ h) = (g ∗ f ) ∗ h = δ ∗ h = h.
The left inverse and right inverse of f (if f (x, x) 6= 0 for all x ∈ X) are the same. So the left inverse function and
the right inverse function of f are just called the inverse function of f .
The inverse of the zeta function ζ in the incidence algebra I(X) is called the Möbius function of the poset
(X, ≤), denoted µ. The Möbius function µ can be defined as
µ(x, x) := 1 for all x ∈ X,
and for x < y,
µ(x, y) := −
X
µ(x, z) = −
X
x<z≤y
x≤z<y
14
µ(z, y).
Example 9.2. Let X = {1, 2, . . . , n}. The Möbius function of the poset (P(X), ⊆) is given by
µ(A, B) = (−1)|B|−|A| ,
where A ⊆ B.
This can be proved by induction on |B − A|. For |B − A| = 0, i.e., A = B, it is obviously true. Assume it is
true when |B − A| < p. Consider the case of |B − A| = p. In fact,
X
µ(A, B) = −
µ(A, C)
A⊆C(B
X
= −
(−1)|C|−|A|
A⊆C(B
= −
p−1
X
³p´
(−1)k
k
k=0
p
= (−1) = (−1)|B−A| .
Example 9.3. Let X = {1, 2, . . . , n} and consider the linearly ordered set (X, ≤), where 1 < 2 < · · · < n. Then
for (k, l) ∈ X × X with k ≤ l, the Möbius function is given by

 1 if l = k,
−1 if l = k + 1,
µ(k, l) =

0 otherwise.
It is easy to see that µ(k, k) = 1 and µ(k, k + 1) = −1. It follows that µ(k, k + 2) = 0 and subsequently,
µ(k, k + i) = 0 for all i ≥ 2.
Theorem 9.1. Let (X, ≤) be a finite poset with a smallest element 0. Let f, g : X → R be real-valued functions
such that
X
g(x) =
f (z) for all x ∈ X.
z≤x
Then
X
f (x) =
g(z)µ(z, x) for all x ∈ X.
z:z≤x
Proof.
X
g(y)µ(y, x) =
y:y≤x
XX
f (z)µ(y, x)
y≤x z≤y
=
X
µ(y, x)
y≤x
=
X
=
ζ(z, y)f (z)
z≤y
f (z)
z∈x
X
X
X
ζ(z, y)µ(y, x)
z≤y≤x
f (z)δ(z, x)
z≤x
= f (x).
Corollary 9.2. Let [n] = {1, 2, . . . , n}. Let f, g : P([n]) → R be functions such that
X
g(I) =
f (J), I ⊆ [n].
J⊆I
Then
f (I) =
X
(−1)|I|−|J| g(J),
J⊆I
15
I ⊆ [n].
Permanent. Fix a positive integer n. Let Sn denote the symmetric group of [n] = {1, 2, . . . , n}, i.e., the set of all
permutations of [n]. Let A be an n × n real matrix. The permanent of A is defined as the number
per(A) :=
n
X Y
ai,σ(i) .
σ∈Sn i=1
For the chessboard C in Example 6.1, we associate a 0-1 matrix A = [aij ]

× ×
0 0
 1 1
× ×

× ,
C= ×
A=
 0 1
 1 0
× ×
1 1
× ×
as follows:

1 1 1
0 0 1 

1 1 0 
.
0 1 1 
1 0 0
Then the number of ways to put 5 non-attacking indistinguishable rooks on C is the permanent per(A).
Fix an n-by-n matrix A. For each subset I ⊆ [n], let AI denote the submatrix of A, whose rows are those rows
of A indexed by I. Let F (I) be the set of all functions σ : [n] → I, G(I) the set of all surjective functions from [n]
onto I. Then
G
F (I) =
G(J).
J⊆I
Let P([n]) be the power set of [n]. We define a function f : P([n]) → R by f (∅) = 0 and
f (I) =
n
X Y
ai,σ(i) ,
I ⊆ [n], I 6= ∅.
σ∈G(I) i=1
Note that f ([n]) = per(A). Set
g(I) :=
X
f (J),
I ⊆ [n].
J⊆I
Then
g(I) =
n
X X Y
n
X Y
ai,σ(i) =
J⊆I σ∈G(J) i=1
ai,σ(i) ,
I ⊆ [n].
(6)
σ∈F (I) i=1
Thus by the Möbius inversion, we have
X
f (I) =
(−1)|I|−|J| g(J),
I ⊆ [n].
J⊆I
In particular,
f ([n]) =
X
(−1)n−|I| g(I).
I⊆[n]
Note that by the second equality of (6), g(I) is the summation of a1,σ(1) · · · an,σ(n) over all functions σ : [n] → I.
Hence


n
X
Y
X

a1,σ(1) · · · an,σ(n) =
g(I) =
aij  .
i=1
σ∈F (I)
It follows that
F ([n]) =
X
I⊆[n]
(−1)n−|I|
n
Y


i=1
However this formula is not much useful because there are
2n
j∈I

X
aij  = per(A).
j∈I
terms in the summation.
Definition 9.3. Let (Xi , ≤i ) (i = 1, 2) be two posets. The product poset (X1 × X2 , ≤) is given by
(x1 , x2 ) ≤ (y1 , y2 ) if and only if x1 ≤1 y1 , x2 ≤2 y2 .
For the convenience, we write ≤1 and ≤2 simply as ≤. Then (X1 × X2 , ≤) is a poset.
16
Theorem 9.4. Let µi be the Möbius functions of posets (Xi , ≤i ), i = 1, 2. Then the Möbius function µ of X1 × X2
for (x1 , x2 ) ≤ (y1 , y2 ) is given by
µ((x1 , x2 ), (y1 , y2 )) = µ1 (x1 , y1 ) µ2 (x2 , y2 ).
Proof. We prove it by induction on the length `((x1 , x2 ), (y1 , y2 )), the length of the longest chains in the interval
[(x1 , x2 ), (y1 , y2 )]. It is obviously true when ` = 0. For ` ≥ 1, we have
X
µ((x1 , x2 ), (y1 , y2 )) = −
µ((x1 , x2 ), (z1 , z2 ))
(x1 ,x2 )≤(z1 ,z2 )<(y1 ,y2 )
X
= −
µ1 (x1 , z1 ) µ2 (x2 , z2 ) (by induction)
(x1 ,x2 )≤(z1 ,z2 )<(y1 ,y2 )
X
= µ1 (x1 , y1 ) µ2 (x2 , y2 ) −
X
µ1 (x1 , z1 )
x1 ≤z1 ≤y1
µ2 (x2 , z2 )
x2 ≤z2 ≤y2
= µ1 (x1 , y1 ) µ2 (x2 , y2 ) − δ1 (x1 , y1 ) δ2 (x2 , y2 )
= µ1 (x1 , y1 ) µ2 (x2 , y2 ).
Example 9.4. Let n be a positive integer and Z+ = {1, 2, . . .}. Then Z+ is a poset whose partial ordering is
divisibility. Let n ∈ Z+ be factored as
n = pe11 pe22 · · · pekk ,
where pi are distinct prime numbers and ei are positive integers. Since µ(m, m) = 1 for all m ∈ Z+ and µ(1, n) is
inductively given by
X
µ(1, n) = −
µ(1, m)
m∈Z+ , m|n, m6=n
We only need to to consider the subposet (D(n), divisibility), where D(n) = {d ∈ [n] : d|n}. For r, s ∈ D(n), write
r = pa11 pa22 · · · pakk ,
s = pb11 pb22 · · · pbkk ,
where 0 ≤ ai , bi ≤ ei . Then r|s if and only if ai ≤ bi . This means that the poset D(n) is isomorphic to the product
poset
k
©
ª Y
Q := (a1 , . . . , ak ) | ai ∈ [0, ei ] =
[0, ei ],
i=1
where [0, ei ] = {0, 1, . . . , ei }. Thus µ(1, n) = µQ ((0, . . . , 0), (e1 , . . . , ek )), where
µQ ((0, . . . , 0), (e1 , . . . , ek )) =
k
Y
µ[0,ei ] (0, ei ).
i=1
Note that


½
1 if ei = 0,
(−1)ei
−1 if ei = 1, =
µ[0,ei ] (0, ei ) =
0

0 if ei ≥ 2.
It follows that
½
µ(1, n) =


=
(−1)e1 +···+ek
0
if ei ≤ 1,
if ei ≥ 2.
if all ei ≤ 1,
otherwise.
1
if n = 1,
(−1)j if n is a product of j distinct primes,

0
otherwise.
Now for arbitrary m, n ∈ Z+ such that m|n,
¡ the
¢ subposet {z ∈ Z+ : m|z, z|n} is isomorphic to the the subposet
n
n
{z ∈ Z+ : z| m
}. We then have µ(m, n) = µ 1, m
. In number theory, we usually write
µ(n) := µ(1, n).
17
Theorem 9.5. Let f, g : Z+ → R be functions such that
X
g(n) =
f (k) for all n ∈ Z+ .
k|n
Then
X ³n´
µ
f (n) =
g(k) for all n ∈ Z+ .
k
k|n
Example 9.5. Let Φn := {k ∈ Z ∩ [1, n] | gcd(k, n) = 1}. Then φ(n) = |Φn |. Let
X
g(n) :=
φ(d) for all n ∈ Z+ .
d|n
Set Φdn := {k ∈ [1, n] : gcd(k, n) = d}. There is bijection Φdn → Φ1n/d , k 7→ k/d, where k ∈ Φdn . Then φ(n/d) = |Φdn |.
Note that for each integer k ∈ [1, n], there is an unique integer d ∈ [1, n] such that gcd(k, n) = d, and of course d|n.
Thus
X
X
n=
φ(n/d) =
φ(k).
d|n
By the Möbius inversion,
φ(n) =
X
k|n
d µ(n/d) =
d|n
X
µ(d) n/d.
d|n
Note that µ(d) = 1 if and only if d = 1; µ(d) = (−1)j if d is a product of j distinct primes; and µ(d) = 0 otherwise.
Let the distinct primes dividing n be p1 , p2 , . . . , pr . Then
(
)
n
o
Y
d ∈ [1, n] : d|n, µ(d) 6= 0
=
x=
a : I ⊆ {1, 2, . . . , r}
a∈I
n
o
=
1, pi , pj pk , . . . | 1 ≤ i ≤ r, 1 ≤ j < k ≤ r, . . . .
We thus have
¶ µ
¶
n
n
n
n
+
+ ··· +
+
+ ··· − ···
φ(n) = n −
p1 p2
p1 p2 p 1 p 3
n
+ · · · + (−1)r
p1 p2 · · · pr
¶
¶
r µ
Y
Y µ
1
1
.
= n
=n
1−
1−
pi
p
µ
i=1
primes p|n
Example 9.6. Let M = {∞ · a1 , . . . , ∞ · ak } be a multiset over a set S = {a1 , . . . , ak }. A circular n-permutation
of M is an arrangement of n elements of M around a circle. Each circular n-permutation of M may be considered
as a periodic double-infinite string
(xi ) := (xi )i∈Z = · · · x−2 x−1 x0 x1 x2 · · ·
with period n, i.e., xi+n = xi for all i ∈ Z. The minimal period of a circular permutation (xi ) of M is the smallest
positive integer d such that for all i ∈ Z,
xi+d = xi .
Let Ln (M ) be the set of all n-permutations of M , and Cn (M ) the set of all circular n-permutations of M . Then
Ln (M ) is just the set of all words of length n over the set S. Consider the map
σ : Ln (M ) → Ln (M ),
σ(x1 x2 · · · xn ) = x2 · · · xn x1 .
A word w of length n is said to be primitive if the words w, σ(w), . . . , σ n−1 (w) are distinct. A period of an n-word
w is a positive integer m such that σ m (w) = w; the very smallest number of all periods of w is called the minimal
18
period of w. Every n-word has trivial period n. An n-word is primitive if and only if its minimal period is n. It
is clear that the minimal period d of a word w is a factor of any period m of w. In fact, write m = qd + r, where
0 ≤ r ≤ d − 1. Suppose r ≥ 1. Then
d
σ r (w) = σ r σ
· · σ }d (w) = σ qd+r (w) = σ m (w) = w.
| ·{z
q
This means that r is a period of w, and is smaller than d, a contradiction.
Let L0d (M ) denote the set of all primitive d-words over S, and L0n,d the set of all n-words of minimal period d.
Then |L0n,d (M )| = |L0d (M )|. Let Cd0 (M ) denote the set of all circular d-words of minimal period d (called primitive
0
0 (M )| = |C 0 (M )|.
circular d-words), and Cn,d
the set of all circular n-words of minimal period d. Then |Cn,d
d
Consider the map
F : Ln (M ) → Cn (M ), w = x1 x2 · · · xn 7→ (xi ) = · · · www · · ·
F
0 (M ), we have
It is easy to see that F is surjective. Since Cn (M ) = d|n Cn,d
X
X
0
|Cn (M )| =
|Cn,d
(M )| =
|Cd0 (M )|.
d|n
F
Since Ln (M ) =
0
d|n Ln,d (M ),
d|n
we have
|Ln (M )| =
X
|L0n,d (M )| =
d|n
By the Möbius inversion,
|L0n (M )| =
X
|Ld (M )| µ(d, n) =
X
|Ld (M )| µ
d|n
Note that each primitive circular d-word (xi ) ∈
|Cd0 (M )| = |L0d (M )|/d. It follows that
X1
d|n
|L0d (M )|.
d|n
d|n
|Cn (M )| =
X
0 (M )
Cn,d
d
.
has exactly d primitive d-words sent to (xi ) by F . Then
|L0d (M )| =
d
³n´
X1X
d|n
d
|La (M )| µ
a|d
µ ¶
d
.
a
Let b = d/a, that is, d = ab. Then d|n is equivalent to b|(n/a). Thus
|Cn (M )| =
X
|La (M )|
a|n
Since φ(n) =
P
n
d|n d
µ(d), then
P
µ(b)
b|(n/a) ab
|Cn (M )| =
=
=
1
n
X µ(b)
.
ab
b|(n/a)
P
b|(n/a)
n/a
b
µ(b) =
1
n
φ
¡n¢
a
. We finally have
³n´
1X
|La (M )| φ
(since |La (M )| = k a |)
n
a
a|n
1 X a ³n´
k φ
(set d = n/a)
n
a
a|n
=
1 X n/d
k φ(d).
n
d|n
Example 9.7. Let M = {n1 · a1 , . . . , nk · ak } be a multiset of type (n1 , . . . , nk ) such that n = n1 + · · · + nk . Set
m = gcd(n1 , . . . , nk ), Md := {(dn1 /m) · a1 , . . . , (dnk /m) · ak }. Let L(Md ) denote the set of all permutations of Md ,
L0a (Md ) the set of all permutations
of Md with minimal period a, and L0 (Md ) the set of all primitive permutations
F
of Md . Then L(Md ) = a|d L0a (Md ) and |L0a (Md )| = |L0 (Ma )|. We have
µ ¶
X
X
d
0
0
|L(Ma )| µ
|L (Ma )|, i.e., |L (Md )| =
|L(Md )| =
.
a
a|d
a|d
19
Analogously, let C(Md ) denote the set of all circular permutations of Md , Ca0 (Md ) the set of all circular permutations
of Md with minimal period a, and C 0 (Md ) the set of all primitive circular permutations of Md . Then C(Md ) =
F
0
0
0
a|d Ca (Md ) and |Ca (Md )| = |C (Ma )|. We have
X
|C(Md )| =
|C 0 (Ma )| =
a|d
X
|L0 (Ma )| ·
a|d
³a´
X m X
|L(Mb )| µ
=
an
b
a|d
m
an
(set c = ab , then a = bc, c| db )
b|a
X d/b
1Xm
|L(Mb )|
µ(c)
n
d
c
d
=
b|d
c| b
=
µ ¶
1Xm
d
|L(Mb )| φ
(set a = db , i.e., b = ad )
n
d
b
=
1Xm
|L(Md/a )| φ(a).
n
d
b|d
a|d
³
Note that |L(Mb )| =
bn/m
bn1 /m,...,bnk /m
´
. Let d = m. We then have
|C(Mm )| =
=
1X
φ(a) |L(Mm/a )|
n
a|m
¶
µ
1X
n/a
.
φ(a)
n1 /a, . . . , nk /a
n
a|m
For instance, M = {12a1 , 24a2 , 18a3 }. Then gcd(12, 24, 18) = 6. Note that φ(1) = 1, φ(2) = 1, φ(3) = 2,
φ(4) = 2, φ(5) = 4, φ(6) = 2. Thus the number of circular permutations of M is
·
µ
¶
µ
¶
µ
¶
µ
¶¸
1
54
27
18
9
φ(1)
+ φ(2)
+ φ(3)
+ φ(6)
54
12, 24, 18
6, 12, 9
4, 8, 6
2, 4, 3
20
Download