Discrete Mathematics Discrete Mathematics -- Chapter 9: Generating Function Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U
Outline � Calculational Techniques � Partitions of Integers � Partitions of Integers � The Exponential Generating Function � The Summation Operator 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 2
Enumeration again � Chapter 1: c 1 + c 2 + c 3 + c 4 =25, where c i >= 0 � Chapter 8: c + c + c + c =25 where 10> c >= 0 � Chapter 8: c 1 + c 2 + c 3 + c 4 =25, where 10> c i >= 0 � In chapter 9, c 2 to be even and c 3 to be a multiple of 3 f � the coefficient xy 2 in (x+y) 3 � the coefficient x 4 in (x+x 2 )(x 2 +x 3 +x 4 )(1+x+2x 2 ) 4 i ( + 2 )( 2 + 3 + 4 )(1+ +2 2 ) th ffi i t 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 3
9.1 Introductory Examples Ex 9.1 : � One mother buys 12 oranges � f for three children, Grace, Mary, th hild G M and Frank. Grace gets at least four, and Mary and Frank gets at least two, Grace gets at least four, and Mary and Frank gets at least two, � � but Frank gets no more than five. Solution � + + = ≤ ≤ ≤ ≤ � 12 , where 4 , 2 , and 2 5 c c c c c c 1 2 3 1 2 3 Generating function: � f ( x ) = (x 4 + x 5 + x 6 + x 7 + x 8 )(x 2 + x 3 +x 4 + x 5 + x 6 )(x 2 + x 3 +x 4 + x 5 ) ( 4 + 5 + 6 + 7 + 8 )( 2 + 3 + 4 + 5 + 6 )( 2 + 3 + 4 + 5 ) f ( ) product x j x j x k → every triple ( i , j , k ) The coefficient of x 12 in f ( x ) yields the solution. f ( ) y � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 4
Introductory Examples Ex 9.2 : � There is an unlimited number of red, green, white, and black jelly � beans. beans. In how many ways can we select 24 jelly beans so that we have an � even number of white beans and at least six black ones? Solution Solution � � red (green): 1+ x 1 + x 2 +….+ x 23 + x 24 � white: 1+ x 2 + x 4 +….+ x 22 + x 24 � black: x 6 + x 7 +….+ x 23 + x 24 � Generating function: � f ( x ) = (1+ x 1 + x 2 +….+ x 23 + x 24 ) 2 (1+ x 2 + x 4 +….+ x 22 + x 24 ) f ( x ) (1 x x …. x x ) (1 x x …. x x ) (x 6 + x 7 +….+ x 23 + x 24 ) The coefficient of x 24 in f ( x ) is the answer. � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 5
Introductory Examples Ex 9.3 : How many nonnegative integer solutions are there for H ti i t l ti th f � c 1 + c 2 + c 3 + c 4 = 25? Solution � Alternatively, in how many ways 25 pennies can be distributed among � four children? Generating function: Generating function: � � f ( x ) = (1+ x 1 + x 2 +…+ x 24 + x 25 ) 4 (polynomial) The coefficient of x 25 is the solution. � Note : Note : � � g ( x ) = (1+ x 1 + x 2 +…+ x 24 + x 25 + x 26 +…) 4 ( power series ) � can also generate the answer ∞ ∞ ∑ = − n ( ) ( ) f x a x c n = n 0 Easier to compute with a power series than with a polynomial p p p y � 2009 Spring 2009 Spring Discrete Mathematics – Discrete Mathematics – CH9 CH9 6
9.2 Definition and Examples: Calculational Techniques Definition 9.1: � ( ) ( ) ( ) ( ) + = + + + ⋅ ⋅ ⋅ + 2 n n Ex 9.4 : n n n n ( 1 ) x x x x � 0 1 2 n so, (1 + x ) n is the generating function for the sequence , ( ) g g q ( ) ( ) ( ) ( ) ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ n n n n , , , , , 0 , 0 , 0 , 0 1 2 n 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 7
Definition and Examples: Calculational p Techniques Ex 9.5 : � (1 - x n +1 )/(1 - x ) is the generating function for the sequence 1, a) 1, 1,…, 1, 0, 0, 0,…, where the first n +1 terms are 1. + − = − + + + ⋅ ⋅ ⋅ + n 1 2 n Q ( 1 ) ( 1 )( 1 ). x x x x x 1/(1 x) is the generating function for the sequence 1 1 1 1/(1-x) is the generating function for the sequence 1, 1, 1, b) b) < = + + + + ⋅ ⋅ ⋅ 2 3 Q 1 while | | 1 , 1 x x x x 1,… − 1 x 1/(1-x) 2 is the generating function for the sequence 1, 2, 3, ( ) g g q , , , c) ) 4,… = − − = − − − − 1 2 Q 1 d d ( 1 ) ( 1 )( 1 ) ( 1 ) x x − 1 dx x dx = = + + + + ⋅ ⋅ ⋅ = + + + + ⋅ ⋅ ⋅ 2 3 2 3 1 d ( ( 1 ) ) 1 2 3 4 x x x x x x − ) 2 dx dx ( ( 1 1 ) x x x/(1-x) 2 is the generating function for the sequence 0,1,2,3,…. d) = + + + + + ⋅ ⋅ ⋅ 2 2 3 3 4 4 Q x 0 0 1 1 2 2 3 3 4 4 x x x x − 2 ( 1 ) x 2009 Spring 2009 Spring Discrete Mathematics – Discrete Mathematics – CH9 CH9 8
Definition and Examples: Calculational p Techniques Ex 9.5 : � (x+1)/(1-x) 3 is the generating function for the sequence e) 1 2 , 2 2 , 3 2 , 4 2 ,… 2 2 2 2 d x Q − 2 dx = + + + + ⋅ ⋅ ⋅ ( 1 ) x 2 3 Q d x d ( 0 2 3 ) x x x − 2 dx dx − ( 1 ) x = − 2 d ( ( 1 ) ) x x d dx = + + + + ⋅ ⋅ ⋅ + 2 2 2 2 3 1 x 1 2 3 4 x x x − − = − 2 + − − 3 − − 3 ( 1 ) x ( 1 ) ( 2 )( 1 ) ( 1 ) x x x − + + ( 1 ) 2 = x x = 1 x − 3 3 − 3 3 ( 1 ) ( 1 ) x x x(x+1)/(1-x) 3 is the generating function for the sequence f) 0 2 , 1 2 , 2 2 , 3 2 , 4 2 ,… + + = + + + + ⋅ ⋅ ⋅ ( ( 1 1 ) ) 2 2 2 2 2 2 3 3 x x x x Q 0 0 1 1 2 2 3 3 x x x − 3 ( 1 ) x 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 9
Definition and Examples: Calculational p Techniques Ex 9.5 : � Further extensions: g) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 10
Definition and Examples: Calculational p Techniques Ex 9.6 : � 1/(1 - a x) is the generating function for the sequence a 0 , a 1 , a 2 , ( ) g g q , , , a) ) a 3 ,… f (x) = 1/(1- x) is the generating function for the sequence 1, 1, b) 1, 1,… Then g (x) = f (x) - x 2 is the generating function for the � sequence 1 1 0 1 1 1 sequence 1, 1, 0, 1, 1, 1,… h (x) = f (x) + 2x 3 is the generating function for the � sequence 1, 1, 1, 3, 1, 1,… sequence 1, 1, 1, 3, 1, 1,… Can we find a generating function for the sequence 0, 2, 6, 12, c) 20, 30, 42,…? 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 11
Definition and Examples: Calculational p Techniques Ex 9.6 : � c) Observe 0, , 2, , 6, , 12, , 20,... , = = + = = + 2 2 0 0 0 , 2 1 1 , a a 0 1 = = + + = = + + 2 2 6 6 2 2 2 2 , , 12 12 3 3 3 3 , , a a a a 2 2 3 3 = = + ⋅ ⋅ ⋅ 2 20 4 4 , a 4 ∴ ∴ = + + 2 a n a n n n n + + + − ( 1 ) ( 1 ) ( 1 ) x x x x x x 2 x x + = = 3 2 3 3 − − − − ( ( 1 1 ) ) ( ( 1 1 ) ) ( ( 1 1 ) ) ( ( 1 1 ) ) x x x x x x x x is the generating function. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 12
Extension of Binomial Theorem ( ) ( ) ( ) ( ) n + = + + + ⋅ ⋅ ⋅ + 2 n n n n n Binomial theorem: ( 1 ) x x x x � 0 1 2 n ⎛ ⎛ ⎞ ⎞ − − − + n ! ( 1 )( 2 )...( 1 ) n n n n n r ⎜ ⎟ = = When n ∈ Z + , we have ⎜ ⎟ � − ⎝ ⎠ ! ( )! ! r r n r r ⎛ ⎞ − − − + If n ∈ R , we define n ( 1 )( 2 )...( 1 ) n n n n r � ⎜ ⎟ = ⎜ ⎟ ⎝ ⎠ ! r r ⎛− ⎛ ⎞ ⎞ − − − − − − − + If n ∈ Z + , we have n ( )( 1 )( 2 )...( 1 ) n n n n r � ⎜ ⎟ = ⎜ ⎟ ⎝ ⎠ ! r r − + + + + − r ( ( 1 1 ) ) ( ( )( )( 1 1 ) ( )...( 1 1 ) ) n n n n n n r r = ! r + − ⎛ ⎞ − + − 1 r ( 1 ) ( 1 )! n r n r = = − ⎜ r ( ( 1 ) ) ⎜ ⎜ − ( ( 1 )! ) ! ⎝ ⎝ ⎠ ⎠ r n r 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 13
Extension of Binomial Theorem Ex 9.7 : � (1-x) -n ? 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 14
Extension of Binomial Theorem Ex 9.8 : Find the coefficient of x 5 in (1-2x) -7 . � Solution � ( ) ( ) ∑ ∑ ∞ ∞ − − = − − 7 7 7 7 r ( 1 2 ) ( 2 ) x x = 0 r r 5 The coefficien t of : x ( ) ( ) ( ) − − = − + − − = 5 5 7 7 5 1 11 ( 2 ) ( 1 ) ( 32 ) ( 32 ) 5 5 5 Ex 9.9 : Find the coefficient of all x i in (1+3x) -1/3 � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 15
Definition and Examples: Calculational p Techniques Ex 9.10 : Determine the coefficient of x 15 in f ( x ) = � (x 2 +x 3 +x 4 +…) 4 . Solution � (x 2 +x 3 +x 4 +…) = x 2 (1+x+x 2 +…) = x 2 /(1-x) � f ( x )=(x 2 /(1-x)) 4 = x 8 /(1-x) 4 � Hence the solution is the coefficient of x 7 in (1-x) -4 : � C( 4 7)( 1) 7 = ( 1) 7 C(4+7 1 7)( 1) 7 = C(10 7) = 120 C(-4, 7)(-1) 7 = (-1) 7 C(4+7-1, 7)(-1) 7 = C(10, 7) = 120. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH9 CH9 16
Recommend
More recommend