Examples of generating functions

The following examples of generating functions are in the spirit of George Pólya, who advocated learning mathematics by doing and re-capitulating as many examples and proofs as possible. The purpose of this article is to present common ways of creating generating functions.

Worked example A: basics

New generating functions can be created by extending simpler generating functions. For example, starting with

and replacing with , we obtain

Bivariate generating functions

One can define generating functions in several variables, for series with several indices. These are often called super generating functions, and for 2 variables are often called bivariate generating functions.

For instance, since is the generating function for binomial coefficients for a fixed n, one may ask for a bivariate generating function that generates the binomial coefficients for all k and n. To do this, consider as itself a series (in n), and find the generating function in y that has these as coefficients. Since the generating function for is just , the generating function for the binomial coefficients is:

and the coefficient on is the binomial coefficient.

Worked example B: Fibonacci numbers

Consider the problem of finding a closed formula for the Fibonacci numbers Fn defined by F0 = 0, F1 = 1, and Fn = Fn1 + Fn2 for n ≥ 2. We form the ordinary generating function

for this sequence. The generating function for the sequence (Fn1) is xf and that of (Fn2) is x2f. From the recurrence relation, we therefore see that the power series xf + x2f agrees with f except for the first two coefficients:

Taking these into account, we find that

(This is the crucial step; recurrence relations can almost always be translated into equations for the generating functions.) Solving this equation for f, we get

The denominator can be factored using the golden ratio φ1 = (1 + 5)/2 and φ2 = (1 5)/2, and the technique of partial fraction decomposition yields

These two formal power series are known explicitly because they are geometric series; comparing coefficients, we find the explicit formula

Worked example C: Number of ways to make change

The number of unordered ways an to make change for n cents using coins with values 1, 5, 10, and 25 is given by the generating function

For example there are two unordered ways to make change for 6 cents; one way is six 1-cent coins, the other way is one 1-cent coin and one 5-cent coin. See OEIS: A001299.

On the other hand, the number of ordered ways bn to make change for n cents using coins with values 1, 5, 10, and 25 is given by the generating function

For example there are three ordered ways to make change for 6 cents; one way is six 1-cent coins, a second way is one 1-cent coin and one 5-cent coin, and a third way is one 5-cent coin and one 1-cent coin. Compare to OEIS: A114044, which differs from this example by also including coins with values 50 and 100.

gollark: On a Discord server for another modern note-taking thing I'm on someone was talking about "n-grams" and "latent dirichlet allocation".
gollark: There are also, if NLP were not so bee, *many* useful approaches I could take to categorize things efficiently.
gollark: I'm likely to implement (eventually) fuzzy page name matching where it tells you stuff *like* what you spelt. Right now the search just looks for pages containing the same word (give or take endings, SQLite uses some "porter stemming" algorithm).
gollark: > "nice editor" sounds good. for instanceI mostly just mean that it will, for instance, keep your current indentation/list level if you add a newline. I can't think of much other useful stuff, markdown is simple enough.> it'd be cool to have a way to embed links to other notes a way that's as easy as adding a tenor gif to a discord messageYou can, it's just `[[link text:note name]]` or `[[note name]]` if they're both the same. "Nice editor" may include something which shows fuzzy matches > sematic taggingI thought about tagging but realized that "bidirectional links" were *basically* the same thing; if you put `[[bees]]` into a document, then the `Bees` page has a link back to it.
gollark: Δy/Δx, if you prefer.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.