How can I learn about generating functions?

The intent of this question is to provide a list of learning resources for people who are new to generating functions and would like to learn about them.

I'm personally interested in combinatorics, and I sometimes use generating functions in answers to combinatorial questions on stackexchange, but I know many readers are not familiar with these objects. I hope this list will help those readers and provoke interest in GFs generally.

I will provide an answer below, but feel free to edit my answer or provide your own answer. Initially it will be a short list, but maybe it will grow over time. Please regard this question and its answers as a community resource.

Acknowledgement: In asking this self-answered question I was prompted by helpful advice provided by this discussion on mathematics meta stackexchange, users quid and John Omielan in particular. Thank you.


Solution 1:

Here are some resources to get you started on generating functions. With one exception, which is clearly designated, any of the items mentioned here should be suitable to provide a gentle introduction to GFs for total newbies.

  • generatingfunctionology by Herbert S. Wilf is probably the best introductory text. You can find this book in pdf format for free, online, but I think it's worth adding a hard copy to your library. The writing style is breezy and entertaining. First sentence: "A generating function is a clothesline on which we hang up a sequence of numbers for display."

  • An Introduction to the Analysis of Algorithms by Robert Sedgewick and Philippe Flajolet is another fine introduction. Despite its title, the book is mostly about generating functions. Coursera has a free online course from Princeton University based on this book, with Professor Sedgewick as the instructor,so here is your chance to sit at the feet of the Master, figuratively: Coursera Analysis of Algorithms. There is also a follow-on course on Analytic Combinatorics: Coursera Analytic Combinatorics. The analytic combinatorics course is based on the book Analytic Combinatorics by the same two authors, which is a fine book, but I don't think it's the best starting point for most beginners. (Of course, you might be the exception, and it really is a wonderful book with encyclopedic coverage.) Both Coursera courses are selective in their coverage and do not attempt to cover the entire contents of their respective books, especially the course on analytic combinatorics.

  • While we are on the subject of free online materials, Bogart's Introductory Combinatorics (pdf) includes an introduction to generating functions. Bogart leads the reader to discover ideas and methods for himself through a series of problems. In fact, the book is almost entirely composed of problems.

  • Schaum's Outline of Theory and Problems of Combinatorics by V.K. Balakrishnan includes a good introduction to generating functions and is noteworthy for being inexpensive by comparison with other texts (around \$20 on Amazon the last time I checked). I find this book useful both for reference and as a learning resource. Coverage includes some relatively advanced topics, such as rook polynomials and the Polya Enumeration Theorem, but you can skip those parts on a first reading.

  • Do you find yourself overwhelmed by the amount of material on generating functions in the above books? Maybe you would like a short, down-to-earth introduction, just the basics. Then you might like Chapter Six of Applied Combinatorics by Alan Tucker.

  • And there are many others, I am sure. Many books on combinatorics include sections on generating functions.

As for prerequisites, many applications of GFs require only a knowledge of polynomials. But many others require infinite series, so you need some exposure to series like infinite geometric series, the series for $e^x$, and the Binomial Theorem for negative and fractional exponents. Interestingly enough, we can often (but not always) ignore questions of convergence, because we view the series as formal objects and don't worry about evaluating them. It is frequently useful to differentiate or integrate a generating function, so you need calculus skills. (In fact, part of the fascination of generating functions is that they take a problem in discrete mathematics, where the normal tools are addition, multiplication, subtraction and division, and transform the problem into the realm of the continuous, where tools like differential and integral calculus apply.) Some applications do use differential equations or complex analysis, but you can go a long way without these.

A computer algebra system, such as Wolfram Alpha, though not essential, is sometimes useful to take the drudgery out of calculations that would otherwise be tedious. I used to feel guilty when I used a computer to multiply two long polynomials, but I've gotten over the guilt and now feel that to the combinatorialist, computer algebra is a basic tool like a calculator.

To pique your interest in GFs, here is how the statistician Frederick Mosteller described his initial exposure to generating functions.

A key moment in my life occurred in one of those classes during my sophomore year. We had the question: When three dice are rolled what is the chance that the sum of the faces will be 10? The students in this course were very good, but we all got the answer largely by counting on our fingers. When we came to class, I said to the teacher, "That's all very well - we got the answer - but if we had been asked about six dice and the probability of getting 18, we would still be home counting. How do you do problems like that?" He said, "I don't know, but I know a man who probably does and I'll ask him." One day I was in the library and Professor Edwin G Olds of the Mathematics Department came in. He shouted at me, "I hear you're interested in the three dice problem." He had a huge voice, and you know how libraries are. I was embarrassed. "Well, come and see me," he said, and I'll show you about it." "Sure, " I said. But I was saying to myself, "I'll never go." Then he said, "What are you doing?" I showed him. "That's nothing important," he said. "Let's go now."

So we went to his office, and he showed me a generating function. It was the most marvelous thing I had ever seen in mathematics. It used mathematics that, up to that time, in my heart of hearts, I had thought was something that mathematicians just did to create homework problems for innocent students in high school and college. I don't know where I had got ideas like that about various parts of mathematics. Anyway, I was stunned when I saw how Olds used this mathematics that I hadn't believed in. He used it in such an unusually outrageous way. It was a total retranslation of the meaning of the numbers. [Albers, More Mathematical People].

** Edit added Feb. 13, 2021 **

Mathologer has a video on YouTube in which he develops the generating function for the number of ways to make change with US coins, and uses the GF to find a formula for the number of ways to make change for $k$ dollars. He then uses that formula to explain why we see a strange pattern in the number of ways to make change for various numbers of dollars. The video assumes no prior knowledge of generating functions, so it may be a good introduction to the subject. Explaining the bizarre pattern in making change for a googol dollars

Solution 2:

One of the treasures which might fit the needs is Concrete Mathematics by R.L. Graham, D.E. Knuth and O. Patashnik.

A starting point could be section 5.4 Generating Functions where we can read:

  • We come now to the most important idea in this whole book, the notion of a generating function. ...

The book provides a wealth of instructive examples devoting chapter 7 Generating Functions entirely to the subject of interest.

Solution 3:

Nicholas Loehr's Bijective Combinatorics, 1st edition includes the best treatment of formal power series I have ever seen in the combinatorics literature. (It has been watered down in the 2nd edition, which has recently appeared under the name Combinatorics.)

Herbert Wilf's generatingfunctionology goes farther than any other text I know into the usage of generating functions (but is sloppier at setting the stage).

A lot of other texts focus on uses of generating functions without formally defining them. For example: Aigner or Wagner or Hulpke or MacGillivray. For best effects, combine them with some text on abstract algebra.

Solution 4:

One book which is worth mentioning is Irresistible Integrals by George Boros and Victor Moll. It touches a bit on GFs, especially in relation to their use in the evaluation of series and integrals, as well as their connections to the study of polynomials and recurrence relations.

One of the first chapters uses the recursive definition of the Fibonacci numbers in order to find their generating function, namely $$\sum_{n\geq0}F_nx^n=\frac1{1-x-x^2}$$ But the use of GF's is consistent throughout the book. I highly recommend it if you also want to learn about series, integrals, and polynomials.