The Fundamental Theorem of Enumeration, independently discovered by several anonymous cave-dwellers, states that | A| = ∑1 a∈ A Doron Zeilberger 1 Contents 1. Introduction 2. Permutations 3. Generating Functions 4. Binomials 5. Inclusion-Exclusion 6. Möbius Inversion 7. Cauchy-Frobenius Theorem 8. Pólya-Redfield Theorem Bibliography 2 We are interested in counting objects But what is an answer? Example 1. How many even numbers are there less than n? The answer is in explicit and compact form: the integer part of n/2, i.e., [ n/2]. Example 2. How many permutations α of {1, 2, . . . , n} are there so that α(i ) 6= i for all i. The answer is explicit but involves a summation depending on n: n (−1)i . dn = n! ∑ i! i =0 Sometimes explicit answers cannot be found. 3 Problem settings Count the number of objects • without symmetry: How many prime numbers are there ≤ n? • with symmetry: How many cubes are there with green/blue faces? 4 Problem Consider red and blue beads. Beads of the same colour are indistinguishable. How many necklaces are there of n beads? The solution depends on what is considered to be a necklace. 5 Four beads in line 2n = 16 ways to put n beads in line. •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• 6 •••• •••• •••• •••• 10 open necklaces These can be turned over. This means that some of the previous designs give the same open necklace. •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• 7 •••• •••• •••• •••• 6 (closed) necklaces These can be rotated and turned over. •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• 8 •••• •••• •••• •••• 4 patterns of necklaces We allow change • and •. •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• •••• 9 •••• •••• •••• •••• Cayley 1875: Alkanes Cn H2n+2 How many isomers Cn H2n+2 are there? Hexane and isohexane: both C6 H14 but their structures are quite different. Counting problems can be difficult because of symmetries. Rains and Sloane (1999) → n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 count 1 1 1 2 3 5 9 18 35 75 159 355 802 1858 4347 C8 H18 ... and they have all names! Octane 3-Methylheptane 2,2-Dimethylhexane 2,4-Dimethylhexane 3,3-Dimethylhexane 3-Ethylhexane 2,2,4-Trimethylpentane 2,3,4-Trimethylpentane 3-Ethyl-3-methylpentane 2-Methylheptane 4-Methylheptane 2,3-Dimethylhexane 2,5-Dimethylhexane 3,4-Dimethylhexane 2,2,3-Trimethylpentane 2,3,3-Trimethylpentane 3-Ethyl-2-methylpentane 2,2,3,3-Tetramethylbutane 11 Notation • N = {0, 1, . . . }, Z, Q, R and C • We sometimes consider the field (R, +, ·) of real numbers, but what is needed is an arbitrary field (sometimes of characteristic 0). • [1, n] = {1, 2, . . . , n}. • The Kronecker symbol: • k | n: δnk = k divides n for k ∈ [1, n]. 12 ( 1 if n = k 0 if n 6= k • For a finite set X, let | X | denote its size. A set X is an n-set (n-subset of Y) if | X | = n (X ⊆ Y). • 2X denotes the power set of X. • n! = 1 · 2 · . . . · n is the factorial of a nonnegative integer n with 0! = 1. • For 0 ≤ k ≤ n from N, n n! = k k!(n − k )! is the binomial coefficient “n choose k”. 13 • S A is the set of all permutations of the set A. • In summations such as ∑ nz + k k≤ẑ ≤n the summation is over the elements z. 14 Introduction to combinatorial counting A typical technique is double counting, where the number of objects is counted in two different ways. Lemma (Handshaking). Let A = { A1, A2, . . . , An } be a family of subsets Ai of a finite set X. The degree of an element x ∈ X is defined by d( x ) = |{i | x ∈ Ai }|. Then n ∑ d ( x ) = ∑ | Ai | . x∈X i =1 15 Proof Let X = { x1, x2, . . . , xm }, and consider the matrix M = (mij )n×m , where ( 1 if xi ∈ A j , mij = 0 otherwise. Then d( xi ) equals the number of ones in the ith row, and | A j | equals the number one ones in the jth column. Hence the claim. 16 Example: X = [1, 4] A1 = {1, 3, 4}, A2 = {1, 2, 4}, A3 = {2, 3}. Then 1 1 0 0 1 1 M= 1 0 1 1 1 0 17 Changing summation order In this example, double counting happens in the change of summation order. Let f : N → N be a function of nonnegative integers, then n i n n ∑ ∑ f (i, k) = ∑ ∑ f (i, k) . i =1 k =1 k =1 i = k Indeed, on both sides, f (i, k ) is counted once for each pair (i, k ) with 1 ≤ k ≤ i ≤ n. One could write the summation as ∑ f (i, k ) 1≤k̂ ≤iˆ≤n 18 A geometric proof of n2 = ∑nk=1 2k − 1 19 Pigeon hole principle Two sets have the same size if and only if there is a bijection between them. Lemma (Pigeon Holes). Let f : X → Y be a function. If |Y | < | X |, then f is not injective. 20 Pigeon hole: Chinese remainder thm Let n, m ∈ N be relatively prime and 0 ≤ a < n and 0 ≤ b < m. Then there exists an integer x such that x ≡ a (mod n) and x ≡ b (mod m ). Proof. Holes are the residue classes modulo m. Pigeons are a + in for i = 0, 1, . . . , m − 1. Suppose a + in ≡ a + jn (mod m ) for some i < j. Then m | a + jn − a − in = ( j − i )n, and so m | j − i. But j − i < m; a contradiction. Hence a, a + n, . . . , a + (m − 1)n are distinct modulo m, and so b ≡ a + in (mod m ) for some i < m. Hence a + in = bm + x, and x is as required. 21