Permutations that are in two of the sets AI, A2 , . . . , An -l contain two patterns. These patterns either share an element, such as the patterns 12 and 23, or have no element in common, such as the patterns 12 and 34. A permutation which contains the two patterns 12 and 34 can be regarded as a permutation of the n - 2 symbols {12, 34, 5, ... ,n}. Thus, IAI
n
A31=
(n - 2)!. A permutation that contains the two patterns 12 and 23 contains the pattern 123 and thus can be regarded as a permutation of the n - 2 symbols {123,4, ... ,n}. Hence, IAI n A21 = (n - 2)!. In general, we see thatI
Ai nAjl=(n-2)!for each 2-subset {i, j} of {I, 2, ... , n - I}. More generally, we see that a permutation which contains k specified patterns from the list 12,23, ... , (n - l)n can be regarded as a permutation of n - k symbols, and thus that
for each k-subset {iI, i2, ... ,ik} of {I, 2, ... ,n - I}. Since, for each k = 1,2, ... ,n - 1, there are
(nk"l)
k-subsetss of {I, 2, ... ,n-1}, applying the inclusion-exclusion principlewe obtain the formula in the theorem. 0
Using the formula of Theorem 6.5.1, we calculate that
The numbers Ql, Q2, Q3,'" are closely related to the derangement numbers. Indeed, we have Qn = Dn
+
D n-l , (n ::::: 2). (See Exercise 23.) Thus, knowing the derangement numbers, we can calculate all the numbers Qn, (n ::::: 2). Since we have already seen in the preceding section that Ds=
44, D6=
265, we conclude that Q6=
D6+
Ds=
265
+
44 = 309.6.6 Mobius Inversion
This section includes more sophisticated mathematics than the other sections in this chapter.
The inclusion-exclusion principle is an instance of Mobius inversion on a finite4 partially ordered set. In order to set the stage for the generality of Mobius inversion, we first discuss a somewhat more general version of the inclusion-exclusion principle.
Let n be a positive integer and consider the set Xn
=
{I, 2, ... ,n} of n elements, and the partially ordered set (P(Xn), <;:;) o~ all subsets of Xn partially ordered by containment. Let40ne can replace the property of being finite by a weaker property called locally finite, which asserts that, for all a and b with a :S b, the interval {x : a :S x :S b} is a finite set.
be a real-valued function defined on P(Xn ). We use F to define a new function
by
C(K) =
L
F(L), (K ~ Xn ), (6.10)L~K
where, as indicated, K is a subset of Xn and the summation extends over all subsets L of K. Mobius inversion allows one to invert equation (6.10) and to recover F from C; specifically, we have
F(K)
= L
(_l)IKI-ILIC(L), (K ~ Xn). (6.11)L~K
Notice that F is obtained from C in (6.11) in a way similar to that in which C is obtained from F in (6.10); the only difference is that in (6.11) we insert in front of each term of the summation either a 1 or -1 depending on whether
IKI -ILl
is even or odd.Let AI, A2, ... , An be subsets of a finite set S, and for a set K ~ {I, 2, ... , n}, define F(K) to be the number of elements of S that belong to exactly those sets Ai with i
rf.
K. Thus, for 8 E S, 8 is counted by F(K) if and only ifThen
for each i E K, and for each j
rf.
K.C(K)
= L
F(L)L~K
counts the Humber of elements of S that belong to all of the sets Aj with j not in K and possibly other sets as well. Thus,
By (6.11),
F(K) =
L
(_l)IKI-ILIC(L). (6.12)L~K
Taking K
=
{I, 2, ... ,n} in (6.12), we getF(Xn)
= L
(_1)n-1LIC(L). (6.13)L~Xn
Now, F(Xn) counts the number of elements of S that belong only to those sets Ai with i
rf.
Xn; that is, F(Xn) is the number of elements of S that belong to none of the sets6.6. MOBIUS INVERSION 185 AI, A2 , .•. , An and thus equals the number of elements contained in Al nA2n·· ·nAn.
Substituting into (6.13), we obtain
IAI n A2 n ... n Ani =
L
(_l)n-1LII nillL Ail,L<;;Xn
or, equivalently, by replacing L with its complement in Xn and calling it J, IAI n A2 n .. · n Ani =
L
(-1)1111 niEJ Ail·J<;;Xn
(6.14) Equation (6.14) is equivalent to the formula for the inclusion-exclusion principle as given in Theorem 6.1.1.
We now replace (P(Xn ), <;;;;) with an arbitrary finite partially ordered set (X, ::;).
To derive the formula for Mobius inversion, we first consider functions of two variables.
Let F(X) be the collection of all real-valued functions f: X x X --t R,
with the property that f(x, y) =
°
whenever x1.
y. Thus, f(x, y) can be different from°
only when x ::; y. We define the convolution product h = f*
9 of two functionsf
and 9 in F(X) byh( ) { L{z:x::;z::;y} f(x, z)g(z,y),
x,y
=
0, if x::; y,otherwise.
Thus, in the convolution product, to compute h(x, y) when x ::; y, we add up all products f(x, z)g(z, y) as z varies over all elements z between x and y in the given partial order. We leave it as an exercise to verify that the convolution product satisfies the associative law:
f*(g*h)=(j*g)*h, (j,g,hinF(X».
There are three special functions in F(X) of interest to us. The first is the Kro- necker delta function 6, given by
6(x,y) = { 1, 0,
if x = y otherwise.
Note that 6
*
f=
f*
6=
f for all functionsf
E F(X), and thus 6 acts as an identity function with respect to convolution product. The second is the zeta function <; defined by<;(x,y) = { 1, 0,
if x::; y otherwise.
The zeta function is a representation of the poset (X,~) in that it contains all the information about which pairs x, y of elements satisfy x ~ y.
Let I be a function in :F(X) such that I(y, y)
#
0 for all y in X. We can inductively define a function 9 in :F(X) by first letting1
g(y, y)
=
ICy, y)' (y EX), (6.15) and then lettingg(x, y) = - - ( - ) 1
L
g(x, z)/(z, y), (x<
y). (6.16)I
y, y {z:x9<y}From (6.16), we get
L
g(x, z)/(z, y)=
6(x, y), (x ~ y). (6.17){z:x~z~y}
Equation (6.17) tells us that
9
* 1=
6,and therefore 9 is a left-inverse function of
I
with respect to the convolution product.In a similar way, we can show that
I
has a right-inverse function h satisfyingUsing the associative law for convolution product, we get
Thus, 9
=
hand 9 is an inverse function ofI.
In sum, every functionI
E :F(X) with I(y,y)#
0 for all y in X has an inverse function g, inductively defined by (6.15) and (6.16), satisfying9
* I = 1*
9=
6.The third special function we define is the Mobius function 1-£. Since ((y, y)
=
1 for all y EX, ( has an inverse, and we define 1-£ to be its inverse. Therefore,1-£*( = 6, and so, applying (6.17) with
1=(
and 9 = J-t, we getL
J-t(x,z)((z,y) = 6(x,y), (~~ y),{z:x~z~y}
or, equivalently,
L
J-t(x, z) = 6(x, y), (x ~ y). ( 6.18){z:x~z~y}
6.6. MOBIUS INVERSION 187