Jump to content

User:Yeetcode/sandbox

From Wikipedia, the free encyclopedia

Applications

[edit]

Various techniques: Evaluating sums and tackling other problems with generating functions

[edit]

Example 1: A formula for sums of harmonic numbers

[edit]

Generating functions give us several methods to manipulate sums and to establish identities between sums.

The simplest case occurs when sn = Σn
k = 0
ak
. We then know that S(z) = A(z)/1 − z for the corresponding ordinary generating functions.

For example, we can manipulate where Hk = 1 + 1/2 + ⋯ + 1/k are the harmonic numbers. Let be the ordinary generating function of the harmonic numbers. Then and thus

Using convolution with the numerator yields which can also be written as

Example 2: Modified binomial coefficient sums and the binomial transform

[edit]

As another example of using generating functions to relate sequences and manipulate sums, for an arbitrary sequence fn we define the two sequences of sums for all n ≥ 0, and seek to express the second sums in terms of the first. We suggest an approach by generating functions.

First, we use the binomial transform to write the generating function for the first sum as

Since the generating function for the sequence ⟨ (n + 1)(n + 2)(n + 3) fn is given by we may write the generating function for the second sum defined above in the form

In particular, we may write this modified sum generating function in the form of for a(z) = 6(1 − 3z)3, b(z) = 18(1 − 3z)3, c(z) = 9(1 − 3z)3, and d(z) = (1 − 3z)3, where (1 − 3z)3 = 1 − 9z + 27z2 − 27z3.

Finally, it follows that we may express the second sums through the first sums in the following form:

Example 3: Generating functions for mutually recursive sequences

[edit]

In this example, we reformulate a generating function example given in Section 7.3 of Concrete Mathematics (see also Section 7.1 of the same reference for pretty pictures of generating function series). In particular, suppose that we seek the total number of ways (denoted Un) to tile a 3-by-n rectangle with unmarked 2-by-1 domino pieces. Let the auxiliary sequence, Vn, be defined as the number of ways to cover a 3-by-n rectangle-minus-corner section of the full rectangle. We seek to use these definitions to give a closed form formula for Un without breaking down this definition further to handle the cases of vertical versus horizontal dominoes. Notice that the ordinary generating functions for our two sequences correspond to the series

If we consider the possible configurations that can be given starting from the left edge of the 3-by-n rectangle, we are able to express the following mutually dependent, or mutually recursive, recurrence relations for our two sequences when n ≥ 2 defined as above where U0 = 1, U1 = 0, V0 = 0, and V1 = 1:

Since we have that for all integers m ≥ 0, the index-shifted generating functions satisfy[note 1] we can use the initial conditions specified above and the previous two recurrence relations to see that we have the next two equations relating the generating functions for these sequences given by which then implies by solving the system of equations (and this is the particular trick to our method here) that

Thus by performing algebraic simplifications to the sequence resulting from the second partial fractions expansions of the generating function in the previous equation, we find that U2n + 1 ≡ 0 and that for all integers n ≥ 0. We also note that the same shifted generating function technique applied to the second-order recurrence for the Fibonacci numbers is the prototypical example of using generating functions to solve recurrence relations in one variable already covered, or at least hinted at, in the subsection on rational functions given above.

Convolution (Cauchy products)

[edit]

A discrete convolution of the terms in two formal power series turns a product of generating functions into a generating function enumerating a convolved sum of the original sequence terms (see Cauchy product).

  1. Consider A(z) and B(z) are ordinary generating functions.
  2. Consider A(z) and B(z) are exponential generating functions.
  3. Consider the triply convolved sequence resulting from the product of three ordinary generating functions
  4. Consider the m-fold convolution of a sequence with itself for some positive integer m ≥ 1 (see the example below for an application)

Multiplication of generating functions, or convolution of their underlying sequences, can correspond to a notion of independent events in certain counting and probability scenarios. For example, if we adopt the notational convention that the probability generating function, or pgf, of a random variable Z is denoted by GZ(z), then we can show that for any two random variables [1] if X and Y are independent. Similarly, the number of ways to pay n ≥ 0 cents in coin denominations of values in the set {1, 5, 10, 25, 50} (i.e., in pennies, nickels, dimes, quarters, and half dollars, respectively) is generated by the product and moreover, if we allow the n cents to be paid in coins of any positive integer denomination, we arrive at the generating for the number of such combinations of change being generated by the partition function generating function expanded by the infinite q-Pochhammer symbol product of

Example: The generating function for the Catalan numbers

[edit]

An example where convolutions of generating functions are useful allows us to solve for a specific closed-form function representing the ordinary generating function for the Catalan numbers, Cn. In particular, this sequence has the combinatorial interpretation as being the number of ways to insert parentheses into the product x0 · x1 ·⋯· xn so that the order of multiplication is completely specified. For example, C2 = 2 which corresponds to the two expressions x0 · (x1 · x2) and (x0 · x1) · x2. It follows that the sequence satisfies a recurrence relation given by and so has a corresponding convolved generating function, C(z), satisfying

Since C(0) = 1 ≠ ∞, we then arrive at a formula for this generating function given by

Note that the first equation implicitly defining C(z) above implies that which then leads to another "simple" (of form) continued fraction expansion of this generating function.

Example: Spanning trees of fans and convolutions of convolutions

[edit]

A fan of order n is defined to be a graph on the vertices {0, 1, ..., n} with 2n − 1 edges connected according to the following rules: Vertex 0 is connected by a single edge to each of the other n vertices, and vertex is connected by a single edge to the next vertex k + 1 for all 1 ≤ k < n.[2] There is one fan of order one, three fans of order two, eight fans of order three, and so on. A spanning tree is a subgraph of a graph which contains all of the original vertices and which contains enough edges to make this subgraph connected, but not so many edges that there is a cycle in the subgraph. We ask how many spanning trees fn of a fan of order n are possible for each n ≥ 1.

As an observation, we may approach the question by counting the number of ways to join adjacent sets of vertices. For example, when n = 4, we have that f4 = 4 + 3 · 1 + 2 · 2 + 1 · 3 + 2 · 1 · 1 + 1 · 2 · 1 + 1 · 1 · 2 + 1 · 1 · 1 · 1 = 21, which is a sum over the m-fold convolutions of the sequence gn = n = [zn] z/(1 − z)2 for m ≔ 1, 2, 3, 4. More generally, we may write a formula for this sequence as from which we see that the ordinary generating function for this sequence is given by the next sum of convolutions as from which we are able to extract an exact formula for the sequence by taking the partial fraction expansion of the last generating function.

Implicit generating functions and the Lagrange inversion formula

[edit]

Introducing a free parameter (snake oil method)

[edit]

Sometimes the sum sn is complicated, and it is not always easy to evaluate. The "Free Parameter" method is another method (called "snake oil" by H. Wilf) to evaluate these sums.

Both methods discussed so far have n as limit in the summation. When n does not appear explicitly in the summation, we may consider n as a "free" parameter and treat sn as a coefficient of F(z) = Σ sn zn, change the order of the summations on n and k, and try to compute the inner sum.

For example, if we want to compute we can treat n as a "free" parameter, and set

Interchanging summation ("snake oil") gives

Now the inner sum is zm + 2k/(1 − z)m + 2k + 1. Thus

Then we obtain

It is instructive to use the same method again for the sum, but this time take m as the free parameter instead of n. We thus set

Interchanging summation ("snake oil") gives

Now the inner sum is (1 + z)n + k. Thus

Thus we obtain for m ≥ 1 as before.

Generating functions prove congruences

[edit]

We say that two generating functions (power series) are congruent modulo m, written A(z) ≡ B(z) (mod m) if their coefficients are congruent modulo m for all n ≥ 0, i.e., anbn (mod m) for all relevant cases of the integers n (note that we need not assume that m is an integer here—it may very well be polynomial-valued in some indeterminate x, for example). If the "simpler" right-hand-side generating function, B(z), is a rational function of z, then the form of this sequence suggests that the sequence is eventually periodic modulo fixed particular cases of integer-valued m ≥ 2. For example, we can prove that the Euler numbers, satisfy the following congruence modulo 3:[3]

One of the most useful, if not downright powerful, methods of obtaining congruences for sequences enumerated by special generating functions modulo any integers (i.e., not only prime powers pk) is given in the section on continued fraction representations of (even non-convergent) ordinary generating functions by J-fractions above. We cite one particular result related to generating series expanded through a representation by continued fraction from Lando's Lectures on Generating Functions as follows:

Theorem: congruences for series generated by expansions of continued fractions — Suppose that the generating function A(z) is represented by an infinite continued fraction of the form and that Ap(z) denotes the pth convergent to this continued fraction expansion defined such that an = [zn] Ap(z) for all 0 ≤ n < 2p. Then:

  1. the function Ap(z) is rational for all p ≥ 2 where we assume that one of divisibility criteria of p | p1, p1p2, p1p2p3 is met, that is, p | p1p2pk for some k ≥ 1; and
  2. if the integer p divides the product p1p2pk, then we have A(z) ≡ Ak(z) (mod p).

Generating functions also have other uses in proving congruences for their coefficients. We cite the next two specific examples deriving special case congruences for the Stirling numbers of the first kind and for the partition function p(n) which show the versatility of generating functions in tackling problems involving integer sequences.

The Stirling numbers modulo small integers

[edit]

The main article on the Stirling numbers generated by the finite products

provides an overview of the congruences for these numbers derived strictly from properties of their generating function as in Section 4.6 of Wilf's stock reference Generatingfunctionology. We repeat the basic argument and notice that when reduces modulo 2, these finite product generating functions each satisfy

which implies that the parity of these Stirling numbers matches that of the binomial coefficient

and consequently shows that [n
k
]
is even whenever k < ⌊ n/2.

Similarly, we can reduce the right-hand-side products defining the Stirling number generating functions modulo 3 to obtain slightly more complicated expressions providing that

Congruences for the partition function

[edit]

In this example, we pull in some of the machinery of infinite products whose power series expansions generate the expansions of many special functions and enumerate partition functions. In particular, we recall that the partition function p(n) is generated by the reciprocal infinite q-Pochhammer symbol product (or z-Pochhammer product as the case may be) given by

This partition function satisfies many known congruence properties, which notably include the following results though there are still many open questions about the forms of related integer congruences for the function:[4]

We show how to use generating functions and manipulations of congruences for formal power series to give a highly elementary proof of the first of these congruences listed above.

First, we observe that in the binomial coefficient generating function all of the coefficients are divisible by 5 except for those which correspond to the powers 1, z5, z10, ... and moreover in those cases the remainder of the coefficient is 1 modulo 5. Thus, or equivalently It follows that

Using the infinite product expansions of it can be shown that the coefficient of z5m + 5 in z · ((1 − z)(1 − z2)⋯)4 is divisible by 5 for all m.[5] Finally, since we may equate the coefficients of z5m + 5 in the previous equations to prove our desired congruence result, namely that p(5m + 4) ≡ 0 (mod 5) for all m ≥ 0.


Cite error: There are <ref group=note> tags on this page, but the references will not show without a {{reflist|group=note}} template (see the help page).

  1. ^ Graham, Knuth & Patashnik 1994, §8.3
  2. ^ Graham, Knuth & Patashnik 1994, Example 6 in §7.3 for another method and the complete setup of this problem using generating functions. This more "convoluted" approach is given in Section 7.5 of the same reference.
  3. ^ Lando 2003, §5
  4. ^ Hardy et al. 2008, §19.12
  5. ^ Hardy, G.H.; Wright, E.M. An Introduction to the Theory of Numbers. p.288, Th.361