Definitions

# Symbolic combinatorics

Symbolic combinatorics in mathematics is a technique of analytic combinatorics that uses symbolic representations of combinatorial classes to derive their generating functions. The underlying mathematics, including the Pólya enumeration theorem, are explained on the page of the fundamental theorem of combinatorial enumeration.

## Procedure

Typically, one starts with the neutral class $mathcal\left\{E\right\}$, containing a single object of size 0 (the neutral object, often denoted by $epsilon$), and one or more atomic classes $mathcal\left\{Z\right\}$, each containing a single object of size 1. Next, set-theoretic relations involving various simple operations, such as disjoint unions, products, sets, sequences, and multisets define more complex classes in terms of the already defined classes. These relations may be recursive. The elegance of symbolic combinatorics lies in that the set theoretic, or symbolic, relations translate directly into algebraic relations involving the generating functions.

In this article, we will follow the convention of using script uppercase letters to denote combinatorial classes and the corresponding plain letters for the generating functions (so the class $mathcal\left\{A\right\}$ has generating function $A\left(z\right)$).

There are two types of generating functions commonly used in symbolic combinatorics—ordinary generating functions, used for combinatorial classes of unlabelled objects, and exponential generating functions, used for classes of labelled objects.

It is trivial to show that the generating functions (either ordinary or exponential) for $mathcal\left\{E\right\}$ and $mathcal\left\{Z\right\}$ are $E\left(z\right) = 1$ and $Z\left(z\right) = z$, respectively. The disjoint union is also simple — for disjoint sets $mathcal\left\{B\right\}$ and $mathcal\left\{C\right\}$, $mathcal\left\{A\right\} = mathcal\left\{B\right\} cup mathcal\left\{C\right\}$ implies $A\left(z\right) = B\left(z\right) + C\left(z\right)$. The relations corresponding to other operations depend on whether we are talking about labelled or unlabelled structures (and ordinary or exponential generating functions).

## Combinatorial sum

The restriction of unions to disjoint unions is an important one; however, in the formal specification of symbolic combinatorics, it is too much trouble to keep track of which sets are disjoint. Instead, we make use of a construction that guarantees there is no intersection (be careful, however; this affects the semantics of the operation as well). In defining the combinatorial sum of two sets $mathcal\left\{A\right\}$ and $mathcal\left\{B\right\}$, we mark members of each set with a distinct marker, for example $circ$ for members of $mathcal\left\{A\right\}$ and $bullet$ for members of $mathcal\left\{B\right\}$. The combinatorial sum is then:

$mathcal\left\{A\right\} + mathcal\left\{B\right\} = \left(mathcal\left\{A\right\} times \left\{circ\right\}\right) cup \left(mathcal\left\{B\right\} times \left\{bullet\right\}\right)$

This is the operation that formally corresponds to addition.

## Unlabelled structures

With unlabelled structures, an ordinary generating function (OGF) is used. The OGF of a sequence $A_\left\{n\right\}$ is defined as

$A\left(x\right)=sum_\left\{n=0\right\}^\left\{infty\right\}A_\left\{n\right\}x^\left\{n\right\}$

### Product

The product of two combinatorial classes $mathcal\left\{A\right\}$ and $mathcal\left\{B\right\}$ is specified by defining the size of an ordered pair as the sum of the sizes of the elements in the pair. Thus we have for $a in mathcal\left\{A\right\}$ and $b in mathcal\left\{B\right\}$, $|\left(a,b\right)| = |a| + |b|$. This should be a fairly intuitive definition. We now note that the number of elements in $mathcal\left\{A\right\} times mathcal\left\{B\right\}$ of size n is

$sum_\left\{k=0\right\}^\left\{n\right\}A_\left\{k\right\}B_\left\{n-k\right\}.$

Using the definition of the OGF and some elementary algebra, we can show that

$mathcal\left\{A\right\} = mathcal\left\{B\right\} times mathcal\left\{C\right\}$ implies $A\left(z\right) = B\left(z\right) cdot C\left(z\right).$

### Sequence

The sequence construction, denoted by $mathcal\left\{A\right\} = mathfrak\left\{G\right\}\left\{mathcal\left\{B\right\}\right\}$ is defined as

$mathfrak\left\{G\right\}\left\{mathcal\left\{B\right\}\right\} = mathcal\left\{E\right\} + mathcal\left\{B\right\} + \left(mathcal\left\{B\right\} times mathcal\left\{B\right\}\right) + \left(mathcal\left\{B\right\} times mathcal\left\{B\right\} times mathcal\left\{B\right\}\right) + cdots.$

In other words, a sequence is the neutral element, or an element of $mathcal\left\{B\right\}$, or an ordered pair, ordered triple, etc. This leads to the relation

$A\left(z\right) = 1 + B\left(z\right) + B\left(z\right)^\left\{2\right\} + B\left(z\right)^\left\{3\right\} + cdots = frac\left\{1\right\}\left\{1 - B\left(z\right)\right\}.$

### Set

The set (or powerset) construction, denoted by $mathcal\left\{A\right\} = mathfrak\left\{P\right\}\left\{mathcal\left\{B\right\}\right\}$ is defined as

$mathfrak\left\{P\right\}\left\{mathcal\left\{B\right\}\right\} = prod_\left\{beta in mathcal\left\{B\right\}\right\}\left(mathcal\left\{E\right\} + \left\{beta\right\}\right),$

begin\left\{align\right\}A\left(z\right) &\left\{\right\} = prod_\left\{beta in mathcal\left\{B\right\}\right\}\left(1 + z^
) >
&{} = prod_{n=1}^{infty}(1 + z^{n})^{B_{n}} &{} = exp left (ln prod_{n=1}^{infty}(1 + z^{n})^{B_{n}} right ) &{} = exp left (sum_{n = 1}^{infty} B_{n} ln(1 + z^{n}) right ) &{} = exp left (sum_{n = 1}^{infty} B_{n} cdot sum_{k = 1}^{infty} frac{(-1)^{k-1}z^{nk}}{k} right ) &{} = exp left (sum_{k = 1}^{infty} frac{(-1)^{k-1}}{k} cdot sum_{n = 1}^{infty}B_{n}z^{nk} right ) &{} = exp left (sum_{k = 1}^{infty} frac{(-1)^{k-1} B(z^{k})}{k} right), end{align}

where the expansion

$ln\left(1 + u\right) = sum_\left\{k = 1\right\}^\left\{infty\right\} frac\left\{\left(-1\right)^\left\{k-1\right\}u^\left\{k\right\}\right\}\left\{k\right\}$

was used to go from line 4 to line 5.

### Multiset

The multiset construction, denoted $mathcal\left\{A\right\} = mathfrak\left\{M\right\}\left\{mathcal\left\{B\right\}\right\}$ is a generalization of the set construction. In the set construction, each element can occur zero or one times. In a multiset, each element can appear an arbitrary number of times. Therefore,

$mathfrak\left\{M\right\}\left\{mathcal\left\{B\right\}\right\} = prod_\left\{beta in mathcal\left\{B\right\}\right\} mathfrak\left\{G\right\}\left\{beta\right\}.$

begin\left\{align\right\} A\left(z\right) &\left\{\right\} = prod_\left\{beta in mathcal\left\{B\right\}\right\} \left(1 - z^
)^{-1} >
&{} = prod_{n = 1}^{infty} (1 - z^{n})^{-B_{n}} &{} = exp left (ln prod_{n = 1}^{infty} (1 - z^{n})^{-B_{n}} right ) &{} = exp left (sum_{n=1}^{infty}-B_{n} ln (1 - z^{n}) right ) &{} = exp left (sum_{k=1}^{infty} frac{B(z^{k})}{k} right ), end{align}

where, similar to the above set construction, we expand $ln \left(1 - z^\left\{n\right\}\right)$, swap the sums, and substitute for the OGF of $mathcal\left\{B\right\}$.

### Other elementary constructions

Other important elementary constructions are:

• the cycle construction ($mathfrak\left\{C\right\}\left\{mathcal\left\{B\right\}\right\}$), like sequences except that cyclic rotations are not considered distinct
• pointing ($Thetamathcal\left\{B\right\}$), in which each member of $mathcal\left\{B\right\}$ is augmented by a neutral (zero size) pointer to one of its atoms
• substitution ($mathcal\left\{B\right\} circ mathcal\left\{C\right\}$), in which each atom in a member of $mathcal\left\{B\right\}$ is replaced by a member of $mathcal\left\{C\right\}$.

The derivations for these constructions are too complicated to show here. Here are the results:

Construction Generating function
$mathcal\left\{A\right\} = mathfrak\left\{C\right\}\left\{mathcal\left\{B\right\}\right\}$ $A\left(z\right) = sum_\left\{k=1\right\}^\left\{infty\right\} frac\left\{phi\left(k\right)\right\}\left\{k\right\} ln frac\left\{1\right\}\left\{1 - B\left(z^\left\{k\right\}\right)\right\}$ (where $phi\left(k\right),$ is the Euler totient function)
$mathcal\left\{A\right\} = Thetamathcal\left\{B\right\}$ $A\left(z\right) = zfrac\left\{d\right\}\left\{dz\right\}B\left(z\right)$
$mathcal\left\{A\right\} = mathcal\left\{B\right\} circ mathcal\left\{C\right\}$ $A\left(z\right) = B\left(C\left(z\right)\right),$

### Examples

Many combinatorial classes can be built using these elementary constructions. For example, the class of plane trees (that is, trees embedded in the plane, so that the order of the subtrees matters) is specified by the recursive relation

$mathcal\left\{G\right\} = mathcal\left\{Z\right\} times mathfrak\left\{G\right\}\left\{mathcal\left\{G\right\}\right\}.$

In other words, a tree is a root node of size 1 and a sequence of subtrees. This gives

$G\left(z\right) = frac\left\{z\right\}\left\{1 - G\left(z\right)\right\}$

or

$G\left(z\right) = frac\left\{1 - sqrt\left\{1 - 4z\right\}\right\}\left\{2\right\}.$

Another example (and a classic combinatorics problem) is integer partitions. First, define the class of positive integers $mathcal\left\{I\right\}$, where the size of each integer is its value:

$mathcal\left\{I\right\} = mathcal\left\{Z\right\} times mathfrak\left\{G\right\}\left\{mathcal\left\{Z\right\}\right\}$

The OGF of $mathcal\left\{I\right\}$ is then

$I\left(z\right) = frac\left\{z\right\}\left\{1 - z\right\}.$

Now, define the set of partitions $mathcal\left\{P\right\}$ as

$mathcal\left\{P\right\} = mathfrak\left\{M\right\}\left\{mathcal\left\{I\right\}\right\}.$

The OGF of $mathcal\left\{P\right\}$ is

$P\left(z\right) = exp left \left(I\left(z\right) + frac\left\{1\right\}\left\{2\right\} I\left(z^\left\{2\right\}\right) + frac\left\{1\right\}\left\{3\right\} I\left(z^\left\{3\right\}\right) + cdots right \right).$

Unfortunately, there is no closed form for $P\left(z\right)$; however, the OGF can be used to derive a recurrence relation, or, using more advanced methods of analytic combinatorics, calculate the asymptotic behavior of the counting sequence.

## Labelled structures

An object is weakly labelled if each of its atoms has a nonnegative integer label, and each of these labels is distinct. An object is (strongly or well) labelled, if furthermore, these labels comprise the consecutive integers $\left[1 ldots n\right]$. Note: some combinatorial classes are best specified as labelled structures or unlabelled structures, but some readily admit both specifications. A good example of labelled structures is the class of labelled graphs.

With labelled structures, an exponential generating function (EGF) is used. The EGF of a sequence $A_\left\{n\right\}$ is defined as

$A\left(x\right)=sum_\left\{n=0\right\}^\left\{infty\right\}A_\left\{n\right\}frac\left\{x^\left\{n\right\}\right\}\left\{n!\right\}.$

### Product

For labelled structures, we must use a different definition for product than for unlabelled structures. In fact, if we simply used the cartesian product, the resulting structures would not even be well labelled. Instead, we use the so-called labelled product, denoted $mathcal\left\{A\right\} star mathcal\left\{B\right\}$.

For a pair $beta in mathcal\left\{B\right\}$ and $gamma in mathcal\left\{C\right\}$, we wish to combine the two structures into a single structure. In order for the result to be well labelled, this requires some relabelling of the atoms in $beta$ and $gamma$. We will restrict our attention to relabellings that are consistent with the order of the original labels. Note that there are still multiple ways to do the relabelling; thus, each pair of members determines not a single member in the product, but a set of new members. The details of this construction are found on the page of the Labelled enumeration theorem.

To aid this development, let us define a function, $rho$, that takes as its argument a (possibly weakly) labelled object $alpha$ and relabels its atoms in an order-consistent way so that $rho\left(alpha\right)$ is well labelled. We then define the labelled product for two objects $alpha$ and $beta$ as

$alpha star beta = \left\{\left(alpha\text{'},beta\text{'}\right): \left(alpha\text{'},beta\text{'}\right) mbox\left\{ is well-labelled, \right\} rho\left(alpha\text{'}\right) = alpha, rho\left(beta\text{'}\right) = beta \right\}.$

Finally, the labelled product of two classes $mathcal\left\{A\right\}$ and $mathcal\left\{B\right\}$ is

$mathcal\left\{A\right\} star mathcal\left\{B\right\} = bigcup_\left\{alpha in mathcal\left\{A\right\}, beta in mathcal\left\{B\right\}\right\} \left(alpha star beta\right).$

The EGF can be derived by noting that for objects of size $k$ and $n-k$, there are $\left\{n choose k\right\}$ ways to do the relabelling. Therefore, the total number of objects of size $n$ is

$sum_\left\{k=0\right\}^\left\{n\right\}\left\{n choose k\right\}A_\left\{k\right\}B_\left\{n-k\right\}.$

This binomial convolution relation for the terms is equivalent to multiplying the EGFs,

$A\left(z\right) cdot B\left(z\right).,$

### Sequence

The sequence construction $mathcal\left\{A\right\} = mathfrak\left\{G\right\}\left\{mathcal\left\{B\right\}\right\}$ is defined similarly to the unlabelled case:
$mathfrak\left\{G\right\}\left\{mathcal\left\{B\right\}\right\} = mathcal\left\{E\right\} + mathcal\left\{B\right\} + \left(mathcal\left\{B\right\} star mathcal\left\{B\right\}\right) + \left(mathcal\left\{B\right\} star mathcal\left\{B\right\} star mathcal\left\{B\right\}\right) + cdots$
and again, as above,
$A\left(z\right) = frac\left\{1\right\}\left\{1 - B\left(z\right)\right\}$

### Set

In labelled structures, a set of $k$ elements corresponds to exactly $k!$ sequences. This is different from the unlabelled case, where some of the permutations may coincide. Thus for $mathcal\left\{A\right\} = mathfrak\left\{P\right\}\left\{mathcal\left\{B\right\}\right\}$, we have
$A\left(z\right) = sum_\left\{k = 0\right\}^\left\{infty\right\} frac\left\{B\left(z\right)^k\right\}\left\{k!\right\} = exp\left(B\left(z\right)\right)$

### Cycle

Cycles are also easier than in the unlabelled case. A cycle of length $k$ corresponds to $k$ distinct sequences. Thus for $mathcal\left\{A\right\} = mathfrak\left\{C\right\}\left\{mathcal\left\{B\right\}\right\}$, we have

$A\left(z\right) = sum_\left\{k = 0\right\}^\left\{infty\right\} frac\left\{B\left(z\right)^k\right\}\left\{k\right\} = lnleft\left(frac\left\{1\right\}\left\{1-B\left(z\right)\right\}right\right).$

### Other elementary constructions

The operators


mathfrak{C}_operatorname{even}, mathfrak{C}_operatorname{odd}, mathfrak{P}_operatorname{even}, mbox{ and } mathfrak{P}_operatorname{odd}

represent cycles of even and odd length, and sets of even and odd cardinality.

### Examples

Stirling numbers of the second kind may be derived and analyzed using the structural decomposition

$mathfrak\left\{P\right\}\left(mathfrak\left\{P\right\}_\left\{ge 1\right\}\left(mathcal\left\{Z\right\}\right)\right).$

The decomposition

$mathfrak\left\{P\right\}\left(mathfrak\left\{C\right\}\left(mathcal\left\{Z\right\}\right)\right)$

is used to study unsigned Stirling numbers of the first kind, and in the derivation of the statistics of random permutations. A detailed examination of the exponential generating functions associated to Stirling numbers may be found on the page on Stirling numbers and exponential generating functions.