Encode counting sequences with ordinary and exponential generating functions, extract coefficients, and distinguish formal counting from probability.
Combinatorial generating function
A combinatorial generating function stores a sequence of counts as the coefficients of a power series. Algebra on the series then counts objects built from simpler objects. For a quant, this can turn a constrained scenario or execution-sequence count into a coefficient calculation—before any probabilities or prices are assigned.
The ordinary generating function (OGF) of counts a0,a1,… is
A(z)=n≥0∑anzn,[zn]A(z)=an.
Here n measures size and [zn] means “take the coefficient of zn.” The symbol z is a bookkeeping variable. Initially, the series is formal: equality means equality of every coefficient; no numerical value of z or convergence assumption is needed. Convergence matters if we later evaluate an infinite series numerically. Hulpke’s university notes develop this coefficient-based arithmetic.
A sequence of one- and two-unit blocks
Consider a toy execution planner that permits blocks of one or two units. Count every ordered block-size sequence with total quantity n; there are no timing, price or liquidity constraints. Thus (1,1,2) and (2,1,1) are different sequences. This is a count of admissible plans, with no claim that plans are equally likely.
Let an be the count. The empty sequence gives a0=1, and a1=1. Every nonempty sequence ends in either a 1-unit block or a 2-unit block. Remove that final block and the remaining total is n−1 or n−2. These cases are disjoint and exhaustive, giving the recurrence relation
an=an−1+an−2,n≥2.
At total quantity four, the five sequences are
(1,1,1,1),(1,1,2),(1,2,1),(2,1,1),(2,2).
Five ordered sequences of total size four: 1111, 121 and 211 end in one; 112 and 22 end in two. Their counts are three plus two equals five. Counts for total sizes zero through four are one, one, two, three and five.
Original counting illustration: the final block separates the five sequences into groups of three and two. The coefficient records the count at each total quantity.
One block has generating function B(z)=z+z2. A sequence is either empty or a shorter sequence followed by one block, so
A(z)=1+A(z)(z+z2).
Solving as a formal power-series identity,
A(z)=1−z−z21=1+z+2z2+3z3+5z4+⋯.
The constant term 1 in the denominator makes the formal inverse well defined. Another way to read the answer is
A(z)=k≥0∑(z+z2)k.
The kth term counts sequences with exactly k blocks. At any fixed total quantity n, only k≤n can contribute. This is why the infinite sum is legitimate formally. The sequence construction requires positive-size blocks: permitting arbitrarily many zero-size blocks would create infinitely many sequences of the same total size. See Aspnes’s counting constructions for the sum, product and repetition rules.
Why multiplying counts works
Suppose U(z) counts choices for a first component and V(z) counts choices for a second. Then
[zn]U(z)V(z)=j=0∑nujvn−j.
This convolution sums over every split of total size n. Within a split, choose either component freely, so the counts multiply. The decomposition must identify each resulting object uniquely; otherwise the product counts construction histories rather than the intended objects.
For the blocks above, (z+z2)2=z2+2z3+z4: the coefficient 2 represents the distinct pairs (1,2) and (2,1). Multiplication here expresses combinatorial choices; it does not assert probabilistic independence.
Ordinary, exponential and probability generating functions
The coefficient convention changes what multiplication means.
Encoding
Series
Recover the quantity
Ordinary generating function
A(z)=∑anzn
an=[zn]A(z)
Exponential generating function
E(z)=∑anzn/n!
an=n![zn]E(z)
Probability generating function
GX(z)=∑P(X=n)zn
P(X=n)=[zn]GX(z)
An exponential generating function (EGF) is particularly useful for labelled objects. In a labelled product, distributing n distinct labels between two components of sizes j and n−j introduces the binomial coefficient(jn). EGF multiplication incorporates it:
n![zn]EU(z)EV(z)=j=0∑n(jn)ujvn−j.
For example, a set has one structure on any given label set, hence EGF ez. Assigning each label to either of two named sets gives ezez=e2z and count 2n. At n=3, the coefficient is 8/3!=4/3, but the count is 8. Forgetting the factorial changes the answer. These product conventions are explained in Aspnes’s variants section.
A probability generating function instead has nonnegative coefficients summing to one, so GX(1)=1. The counting series A above is not a PGF. To introduce probability, specify a sampling model. If we choose uniformly from the five total-four sequences and let K be the number of blocks, then
GK(t)=5t2+3t3+t4.
There is one two-block sequence, three three-block sequences and one four-block sequence. Here t tracks number of blocks, whereas z in A(z) tracks total units. Counting alone supplies neither that uniform sampling rule nor a discount factor for pricing. Norris’s probability notes, §13.1 give the PGF definition.
For the underlying choice between ordered selections, subsets and labelled partitions, Counting and Combinatorics develops the counting principles with worked examples. Its preview is public; full lesson access requires membership.
Change the permitted blocks
A planner now permits blocks of size 1 or 3. How many ordered sequences total six units? Why would counting only unordered block collections give a different answer?
Answer. The OGF is 1/(1−z−z3). There is one sequence of six 1s; four sequences with one 3 and three 1s, because the 3 can occupy any of four positions; and one sequence (3,3). Therefore [z6](1−z−z3)−1=1+4+1=6. Ignoring order leaves only three collections. That counts a different class of objects and discards the planner’s sequence information.