generating functions and recurrence relations
play

GENERATING FUNCTIONS AND RECURRENCE RELATIONS Generating Functions - PowerPoint PPT Presentation

GENERATING FUNCTIONS AND RECURRENCE RELATIONS Generating Functions Recurrence Relations Suppose a 0 , a 1 , a 2 , . . . , a n , . . . , is an infinite sequence. A recurrence recurrence relation is a set of equations a n = f n ( a n 1 , a n


  1. GENERATING FUNCTIONS AND RECURRENCE RELATIONS Generating Functions

  2. Recurrence Relations Suppose a 0 , a 1 , a 2 , . . . , a n , . . . , is an infinite sequence. A recurrence recurrence relation is a set of equations a n = f n ( a n − 1 , a n − 2 , . . . , a n − k ) . (1) The whole sequence is determined by (6) and the values of a 0 , a 1 , . . . , a k − 1 . Generating Functions

  3. Linear Recurrence Fibonacci Sequence a n = a n − 1 + a n − 2 n ≥ 2 . a 0 = a 1 = 1. Generating Functions

  4. b n = | B n | = |{ x ∈ { a , b , c } n : aa does not occur in x }| . b 1 = 3 : a b c b 2 = 8 : ab ac ba bb bc ca cb cc b n = 2 b n − 1 + 2 b n − 2 n ≥ 2 . Generating Functions

  5. b n = 2 b n − 1 + 2 b n − 2 n ≥ 2 . Let B n = B ( b ) ∪ B ( c ) ∪ B ( a ) n n n where B ( α ) = { x ∈ B n : x 1 = α } for α = a , b , c . n Now | B ( b ) n | = | B ( c ) n | = | B n − 1 | . The map f : B ( b ) → B n − 1 , n f ( bx 2 x 3 . . . x n ) = x 2 x 3 . . . x n is a bijection. B ( a ) = { x ∈ B n : x 1 = a and x 2 = b or c } . The map n g : B ( a ) → B ( b ) n − 1 ∪ B ( c ) n − 1 , n g ( ax 2 x 3 . . . x n ) = x 2 x 3 . . . x n is a bijection. Hence, | B ( a ) n | = 2 | B n − 2 | . Generating Functions

  6. Towers of Hanoi Peg 2 Peg 3 Peg 1 Hn is the minimum number of moves needed to shift n rings from Peg 1 to Peg 2. One is not allowed to place a larger ring on top of a smaller ring. Generating Functions

  7. xxx H n-1 moves 1 move H n-1 moves Generating Functions

  8. A has n dollars. Everyday A buys one of a Bun (1 dollar), an Ice-Cream (2 dollars) or a Pastry (2 dollars). How many ways are there (sequences) for A to spend his money? Ex. BBPIIPBI represents “Day 1, buy Bun. Day 2, buy Bun etc.”. u n = number of ways = u n , B + u n , I + u n , P where u n , B is the number of ways where A buys a Bun on day 1 etc. u n , B = u n − 1 , u n , I = u n , P = u n − 2 . So u n = u n − 1 + 2 u n − 2 , and u 0 = u 1 = 1 . Generating Functions

  9. If a 0 , a 1 , . . . , a n is a sequence of real numbers then its (ordinary) generating function a ( x ) is given by a ( x ) = a 0 + a 1 x + a 2 x 2 + · · · a n x n + · · · and we write a n = [ x n ] a ( x ) . For more on this subject see Generatingfunctionology by the late Herbert S. Wilf. The book is available from https://www.math.upenn.edu// wilf/DownldGF .html Generating Functions

  10. a n = 1 1 1 − x = 1 + x + x 2 + · · · + x n + · · · a ( x ) = a n = n + 1. 1 ( 1 − x ) 2 = 1 + 2 x + 3 x 2 + · · · + ( n + 1 ) x n + · · · a ( x ) = a n = n . x ( 1 − x ) 2 = x + 2 x 2 + 3 x 3 + · · · + nx n + · · · a ( x ) = Generating Functions

  11. Generalised binomial theorem: � α � a n = n ∞ � α � a ( x ) = ( 1 + x ) α = � x n . n n = 0 where � α � = α ( α − 1 )( α − 2 ) · · · ( α − n + 1 ) . n n ! � m + n − 1 � a n = n ∞ ∞ � − m � � m + n − 1 � 1 ( − x ) n = � � x n . a ( x ) = ( 1 − x ) m = n n n = 0 n = 0 Generating Functions

  12. General view. Given a recurrence relation for the sequence ( a n ) , we (a) Deduce from it, an equation satisfied by the generating n a n x n . function a ( x ) = � (b) Solve this equation to get an explicit expression for the generating function. (c) Extract the coefficient a n of x n from a ( x ) , by expanding a ( x ) as a power series. Generating Functions

  13. Solution of linear recurrences a n − 6 a n − 1 + 9 a n − 2 = 0 n ≥ 2 . a 0 = 1 , a 1 = 9. ∞ ( a n − 6 a n − 1 + 9 a n − 2 ) x n = 0 . � (2) n = 2 Generating Functions

  14. ∞ � a n x n = a ( x ) − a 0 − a 1 x n = 2 = a ( x ) − 1 − 9 x . ∞ ∞ � � 6 a n − 1 x n a n − 1 x n − 1 = 6 x n = 2 n = 2 = 6 x ( a ( x ) − a 0 ) = 6 x ( a ( x ) − 1 ) . ∞ ∞ � 9 a n − 2 x n 9 x 2 � a n − 2 x n − 2 = n = 2 n = 2 9 x 2 a ( x ) . = Generating Functions

  15. a ( x ) − 1 − 9 x − 6 x ( a ( x ) − 1 ) + 9 x 2 a ( x ) = 0 or a ( x )( 1 − 6 x + 9 x 2 ) − ( 1 + 3 x ) = 0 . 1 + 3 x 1 + 3 x a ( x ) = 1 − 6 x + 9 x 2 = ( 1 − 3 x ) 2 ∞ ∞ ( n + 1 ) 3 n x n + 3 x � � ( n + 1 ) 3 n x n = n = 0 n = 0 ∞ ∞ ( n + 1 ) 3 n x n + � � n 3 n x n = n = 0 n = 0 ∞ � ( 2 n + 1 ) 3 n x n . = n = 0 a n = ( 2 n + 1 ) 3 n . Generating Functions

  16. Fibonacci sequence: ∞ ( a n − a n − 1 − a n − 2 ) x n = 0 . � n = 2 ∞ ∞ ∞ a n x n − a n − 1 x n − a n − 2 x n = 0 . � � � n = 2 n = 2 n = 2 ( a ( x ) − a 0 − a 1 x ) − ( x ( a ( x ) − a 0 )) − x 2 a ( x ) = 0 . 1 a ( x ) = 1 − x − x 2 . Generating Functions

  17. 1 a ( x ) = − ( ξ 1 − x )( ξ 2 − x ) 1 � 1 1 � = ξ 1 − x − ξ 1 − ξ 2 ξ 2 − x � � ξ − 1 ξ − 1 1 1 2 = − ξ 1 − ξ 2 1 − x /ξ 1 1 − x /ξ 2 where √ √ 5 + 1 5 − 1 ξ 1 = − and ξ 2 = 2 2 are the 2 roots of x 2 + x − 1 = 0 . Generating Functions

  18. Therefore, ∞ ∞ ξ − 1 ξ − 1 1 x n − � � 1 ξ − n 2 ξ − n 2 x n a ( x ) = ξ 1 − ξ 2 ξ 1 − ξ 2 n = 0 n = 0 ∞ ξ − n − 1 − ξ − n − 1 � 1 2 x n = ξ 1 − ξ 2 n = 0 and so ξ − n − 1 − ξ − n − 1 1 2 a n = ξ 1 − ξ 2 � √ √  � n + 1  � n + 1 � 1 5 + 1 1 − 5  . √ = −  2 2 5 Generating Functions

  19. Inhomogeneous problem a n − 3 a n − 1 = n 2 n ≥ 1 . a 0 = 1. ∞ ∞ � ( a n − 3 a n − 1 ) x n � n 2 x n = n = 1 n = 1 ∞ ∞ ∞ n ( n − 1 ) x n + � n 2 x n � � nx n = n = 1 n = 2 n = 1 2 x 2 x = ( 1 − x ) 3 + ( 1 − x ) 2 x + x 2 = ( 1 − x ) 3 ∞ � ( a n − 3 a n − 1 ) x n = a ( x ) − 1 − 3 xa ( x ) n = 1 = a ( x )( 1 − 3 x ) − 1 . Generating Functions

  20. x + x 2 1 a ( x ) = ( 1 − x ) 3 ( 1 − 3 x ) + 1 − 3 x A B ( 1 − x ) 3 + D + 1 C = 1 − x + ( 1 − x ) 2 + 1 − 3 x where x + x 2 ∼ A ( 1 − x ) 2 ( 1 − 3 x ) + B ( 1 − x )( 1 − 3 x ) = + C ( 1 − 3 x ) + D ( 1 − x ) 3 . Then A = − 1 / 2 , B = 0 , C = − 1 , D = 3 / 2 . Generating Functions

  21. So − 1 / 2 1 5 / 2 a ( x ) = 1 − x − ( 1 − x ) 3 + 1 − 3 x ∞ ∞ ∞ − 1 � n + 2 � x n + 5 x n − � � � 3 n x n = 2 2 2 n = 0 n = 0 n = 0 So − 1 � n + 2 � + 5 23 n a n = 2 − 2 2 − n 2 − 3 2 − 3 n 2 + 5 23 n . = Generating Functions

  22. General case of linear recurrence a n + c 1 a n − 1 + · · · + c k a n − k = u n , n ≥ k . u 0 , u 1 , . . . , u k − 1 are given. ( a n + c 1 a n − 1 + · · · + c k a n − k − u n ) x n = 0 � It follows that for some polynomial r ( x ) , a ( x ) = u ( x ) + r ( x ) q ( x ) where k q ( x ) = 1 + c 1 x + c 2 x 2 + · · · + c k x k = � ( 1 − α i x ) i = 1 and α 1 , α 2 , . . . , α k are the roots of p ( x ) = 0 where p ( x ) = x k q ( 1 / x ) = x k + c 1 x k − 1 + · · · + c 0 . Generating Functions

  23. Products of generating functions ∞ ∞ � � a n x n , b ( x )) = b n x n . a ( x ) = n = 0 n = 0 ( a 0 + a 1 x + a 2 x 2 + · · · ) × a ( x ) b ( x ) = ( b 0 + b 1 x + b 2 x 2 + · · · ) = a 0 b 0 + ( a 0 b 1 + a 1 b 0 ) x + ( a 0 b 2 + a 1 b 1 + a 2 b 0 ) x 2 + · · · ∞ � c n x n = n = 0 where n � c n = a k b n − k . k = 0 Generating Functions

  24. Derangements n � n � � n ! = d n − k . k k = 0 � n � Explanation: d n − k is the number of permutations with k � n � exactly k cycles of length 1. Choose k elements ( ways) for k which π ( i ) = i and then choose a derangement of the remaining n − k elements. So n 1 d n − k � 1 = k ! ( n − k )! k = 0 � n ∞ ∞ � 1 d n − k � x n � � x n . = (3) k ! ( n − k )! n = 0 n = 0 k = 0 Generating Functions

  25. Let ∞ d m � m ! x m . d ( x ) = m = 0 From (3) we have 1 e x d ( x ) = 1 − x e − x d ( x ) = 1 − x ∞ n � ( − 1 ) k � � � x n . = k ! n = 0 k = 0 So n ( − 1 ) k d n � = . n ! k ! k = 0 Generating Functions

  26. Triangulation of n -gon Let a n = number of triangulations of P n + 1 n � = a k a n − k n ≥ 2 (4) k = 0 a 0 = 0, a 1 = a 2 = 1. k +1 n+1 1 Generating Functions

  27. Explanation of (4): a k a n − k counts the number of triangulations in which edge 1 , n + 1 is contained in triangle 1 , k + 1 , n + 1. There are a k ways of triangulating 1 , 2 , . . . , k + 1 , 1 and for each such there are a n − k ways of triangulating k + 1 , k + 2 , . . . , n + 1 , k + 1. Generating Functions

  28. � n � ∞ ∞ a n x n = x + � � � x n . x + a k a n − k n = 2 n = 2 k = 0 But, ∞ a n x n = a ( x ) � x + n = 2 since a 0 = 0 , a 1 = 1. � n � n � � ∞ ∞ � � x n � � x n a k a n − k = a k a n − k n = 2 k = 0 n = 0 k = 0 a ( x ) 2 . = Generating Functions

  29. So a ( x ) = x + a ( x ) 2 and hence √ √ a ( x ) = 1 + 1 − 4 x or 1 − 1 − 4 x . 2 2 But a ( 0 ) = 0 and so √ 1 − 1 − 4 x a ( x ) = 2 � � ∞ ( − 1 ) n − 1 1 2 − 1 � 2 n − 2 � � ( − 4 x ) n = 1 + n 2 2 n − 1 2 n − 1 n = 1 ∞ � 2 n − 2 � 1 � x n . = n n − 1 n = 1 So a n = 1 � 2 n − 2 � . n n − 1 Generating Functions

Recommend


More recommend