Discrete Mathematics -- Chapter 8: The Principle of Ch t 8 Th P i i l f Inclusion and Exclusion Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U
Outline � The Principle of Inclusion and Exclusion � Generalization of the Principle � Generalization of the Principle � Derangements: Nothing Is in Its Right Place � Rook Polynomials � Arrangements with Forbidden Positions � Arrangements with Forbidden Positions 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 2
8.1 The principle of Inclusion and Exclusion � For a given finite set S (| S | = N ) with conditions C � For a given finite set S (| S | = N ) with conditions C i • = − + + ( ) [ ( ) ( )] ( ) ( and ) N c c N N c N c N c c N c c 1 2 1 2 1 2 1 2 = − ( ) ( ) N c N c c 1 1 2 = − ( ) ( ) N c c N N c c 1 2 1 2 ≠ ≠ ( ( ) ) N N c c 1 c c ( ( or or ) ) N N c c c c 1 2 2 1 2 • = − + + ( ) [ ( ) ( ) ( )] N c c c N N c N c N c 1 2 3 1 2 3 + + + − [ [ ( ( ) ) ( ( ) ) ( ( )] )] ( ( ) ) N N c c N N c c N N c c N N c c c 1 2 1 3 2 3 1 2 3 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 3
Four sets Four sets � Ex 8.3 : = − + + + ( ) [ ( ) ( ) ( ) ( )] N c c c c N N c N c N c N c 1 2 3 4 1 2 3 4 + + + + + + + + + + + + [ [ ( ( ) ) ( ( ) ) ( ( ) ) ( ( ) ) ( ( ) ) ( ( )] )] N N c c c c N N c c c c N N c c c c N N c c c c N N c c c c N N c c c c 1 1 2 2 1 1 3 3 1 1 4 4 2 2 3 3 2 2 4 4 3 3 4 4 − + + + + [ ( ) ( ) ( ) ( )] ( ) N c c c N c c c N c c c N c c c N c c c c 1 2 3 1 2 4 1 3 4 2 3 4 1 2 3 4 � For each element x ∈ S we have five cases: � For each element x ∈ S , we have five cases: � (0) x satisfies none of the four conditions; � (1) x satisfies only one 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; (3) x satisfies exactly three of the four conditions; � (4) x satisfies all the four conditions. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 4
= − + + + ( ) [ ( ) ( ) ( ) ( )] Four sets N c c c c N N c N c N c N c 1 2 3 4 1 2 3 4 + + + + + + [ ( ) ( ) ( ) ( ) ( ) ( )] N c c N c c N c c N c c N c c N c c 1 2 1 3 1 4 2 3 2 4 3 4 − + + + + [ ( ) ( ) ( ) ( )] ( ) N c c c N c c c N c c c N c c c N c c c c 1 2 3 1 2 4 1 3 4 2 3 4 1 2 3 4 x satisfies no condition. x is counted once in and once in N . ( ) 1. N c c c c 1 2 3 4 [1=1] x satisfies c 1 . It is not counted on the left side. It is counted once in N and 2. once in N ( c 1 ). [0 = 1-1 = 0] i ( ) [0 1 1 0] x satisfies c 2 and c 4 . It is not counted on the left side. It is counted once in 3. N , N ( c 2 ), N ( c 4 ) and N ( c 2 c 4 ). ( ) ( ) ( ) ( ) = − + + = − + = 2 2 2 2 [ 0 1 ( 1 1 ) 1 1 0 ] 1 2 x satisfies c 1 , c 2 and c 4 . It is not counted on the left side. It is counted 4. once in N N ( c 1 ) N ( c 2 ) N ( c 4 ) N ( c 1 c 2 ) N ( c 1 c 4 ) N ( c 2 c 4 ) and N ( c 1 c 2 c 4 ) once in N , N ( c 1 ), N ( c 2 ), N ( c 4 ), N ( c 1 c 2 ), N ( c 1 c 4 ), N ( c 2 c 4 ) and N ( c 1 c 2 c 4 ). ( ) ( ) ( ) = − + + + + + − = − + − = 3 3 3 [ 0 1 ( 1 1 1 ) ( 1 1 1 ) 1 1 0 ] 1 2 3 x satisfies all conditions. It is not counted on the left side. It is counted 5. once in all the subsets on the right side. ( ) ( ) ( ) ( ) = − + − + = 4 4 4 4 [ 0 1 0 ] 1 2 3 4 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 5
Four sets 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 6
The Principle of Inclusion and Exclusion � Theorem 8.1: � | S | = N conditions c 1 ≤ i ≤ t � | S | = N , conditions c i , 1 ≤ i ≤ t = ⋅ ⋅ ⋅ denote the number of elements of S ( ) � N N c c c 1 2 t that satisfy none of the conditions that satisfy none of the conditions. ∑ ∑ ∑ = − + − + ⋅ ⋅ ⋅ ( ) ( ) ( ) (2) N N N c N c c N c c c i i j i j k ≤ ≤ ≤ < ≤ ≤ < < ≤ 1 1 1 i t i j j t i j j k t + − ⋅ ⋅ ⋅ ( 1 ) ( ) t N c c c c 1 2 3 t 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 7
2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 8
The Principle of Inclusion and Exclusion = − ( or or ... or ) . � Corollary 8.1: N c c c N N 1 2 t � Some notation for simplifying Theorem 8.1 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 9
The Principle of Inclusion and Exclusion � Ex 8.4 : Determine the number of positive integers n where 1 ≤ n ≤ 100 and n is not divisible by 2, 3 n where 1 ≤ n ≤ 100 and n is not divisible by 2, 3 or 5. � Condition c if n is divisible by 2 � Condition c 1 if n is divisible by 2. � Condition c 2 if n is divisible by 3. � Condition c 3 if n is divisible by 5. C di i if i di i ibl b 5 � Then the answer to this problem is = − + − ⎣ ⎣ ⎦ ⎦ = ( ) 100 /( 2 * 3 ) 16 N c c c S S S S 1 2 3 0 1 2 3 = − + + + + + − [ ( ) ( ) ( )] [ ( ) ( ) ( )] ( ) N N c N c N c N c c N c c N c c N c c c 1 2 3 1 2 1 3 2 3 1 2 3 = − + + + + + − = 100 [ 50 33 20 ] [ 16 10 6 ] 3 26 . 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 10
The Principle of Inclusion and Exclusion � Ex 8.5 : Determine the number of nonnegative integer solutions to the equation x 1 + x 2 + x 3 + x 4 = 18 and x i ≤ 7 for all i . � We say that a solution x 1 , x 2 , x 3 , x 4 satisfies condition c i if x i > 7 (i.e., x i ≥ 8) . � Then the answer to this problem is + − ⎛ ⎛ 4 4 2 2 1 1 ⎞ ⎞ + − ⎛ ⎞ 4 10 1 ⎜ ⎟ + − ⎛ ⎞ 4 18 1 ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ ⎜ ⎟ 2 ⎝ ⎠ ⎜ ⎟ 10 ⎝ ⎠ 18 ⎝ ⎠ 2009 Spring 2009 Spring Discrete Mathematics – Discrete Mathematics – CH8 CH8 11
The Principle of Inclusion and Exclusion � Ex 8.6 : For finite sets A , B , where ⎪ A ⎪ = m ≥ n = ⎪ B ⎪ , and function f : A → B , determine the number of onto functions f . Let A = { a 1 , a 2 ,…, a m } and B = { b 1 , b 2 , …, b n }. L { } d B { b b } A b � Let c i be the condition that b i is not in the range of f . � Then ( ) is the number of functions in that have in their range. N c S b 1 i ( ...... ). Then the answer to this problem is N c c c � 1 2 n = = = | | m N S S n ( ) 0 = − ⇒ = − ( ) ( 1 ) ( 1 ) m n m N c n S n 1 i 1 ( ) ( ) = − ⇒ = − ( ( ) ) ( ( 2 2 ) ) ( ( 2 2 ) ) m m n n m m N N c c n S S n 2 i j 2 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 12
The Principle of Inclusion and Exclusion � Ex 8.7 : In how many ways can the 26 letters of the alphabet be permuted so that none of the patterns car, dog, pun or byte occurs? pun, or byte occurs? � Ex 8.8 : Let φ ( n ) be the number of positive integers m , where 1 ≤ m < n and gcd( m , n )=1, i.e., m and n are relatively prime. relatively prime. n = e e e e � Consider p 1 p 2 p 3 p 4 1 2 3 4 � For 1 ≤ i ≤ 4, let c i denote that k is divisible by p i . � N = S 0 = n ; N ( c i ) = n / p i ; N ( c i c j ) = n /( p i p j ); … ( ) / ( ) /( ) S � Then the answer to this problem is ( ). N c c c c 1 2 3 4 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 13
− − − − − − − − 1 1 1 1 ( 1 ) e ( 1 ) e ( 1 ) e ( 1 ) e p p 1 p p 2 p p 3 p p 4 1 1 2 2 3 3 4 4 2009 Spring 2009 Spring Discrete Mathematics – Discrete Mathematics – CH8 CH8 14
The Principle of Inclusion and Exclusion � 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 1 ≤ i ≤ 6, let c i denote the condition where a seating arrangement has couple i seated next to each other. N ( c i ) = 2(11-1)! ( ) ( .... ). � Then the answer to this problem is N c c c 1 2 6 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH8 CH8 15
Recommend
More recommend