• 沒有找到結果。

Principle of Inclusion and Exclusion

N/A
N/A
Protected

Academic year: 2022

Share "Principle of Inclusion and Exclusion"

Copied!
146
0
0

加載中.... (立即查看全文)

全文

(1)

Principle of

Inclusion and Exclusion

•••• An Illustrative Example

Determine the number of integers n, 1≤≤≤≤n≤≤≤≤100, which are not divisible by 2, 3, 5.

Let S={1, 2, …, 100} and N=|S|=100.

Define three conditions as follows: c1 : divisible by 2;

c2 : divisible by 3;

c3 : divisible by 5.

The answer is denoted by N(c1c2c ), which is 3 evaluated below.

(2)

N(c1) = 100/2 = 50; N(c2) = 100/3 = 33;

N(c3) = 100/5 = 20.

N(c1c2) = 100/6 = 16; N(c1c3) = 100/10 = 10;

N(c2c3) = 100/15 = 6.

N(c1c2c3) = 100/30 = 3.

N(c1c2c ) = N −3 −−− (N(c1)++++N(c2)++++N(c3)) ++++ (N(c1c2)++++N(c1c3)++++N(c2c3)) −−−− N(c1c2c3)

= 100 −−−− (50++++33++++20) ++++ (16++++10++++6) −−−− 3

= 26.

(3)

•••• The Principle

S : a set; N = |S|

c1, c2, …, ct : conditions

N(ci) : the number of elements in S that satisfy ci

N(cicj) : the number of elements in S that satisfy ci and cj (and perhaps some others)

N(ci) : the number of elements in S that do not satisfy

ci (N(ci) = N−−−−N(ci))

N(ci cj) : the number of elements in S that do not satisfy either of ci and cj

(4)

Theorem. The number of elements in S that satisfy none of c1, c2, …, ct is equal to

N(c1c2ct)

=

N

− − − −

∑ ∑

∑ ∑

i t 1

N(ci)

+

∑ ∑ ∑

<

<<

<

i j t 1

N(cicj)

− − − −

∑ ∑

∑ ∑

<

<<

<

<

<

<

<

i j k t 1

N(cicjck)

+

•••• •••• ••••

+

(−−−−1)tN(c1c2…ct).

(5)

When t=2, c1→→→ A and c2→→→ B.

N(c1 c ) = 2 |S| −−−− |A∪∪B|

= |S| −−−− (|A| + |B| −−−− |A∩∩B|)

= |S| −−−− (|A| + |B|) + |A∩∩∩∩B|

(6)

When t=3, c1→→→ A, c2→→→ B, and c3→ C.

N(c1c2c ) = 3 |S| −− |A∪− ∪∪∪B∪∪∪∪C|

= |S| −− (|A| + |B| + |C| −− −− |A∩− ∩∩∩B| −− |A∩− ∩∩∩C| −−−−

|B∩∩∩∩C| + |A∩∩B∩∩ ∩∩C|)

= |S| −− (|A| + |B| + |C|) +

(|A∩∩∩∩B| + |A∩∩C| + |B∩∩ ∩∩∩C|) −−−−

|A∩∩∩∩B∩∩∩∩C|

(7)

This theorem can be proved by induction on t.

Here we prove it by a combinatorial method.

(8)

Observation:

|A∪∪∪∪B| = |A| + |B| −−−− |A∩∩B| a 1 = 1 + 0 −−− 0 b 1 = 1 + 0 −−− 0 c 1 = 1 + 1 −−− 1 d 1 = 0 + 1 −−− 0 e 0 = 0 + 0 −−− 0 −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

4 = 3 + 2 −−− 1

(9)

Proof : For each x ∈∈∈∈ S, we show that x contributes the same count to each side of the equation.

N(c1 c2ct)

=

N

− − − −

i t 1

N(ci)

+

<

<<

<

i j t 1

N(cicj)

− − − −

<

<

<

<

<

<<

<

i j k t 1

N(cicjck)

+

•••• •••• ••••

+

(−−−−1)tN(c1c2…ct).

Case 1. x satisfies none of the conditions.

x is counted once in N(c1c2ct) and N, but not in the other terms.

(10)

Case 2. x satisfies r of the conditions.

(1) x contributes nothing to N(c1c2ct ) (2) x is counted once in N.

(3) x is counted (

1

r) times in

∑ ∑ ∑ ∑

i t 1

N(ci).

(4) x is counted (

2

r) times in

∑ ∑ ∑ ∑

<

<

<

<

i j t 1

N(cicj).

x is counted (

r

r) times in

∑ ∑ ∑ ∑

N(

i1

c c …i2

ir

c ).

⇒⇒

⇒ left-hand side : 0.

right-hand side : 1 −−−− (

1 r) ++++ (

2

r) −−−− … ++++ (−−−−1)r(

r r)

= (1++++(−−−−1))r = 0.

(11)

Corollary. The number of elements in S that satisfy at least one of the conditions is N(c1 or c2 or … or ct) = N −−−− N(c1c2ct).

(12)

Let S0 = N.

S1 =

∑ ∑ ∑ ∑

i t 1

N(ci).

S2 =

∑ ∑ ∑ ∑

<

<<

<

i j t 1

N(cicj).

Sk =

∑ ∑ ∑ ∑

N(

i1

c c …i2

ik

c ).

Theorem. The number of elements in S that satisfy exactly m of c1, c2, …, ct is

Em = Sm−−− (

1 +1 + + +

m )Sm+1 + (

2 +2 + + +

m )Sm+2−−− … +

(−−−−1)t−−m (

m t

t

)St.

(13)

Proof. For each x∈∈∈∈S, we show that x contributes the same count to each side of the equation.

Case 1. x satisfies fewer than m conditions.

x is not counted on either side of the equation.

Case 2. x satisfies exactly m of the conditions.

x is counted once in Em and once in Sm, but not in Sm+1, Sm+2, …, St.

(14)

Case 3. x satisfies r (m<<<<r≤≤≤≤t) of the conditions.

x is counted (

m

r ) times in Sm, (

+1 + + + m

r ) times in

Sm+1, …, (

r

r) times in Sr.

But, x contributes nothing to the other terms.

⇒⇒

left-hand side : 0.

right-hand side :

(

m

r ) −

(

1 +1 + ++ m

)

(

+1 ++ + m

r ) +

(

2 +2 + ++ m

)

(

+2 + + + m

r ) −−−− +

(−−−−1)r−−m(

m r

r

)(

r r)

=

. .

(left as an exercise)

.

= 0.

(15)

Theorem. The number of elements in S that satisfy at least m of the t conditions is

Lm = Sm −−−−(

1

m

m )Sm+1 + (

1 1

+ + + + m

m )Sm+2−−− … +

(

−−1

)

t−−m(

1 1

m

t )St.

An inductive proof of this theorem was outlined as problem 8 on page 401 of Grimaldi’s book.

For your reference, the following shows an alternative proof that is based on a combinatorial method.

(16)

For each xS, we show that x contributes the same count to each side of the equation.

Case 1. x satisfies fewer than m conditions.

x is not counted on either side of the equation.

Case 2. x satisfies r (mrt) of the t conditions.

x is counted once in Lm, r

m

  

  times in Sm,

1 r m+

times in Sm+1, …,

r r

  

  times in Sr. But, x contributes nothing to any of the other terms in the equation.

Left-hand side: 1.

Right-hand side:

r m

  

 

1 1

m r

m m+

 

 

  + 1

1 2

m r

m m

+

+

 

 

  +(−1)r−m 1

1

r r

m r

  

  

  

= ( 1)

0 1

r m k

m k m

k r m

+

+

≤ ≤ −

 

 

  (−1)k

= ( 1)

0

r m k

m k

k r m k

+

+

≤ ≤ −

 

 

  (−1)k (assume m1+k0)

= 0

r m k k r m

m

k

≤ ≤ − +

 

 

  (refer to Concrete Mathematics, 2nd edition, by Graham, Knuth, and Patashnik, pp. 164, Eq. (5.14))

= r

m k k

m

k

+

 

 

  (

k

m

=0 as k<0, and

m k

r

+

=0 as k>rm)

= r m

r m

(refer to Concrete Mathematics, 2nd edition, by Graham, Knuth, and Patashnik, pp. 169, Eq. (5.23))

= 1.

Since m0 and k0, we have m=0 and k=0 if m1+k<0.

When m=0 and k=0, the right-hand side is 0

 r

   =1.

(17)

Ex. Compute the number of integer solutions to

x1 + x2 + x3 + x4 = 18, where 0≤≤≤≤xi ≤≤≤≤7 for 1≤≤≤≤i≤≤≤≤4.

Let S be the set of integer solutions to

x1 + x2 + x3 + x4 = 18, where xi ≥≥≥≥0 for 1≤≤≤≤i≤≤≤≤4.

Also, let ci denote the constraint of xi ≥≥≥≥8.

Then, N(c1c2c3c4) is the answer.

N = H(4, 18) = C(4+18−−−−1, 18) = C(21, 18).

N(ci) = H(4, 10) = C(13, 10).

N(cicj) = H(4, 2) = C(5, 2).

N(cicjck) = 0.

N(c1c2c3c4) = 0.

N(c1c2c3c4) = C(21, 18) −−−− C(4, 1)××××C(13, 10) + C(4, 2)××××C(5, 2) −−−− 0 + 0

= 246.

(18)

Ex. Compute the number of ways to permute a, b, c, …, y, z so that none of car, dog, pun, and byte occurs.

Let S be the set of all permutations of the 26 letters.

Let c1, c2, c3 and c4 denotethe conditions that the permutations contain car, dog, pun, and byte, respectively.

Then, N(c1c2c3c4) is the answer.

N = 26!.

N(c1) = N(c2) = N(c3) = 24!; N(c4) = 23!.

N(c1c2) = N(c1c3) = N(c2c3) = 22!; N(cic4) = 21!.

N(c1c2c3) = 20!; N(cicjc4) = 19!.

N(c1c2c3c4) = 17!.

N(c1c2c3c4) = 26! −− (3− ××××24!+23!) + (3××××22!+ 3××××21!) −− (20!+3××××19!) + 17!.

(19)

Ex. Given a positive integer n≥≥≥≥2, the Euler’s phi function, denoted by φφφφ(n), is the number of integers m so that

1≤≤≤≤m≤≤≤≤n and gcd(m, n)=1 (m, n are relatively prime).

For example, φφφφ(2)=1, φφφφ(3)=2, φφφφ(4)=2, and φφφφ(5)=4.

Consider n = 1260 = 22××××32××××5××××7 (質因數分解質因數分解質因數分解質因數分解).

Let S = {1, 2, …, 1260}.

φ φφ

φ(1260) can be computed as follows.

Let c1, c2, c3, c4 denotethe conditions that the integers m are divisible by 2, 3, 5, 7, respectively.

Then, φφφφ(1260) = N(c1c2 c3c4).

(20)

N = 1260.

N(c1) = 1260/2 = 630; N(c2) = 1260/3 = 420;

N(c3) = 1260/5 = 252; N(c4) = 1260/7 = 180.

N(c1c2) = 1260/6 = 210; N(c1c3) = 1260/10 = 126;

N(c1c4) = 1260/14 = 90; N(c2c3) = 1260/15 = 84;

N(c2c4) = 1260/21 = 60; N(c3c4) = 1260/35 = 36.

N(c1c2c3) = 1260/30 = 42; N(c1c2c4) = 1260/42 = 30;

N(c1c3c4) = 1260/70 = 18; N(c2c3c4) = 1260/105 = 12.

N(c1c2c3c4) = 1260/210 = 6.

N(c1c2c3c4) = 1260 −− (630+420+252+180) + (210+126+90+84+60+36) −(42+30+18+12) + 6

= 288.

(21)

In general, suppose n = p1e1 p2e2 ptet (質因數分解質因數分解質因數分解質因數分解).

Then, φφφφ(n) = n××××(1−−−−

1

1

p )××××(1−−−−

2

1

p )×××× … ××××(1−−−− 1 pt ).

For example, when n = 1260, φ

φφ

φ(1260) = 1260××××(1−−−− 1

2)××××(1−−−− 1

3)××××(1−−−− 1

5)××××(1−−−− 1 7)

= 288.

(22)

Another description of Euler’s formula:

Suppose that n is a positive integer and p1, p2, …, pr are distinct prime numbers, where n>pi for all 1≤≤≤≤i≤≤≤≤r.

Let F(n) = |{m| 1≤≤≤≤m≤≤≤≤n is an integer and gcd(m, pi)=1 for all 1≤≤≤≤i≤≤≤≤r}|.

Then, F(n) is equal to f(n) = n××××(1−−−−

1

1

p )××××(1−−−−

2

1

p )×××× … ××××(1−−−− 1 pr ), if f(n) is an integer.

(23)

Ex. Suppose that n=23, p1 =2, and p2 =3 (i.e., r=2).

There are 8 integers in {1, 2, …, 23} that are relatively prime to both 2 and 3. They are 1, 5, 7, 11, 13, 17, 19, and 23.

f(n) = n××××(1−−−− 1

2)××××(1−−−− 1 3) =

3 n. f(23) is not an integer

We first compute f(21)=7 (or f(24)=8), and then obtain F(23)=F(21)+1=f(21)+1=8 (or F(23)= F(24)=f(24)=8), where 1 indicates the integer 23.

(24)

Ex. Six married couples are to be seated at a circular table. In how many ways can they be arranged so that no wife sits next to her husband?

Let ci denotethe condition that couple i are neighboring, where 1≤≤≤≤i≤≤≤≤6.

The answer is N(c1c2c6).

N = 12!

12 = 11!.

N(ci) = 11!

11 ××××2 = 2××××10!.

N(cicj) = 10!

10 ××××22 = 22××××9!.

Similarly, N(cicjck) = 23××××8!, N(cicjckcl) = 24××××7!, N(cicjckclcr) = 25 ××××6!, N(cicjckclcrcs) = 26 ××××5!.

N(c1c2c6) = 11! −− C(6, 1)− ××××2××××10! + C(6, 2)××××22××××9!

−−

− C(6, 3)××××23××××8! + C(6, 4)××××24××××7!

−−

− C(6, 5)××××25 ××××6! + C(6, 6)××××26××××5!

= 12,771,840.

(25)

Ex. How many ways are there to connect five vertices a, b, c, d and e so that none of them is isolated?

(O) (O) (X) (X)

Let c1, c2, c3, c4 and c5 denotethe conditions that vertices a, b, c, d and e are isolated, respectively.

The answer is N(c1c2c5).

(26)

N = 210 (at most 10 edges among five vertices).

N(ci) = 26. N(cicj) = 23. N(cicjck) = 21.

N(cicjckcl) = N(cicjckclcr) = 20.

N(c1c2c5) = 210− C(5, 1)− ××××26 + C(5, 2)××××23

−−

− C(5, 3)××××21 + C(5, 4)××××20

−−

− C(5, 5)××××20

= 768.

(27)

Ex. For the example above, how many ways are there to connect five vertices a, b, c, d and e so that exactly two of them are isolated?

The answer is E2 = S2− C(3, 1)− ××××S3 + C(4, 2)××××S4

−−

− C(5, 3)××××S5

= C(5, 2)××××23−−− C(3, 1)××××C(5, 3)××××21 + C(4, 2)××××C(5, 4)××××20

−−

− C(5, 3)××××C(5, 5)××××20

= 80 −−−− 60 + 30 −−−− 10

= 40.

(28)

•••• Derangements

An arrangement of 1, 2, …, n is called a derangement, if 1 is not at the first place (its natural position), 2 is not at the second place (its natural position), …, and n is not at the nth place (its natural position).

Consider n=10, and let ci denote the condition that integer i is at the ith place, where 1≤≤≤≤i≤≤≤≤10.

The number of derangements of 1, 2, …, 10 is N(c1c …2 c ) =10 10! −−−− (

1

10)9! +++ (+

2

10)8! −−−− … ++++(

10

10)0!

= 1334960.

(29)

Ex. There are seven books undergoing a two-round review process of seven reviewers. Each book is reviewed by two distinct reviewers. In how many ways can these books be reviewed?

There are 7! ways for the first-round review.

There are d7 ways for the second-round review, where d7 is the number of derangements of 1, 2,

…, 7.

The answer is 7!××××d7.

(30)

×

× ×

×

: rook (車車)

•••• Rook Polynomials

Problem : Given a chessboard C of arbitrary shape and size, determine the number rk of ways of placing k nontaking rooks on C.

××××

… … …

(31)

C :

r1 = 6, r2 = 8, r3 = 2 rk = 0 for k≥≥≥≥4

Let r0 = 1.

rook polynomial R(C, x) =

∑ ∑ ∑ ∑

=

==

=0 i

rixi

= 1+6x+8x2+2x3

(32)

C2 : C1 :

C :

R(C, x) = 1+11x+40x2+56x3+28x4+4x5 R(C1, x) = 1+4x+2x2

R(C2, x) = 1+7x+10x2+2x3

C1 and C2 are “disjoint” (no square in the same row or column)

⇒⇒

⇒ R(C, x) = R(C1, x)

⋅⋅⋅⋅

R(C2, x)

(33)

Count r3 in C as follows.

Case 1. All three rooks are placed on C2 : 2 ways Case 2. Two rooks are placed on C2 and one rook is

placed on C1 : 10××××4 = 40 ways

Case 3. One rook is placed on C2 and two rooks are placed on C1 : 7××××2 = 14 ways

r3 = 2+40+14 = 56

Compute the coefficient r3 of x3 in R(C1, x)

⋅⋅⋅⋅

R(C2, x) : R(C1, x)

⋅⋅⋅⋅

R(C2, x)

= (1+4x+2x2)

⋅⋅⋅⋅

(1+7x+10x2+2x3)

= . . . + 1

⋅⋅⋅⋅

2x3 + 4x

⋅⋅⋅⋅

10x2 + 2x2

⋅⋅⋅⋅

7x + . . .

= . . . + (1

⋅⋅⋅⋅

2+4

⋅⋅⋅⋅

10+2

⋅⋅⋅⋅

7)x3 + . . . Case 1 Case 2 Case 3

(34)

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).

(35)

Let rk(C) denote the number of ways of placing k nontaking rooks on the chessboard C.

C:

rk(C) consists of the following two parts.

∗∗∗

(36)

Cs :

Ce : (Ce is obtained from C by deleting the designated square.)

1. A rook on the square designated by “∗∗∗∗”.

(Cs is obtained from C by deleting the row and the column containing the designated square.)

rk−−1 (Cs) is included in rk(C).

2. No rook on the designated square.

rk(Ce) is included in rk(C).

Therefore, rk(C) = rk−−1 (Cs) + rk(Ce), and R(C, x) = xR(Cs, x) + R(Ce, x).

(37)

= x

⋅⋅⋅⋅

∗∗

+

∗∗

= x2

⋅⋅⋅⋅

+x

⋅⋅⋅⋅

+x

⋅⋅⋅⋅

+ ∗∗∗∗

= x2

⋅⋅⋅⋅

+2x

⋅⋅⋅⋅

+x

⋅⋅⋅⋅

+

= (x2+ x)

⋅⋅⋅⋅

+ (2x+ 1)

⋅⋅⋅⋅

Ex.

= (x2+x)

⋅⋅⋅⋅

(1+2x)+(2x+1)

⋅⋅⋅⋅

(x2+3x + 1)

= 1+6x+10x2+4x3.

∗∗∗

(38)

C : Ex.

Determine the number of ways of placing four nontaking rooks on the unshaded area of C.

Let ci be the condition that a rook is placed on the shaded area of row i.

N(c1c2 c3 c4) = S0 S1 +S2 S3 +S4

= 5!–r1

⋅⋅⋅⋅

4!+r2

⋅⋅⋅⋅

3!r3

⋅⋅⋅⋅

2!+r4

⋅⋅⋅⋅

1!,

where R(the shaded area of C, x)

= (1+3x+x2)

⋅⋅⋅⋅

(1+4x+3x2)

= 1+7x+16x2+13x3+3x4 = 1+r1x+r2x2+r3x3+r4x4.

N(c1 c2 c3c4) = 5!–7

⋅⋅⋅⋅

4!+16

⋅⋅⋅⋅

3!13

⋅⋅⋅⋅

2!+3

⋅⋅⋅⋅

1!

= 25.

(39)

Ex. Four people, denoted by R1, R2, R3 and R4, are assigned to five tables, denoted by T1, T2, T3, T4 and T5, in a wedding reception. In how many ways can they be assigned to four distinct tables, subject to the following four restrictions:

(a) R1 is not assigned to T1 or T2; (b) R2 is not assigned to T2;

(c) R3 is not assigned to T3 or T4; (d) R4 is not assigned to T4 or T5.

The answer is 25, as computed in the example above.

(40)

Ex. Two dice, denoted by R and G, are rolled six times.

Under the condition of (R, G)∉∉∉∉{(1, 2), (2, 1), (2, 5), (3, 4), (4, 1), (4, 5), (6, 6)}, what is the probability that all six values 1, 2, …, 6 occur for both R and G?

Consider the following left chessboard, where the row (column) labels represent the outcome on R (G).

The right chessboard is obtained by relabeling the rows and columns, where the seven shaded squares constitute four pairwise disjoint subboards.

Therefore, r(C, x) = (1+4x+2x2)××××(1+x)3

= 1+7x+17x2+19x3+10x4+2x5.

(41)

The probability is P = 6! 6 29

×S

×

×

× , where there are 6! ways for R to occur 1, 2, …, 6 and S is the number of ways for G to occur 1, 2, …, 6 under the condition.

For example, (1, ?), (2, ?), (3, ?), (4, ?), (5, ?), (6, ?) and (4, ?), (5, ?), (6, ?), (1, ?), (2, ?), (3, ?) are two ways for R to occur 1, 2, 3, 4, 5, 6.

Then, each way for the former to occur 1, 2, 3, 4, 5, 6 for G, e.g., (1, 6), (2, 2), (3, 3), (4, 4), (5, 5), (6, 1),

uniquely corresponds to a way for the latter to occur 1, 2, 3, 4, 5, 6 for G, e.g., (4, 4), (5, 5), (6, 1), (1, 6), (2, 2), (3, 3), and vice versa.

參考文獻

相關文件

Particles near (x, y, z) in the fluid tend to rotate about the axis that points in the direction of curl F(x, y, z), and the length of this curl vector is a measure of how quickly

Notice that Theorem 3 has one term for each intermediate variable and each of these terms resembles the one-dimensional Chain Rule in Equation 1.. To remember the Chain

remember from Equation 1 that the partial derivative with respect to x is just the ordinary derivative of the function g of a single variable that we get by keeping y fixed.. Thus

The following theorem states that (1 + x) k is equal to the sum of its Maclaurin

In order to establish the uniqueness of a prime factorization, we shall use the alternative form of the Principle of Mathematical Induction.. For the integer 2, we have a unique

An n×n square is called an m–binary latin square if each row and column of it filled with exactly m “1”s and (n–m) “0”s. We are going to study the following question: Find

By exploiting the Cartesian P -properties for a nonlinear transformation, we show that the class of regularized merit functions provides a global error bound for the solution of

The case where all the ρ s are equal to identity shows that this is not true in general (in this case the irreducible representations are lines, and we have an infinity of ways