2. Ordinary Generating Functions

2.1Review

普通生成函数是代数组合里最为基础的一种生成函数.

简略地来说, 组合学是一门大部分情况下以解决问题为目标的数学科目, 而生成函数则是代数组合里最为普遍应用的一种方法/思想.

其大致的使用框架是, 如果我们有一个组合对象 (比如说, 图, 树, 集合分拆, 整数分拆, 等等), 然后我们想要计数这一对象, 那么我们就考虑一个配重函数 , 然后我们考虑形式级数 . 举例来说, 比如我们可以考虑所有的整数分拆所组成的组合对象 , 然后考虑 , 其中对于 我们定义 . 那么, 如果我们能够通过代数或者组合的方法, 弄清楚 这个形式级数的系数, 比如说 , 那么则不难看出, 这个系数 对应了整数 的分拆的数量.

换句话说, 我们如果能够弄清楚 的系数, 那么我们就解决了整数分拆的数量这个组合问题.

接下来, 我们将把上述的方法拓展到多元的情况 (也就是下面的 remark). 然后, 我们会考虑各种各样的例子来学习如何使用生成函数解决组合问题.

Remark 2.1.1 (Framework). Let be a set of combinatorial objects (finite or countably infinite). Let with be one or more weight functions on .

Then the OGF (ordinary generating function) of (wrt ) is In this case, we say variable “marks” the weight function . The point is that we have

Remark 2.1.2 (OGF Technique).

1.

Figure out relevant set of objects and weight function(s).

2.

Find bijections involving set of objects.

3.

Convert bijections into OGF equations.

4.

Simplify/solve equations.

5.

Extract the answer to your problem.

We remark that, in order to make everything to work, we must have the weight and bijection works together in certain way. In other word, we must have the weight of a composite object should be the sum of the weight of its components, i.e. we need to find weight-preserving bijections.

We will now introduce a series of operations on sets and their OGF correspondence.

Remark 2.1.3. In the following, we will set be two sets with weight function and and their OGF are , respectively. Then we have

1.

(Disjoint Union) If is disjoint union, then we get a new weight function given by if and if . Then we have the generating function for is .

2.

(Products) Consider the product of sets. Set by and we have the corresponding OGF for is .

3.

(Star/Sequence) Consider the set . Then set and we have the generating function for is , if it is defined, i.e. we need .

4.

(Composition) Consider the set . The ideal of composition: imagine as the number of widgets, then start with object and we replace each widgets by an object in . We can define two different weights on this set, depends on whether we decide to count the weight of or not.

The first weight function is where is dewidgetized, and we have . In this case we have the OGF is .

The second weight function is where we still want to take account of the weight of , i.e. we want to make the widgets intact, and we have . In this case we have the OGF is

Example 2.1.4 (Ordered Rooted Trees). An ordered rooted tree(ORT)/ plane planted tree (PPT) is a rooted tree such that the childrens of any nodes are ordered (as 1st, 2nd,...). Note the order of children matters, and hence the following two trees are not equal:

The first question is, how many ORT with nodes? We will use OGF to solve it. Let be the collection of all ORTs, then we define the weight function to be the number of nodes, i.e. given we have equal the number of nodes of .

Next, we need to come up with some bijections. In this case, we see by sending to the tuple where are ORT that are childrens of and denote the root of . Thus, we see for generating function we getThus use LIFT we get This is the answer for .

Example 2.1.5 (Full Binary Trees). We say the updegree of a node equal the number of children of the node. We say a node is terminal if the node has updegree , i.e. it has no child. Then we define a full binary tree (FBT) to be a tree with each node has updegree or .

So, how many FBTs with terminals? Let be all FBTs and let the weight function to be to be the number of terminals. Then we see (on the second union we are not consider the root node because we are counting the number of terminals and if the root node has two children then it is not a terminal) Then we see .

Example 2.1.6. How many ORTs with nodes and terminals?

In this problem we have two parameters. Again let the set be the collection of ORTs. The two weight functions will be equal the number of nodes and the number of terminals.

Then we get where we note this time on the second set in the union, we have has weight . Thus we getNow use LIFT we get Thus immediately extract the coefficient of we get

2.2Partitions

Definition 2.2.1. A partition is a weakly decreasing sequence of positive integers. The size of is . The length of is . The width of is .

Example 2.2.2 (Counting Partitions by Size). Let be the set of all partitions, let weight function on be the size of , i.e. . Then we want to compute OGF . To this end, consider Then we seeand henceHowever, we note and hence

Example 2.2.3 (Counting Partitions by Size and Length). Let be the set of all partitions, let and . Then we getwith a similar bijection as before. Thus we see

Example 2.2.4 (“At most” vs “Exactly”). The number of partitions of size , length and width is equal to On the other hand, the number of partitions with size , length less than or equal , and width less than or equal is equal to

Example 2.2.5. Let . Then by consider the paths from to in .

Now we recall the -analogous of binomial coefficients where those are called -binomial coefficients. In particular we have a theorem says that To prove this, consider , which is by the above example. Thus it suffices to showand this can be done by induction on .

Theorem 2.2.6 (Euler’s Pentagonal Number Theorem). For , let . Then

Corollary 2.2.7. , where is the number of partitions of .

Proof. Note we see for and hence . Now expand the left hand side and extract coefficients we get the result.

Example 2.2.8. Compute the number of -strings of length such that is not a substring.

Let . We will define weight functions, given by equal the number of in . Then the OGF is given by Then notewhere we see with are exactly -strings without as a substring. Hence the answer of our question is .

To compute , we use composition of with . Elements are then constructed as follows: for each , replace each in by some string in . E.g. then we have four strings we can construct by replacing elements from , namely .

Then the result of such construction is equal to , i.e. all -strings, as we can do this construction backwards as well. Thus we get where we seeand hence

2.3Transfer Matrix Method

Example 2.3.1. Let be a directed graph, allow loops and parallel edges. Let any we let:

1.

.

2.

.

3.

.

4.

.

Then the TMM (transfer matrix method) theory is as follows: we assign a weight to each edge, say . Then we obtain a generating function . Since for each we have , we get a matrix with entries (or ), just like we can get adjacency matrix from .

For a walk , we let the weight function to be . Then we have the following propositions.

Proposition 2.3.2. Use the notation as above, we have

1.

where for a matrix we use to denote the entry at place.

2.

.

3.

equal the -component of , where is the solution to where is a vector.

Remark 2.3.3. The above proposition will work out nicely, provided is nilpotent matrix.

Proof. Statement is by induction on . Statement we note we have where if we assume nilpotent then it always converges. In particular note is geometric series and hence we are done. For we note and hence by basic linear algebra we are done.

Example 2.3.4 (TMM in Practice). We can use TMM in practice, when:

1.

Our objects are build up recursively.

2.

The options in recursive construction depends on cases.

3.

Vertices correspond to cases.

4.

Edges correspond to construction options.

5.

Walks correspond to objects(we have to be very careful to make sure this is a bijection). Also we make to make sure this bijection is weight-preserving.

Example 2.3.5. Let . For example, and . Then consider the weight function to be the length of the string. Compute .

We have three different cases:

1.

Case 1: the empty string.

2.

Case 2: string with length or , i.e. strings end with the same letter twice.

3.

Case 3: string , i.e. at least length and end with different letters.

Then we get the construction of is the following graphThen we get a bijection and . Hence we getand so