Post on 22-Dec-2015
Chapter 8 The principle of Inclusion and Exclusion
Yen-Liang Chen
Dept of Information Management
National Central University
8.1 The principle of Inclusion and Exclusion
)]()()([) ( 212121 ccNcNcNNccN
)()( 2121 ccNccN
)()]()()([
)]()()([) (
321323121
321321
cccNccNccNccN
cNcNcNNcccN
)()]()()()([
)]()()()()()([
)]()()()([) (
4321432431421321
434232413121
43214321
ccccNcccNcccNcccNcccN
ccNccNccNccNccNccN
cNcNcNcNNccccN
Four sets
For each element x, we have five cases: (0) x satisfies none of the four conditions; (1) x satisfies only one of the four conditions; (2) x satisfies exactly two of the four conditions; (3) x satisfies exactly three of the four conditions; (4) x satisfies all the four conditions.
Four sets
1. Say x satisfies no condition. x is counted once on the left side and once on the right side.
2. Say x satisfies c1. It is not counted on the left side. It is counted once in N and once in N(c1).
3. Say x satisfies c2 and c4. It is not counted on the left side. It is counted once in N, N(c2), N(c4) and N(c2c4).
4. Say x satisfies c1, c2 and c4. It is not counted on the left side. It is counted once in N, N(c1), N(c2), N(c4), N(c1c2), N(c1c4), N(c2c4) and N(c1c2c4).
5. Say x satisfies all conditions. It is not counted on the left side. It is counted once in all the subsets on the right side.
)( 4321 ccccN
Theorem 8.1.
Symbol Sk
Ex 8.4.
Determine the number of positive integers n where n100 and n is not divisible by 2, 3 or 5.
Condition c1 if n is divisible by 2.
Condition c2 if n is divisible by 2.
Condition c3 if n is divisible by 2.
Then the answer to this problem is ).( 321 cccN
Ex 8.5.
Determine the number of nonnegative integer solutions to the equation x1+x2+x3+x4=18 and xi7 for all i.
We say that a solution x1, x2, x3, x4 satisfies condition ci if xi>7.
Then the answer to this problem is ).( 4321 ccccN
Ex 8.6.
For finite sets A, B, where A=mn=B, and function f: AB, determine the number of onto functions f.
Let A={a1, a2,…, am} and B={b1, b2, …, bn}.
Let ci be the condition that bi is not in the range of f.
Then the answer to this problem is
).......( 21 ncccN
Ex 8.8.
Let (n) be the number of positive integers m, where 1m<n and gcd(m, n)=1—that is, m and n are relatively prime.
Consider . For 1i4, let ci denote that n is divisible by p
i.
Then the answer to this problem is
4321
4321eeee ppppn
).( 4321 ccccN
Ex 8.9.
Six married couples are to be seated at a circular table. In how many ways can they arrange themselves so that no wife sits next to her husband?
For 1i6, let ci denote the condition that where a seating arrangement has couple i seated next to each other.
Then the answer to this problem is
).....( 621 cccN
8.2. Generalizations of the principle
Em denotes the number of elements in S that satisfy exactly m of the t conditions.
E1=N(c1)+N(c2)+N(c3)-2[N(c1c2)+ N(c1c3)+ N(c2c3)]+3N(c1c2c3)
=S1-2S2+3S3
=S1-C(2,1)S2+C(3, 2)S3
E2=N(c1c2)+N(c1c3)+N(c2c3)-3N(c1c2c3)
=S2-3S3=S2-C(3, 1)S3
E3=S3
No of conditions =4
E1=S1-C(2,1)S2+ C(3, 2)S3-C(4, 3)S4
E2=S2-C(3,1)S3+ C(4, 2)S4
E3=S3-C(4,1)S4
E4=S4
Theorem 8.2.
Corollary 8.2.
Let Lm denotes the number of elements in S that satisfy at least m of the t conditions.
8.3. Derangements: nothing is in its right place Derangement means that all numbers are in the wron
g positions. e-1=1-1+(1/2!)-(1/3!)+(1/4!)-(1/5!)+….. =0.36788 Ex 8.12. Determine the number of derangements of 1,
2,…, 10. Let ci be the condition that integer i is in the i-th position. d10 can be computed as follows.
The general formula
]!
1....
!4
1
!3
1
!2
111[!
nndn
1! endn
Examples
Ex 8.14. We have seven books and seven reviewers. Each book needs to be reviewed by two persons. How many ways can we assign the referees? The first week has 7! ways to assign referees. The second week has d7 ways to assign
referees. Totally, we have 7!d7 ways of possible
assignments.
8.4. Rook polynomials
In Fig. 8.6, we want to determine the number of ways in which k rooks can be placed on the unshaded squares of this chessboard so that no two of them can take each other—that is, no two of them are in the same row or column of the chessboard. This number is denoted as rk(C).
3 2 1
4
5 6
Rook polynomials
In Fig. 8.6, we have r0=1, r1=6, r2=8, r3=2 and rk=0 for k4.
r(C, x)=1+6x+8x2+2x3. For each k0, the coefficient of xk is the number of ways we can place k nontaking rooks on chessboard C.
disjoint subboards
In Fig. 8.7, the chessboard contains two disjoint subboards that have no squares in the same column or row of C.
r(C, x)=r(C1, x). r(C2, x).
Multiple disjoint subboards
In general, if C is a chessboard made up of pairwise disjoint subboards C1, C2,…, Cn, then r(C, x)= r(C1, x). r(C2, x)…. r(Cn, x).
Recursive formula
For a given designated square, (1) we either place one root here, or (2) we do not use this square.
rk(C)=rk-1(Cs)+rk(Ce)
rk(C) xk =rk-1(Cs) xk +rk(Ce) xk for 1kn.
Recursive formula
Apply the recursive formula
8.5. Arrangements with forbidden positions Ex 8.15. The shaded square of RiTj means Ri will not sit at Tj. Determine the number of ways that we can seat these four re
latives on unshaded squares. Let S be the total number of ways we can place these four rel
atives, one to a table. Let ci be the condition that Ri is seated in a forbidden position
but at different tables.
T1 T2 T3 T4 T5
R1
R2
R3
R4
Ex 8.15
Let ri be the number of ways in which it is possible to place i nontaking rooks on the shaded chessboard.
For all 0i4, Si=ri(5-i)! R(C, x)=(1+3x+x2)(1+4x+3x2) =1+7x+16x2+13x3+3x4
4
0
432104321
)!5()1(
)!1(3)!2(13)!3(16)!4(7!5
)(
ii
i ir
SSSSSccccN
Ex 8.16.
We roll two dice six times, where one is red die and the other green die.
We know the following pairs did not occur: (1, 2), (2, 1), (2, 5), (3, 4), (4, 1), (4, 5) and (6, 6).
What is the probability that we obtain all six values both on red die and green die?
One of solutions is like (1, 1), (2, 3), (4, 4), (3, 2), (5, 6), (6, 5).
r(C, x)=(1+4x+2x2)(1+x)3=1+7x+17x2+19x3+10x4+2x5
ci denotes that all six values occur on both the red and green dies, but i on the red die is paired with one of the forbidden numbers on the green die
1 2 3 4 5 6
1
2
3
4
5
6
1 5 3 4 2 6
1
2
4
3
5
6
Ex 8.17.
How many one-to-one functions from A to B satisfy none of the following conditions shown in Fig. 8.11.
r(C, x)= (1+2x)(1+6x+9x2+2x3) =1+8x+21x2+20x3+4x4
u v w x y z
1
2
3
4