Generatingfunctionology
Total Page:16
File Type:pdf, Size:1020Kb
generatingfunctionology HerbertS.Wilf Department of Mathematics University of Pennsylvania Philadelphia, Pennsylvania Copyright 1990 and 1994 by Academic Press, Inc. All rights re- served. This Internet Edition may be reproduced for any valid educational purpose of an institution of higher learning, in which case only the reason- able costs of reproduction may be charged. Reproduction for pro¯t or for any commercial purposes is strictly prohibited. vi Preface This book is about generating functions and some of their uses in discrete mathematics. The subject is so vast that I have not attempted to give a comprehensive discussion. Instead I have tried only to communicate some of the main ideas. Generating functions are a bridge between discrete mathematics, on the one hand, and continuous analysis (particularly complex variable the- ory) on the other. It is possible to study them solely as tools for solving discrete problems. As such there is much that is powerful and magical in the way generating functions give uni¯ed methods for handling such prob- lems. The reader who wished to omit the analytical parts of the subject would skip chapter 5 and portions of the earlier material. To omit those parts of the subject, however, is like listening to a stereo broadcast of, say, Beethoven's Ninth Symphony, using only the left audio channel. The full beauty of the subject of generating functions emerges only from tuning in on both channels: the discrete and the continuous. See how they make the solution of di®erence equations into child's play. Then seehowthetheoryoffunctionsofacomplexvariablegives,virtuallyby inspection, the approximate size of the solution. The interplay between the two channels is vitally important for the appreciation of the music. In recent years there has been a vigorous trend in the direction of ¯nding bijective proofs of combinatorial theorems. That is, if we want to prove that two sets have the same cardinality then we should be able to do it by exhibiting an explicit bijection between the sets. In many cases the fact that the two sets have the same cardinality was discovered in the ¯rst place by generating function arguments. Also, even though bijective arguments may be known, the generating function proofs may be shorter or more elegant. The bijective proofs give one a certain satisfying feeling that one `re- ally' understands why the theorem is true. The generating function argu- ments often give satisfying feelings of naturalness, and `oh, I could have thought of that,' as well as usually o®ering the best route to ¯nding exact or approximate formulas for the numbers in question. This book was tested in a senior course in discrete mathematics at the University of Pennsylvania. My thanks go to the students in that course for helping me at least partially to debug the manuscript, and to a number of my colleagues who have made many helpful suggestions. Any reader who is kind enough to send me a correction will receive a then-current complete errata sheet and many thanks. Herbert S. Wilf Philadelphia, PA September 1, 1989 vii Preface to the Second Edition This edition contains several new areas of application, in chapter 4, many new problems and solutions, a number of improvements in the pre- sentation, and corrections. It also contains an Appendix that describes some of the features of computer algebra programs that are of particular importance in the study of generating functions. Iamindebtedtomanypeopleforhelpingtomakethisabetterbook. Bruce Sagan, in particular, made many helpful suggestions as a result of a test run in his classroom. Many readers took up my o®er (which is now repeated) to supply a current errata sheet and my thanks in return for any errors discovered. Herbert S. Wilf Philadelphia, PA May 21, 1992 viii CONTENTS Chapter 1: Introductory Ideas and Examples 1.1Aneasytwotermrecurrence.................3 1.2Aslightlyhardertwotermrecurrence.............5 1.3Athreetermrecurrence...................8 1.4Athreetermboundaryvalueproblem............ 10 1.5Twoindependentvariables................. 11 1.6Another2-variablecase.................. 16 Exercises......................... 24 Chapter 2: Series 2.1Formalpowerseries.................... 30 2.2 The calculus of formal ordinary power series generating functions 33 2.3 The calculus of formal exponential generating functions . 39 2.4Powerseries,analytictheory................ 46 2.5Someusefulpowerseries.................. 52 2.6Dirichletseries,formaltheory............... 56 Exercises......................... 65 Chapter 3: Cards, Decks, and Hands: The Exponential Formula 3.1Introduction....................... 73 3.2De¯nitionsandaquestion................. 74 3.3Examplesofexponentialfamilies.............. 76 3.4Themaincountingtheorems................ 78 3.5Permutationsandtheircycles............... 81 3.6Setpartitions....................... 83 3.7Asubclassofpermutations................. 84 3.8Involutions,etc...................... 84 3.92-regulargraphs..................... 85 3.10Countingconnectedgraphs................. 86 3.11Countinglabeledbipartitegraphs.............. 87 3.12Countinglabeledtrees................... 89 3.13 Exponential families and polynomials of `binomial type.' . 91 3.14Unlabeledcardsandhands................. 92 3.15Themoneychangingproblem............... 96 3.16Partitionsofintegers...................100 3.17Rootedtreesandforests..................102 3.18Historicalnotes......................103 Exercises.........................104 vii Chapter 4: Applications of generating functions 4.1 Generating functions ¯nd averages, etc. 108 4.2 A generatingfunctionological view of the sieve method . 110 4.3 The `Snake Oil' method for easier combinatorial identities . 118 4.4WZpairsproveharderidentities..............130 4.5 Generating functions and unimodality, convexity, etc. 136 4.6Generatingfunctionsprovecongruences...........140 4.7Thecycleindexofthesymmetricgroup...........141 4.8Howmanypermutationshavesquareroots?.........146 4.9Countingpolyominoes...................150 4.10Exactcoveringsequences..................154 Exercises.........................157 Chapter 5: Analytic and asymptotic methods 5.1TheLagrangeInversionFormula..............167 5.2 Analyticity and asymptotics (I): Poles . 171 5.3 Analyticity and asymptotics (II): Algebraic singularities . 177 5.4 Analyticity and asymptotics (III): Hayman's method . 181 Exercises.........................188 Appendix: Using MapleTM and MathematicaTM ........192 Solutions ........................197 References .......................224 viii Chapter 1 Introductory ideas and examples A generating function is a clothesline on which we hang up a sequence of numbers for display. What that means is this: suppose we have a problem whose answer is a sequence of numbers, a0;a1;a2;:::. Wewantto`know'whatthesequence is. What kind of an answer might we expect? A simple formula for an would be the best that could be hoped for. If 2 we ¯nd that an = n + 3 for each n =0; 1; 2;:::, then there's no doubt that we have `answered' the question. Butwhatifthereisn'tanysimpleformulaforthemembersofthe unknown sequence? After all, some sequences are complicated. To take just one hair-raising example, suppose the unknown sequence is 2, 3, 5, 7, 11, 13, 17, 19, :::,wherean is the nth prime number. Well then, it would be just plain unreasonable to expect any kind of a simple formula. Generating functions add another string to your bow. Although giv- ing a simple formula for the members of the sequence may be out of the question, we might be able to give a simple formula for the sum of a power series, whose coe±cients are the sequence that we're looking for. For instance, suppose we want the Fibonacci numbers F0;F1;F2;:::, and what we know about them is that they satisfy the recurrence relation Fn+1 = Fn + Fn¡1 (n ¸ 1; F0 =0;F1 =1): The sequence begins with 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ::: There are exact, not-very-complicated formulas for Fn, as we will see later, in example 2 of this chapter. But, just to get across the idea of a generating function, here is how a generatingfunctionologist might answer the question: the n nth Fibonacci number, Fn, is the coe±cient of x in the expansion of the function x=(1 ¡ x ¡ x2) as a power series about the origin. You may concede that this is a kind of answer, but it leaves a certain unsatis¯ed feeling. It isn't really an answer, you might say, because we don'thavethatexplicitformula.Isitagood answer? In this book we hope to convince you that answers like this one are often spectacularly good, in that they are themselves elegant, they allow you to do almost anything you'd like to do with your sequence, and gener- ating functions can be simple and easy to handle even in cases where exact formulas might be stupendously complicated. Here are some of the things that you'll often be able to do with gener- ating function answers: (a) Find an exact formula for the members of your sequence. Not always. Not always in a pleasant way, if your sequence is 1 2 1 Introductory ideas and examples complicated. But at least you'll have a good shot at ¯nding such a formula. (b) Find a recurrence formula. Most often generating functions arise from recurrence formulas. Sometimes, however, from the generating function you will ¯nd a new recurrence formula, not the one you started with, that gives new insights into the nature of your sequence. (c) Find averages and other statistical properties of your se- quence. Generating functions can give stunningly quick deriva- tions of various probabilistic aspects