COS 341 Discrete Mathematics Epoetial Geeratig Fuctios ad Recurrece Relatios 1
Tetbook? 1 studets said they eeded the tetbook, but oly oe studet bought the tet from Triagle. If you do t have the book, please get it from Triagle. We will have to pay for the copies that are t take!
Deragemets (or Hatcheck lady revisited) d : umber of permutatios o objects without a fied poit D ( ) : epoetial geeratig fuctio for umber of deragemets A permutatio o [ ] ca be costructed by pickig a subset K of [ ], costructig a deragemet of K ad fiig the elemets of [ ]- K. Every permutatio of [] arises eactly oce this way. EGF for all permutatios! 1 = =! 1 = 0 EGF for permutatios with all elemets fied 1 1 = D ( ) e 1! = = = 0 e 3
Deragemets 1 = D ( ) e 1 1 D ( ) = e 1 = ( 1)! = 0 = 0 k d ( 1) = coefficiet of =! k = 0 k! k ( 1) d =! k! k= 0 Differet proof i Matousek 10., problem 17 4
Eample How may sequeces of letters ca be formed from A, B, ad C such that the umber of A's is odd ad the umber of B's is odd? EGF for A's EGF for B's EGF for C' s required EGF = e = = odd! e e = = =! e = 0 e = e e e e e e 3 + 4 5
Eample How may sequeces of letters ca be formed from A, B, ad C such that the umber of A's is odd ad the umber of B's is odd? required EGF = coefficiet of = required umber = e e e 3 + 4 1 3 ( 1) +! 4 3 + ( 1) 4 6
Recurrece relatios A recurrece relatio for the sequece {a } is a equatio that epressed a i terms of oe or more of the previous terms of the sequece, for all itegers 0 A sequece is called a solutio of a recurrece relatio if its terms satisfy the recurrece relatio. a = a a a a a 1 0 1 3 = 3, a = 5 = 5 3= = 5= 3 Iitial coditios 7
Reproducig rabbits Suppose a ewly-bor pair of rabbits, oe male, oe female, are placed o a islad. A pair of rabbits does ot breed util they are moths old. After they are two moths old, each pair of rabbits produces aother pair each moth. Suppose that our rabbits ever die ad that the female always produces oe ew pair (oe male, oe female) every moth from the secod moth o. The puzzle that Fiboacci posed was... How may rabbits will there be i oe year? 8
I the begiig 9
Eter recurrece relatios Let f be the umber of rabbits after moths. f = 1, f = 1 1 f = f + f 1 Number of pairs moths old Number of eistig pairs Fiboacci sequece 10
Towers of Haoi N disks are placed o first peg i order of size. The goal is to move the disks from the first peg to the secod peg Oly oe disk ca be moved at a time A larger disk caot be placed o top of a smaller disk 11
Towers of Haoi Let be the umber of moves required to H solve the problem with disks. H H 1 = 1 = + 1 H 1 1
Towers of Haoi solutio H = + 1 H 1 = ( H + 1) + 1= H + + 1 = ( H + 1) + + 1= H + + + 1 3 3 3 = H + + + + + 1 1 3 1 = + + + + + 1 3 1 = 1 13
The ed of the world? A aciet leged says that there is a tower i Haoi where the moks are trasferrig 64 gold disks from oe peg to aother accordig to the rules of the puzzle. The moks work day ad ight, takig 1 secod to trasfer each disk. The myth says that the world will ed whe they fiish the puzzle. How log will this take? 64 1= 18,446,744,073,709,551,615 It will take more tha 500 billio years to solve the puzzle! 14
More recurrece relatios How may bit strigs of legth do ot have cosecutive 0 s? Let a be the umber of such bit strigs of legth. Ed with 1: Ay bit strig of legth -1 with o two cosecutive 0 s 1 a 1 Ed with 0: Ay bit strig of legth - with o two cosecutive 0 s 1 0 a a = a + a 1 15
A familiar sequece? How may bit strigs of legth do ot have cosecutive 0 s? Let a be the umber of such bit strigs of legth. a = a + a 1 1 = = f 3 = 3 = f 4 a a a a 3 4 = 3+ = 5 = = 5+ 3= 8 = a = f + f 5 f 6 16
How may ways ca you multiply? I how may ways ca you parethesize the product of + umbers? 3 1 0 1 e.g. (( ) ), 0 1 3 ( ( ))), 0 1 3 ( ) ( ), 0 1 3 (( ) ), 0 1 3 ( ( )). 0 1 3 Let be the umber of ways of parethesizig C a product of + 1 umbers. C = 5 17
How may ways ca you multiply? Let C be the umber of ways of parethesizig the product 0 1 ( ) ( ) k 0 1 k k+ 1 C 1 C = C C C k 1 k k 1 k= 0 th Catala umber C = 1, C = 1 0 1 18
Solvig recurrece relatios A liear homogeeous recurrece relatio of degree k with costat coefficiets is a recurrece relatio of the form a = c a + c a + + c a 1 1 k k where c, c are real umbers ad c 0 1 k k a 5 1 a a = a + a a = = a 1 19
Solvig recurrece relatios a = c a + c a + + c a 1 1 k k Try a = r r = c r + c r + + c r 1 k 1 k r c r c r c r = 1 k 1 k r c r c r c r c = k k 1 k k 1 1 k 1 0 k 0 Characteristic equatio 0
Solvig recurrece relatios 1 r c1r c a = c a + c a 1 1 Let r, r be the roots of the characteristic equatio = 0 The the solutio to the recurrece relatio is of the form a = α r +α r 1 1 1
1 1 ( ) Solvig recurrece relatios f = f + f 1 Let r, r be the roots of the characteristic equatio r r r 1= 0 = 1+ 5 / r ( 1 5) = / The the solutio to the recurrece relatio is of the form f 1+ 5 1 5 = α +α 1
Solvig recurrece relatios f = f + f 1 f 1 1+ 5 1 1 5 = 5 5 3