{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

l16_generating - 6.042/18.062J Mathematics for Computer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
6.042/18.062J Mathematics for Computer Science April 7, 2005 Srini Devadas and Eric Lehman Lecture Notes Generating Functions Generating functions are one of the most surprising, useful, and clever inventions in discrete math. Roughly speaking, generating functions transform problems about se- quences into problems about functions . This is great because we’ve got piles of mathe- matical machinery for manipulating functions. Thanks to generating functions, we can apply all that machinery to problems about sequences. In this way, we can use generating functions to solve all sorts of counting problems. There is a huge chunk of mathematics concerning generating functions, so we will only get a taste of the subject. In this lecture, we’ll put sequences in angle brackets to more clearly distinguish them from the many other mathemtical expressions floating around. 1 Generating Functions The ordinary generating function for the infinite sequence g 0 , g 1 , g 2 , g 3 . . . is the formal power series: 3 G ( x ) = g 0 + g 1 x + g 2 x 2 + g 3 x + · · · A generating function is a “formal” power series in the sense that we usually regard x as a placeholder rather than a number. Only in rare cases will we let x be a real number and actually evaluate a generating function, so we can largely forget about questions of convergence. Not all generating functions are ordinary, but those are the only kind we’ll consider here. Throughout the lecture, we’ll indicate the correspondence between a sequence and its generating function with a double-sided arrow as follows: 2 3 + g 3 x g 0 , g 1 , g 2 , g 3 , . . . ←→ g 0 + g 1 x + g 2 x + · · · For example, here are some sequences and their generating functions: 3 0 , 0 , 0 , 0 , . . . ←→ 0 + 0 x + 0 x 2 + 0 x = 0 + · · · 3 1 , 0 , 0 , 0 , . . . ←→ 1 + 0 x + 0 x 2 + 0 x = 1 + · · · 3 3 , 2 , 1 , 0 , . . . ←→ 3 + 2 x + 1 x 2 + 0 x = 3 + 2 x + x 2 + · · · The pattern here is simple: the i -th term in the sequence (indexing from 0) is the coefficient of x i in the generating function. Recall that the sum of an infinite geometric series is: 1 3 1 + z + z 2 + z = + · · · 1 z
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Generating Functions This equation does not hold when z 1 , but once again we won’t worry about conver- | | gence issues. This formula gives closed-form generating functions for a whole range of sequences. For example: 1 , 1 , 1 , 1 , . . . 1 + x + x 2 + x = 1 ←→ 3 + · · · 1 x 1 4 = 1 , 1 , 1 , 1 , . . . x 3 + x ←→ 1 x + x 2 − · · · 1 + x 1 3 3 1 , a, a 2 , a , . . . 1 + ax + a 2 x 2 + a x = 1 ax ←→ 3 + · · · 1 4 + x 6 1 , 0 , 1 , 0 , 1 , 0 , . . . 1 + x 2 + x = 1 x 2 ←→ + · · · 2 Operations on Generating Functions The magic of generating functions is that we can carry out all sorts of manipulations on sequences by performing mathematical operations on their associated generating func- tions. Let’s experiment with various operations and characterize their effects in terms of sequences.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}