discrete math by r.s. chang, dept. csie, ndhu1 chapter 8 + or -?

27
crete Math by R.S. Chang, Dept. CSIE, NDHU Chapter 8 + or -?

Upload: jovany-bulkley

Post on 01-Apr-2015

223 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 1

Chapter 8

+ or -?

Page 2: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 2

Chapter 88.1 The Principle of Inclusion and Exclusion

Let be a set with | |= , and let be a collection ofconditions or properties satisfied by some, or all, of the elementsof . Some elements of may satisfy more than one of the conditions, whereas others may not satisfy any of them.

( the number of elements in that satisfy condition the number of elements in that satisfy both of the

conditions , and perhaps some others

the number of elements in that do not satisfy either of

the conditions (

S S N c c c

S S

N c S cN c c S

c cN c N N c

N c c S

c or c N c c

t

i ii j

i j

i i

i j

i j i j

1 2, , ,

):( ):

,( )

:

)

不滿足 ci且不滿足 cj 不滿足 ci或不滿足 cj

Page 3: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 3

Chapter 88.1 The Principle of Inclusion and Exclusion

N c j( )

N c c ci j k

N c j( )N ci( ) N ci( )

N ck( )N c ci j( )

N c c ci j k( )N c cj k( )

N c ci j

N c ci j N ci( ) N c j( )

N c ci j( )

=N-[+ ]

+

Page 4: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 4

Chapter 88.1 The Principle of Inclusion and Exclusion

Theorem 8.1 . Consider aset with | |= , and conditions satisfied by some ofthe elements of . The number of elements of that satisfy noneof the conditions is denoted by where

Proof by combinatorial argument. For each , we show that contributes the same count, either 0 or 1, to each side of theequation.

The inciple of Inclusion and ExclusionS S N c i t

S SN N c c c

N N N c N c c N c c c

N c c c

x S x

i

t

ii t

i ji j t

i j ki j k t

tt

Pr, ,

( ) ( ) ( )

( )

1

1

1 2

1 1 1

1 2

Page 5: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 5

Chapter 8

N N N c N c c N c c c

N c c c

x x NN x

xr r t x

N x

rr r r

r

ii t

i ji j t

i j ki j k t

tt

r

( ) ( ) ( )

( )

.

1 1 1

1 21

2 31

If satisfies none of the conditions, then is counted once in and once in , but not in any of the other terms. Consequently, contributed a count of 1 to each side. The other possibility is that satisfies exactly of the conditions, 1 . In this case contributes nothing to But on the right - hand side, is counted

1 - + [ ( )]1 1 0 0r r times.

8.1 The Principle of Inclusion and Exclusion

Theorem 8.1 The Principle of Inclusion and Exclusion

Page 6: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 6

Chapter 88.1 The Principle of Inclusion and Exclusion

Corollary 8.1 The number of elements in that satisfy at leastone of the conditions is -

Ex. 8.1 Determine the number of positive integer n where 1100 and is not divisible by 2,3, or 5.Here = {1,2, ,100}, =100, divisible by 2, divisibleby 3, divisible by 5.

1 23

SN N

NotationsS N S N c S N c c

S N c c c k tn

nS N c cc

N c c c S S S S

i i j

k i i ik

.

, ( ), ( ),, ( ), .

: ::

0 1 2

1 2 3 0 1 2 3

1 21

100100

2

100

3

100

5

100

2 3

100

2 5

100

3 5

100

2 3 526

Page 7: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 7

Chapter 88.1 The Principle of Inclusion and Exclusion

Ex. 8.2 Found the number of nonnegative integer solutions of with x for all 1 i 4.

S: nonnegative integer solutions, N =|S|=4 +18 - 1

18condition c then the answer is N c

nonnegative integer solution of nonnegative integer solution of

N c

1 i

i 1

11

1

x x x x

x i c c cN c x x x xN c c x x x xN c c c N c c c c

c c

i

2 3 4

2 3 4

1 2 3 41 2 2 3 41 2 3 1 2 3 4

2

18 721

188 1 4

102

0

,

.

: , ,( ):( ):( ) ( )

3 4 1 2 3 421

18

4

1

13

104

2

5

20 0 246

c N S S S S

Page 8: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 8

Chapter 88.1 The Principle of Inclusion and Exclusion

Ex. 8.3 The number of onto functions from = {to = { with .

= the set of all functions : . Then =| |=condition is not in the range of for 1Then counts the number of onto functions.

In general,

A a a aB b b b m n

S f A B N S nc b f i n

N c c c

S N cn

n S N c cn

n

S N c c cn

kn k

mn

m

i i

n

im

i jm

k i i ik

1 21 2

1 2

1 211

22

1 2

, , , }, , , }

.:

( ) , ( ) ,

(

)

( )

( ) ( )

m

nn

n

i

i

n m

N c c c S S S Sn

n in i

1 2 0 1 2

1

1

1

Page 9: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 9

Chapter 88.1 The Principle of Inclusion and Exclusion

Ex. 8.5 For Z let ( ) be the number of positiveintegers , where 1 < and gcd( , ) = 1, i.e. , , arerelative prime. The function is known as ' .For example, (2) = 1, (3) = 2, (4) = 2, (5) = 4, (6) = 2.

For prime , ( ) = - . For 2, let =where are distinct primes and , .Consider the case where = 4.

= { , , , }, =| |= ,

+n n nm m n m n m n

Euler s phi function

p p p n n p p pp p p e i t

tS n N S nc

e ete

t i

i

t

, ,

,, , ,

2

111

1 2

1 21 2

1 2

: .

( )

divisible by Hence, ( ) =p n N c c c c

n S S S S S nn

p

n

pn

p p

n

p p p

n

p p p pn

p

i

ii

1 2 3 4

0 1 2 3 41 4

1 2 1 2 3 1 2 3 4 1

41

1

Page 10: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 10

Chapter 88.1 The Principle of Inclusion and Exclusion

In general, ( ) = - where the product is taken

over all primes dividing . When = , a prime,

( ) = ( ) = -

|

n np

p n n p

n p pp

p

pn 11

11

1

,

.

Ex. 8.6 Construct roads for 5 villages such that no village will beisolated. In how many ways can we do this?

O.K. not O.K.

Page 11: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 11

Chapter 88.1 The Principle of Inclusion and Exclusion

Ex. 8.6 Construct roads for 5 villages such that no village is isolated.

= 2 : village is isolated for 1 5.

5

2N c i iN c c c c c S S S S S S

i

2

25

12

5

22

5

32

5

42

5

52 768

10

1 2 3 4 5 0 1 2 3 4 5

10

4

2

3

2

2

2 0 0

.

.

Page 12: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 12

Chapter 88.2 Generalizations of the Principle

If Z and , we now want to determine which denotes the number of elements in that satisfyexactly of the conditions. (At present, we can obtain

+

0

m m t ES

m t E

m 1 ,

)

c1

c2

c3

2

5 86

37 4

1E1: regions 2,3,4E2: regions 5,6,7

E S S S

S S S

E S S S S

E S

1 1 2 3

1 2 3

2 2 3 2 3

3 3

2 32

1

3

2

33

1

Page 13: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 13

Chapter 88.2 Generalizations of the Principle

Theorem 8.2 For each , the number of elements in that satisfy exactly of the conditions is given by

Proof: Let , consider the following three cases:(a) satisfies fewer than conditions: it contributes 0 to both side(b) satisfies exactly of the conditions: it contributes 1 to both side ( and c) satisfies of the conditions, where < . Then

contributes nothing to

1

1

1

2

21

1 2

1 2

m t Sm c c c

E Sm

Sm

St

t mS

x Sx m

x mE S

x r m r t xE

t

m m m mt m

t

m m

m

, , ,

( )

)(

.

For the right side, is counted

x

Page 14: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 14

Chapter 8

times. For 0 - ,

+

r

m

m r

m

m r

mr

r m

r

rk r m

m k

k

r

m k

m k

k m

r

m k r m kr

m k r m k

r

m r m

r m

k r m k

r

m

r m

1

1 1

2

2 2

1

1

( )

( )!

! !

!

( )!( )!!

! !( )!

!

!( )!

( )!

!( )!

r m

kx

r

m

r m r m r m r m

r mr

m

r m

r m

Consequently, on the right hand side, is counted

times.

0 1 21

1 1 0

( )

( )

8.2 Generalizations of the Principle

Page 15: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 15

Chapter 88.2 Generalizations of the Principle

Let denote the number of elements in that satisfy at least of the conditions. Then we have:

Corollary 8.2

When = ,

L Sm t

L Sm

mS

m

mS

t

mS

m L S S St

S

S S S S N N

m

m m m m

t mt

tt

tt

1

1

1

11

1

11

0

2

01

1

0

1

1 2

1 1 2 31

1 2 31

( ) .

( )

( )

Page 16: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 16

Chapter 88.3 Derangements: Nothing Is in Its Right Place

Ex. 8.8 Find the number of permutations such that 1 is not inthe first place, 2 is not in the second place, ..., and 10 is not inthe tenth place. (derangements of 1,2,3,...,10)

c i i i

d N c c c

e

e xx x x

n

i

xn

n

:

! ! ! !

!(! ! !

) !

! ! !

is in the th place for 1 10

since

10

1 2 10

1

2 3

0

1010

19

10

28

10

100

10 1 11

2

1

3

1

1010

12 3

Page 17: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 17

Chapter 88.3 Derangements: Nothing Is in Its Right Place

Ex. 8.10 Assign 7 books to 7 reviewers two times such thateveryone gets a different book the second times.Ans: first time 7!, second time d7

therefore, 7! d7

nn

dn

dn

dn

nd

n

kd

d k d

nk

nk

k

!

0 1 2

1

0 1 20

0

the number of derangements of 1,2, , ;

Page 18: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 18

Chapter 88.4 Rook Polynomials

rook: castle

123

4

5 6

Determine the number of ways in which k rookscan be placed on the chessboard so that no twoof them can take each other, i.e., no two of themare in the same row or column of the chessboard.Denote this number by rk or rk(C).

r r r r k

r

r C x x

k1 2 3

3

6 8 2 0 4

1

2

, , , ,

,

for

With the rook polynomial

( , ) = 1 + 6x + 8x0

2

idea: break up a large board into smaller subboards

Page 19: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 19

Chapter 88.4 Rook Polynomials

C1

C2

C

r C x x x r C x x x x

r C x x x x x x r C x r C x

( , ) , ( , )

( , ) ( , ) ( , )1

22

2 3

2 3 4 51 2

1 4 2 1 7 10 2

1 11 40 56 28 4

Did this occur by luck or is somethinghappening here that we should examinemore closely?

Page 20: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 20

Chapter 88.4 Rook Polynomials

C1

C2

C

To obtain r3 for C:(a) All three rooks are on C2:(2)(1)=2 ways(b) Two on C2 and one on C1:(10)(4)=40(c) One on C2 and two on C1:(7)(2)=14total=(2)(1)+(10)(4)+(7)(2)=56

r C x x x r C x x x x

r C x x x x x x r C x r C x

( , ) , ( , )

( , ) ( , ) ( , )1

22

2 3

2 3 4 51 2

1 4 2 1 7 10 2

1 11 40 56 28 4

In general, if is a chessboard made up of pairwise disjointsubboards then ( , ) = (

CC C C r C x r C x r C x r C xn n1 2 1 2, , , , , ) ( , ) ( , ).

Page 21: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 21

Chapter 88.4 Rook Polynomials

* decompose this board according to (*)

Ce

Cs r C r C r C

r C x r C x r C x

r C x r C x r C x

r C x x r C x r C x

r C x x r C x r C x

k k s k e

kk

k sk

k ek

kk

k

nk s

k

k

nk e

k

k

n

kk

k

nk s

k

k

nk e

k

k

n

s e

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( )

( , ) ( , ) ( , )

1

1

11

1 1

11

1

1 11 1

put one at *

* is empty

*

Cs

Ce

Page 22: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 22

Chapter 88.4 Rook Polynomials

*=x +

* *

=x2 +x +x + *

=x2 +2x +x +

x x x x x x x x

x x x x x x x

2 2 2

2 2 31 2 2 1 4 2 1 3

1 2 1 4 2 1 8 16 7

( ) ( ) ( )

[ ( ) ( )]

Page 23: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 23

Chapter 88.5 Arrangements with Forbidden Positions

Ex. 8.11 Arrange 4 persons to sit at five tables such that each onesits at a different table and with the following conditions satisfied:(a) R1 will not sit at T1 or T2 (b) R2 will not sit at T2

(c) R3 will not sit at T3 or T4 (b) R4 will not sit at T4 or T5

R1R2R3

R4

T1 T2 T3 T4 T5 It would be easier to work with the shaded areasince it is less than the unshaded one.

condition ci: Ri is in a forbidden position

The answer is N c c c c S S S S S1 2 3 4 0 1 2 3 4 .

Page 24: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 24

Chapter 88.5 Arrangements with Forbidden Positions

Ex. 8.11

R1R2R3

R4

T1 T2 T3 T4 T5

condition ci: Ri is in a forbidden position

The answer is where is the number of ways

in which it is possible to place nontaking rooks on the shadedchessboard.

( , ) = ( + +

So

N c c c c S S S S SS P S r i r

i

r C x x x x x x x x x

N c c c c r i

i i i

ii

i

1 2 3 4 0 1 2 3 4

0

2 2 2 3 4

1 2 3 40

4

5 4 5 5

1 3 1 4 3 1 7 16 13 3

1 5 25

.( , ) !, ( )!,

)( )

( ) ( )!

Page 25: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 25

Chapter 88.5 Arrangements with Forbidden Positions

Ex. 8.12 We have a pair of dice; one is red, the other green. We rollthese dice six times. What is the probability that we obtain all sixvalues on both the red dice and the green die if we know that the ordered pairs (1,2), (2,1),(2,5),(3,4),(4,1),(4,5), and (6,6) did not occur? [(x,y) indicates x on the red die and y on the green.]

1 2 3 4 5 6123456

1 5 3 4 2 6124356

For chessboard C of seven shaded squares,

r C x x x x x x x x x( , ) ( )( ) 1 4 2 1 1 7 17 19 10 22 3 2 3 4 5

Relabeling the rows and columns

Page 26: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 26

Chapter 88.5 Arrangements with Forbidden Positions

ci: the condition where, having rolled the dice six times, we findthat all six values occur on both the red die and the green die, buti on the red die is paired with one of the forbidden numbers on thegreen die

Then the number of ordered sequences of the six rolls of the dicefor the event we are interested in is:

6 6 1

6 1 6 138 240

0 00023

1 2 3 4 5 60

6

0

6

! ! ( )

! ( ) ( )! ,

.

N c c c c c c S

r i

ii

i

ii

i

The probability is 138240 / (29)6

Page 27: Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Chapter 8 + or -?

Discrete Math by R.S. Chang, Dept. CSIE, NDHU 27

Chapter 8Exercise: P369: 16 P373: 8 P376: 14 P382: 5

End of chapter 8.