core30 min studyLesson 223 in Mathematics

Ordinary generating functions

Encode a sequence as a formal power series and translate additive size decompositions into coefficient identities.

On this page

What you’ll understand

  • Interpret coefficient extraction and Cauchy products combinatorially.
  • Solve a recurrence using a formal generating function.
  • Separate formal algebra from analytic convergence claims.

A generating function stores one count at each power of a bookkeeping symbol. Its value at a numerical input is initially irrelevant: the coefficient is the information we want. This viewpoint turns choices of component sizes into multiplication and recurrences into algebraic identities. It also clarifies a common source of confusion. Manipulating an infinite formal series is justified by finite coefficient calculations, while substituting a real or complex number requires a separate convergence argument.

Coefficients are the data

For a sequence a0,a1,…a_0,a_1,\ldots, its ordinary generating function is the formal expression A(x)=∑n≥0anxnA(x)=\sum_{n\ge0}a_nx^n. The notation [xn]A(x)[x^n]A(x) extracts one coefficient. Equality of formal series means equality of every coefficient, not equality of sums on an interval. Addition is coefficientwise, and multiplication uses a finite Cauchy sum at each degree. Consequently these operations make sense even when no nonzero numerical input gives a convergent series.

The geometric-series identity is formal because multiplying by one minus the symbol cancels every positive-degree coefficient, leaving one. More generally a series over a field has a multiplicative inverse exactly when its constant coefficient is nonzero. Composition needs more care: substituting a series with zero constant coefficient into another formal series ensures that each resulting coefficient receives only finitely many contributions. Without that condition, an infinite sum may appear even at degree zero and no longer be defined in the purely formal setting.

[xn](A(x)B(x))=∑k=0nakbn−k,11−x=∑n≥0xn[x^n](A(x)B(x))=\sum_{k=0}^{n}a_kb_{n-k},\qquad\frac{1}{1-x}=\sum_{n\ge0}x^n
These are coefficient identities in a formal power-series ring; no numerical value of x or radius of convergence is required.↔ Scroll wide equations horizontally.

Products describe recoverable size splits

Suppose an object is an ordered pair of components with additive sizes. Choosing a term from each generating function records the two sizes in the exponent of their product, and multiplying their coefficients counts the possible component choices. Summing terms of a fixed total degree gives the convolution already obtained by a direct structural decomposition. If the pair is unordered, this product generally counts each object multiple times and cannot be used without an additional symmetry argument.

A sequence of nonempty building blocks with generating function B(x)B(x) has generating function 1+B+B2+⋯=1/(1−B)1+B+B^2+\cdots=1/(1-B). Nonempty means B(0)=0B(0)=0, which is precisely the condition that makes the infinite formal sum coefficientwise finite. A class with a repeatable zero-size block violates this condition: arbitrarily many such blocks would contribute to the same size. The algebraic restriction therefore has a concrete counting meaning, rather than being an arbitrary technical qualification.

SEQ⁡(B)(x)=∑j≥0B(x)j=11−B(x)(B(0)=0)\operatorname{SEQ}(B)(x)=\sum_{j\ge0}B(x)^j=\frac{1}{1-B(x)}\qquad(B(0)=0)
The jth power counts ordered sequences of j blocks. The constant term one represents the empty sequence.↔ Scroll wide equations horizontally.

Recurrences become equations, with boundary terms

To convert a recurrence, multiply by the appropriate power and sum only over the indices where it is valid. Shift the sums carefully, retaining missing initial terms. These boundary contributions often form the numerator of the rational generating function. Dropping them produces a function with the right denominator but the wrong sequence. After solving algebraically, extract the first few coefficients to check the original initial conditions before seeking a general coefficient formula.

Analytic information can later be added to a formal identity. For example the geometric series converges numerically only inside the unit disk, even though its formal identity has no such restriction. Outside that disk the rational expression may still have a numerical value, but that value is not the sum of the divergent series. Likewise singularity-based asymptotic estimates require analytic hypotheses and cannot be inferred merely by treating the bookkeeping symbol as a convenient real number. Keep those two levels of argument distinct.

T(x)−1−x=x(T(x)−1)+x2T(x)⟹T(x)=11−x−x2T(x)-1-x=x(T(x)-1)+x^2T(x)\quad\Longrightarrow\quad T(x)=\frac{1}{1-x-x^2}
For t₀=t₁=1 and tₙ=tₙ₋₁+tₙ₋₂, summing from n=2 retains both initial terms and gives the correct tiling series.↔ Scroll wide equations horizontally.

Parts of size one or three, in order

Count ordered compositions of six in which every part is either one or three, using an ordinary generating function.

  1. One part has series B(x)=x+x³, so a sequence of parts has C(x)=1/(1−x−x³). The empty sequence contributes the coefficient at degree zero.

  2. The identity C=1+(x+x³)C gives cₙ=cₙ₋₁+cₙ₋₃, with c₀=1 and negative-index counts zero. Thus c₁=1, c₂=1, c₃=2, c₄=3, c₅=4, and c₆=6.

  3. Check directly by the number of threes. Zero threes gives one composition; one three and three ones can be ordered in four ways; two threes give one further composition.

[x6]11−x−x3=1+4+1=6[x^6]\frac{1}{1-x-x^3}=1+4+1=6
Coefficient extraction asks for total size six without numerically evaluating the infinite series.↔ Scroll wide equations horizontally.
The result

There are six compositions. Treating the parts as unordered would merge the four middle arrangements and give a different problem.

Explore the model

Interactive lab

Interactive lab · probability

Recovering coefficients from normalized bars

Pause and Reset, then set p=0.5 and n=6. Predict the coefficient of x² in (1+x)⁶. Multiply the exact mass of two successes by 64 and compare with your coefficient. The normalization turns coefficient counts into probabilities; no random sampling is performed.

Recovering coefficients from normalized barsThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forThe coefficient is fifteen and the bar mass is 15/64. This finite polynomial example illustrates coefficient extraction; it does not establish convergence of an infinite generating function.

Check your understanding

Why is 1/(1−B(x)) a well-defined formal series for a repeatable block class when B(0)=0?

Try it yourself

Find the coefficient of x⁵ in 1/((1−x)(1−x²)) and explain exactly what it counts.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Expand both geometric factors and solve the exponent equation with nonnegative integer indices.

Compare with the solution

A term has degree a+2b, where a and b are nonnegative. For degree five, b can be zero, one, or two, giving a=5,3,1. Hence the coefficient is three. It counts unordered collections of ones and twos totaling five, because a and b are their multiplicities; it does not count ordered compositions, which would require a sequence construction.

Take it with you

  • Formal series identities compare coefficients without substituting numbers.
  • Multiplication encodes ordered component products with additive sizes.
  • Boundary terms and zero-size blocks determine whether a formal construction is valid.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.