200 Combinatorics from the Floor

Counting is pairing: two finite collections have the same size when their elements can be matched one-to-one (Section 7). Every basic method of combinatorics is one of the primitives used to build or compare such matchings.

The primitives at work.

200.1 Counting by pairing

Size. \(|X|=|Y|\) when \(X\) and \(Y\) can be paired. Writing \([n]\) for a row of \(n\) marks, \(|X|=n\) means \(X\) pairs with \([n]\).

Pigeonhole. A finite row cannot be paired with a proper part of itself. Hence, if \(|X|>|Y|\), every map \(X\to Y\) sends two elements to the same place.

Bijective proof. To show two counts agree, exhibit a pairing between the collections they count.

200.2 Sum and product rules

Sum rule. For disjoint \(X,Y\), \(|X\sqcup Y|=|X|+|Y|\): the pairing for \(X\sqcup Y\) joins those for \(X\) and for \(Y\).

Product rule. \(|X\times Y|=|X|\cdot |Y|\): replacing each element of \(Y\) by a copy of \(X\) is substitution, which is multiplication.

Consequences.

Count Value
maps \([k]\to [n]\) \(n^k\)
injective maps \([k]\to [n]\) \(n(n-1)\cdots (n-k+1)\)
permutations of \([n]\) \(n!\)
subsets of \([n]\) \(2^n\)
\(k\)-subsets of \([n]\) \(\binom nk=\dfrac {n!}{k!\,(n-k)!}\)

The last entry divides the injective maps by the \(k!\) orders of the same set.

Pascal and the binomial theorem. A \(k\)-subset of \([n]\) either omits \(n\) or contains it:

\begin{equation} \binom nk=\binom {n-1}{k}+\binom {n-1}{k-1}. \tag{11628}\end{equation}
Expanding \((x+y)^n\) means choosing \(x\) or \(y\) from each of \(n\) factors. A term \(x^ky^{n-k}\) arises once for each \(k\)-subset of factors chosen for \(x\):
\begin{equation} (x+y)^n=\sum _{k=0}^n\binom nkx^ky^{n-k}. \tag{11629}\end{equation}

200.3 Double counting

Method. Count a set of pairs \(R\subseteq X\times Y\) through each projection:

\begin{equation} \sum _{x\in X}|R_x|=|R|=\sum _{y\in Y}|R^y|. \tag{11630}\end{equation}

Example. For a graph, counting (vertex, incident edge) pairs gives

\begin{equation} \sum _v\deg v=2|E| , \tag{11631}\end{equation}
so the number of vertices of odd degree is even.

200.4 Inclusion–exclusion from idempotents

Indicators. For \(A\subseteq X\), the indicator \(1_A\) is idempotent, and \(1-1_A\) is the indicator of the complement.

The formula. The points lying in none of \(A_1,\ldots ,A_n\) have indicator

\begin{equation} \prod _{i=1}^n(1-1_{A_i})=\sum _{S\subseteq [n]}(-1)^{|S|}\,1_{A_S}, \qquad A_S=\bigcap _{i\in S}A_i , \tag{11632}\end{equation}
by expanding the product of complementary idempotents. Summing over \(X\),
\begin{equation} \Bigl |X\setminus \bigcup _iA_i\Bigr |=\sum _{S\subseteq [n]}(-1)^{|S|}\,|A_S| . \tag{11633}\end{equation}

Derangements. Permutations of \([n]\) with no fixed point: with \(A_i\) the permutations fixing \(i\), \(|A_S|=(n-|S|)!\), so

\begin{equation} D_n=\sum _{k=0}^n(-1)^k\binom nk(n-k)!=n!\sum _{k=0}^n\frac {(-1)^k}{k!}, \qquad \frac {D_n}{n!}\to \frac 1e . \tag{11634}\end{equation}

200.5 Partitions of a set as partitions of the identity

Correspondence. A partition of \([n]\) into blocks \(B_1,\ldots ,B_k\) is a family of orthogonal idempotents summing to \(1\):

\begin{equation} 1_{B_i}^2=1_{B_i}, \qquad 1_{B_i}1_{B_j}=0, \qquad \sum _i1_{B_i}=1 . \tag{11635}\end{equation}

Stirling numbers of the second kind. \(S(n,k)\), the number of partitions into \(k\) blocks, satisfies

\begin{equation} S(n,k)=k\,S(n-1,k)+S(n-1,k-1): \tag{11636}\end{equation}
the element \(n\) joins one of \(k\) existing blocks or forms its own. The Bell numbers \(B_n=\sum _kS(n,k)\) count all partitions: \(1,1,2,5,15,52,\ldots \)

Surjections. The number of surjections \([n]\to [k]\) is \(k!\,S(n,k)\), and by inclusion–exclusion

\begin{equation} k!\,S(n,k)=\sum _{i=0}^k(-1)^i\binom ki(k-i)^n . \tag{11637}\end{equation}

200.6 Sign-reversing involutions

Principle. Let \(X\) be finite with signs \(\varepsilon :X\to \{\pm 1\}\) and an involution \(\iota \) (\(\iota ^2=\mathrm {id}\)) that reverses the sign of every non-fixed point. Non-fixed points cancel in pairs, so

\begin{equation} \sum _{x\in X}\varepsilon (x)=\sum _{x\in \mathrm {Fix}(\iota )}\varepsilon (x). \tag{11638}\end{equation}

Alternating binomial sum. On subsets of \([n]\), \(n\ge 1\), with sign \((-1)^{|S|}\), toggling the element \(1\) is a sign-reversing involution with no fixed points:

\begin{equation} \sum _k(-1)^k\binom nk=0 . \tag{11639}\end{equation}

Reflection principle and Catalan numbers. Paths of \(n\) up-steps and \(n\) down-steps from height \(0\) number \(\binom {2n}n\). A path that dips below \(0\) is reflected after its first visit to \(-1\); this is a pairing between bad paths and all paths ending at \(-2\), which number \(\binom {2n}{n+1}\). The paths that stay at or above \(0\) number

\begin{equation} C_n=\binom {2n}{n}-\binom {2n}{n+1}=\frac {1}{n+1}\binom {2n}{n}: \qquad 1,1,2,5,14,42,\ldots \tag{11640}\end{equation}
Decomposing a path at its first return to \(0\) gives \(C(x)=1+xC(x)^2\), so
\begin{equation} C(x)=\frac {1-\sqrt {1-4x}}{2x}. \tag{11641}\end{equation}

Euler’s pentagonal theorem.

\begin{equation} \prod _{k\ge 1}(1-x^k)=\sum _{m\in \mathbb Z}(-1)^mx^{m(3m-1)/2} . \tag{11642}\end{equation}
The left side is a signed sum over partitions into distinct parts, with sign \((-1)^{\text {number of parts}}\). Franklin’s involution moves the smallest part onto the top diagonal of the diagram, or the reverse; it reverses the sign and is undefined exactly on the staircase shapes of size \(m(3m-1)/2\), which remain.

200.7 Order and closure: Möbius inversion

Incidence algebra. For a finite order \((P,\le )\), the incidence algebra consists of functions on intervals \(\{(x,y):x\le y\}\) with convolution

\begin{equation} (f*g)(x,y)=\sum _{x\le z\le y}f(x,z)\,g(z,y). \tag{11643}\end{equation}
The zeta function \(\zeta (x,y)=1\) is invertible, with inverse the Möbius function:
\begin{equation} \mu (x,x)=1, \qquad \sum _{x\le z\le y}\mu (x,z)=0\quad (x<y). \tag{11644}\end{equation}

Inversion.

\begin{equation} g(y)=\sum _{x\le y}f(x)\iff f(y)=\sum _{x\le y}\mu (x,y)\,g(x). \tag{11645}\end{equation}

Cases.

Order \(\mu \) Inversion becomes
subsets by inclusion \((-1)^{|T\setminus S|}\) inclusion–exclusion
divisibility on \(\mathbb N\) classical \(\mu (n)\) number-theoretic Möbius inversion
a chain \(\mu =1,-1\) on steps finite differences

On a chain, inversion is the telescoping identity of Subsection 349.1.

200.8 Orbits: the averaging idempotent

Burnside. For a finite group \(G\) acting on a finite set \(X\),

\begin{equation} \#\{\text {orbits}\}=\frac {1}{|G|}\sum _{g\in G}|\mathrm {Fix}(g)|. \tag{11646}\end{equation}
This is \(\dim \mathbb C[X]^G=\mathrm {tr}\,e_1\) for the permutation representation, since the trace of a permutation is its number of fixed points (Section 201).

Necklaces. Necklaces of \(n\) beads in \(k\) colours, up to rotation:

\begin{equation} \frac 1n\sum _{d\mid n}\varphi (d)\,k^{n/d} . \tag{11647}\end{equation}
For \(n=4\), \(k=2\): \(\tfrac 14(16+4+2\cdot 2)=6\), namely \(0000,0001,0011,0101,0111,1111\).

200.9 Generating functions

Method. A sequence is encoded as \(\sum a_nx^n\). Joining corresponds to adding series, and pairing structures side by side corresponds to multiplying them.

Fibonacci. Tilings of a strip of length \(n\) by pieces of length \(1\) and \(2\) satisfy \(f_n=f_{n-1}+f_{n-2}\), so

\begin{equation} \sum f_nx^n=\frac {1}{1-x-x^2}, \qquad f_n=\frac {\varphi ^{n+1}-\psi ^{n+1}}{\sqrt 5}, \quad \varphi ,\psi =\frac {1\pm \sqrt 5}{2}. \tag{11648}\end{equation}

Integer partitions.

\begin{equation} \sum _np(n)x^n=\prod _{k\ge 1}\frac {1}{1-x^k}. \tag{11649}\end{equation}

Distinct parts and odd parts.

\begin{equation} \prod _k(1+x^k)=\prod _k\frac {1-x^{2k}}{1-x^k}=\prod _k\frac {1}{1-x^{2k-1}} , \tag{11650}\end{equation}
so partitions into distinct parts are equinumerous with partitions into odd parts (Euler).

200.10 Matchings and structure

Hall’s theorem. A bipartite graph on \(X\sqcup Y\) has a matching covering \(X\) if and only if

\begin{equation} |N(S)|\ge |S|\quad \text {for every }S\subseteq X . \tag{11651}\end{equation}
The condition is necessary by pigeonhole. Sufficiency is by induction on \(|X|\):

Ramsey. Every red–blue colouring of the edges of \(K_6\) contains a one-coloured triangle. A vertex has \(5\) edges, three of one colour, say red. Among their three far ends, a red edge closes a red triangle, and no red edge leaves a blue triangle. \(K_5\) coloured as a red pentagon with blue diagonals has none, so \(R(3,3)=6\).

200.11 Positivity: existence by expectation

Principle. If a random object has \(\mathbb E[N]<1\) for a nonnegative integer count \(N\), then some object has \(N=0\): a quantity whose average is below \(1\) is \(0\) somewhere.

Lower bound for Ramsey numbers. Colour the edges of \(K_n\) independently and uniformly. The expected number of one-coloured \(K_k\) is

\begin{equation} \binom nk2^{1-\binom k2}<1\quad \text {for }n=\lfloor 2^{k/2}\rfloor ,\ k\ge 3, \tag{11652}\end{equation}
so a colouring with none exists, and \(R(k,k)>2^{k/2}\), with no construction given.

200.12 Summary

Method Example Primitive
bijection equal counts pairing
pigeonhole two in one place no pairing into a proper part
sum and product rules \(n^k\), \(n!\), \(\binom nk\) joining, substituting
double counting \(\sum \deg =2|E|\) two projections
inclusion–exclusion \(D_n/n!\to 1/e\) product of \(1-1_{A_i}\)
set partitions \(S(n,k)\), Bell numbers partitions of \(1\)
sign-reversing involution Catalan, pentagonal theorem involution
Möbius inversion inclusion–exclusion, \(\mu (n)\), differences order, closure
Burnside necklaces averaging idempotent
generating functions Fibonacci, partitions joining as products
Hall, Ramsey matchings, monochromatic triangles pairing
probabilistic method \(R(k,k)>2^{k/2}\) positivity of expectation