3 generating functions
play

3. Generating Functions http://aofa.cs.princeton.edu A N A L Y T I - PowerPoint PPT Presentation

A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions http://aofa.cs.princeton.edu A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions OGFs Solving recurrences Catalan


  1. A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions http://aofa.cs.princeton.edu

  2. A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions •OGFs •Solving recurrences •Catalan numbers OF •EGFs •Counting with GFs http://aofa.cs.princeton.edu 3a.GFs.OGFs

  3. Ordinary generating functions Definition. � � � � � � ( � ) = is the ordinary generating function (OGF) � ≥ � � � , � � , � � , . . . , � � , . . . of the sequence Notation. [ z N ] A ( z ) is “the coefficient of z N in A ( z )” sequence OGF � � � = � 1, 1, 1, 1, 1, ... � − � � ≥ � � � � ! = � � � [ z N ] e z = 1/ N ! 1, 1/2, 1/6, 1/24, ... � ≥ � Significance. Can represent an entire sequence with a single function. 3

  4. Operations on OGFs: Scaling � � � � � � , � � , � � , . . . , � � , . . . � ( � ) = � If is the OGF of � ≥ � � � , �� � , � � � � , � � � � , . . . � � � � � � � ( �� ) = � then is the OGF of � ≥ � sequence OGF � � � = � 1, 1, 1, 1, 1, ... � − � � ≥ � � � � � � � = � [ � � ] � − � � = � � 1, 2, 4, 8, 16, 32, ... � − � � � ≥ � 4

  5. Operations on OGFs: Addition � � � � � � , � � , � � , . . . , � � , . . . � ( � ) = � If is the OGF of � ≥ � � � � � � ( � ) = � � � , � � , � � , . . . , � � , . . . and is the OGF of � ≥ � � ( � ) + � ( � ) � � + � � , � � + � � , � � + � � , . . . , � � + � � . . . then is the OGF of Example: sequence OGF � � � = � 1, 1, 1, 1, 1, ... � − � � ≥ � � � � � � = � 1, 2, 4, 8, 16, 32, ... � − � � � ≥ � � � 0, 1, 3, 7, 15, 31, ... � − � � − � − � 5

  6. Operations on OGFs: Differentiation � � � � � � , � � , � � , . . . , � � , . . . � � ( � ) = If is the OGF of � ≥ � �� � � � � , � � , � � � , � � � , . . . , �� � , . . . � �� ′ ( � ) = then is the OGF of � ≥ � OGF sequence � � � � 1, 1, 1, 1, 1, ... � − � = � ≥ � � �� � � ( � − � ) � = 0, 1, 2, 3, 4, 5, ... � ≥ � � � � � � � � � ( � − � ) � = 0, 0, 1, 3, 6, 10, ... � � ≥ � � � � � � � � � ( � − � ) � + � = 0, ..., 1, M+1, (M+2)(M+1)/2, ... � � ≥ � � � � + � � � � � ( � − � ) � + � = 1, M+1, (M+2)(M+1)/2, ... � � ≥ � 6

  7. Operations on OGFs: Integration � � , � � , � � , . . . , � � , . . . � � � � � � ( � ) = If is the OGF of � ≥ � � � � , � � , � � � , � � � , . . . , � � − � � � − � � � � � ( � ) �� = then is the OGF of � � , . . . � � ≥ � Example: OGF sequence � � � � 1, 1, 1, 1, 1, ... � − � = � ≥ � � � � � ln � − � = 0, 1, 1/2, 1/3, 1/4, 1/5, ... � � ≥ � 7

  8. Operations on OGFs: Partial sum � � , � � , � � , . . . , � � , . . . � � � � � � ( � ) = If is the OGF of � ≥ � � � � , � � + � � , � � + � � + � � , . . . � − �� ( � ) then is the OGF of � Proof. � � � � � � � � � − �� ( � ) = � ≥ � � ≥ � � � � � + � � � = Distribute � ≥ � � ≥ � � � − � � � � � Change n to n − k = � ≥ � � ≥ � � � � � � � � − � � Switch order of summation. = � ≥ � � ≤ � ≤ � � � � � � � � � Change k to n − k = � ≥ � � ≤ � ≤ � 8

  9. Operations on OGFs: Partial sum � � , � � , � � , . . . , � � , . . . � � � � � � ( � ) = If is the OGF of � ≥ � � � � , � � + � � , � � + � � + � � , . . . � − �� ( � ) then is the OGF of � � − �� ( � ) = � � � � � � � � Example: � ≥ � � ≥ � OGF sequence � � � � + � = � � � ≥ � � ≥ � � � � � − � � � = � ≥ � � ≥ � = � � � � � − � � � � � ≥ � � ≤ � ≤ � � � = � � � � � � � ≥ � � ≤ � ≤ � � � � � 1, 1, 1, 1, 1, ... � − � = � ≥ � � � � � ln � − � = � 0, 1, 1/2, 1/3, 1/4, 1/5, ... � ≥ � � � � � � � � � − � ln � − � = 1, 1 + 1/2, 1 + 1/2 + 1/3, ... � ≥ � 9

  10. � � � � Operations on OGFs: Convolution � � � � � � , � � , � � , . . . , � � , . . . � � ( � ) = If is the OGF of � ≥ � � � � � � � ( � ) = and is the OGF of � � , � � , � � , . . . , � � , . . . � ≥ � � � � � � , � � � � + � � � � , . . . , � � � � − � , . . . � ( � ) � ( � ) then is the OGF of � ≤ � ≤ � Proof. � � � � � � � � � � ( � ) � ( � ) = � � ≥ � � ≥ � � � � � � � + � � � Distribute = � ≥ � � ≥ � � � � � − � � � � � Change n to n − k = � ≥ � � ≥ � � � � � � � − � Switch order of summation. = � ≥ � � ≤ � ≤ � 10

  11. Operations on OGFs: Convolution � � � � � � , � � , � � , . . . , � � , . . . � � ( � ) = If is the OGF of � ≥ � � � � � � � ( � ) = and is the OGF of � � , � � , � � , . . . , � � , . . . � ≥ � � � � � � , � � � � + � � � � , . . . , � � � � − � , . . . � ( � ) � ( � ) then is the OGF of � ≤ � ≤ � Example: OGF sequence � � � � 1, 1, 1, 1, 1, ... � − � = � ≥ � � ( � + � ) � � � ( � − � ) � = 1, 2, 3, 4, 5, ... � ≥ � 11

  12. Expanding a GF (summary) The process of expressing an unknown GF as a power series (finding the coefficients) is known as expanding the GF . Techniques we have been using: � ( � ) = � ( � ) + � ′ ( � ) � + � ′′ ( � ) � � + � ′′′ ( � ) � � + � ′′′′ ( � ) � � + . . . . 1. Taylor theorem: � ! � ! � ! Example. � � = � + � + � � � ! + � � � ! + � � � ! + . . . 2. Reduce to known GFs. � � Example. ln Integrate to get � � � � − � � − � [ � � ] � � = � � ( � − � ) ln � − � = � � ln � ≤ � ≤ � then convolve with � − � � − � 12

  13. In-class exercise � � � = ( � + � )( � � + � − � ) Exercise 3.4 Prove that � ≤ � ≤ � � � � 1. Find GF for LHS (convolve with ) � − � ln � − � � − � � � ( � − � ) � ln � − � � � 2. Expand GF to find RHS coefficients (convolve with ) ln ( � − � ) � � − � 3. Do some math � � � [ � � ] � � ( � + � − � ) = ( � + � ) � � − � ( � − � ) � ln � − � = � � ≤ � ≤ � = ( � + � )( � � + � − � + � ) − � = ( � + � )( � � + � − � ) 13

  14. A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions •OGFs •Solving recurrences •Catalan numbers OF •EGFs •Counting with GFs http://aofa.cs.princeton.edu 3a.GFs.OGFs

  15. A N A L Y T I C C O M B I N A T O R I C S P A R T O N E 3. Generating Functions •OGFs •Solving recurrences •Catalan numbers OF •EGFs •Counting with GFs http://aofa.cs.princeton.edu 3b.GFs.recurrences

  16. ⬅ ⬅ Solving recurrences with OGFs General procedure: • Make recurrence valid for all n . • Multiply both sides of the recurrence by z n and sum on n . • Evaluate the sums to derive an equation satisfied by the OGF . • Solve the equation to derive an explicit formula for the OGF . (Use the initial conditions!) • Expand the OGF to find coefficients. recurrence sequence 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend