Enumerative Combinatorics Notes
Enumerative Combinatorics Notes
notes
                                  Darij Grinberg
                         May 4, 2021 (unfinished!)
               Status: Chapters 1 and 2 finished; Chapter 3 outlined.
Contents
1. Introduction                                                                                     7
   1.1. Domino tilings . . . . . . . . . . . . . . . . . . . . . . . . . . .   .   .   .   .   .    8
        1.1.1. The problem . . . . . . . . . . . . . . . . . . . . . . . .     .   .   .   .   .    8
        1.1.2. The odd-by-odd case and the sum rule . . . . . . . .            .   .   .   .   .   12
        1.1.3. The symmetry and the bijection rule . . . . . . . . . .         .   .   .   .   .   14
        1.1.4. The m = 1 case . . . . . . . . . . . . . . . . . . . . . .      .   .   .   .   .   18
        1.1.5. The m = 2 case and Fibonacci numbers . . . . . . . .            .   .   .   .   .   19
        1.1.6. Kasteleyn’s formula (teaser) . . . . . . . . . . . . . . .      .   .   .   .   .   26
        1.1.7. Axisymmetric domino tilings . . . . . . . . . . . . . .         .   .   .   .   .   28
        1.1.8. Tiling rectangles with k-bricks . . . . . . . . . . . . .       .   .   .   .   .   31
   1.2. Sums of powers . . . . . . . . . . . . . . . . . . . . . . . . . .     .   .   .   .   .   38
        1.2.1. The sum 1 + 2 + ... + n . . . . . . . . . . . . . . . . . .     .   .   .   .   .   38
        1.2.2. What is a sum, actually? . . . . . . . . . . . . . . . . .      .   .   .   .   .   42
        1.2.3. Rules for sums . . . . . . . . . . . . . . . . . . . . . .      .   .   .   .   .   48
        1.2.4. While at that, what is a finite product? . . . . . . . .        .   .   .   .   .   53
        1.2.5. The sums 1k + 2k + ... + nk . . . . . . . . . . . . . . .       .   .   .   .   .   54
   1.3. Factorials and binomial coefficients . . . . . . . . . . . . . .       .   .   .   .   .   58
        1.3.1. Factorials . . . . . . . . . . . . . . . . . . . . . . . . .    .   .   .   .   .   58
        1.3.2. Definition of binomial coefficients . . . . . . . . . . .       .   .   .   .   .   59
        1.3.3. Fundamental properties of the binomial coefficients             .   .   .   .   .   61
        1.3.4. Binomial coefficients count subsets . . . . . . . . . .         .   .   .   .   .   69
        1.3.5. Integrality and some arithmetic properties . . . . . .          .   .   .   .   .   74
        1.3.6. The binomial formula . . . . . . . . . . . . . . . . . .        .   .   .   .   .   78
        1.3.7. Other properties of binomial coefficients . . . . . . .         .   .   .   .   .   86
   1.4. Counting subsets . . . . . . . . . . . . . . . . . . . . . . . . .     .   .   .   .   .   93
        1.4.1. All subsets . . . . . . . . . . . . . . . . . . . . . . . . .   .   .   .   .   .   93
                                             1
Enumerative Combinatorics: class notes                                                          page 2
4. Permutations                                                                         349
   4.1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
   4.2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
   4.3. Transpositions and cycles . . . . . . . . . . . . . . . . . . . . . . . . . 350
Enumerative Combinatorics: class notes                                                                                    page 4
Preface
This is the text accompanying my Math 222 (Enumerative Combinatorics) class at
Drexel University in Fall 2019. The website of this class can be found at
                   http://www.cip.ifi.lmu.de/~grinberg/t/19fco
and includes some extra materials (such as homeworks and solutions).
  This document is a work in progress. It might become a textbook one day,
but for now only parts of it (currently Chapters 1 and 2) are at the level of detail
expected from a textbook and can be read on a standalone basis. The later chapters
resemble a construction zone.
  Please report any errors you find to darijgrinberg@gmail.com .
What is this?
These notes cover the basics of enumerative combinatorics, with an emphasis on
counting, identities and bijections. We assume that you (the reader) are well famil-
Enumerative Combinatorics: class notes                                            page 6
iar with the basics of rigorous mathematics (such as proof methods, the construc-
tions of integers and rationals, and basic properties of finite sets), as covered (for
example) in [LeLeMe16, Chapters 1–5], [Day16], [Hammac15] and [Newste19, Part
I and Appendices A–B]. We will not rely on any analysis, linear algebra or abstract
algebra except for the little that we introduce ourselves.
   In terms of coverage, these notes do not set out to break any new ground.
   • The first chapter (Chapter 1) is introductory and begins (in Section 1.1) with
     a problem (that of counting domino tilings) that is not in itself particularly
     important, but serves to motivate many basic ideas and notions (such as bi-
     jective proofs, the sum rule and the product rule). We continue (in Section
     1.2) with another elementary problem (viz., finding closed-form expressions
     for sums of the form 1k + 2k + · · · + nk ), which we do not solve at this point (it
     serves as a teaser for the next chapter) but which prompts us to introduce the
     finite sum notation and get some passing acquaintance with certain combi-
     natorial numbers that will later become important. The next section (Section
     1.3) introduces factorials and binomial coefficients, and proves (mostly alge-
     braically) their most basic properties, such as the recursion, the combinatorial
     interpretation and the hockey-stick formula. In the sections that follow (Sec-
     tions 1.4, 1.5, 1.6 and 1.7), we start counting for real: Various problems are
     considered and solved, counting (certain kinds of) subsets, tuples, maps and
     permutations. In the process we gradually introduce general strategies (such
     as the difference rule, the isomorphism principle, or the interchange of sum-
     mations) as they become useful. Among other things, we also provide brief
     introductions to the use of modern electronic tools like the Online Encylope-
     dia of Integer Sequences and the SageMath CAS.
   • The second chapter (Chapter 2) focusses on binomial coefficients and related
     concepts and problems. The first sections revisit some statements made in
     the previous chapter, proving and re-proving them and demonstrating some
     further techniques in the process. Section 2.4 answers one of the most ba-
     sic counting problems, namely that of counting injective maps between two
     finite sets; the analogous problem for surjective maps has no closed-form an-
     swer, but two recurrences are derived. Section 2.5 then proves the formula for
     1k + 2k + · · · + nk that was left unproved in Section 1.2. The next section (Sec-
     tion 2.6) states, proves and applies the Vandermonde convolution theorem in
     several ways, while also explaining the “polynomial identity trick” on which
     all of the proofs rely and which is a versatile tool in the study of binomial
     coefficients (despite not being in itself a result of combinatorics). The    next
                                                                                      
                                                                                    n
     sections continue with a re-proof of the combinatorial interpretation of
                                                                                    k
     (Section 2.7), a first encounter with the method of generating functions (Sec-
     tion 2.8), and the Principle of Inclusion and Exclusion (Section 2.9). Then, in
     Section 2.10, we count several kinds and variants of compositions of an inte-
     ger. In Section 2.11, we introduce multisubsets of a set, count them and show
Enumerative Combinatorics: class notes                                                  page 7
   One particular goal of these notes is to develop at least the basics of the theory
rigorously – i.e., without handwaving, picture “proofs” and ambiguous terminol-
ogy like “ways to choose” or vaguely specified “arrangements”. This does not
mean that we shall avoid such semi-intuitive explanations whatsoever; but we aim
to ensure that they will never be used in a load-bearing capacity. Sometimes, a
statement will be first proved informally using such explanations, then re-proved
in a rigorous language.
  These notes have their origin in the handwritten class notes I made for the Math 5705
(Enumerative Combinatorics) class at the UMN in Fall 20181 . However, they differ notice-
ably (both in coverage and in the order of the topics).
Class of 2019-09-23
1. Introduction
This is a text on enumerative combinatorics: the part of mathematics concerned with
the sizes of finite sets, particularly their computation and the proof of equalities
between them. More precisely, here are what I consider to be the three main threads
of enumerative combinatorics:
     • Counting – i.e., finding formulas for the sizes of certain finite sets. For ex-
       ample, we count the permutations of the set {1, 2, . . . , n}, or the k-subsets of
       {1, 2, . . . , n} that contain no two consecutive elements. “Count” means find-
       ing a formula that expresses the number of such permutations or k-subsets in
       terms of n and k.
                                                                           n
             polynomial identities (such as the binomial formula ( x + y) =
     • Proving
         n  n k n−k
        ∑      x y  or various deeper ones).
       k =0 k
     • Finding and studying interesting maps between finite sets. A basic exam-
       ple of such a map is the “bit-set encoding”: the bijection from the set of all
       subsets of {1, 2, . . . , n} (for a fixed positive integer n) to the set of all n-tuples
       (i1 , i2 , . . . , in ) ∈ {0, 1}n (known as “length-n bitstrings”) which sends each
 1   http://www.cip.ifi.lmu.de/~grinberg/t/18f
Enumerative Combinatorics: class notes                                                         page 8
                                                                                           (
                                                                            1, if k ∈ S;
        subset S of {1, 2, . . . , n} to the n-tuple (i1 , i2 , . . . , in ), where ik = .
                                                                            0, if k ∈
                                                                                    /S
        We will care particularly about bijections, since they directly help in counting,
        but even non-bijective maps are fundamental to enumerative combinatorics.
  You will see more examples of each of these three threads all over this text,
starting with this introductory chapter.
  We will also occasionally see some connections to linear algebra, abstract algebra, num-
ber theory and graph theory. There are other threads in enumerative combinatorics that
we are not going to encounter (or only tangentially): applications (mostly), connections to
representation theory or geometry, asymptotics and many more. A one-semester course
needs to have its limits!
  First, I will discuss some interesting (if you share my taste) questions, in no
particular order. Not all of them will be answered right away.
                                                 ;                           .
                                                            |       {z   }
                                    | {z }               horizontal domino
                               vertical domino
  A domino tiling of Rn,m is a way to cover the rectangle Rn,m with non-overlapping
dominos.
 2 We   subdivide it with grid lines just to show its dimensions.
Enumerative Combinatorics: class notes                                                      page 9
  For example, here are three domino tilings of the rectangle R3,4 (which rectangle
you have seen in (1)):
, , .
(Now, of course, we are no longer drawing the grid lines, but only the outlines of
the dominos.)
  We can now state our first enumeration (i.e., counting) problem: How many
domino tilings does Rn,m have?
  As we just saw, R3,4 has at least 3 domino tilings, but in fact you can find several
more. Counting them all is, at the very least, an unpleasant exercise in carefulness.
Let us try a simpler example:
, , .
   If we are to solve the above problem in general, our first step should be making it
rigorous. We said that a domino tiling should be a way to cover the rectangle Rn,m
with non-overlapping dominos. What does “cover” mean, and what does “non-
overlapping” mean? Visually, it is pretty clear, but we do not have bulletproof
mathematical definitions yet. There are two ways to create such definitions:
 3 For example, you can say that two dominos are non-overlapping if their intersection is either the
   empty set or a point or a line segment. Then you can say that a set of dominos is non-overlapping
   if any two distinct dominos in it are non-overlapping.
Enumerative Combinatorics: class notes                                                  page 10
         grid” (i.e., why must their corners be grid points4 )? This is indeed true, but
         proving this would take serious work. Thus, even our previous observation
         that R3,2 has three domino tilings (shown visually in Example 1.1.1) would
         become a nontrivial theorem. Thus, we leave this geometric model of domino
         tilings aside, and instead define things in . . .
   • The combinatorial way: We redefine Rn,m as the set [n] × [m], where we set
     [k] = {1, 2, . . . , k} for each k ∈ N.
         Its elements thus are the pairs (i, j) with i ∈ [n] and j ∈ [m]; we call these
         pairs “squares”. Thus, Rn,m is a finite set of size5 | Rn,m | = nm.
         A vertical domino shall mean a set of the form {(i, j) , (i, j + 1)} for some i, j ∈
         Z.
         A horizontal domino shall mean a set of the form {(i, j) , (i + 1, j)} for some
         i, j ∈ Z.
         A domino shall mean a set that is either a vertical domino or a horizontal
         domino.
         If S is a set of squares (for example, Rn,m ), then a domino tiling of S shall
         mean a set {S1 , S2 , . . . , Sk } of disjoint dominos whose union is S (that is,
         S1 ∪ S2 ∪ · · · ∪ Sk = S).
         A few words are in order about what this has to do with our visual concept
         of domino tilings.
         First of all, why are we suddenly considering the finite set Rn,m to be a “rect-
         angle”? Because we are no longer thinking in terms of all points in the plane,
         but rather thinking in terms of grid squares (as in (1)). Thus, the rectangle
         Rn,m is no longer an (infinite) set of points, but now becomes a (finite) set of
         grid squares that lie in this rectangle. We label these grid squares by pairs
         of integers (namely, we label each grid square by the pair (i, j) of Cartesian
         coordinates of its northeastern corner6 ; thus, the southwesternmost square of
       Rn,m is labeled (1, 1), and the eastern neighbor of a square (i, j) is (i + 1, j),
       whereas the northern neighbor of a square (i, j) is (i, j + 1)). In other words,
       the square in column i (counted from the left) and row j (counted from the
       bottom) is labelled by the pair (i, j).
       Having thus redefined the rectangle Rn,m as a finite set of grid squares, we
       then do the same for dominos and domino tilings. A domino, too, is not an
       infinite set any more, but just a set of two adjacent grid squares. It is a vertical
       domino if these grid squares differ in their y-coordinate (i.e., have the forms
       (i, j) and (i, j + 1) for some i, j ∈ Z), and it is a horizontal domino if these grid
       squares differ in their x-coordinate (i.e., have the forms (i, j) and (i + 1, j) for
       some i, j ∈ Z). From this point of view, two dominos are non-overlapping
       if they are literally disjoint (because they are sets of grid squares now, and
       thus disjointness means that they have no grid squares in common; it does
       not matter if they share an edge).
       So we have obtained a new model for domino tilings, with simpler definitions
       and with all sets involved being finite. This kind of model is called a discrete
       model. It is much more manageable than the geometric one, and in partic-
       ular, almost everything that is visually obvious is actually straightforward to
       prove in this model (unlike in the geometric one). For example, it is easy
       to rigorously reproduce our result from Example 1.1.1 saying that R3,2 has 3
       domino tilings. In the discrete model, these domino tilings are7
                                                                                 
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                                                                                 
                       {(1, 1) , (1, 2)}, {(2, 1) , (2, 2)}, {(3, 1) , (3, 2)} ,
                     
                      |        {z       } |        {z       } |        {z       }
                                                                                  
                     
                        vertical domino     vertical domino     vertical domino  
                                                                                  
                           covering the        covering  the       covering  the
                     
                                                                                 
                                                                                  
                                                                                 
                        leftmost column      middle column     rightmost column
                                                                                 
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                                                                                 
                       {(1, 1) , (2, 1)}, {(1, 2) , (2, 2)}, {(3, 1) , (3, 2)} ,
                     
                      |        {z       } |        {z       } |        {z       }
                                                                                  
                     
                      horizontal  domino  horizontal  domino    vertical domino  
                                                                                  
                      in the bottom row      in the top row       covering the 
                     
                                                                                 
                                                                                  
                                                               rightmost column
                                                                                 
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                     
                                                                                 
                                                                                  
                       {(1, 1) , (1, 2)}, {(2, 1) , (3, 1)}, {(2, 2) , (3, 2)} .
                     
                      |        {z       } |        {z       } |        {z       }
                      vertical domino horizontal domino horizontal domino
                                                                                 
                                                                                  
                      covering the
                                          in the bottom row      in the top row 
                                                                                  
                             leftmost column
 7 listed   here in the same order in which they appeared in Example 1.1.1
Enumerative Combinatorics: class notes                                             page 12
         You do need a bit of work to verify that no other domino tilings of R3,2 exist;
         but it is very much doable. The surefire (but boring) way is to simply check
         all possibilities by brute force: There are only 7 dominos that lie inside8 R3,2 ,
         and clearly any domino tiling must consist of some of these 7 dominos; now,
         you can check all the 27 possible subsets. (Of course, you can be a lot less
         stupid.)
  From now on, we shall always be using the discrete model when we study
domino tilings – i.e., we define Rn,m , dominos and domino tilings via the com-
binatorial way.
  If n, m ∈ N, then let us define an integer dn,m by
Here and in the following, the symbol “#” always means “number” (or “the num-
ber”, depending on context).
   Our problem thus asks us to compute dn,m . In Example 1.1.1, we have seen that
d3,2 = 3. For any fixed n and m, we can technically compute dn,m by brute force
(i.e., trying out all possible subsets of the set of dominoes lying inside Rn,m , and
counting the domino tilings among them). But this becomes forbiddingly slow
when n and m get even a little bit large (say, n = 8 and m = 8). We are looking for
something better: for an explicit formula for dn,m if possible, and otherwise at least
for faster algorithms that compute dn,m .
Proof sketch. We have assumed that n and m are odd. Thus, the product nm is odd
as well. In other words, the size | Rn,m | is odd (since | Rn,m | = nm).
  But each domino has even size (in fact, it has size 2).
  If the set Rn,m had a domino tiling, then the size | Rn,m | of Rn,m would equal the
sum of the sizes of all the dominos in the tiling (because Rn,m is the union of the
dominos, and the dominos are disjoint). But the size | Rn,m | is odd, whereas the
sum of the sizes of all the dominos in the tiling is even (since each domino has
even size); thus the former cannot equal the latter. This shows that the set Rn,m has
no domino tilings. In other words, the # of domino tilings of Rn,m is 0. In other
words, dn,m = 0.
  It is worth being a little bit more detailed once and look under the hood of this
proof. We have used the following basic fact:
  Theorem 1.1.3 (The sum rule). If a finite set S is the union of k disjoint sets
  S1 , S2 , . . . , Sk , then
                              | S | = | S1 | + | S2 | + · · · + | S k | .
   Theorem 1.1.3 is known as the sum rule or the addition rule, and is so fundamental
for all of mathematics that you have probably not even noticed us tacitly using it in
the proof of Proposition 1.1.2 above. We shall not prove Theorem 1.1.3, since this
is a job for “axiomatic foundations of mathematics” courses and depends on the
“implementation details” of your mathematical “standard library” (such as: how
do you define the size of a finite set?).9
   We can restate Theorem 1.1.3 as follows: If S1 , S2 , . . . , Sk are k disjoint finite sets,
then the set S1 ∪ S2 ∪ · · · ∪ Sk is finite and satisfies
| S1 ∪ S2 ∪ · · · ∪ S k | = | S1 | + | S2 | + · · · + | S k | . (3)
  Theorem 1.1.4 (The product rule for two sets). Let X and Y be two finite sets.
  Then, X × Y is a finite set with size
| X × Y | = | X | · |Y | . (5)
 9 Forexample, if you define your sets and numbers in the old-fashioned Bourbakist way, then you
   can find Theorem 1.1.3 with proof in [Bourba68, Chapter III, §3.3, Corollary]. If you are using
   constructivist foundations, then Theorem 1.1.3 can be proven by induction on k (see [Loehr11,
   proof of 1.2] for the details of this induction proof), relying on the fact that any two disjoint finite
   sets A and B of | A ∪ B| = | A| + | B|. The latter fact (which is, of course, essentially equivalent to
   the particular case of Theorem 1.1.3 for k = 2) can be proven directly by explicitly constructing
   a bijection A ∪ B → [n + m] out of two bijections A → [n] and B → [m] (see [Loehr11, proof of
   1.32] for the details of this construction). But we will not dwell on fundamental issues like this
   here.
Enumerative Combinatorics: class notes                                                                  page 14
         | Rn,m | = |[n] × [m]| = |[n]| · |[m]|         (by (5), applied to X = [n] and Y = [m])
                                  |{z} | {z }
                                    =n    =m
                = nm.
   We have assumed that n and m are odd. Thus, the product nm is odd as well. In other
words, the size | Rn,m | is odd (since | Rn,m | = nm).
   Our next goal is to show that the set Rn,m has no domino tilings.
   Indeed, let T be a domino tiling of Rn,m . We will derive a contradiction.
   Write T in the form T = {S1 , S2 , . . . , Sk }, where S1 , S2 , . . . , Sk are distinct dominos11 .
Then, the sets S1 , S2 , . . . , Sk are dominos; thus, their sizes |S1 | , |S2 | , . . . , |Sk | are even (since
the size of each domino is even12 ). Hence, the sum |S1 | + |S2 | + · · · + |Sk | is even (being a
sum of even integers).
   But the finite set Rn,m is a union of the k disjoint sets S1 , S2 , . . . , Sk (since {S1 , S2 , . . . , Sk } =
T is a domino tiling of Rn,m ). Hence, Theorem 1.1.3 (applied to S = Rn,m ) yields | Rn,m | =
|S1 | + |S2 | + · · · + |Sk |. Hence, | Rn,m | is even (since |S1 | + |S2 | + · · · + |Sk | is even). This
contradicts the fact that | Rn,m | is odd.
   Now, forget that we fixed T. We thus have found a contradiction for each domino tiling
T of Rn,m . This shows that there exists no domino tiling of Rn,m . In other words, the # of
domino tilings of Rn,m is 0. In other words, dn,m = 0. This proves Proposition 1.1.2.
  In the future, we will be using the sum rule (Theorem 1.1.3) many times, usually
without even mentioning it.
Proof sketch. The idea is very simple: The rectangle Rm,n can be obtained by “flip-
ping” the rectangle Rn,m across the line with equation x = y (in Cartesian coordi-
nates). This “flip” operation turns domino tilings of Rm,n into domino tilings of
Rn,m and vice versa; here is an example:
                                                 flip
                                                −→                              .
Thus, the domino tilings of Rm,n are in 1-to-1 correspondence with the domino
tilings of Rn,m . This entails that the # of the former equals the # of the latter. Since
the # of the former is dm,n (by the definition of dm,n ), whereas the # of the latter is
dn,m (by the definition of dn,m ), we can rewrite this as follows: dm,n = dn,m . This
proves Proposition 1.1.5.
   It is worth expanding this proof just to see what exactly we have done; again,
the underlying principle is very basic but worth stating at least once. The domino
tilings of Rm,n are not literally the same as the domino tilings of Rn,m (unless n = m
or one of n and m is 0); yet, we have argued that the former are in 1-to-1 correspon-
dence with the latter, and therefore equinumerous to the latter. Formally, a 1-to-1
correspondence between two sets of objects is given by a map from one set to the
other, but it cannot be just any map: It has to be a bijection (i.e., a bijective map)13 .
Thus, what we have used is the fact that if there is a bijection between two sets,
then these two sets have the same size. Let us state this a little bit more explicitly:
13 We refer to places like [LeLeMe16, §4.4–4.5], [Hammac15, §12.2] or [Day16, §3.F] for basic prop-
   erties of bijections and bijectivity. Here come some brief reminders: A map f : X → Y between
   two sets X and Y is said to be
     It is easy to see that a map is bijective if and only if it is invertible (i.e., has an inverse).
     The word “bijection” is a shorthand for “bijective map”. Likewise, the word “injection” is
   a shorthand for “injective map”, whereas the word “surjection” is a shorthand for “surjective
   map”.
Enumerative Combinatorics: class notes                                                               page 16
  Theorem 1.1.6 (The bijection principle). If X and Y are two sets, and if f : X → Y
  is a bijection (i.e., a bijective map), then
| X | = |Y | . (6)
   We have not required X and Y to be finite in Theorem 1.1.6. The size of an infinite
set is a well-defined notion in mathematics (more commonly known as cardinality);
see, e.g., [LeLeMe16, §8.1] for an introduction to this or [Newste19, Chapter 9] for a
more in-depth treatment. We will only use Theorem 1.1.6 in the case when at least
one of the sets X and Y is known to be finite (in which case its size is a nonnegative
integer). In this case, Theorem 1.1.6 automatically yields that both sets X and Y
are finite, and have equal size.
   Theorem 1.1.6 is known as the bijection principle or the bijection rule, and is suffi-
ciently basic that some authors consider it part of the definition of the cardinality
of a set; we are not going to reference it explicitly every time we use it. But just this
one time, let us do so, and while at that, also formalize the definition of the “flip”
operation that was used in our proof of Proposition 1.1.5:
Proof of Proposition 1.1.5 (detailed version). Define the map
                                             F : Rn,m → Rm,n ,
                                                (i, j) 7→ ( j, i ) .
(This notation is saying “the map F from Rn,m to Rm,n that sends each element (i, j) of
Rn,m to the element ( j, i ) of Rm,n ”. To see why this map is well-defined, just recall that
Rn,m = [n] × [m] and Rm,n = [m] × [n], which is why (i, j) ∈ Rn,m will always lead to
( j, i ) ∈ Rm,n .)
    Visually speaking, this map F simply flips each square of the rectangle Rn,m across the
line with equation x = y. This yields a square of the rectangle Rm,n , of course. Thus, it is
clear that the map F is a bijection. This can be proved rigorously as follows: The map
                                             G : Rm,n → Rn,m ,
                                                 (i, j) 7→ ( j, i )
Note that its inverse map G was defined in the same way as F, but simply with the roles of
n and m interchanged.
   The map F is a bijection, but it is not the bijection that we are going to apply Theorem
1.1.6 to. (If we applied Theorem 1.1.6 to f = F, then we would conclude that | Rn,m | =
| Rm,n |, that is, nm = mn, which is reassuring but not what we are trying to prove.)
14 This   is proved in the same way as we showed that F is well-defined.                        
15 since   F ◦ G = id (because each (i, j) ∈ Rm,n satisfies ( F ◦ G ) (i, j) = F  G (i, j) = F ( j, i ) =
                                                                                          
                                                                                   | {z }
                                                                                      =( j,i )
   (i, j) = id (i, j)) and G ◦ F = id (for similar reasons)
Enumerative Combinatorics: class notes                                                          page 17
   The map F merely flips the squares of Rn,m across the x = y line; we want a map that
flips domino tilings. Of course, to flip a domino tiling, we have to flip each domino in it;
and to flip a domino, we have to flip each square in it. Thus, we define the following two
maps:
         (To spell this out: The map Fdom sends each domino D to the domino { F (d) | d ∈ D },
         which is obtained from D by flipping each square d ∈ D. In other words, it flips each
         domino by applying the flip map F to each square of the domino.)
         It is easy to see that this map Fdom is a bijection. (Indeed, it has an inverse Gdom ,
         which is defined in the same way but with the roles of n and m interchanged.)
         (To spell this out: The map Ftil sends each domino tiling T to the domino tiling
         { Fdom ( D ) | D ∈ T }, which is obtained from T by flipping each domino D ∈ T. In
         other words, it flips each domino tiling by applying the flip map Fdom to each domino
         of the tiling.)
         It is easy to see that this map Ftil is a bijection. (Indeed, it has an inverse Gtil , which
         is defined in the same way but with the roles of n and m interchanged.)
    To be fully rigorous, we would have to check that these two maps Fdom and Ftil are well-
defined (i.e., that flipping a domino inside Rn,m really results in a domino inside Rm,n , and
that flipping a domino tiling of Rn,m really results in a domino tiling of Rm,n ), but this is
intuitively clear, and the formal proof can easily be constructed by just “following your
nose”16 , which is why we omit it.
    Anyway, we now have constructed a map
Ftil : {domino tilings of Rn,m } → {domino tilings of Rm,n } and showed that it is a bijection.
Hence, (6) (applied to X = {domino tilings of Rn,m } and Y = {domino tilings of Rm,n } and
f = Ftil ) shows that
16 For example: If D is a horizontal domino {(i, j) , (i + 1, j)}, then flipping it yields the vertical
   domino {( j, i ) , ( j, i + 1)}. Likewise, flipping a vertical domino yields a horizontal domino. Thus,
   flipping a domino yields a domino. (Note that this would be false if our definition of dominos
   didn’t have the symmetry built in!)
Enumerative Combinatorics: class notes                                                                    page 18
In view of the latter two equalities, we can rewrite (7) as dn,m = dm,n . Thus Proposition
1.1.5 is proven.
For the sake of future use, we observe that Theorem 1.1.6 has a converse:
  Theorem 1.1.7. If X and Y are two sets of the same size (that is, | X | = |Y |), then
  there exists a bijection from X to Y.
  Again, this holds for infinite sets just as it does for finite ones, but we will only
use it for finite sets.
Proof of Proposition 1.1.8 (sketched). We must show that there is exactly one domino
tiling of Rn,m . But this is visually obvious: The rectangle Rn,m has only one row,
and this row has an even number of squares, so we can cover it with horizontal
dominos in only one way. Here is how this domino tiling looks like:
··· .
  This is not yet a rigorous proof, but it is fairly easy to turn it into one. Rigorously
speaking, the domino tiling we just described is17
            {{(1, 1) , (2, 1)} , {(3, 1) , (4, 1)} , {(5, 1) , (6, 1)} , . . . , {(n − 1, 1) , (n, 1)}}
            = {{(2k − 1, 1) , (2k, 1)} | k ∈ {1, 2, . . . , n/2}} .                                            (8)
It is instantly clear that this is a domino tiling of Rn,m . In order to show that this is the only
domino tiling of Rn,m , we can let T be any domino tiling of Rn,m , and then argue as follows:
A1 A1 ? ? ? ? ? ? ? ? ? ? ? ? ? ··· ? ? ? ? ? ? ? ? ?
         (where we have labeled the leftmost two squares with “A1 ” to signify that they are
         contained in the domino A1 ).
17 Pay   attention to where the set braces are! This is a set of sets of pairs of numbers.
Enumerative Combinatorics: class notes                                                         page 19
   • The square (3, 1) must be contained in some domino A2 ∈ T. This domino A2 must
     be either {(3, 1) , (4, 1)} or {(2, 1) , (3, 1)} or {(3, 1) , (3, 2)} or {(3, 0) , (3, 1)} (since
     these are the only dominos that contain (3, 1)). But out of these four dominos, only
     {(3, 1) , (4, 1)} and {(2, 1) , (3, 1)} are subsets of Rn,m (since m = 1). Hence, A2 must
     be either {(3, 1) , (4, 1)} or {(2, 1) , (3, 1)}. But the dominos in a domino tiling must
     be disjoint (by definition); hence, A2 cannot be {(2, 1) , (3, 1)} (because if A2 was
     {(2, 1) , (3, 1)}, then it would fail to be disjoint from A1 = {(1, 1) , (2, 1)}). Thus, A2
     must be {(3, 1) , (4, 1)}. Hence, (4, 1) is also contained in A2 .
      Now we know that our tiling T looks like this:
A1 A1 A2 A2 ? ? ? ? ? ? ? ? ? ? ? ··· ? ? ? ? ? ? ? ? ?
   • The square (5, 1) must be contained in some domino A3 ∈ T. This domino A3 must
     be either {(5, 1) , (6, 1)} or {(4, 1) , (5, 1)} or {(5, 1) , (5, 2)} or {(5, 0) , (5, 1)} (since
     these are the only dominos that contain (5, 1)). But out of these four dominos, only
     {(5, 1) , (6, 1)} and {(4, 1) , (5, 1)} are subsets of Rn,m (since m = 1). Hence, A3 must
     be either {(5, 1) , (6, 1)} or {(4, 1) , (5, 1)}. But the dominos in a domino tiling must
     be disjoint (by definition); hence, A3 cannot be {(4, 1) , (5, 1)} (because if A3 was
     {(4, 1) , (5, 1)}, then it would fail to be disjoint from A2 = {(3, 1) , (4, 1)}). Thus, A3
     must be {(5, 1) , (6, 1)}. Hence, (6, 1) is also contained in A3 .
      Now we know that our tiling T looks like this:
A1 A1 A2 A2 A3 A3 ? ? ? ? ? ? ? ? ? ··· ? ? ? ? ? ? ? ? ?
. . . and so on, proceeding further and further right until you hit the “eastern wall” of Rn,m
(that is, the square (n, 1)). Thus, the dominos appearing in T are uniquely determined:
They must be A1 = {(1, 1) , (2, 1)}, A2 = {(3, 1) , (4, 1)}, A3 = {(5, 1) , (6, 1)} and so on.
This is precisely the one tiling that we presented in (8). Thus, that one tiling is the only
domino tiling of Rn,m .
     To be fully rigorous, this argument should be formalized as an induction proof (feel free
to do so!), but even if I wake you up at night, you will know how to construct this argument
if necessary, because the idea behind it is glaringly obvious (just walk the rectangle Rn,m
from its western wall to its eastern wall, and observe that at each step, there is only one
possible domino that fits in the rectangle without overlapping with the previous domino).
dn,m = dn,2 for some small values of n simply by listing all domino tilings of Rn,m :
0 d0,2 = 1
1 d1,2 = 1
   2       d2,2 = 2                ,
                                                                                      .
3 d3,2 = 3 , ,
4 d4,2 = 5 , , ,
If the n = 0 case confuses you, keep in mind that the rectangle R0,2 is the empty
set (since R0,2 = [0] × [2] = ∅ × [2] = ∅) and thus has exactly one domino tiling
                 |{z}
                           =∅
– namely, the tiling that contains no dominos (i.e., the empty set).
  Can you find d5,2 ?
  Here is a quick way to the answer, at least as far as counting is concerned:
Class of 2019-09-25
Proof of Proposition 1.1.9 (sketched). Let n ≥ 2 be an integer. Consider the last18 col-
umn of Rn,2 (that is, the set {(n, 1) , (n, 2)}).
  In any domino tiling T of Rn,2 , this last column is either covered by 1 vertical
domino, or covered by (parts of) 2 horizontal dominos.
18 i.e.,   easternmost
Enumerative Combinatorics: class notes                                                     page 21
   In the former case, we shall call T a type-1 tiling; in the latter case, we shall call T
a type-2 tiling. Visually, these look as follows:
                  ???????????????                      ???????????????
                                             ,
                  ???????????????                      ???????????????
              |           {z             }         |             {z                 }
                       type-1 tiling                           type-2 tiling
(by adding the equalities (10) and (12) together). Now, the definition of dn,2 yields
                 dn,2 = (# of domino tilings of Rn,2 ) = dn−1,2 + dn−2,2
(by (14)). This proves Proposition 1.1.9.
  Again, let us analyze what we have actually done in this proof:
   1. The equality (9) follows from the bijection principle. Indeed, our argument for it
      boils down to the (easily established) fact that there is a bijection
                          f : {domino tilings of Rn−1,2 } → {type-1 tilings}
      (which takes any domino tiling of Rn−1,2 , and adds the vertical domino {(n, 1) , (n, 2)}
      to it). Once you have convinced yourself of this fact, you can apply Theorem 1.1.6 to
      X = {domino tilings of Rn−1,2 } and Y = {type-1 tilings}, and conclude that
                          |{domino tilings of Rn−1,2 }| = |{type-1 tilings}| .
      In other words, (# of domino tilings of Rn−1,2 ) = (# of type-1 tilings). Thus, the
      equality (9) is proven. The equality (11) is obtained similarly.
   2. The equality (13) follows from the sum rule. Indeed, the sets {type-1 tilings} and
      {type-2 tilings} are disjoint, and their union is the set {domino tilings of Rn,2 }. Hence,
      Theorem 1.1.3 (applied to S = {domino tilings of Rn,2 }, k = 2, S1 = {type-1 tilings}
      and S2 = {type-2 tilings}) yields
               |{domino tilings of Rn,2 }| = |{type-1 tilings}| + |{type-2 tilings}| .
      In other words,
           (# of domino tilings of Rn,2 ) = (# of type-1 tilings) + (# of type-2 tilings) .
      This proves (13).
  Proposition 1.1.9 lets us compute the numbers dn,2 rather easily, if we compute
them in the appropriate order (i.e., start with d0,2 and d1,2 , then compute d2,2 , then
compute d3,2 , then compute d4,2 , and so on). For example, we get
                             d5,2 = d4,2 + d3,2 = 5 + 3 = 8;
                                    |{z} |{z}
                                         =5   =3
                             d6,2 = d5,2 + d4,2 = 8 + 5 = 13;
                                    |{z} |{z}
                                         =8   =5
                             d7,2 = d6,2 + d5,2 = 13 + 8 = 21;
                                    |{z} |{z}
                                     =13      =8
                                  ....
But what if we want to compute (say) d900,2 without having to first compute all the
previous numbers d0,2 , d1,2 , . . . , d899,2 ? Is there an explicit formula?
  Before we answer this question, let us forget for a moment about domino tilings,
and define the following sequence of integers:
Enumerative Combinatorics: class notes                                                             page 23
                  n     0   1     2   3 4    5    6    7     8     9         ···
                                                                                            .
                  fn    0   1     1   2 3    5    8    13 21 34              ···
   The Fibonacci sequence is famous – just look at its Wikipedia page! It also has
several books dedicated to it, such as Vorobiev’s [Vorobi02] (although, to be fully
honest, Vorobiev often uses it as a plug to pivot to other mathematics); there is also
a journal called The Fibonacci Quarterly (again, however, its actual scope is broader).
Now, we can reduce our problem of computing dn,2 to the problem of computing
Fibonacci numbers:
Proof of Proposition 1.1.11 (informal version). Here is the main idea of the proof: We
must show that the two sequences (d0,2 , d1,2 , d2,2 , d3,2 , . . .) and ( f 1 , f 2 , f 3 , f 4 , . . .) are
identical. Both of them have the property that their first entries are 1’s (that is,
d0,2 = 1 and f 1 = 1), their second entries are 1’s (that is, d1,2 = 1 and f 2 = 1), and
each of their further entries equals the sum of the preceding two entries (because
Proposition 1.1.9 shows that the dn,2 satisfy dn,2 = dn−1,2 + dn−2,2 , whereas the
definition of Fibonacci numbers shows that f n+1 = f n + f n−1 ). Thus, to put it in
practical terms: Both sequences start with the same two entries, and then are built
out of these two entries according to the same rule (namely, each further entry is
the sum of the preceding two entries). Hence, the two sequences must be the same.
This proves Proposition 1.1.11.
  If you found this proof insufficiently rigorous, here is a formal version of this argument:
Enumerative Combinatorics: class notes                                                        page 24
Proof of Proposition 1.1.11 (formal version). We shall prove Proposition 1.1.11 by strong in-
duction on n.
  A strong induction needs no induction base20 . Thus, we only do the induction step:
  Induction step: Let m ∈ N. Assume (as the induction hypothesis) that Proposition 1.1.11
holds for each n < m. We must prove that Proposition 1.1.11 holds for n = m.
  Our induction hypothesis says that Proposition 1.1.11 holds for each n < m. In other
words, we have
                       dn,2 = f n+1       for each n ∈ N satisfying n < m.               (15)
   Now, we must prove that Proposition 1.1.11 holds for n = m. In other words, we must
prove that dm,2 = f m+1 . If m = 0, then this is true (since d0,2 = 1 = f 1 = f 0+1 ). If m = 1,
then this is also true (since d1,2 = 1 = f 2 = f 1+1 ). Hence, it remains to prove this in the
case m ≥ 2. So let us WLOG21 assume that m ≥ 2. Then, m − 2 ∈ N. Hence, we can apply
(15) to n = m − 2 (since m − 2 < m), and obtain dm−2,2 = f (m−2)+1 = f m−1 . Furthermore,
m − 1 ∈ N (since m ≥ 2 ≥ 1). Thus, we can apply (15) to n = m − 1 (since m − 1 < m), and
obtain dm−1,2 = f (m−1)+1 = f m . However, Proposition 1.1.9 (applied to n = m) shows that
= f m + f m −1 ,
we obtain dm,2 = f m+1 . In other words, Proposition 1.1.11 holds for n = m. This completes
the induction step. Thus, Proposition 1.1.11 is proven.
  So we have identified our numbers dn,2 as the famous Fibonacci numbers f n+1 .
Does this help us compute them directly? Yes, because there is a famous formula
for the Fibonacci numbers:
                                                  1
                                            f n = √ ( ϕn − ψn ) ,
                                                   5
  where
                   √                                                    √
                1+ 5                                                 1− 5
             ϕ=      ≈ 1.618 . . .                    and         ψ=      ≈ −0.618 . . . .
                  2                                                    2
  A few words about this strange formula are in order. On its left hand side is
a nonnegative √  integer, f n . On its right side is an expression involving irrational
numbers like 5 as well as minus signs. How could an explicit formula for a
sequence of nonnegative integers require irrational numbers and subtraction?
  Well, this is the price of asking for explicit formulas!
  The numbers ϕ and ψ in Theorem 1.1.12 are known as the golden ratios (although
usually only ϕ is considered “the golden ratio”). They are the two roots of the
quadratic polynomial x2 − x − 1, so they satisfy ϕ2 = ϕ + 1 and ψ2 = ψ + 1. If this
looks like the Fibonacci recursion f n = f n−1 + f n−2 , don’t be surprised! This is the
reason why they show up in the explicit formula for the Fibonacci numbers.
   How do you compute f 900 using Theorem 1.1.12? You may be tempted to just plug
n = 900 into the formula      √ using your favorite computer algebra system; but there is a
subtlety involved: Since 5 is irrational, the computer may try to work with approximate
values, and then when you take n-th powers, the rounding errors will blow up. You will
probably not get an integer as a result, and even if you try to round it to the nearest
integer, you may well get the wrong √       value! Such is the price of blindly trusting floating-
point arithmetic. Fortunately, 5 is an algebraic number (i.e., a root of a polynomial with
rational coefficients), and this means that it is   √possible to make exact computations with
it. You
      √ just need to restrict yourself to the “ 5-rationals” (i.e., the numbers of the form
a + b 5 with a, b√∈ Q), and instead of approximating them with decimals, you just keep
          √ a + b 5 form. It is easy to find rules for adding, subtracting, multiplying and
them in the
dividing 5-rationals by one another22 ; thus you don’t need approximate values. Using
the “exponentiation by squaring” trick, it is now easy to compute very high powers of ϕ
and ψ, and then Theorem 1.1.12 yields f n . For example, a computer will readily tell you
all the 188 digits of f 900 , the last six of which are 938800; you would probably have gotten
these wrong if you relied on approximate computation.
   Theorem 1.1.12 also gives a very easy answer to the question (which we arguably haven’t
asked) how fast the Fibonacci numbers f n grow when n gets large. Indeed, |ψ| < 1, so that
                                                                            1
ψn → 0 when n → ∞. Hence, for high enough n, we have f n ≈ √ ϕn . Of course, the
                                                                             5
               1 n
sequence of √ ϕ for n ∈ N is a geometric sequence with ratio ϕ ≈ 1.618 . . ., and grows
                5
exponentially. Thus, we see that the Fibonacci numbers f n grow exponentially – slower than
22 To   wit:
                      √       √                      √
                 a + b 5 + c + d 5 = ( a + c) + (b + d) 5;
                      √       √                      √
                 a + b 5 − c + d 5 = ( a − c) + (b − d) 5;
                        √     √                           √
                    a + b 5 c + d 5 = ( ac + 5bd) + ( ad + bc) 5;
                                  √
                                              √         √                            √
                              a+b 5      a + b  5   c −  d  5     ( ac − 5bd) + (bc − ad) 5
                                  √ =         √         √  =                            .
                              c+d 5      c+d 5 c−d 5                        c2 − 5d2
   Note in particular the last equation: This is why they taught you to rationalize denominators in
   high school!
Enumerative Combinatorics: class notes                                                                  page 26
the powers of 2 (since 1.618 . . . < 2), but still faster than any polynomial. The Fibonacci
                                  
number f n will have ≈ log10 ϕ · n ≈ 0.209 · n many digits.
  Theorem 1.1.12 is easy to prove:
Proof of Theorem 1.1.12 (sketched). This can be proven by the same argument that
      for Proposition 1.1.11: We have to show thatthe sequences ( f 0 , f 1 , f 2 , . . .)
we used
        1            1               1
and √ ϕ0 − ψ0 , √ ϕ1 − ψ1 , √ ϕ2 − ψ2 , . . . are identical. Both of them
                                                     
         5                5              5
have the property that their first entries are 0’s (this is easy to check), their second
entries are 1’s (this is easy to check), and each of their further entries equals the
sum of the preceding two entries23 . Thus, both sequences start with the same two
entries, and then are built out of these two entries according to the same rule.
Hence, the two sequences must be the same. This proves Theorem 1.1.12.
  This proof should convince you that Theorem 1.1.12 holds, but does not explain
how you could have come up with Theorem 1.1.12. If time allows, we will later
explain this when we explore the concept of generating functions.
There is no tiling of R5,3 anywhere in it, nor of R4,3 , nor of R3,3 , nor of R2,3 , nor of
R1,3 . This thwarts our recursive approach.
  Nevertheless, there is a nice recursion for dn,3 :
23 Indeed,
         for the Fibonacci sequence ( f 0 , f 1 , f 2 , . . .), this is clear. For the second sequence, this boils
   down to proving the identity
                      1                 1                 1               
                      √ ( ϕ n − ψ n ) = √ ϕ n −1 − ψ n −1 + √ ϕ n −2 − ψ n −2 ,
                       5                 5                   5
   which however follows by subtracting the two easily verified identities
                      ϕ n = ϕ n −1 + ϕ n −2           and         ψ n = ψ n −1 + ψ n −2
                              √
   and dividing the result by 5.
Enumerative Combinatorics: class notes                                                    page 27
  As I said, there is no proof as easy as the one we gave for Proposition 1.1.9. We
will later learn the technique of generating functions, which can be used to give a rea-
sonably simple proof (see [Read80]), and probably a more complicated induction
could also do the trick.
  What about dn,4 ? There is a recursion, too, according to [Read80, §2]:
As you see, these are getting more complicated. In theory, recurrence relations like
these have explicit formulas like Binet’s formula for f n (Theorem 1.1.12). However,
these formulas become more and more complicated       √as well, and in particular they
no longer involve “nice” irrational numbers like 5, but rather roots of higher-
degree polynomials, which at some point can no longer be expressed  √   using rational
                                                                     a
numbers, sums, differences, products, quotients and radicals (i.e., b terms)24 . This
looks like a dead end.
  In the 20th Century, however, theoretical physicists studying thermodynamics
got interested in computing dn,m , as they considered a domino tiling to be a (rather
idealized) model for a liquid consisting of “dimers” (polymers that take up two
adjacent sites in a rectangular lattice; these are exactly our dominos). Even though
the 2-dimensionality of a rectangle makes it a somewhat unrealistic approximation
for real-world liquids, it found its use as a model for the adsorption of molecules
on a surface (see [Kastel61]). In 1961, Kasteleyn found the following surprising
formula for dn,m :
  (Here, we are using the product sign ∏: That is, if a1 , a2 , . . . , a p are any numbers,
          p
  then ∏ ai means the product a1 a2 · · · a p . The presence of two product signs
         i =1
  directly following one another means that we are taking a product of products.)
   We won’t even get close to proving Theorem 1.1.14. A proof outline appears
in [Loehr11, Theorem 12.85], serving as a culmination of a graduate-level combi-
natorics textbook. A more self-contained exposition of the proof has been given
by Stucky in [Stucky15], but even that is only self-contained up to some advanced
linear algebra (Pfaffians and Kronecker products of matrices, as well as a good
understanding of eigenvectors are required).
   For all its seeming extravagance, Theorem 1.1.14 actually provides a good way
                                              jπ            kπ
of computing dn,m . Indeed, cosines like cos       and cos      are algebraic num-
                                             m+1           n+1
bers that lend themselves to exact computation (using cyclotomic polynomials – a
piece of abstract algebra we are also not coming close to), and the scary-looking
products don’t scare a good computer algebra system. For example, Kasteleyn’s
formula can be used to show that d8,8 = 12 988 816. This wouldn’t be so easy to
check by a brute force search for domino tilings!
Class of 2019-09-27
and
  are not axisymmetric (indeed, reflecting them across the vertical line transforms
  them into one another, and they are not the same), but the tilings
and
  are axisymmetric.
    How many axisymmetric domino tilings does Rn,2 have?
  Example 1.1.15. Let us list the axisymmetric domino tilings for Rn,2 when n is
Enumerative Combinatorics: class notes                                               page 29
small:
                                                                               their
   n      axisymmetric domino tilings
                                                                              number
0 1
1 1
                                                                                               .
    2                  ,                                                         2
3 1
4 , , 3
Solution sketch to Exercise 1.1.1. Let us only show the main steps; a (more) detailed
solution to Exercise 1.1.1 can be found in [17f-hw1s, Exercise 5].
  There are two cases to consider: the case when n is even, and the case when n is
odd.
  Let us first consider the case when n is even. In this case, I claim that any
axisymmetric domino tiling of Rn,2 has one of the following two forms:
   • Form 1: a domino tiling J of Rn/2,2 covering the left half of Rn,2 , and its mirror
     image across the vertical axis covering the right half:
(Note that the vertical axis cuts through the middle of this picture.)
(Again, the vertical axis cuts through the middle of this picture.)
If you agree with me that these are the only possible forms of an axisymmetric
domino tiling of Rn,2 , then it follows (by the same logic as in the proof of Proposi-
tion 1.1.9) that the # of axisymmetric domino tilings of Rn,2 is
Note, however, that the part marked “some dominos” in this picture has an odd
number of squares (namely, 2 (n/2 − 1) − 1 many squares), so that it cannot ac-
tually be covered by dominos!26 Thus, we obtain a contradiction. Hence, this
“rogue” possibility is actually impossible. This shows that every axisymmetric
domino tiling T of Rn,2 either has Form 1 or has Form 2.
26 This   is the same logic that we used to prove Proposition 1.1.2.
Enumerative Combinatorics: class notes                                                     page 31
  Thus, we have proved that the # of axisymmetric domino tilings of Rn,2 is f n/2+2
in the case when n is even.
  What about the case when n is odd? In this case, I claim that any axisymmetric
domino tiling of Rn,2 has the following form:
      (Again, the vertical axis cuts through the middle of this picture, which in this
      case means cutting through the middle of the vertical domino.)
This time, there is no Form 2. Again, we need to prove that this is the only possible
form. This is even easier than in the previous case; the main idea is the following: If
an axisymmetric tiling T of Rn,2 contained any horizontal domino that intersects its
(n + 1) /2-th column, then it would also contain the mirror image of this domino
across the vertical axis (since T is axisymmetric), but then this domino and its
mirror image would be distinct but overlapping27 , which would contradict the
definition of a domino tiling. Thus, the (n + 1) /2-th column of any axisymmetric
tiling T of Rn,2 must be covered by a vertical domino. This shows that Form 1 is
the only possible form.
   Thus, when n is odd, the # of axisymmetric domino tilings of Rn,2 equals the # of
domino tilings of R(n−1)/2,2 , which (by Proposition 1.1.11) is f (n−1)/2+1 = f (n+1)/2 .
   Thus, the general formula for the # of axisymmetric domino tilings of Rn,2 is:
                                                      (
                                                        f n/2+2 ,   if n is even;
       (# of axisymmetric domino tilings of Rn,2 ) =                              .
                                                        f (n+1)/2 , if n is odd
for some i, j ∈ Z); a horizontal k-brick shall mean a k × 1-rectangle (i.e., a set of the
form
                     {(i, j) , (i + 1, j) , (i + 2, j) , . . . , (i + k − 1, j)}
for some i, j ∈ Z). Here is how they look like:
                                             ;                        .
                                                 |      {z        }
                                                 horizontal k-brick
                             | {z }
                          vertical k-brick
  If S is a set of squares, then a k-brick tiling of S means a way to cover the set
S with non-overlapping k-bricks (i.e., formally speaking: a set of disjoint k-bricks
whose union is S).
  Thus, k-brick tilings are a generalization of domino tilings. More specifically: If
k = 2, then k-bricks are the same as dominos, and thus k-brick tilings are the same
as domino tilings.
  When does a rectangle Rn,m have a k-brick tiling? The answer is surprisingly
simple:
  In the case when k = 2, Proposition 1.1.16 says that the rectangle Rn,m has a
domino tiling if and only if we have 2 | m or 2 | n (that is, at least one of the
numbers m and n is even). This should not be surprising: One direction of this
equivalence (namely, the “=⇒” direction: i.e., the direction saying that if Rn,m has
a domino tiling, then at least one of m and n is even) follows from Proposition
1.1.2, whereas the other direction is easy. We could use a similar argument to
prove Proposition 1.1.16 whenever the number k is prime. Indeed, our proof of
Proposition 1.1.2 generalizes to show that if the rectangle Rn,m has a k-brick tiling,
then k | mn. When k is prime, the divisibility k | mn implies that k | m or k | n;
thus, the “=⇒” direction of Proposition 1.1.16 would follow immediately in this
case. But when k is not prime, we need a better argument.
Proof of Proposition 1.1.16. The claim we want to prove is an “if and only if” claim,
so it has two directions: the “⇐=” direction (also known as the “if” direction), and
the “=⇒” direction (also known as the “only if” direction). The former direction
claims that if we have k | m or k | n, then the rectangle Rn,m has a k-brick tiling. The
latter claims the converse of this statement.
   We shall prove these two directions separately:
   ⇐=: Assume that k | m or k | n.
Enumerative Combinatorics: class notes                                          page 33
···
···
                                    ..     ..     ..       ..
                                     ..     ..         .    ..
                                      ..     ..              ..
···
(with each column being covered by m/k many vertical k-bricks). Similarly, if k | n,
then Rn,m has a k-brick tiling consisting entirely of horizontal k-bricks. Thus, in
either case, Rn,m has a k-brick tiling. This proves the “⇐=” direction of Proposition
1.1.16.
   =⇒: Assume that the rectangle Rn,m has a k-brick tiling. We must prove that we
have k | m or k | n.
   Assume the contrary (for the sake of contradiction). Thus, k - m and k - n.
   We shall use the following notations from elementary number theory: If a is an
integer and b is a positive integer, then
   • we let a // b denote the quotient obtained when dividing a by b (in the sense
     of division with remainder);
   Both of these numbers a // b and a%b are integers, and they satisfy 0 ≤ a%b < b
and a = ( a // b) · b + ( a%b).
   Let r = n%k and s = m%k. We have r = n%k 6= 0 (since k - n) and thus 0 < r < k
(since r is a remainder upon division by k). Likewise, 0 < s < k.
   Now, we are going to color the squares of Rn,m with k colors. The k colors we
are going to use will be numbered 0, 1, . . . , k − 1. Each square (i, j) ∈ Rn,m will be
colored with the color (i + j − 2) %k. Here is how this coloring looks like (in the
Enumerative Combinatorics: class notes                                           page 34
                           2   3   0   1   2   3       0   1   2     3
                           1   2   3   0   1   2       3   0   1     2
                           0   1   2   3   0   1       2   3   0     1
                           3   0   1   2   3   0       1   2   3     0
                           2   3   0   1   2   3       0   1   2     3
                           1   2   3   0   1   2       3   0   1     2
                           0   1   2   3   0   1       2   3   0     1
(where we have written the color of each square as a number into this square). Note
that if k = 2, then there are two colors only, numbered 0 and 1; in this case, our
coloring is precisely the usual chessboard coloring (if we regard color 0 as black
and color 1 as white).
  Let us make a few observation about how our coloring behaves:
   • The southwesternmost square Rn,m is (1, 1), and thus has color (1 + 1 − 2) %k =
     0%k = 0.
   • Along each “northwest-to-southeast” diagonal (i.e., each line with slope −1),
     the color stays constant.
  Let us say that a finite set S of squares is balanced if it has equally many squares
of each color. In other words, a finite set S of squares is balanced if and only if for
any color h ∈ {0, 1, . . . , k − 1}, the # of all squares in S that have color h does not
depend on h.
  Each horizontal k-brick has exactly 1 square of each color. Indeed, the colors of
the k squares in a horizontal k-brick look as follows:
(where u is the color of the leftmost square of the k-brick). Thus, each horizontal k-
brick is balanced. Likewise, each vertical k-brick is balanced. Thus, we have shown
that each k-brick is balanced.
Enumerative Combinatorics: class notes                                                                   page 35
   But we have assumed that the rectangle Rn,m has a k-brick tiling. Hence, Rn,m
must, too, be balanced (by the sum rule)28 .
   Let us now subdivide the rectangle Rn,m into several (disjoint) zones Zu,v by cut-
ting it with several lines29 . Namely, we cut it with horizontal lines every k squares
(counted from the bottom), and with vertical lines every k squares (counted from
the left). Thus, we obtain the following subdivision of Rn,m :
    Hence, for each h ∈ {0, 1, . . . , k − 1}, the # of all squares in Rn,m that have color h is independent
    of h (since it is a sum of j numbers that are each independent of h). In other words, Rn,m is
    balanced.
29 We will give a rigorous definition further below.
Enumerative Combinatorics: class notes                                                                        page 36
  All these zones Zu,v are rectangles. More precisely: Let us call a zone Zu,v (with
u ∈ {0, 1, . . . , (n − 1) // k } and v ∈ {0, 1, . . . , (m − 1) // k })
• northeastern if u = (n − 1) // k and v = (m − 1) // k.
Then,30
Note that all these zones are nonempty, since r > 0 and s > 0 and k > 0.
  Each northern zone is a k × s-rectangle, and thus can be tiled with horizontal
k-bricks; therefore it is balanced (since each k-brick is balanced). Likewise, each
eastern zone is balanced, and each generic zone is balanced. Thus, summarizing,
we have shown that each zone Z except for the northeastern zone is balanced. In
other words, if Z is a zone that is not the northeastern zone, then, for any color
h ∈ {0, 1, . . . , k − 1},
  But the zones are disjoint and their union is the whole rectangle Rn,m . Hence, it
follows that the northeastern zone is balanced as well31 .
  But let us take a closer look at the northeastern zone. We denote this zone by Z.
This zone Z is an r × s-rectangle, and (just as for any zone) its southwestern corner
s−1 s ∗ ··· ∗ ∗
                              ..         ..         ..        ...      ..        ..
                               .          .          .                  .         .                      (17)
1 2 3 ··· r−1 r
(where each asterisk ∗ stands for some entry we don’t need to know about).
  We shall now show that this northeastern zone is not balanced. This will give us
a contradiction.
  We WLOG assume that s ≤ r (since otherwise, the argument is similar32 ). Recall
that 0 < r < k and 0 < s < k. From 0 < s, we obtain s ≥ 1, so that s − 1 ≤ 0. Thus,
       s −1 ≤ r − 1. Therefore, each row of Z contains at least one square with
0 ≤ |{z}
      ≤r
color s − 1. Since Z has s rows, we thus conclude that
(We can easily see that Z contains exactly s squares with color s − 1, but we won’t
need this.)
   On the other hand, the bottommost row of Z only contains squares with colors
0, 1, . . . , r − 1. Hence, it does not contain a square with color r (since r > r − 1). But
each row of Z has width r < k, and thus contains at most one square with color
r (because if it contained two distinct squares with color r, then these two squares
would be a distance of ≥ k apart from one another, but the row only has width
r < k). So we know that the zone Z has s rows, one of which (the bottommost one)
   so that
    and thus the # of all squares in the northeastern zone that have color h is independent of h. In
    other words, the northeastern zone is balanced.
32 More precisely, the same argument applies if we interchange the roles of rows and columns.
Enumerative Combinatorics: class notes                                                      page 38
contains no square with color r, while each of the other s − 1 rows contains at most
one square with color r. Hence, altogether,
                     Z contains at most s − 1 squares with color r.                            (19)
Comparing this with (18), we conclude that the # of squares with color r contained
in Z is different from the # of squares with color s − 1 contained in Z (since the for-
mer number is ≤ s − 1, while the latter number is ≥ s). Hence, Z is not balanced.
In other words, the northeastern zone is not balanced (since Z is the northeast-
ern zone). This contradicts the fact that the northeastern zone is balanced. This
contradiction shows that our assumption was false. Hence, the “=⇒” direction of
Proposition 1.1.16 is proven.
   This was just a little taste of the theory of tilings of discrete (plane) shapes. See
the survey [ArdSta10] by Ardila and Stanley for an introduction to the varied ques-
tions and ideas of this theory. See also [18f-hw1s, Exercises 4 and 5] and [19f-hw1s,
Exercises 1, 2, 3] for further exercises on counting tilings, and [LeLeMe16, §5.1.5] for
a neat exercise in proving existence of tilings. Furthermore, the book [BenQui03]
by Benjamin and Quinn provides a lot of applications of tilings to enumerative
combinatorics, such as proofs of identities between Fibonacci numbers using their
domino-tiling interpretation (Proposition 1.1.11)33 . (See [BenQui04] for a “best-of”
of sorts.)
Class of 2019-09-30
                                                       n ( n + 1)
                                 1+2+···+n =                      .
                                                            2
First proof of Theorem 1.2.1. Induction on n. The details are completely straightfor-
ward and LTTR.
  (The abbreviation “LTTR” stands for “left to the reader”. I will usually leave
arguments to the reader when they are straightforward or easy variations of argu-
ments shown before.)
Second proof of Theorem 1.2.1. We observe the following fact: If a1 , a2 , . . . , an are n
numbers (say, real numbers), and b1 , b2 , . . . , bn are n further numbers, then
                        ( a1 + a2 + · · · + an ) + (b1 + b2 + · · · + bn )
                        = ( a1 + b1 ) + ( a2 + b2 ) + · · · + ( an + bn ) .                  (20)
(Indeed, both sides of this equality are just two ways to add all the 2n numbers
a1 , a2 , . . . , an , b1 , b2 , . . . , bn . This should convince you that they are the same, al-
though formally speaking, this is not a proof. See Subsection 1.2.2 below for some
references to a formal proof.)
   Now,
   2 · (1 + 2 + · · · + n )
    = (1 + 2 + · · · + n ) +     (1 + 2 + · · · + n )
                                 |      {z         }
                                    =n+(n−1)+···+1
                               (here, we have just reversed
                                 the order of summation)
    = (1 + 2 + · · · + n ) + ( n + ( n − 1) + · · · + 1)
    = (1 + n) + (2 + (n − 1)) + · · · + (n + 1)
           (by (20), applied to ai = i and bi = n + 1 − i )
    = ( n + 1) + ( n + 1) + · · · + ( n + 1)
      |                 {z                 }
                   n many addends
                                                                        n ( n + 1)
Dividing this equality by 2, we obtain 1 + 2 + · · · + n =                         . This proves
                                                                             2
Theorem 1.2.1 again.
Third proof of Theorem 1.2.1 (sketched). Here is a picture proof (drawn for the case
n = 3):
                                    ∗ ∗ ∗ ∗
                                        ∗    ∗    ∗     ∗
                                                              .
                                        ∗    ∗    ∗     ∗
Enumerative Combinatorics: class notes                                                         page 40
This is a 4 × 3-rectangle35 (i.e., a rectangle of width 4 and height 3), subdivided into
two parts by a broken line which starts in the southwestern corner and winds its
way to the northeastern corner, making steps of length 1 eastwards and northwards
(by turns). The two parts (the one below and the one above the broken line) have
the same area, since they are symmetric to each other with respect to the center
of the square.36 Hence, the area of either part equals half the area of the whole
rectangle. Since the area of the whole rectangle is 3 · 4, we thus conclude that the
                             3·4
area of either part equals        .
                              2
   On the other hand, here is a different way to compute this area: Let us look at
the part below the broken line. This part has 0 squares in the 1-st column37 , 1
square in the 2-nd column, 2 squares in the 3-rd column, and 3 squares in the 4-th
column. Hence, in total, it has 0 + 1 + 2 + 3 many squares. In other words, its area
is 0 + 1 + 2 + 3.
   Now we know that the area of the part of the rectangle below the broken line is
                                                                  3·4
0 + 1 + 2 + 3, but we also know (from before) that it equals           . Hence, 0 + 1 +
                                                                    2
         3·4                                                                       3·4
2+3 =         . In view of 0 + 1 + 2 + 3 = 1 + 2 + 3, this rewrites as 1 + 2 + 3 =      .
           2                                                                         2
This is precisely the statement of Theorem 1.2.1 for n = 3.
   The same argument (but using an (n + 1) × n-rectangle instead of a 4 × 3-rectangle)
proves Theorem 1.2.1 for arbitrary n.
  How can we formalize this argument? Once again (as with domino tilings), it makes
sense to think of the (n + 1) × n-rectangle as the finite set [n + 1] × [n] (where, as before,
we set [k ] = {1, 2, . . . , k } for each k ∈ N) rather than a geometric shape in the real plane.38
The two parts into which this rectangle is divided by the broken line become the two sets
of [n + 1] × [n]. These two subsets A and B are disjoint (since no (i, j) ∈ [n + 1] × [n] can
satisfy i ≤ j and i > j at the same time), and their union is [n + 1] × [n] (since each (i, j) ∈
35 We  have put an asterisk into each little square of the rectangle in order to make the squares easier
    to discern.
36 Note that “area” is normally a geometric concept, but since both parts consist of full squares, we
    bottom).
Enumerative Combinatorics: class notes                                                        page 41
[n + 1] × [n] satisfies either i ≤ j or i > j). Hence, the sum rule shows that |[n + 1] × [n]| =
| A| + | B|, so that
                                       A → B,
                                    (i, j) 7→ (n + 2 − i, n + 1 − j)
(which, visually, is just the reflection around the center of the (n + 1) × n-rectangle) is a
bijection39 . Hence, the bijection rule yields | A| = | B|. Thus, | A| + | B| = | B| + | B| = 2 · | B|.
                                                                  |{z}
                                                                          =| B|
Comparing this with (21), we obtain 2 · | B| = n (n + 1), so that
                                                     n ( n + 1)
                                            | B| =              .                                 (22)
                                                          2
   On the other hand, let us count the squares in B “by column”. Recall that, in our
combinatorial model, the x-coordinate i of a square (i, j) tells us which column it belongs to.
Thus, the squares c ∈ B in the k-th column (for any given k ∈ {1, 2, . . . , n + 1}) are precisely
the squares c ∈ B that have x-coordinate k. Hence, we should count the squares in B
according to their x-coordinate. Formally speaking, this means applying the sum rule to the
set B and its n + 1 disjoint subsets {c ∈ B | c has x-coordinate k } for k ∈ {1, 2, . . . , n + 1}.
These n + 1 subsets are disjoint (since any square c ∈ B has only one x-coordinate) and
their union is B (since each square c ∈ B has x-coordinate 1 or 2 or · · · or n + 1). Hence,
the sum rule yields
But the addends on the right hand side of this equality are easily computed:40 For each
39 Thisneeds to be proven, but the proof is really straightforward. First, you need to check that this
   map is well-defined. This means showing that (n + 2 − i, n + 1 − j) ∈ B for each (i, j) ∈ A. Once
   this is shown, you can show the bijectivity of this map by explicitly constructing an inverse;
   namely, the inverse is the map
                                        B → A,
                                     (i, j) 7→ (n + 2 − i, n + 1 − j) .
    (Don’t be surprised that it is given by the same formula: In order to undo a reflection around a
    point, you have to reflect again around the same point.)
40 This is just the formalization of our (visually obvious) observation that the part below the broken
    line (which we are now calling B) has 0 squares in the 1-st column, 1 square in the 2-nd column,
    2 squares in the 3-rd column, etc..
Enumerative Combinatorics: class notes                                                         page 42
               {c ∈ B | c has x-coordinate i }
               = {c ∈ B | c = (i, j) for some j ∈ [n]}
                     
                         since a square of [n + 1] × [n] has x-coordinate i
                                                                               
and thus
                                                                 n ( n + 1)
Comparing this with (22), we obtain 1 + 2 + · · · + n =                     . This finally completes our
                                                                      2
formalized picture proof of Theorem 1.2.1.
   The moral of the story: A picture is worth a thousand words!
 Now, suppose you are given three numbers a, b and c. To add them all together
means to add two of them and then add the third one to the result. How many
ways are there to do this? There are 12, as you can easily check, namely
         ( a + b) + c,           ( a + c) + b,          (b + a) + c,          (b + c) + a,
         (c + a) + b,            (c + b) + a,           a + (b + c) ,         a + (c + b) ,
         b + ( a + c) ,          b + (c + a) ,          c + ( a + b) ,         c + (b + a) .
       a + (b + c) =          ( a + b)         +c       (by associativity)
                              | {z }
                                =b+ a
                          (by commutativity)
                      = (b + a) + c = b +           ( a + c)             (by associativity)
                                                    | {z }
                                                      =c+ a
                                                (by commutativity)
                      = b + (c + a) = (b + c) + a                (by associativity)
and so on (in the sense that similar reasoning shows that all 12 ways give equal
results). Once we know that these 12 ways all lead to the same result, we can
call the result “the sum of the three numbers a, b and c” with a clear conscience,
and denote it by a + b + c without specifying the order in which the sum is taken
through well-placed parentheses.
  Next, suppose you are given four numbers a, b, c and d. There are now 120 ways
of adding them together, including such ways as
(( a + b) + c) + d, ( a + b) + (c + d) , (b + d) + (c + a) , (b + (d + a)) + c
and many others. How can we tell that they all lead to the same result? They
do, and this can be proven as for three numbers (we don’t need any new rules;
commutativity and associativity suffice), but this is of course more laborious than
the case of three numbers.
   Now, suppose you are given n numbers a1 , a2 , . . . , an , and you want to prove that
all ways of adding them together give the same result. For example, two of these
ways are
and
{( a + b) + c, ( a + c) + b, . . . , c + (b + a)}
(containing all the 12 ways to add a, b, c together, listed above). This definition can
easily be done by recursion:
   • There is only one way to add 0 numbers together. Namely, adding 0 numbers
     always yields 0.
   • There is only one way to add 1 number together. Namely, adding 1 number
     a always yields a itself.
Thus we can define the set of all possible sums of n numbers. Our goal is to prove
that there is only one such sum, i.e., that this set is a 1-element set. This is now a
rigorously stated claim42 , which we can try to prove! Thus, at the very least, we
have formalized our claim that we can add n numbers together in a well-defined
way. Proving it is another story, but it can be done with rather elementary tools.
See [Grinbe15, §2.14] for a very detailed proof43 (and [18s, lecture of 7th February
2018, pages 1–7] for a short version). Other proofs can be found in [Warner71,
Appendix A] and in [GalQua19, §3.3].
   The upshot is that we have a well-defined notion of the sum of any finite family
of numbers, even if it is given without specifying an order. For example, “the sum
of all prime numbers smaller than 10” is well-defined (and equals 2 + 3 + 5 + 7 =
17). Likewise, if you are given a polygon, then “the sum of the sidelengths of the
polygon” is well-defined.
   It is helpful to have a notation for these kinds of sums, so let us introduce it
(although we have already used it to some extent):
41 “Groups”  in the sense of “batches”, not in the sense of group theory. For example, if our n
    numbers are a, b, c, d, e, then the first group may be d, b and the second may be c, a, e.
42 known as the general commutativity theorem (“general” because it applies to any finite number of
  Definition 1.2.2. Let S be a finite set. For each s ∈ S, let as be a number (e.g., an
  integer or a rational number or a real number or a complex number).
    Then, ∑ as shall denote the sum of the numbers as for all s ∈ S. This notation
           s∈S
  is read as “the sum of as over all s ∈ S” or “the sum of as for s ranging over S” or
  “the sum of as where s runs through S”. The “∑” sign in this notation is called
  the summation sign.
   • In the notation “ ∑ as ”, the letter “s” is called the summation index; the set S
                              s∈S
     is called the indexing set (or range) of the sum; and the numbers as are called
     the addends of the sum. The whole expression ∑ as is called a finite sum.
                                                               s∈S
     However,
                                         ∑                  s = 02 + 12 + 22 = 0 + 1 + 4 = 5,
                           s∈{(−2)2 ,(−1)2 ,02 ,12 ,22 }
                                   n                                        o
                                             2         2
     because the set                   (−2) , (−1)         , 02 , 12 , 22       is only a 3-element set (with ele-
     ments       02 , 12 , 22 ).
                       Thus, if you want to write down a sum with some of its
     entries equal, you still need to ensure that each of the addends gets a distinct
     index in the indexing set. In general, the sum of 5 numbers is not the sum of
     the elements of the set of these 5 numbers, because if some of these 5 numbers
     are equal, then the set “forgets” that they appear more than once.
   • The summation index does not always have to be a single letter. For instance,
     if S is a set of pairs, then we can write ∑ a( x,y) (meaning the same as
                                                                                ( x,y)∈S
      ∑ as ). Here is an example of this notation:
     s∈S
                                              x  1 1 1 2 2 2 3 3 3
                                   ∑          y
                                                = + + + + + + + + .
                                                 1 2 3 1 2 3 1 2 3
                           ( x,y)∈{1,2,3}2
  Here are some more examples, coming from more combinatorial questions:
  Example 1.2.4. (a) Let P ( A) denote the powerset of a set A (that is, the set of all
  subsets of A). Then, we can write the sum of the sizes of all subsets of {1, 2, 3}
  as follows:
       ∑       | f ( A)|
      f ∈B A
      =            |{1}|                +        |{1, 2}|           +             |{1, 2}|     +          |{2}|
                   | {z }                        | {z }                           | {z }                  | {z }
           corresponding to the             corresponding to the        corresponding to the       corresponding to the
                           !                                !                           !                          !
                       1 2                           1 2                               1 2                  1 2
            map                              map                            map                     map
                       1 1                           1 2                               2 1                  2 2
      = 1 + 2 + 2 + 1 = 6.
  (Here, we have written out each map in two-line   notation:
                                                            That is, the map
                                                     1 2
  sending 1 and 2 to a1 and a2 has been written as           .)
                                                     a1 a2
Enumerative Combinatorics: class notes                                                                     page 47
   • The expression                ∑             s2 stands for the sum of the squares of all odd
                             s∈{1,2,3,4,5,6};
                                s is odd
     elements of {1, 2, 3, 4, 5, 6}. In general, if S is a set, and if A (s) is a logical
     statement defined for each s ∈ S, then the notation ∑ as stands for the sum
                                                                              s∈S;
                                                                              A(s)
             ∑           as (that is, the sum of as not over all s ∈ S, but only over the ones
     s∈{t∈S | A(t)}
     which satisfy A (s)). For this sum to be well-defined, we do not need S to be
     finite; we only need the subset {t ∈ S | A (t)} to be finite (i.e., we need there
     to only be finitely many s ∈ S satisfying A (s)).
                             8
   • The expression ∑ i2 stands for the sum                      ∑          i2 . In general, if p and q are
                            i =5                             i ∈{5,6,7,8}
                                                     q
     two integers, then the notation ∑ ai stands for the sum                                ∑            ai . Here
                                                    i= p                             i ∈{ p,p+1,...,q}
     it should be kept in mind that the set { p, p + 1, . . . , q} is understood to be
     empty if p > q. (Be warned that some authors have different conventions for
     the latter case.)
                             q
     In the notation ∑ ai , the integers p and q are called the bounds of the summa-
                            i= p
     tion.
                                                      n
     Note that the summation sign ∑ (for some n ∈ N) is thus equivalent to
                                                     i =1
          ∑           , hence also to ∑ .
     i ∈{1,2,...,n}                     i ∈[n]
   • The summation sign                ∑      (where A and B are two sets) is shorthand for ∑ .
                                   f :A→ B                                                                   f ∈B A
     Thus, the result of Example 1.2.4 (b) could be rewritten as                          ∑      | f ( A)| = 6.
                                                                                       f :A→ B
   • Statements under the summation sign can be written out in words. For ex-
     ample, “     ∑      ” means the same as “ ∑ ”.
                  B is a subset of A                             B⊆ A
         In other words, we can always rewrite the sum ∑ as as its addend at plus
                                                                                       s∈S
         the sum of all remaining addends. This is called splitting off (or extracting) an
         addend from a sum. Particular cases of this identity are the identities
                        q                       q                                      q             q −1
                       ∑ ai = a p + ∑                   ai           and              ∑ ai = a q + ∑ ai
                      i= p                   i = p +1                                i= p            i= p
         that hold whenever p ≤ q. (They do not hold for p > q, because we cannot
         extract an addend from an empty sum.)
   • Splitting: Let S be a finite set. Let X and Y be two subsets of S such that
     X ∩ Y = ∅ and X ∪ Y = S. (Equivalently, X and Y are two subsets of S such
     that each element of S lies in exactly one of X and Y.) Let as be a number for
     each s ∈ S. Then,
                                  ∑ as = ∑ as + ∑ as .                         (26)
                                                    s∈S            s∈ X      s ∈Y
                                                                                                                    
         (The right hand side of this equality has to be understood as          ∑ as +
                                                                            s ∈ X
            ∑ as . In general, finite sums reach past “·” signs but not past “+” signs;
           s ∈Y                                                  
         thus, ∑ as b means ∑ ( as b), but ∑ as + b means ∑ as + b. This is consid-
                s∈S                 s∈S                      s∈S                           s∈S
         ered to be part of the PEMDAS convention, because finite sums are a form of
         addition. When in doubt, always use parentheses.)
         For example, we can apply (26) to S = {1, 2, 3, 4, 5} and X = {1, 3, 5} and
         Y = {2, 4}. We then obtain
                                 ∑           as =            ∑     as +     ∑       as ,         or, equivalently,
                             s∈{1,2,3,4,5}           s∈{1,3,5}            s∈{2,4}
               a1 + a2 + a3 + a4 + a5 = ( a1 + a3 + a5 ) + ( a2 + a4 ) .
                                  ∑ as = ∑                 as +     ∑        as             (27)
                                  s∈S             s∈S;              s∈S;
                                               s is even          s is odd
                            ∑ as =             ∑        as +         ∑            as .      (28)
                            s∈S             s∈S;                  s∈S;
                                         A(s) is true          A(s) is false
                                              ∑ a = |S| · a.                                (29)
                                              s∈S
     (That is, summing n many copies of a number a results in the number na.)
     Applying (29) to a = 1, we find
     In other words, the size of a finite set is a particular case of a finite sum. This
     trivial observation will prove rather useful to us below.
   • Splitting an addend: Let S be a finite set. For every s ∈ S, let as and bs be
     numbers. Then,
                            ∑ ( a s + bs ) = ∑ a s + ∑ bs .                   (31)
                                  s∈S                   s∈S          s∈S
     When S = {1, 2, . . . , n}, this becomes precisely the equality (20).
   • Factoring out: Let S be a finite set. For every s ∈ S, let as be a number. Also,
     let λ be a number. Then,
                                     ∑ λas = λ ∑ as .                            (32)
                                         s∈S                s∈S
     This is a generalization of the distributive law λ ( a + b) = λa + λb.
   • Zeroes sum to zero: Let S be a finite set. Then,
                                                ∑ 0 = 0.                                    (33)
                                                s∈S
Enumerative Combinatorics: class notes                                             page 50
   • Renaming the index: Let S be a finite set. Let as be a number for each s ∈ S.
     Then,
                                   ∑ as = ∑ at .
                                         s∈S           t∈S
     This is called renaming the summation index, and is justified by the fact that the
     summation index is a dummy variable.
                                      ∑ at = ∑ a f (s) .                              (34)
                                     t∈ T             s∈S
     The idea here is that the sum ∑ a f (s) contains the same addends as the sum
                                     s∈S
      ∑ at .
     t∈ T
     When we apply (34), we say that we are substituting f (s) for t in the sum
     ∑ at .
     t∈ T
     Applying (34) to at = 1, we obtain ∑ 1 = ∑ 1, which rewrites as | T | = |S|
                                               t∈ T          s∈S
     (because of (30)). This is precisely the bijection principle (Theorem 1.1.6).
     Thus, (34) generalizes the bijection principle.
     The equality (34) also shows that we can “turn a sum around”, in the sense
     that we have
                        a 1 + a 2 + · · · + a n = a n + a n −1 + · · · + a 1 (35)
     for any n ∈ N and any n numbers a1 , a2 , . . . , an . (This was used in the Second
     proof of Theorem 1.2.1.) Indeed, the left hand side of (35) can be rewrit-
     ten as ∑ at , whereas the right hand side can be rewritten as ∑ an+1−s =
               t∈[n]                                                       s∈[n]
      ∑ a f (s) , where f : [n] → [n] is the map that sends each s ∈ [n] to n + 1 − s.
     s∈[n]
     Since this latter map f : [n] → [n] is a bijection, we can use (34) (applied to
     S = [n] and T = [n]) to conclude that ∑ at = ∑ a f (s) ; but this is precisely
                                                  t∈[n]            s∈[n]
     the identity (35).
   • Substituting the index II: Let S and T be two finite sets. Let f : S → T be a
     bijection. Let as be a number for each s ∈ S. Then,
                                     ∑ a s = ∑ a f −1 ( t ) .                         (36)
                                    s∈S          t∈ T
     This is, of course, just (34) but applied to T, S and f −1 instead of S, T and f .
     We state it as a separate formula because we shall be using both versions.
Enumerative Combinatorics: class notes                                                                page 51
   • Splitting a sum by a value of a function: Let S and W be two finite sets. Let
     f : S → W be a map. Let as be a number for each s ∈ S. Then,
                                                ∑ as = ∑               ∑         as .                     (37)
                                                s∈S        w ∈W         s∈S;
                                                                      f (s)=w
         (There are two summation signs on the right hand side, signifying that we
         are taking a finite sum of finite sums.) This equality provides a way to split
         a sum ∑ as into several batches by distributing all possible values of the
                   s∈S
         summation index s into several “bins”45 , and then summing each batch of
         addends corresponding to a bin together and then summing the “bin totals”.
         For example, let us apply (37) to the 11-element set S = {−5, −4, . . . , 4, 5}
         and the 6-element set W = {0, 1, . . . , 5} and the map f : S → W that sends
         each s ∈ S to |s| ∈ W. We thus obtain
                                      ∑           as =         ∑                        ∑      as .
                              s∈{−5,−4,...,4,5}          w∈{0,1,...,5}    s∈{−5,−4,...,4,5};
                                                                              |s|=w
              a −5 + a −4 + · · · + a 4 + a 5
               = a 0 + ( a −1 + a 1 ) + ( a −2 + a 2 ) + ( a −3 + a 3 ) + ( a −4 + a 4 ) + ( a −5 + a 5 ) .
         Here, the “bins” are {0}, {−1, 1}, {−2, 2}, {−3, 3}, {−4, 4} and {−5, 5}, and
         the corresponding “bin totals” are a0 , a−1 + a1 , a−2 + a2 , a−3 + a3 , a−4 + a4
         and a−5 + a5 .
   • Splitting a sum into subsums: Let a finite set S be the union of k disjoint sets
     S1 , S2 , . . . , Sk . Let as be a number for each s ∈ S. Then,
                                                                k
                                                  ∑     as =   ∑ ∑             as .                       (38)
                                                  s∈S          w =1   s ∈ Sw
         (The right hand side can be rewritten in the somewhat more familiar form
          ∑ as + ∑ as + · · · + ∑ as .)
         s ∈ S1     s ∈ S2             s ∈ Sk
         It is easy to see that (38) follows from (37) (by setting W = {1, 2, . . . , k},
         and letting f : S → W be the map that sends each s ∈ S to the unique
         w ∈ {1, 2, . . . , k } for which s ∈ Sw ).
         Note that if we set as = 1 for each s ∈ S and recall the formula (30), then (38)
                                  k
         rewrites as |S| = ∑ |Sw | = |S1 | + |S2 | + · · · + |Sk |. Thus, we have recovered
                                w =1
         the sum rule (Theorem 1.1.3) as a particular case of (38).
45 The   “bins” are the elements of W here. Each value s ∈ S goes into bin f (s).
Enumerative Combinatorics: class notes                                                     page 52
   There are further rules, such as Fubini’s principle for the interchange of summation
signs. We will not state them yet in order to keep this section reasonably short.
   However, let us state an important application of summation signs in counting:
   Theorem 1.2.5 (The sum rule, in summation-sign form). Let S and W be two
   finite sets. Let f : S → W be a map. Then,
  Theorem 1.2.5 is called the sum rule, since it is a more flexible version of Theorem
1.1.3. Indeed, both theorems tell us how to compute the size |S| of a set S that has
been split into several subsets46 ; but Theorem 1.1.3 requires the latter subsets to be
numbered by 1, 2, . . . , k, whereas Theorem 1.2.5 only needs them to be indexed by
elements w of W.
   Example 1.2.6. Assume you have a finite set of socks, and each sock is either red
   or blue or green. Then,
46 In Theorem 1.1.3, the subsets are S1 , S2 , . . . , Sk ;     in Theorem 1.2.5,   the subsets are
   {s ∈ S | f (s) = w} for various w ∈ W.
Enumerative Combinatorics: class notes                                                                      page 53
   ∑       1=               ∑         1
   s∈S;          s∈{t∈S | f (t)=w}
 f (s)=w
                                                                                                          
                                                 ∑                                            ∑
                                                                                                         
                        since the sign “                 ” is shorthand for “                           ”
                                                                                                         
                                                  s∈S;                               s∈{t∈S | f (t)=w}
                                                f (s)=w
               = |{t ∈ S | f (t) = w}|
                     (by (30), applied to {t ∈ S | f (t) = w} instead of S)
               = |{s ∈ S | f (s) = w}|         (here, we have renamed the index t as s)
               = (# of s ∈ S satisfying f (s) = w) .                                (40)
  Definition 1.2.7. Let S be a finite set. For each s ∈ S, let as be a number (e.g., an
  integer or a rational number or a real number or a complex number).
    Then, ∏ as shall denote the product of the numbers as for all s ∈ S. This
                s∈S
  notation is read as “the product of as over all s ∈ S” or “the product of as for s
  ranging over S” or “the product of as where s runs through S”. The “∏” sign in
  this notation is called the product sign.
                           q
(that is, ∏ as and ∏ as ) and are defined in the same way. We only need to be
            s∈S;          i= p
            A(s)
careful in defining empty products correctly: While an empty sum was defined to
be 0, we must define an empty product (i.e., a product with no factors47 ) to be 1.
This is why, in particular, we have x0 = 1 for each x ∈ R. (Indeed, x m is defined as
    · · · x} whenever m ∈ N and x ∈ R. Thus, x0 = |xx {z
|xx {z                                                · · · x} = (empty product) = 1.)
m times                                                          0 times
                                                          n (n + 1) (2n + 1)
                                 12 + 22 + · · · + n2 =                      .
                                                                  6
                                                             n2 ( n + 1)2
                                    13 + 23 + · · · + n3 =                .
                                                                   4
a combinatorial argument that did not rely on any pictures. Such arguments can be
made in any number of dimensions. And indeed, such proofs can be found for Propo-
sition 1.2.8 and for Proposition 1.2.9. For such proofs, see the math.stackexchange thread
https://math.stackexchange.com/questions/95047/ .
   Now, a question suggests itself: Are Theorem 1.2.1, Proposition 1.2.8 and Propo-
sition 1.2.9 just the first three pieces in a sequence of formulas? In other words,
given a positive integer k, is there an explicit formula for 1k + 2k + · · · + nk ? Hav-
ing seen the answers for k = 1, k = 2 and k = 3, we would expect the right hand
side of such a formula to be a (k + 1)-st degree polynomial in n.
   Let us first reword the question. Recall (from Subsection 1.2.2) that we are using
the shorthand notation
                       q
                     ∑ ai               for          ∑             a i = a p + a p +1 + · · · + a q
                     i= p                      i ∈{ p,p+1,...,q}
whenever p and q are two integers and a p , a p+1 , . . . , aq are arbitrary numbers. Thus,
the sum that we are interested in, namely 1k + 2k + · · · + nk , can be rewritten as
 n
∑ ik .
i =1
     Let us list the answers to our question for small values of k:
                 n
                                  n ( n + 1)
                 ∑ i1 =                2
                                                         (by Theorem 1.2.1) ;
                i =1
                  n
                                  n (n + 1) (2n + 1)
                 ∑ i2 =                   6
                                                                       (by Proposition 1.2.8) ;
                i =1
                  n
                     n2 ( n + 1)2
                ∑i =       3
                           4
                                                            (by Proposition 1.2.9) ;
                i =1
                 n                                     2−1
                                                           
                       n ( 2n + 1 ) ( n + 1 ) 3n + 3n
                ∑ i4 =                    30
                                                             ;
                i =1
                  n    n2 (n + 1)2 2n + 2n2 − 1
                                                   
                ∑i = 5
                                      12
                                                     ;
                i =1
                               ....
(We can prove each of these formulas by induction on n once we know how it looks
like.) For now, we don’t see much of a pattern. However, there is one – once we
rewrite the right hand sides in terms of binomial coefficients. We will give a more
general definition of binomial coefficients later, but for now let us just set
                             m ( m − 1) ( m − 2) · · · ( m − k + 1)
                      
                       m
                          =                                                     (41)
                        k           k ( k − 1) ( k − 2) · · · 1
for all m ∈ R and k ∈ N. (Here, on the right hand side, the numerator is a
product of k factors, the first of which is m and which decrease by 1 from each
Enumerative Combinatorics: class notes                                                                page 56
factor to the next; the denominator is a similar product, but starting at k instead
of m.) Furthermore, if k and m are two nonnegative integers, then let us use the
notation sur (k, i ) for the # of all surjective maps from [k ] to [i ]. (Recall that [k ]
stands for {1, 2, . . . , k }; in particular, [0] = ∅.) Now, we can answer our question
by the following formula:
                                        n         k              
                                                            n+1
                                       ∑ i = ∑ sur (k, i) · i + 1 .
                                            k
                                       i =1  i =0
      We will prove this theorem in Section 2.5. For now, let us say a few things about
it.
   First of all, why does Theorem 1.2.10 answer our question? Why does its right
hand side count as an explicit answer? Didn’t we just rewrite a finite sum as
another finite sum (a more complicated one to boot)? In a sense, yes; but if k is
fixed, then the sum on the right hand side has a fixed number of addends (namely,
k + 1), so it can indeed count as explicit, whereas the left hand side has n addends.
To illustrate this point, let us see how Proposition 1.2.8 can be straightforwardly
recovered from Theorem 1.2.10.
   We will need to know the numbers sur (2, i ) for all i ∈ {0, 1, 2}, so let us agree
on a notation for maps between finite sets:
      Definition 1.2.11. Let X be a finite set, and let Y be any set. Assume that X =
      { x1 , x2 , . . . , xk } for some distinct elements x1 , x2 , . . . , xk . Let y1 , y2 , . . . , yk be any
      k elements of Y (not necessarily distinct). Then, the mapfrom X to Y that sends                     
                                                                                  x1 x2 · · · x k
      x1 , x2 , . . . , xk to y1 , y2 , . . . , yk , respectively, will be called                            .
                                                                                  y1 y2 · · · y k
         This is called the two-line notation for maps.
                            3} and Y = Z,
  For example, if X = {1, 2,                   the map that sends each m ∈ X
                                            then
                                1 2 3             1 2 3
to m2 ∈ Z can be written as      2   2   2   =              in two-line notation. It
                               1 2 3             1 4 9
                       
                         2 1 3
can also be written as              and in four other ways, since we have freedom
                         4 1 9
to decide in which order we list the elements of X.
  The two-line notation makes it easy to see whether a map is injective or surjective:
With this in hand, we can easily compute sur (2, 0), sur (2, 1) and sur (2, 2):
   • There exist no maps [2] → [0] (since [0] = ∅ is the empty set, so there is
     nowhere to map 1 ∈ [2] to). Thus, a fortiori, there exist no surjective maps
     [2] → [0]. Hence, sur (2, 0) = 0. (Similarly, sur (k, 0) = 0 for all k > 0.)
   • There is only one map [2] → [1], namely  themap that sends both 1 and 2 to 1.
                                              1 2
     (In two-line notation, it is written as        .) This map is surjective. Hence,
                                              1 1
     there is exactly 1 surjective map [2] → [1]. Hence, sur (2, 1) = 1. (Similarly,
     sur (k, 1) = 1 for all k > 0.)
   • There
            are
               four
                   maps  [2] → [ 2]. In 
                                            two-linenotation, they are written as
        1 2         1 2         1 2           1 2
                ,         ,             and          . The second and the third
        1 1         1 2         2 1           2 2
     among them are surjective (since {1, 2} and {2, 1} both equal [2]), whereas
     the first and the fourth are not. Hence, there are exactly 2 surjective maps
     [2] → [2]. Hence, sur (2, 2) = 2.
                                         n! = 1 · 2 · · · · · n.
                                                                                         n
  (Using the product sign as defined in Definition 1.2.7, this rewrites as n! = ∏ i.)
                                                                                        i =1
     We shall refer to n! as “n factorial”.
   We have agreed that empty products are defined to be 1. Thus, the above defini-
tion of 0! yields
                    0! = 1 · 2 · · · · · 0 = (empty product) = 1.
  Definition 1.3.1 yields the following values for the first few factorials:
                           0!   = 1,
                           1!   = 1,
                           2!   = 1 · 2 = 2,
                           3!   = 1 · 2 · 3 = 6,
                           4!   = 1 · 2 · 3 · 4 = 24,
                           5!   = 1 · 2 · 3 · 4 · 5 = 120,
                           6!   = 1 · 2 · 3 · 4 · 5 · 6 = 720,
                           7!   = 1 · 2 · 3 · 4 · 5 · 6 · 7 = 5 040,
                           8!   = 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8 = 40 320.
  Factorials can be computed recursively:
  Proposition 1.3.2. If n is a positive integer, then n! = (n − 1)! · n.
Proof of Proposition 1.3.2. Let n be a positive integer. Then, n − 1 ∈ N, so that
Definition 1.3.1 yields (n − 1)! = 1 · 2 · · · · · (n − 1). But Definition 1.3.1 also yields
               n! = 1 · 2 · · · · · n = (1 · 2 · · · · · (n − 1)) ·n = (n − 1)! · n.
                                        |            {z         }
                                                =(n−1)!
Enumerative Combinatorics: class notes                                           page 59
• If k ∈ N, then we set
                               n ( n − 1) ( n − 2) · · · ( n − k + 1)
                         
                          n
                             =                                        .             (42)
                          k                     k!
            / N, then we set
     • If k ∈                                 
                                              n
                                                 = 0.                               (43)
                                              k
              
              n
     We call     a binomial coefficient, and we refer to it as “n choose k”.
              k
                                                                       
                                                                         n
   Some authors use notations like        Ckn    nC
                                                 ork     or n Ck for       .
                                                                         k
   We shalllater
                 see why the words “binomial coefficient” and “choose” are appro-
             n
priate for       .
              k
   Definition 1.3.3 does not contradict our earlier definition (41) of binomial co-
efficients (but merely extends it to a more general setting). Indeed, the product
k (k − 1) (k − 2) · · · 1 in the denominator of (41) is precisely the k! in the denomina-
tor of (42) (since k! = 1   · 2
                                · · · · · k = k (k − 1) (k − 2) · · · 1).
                             n
  Caution: The notation          for a binomial coefficient risks getting confused for the two-
                              k
line notation for a map (if the domain of the map is a 1-element set) or for a column vector
with 2 entries. In practice, this kind of confusion rarely happens, but its possibility should
be kept in mind.
         √      √ √          √           √             √ √     
            2        2    2−1        2−2 ···      2−2+1         2   2−1
                =                                          =              .
           2                           2!                          2
                                                     √
     (h) The equality (43) (applied to n = 2 and k = 2) yields
                                                 √
                             √2 = 0,                  / N.
                                              since 2 ∈
                               2
                         nk
                    
                    n
                       =              for all numbers n and all k ∈ N.                (48)
                    k    k!
Class of 2019-10-02
                                                                             k =0        k =1         k =2          k =3
                                                                             .           .            .             .
n   = −3     →                                                          1           −3           6            −10
n   = −2     →                                                   1           −2           3           −4
n   = −1     →                                             1            −1          1           −1             1
n   =0       →                                       1           0            0           0               0
n   =1       →                                  1          1            0           0            0             0
n   =2       →                            1          2           1            0           0               0
n   =3       →                      1           3          3            1           0            0             0
n   =4       →                 1          4          6           4            1           0               0
n   =5       →           1          5          10         10            5           1            0             0
n   =6       →      1          6         15          20         15          1 6      0
                                                                             
                                                                              n
  Just by staring at this table, you will discover many properties of           . For
                                                                              k
example, all the zeroes in the right half of it suggest the following fact:
                                                                      
                                                                      n
    Proposition 1.3.6. Let n ∈ N and k ∈ R be such that k > n. Then,     = 0.
                                                                      k
                                 n ( n − 1) ( n − 2) · · · ( n − k + 1)
                         
                          n
                               =                                        .       (49)
                          k                       k!
But n ∈ {0, 1, . . . , k − 1} (since n ∈ N and k ∈ N and k > n). Hence, one of the
factors of the product n (n − 1) (n − 2) · · · (n − k + 1) is n − n = 0. Therefore, the
product n (n − 1) (n − 2) · · · (n − k + 1) must be 0 (because if one ofthefactors of
                                                                          n      0
a product is 0, then the whole product is 0). Thus, (49) rewrites as          = . In
                                                                        k      k!
                n
other words,           = 0. This proves Proposition 1.3.6.
                 k
    This proof might remind you of the math joke “simplify ( x − a) ( x − b) · · · ( x − z)”.        48
  Another pattern that you might guess from the table above is that the binomial
coefficients in the “negative rows” (i.e., corresponding to n = −1, n = −2 and
further above) repeat the ones you find in the nonnegative rows up to sign. More
precisely:
                            −n           k n+k−1
                                                  
                                  = (−1)               .                                  (50)
                             k                  k
                −n           (−1)k · ((n + k − 1) (n + k − 2) (n + k − 3) · · · n)
                    
                         =                                                         .      (52)
                 k                                   k!
  On the other hand, (42) (applied to n + k − 1 instead of n) yields
      n+k−1         ( n + k − 1) ( n + k − 2) ( n + k − 3) · · · ( n + k − 1 − k + 1)
              
                 =
          k                                        k!
                    ( n + k − 1) ( n + k − 2) ( n + k − 3) · · · n
                 =                                                 .
                                         k!
Enumerative Combinatorics: class notes                                                  page 64
          k n+k−1                   ( n + k − 1) ( n + k − 2) ( n + k − 3) · · · n
                      
     (−1)                = (−1)k ·
                  k                                      k!
                             (−1)k · ((n + k − 1) (n + k − 2) (n + k − 3) · · · n)
                            =                                                      .
                                                     k!
                                         −n            k n+k−1
                                                                 
Comparing this with (52), we obtain            = (−1)                 . Thus, Proposi-
                                          k                    k
tion 1.3.7 is proven in Case 2.
  Proposition 1.3.7 and Proposition 1.3.6 show that muchofour above table of
                                                              n
binomial coefficients is redundant. In order to know all          with n ∈ Z and
                                                            k
                                           n
k ∈ N, it suffices to tabulate the values     for n ∈ N and k ∈ {0, 1, . . . , n}. Let us
                                           k
do this here for n ∈ {0, 1, . . . , 8}:
                                                          k =0
                                                          .
                                                                 k =1
n=0     →                                            1           .
                                                                        k =2
n=1     →                                       1          1            .
                                                                               k =3
n=2     →                                  1         2            1            .
                                                                                      k =4
n=3     →                             1         3          3             1            .
                                                                                             k =5
n=4     →                        1         4         6            4             1            .
                                                                                                    k =6
n=5     →                   1         5         10        10             5             1            .
                                                                                                           k =7
n=6     →              1         6         15        20          15             6             1            .
n=7     →         1         7         21        35        35            21             7             1
n=8 → 1 8 28 56 70 56 28 8 1
bers). Explicitly:
                                 n ( n − 1) ( n − 2) · · · ( n − k + 1)
                            
                            n
                               =
                            k                      k!
                                 n ( n − 1) ( n − 2) · · · ( n − k + 1)
                               =                                                         (53)
                                              ( k − 1) ! · k
                                      (since k! = (k − 1)! · k)
and
                n−1           (n − 1) (n − 2) (n − 3) · · · ((n − 1) − k + 1)
                     
                          =
                 k                                     k!
                              ( n − 1) ( n − 2) ( n − 3) · · · ( n − k )
                          =
                                                 k!
                              ((n − 1) (n − 2) (n − 3) · · · (n − k + 1)) · (n − k)
                          =
                                                          k!
                              ((n − 1) (n − 2) (n − 3) · · · (n − k + 1)) · (n − k)
                          =
                                                    ( k − 1) ! · k
                                  (since k! = (k − 1)! · k)
                              ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1) n − k
                          =                                                ·             (54)
                                               ( k − 1) !                     k
and
                n−1         (n − 1) (n − 2) (n − 3) · · · ((n − 1) − (k − 1) + 1)
                     
                          =
                k−1                                 ( k − 1) !
                            ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1)
                          =                                               .              (55)
                                             ( k − 1) !
Enumerative Combinatorics: class notes                                                         page 67
  n−1          n−1
                  
          +
  k−1             k
   ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1) ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1) n − k
=                                                +                                            ·
                     ( k − 1) !                                   ( k − 1) !                     k
   ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1)      n−k
                                                           
=                                                  1+
                     ( k − 1) !                          k
                                                 |    {z     }
                                                       n
                                                     =
                                                       k
   ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1) n
=                                                ·
                     ( k − 1) !                    k
   n · ((n − 1) (n − 2) (n − 3) · · · (n − k + 1))
=
                       ( k − 1) ! · k
   n ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1)
=
                    ( k − 1) ! · k
   n ( n − 1) ( n − 2) ( n − 3) · · · ( n − k + 1)
=                                                        (since (k − 1)! · k = k!) ;
                         k!
     n
=                (by (53)) .
      k
  Theorem 1.3.9 (Factorial formula for the binomial coefficients). Let n ∈ N and
  k ∈ N be such that k ≤ n. Then,
                                
                                 n           n!
                                    =                 .
                                 k     k! · (n − k )!
Proof of Theorem 1.3.9. Multiplying the equality (42) with k! · (n − k )!, we obtain
                                         n ( n − 1) ( n − 2) · · · ( n − k + 1)
                    
                    n
   k! · (n − k)! ·     = k! · (n − k)! ·
                    k                                     k!
                       =         (n − k)!          · (n (n − 1) (n − 2) · · · (n − k + 1))
                                 | {z }              |                   {z              }
                                  =1·2·····(n−k)                   =(n−k+1)·(n−k+2)·····n
                           (by the definition of (n−k)!)   (here, we have turned the product around)
                        = (1 · 2 · · · · · (n − k)) · ((n − k + 1) · (n − k + 2) · · · · · n)
                        = 1 · 2 · · · · · n = n!
Enumerative Combinatorics: class notes                                                   page 68
                                                                             
                                                                 n             n
(since n! is defined to be 1 · 2 · · · · · n). Solving this for     , we find     =
                                                                 k             k
      n!
              . This proves Theorem 1.3.9.
k! · (n − k)!
   Warning: Whenit     applies, Theorem 1.3.9 provides a simple and highly conve-
                       n
nient formula for         . However, Theorem 1.3.9 only applies when n ∈ N and
                       k
                                                                              −3
                                                                             
k ∈ N and k ≤ n. Thus, you cannot use Theorem 1.3.9 to compute                      or
                                                                           5
  1/3           π
          or √ . (There is a generalization of the factorial called the Gamma
    4            2
function, which does not really alleviate this problem: it would make the right
hand side of Theorem 1.3.9 well-defined most of the time, but the equality would
still not be true in general.)                              
                                                            n
   Some authors use Theorem 1.3.9 as a definition of            . But, as we just saw,
                                                            k
such a definition would only work in the case when n      ∈N  and k ∈ N and k ≤ n,
                                                            n
so it lacks the general applicability of our definition of     .
                                                            k
   Lemma
           1.3.10. Let n ∈ N and k ∈ R be such that k ∈               / {0, 1, . . . , n}. Then,
     n
         = 0.
     k
                                                                 
                                                                 n
Proof of Lemma 1.3.10. If k ∈    / N, then the claim (that           = 0) follows immediately
                                                                 k
from (43). Thus, for the rest of this proof, we WLOG assume that we do have
k ∈ N. Combining this with k ∈          / {0, 1, . . . , n}, we obtain k ∈ N \ {0, 1, . . . , n} =
{n +
     1, n + 2, n + 3, . . . } . Hence,  k ≥ n + 1 > n. Thus, Proposition 1.3.6 yields
  n
       = 0. This proves Lemma 1.3.10.
  k
  Theorem 1.3.11 (Symmetry of the binomial coefficients). Let n ∈ N and k ∈ R.
  Then,                                   
                                n        n
                                    =          .
                                k      n−k
Class of 2019-10-04
49 because
         otherwise, we would have n − k ∈ {0, 1, . . . , n} and thus n − (n − k) ∈ {0, 1, . . . , n}, which
   would contradict n − (n − k) = k ∈
                                    / {0, 1, . . . , n}
Enumerative Combinatorics: class notes                                           page 70
   Example 1.3.13. (a) Let n = 4 and k = 2 and S = {1, 2, 3, 4}. Then, the 2-element
   subsets of S are
                   {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4} and {3, 4}. The # of these
                   4
   subsets is 6 =     , which is exactly what Theorem 1.3.12 predicts.
                   2
     (b) Now, let k = 5 instead (while n is still 4, and S is still {1, 2, 3, 4}). Then,
   there are no 5-element subsets of S,   since
                                                   S only has 4 elements. Thus, the #
                                           4
   of these 5-element subsets is 0 =           , which is exactly what Theorem 1.3.12
                                           5
   predicts.
                                        
                                         n
  Theorem 1.3.12 is the reason why            is called “n choose k”: It is the number of
                                         k
ways to choose k distinct elements (without an order) from n given elements. The
k-element subsets of S are called the k-combinations   of S.
                                                       n
  Warning: Theorem 1.3.12 says nothing about               when n ∈/ N.
                                                       k
  Before we prove Theorem 1.3.12, let us state a simple lemma:
                                       
                                       0
   Lemma 1.3.14. Let k ∈ R. Then,           = [ k = 0].
                                       k
1.3.12 begins with the words “For all n ∈ N and k ∈ R and any n-element set S”.
Thus we are proving the same theorem, but we have the freedom to change our
value of k in the proof.)
  We proceed by induction on n:
  Induction base: If S is a 0-element set, then S = ∅ and thus
(# of k-element subsets of S)
= (# of k-element subsets of ∅)
   (                                                                   
     1, if k = 0;          since the empty set ∅ has only one subset,
=
     0, if k 6= 0                namely the 0-element subset ∅
                                                                    (              !
                                                                      1, if k = 0;
= [ k = 0]         since the definition of [k = 0] yields [k = 0] =
                                                                      0, if k 6= 0
    
     0
=              (by Lemma 1.3.14)
     k
 each k ∈ R. In other words, for any k ∈ R and any 0-element set S, we have
for
  0
      = (# of k-element subsets of S). Thus, Theorem 1.3.12 is proven for n = 0.
  k
This completes the induction base.
   Induction step: Let m ∈ N. Assume (as the induction hypothesis) that Theorem
1.3.12 holds for n = m. (This means “for n = m and for all values of k ∈ R and all
n-element sets S”, because k and S are not fixed. This is important, since we will
later apply the induction hypothesis to two different values of k.)
   Let k ∈ R. Let S be an (m + 1)-element set. We must prove that
                           
                        m+1
                              = (# of k-element subsets of S) .
                          k
  The set S is an (m + 1)-element set; thus, its size is |S| = m + 1 ≥ 1 > 0. Hence,
the set S is nonempty, i.e., there exists a t ∈ S. Fix such a t.
  Now, we shall call a subset of S
Thus, each subset of S is either red or green (but not both at the same time). Thus,
by the sum rule, we have
    (# of k-element subsets of S)
    = (# of k-element red subsets of S) + (# of k-element green subsets of S) .
We shall now compute the two addends on the right hand side.
Enumerative Combinatorics: class notes                                                          page 72
  The green subsets of S are the subsets of S that don’t contain t. In other words,
the green subsets of S are exactly the subsets of S \ {t}. Hence,
  But S is an (m + 1)-element set, and thus S \ {t} is an m-element set (since t ∈ S).
Hence, our induction hypothesis shows that Theorem 1.3.12 can be applied to m
and S \ {t} instead of n and S. We thus obtain
                     
                      m
                          = (# of k-element subsets of S \ {t}) .
                      k
Comparing this with (56), we find
                                                                 
                                                                 m
                          (# of k-element green subsets of S) =     .                               (57)
                                                                 k
  What about the red subsets?
  Informally, a similar argument works: The red subsets of S are not exactly the
subsets of S \ {t}, but they “correspond to” the latter in a specific way. Namely,
since the red subsets of S are required to contain t, the only “information” that a
red subset of S really “carries” is what other elements (other than t) it contains. In
other words, each red subset R of S “corresponds to” the subset R \ {t} of S \ {t}.
Note that this correspondence changes the size of the subset: Namely, if R was a
k-element red subset of S, then R \ {t} will be a (k − 1)-element subset of S \ {t}.
Thus, the k-element red subsets of S “correspond to” the (k − 1)-element subsets
of S \ {t}.
  Formally, this can be restated as follows: The map
It is easy to verify that both the map f and its alleged inverse g are well-defined50 ,
and are indeed mutually inverse51 .) Therefore, the bijection principle (applied to
50 This   means proving the following claims:
In other words,
  But S \ {t} is an m-element set. Hence, our induction hypothesis shows that
Theorem 1.3.12 can be applied to m, k − 1 and S \ {t} instead of n, k and S. We
thus obtain
                    
                  m
                       = (# of (k − 1) -element subsets of S \ {t}) .
                 k−1
     (# of k-element subsets of S)
     = (# of k-element red subsets of S) + (# of k-element green subsets of S)
        |             {z             } |                 {z              }
                        m                                    m
                   =                                     =
                      k−1                                    k
                         (by (59))                                     (by (57))
                   
               m     m
      =           +     .                                                              (60)
              k−1    k
                      ( m + 1) − 1     ( m + 1) − 1
                                                          
           m+1                                             m      m
                  =                 +                =          +
             k            k−1                k           k−1      k
  Now, forget that we fixed k and S. We thus have shown that every k ∈ R and
every (m + 1)-element set S satisfy
                          
                     m+1
                              = (# of k-element subsets of S) .
                        k
In other words, Theorem 1.3.12 holds for n = m + 1. This completes the induction
step, and thus the proof of Theorem 1.3.12.
[A ∨ B ∨ C] = [A] + [B] + [C] − [A] [B] − [A] [C] − [B] [C] + [A] [B] [C] .
  In order to prove this theorem, it is perhaps easiest to start with the case when
n ∈ N, which we can declare a lemma:
                                                
                                                 n
  Lemma 1.3.17. Let n ∈ N and k ∈ Z. Then,          ∈ N.
                                                 k
Proof of Lemma 1.3.17. Let S = {1, 2, . . . , n}. Then, S is an n-element set. Hence,
Theorem 1.3.12 yields
     
       n
           = (# of k-element subsets of S) = |{all k-element subsets of S}| ∈ N
       k
(since the size of any finite set is ∈ N). This proves Lemma 1.3.17.
Enumerative Combinatorics: class notes                                                       page 75
                                                                              
                                                                              p
  Theorem 1.3.18. Let p be a prime. Let k ∈ {1, 2, . . . , p − 1}. Then, p |     .
                                                                              k
   Theorem 1.3.18        that if p is a prime, then all entries in the p-th row of Pascal’s
                     says                                                              
                      n                                                                 p
triangle (i.e., all      with n = p) are divisible by p, except for the two entries
                    k                                                                 0
       p
and         (which are equal to 1). This property actually characterizes primes: If
       p
n > 1 is a composite integer (i.e., not a prime), then at least one entry in the n-th
             triangle (except for the entries equal to 1) is not divisible by n. For
row of Pascal’s
             4
example,          = 6 is not divisible by 4.
             2
   We shall not prove Theorem 1.3.18 here. See, e.g., [Vorobi02, §2.9] or [19s, The-
orem 2.17.19] for a proof. We shall likewise not prove the following two proposi-
tions, which provide two quick recursive algorithms for telling whether a binomial
coefficient is even or odd:
                 Let 
  Proposition 1.3.19.    a ∈N and b ∈ N. Then:
                  2a       a
    (a) We have        ≡     mod 2.
                2b      b  
                  2a + 1      a
    (b) We have           ≡      mod 2.
                 2b         b
                    2a
    (c) We have           ≡ 0 mod 2.
                2b + 1   
                  2a + 1      a
    (d) We have           ≡      mod 2.
                  2b + 1      b
but replace every odd entry with a “∗” and every even entry with an empty space:
                                                           k =0
                                                           .
                                                                  k =1
n=0     →                                             ∗           .
                                                                         k =2
n=1     →                                        ∗          ∗            .
                                                                                k =3
n=2     →                                   ∗                      ∗            .
n=3     →                              ∗         ∗          ∗             ∗
n=4     →                         ∗                                              ∗
n=5     →                    ∗         ∗                                  ∗            ∗
n=6     →               ∗                   ∗                      ∗                       ∗
n=7     →          ∗         ∗         ∗         ∗          ∗             ∗            ∗         ∗
n=8     →     ∗                                                                                      ∗
If you are familiar with some fractals, you might recognize this picture as a (fi-
nite step towards) the Sierpinski triangle, with the “∗”s corresponding to the non-
removed points in the triangle. And this is indeed the case: For any r ∈ N, the first
2r rows of Pascal’s triangle (i.e., the rows from n = 0 to n = 2r − 1) form the image
obtained after r steps in the construction of the Sierpinski triangle. This can be
proved by induction on r, and the induction
                                               step requires understanding how the
                                         n
                                            with n ∈ 2r , 2r + 1, . . . , 2r+1 − 1 is con-
                                                       
parity of the binomial coefficients
                                         k              
                                                         n
nected with the parity of the binomial coefficients         with n ∈ {0, 1, . . . , 2r − 1}.
                                                         k
Proposition 1.3.20 yields an easy answer to this question.
   Here are two more results we shall not prove:
 Elementary proofs of Theorem 1.3.21 and Theorem 1.3.22 can be found in [Grinbe17].
Note that Theorem 1.3.21 generalizes Proposition 1.3.19.
  Remark 1.3.23. Lucas’s congruence has the following consequence: Let p be a
  prime. Let a, b ∈ N. Write a and b in base p as follows:
                           a = a k p k + a k −1 p k −1 + · · · + a 0 p 0   and
                           b = bk pk + bk−1 pk−1 + · · · + b0 p0
  (This can be easily proven by induction on k, using Theorem 1.3.21 in the in-
                                                                     a
  duction step.) This allows for quick computation of remainders of      modulo
                                                                     b
  prime numbers.
  See [Mestro14] and [Granvi05] for overviews of more complicated divisibilities
and congruences for binomial coefficients.
                       
                       n
  This is why the         are called the “binomial coefficients” – they appear as
                       k
coefficients in the binomial formula.
  Example 1.3.25. If n = 3, then the claim of Theorem 1.3.24 becomes
                       3 
                         3 k 3− k
        ( x + y) = ∑
                3
                            x y
                   k =0
                         k
                                                                
                      3    0   3−0    3     1   3−1     3 2 3−2       3 3 3−3
                 =        x y      +       x y       +      x y    +      x y
                      0  |{z} |{z}    1   |{z} |{z}     2     |{z}    3     |{z}
                   |{z} =1 =y3             = x                 =y
                                     |{z}       = y2   |{z}          |{z}    =1
                       =1                      =3                     =3           =1
                       3          2        2        3
                    = y + 3xy + 3x y + x .
Enumerative Combinatorics: class notes                                                          page 79
Proof of Theorem
            1.3.24. Let me first “simplify” the   claim: I will rewrite the finite
        n  n k n−k                                 n k n−k
sum ∑          x y    as the infinite sum ∑          x y     (that is, a sum over all
      k =0 k                                k ∈Z k
integers k).
  In order to do so, I need to justify two things:
                                                     
                                                      n k n−k
   • I need to explain why the infinite sum ∑            x y     is well-defined. (We
                                                k ∈Z k
      have seen why finite sums are well-defined in Subsection 1.2.2, but infinite
      sums are a different beast. You can easily write down nonsensical infinite
      sums like ∑ 1 = 1 + 1 + 1 + · · · or ∑ k = 0 + 1 + 2 + 3 + · · · that will
                    k ∈N                                k ∈N
      quickly lead you into contradiction-land. If we want to use an infinite sum,
      we thus have to explain what it means.)
                                                                                 
                                                                             n   n k n−k
   • I need to explain why this infinite sum equals the finite sum ∑                 x y .
                                                                           k =0 k
                                                                           
                                                                            n k n−k
  Let me begin with the first justification: Why is the sum ∑                   x y     well-
                                                                    k ∈Z k
defined?
  If you think about this question very carefully, you       will
                                                                discover that there is
                                                             n k n−k
another question underneath it: Why are the addends              x y      of this sum well-
                                                             k
defined? This is clear when k ∈ {0, 1, . . . , n}, because in this case both exponents k
and n − k are nonnegative integers. But if k < 0 or k > n, one of these exponents
will be negative, and this may cause trouble if x or y is 0 (because 0 j is undefined
when j is negative). We fix this problem by decree: We just decree that an ex-
pression of the form ab is always to be understood as 0 when a = 0, even if b is
undefined. Thus, 0 · 0−1 = 0, despite 0−1 being undefined.54                 
                                                                               n k n−k
  Having convinced ourselves that the addends of the sum ∑                        x y    are
                                                                       k ∈Z k
well-defined, we can now discuss the existence of the sum itself. Let us look at the
case n = 3. In this case, this sum has the form
                                   y3 + 3xy2 + 3x2 y + |{z}
           |· · · + 0{z+ 0 + 0} + |{z}                  x3 + 0| + 0 +{z0 + · · }· ,
                                        |{z}   |{z}
               addends          addend    addend     addend    addend          addends
               for k<0          for k=0   for k=1    for k=2   for k=3         for k>3
54 Stillskeptical? Alright, there are a few more things to check. Conventions like this may lead
    to errors if applied improperly; for example, after having made this particular convention, we
    cannot also decree aa−1 to always equal 1 when a−1 is potentially undefined (since this would
    lead to 0 · 0−1 = 1 6= 0). We need to check what exactly we are going to do with our convention.
    This is easy: The only situation to which we will apply our ab = 0 convention is when a = 0 and
    b = x k yn−k ,and it is 
                             easy to check that the only
                                                      properties
                                                                 we are going to use from this notation
    are that x · ax k yn−k = ax k+1 yn−k and y · ax k yn−k = ax k yn−k+1 and a1 b + a2 b = ( a1 + a2 ) b;
    obviously, all three of these properties are true when a = 0 (resp. a1 = 0 or a2 = 0), even if the
    other factors are undefined.
Enumerative Combinatorics: class notes                                               page 80
                                                   
                                                    n k n−k
because Lemma 1.3.10 renders all addends              x y   with k ∈
                                                                   / {0, 1, . . . , n} equal
                                                    k
to 0. This is an infinite sum, but only finitely many of its addends are nonzero.
Thus, it is clear how to give it a meaningful value: Just add the nonzero addends
together and drop the zero addends. The philosophy behind this is that zero ad-
dends are not supposed to contribute to sums (no matter how many of them are
present): for example, 0 + 0 + 0 + 0 + · · · = 0.
   The same is true for any n ∈ N. Indeed, for any given n ∈ N, wecan        easily see
                                                                           n k n−k
from Lemma 1.3.10 that the only nonzero addends in the sum ∑                    x y       are
                                                                     k ∈Z k
the ones for which k ∈ {0, 1, . . . , n} (which is not saying that all of these addends
must be nonzero). Hence, this sum has only finitely many nonzero addends, and
thus is well-defined.                                               
                                                                 n   n k n−k
   This also explains why this sum equals the finite sum ∑               x y : Indeed,
                                                               k =0 k
the only difference between the infinite and the finite sum is the presence of the
addends with k ∈   / {0, 1, . . . , n}; but these addends do not contribute anything,
because they all equal 0. Hence, the two sums are equal. In other words,
                                                 n  
                                     n k n−k          n
                           ∑ k x y = ∑ k x k yn−k .                                      (61)
                          k ∈Z                   k =0
in this case). Hence, (62) holds if n = 0. This completes the induction base.
  Induction step: Fix m ∈ N. Assume that (62) holds for n = m. We must prove that
(62) holds for n = m + 1.
Enumerative Combinatorics: class notes                                  page 81
                         ( m + 1) − 1     ( m + 1) − 1
                                                  
              m+1
                     =                  +
               k             k−1                k
                            (by Theorem 1.3.8 (applied to n = m + 1))
                                
                           m         m
                     =           +                                         (64)
                         k−1          k
Enumerative Combinatorics: class notes                                                              page 82
   It is instructive to try and prove Theorem 1.3.24 without taking the detour through
infinite sums that we did in our above proof. Such a proof would actually be
slightly shorter, but not by much: We would avoid having to explain why an in-
finite sum is well-defined (and what it means), but we would have to jump a few
extra hurdles in our computation. Namely, instead of (65), we would get the equal-
ity
                                  m                 m  
                                     m k +1 m − k        m k m − k +1
                   ( x + y) = ∑
                            m
                                        x y       +∑        x y       .
                                k =0
                                     k              k =0
                                                         k
Hence, instead of (67), we would get the equality
                               m +1                       m  
                                         m                     m k m +1− k
                         m
                 ( x + y) =    ∑        k−1
                                               k m +1− k
                                              x y        +∑
                                                               k
                                                                  x y
                               k =1                       k =0
  m +1                      m +1                             
            m                          m                      m
   ∑       k−1
                  k m +1− k
                 x y        = ∑
                                     k − 1
                                              k m +1− k
                                             x y        −
                                                            0 − 1
                                                                    x 0 y 0+1− k
   k =1                       k =0                        | {z }
                                                                =0
                                                             (by (43))
                                                                               
                                        here, we extended the sum by adding an
                                     extra addend for k = 0, and then promptly 
                                             subtracted this new addend back
                               m +1        
                                        m
                             = ∑              x k y m +1− k
                               k =0
                                      k − 1
Enumerative Combinatorics: class notes                                               page 84
and
   m
        m k m +1− k m +1 m k m +1− k
                                                 
                                                   m
  ∑ k xy           = ∑
                           k
                              x y    −
                                                  m+1
                                                                  x m+1 ym+1−(m+1)
  k =0               k =0                        | {z }
                                                     =0
                                              (by Lemma 1.3.10)
                                                                           
                                   here, we extended the sum by adding an
                             extra addend for k = m + 1, and then promptly 
                                       subtracted this new addend back
                       m +1    
                              m k m +1− k
                     = ∑          x y      .
                       k =0
                              k
After these transformations, we could combine these two sums and proceed as in
the proof above. (A slightly different but similar proof of Theorem 1.3.24 can be
found in [Grinbe15, Exercise 3.6].)
  So why did we take the trouble to turn our finite sum into an infinite sum, if
we could have just as easily gotten away without it? Because this trick is helpful
not merely in proving Theorem 1.3.24. Graham, Knuth and Patashnik ([GrKnPa94,
§5.1]) frequently apply this trick, in order to avoid having “to fuss over boundary
conditions” (i.e., over the bounds of the sums). Of course, this is not always possi-
ble; sometimes, when you extend a sum to a larger index set, the new addends you
get will not all be 0, and the new sum will either fail to be well-defined or at least
differ from the original sum. Thus, as in our proof of Theorem 1.3.24, the trick can
only be applied after checking that the newly added addends are 0. (You can often
do this checking in your head, but it needs to be done nevertheless.)
  For the sake of future reference, let us summarize what we have learned about
infinite sums in the above proof of Theorem 1.3.24:
  Definition 1.3.26. Let S be a set (not necessarily infinite). For each s ∈ S, let as
  be a number.
    Assume that only finitely many of these numbers are nonzero (i.e., only finitely
  many s ∈ S satisfy as 6= 0). Then, the sum ∑ as is well-defined (even if S is
                                                     s∈S
  infinite): Its value is just defined to be the finite sum ∑ as .
                                                           s∈S;
                                                           a s 6 =0
                                           
                                           nn
  Corollary 1.3.27. Let n ∈ N. Then, ∑        = 2n .
                                     k =0  k
                                                                                    n
Proof
     ofCorollary 1.3.27. Theorem
                                             to x = 1 and y = 1) yields (1 + 1) =
                                   1.3.24 (applied
  n   n                   n  n             n  n
 ∑         1 k
               1 n−k
                     =   ∑      . Hence,  ∑        = (1 + 1)n = 2n . Corollary 1.3.27
k =0 k                  k =0 k           k =0 k
          |{z} |{z}
           =1   =1
follows.
  The following fact ([Grinbe15, Proposition 3.39 (c)]) can be regarded as a coun-
terpart to Corollary 1.3.27:
Thus,                             n
            n      
                   n
           ∑ (−1)k k = (− 1 ) + 1  = 0n = [ n = 0 ]            (by (71)) .
           k =0
                         | {z }
                                      =0
This proves Proposition 1.3.28.
Enumerative Combinatorics: class notes                                                       page 86
First proof of Theorem 1.3.29. Recall the notation nk introduced in [19f-hw0s, Exer-
cise 2] (and also in Remark 1.3.5). Now, [19f-hw0s, Exercise 2] says that
                                n
                                           1
                               ∑ i k = k + 1 ( n + 1 ) k +1 .
                               i =0
                               1
Multiplying this equality by      yields
                               k!
                    1 n k     1    1                   ( n + 1 ) k +1
                    k! i∑
                                                k +1
                           i = ·       ( n + 1)      =                .                         (72)
                        =0
                              k! k + 1                 k! · (k + 1)
  But (48) (applied to n + 1 and k + 1 instead of n and k) yields
                                    ( n + 1 ) k +1   ( n + 1 ) k +1
                              
                          n+1
                                 =                 =
                          k+1         ( k + 1) !     k! · (k + 1)
(since Proposition 1.3.2 (applied to k + 1 instead of n) yields (k + 1)! = k! · (k + 1)).
Comparing this with (72), we obtain
                                    1 n          n         n k
                             
                         n+1                        1         i
                                 = ∑ ik = ∑ ik = ∑ .
                          k+1       k! i=0     i =0
                                                    k!   i =0
                                                              k!
Comparing this with
                                      n                                           n
                                                                                        ik
                                                         
           0       1   2        n                                 i
               +     +   +···+     =∑                                        =   ∑ k! ,
           k       k   k        k   i =0
                                                                  k              i =0
                                                                |{z}
                                                                  ik
                                                                =
                                                                  k!
                                                        (by (48), applied
                                                        to i instead of n)
we obtain                                
                   0        1   2        n    n+1
                       +      +   +···+    =        .
                   k        k   k        k    k+1
This proves Theorem 1.3.29.
Enumerative Combinatorics: class notes                                     page 87
has k addends to begin with. Namely, if n < k − 1, then it has fewer than k addends.
In this case, our splitting argument does not work. This can be a source of real
errors55 . Fortunately, our proof can be easily salvaged. Namely, our argument
above worked fine in the case when n ≥ k − 1; thus, we only need to deal with the
case when n < k − 1 now. So letus assume
                                         that n < k − 1. Hence, n + 1 < k < k + 1,
                                  n+1
so that k + 1 > n + 1 and thus           = 0 (by Proposition 1.3.6, applied to n + 1
                                  k+1
and k + 1 instead of n and k). Comparing this with
                               
  k       k+1        k+2              n
     +           +           +···+       = (empty sum)            (since n < k − 1 < k)
  k         k          k              k
                                         = 0,
                                                        
              k      k+1        k+2              n         n+1
we obtain        +           +          + ··· +      =              again. This com-
              k        k          k              k         k+1
pletes our proof of Corollary 1.3.30.
                                           (n + 1) ((n + 1) − 1)   ( n + 1) n   n ( n + 1)
             1+2+3+···+n =                                       =            =            .
                                                     2                  2            2
  Thus, we have obtained a new proof of Theorem 1.2.1.
1 1
1 2 1
1 3 3 1
                          1            4             6            4             1
                                                                                     .
55 For   example, 1 + 2 + · · · + k = (1 + 2) + (3 + 4 + · · · + k) does not hold for k = 1.
Enumerative Combinatorics: class notes                                              page 89
This picture explains where the “hockey-stick identity” got its name.
  Next, we are going to express the Fibonacci numbers of Definition 1.1.10 as sums
of binomial coefficients:
   We shall prove this later (in Subsection 1.4.5). For now, let us remark that roughly
half the addends on theright hand    side of Proposition 1.3.32 are 0 (indeed, Propo-
                           n−k
                                  
sition 1.3.6 shows that             = 0 for any k ∈ {0, 1, . . . , n} satisfying k > n/2)
                              k
and thus can be discarded; nevertheless it is easier to have the sum end at k = n
rather than figure out where exactly its nonzero addends stop.
   Here are some more examples of binomial identities (i.e., identities involving
binomial coefficients):
                               −1/2     −1 n 2n
                                         
                                     =          .
                                n       4     n
  (Here, both sums are infinite, but they are well-defined, since only finitely many
  of their addends are nonzero.)
                           k∈N;
                                      k     k∈N;            k∈N;
                                                                        k
                             k≤n                                k≤n
                                                  |k>n {z  }
                                                 =0
                                                 n
                          =      ∑ (−1)k k
                            k∈{0,1,...,n}
                                     since the elements k ∈ N satisfying k ≤ n
                                                                                    
         k ∈N
                    k       k∈N;
                                     | {z }      k      k∈N;
                                                                                           | {z }           k
                                   k is even            =1                k is odd           =−1
                                                 (since k is even)                      (since k is odd)
                   since each k ∈ N is either even or odd,
                                                                          
In other words,
                                
                n   n   n         n   n   n
                  +   +   +··· =    +   +    +··· .                             (74)
                0   2   4         1   3   5
  Now,
                       
              n   n   n
         2·     +   +    +···
              0   2   4
                                        
              n   n   n           n     n      n
         =      +   +    +··· +      +      +     +···
              0   2   4           0     2      4
                                |      {z        }
                                     n    n     n
                                  =    +     +    +···
                                     1    3     5
                                                            (by (74))
                                                   
                n       n       n                 n    n   n
          =         +      +       +··· +            +   +   +···
                0       2       4                  1   3   5
                                           
              n       n       n                  n
          =       +       +       +··· = ∑
              0       1       2            k ∈N
                                                 k
                                  
                   n                 n
          = ∑         + ∑
            k∈N;
                   k     k∈N;
                                      k
             k≤n
                                   | {z }
                          k>n
                                         =0
                                 (by Proposition 1.3.6)
                 since each k ∈ N satisfies either k ≤ n or k > n,
                                                                        
  The next fact is highly useful (we will see some of its uses later on):
  Proposition 1.3.35 (Trinomial revision formula). Let n, a, b ∈ R. Then,
                                               n−b
                                              
                              n    a        n
                                       =               .
                              a    b        b  a−b
  Proposition 1.3.35 is the trinomial revision formula, and is not hard to prove.56 We
shall prove it in the next chapter.
  Proposition 1.3.36 (Absorption formula I). Let n ∈ {1, 2, 3, . . .} and m ∈ R. Then,
                                       m m−1
                                               
                                  m
                                     =              .
                                  n     n n−1
  Proposition 1.3.36 is the absorption formula, and is one of the major tools for trans-
forming binomial coefficients into more convenient forms. It is straightforward to
prove. The following proof of Proposition 1.3.36 is taken from [Grinbe15, proof of
Proposition 3.22]57 :
Proof of Proposition 1.3.36. We have n ∈ {1, 2, 3, . . .} ⊆ N. Thus, (42) (applied to m and n
instead of n and k) yields
                                  m ( m − 1) ( m − 2) · · · ( m − n + 1)
                            
                             m
                                =
                             n                       n!
                                  m ( m − 1) ( m − 2) · · · ( m − n + 1)
                                =                                                         (75)
                                               n · ( n − 1) !
(since Proposition 1.3.2 yields n! = (n − 1)! · n = n · (n − 1)!).
   We have n − 1 ∈ N (since n ∈ {1, 2, 3, . . .}). Thus, (42) (applied to m − 1 and n − 1
instead of n and k) yields
          m−1        (m − 1) ((m − 1) − 1) ((m − 1) − 2) · · · ((m − 1) − (n − 1) + 1)
               
                  =
          n−1                                         ( n − 1) !
                     ( m − 1) ( m − 2) ( m − 3) · · · ( m − n + 1)
                  =
                                      ( n − 1) !
(since (m − 1) − 1 = m − 2 and (m − 1) − 2 = m − 3 and (m − 1) − (n − 1) + 1 = m − n + 1).
                                             m
Multiplying both sides of this equality by , we obtain
                                             n
                m m−1          m ( m − 1) ( m − 2) ( m − 3) · · · ( m − n + 1)
                        
                            = ·
                n n−1          n                        ( n − 1) !
                               m · ((m − 1) (m − 2) (m − 3) · · · (m − n + 1))
                            =
                                                    n · ( n − 1) !
                               m ( m − 1) ( m − 2) · · · ( m − n + 1)
                            =
                                            n · ( n − 1) !
56 See   [17f-hw1s, Exercise 2 (c)] for the most interesting case.
57 where    it is stated only for m ∈ Q, but this makes no difference to the proof
Enumerative Combinatorics: class notes                                                 page 93
(since m · ((m − 1) (m − 2) (m
                              −3) · · · (
                                           m − n +1)) = m (m − 1) (m − 2) · · · (m − n + 1)). Com-
                               m       m m−1
pared with (75), this yields       =               . This proves Proposition 1.3.36.
                               n        n n−1
  Theorem 1.3.37. Let n ∈ N, x ∈ R and y ∈ R. Then,
                                     n        
                            x+y           x     y
                                   = ∑               .
                              n      k =0
                                          k   n−k
Class of 2019-10-07
(# of subsets of S) = 2n .
  We will later give two other proofs of Theorem 1.4.1: an algebraic proof in Sub-
section 1.4.2 and a combinatorial proof in Subsection 1.5.3.58
  For example, the set {1, 5, 7} is lacunar, but {1, 5, 6} is not. Note that any 1-
element subset of Z is lacunar, and so is the empty set.
  Some people say “sparse” instead of “lacunar”. I want to avoid this notation,
since the word “sparse” has a different meaning in computer science.
  It is not hard to list the lacunar subsets of [5]: They are
58 The impatient reader can find the latter proof in [19f-hw0s, Exercise 1 (a)]. (More precisely,
   [19f-hw0s, Exercise 1 (a)] is the particular case of Theorem 1.4.1 when S = [n]. But it can easily
   be adapted to the general case.)
Enumerative Combinatorics: class notes                                                      page 95
      • We let b x c denote the largest integer ≤ x. This integer b x c is called the floor
        of x, or “rounding down x”.
  Proposition 1.4.6. Let n ∈ N. Then, the largest size of a lacunar subset of [n] is
  dn/2e.
   This theorem is fundamental. Theorem 1.4.7 (a) is known as the difference rule,
and is part of the reason why A \ B is called the “set difference” of A and B 59 .
Parts (b) and (c) of Theorem 1.4.7 are (in a sense) the combinatorial manifestation
of the principle “the whole is greater than its part”. But before you declare them
completely obvious, keep in mind that Theorem 1.4.7 (c) is not true for infinite sets!
Indeed, if we set B = N and A = Z, then B ⊆ A holds, and so does | B| = | A|
(in the sense that the infinite sets B and A have the same cardinality), but it is not
true that B = A. Thus, it is worth proving the theorem. Fortunately, it is a simple
application of the sum rule:
Proof of Theorem 1.4.7. We know that B ⊆ A. Hence, the set A is the union of the two
disjoint sets B and A \ B. Hence, Theorem 1.1.3 (applied to S = A, k = 2, S1 = B and
59 although  this terminology persists even in the case when B is not a subset of A, despite the fact
   that | A \ B| is usually not | A| − | B| in this case
Enumerative Combinatorics: class notes                                                             page 96
60 We  are using the notation { a1 < a2 < · · · < ak } (where a1 , a2 , . . . , ak are some integers) to mean
    the set { a1 , a2 , . . . , ak } when we want to simultaneously assert that a1 < a2 < · · · < ak . For
    example, {2 < 5 < 8} means the set {2, 5, 8}, whereas {4 < 2 < 7} is not well-defined.
61 Proof. Let t ∈ L ∩ L+ . Thus, t ∈ L ∩ L+ ⊆ L and t ∈ L ∩ L+ ⊆ L+ = { s + 1 | s ∈ L }. In other
    words, there exists some s ∈ L such that t = s + 1. Consider this s. Now, the set L contains
    the two consecutive integers s and s + 1 (since s ∈ L and s + 1 = t ∈ L). But L contains no
    two consecutive integers (since L is lacunar). These two statements clearly contradict each other.
    Thus we have obtained a contradiction.
      Now, forget that we fixed t. We thus have found a contradiction for each t ∈ L ∩ L+ . Hence,
    there exists no t ∈ L ∩ L+ . In other words, the sets L and L+ are disjoint.
Enumerative Combinatorics: class notes                                                                       page 97
Hence,
                                             2 · | L| = L ∪ L+ ≤ n + 1.
Thus,
                                 | L| ≤ (n + 1) /2 = |{z}  1/2 < dn/2e + 1.
                                                     n/2 + |{z}
                                                          ≤dn/2e    <1
Hence,
  Now, forget that we fixed L. We thus have shown that any lacunar subset L of [n]
satisfies | L| ≤ dn/2e. In other words, any lacunar subset of [n] has size ≤ dn/2e.
Then, the largest size of a lacunar subset of [n] is dn/2e (because we already know
that there exists a lacunar subset of [n] having size dn/2e). This proves Proposition
1.4.6.
  As another application of Theorem 1.4.7, let us prove Theorem 1.4.1 again:62
Second proof of Theorem 1.4.1. We have |S| = n, since S is an n-element set. If B is any
subset of S, then Theorem 1.4.7 (b) (applied to A = S) yields | B| ≤ |S| = n and therefore
| B| ∈ {0, 1, . . . , n}. Hence, the sum rule yields63
     (# of subsets of S)
         =        ∑           (# of subsets B of S satisfying | B| = k)
             k ∈{0,1,...,n}
                              |                    {z                 }
                                      =(# of k-element
                                                     subsets of S )
                                                    n
                                                 =
                                                    k
                                           (by Theorem 1.3.12)
                                                                                                                  !
                               n                                           n
                           n        n
         =     ∑           k
                              =∑
                                    k
                                                           since the symbol   ∑      stands for       ∑
           k ∈{0,1,...,n}      k =0                                           k =0                k∈{0,1,...,n}
system [sage], since it has almost all of the necessary functionality built in already.
You can either install SageMath on your computer (see here for Linux binaries, here
for Linux sources, and here for less up-to-date Windows installers), or run it on the
CoCalc cloud, or (if your computations are quick) use the SageMathCell browser
interface. The latter option is the easiest one, in my experience.
  First, let us find all 3-element subsets of [5] = {1, 2, 3, 4, 5}. Typing in
Subsets ( {1 , 2 , 3 , 4 , 5 } , 3 )
returns:
      Subsets of {1, 2, 3, 4, 5} of size 3
Okay, but how do we list them? For that, we use
list ( Subsets ( {1 , 2 , 3 , 4 , 5 } , 3 ) )
and obtain
        [{1, 2, 3},
         {1, 2, 4},
         {1, 2, 5},
         {1, 3, 4},
         {1, 3, 5},
         {1, 4, 5},
         {2, 3, 4},
         {2, 3, 5},
         {2, 4, 5},
         {3, 4, 5}]
These are our subsets indeed.64 Likewise, we can get SageMath to list all subsets
of [4] (of all sizes):
list ( Subsets ( {1 , 2 , 3 , 4 } ) )
   indented, or else SageMath will not recognize that they are part of the definition of the function!
Enumerative Combinatorics: class notes                                                page 99
is_lacunar ( {1 , 4 , 6 } )
returns False.
  If you are using the SageMathCell browser interface, you need to put both the
definition of the function and these tests into the input box67 . So you have to write:
def is_lacunar ( I ) :
  # Check whether a set ‘I ‘ of integers is lacunar .
  return all ( e + 1 not in I for e in I )
is_lacunar ( {1 , 4 , 6 } )
  Better yet, you can use the print instruction to do both of these tests at once:
def is_lacunar ( I ) :
  # Check whether a set ‘I ‘ of integers is lacunar .
  return all ( e + 1 not in I for e in I )
print ( is_lacunar ( {1 , 4 , 6 } ) )
print ( is_lacunar ( {1 , 4 , 5 } ) )
(Without the print instruction, SageMathCell would only give you the output of
the very last line.)
  Now, let us make SageMath list the lacunar subsets of [4]. We shall ask it to do so
by walking through all the subsets of [4], and filtering them for lacunarity. Having
defined the is_lacunar function, this is easy:
[ A for A in Subsets ( {1 , 2 , 3 , 4 } ) if is_lacunar ( A ) ]
The meaning of this expression is very similar to the mathematical set-builder no-
tation { A | A ∈ P ({1, 2, 3, 4}) and A is lacunar}; the main difference is that we
are using square brackets rather than set-braces and therefore obtain a list rather
than a set. The result is what we would expect:
        [{}, {1}, {2}, {3}, {4}, {1, 3}, {1, 4}, {2, 4}]
This is a list of all lacunar subsets of [4], each listed only once. Thus, the length of
the list is the number of said subsets. We can let SageMath compute this length as
follows:
len ( [ A for A in Subsets ( {1 , 2 , 3 , 4 } ) if is_lacunar ( A ) ] )
As expected, we get 8. In general, the SageMath function len can be applied both
to lists and to sets, yielding the length of the former and the size of the latter.
  We can now put these to use and compute the number of lacunar subsets of [n]
for any n ∈ N that is not too high. For example, for n = 7, we just need to ask
SageMath the following:
67 and,
      generally, you must keep the definition in the input box whenever you want to use it – as
   SageMathCell won’t remember it for you
Enumerative Combinatorics: class notes                                              page 100
Working with general n. The way I showed above required me to type in a new
command for each new value of n. Why not have the computer calculate the whole
table at once? For this, we need to define a function which takes a number n as
input and returns the # of lacunar subsets of n. Let me call this function num_lacs,
and define it as follows:
def num_lacs ( n ) :
  # Return the number of all lacunar subsets of ‘[ n ] ‘.
  N = set ( range (1 , n + 1 ) ) # This is the set of ‘1 , 2 , ... , n ‘.
  return len ( [ A for A in Subsets ( N ) if is_lacunar ( A ) ] )
 Here is what this function does: It first constructs the set [n] (which it calls N). It
does this by first constructing the list (1, 2, . . . , n) (which is done via range(1, n+
1) because in general, range(a, b) returns the list ( a, a + 1, . . . , b − 1)), and then
making a set out of this list using the set function. Then, it returns the number of
all lacunar subsets of this set N = [n] (in the same way as we did above).
   Having defined this function, we can make SageMath list its values for all n ∈
{0, 1, . . . , 9} as follows:68
for n in range (0 , 10 ) :
  print ( " The number of lacunar subsets of [ " + str ( n ) + " ] is " + str (
                                      num_lacs ( n ) ) )
This code runs through all elements n of range(0, 10), which means all elements
of {0, 1, . . . , 9}, and prints a certain piece of text for each of them, which always has
the form “The number of lacunar subsets of [”, followed by the value of n, followed
by the text “] is ”, followed by the # of lacunar subsets of [n]. Here is the output:
         The number of lacunar subsets of [0] is 1
         The number of lacunar subsets of [1] is 2
68 The following code fragment has only two lines. The linebreak between str( and num_lacs(n))
   is a consequence of lack of space on this page.
Enumerative Combinatorics: class notes                                        page 101
def num_lacs ( n ) :
  # Return the number of all lacunar subsets of ‘[ n ] ‘.
  N = set ( range (1 , n + 1 ) ) # This is the set of ‘1 , 2 , ... , n ‘.
  return len ( [ A for A in Subsets ( N ) if is_lacunar ( A ) ] )
for n in range (0 , 10 ) :
  print ( " The number of lacunar subsets of [ " + str ( n ) + " ] is " + str (
                                      num_lacs ( n ) ) )
It is good enough for computing the required values for all n ∈ {0, 1, . . . , 18}, but
higher n’s will bring SageMath to its knees. (The SageMathCell browser interface
has a timeout – if your computation takes longer than 30 seconds69 , it will stop.
But even on your own machine, you don’t want to wait for days.)
   It turns out that we can speed up our code a bit by optimizing the num_lacs
function. In its current form, this function first computes the list of all lacunar
subsets of [n] and then returns the length of this list. Thus, it walks through all
subsets of [n], and whenever it encounters a lacunar one, it “writes it down” into a
list (in memory). It would be faster to simply count these lacunar subsets, without
writing them down, since we only want to know their number. The easiest way
to do so is to simply start with the number 0 and then add 1 to it every time a
lacunar subset is encountered. This suggests the following modified version of the
num_lacs function:
def num_lacs ( n ) :
  # Return the number of all lacunar subsets of ‘[ n ] ‘.
  N = set ( range (1 , n + 1 ) ) # This is the set of ‘1 , 2 , ... , n ‘.
  return sum ( 1 for A in Subsets ( N ) if is_lacunar ( A ) )
69 I   believe it is 30 seconds.
Enumerative Combinatorics: class notes                                                 page 102
The line
sum ( 1 for A in Subsets ( N ) if is_lacunar ( A ) )
The manual. You have now seen a few pieces of SageMath’s functionality and
a few examples of how to use it. Of course, there is a lot more. Since this text
is not a SageMath reference book, you will need other sources to discover what
else SageMath can do for you. An overview is given in the text [SageBook]. In
order to systematically explore the abilities of SageMath, you will have to consult
the SageMath reference manual, which can currently be found at https://doc.
sagemath.org/html/en/reference/ . In particular, the Combinatorics page is of
most relevance to us.
  Definition 1.4.8. Let k ∈ Z. Then, [k ] shall denote the set {1, 2, . . . , k }. This is
  understood to be the empty set ∅ when k ≤ 0.
Let us state our claim about the # of lacunar subsets of [n] as a proposition:
Note that `0 = 1 (since the only lacunar subset of the empty set [0] is the empty set
itself) and `−1 = 1 (for similar reasons).
   Now, we claim that
Thus, each subset of [n] is either red or green (but not both at the same time). Thus,
by the sum rule, we have
We shall now compute the two addends on the right hand side.
   First of all, we observe that the green subsets of [n] are precisely the subsets of
[n − 1]. Hence,
70 Keep   in mind that [Grinbe15, Exercise 4.3] is an equivalent restatement of our Proposition 1.4.9
    (more precisely, our Proposition 1.4.9 is [Grinbe15, Exercise 4.3], applied to n + 2 instead of n).
71 Note that [17f-hw1s, Exercise 4 (c)] only covers the case when n ∈ N. But the remaining case
In other words,
72 Indeed,    for the shifted Fibonacci sequence ( f 1 , f 2 , f 3 , . . .), this is clear.   For the sequence
   (`−1 , `0 , `1 , . . .), this follows from (76).
Enumerative Combinatorics: class notes                                          page 105
Second proof of Proposition 1.4.9 (sketched). Let us consider domino tilings of the rect-
angle Rn+1,2 . The # of such tilings is dn+1,2 (because we defined dn+1,2 to be this #).
Hence,
as follows: If T is any domino tiling of Rn+1,2 , then h ( T ) shall be the set of all
i ∈ [n + 1] such that at least one horizontal domino of T starts in column i.
   Before we do anything with this map h, we need to check that it is well-defined.
First, let us illustrate it with an example: If n = 13 and if T is the domino tiling
1 2 3 4 5 6 7 8 9 10 11 12 13 14
(where the numbers on the top are just the numbers of the columns), then h ( T ) =
{2, 4, 7, 9, 13}, since the horizontal dominos of T start in columns 2, 4, 7, 9, 13.
  The proof that h is well-defined will rest on the following two observations:
  [Proof of Observation 1: This is clear, since any horizontal domino that starts in
column n + 1 would continue into column n + 2 and thus fail to stay inside Rn+1,2 .]
E E
D D
(please pretend that the slightly oblong rectangles are actually squares).
  Now, the square (i, 2) must belong to some domino F ∈ T. This domino F cannot
be vertical (since it would otherwise overlap with D), and thus is horizontal. More-
over, this horizontal domino F cannot start in column i (since it would otherwise
overlap with E), and thus must start in column i − 1. This contradicts the fact that
the column i − 1 has no horizontal domino of T start in it. This contradiction shows
that our assumption was false; hence, Observation 2 is proven.]
  Now, we can confirm that the map h defined above is well-defined: If T is a
domino tiling of Rn+1,2 , then the set that we wanted to call h ( T ) is actually a
subset of [n] (since it is a subset of [n + 1], but Observation 1 shows that it does not
contain n + 1), and is lacunar (by Observation 2). Thus, h is well-defined.
  Next, I claim that h is a bijection. Indeed, let me construct an inverse to h:
Consider the map
that sends each lacunar subset S of [n] to the domino tiling of Rn+1,2 that is con-
structed by placing two horizontal dominos into columns i and i + 1 for each i ∈ S,
and filling the rest of Rn+1,2 with vertical dominos. It is easy to see that h ◦ g = id.
It is somewhat trickier to see that g ◦ h = id; this requires the following two obser-
vations:
In other words,
                                                          n+1−k
                                                                 
              (# of k-element lacunar subsets of [n]) =             .
                                                             k
  (To be pedantic, Proposition 1.4.10 only answers Question 1.4.3 (b) in the case
when k ≤ n + 1. But the remaining case is trivial: If k > n + 1, then k > n + 1 > n,
and thus the set [n] has no k-element subsets73 , let alone k-element lacunar subsets.)
  Proposition 1.4.10 appears in [17f-hw2s, Exercise 3 (a)], with two proofs74 . One
way to prove it is by strong induction on n, similar to the first proof of Proposition
73 byTheorem 1.4.7 (b)
74 Tobe very pedantic: [17f-hw2s, Exercise 3 (a)] only states Proposition 1.4.10 in the case when
   n ∈ N. But the remaining case is trivial (since k ≤ n + 1 leads to k = 0 when n is negative, and
   thus we have to count 0-element subsets of an empty set, which is not a challenge at this point).
Enumerative Combinatorics: class notes                                                                      page 108
1.4.9. (This is the second solution of [17f-hw2s, Exercise 3 (a)].) There is, however,
a more enlightening proof than that, which is bijective and explains the binomial
coefficient on the right hand side combinatorially. This latter proof will rely on the
following fact:75
   Proposition 1.4.11. Let S be a finite set of integers. Then, there exists a unique
   tuple (s1 , s2 , . . . , sk ) of integers satisfying {s1 , s2 , . . . , sk } = S and s1 < s2 < · · · <
   sk .
   Proposition 1.4.11 is just saying that any finite set of integers can be uniquely
listed in increasing order (with no repetitions). This is sufficiently self-evident that
I have never seen a combinatorics textbook that proves it. A detailed proof can be
found in [Grinbe15, proof of Theorem 2.46]76 , and a sketch at [19f-hw0s, Outline of
a proof of Proposition 1.3].
   Let us furthermore make the following convention (which we have already made
in our proof of Proposition 1.4.6):
   Thus, Proposition 1.4.11 can be restated as follows: Each finite set of integers can
be uniquely expressed in the form {s1 < s2 < · · · < sk }. Of course, the k here is the
size of this set.
   The following proposition is a variant of Proposition 1.4.11 for the case when |S|
is known:
   The subtle difference between Proposition 1.4.11 and Proposition 1.4.13 is that
the size of the tuple in Proposition 1.4.13 is specified in advance (viz., it must be
m = |S|), whereas Proposition 1.4.13 is a statement about tuples of all possible
sizes.
   The overly skeptical reader may want to solve the following exercise:
                                                                    n+1−k
                                                                          
             (# of k-element subsets of {0, 1, . . . , n − k}) =             .      (80)
                                                                        k
  It is fairly obvious that the maps A and B are mutually inverse. Hence, the map
A is invertible, i.e., is a bijection. Thus, the bijection principle yields
In other words,
                              (# of k-element lacunar subsets of [n])
                              = (# of k-element subsets of {0, 1, . . . , n − k})
                                   n+1−k
                                          
                              =                     (by (80)) .
                                       k
This proves Proposition 1.4.10.
   (The above proof of Proposition 1.4.10 can also be rewritten in terms of domino
tilings instead of lacunar subsets, since we know a bijection between the former
and the latter from our second proof of Proposition 1.4.9.)
   By combining Proposition 1.4.9 and Proposition 1.4.10, we can now obtain a
bijective proof of Proposition 1.3.32:
Proof of Proposition 1.3.32. Let m = n − 1. Then, m ∈ {−1, 0, 1, . . .} (since n ∈ N =
{0, 1, 2, . . .}) and m + 1 = n. Hence, it is easy to see that |[m]| ≤ n 77 .
   If B is any subset of [m], then Theorem 1.4.7 (b) (applied to A = [m]) yields
| B| ≤ |[m]| ≤ n and therefore | B| ∈ {0, 1, . . . , n}. Hence, the sum rule yields78
             (# of lacunar subsets of [m])
              =           ∑        (# of lacunar subsets B of [m] satisfying | B| = k)
                   k∈{0,1,...,n}
                                   |                            {z                      }
                                             =(# of k-element lacunar subsets of [ m ])
                                                            m+1−k
                                                                       
                                                        =
                                                                 k
                                            (by Proposition 1.4.10, applied to m instead of n)
                                                          n                         n 
                                       m+1−k                    m+1−k                      n−k
                                                                                              
              =           ∑              k
                                                     =   ∑        k
                                                                                =   ∑       k
                   k∈{0,1,...,n}                         k =0                       k =0
             = f n +1               since m + 2 = (m + 1) +1 = n + 1 ,
                                                   | {z }
                                                                =n
we obtain
                    n
                              n−k               n−0     n−1     n−2           n−n
                                                                         
        f n +1 =   ∑           k
                                        =
                                                 0
                                                     +
                                                         1
                                                             +
                                                                 2
                                                                      +···+
                                                                               n
                                                                                    .
                   k =0
This proves Proposition 1.3.32.
77 Proof.If m ∈ N, then |[m]| = m = n − 1 ≤ n. Hence, if m ∈ N, then we are done. Thus, we WLOG
    assume that m ∈/ N. Combining this with m ∈ {−1, 0, 1, . . .}, we obtain m ∈ {−1, 0, 1, . . .} \ N =
    {−1}, so that m = −1. Thus, m + 1 = 0, so that n = m + 1 = 0. But m = −1 and thus [m] = ∅
    and therefore |[m]| = |∅| = 0 = n (since n = 0). Hence, |[m]| ≤ n, qed.
78 Again, the sum rule that we are using here is Theorem 1.2.5.
Enumerative Combinatorics: class notes                                             page 111
   This is not the only known proof of Proposition 1.3.32. There is also a (more
straightforward) proof by strong induction on n using Theorem 1.3.8. (See [Vorobi02,
§1.15] for the details of this proof, or find it yourself.)
  (Here, “a even elements” means “exactly a even elements”, and “b odd elements”
  means “exactly b odd elements”.)
Hence, each of the two sets E and O has exactly n/2 elements. In other words,
| E| = n/2 and |O| = n/2. Thus, the equality (81) rewrites as
        (# of subsets of [n] that contain a even elements and b odd elements)
                     
             n/2    n/2
        =                 .
               a      b
This proves Proposition 1.4.14.
  Here is a more rigorous way to write up the same proof (without speaking of
“choices”, which arguably is not a well-defined mathematical notion). Let E be the
set of all even elements of [n]; let O be the set of all odd elements of [n]. Let N be
the set of all subsets of [n] that contain exactly a even elements and exactly b odd
elements. Thus,
      (# of subsets of [n] that contain a even elements and b odd elements)
       = |N | .                                                              (82)
                                               
                                       n/2    n/2
Hence, we need to show that |N | =                  .
                                        a       b
  For any set X and every k ∈ N, we let Pk ( X ) denote the set of all k-element
subsets of X. Now, the two maps
                                        N → P a ( E) × Pb (O) ,
                                         S 7→ (S ∩ E, S ∩ O)
and
                                      P a ( E) × Pb (O) → N ,
                                                 (U, V ) 7→ U ∪ V
are well-defined and mutually inverse79 . Hence, these two maps are bijections.
79 Insteadof proving this in detail (which is straightforward), let me unfold the notations and
   explain what the two maps do:
       • The first map sends any S ∈ N (that is, any subset S of [n] that contains a even elements
         and b odd elements) to the pair (S ∩ E, S ∩ O), which consists of
                – the set S ∩ E (this is the set of all even elements of S; it is an a-element set, because
                  S contains exactly a even elements) and
                – the set S ∩ O (this is the set of all odd elements of S; it is a b-element set).
             In other words, the first map splits any S ∈ N into its set of even elements and its set of
             odd elements.
       • The second map sends any pair (U, V ) ∈ P a ( E) × Pb (O) to the union U ∪ V ∈ N . In
         other words, the second map takes a pair (U, V ) consisting of an a-element set of even
         numbers and a b-element set of odd numbers, and combines them to the set U ∪ V (which
         belongs to N , because it has a even elements and b odd elements).
     From this point of view, it should be clear that the two maps are well-defined and mutually
   inverse.
Enumerative Combinatorics: class notes                                              page 113
  Now, recall that n is even. Thus, there are exactly n/2 even numbers in the set
[n] (namely, 2, 4, 6, . . . , n). In other words, the set of all even elements of [n] has size
n/2. In other words, the set E has size n/2 (since E is the set of all even elements
of [n]). In other words, | E| = n/2. Similarly, |O| = n/2. Now,
                                                              
                                        | E| |O|        n/2      n/2
                              |N | =               =
                                          a   b           a       b
(since | E| = n/2 and |O| = n/2). Hence, (82) becomes
       (# of subsets of [n] that contain a even elements and b odd elements)
                           
                   n/2    n/2
       = |N | =                 .
                    a       b
This proves Proposition 1.4.14.
   The relation between the above informal proof and its formalized version is
worth pointing out explicitly: Informally, we argued that choosing a subset with a
even and b odd elements is tantamount to independently choosing a elements from
E and b elements from O. We formalized this argument as a bijection from N to
P a ( E) × Pb (O), and then used the product rule along with the bijection principle
to conclude that |N | = |P a ( E)| · |Pb (O)|. Thus, “independent choices” in infor-
mal arguments correspond to an application of the product rule and the bijection
principle when formalized.
   The analogue of Proposition 1.4.14 in the case of odd n can be proven in the same
way:
Enumerative Combinatorics: class notes                                                     page 114
Class of 2019-10-09
   This is not a-priori a combinatorial result; it is just an algebraic identity for the
elements of a recursively defined sequence. Consequently, we should expect it to
have a purely algebraic proof. And this is indeed the case: Theorem 1.4.16 can eas-
ily be proven by induction on n. For such proofs, see [18s-mt1s, solution to Exercise
3 (e)] or (in a slightly more general setting) [Grinbe15, proof of Theorem 2.26 (a)]80 .
We shall, instead, derive Theorem 1.4.16 from the combinatorial interpretation of
the Fibonacci numbers.
   To simplify this proof, we shall front-load a little argument into a separate propo-
sition (Proposition 1.4.18). We begin with a fairly standard piece of notation:
80 To  recover Theorem 1.4.16 from [Grinbe15, Theorem 2.26 (a)], set a = 1 and b = 1. Then,
   the sequence ( x0 , x1 , x2 , . . .) in [Grinbe15, Theorem 2.26 (a)] becomes the Fibonacci sequence
   ( f 0 , f 1 , f 2 , . . . ).
Enumerative Combinatorics: class notes                                                            page 115
    Formally speaking, the argument we have just made is a bijective proof, which can be
made rigorous as follows: For each subset S of [n], we let S + a denote the set {s + a | s ∈ S}.
This set S + a is clearly a subset of [ a + 1, a + n]. (Informally speaking, S + a is just the set
S shifted by a units on the number line.) Conversely, for each subset T of [ a + 1, a + n],
we let T − a denote the set {t − a | t ∈ T }.         81 This set T − a is clearly a subset of n .
                                                                                               [ ]
(Informally speaking, T − a is just the set T shifted by − a units on the number line.) Now,
it is easy to see that the maps
and
are well-defined82 and mutually inverse. Hence, they are bijections. Thus, the bijection
principle yields
In other words,
    forward.
Enumerative Combinatorics: class notes                                           page 116
Thus, each subset of [m + n − 1] is either red or green (but not both at the same
time). Thus, by the sum rule, we have
We shall now compute the two addends on the right hand side.
  A lacunar green subset S of [m + n − 1] does not contain m, and thus is the
union of its two subsets {s ∈ S | s < m} and {s ∈ S | s > m}. The former of
these two subsets is a lacunar subset of [m − 1], while the latter is a lacunar sub-
set of [m + 1, m + n − 1]. Hence, a lacunar green subset of [m + n − 1] is just the
union of a lacunar subset of [m − 1] with a lacunar subset of [m + 1, m + n − 1].
Conversely, any such union must be a lacunar green subset of [m + n − 1] (since an
element of [m − 1] and an element of [m + 1, m + n − 1] cannot be consecutive83 ).
Summarizing this discussion, we conclude that the map
is well-defined and is a bijection (and the inverse of this map simply sends each
pair ( P, Q) to P ∪ Q). Thus, the bijection principle yields
  Comparing (85) with (89), we obtain f m+n+1 = f m f n + f m+1 f n+1 . Thus, Theorem
1.4.16 is proven.
   The proof we just gave is an example of a proof by double counting: We have
counted the lacunar subsets of [m + n − 1] (that is, computed their number) in two
different ways. In the first way, we obtained (85); in the second, we found (89).
Comparing the results, we then obtained the equality f m+n+1 = f m f n + f m+1 f n+1 ,
which we had set out to prove.
   Such proofs often look like magic, but they are not always hard to find: If you
want to prove an identity of the form A = B by double counting, all you have to do
is come up with a counting problem that can be solved in two ways, one of which
gives A as a result while the other gives B. The specifics of A and B often give
away how the problem could look like. For example, because the identity we were
proving was f m+n+1 = f m f n + f m+1 f n+1 , it stood to reason that the counting prob-
lem should be “how many lacunar subsets does [m + n − 1] have?”. This way, it is
immediately clear that one answer is f m+n+1 (by Proposition 1.4.9); it remained to
find a second way to solve the counting problem and get f m f n + f m+1 f n+1 instead.
The form of this expression suggests using the sum rule, so that the lacunar subsets
of [m + n − 1] had to somehow be subdivided into two categories (the “red” and
the “green” ones in the above proof) numbering f m f n and f m+1 f n+1 , respectively.
Furthermore, each of these categories should have a product-like structure (i.e., a
lacunar red subset should fall apart into two independent parts, and likewise for a
lacunar green subset), so that the products f m f n and f m+1 f n+1 could be explained
by the product rule. With these heuristics, it is not hard to come up with the exact
argument given above. This kind of reverse-engineering strategy does not always
work (it is an art, not a science, and it relies heavily on your preknowledge), but
when it does, the result is usually worth it.
   Our proof of Proposition 1.3.32 was also a proof by double counting.
   Benjamin and Quinn have devoted a whole book [BenQui03] to proofs by double
counting; it has many more examples. In particular, they give a proof of Theorem
1.4.16 (“Identity 3” in their book) which uses domino tilings, but essentially is the
same as our proof.84
84 Recall   that domino tilings and lacunar subsets are more or less interchangeable, as our Second
Enumerative Combinatorics: class notes                                                         page 119
      (S is self-counting)
      ⇐⇒ (the size |S| is an element of S)          (by the definition of “self-counting”)
      ⇐⇒ (|S| ∈ S)
      ⇐⇒ (k ∈ S)           (since |S| = k (because S is a k-element set))
      ⇐⇒ (S contains k) .
Thus, the self-counting k-element subsets of [n] are precisely the k-element subsets of [n]
that contain k. Hence,
   {k-element subsets of [n] that contain k} → {(k − 1) -element subsets of [n] \ {k}} ,
                                           S 7→ S \ {k}
and
   {(k − 1) -element subsets of [n] \ {k}} → {k-element subsets of [n] that contain k} ,
                                         T 7→ T ∪ {k}
are well-defined85 and mutually inverse86 , and thus are bijections. Hence, the bijection
   proof of Proposition 1.4.9 has shown.
85 This
      means the following:
          • If S is a k-element subset of [n] that contains k, then S \ {k} is a (k − 1)-element subset of
            [ n ] \ { k }.
          • If T is a (k − 1)-element subset of [n] \ {k}, then T ∪ {k} is a k-element subset of [n] that
            contains k.
         Checking this is straightforward; you can do it in your head, but don’t forget to do this!
86 For   this, you need to show that
Enumerative Combinatorics: class notes                                                             page 120
principle yields
But [n] is an n-element set; hence, [n] \ {k } is an (n − 1)-element set (since k ∈ [n]). There-
fore, n − 1 ∈ N, and furthermore, Theorem 1.3.12 (applied to n − 1, k − 1 and [n] \ {k }
instead of n, k and S) shows that
                     n−1
                        
                            = (# of (k − 1) -element subsets of [n] \ {k}) .
                     k−1
Comparing this with (91), we obtain
                                                                               n−1
                                                                                  
                       |{k-element subsets of [n] that contain k}| =                 .
                                                                               k−1
Now, (90) becomes
  Our next exercise is a slight variation on this one, in which we count subsets of
[n] whose size is not just some element but in fact the smallest one:
  Exercise 1.4.4. A set S of integers is said to be self-starting if the size |S| is
  the smallest element of S. (For example, the set {3, 4, 6} is self-starting, since
  |{3, 4, 6}| = 3 is its smallest element; but {1, 3, 6} and {1, 2, 6} are not self-
  starting.)
     Let n be a positive integer.
     (a) For each k ∈ [n], find the # of self-starting k-element subsets of [n].
     (b) Find the # of all self-starting subsets of [n].
  This exercise is essentially [18s-hw1s, Exercise 7]. Note that self-starting sets are
called “maximal sets” in [Chu19].
Solution to Exercise 1.4.4 (sketched). Recall the notation from Definition 1.4.17; in particular,
if k ∈ Z, then [k + 1, n] will mean the integer interval {k + 1, k + 2, . . . , n}.
   (a) Fix k ∈ [n]. For any k-element subset S of [n], we have the following chain of logical
equivalences:
     (S is self-starting)
     ⇐⇒ (|S| is the smallest element of S)             (by the definition of “self-starting”)
     ⇐⇒ (k is the smallest element of S)
                   (since |S| = k (because S is a k-element set))
     ⇐⇒ (k ∈ S, but all elements of S other than k are larger than k)
     ⇐⇒ (k ∈ S, but all elements of S other than k belong to [k + 1, n])
                                                                                
                       because an element of S is larger than k if and only if
                          it belongs to [k + 1, n] (since it belongs to [n] )
     ⇐⇒ (k ∈ S, but all elements of S \ {k} belong to [k + 1, n])
                                                        
                  since the elements of S other than k
                  are precisely the elements of S \ {k }
     ⇐⇒ (k ∈ S and S \ {k} ⊆ [k + 1, n])
(since the statement “all elements of S \ {k } belong to [k + 1, n]” means the same as “S \
{k} ⊆ [k + 1, n]”). Thus, the self-starting k-element subsets of [n] are precisely the k-element
subsets of [n] that contain k and satisfy S \ {k } ⊆ [k + 1, n]. Hence, the maps
    {self-starting k-element subsets of [n]} → {(k − 1) -element subsets of [k + 1, n]} ,
                                           S 7→ S \ {k}
Enumerative Combinatorics: class notes                                                    page 122
and
are well-defined87 and mutually inverse, and thus are bijections. Hence, the bijection prin-
ciple yields
                    n−k
                         
                            = (# of (k − 1) -element subsets of [k + 1, n]) .
                    k−1
                                                                        n−k
                                                                           
                     |{self-starting k-element subsets of [n]}| =             .
                                                                        k−1
In other words,
                                                                          n−k
                                                                             
                    (# of self-starting k-element subsets of [n]) =             .              (94)
                                                                          k−1
87 Asin the solution to Exercise 1.4.3, all these claims need to be thoroughly checked, but this can
   be quickly done in your head.
Enumerative Combinatorics: class notes                                                                  page 123
   The answers we obtained for this exercise might make you wonder whether there is a di-
rect connection between self-starting subsets and lacunar subsets – after all, their numbers
are both given by Fibonacci numbers! More precisely, a comparison of (96) with Proposition
1.4.9 may suggest that there might be a bijection
(since both of these sets have size f n ); furthermore, a comparison of (94) with Proposition
1.4.10 may suggest that there might be a bijection
for each k ∈ [n]. And indeed, such bijections exist, and both of them are given by the same
formula:
(We leave it to the reader to verify that this defines a valid bijection.)
  We can mutate Exercise 1.4.4 into yet another similar-looking counting problem
by replacing “smallest element” by “largest element”:
   [Proof of Claim 1: The set [k ] = {1, 2, . . . , k } has size k, but its largest element is also
k. Thus, [k ] is self-ending. Consequently, [k ] is a self-ending k-element subset of [n]. It
remains to show that [k ] is the only self-ending k-element subset of [n].
   Let S be a self-ending k-element subset of [n]. Thus, |S| = k (since S is a k-element set).
But |S| is the largest element of S (since S is self-ending). In other words, k is the largest
element of S (since |S| = k). Hence, all elements of S are ≤ k and thus belong to the set [k ].
In other words, S is a subset of [k ]. Therefore, Theorem 1.4.7 (c) (applied to A = [k ] and
B = S) shows that S = [k ] (since |S| = k = |[k ]|).
   Now, forget that we fixed S. We thus have shown that each self-ending k-element subset
S of [n] satisfies S = [k ]. In other words, each self-ending k-element subset S of [n] must
equal [k ]. Hence, [k ] is the only self-ending k-element subset of [n] (since we already know
that [k ] is such a subset). This proves Claim 1.]
   Claim 1 obviously yields that
                 =    ∑       1 = |[n]| · 1 = |[n]| = n.
                     k ∈[n]
  The moral of this story is: similar-looking counting problems don’t always have
similar answers. Counting problems can vary wildly in difficulty and method of
solution. Eventually, we will see some where no good formula for the answer is
known!
   Have you been experimenting in SageMath along with the above? In that case, you
have probably defined functions to check whether a set of integers is self-counting, resp.
self-starting, resp. self-ending. Here is one way to do so:
def is_self_counting ( S ) :
  # Check whether a set ‘S ‘ of integers is self - counting .
  return S . cardinality () in S
  # Note : " S . cardinality () " is the size of ‘S ‘.
def is_self_starting ( S ) :
  # Check whether a set ‘S ‘ of integers is self - starting .
  c = S . cardinality ()
  return c in S and all ( c < = i for i in S )
  # This is checking that the size ‘c ‘ of ‘S ‘ is in ‘S ‘
  # and is smaller or equal to all elements of ‘S ‘.
def is_self_ending ( S ) :
  # Check whether a set ‘S ‘ of integers is self - ending .
  c = S . cardinality ()
  return c in S and all ( c > = i for i in S )
With these functions, you can ask SageMath to compute (for example) the # of self-starting
3-element subsets of [8] as follows:
sum ( 1 for S in Subsets (8 , 3 ) if is_self_starting ( S ) )
    (For example, {1, 4, 5, 8, 11} is an O<E<O<E<... set, while {2, 3} and {1, 4, 6}
  are not. Note that k is allowed to be 0, whence ∅ is an O<E<O<E<... set.)
    For each n ∈ N, we let a (n) denote the number of all O<E<O<E<... subsets
  of [n], and let b (n) denote the number of all O<E<O<E<... subsets of [n] that
  contain n.
    (a) Show that a (n) = a (n − 1) + b (n) for each n > 0.
                                  n
     (b) Show that a (n) = 1 + ∑ b (k ) for each n ∈ N.
                                 k =0
Enumerative Combinatorics: class notes                                              page 126
  Exercise 1.4.7. For each n ∈ N, we let c (n) denote the number of all subsets of
  [n] that are simultaneously lacunar and O<E<O<E<....
    Prove that c (n) = c (n − 2) + c (n − 3) for all n ≥ 3.
  Remark 1.4.19. The sequence (c (0) , c (1) , c (2) , c (3) , . . .) from Exercise 1.4.7 is
  the Padovan sequence (starting with 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 21, 28, 37, 49).
                                                                n−d
                                                                   
           (# of k-element subsets A of N satisfying D ⊆ A) =         .
                                                                k−d
  Example 1.4.21. Let N = {1, 2, 3, 4} and D = {1, 2}. Then, the subsets A of N
  satisfying D ⊆ A are {1, 2}, {1, 2, 3}, {1, 2, 4} and {1, 2, 3, 4}. Thus, 1 of them has
  2 elements; 2 have 3 elements; and 1 has 4 elements. This agrees with Proposition
  1.4.20 (for n = 4 and d = 2).
Enumerative Combinatorics: class notes                                                     page 127
Proof of Proposition 1.4.20 (informal version). As usual, let me first show the informal
idea, and then its formalization.
  Informally, how can we construct a k-element subset A of N satisfying D ⊆ A ?
We need to choose k elements of N to go into A; but we cannot choose them freely,
because we must ensure that D ⊆ A. Thus, the d elements of D must necessarily
go into A; the only freedom that we have is to decide which of the remaining n − d
elements of N will go into A. More precisely, we need to choose k − d many of
these n − d elements, because the total size of A has to be k (and d of its elements
have already been decided). Thus, our decision boils down to choosing a (k − d)-
element subset of the (n − d)-element set N \ D. According to Theorem             1.3.12
                                                                            n−d
                                                                          
(applied to n − d, k − d and N \ D instead of n, k and S), there are               many
                                                                            k−d
such  subsets.  Thus, the total # of k-element subsets A of N satisfying D ⊆ A is
  n−d
       
          .
  k−d
   To formalize this argument, we have to replace our “boils down” handwaving with a
bijection. Here is how the result looks like:
Proof of Proposition 1.4.20 (formal version). We have | D | = d (since D is a d-element set) and
| N | = n (since N is an n-element set). Also, D is a subset of N. Thus, Theorem 1.4.7 (a)
(applied to A = N and B = D) yields | N \ D | = | N | − | D | = n − d. Hence, N \ D is an
                                                     |{z} |{z}
                                                         =n     =d
(n − d)-element set. Thus, Theorem 1.3.12 (applied to n − d, k − d and N \ D instead of n,
k and S) yields
                     n−d
                        
                            = (# of (k − d) -element subsets of N \ D ) .             (98)
                     k−d
   If A is a k-element subset of N satisfying D ⊆ A, then A \ D is a (k − d)-element subset
of N \ D 89 . Hence, the map
  {k-element subsets A of N satisfying D ⊆ A} → {(k − d) -element subsets of N \ D } ,
                                            A 7→ A \ D
is well-defined.
   On the other hand, if B is a (k − d)-element subset of N \ D, then B ∪ D is a k-element
subset A of N that satisfies D ⊆ A 90 . Hence, the map
  {(k − d) -element subsets of N \ D } → {k-element subsets A of N satisfying D ⊆ A} ,
                                    B 7→ B ∪ D
89 Proof.Let A be a k-element subset of N satisfying D ⊆ A. Then, | A| = k (since A is a k-element
   set). But D is a subset of A (since D ⊆ A). Hence, Theorem 1.4.7 (a) (applied to B = D) yields
   | A \ D | = | A| − | D | = k − d. In other words, A \ D is a (k − d)-element set. Hence, A \ D is a
               |{z} |{z}
              =k     =d
   (k − d)-element subset of N \ D (because |{z}
                                             A \ D ⊆ N \ D).
                                              ⊆N
90 Proof.Let B be a (k − d)-element subset of N \ D. Thus, B ⊆ N \ D and | B| = k − d (since B is a
   ( k − d )-element set). From B ⊆ N \ D, we conclude that the sets B and D are disjoint. Thus, (4)
Enumerative Combinatorics: class notes                                                    page 128
is well-defined.
   It is easy to see that these two maps are mutually inverse91 . Thus, they are bijections.
Hence, the bijection principle yields
           A1 × A2 × · · · × A n
           = {( a1 , a2 , . . . , an ) | ai ∈ Ai for all i ∈ [n]}
           = {( a1 , a2 , . . . , an ) | a1 ∈ A1 and a2 ∈ A2 and · · · and an ∈ An } .
(sending each element a1 of A1 to the 1-tuple ( a1 )) is a bijection. Thus, the two sets
denoted A1 have the same size, at least, and it is rare that anything bad comes out
of equating them.
   Applying Definition 1.5.1 to n = 0, we obtain the Cartesian product of 0 sets; this
is called the empty Cartesian product, and consists of all 0-tuples. There is only one
0-tuple, namely the empty list (); thus, this Cartesian product is the 1-element set
{()}.
   The Cartesian product of sets is not quite associative! For example, if A, B
and C are three sets, then the three Cartesian products A × B × C, ( A × B) × C
and A × ( B × C ) are not literally the same. The first of them consists of triples92
( a, b, c); the second consists of nested pairs (( a, b) , c); the third consists of nested
pairs ( a, (b, c)). These are different things, and should not be equated93 . Again,
however, there are bijections between these products: The maps
                                     A × B × C → ( A × B) × C,
                                        ( a, b, c) 7→ (( a, b) , c)
and
                                     A × B × C → A × (B × C) ,
                                        ( a, b, c) 7→ ( a, (b, c))
                     A 1 × A 2 × · · · × A n → ( A 1 × A 2 × · · · × A n −1 ) × A n ,
                           ( a1 , a2 , . . . , an ) 7→ (( a1 , a2 , . . . , an−1 ) , an )
  is a bijection.
     (b) If k ∈ {0, 1, . . . , n} is arbitrary, then the map
         A 1 × A 2 × · · · × A n → ( A 1 × A 2 × · · · × A k ) × ( A k +1 × A k +2 × · · · × A n ) ,
               ( a1 , a2 , . . . , an ) 7→ (( a1 , a2 , . . . , ak ) , ( ak+1 , ak+2 , . . . , an ))
  is a bijection.
92 Recall
        that the word “triple” means a 3-tuple. Tuples are always ordered by definition.
93 Forexample, the first entry of the triple ( a, b, c) is a, while the first entry of the pair (( a, b) , c) is
   the pair ( a, b).
Enumerative Combinatorics: class notes                                                      page 130
   Theorem 1.5.3 (The product rule for n sets). Let A1 , A2 , . . . , An be any n finite
   sets. Then, A1 × A2 × · · · × An is a finite set with size
| A1 × A2 × · · · × A n | = | A1 | · | A2 | · · · · · | A n | .
                                | A1 × A2 × · · · × A0 | = |{()}| = 1.
Comparing this with
                          | A1 | · | A2 | · · · · · | A0 | = (empty product) = 1,
we obtain | A1 × A2 × · · · × A0 | = | A1 | · | A2 | · · · · · | A0 |. In other words, Theorem 1.5.3 is
true for n = 0. This completes the induction base.
   Induction step: Let m ∈ N. Assume that Theorem 1.5.3 holds for n = m. We must prove
that Theorem 1.5.3 holds for n = m + 1.
   Let A1 , A2 , . . . , Am+1 be any m + 1 finite sets. Recall that we assumed that Theorem 1.5.3
holds for n = m. Hence,
                         | A1 × A2 × · · · × A m | = | A1 | · | A2 | · · · · · | A m | .
But Proposition 1.5.2 (a) (applied to n = m + 1) yields that the map
                                                                                 
              A1 × A2 × · · · × Am+1 → A1 × A2 × · · · × A(m+1)−1 × Am+1 ,
                                                                                 
                    ( a1 , a2 , . . . , am+1 ) 7→ a1 , a2 , . . . , a(m+1)−1 , am+1
Enumerative Combinatorics: class notes                                                                       page 131
           | A 1 × A 2 × · · · × A m +1 |
                                         
           = A1 × A2 × · · · × A(m+1)−1 × Am+1
           = A1 × A2 × · · · × A(m+1)−1 · | Am+1 |
            |           {z             }
                        =| A1 × A2 ×···× Am |
                        =| A1 |·| A2 |·····| Am |
                                                                                                           
                       by (5), applied to X = A1 × A2 × · · · × A(m+1)−1 and Y = Am+1
           = (| A1 | · | A2 | · · · · · | Am |) · | Am+1 |
           = | A 1 | · | A 2 | · · · · · | A m +1 | .
| A 1 × A 2 × · · · × A m +1 | = | A 1 | · | A 2 | · · · · · | A m +1 | .
In other words, Theorem 1.5.3 holds for n = m + 1. This completes the induction step, and
with it the proof of Theorem 1.5.3.
  A particular case of a Cartesian product is obtained when all the “factors” are
equal:
   Definition 1.5.4. Let A be a set, and let n ∈ N. Then, the n-th (Cartesian) power
   An of A is defined to be the Cartesian product |A × A ×
                                                         {z· · · × A}.
                                                                                     n times
   Corollary 1.5.5. Let A be a finite set. Let n ∈ N. Then, An is a finite set with size
   | An | = | A|n .
   Definition 1.5.6. Let A and B be two finite sets. Then, B A shall mean the set of
   all maps from A to B.
   Theorem 1.5.7. Let A and B be two finite sets. Then, the set B A is finite, and its
   size is
                                   B A = | B || A| .
   Example 1.5.8. Theorem 1.5.7 (applied to A = [2] and B = [3]) says that the set
   [3][2] is finite, and that its size is [3][2] = |[3]||[2]| = 32 = 9. In other words, there
   are exactly 9 maps from [2] to [3]. Here are these 9 maps (written in two-line
   notation, as explained in Definition 1.2.11):
                                                                    
                           1 2                  1 2                1 2
                                    ,                  ,
                           1 1                  1 2                1 3
                                                                    
                           1 2                  1 2                1 2
                                    ,                  ,
                           2 1                  2 2                2 3
                                                                    
                           1 2                  1 2                1 2
                                    ,                  ,                   .
                           3 1                  3 2                3 3
                              Φ : B A → Bk ,
                                    f 7→ ( f ( a1 ) , f ( a2 ) , . . . , f ( ak )) .
This map Φ sends each function f : A → B to its list of values at the points94
a1 , a2 , . . . , ak . This list of values clearly determines f uniquely (since A = { a1 , a2 , . . . , ak },
94 I   am just using “point” as just a suggestive way of saying “element of A” here.
Enumerative Combinatorics: class notes                                                             page 133
so that each value of f appears somewhere in the list95 ); thus, the map Φ is injective.
Furthermore, for each k-tuple (b1 , b2 , . . . , bk ) ∈ Bk , there exists a function f : A → B
such that ( f ( a1 ) , f ( a2 ) , . . . , f ( ak )) = (b1 , b2 , . . . , bk ) (indeed, this latter function f
is given by                                                                 
                                                    a1 a2 · · · a k
                                           f =
                                                    b1 b2 · · · bk
in two-line notation). Hence, the map Φ is surjective. Thus, we know that the map
Φ is both injective and surjective. Therefore, Φ is bijective, i.e., is a bijection. Hence,
the bijection principle yields B A = Bk .
  Corollary 1.5.5 (applied to B and k instead of A and n) shows that Bk is a finite
set with size Bk = | B|k . Hence, B A = Bk = | B|k = | B|| A| (since k = | A|). Thus,
in particular, B A is a finite set. This proves Theorem 1.5.7.
   In one of the next chapters, we will count certain restricted types of maps (injec-
tive maps, surjective maps, etc.).
1.5.3. Applications
Theorem 1.5.7 and Theorem 1.5.3 can be used not only in the kind of problems
that are visibly concerned with subsets or tuples. In fact, often one can discover a
bijection between the objects one wants to count and some kind of maps or tuples.
The most famous example is a combinatorial proof of Theorem 1.4.1:
Third proof of Theorem 1.4.1. The set S is an n-element set. Let us denote its n ele-
ments by s1 , s2 , . . . , sn (in an arbitrary order, with no repetitions). Thus, s1 , s2 , . . . , sn
are n distinct elements of S and satisfy S = {s1 , s2 , . . . , sn }.
   We will construct a bijection from the set {subsets of S} to {0, 1}n . This will then
let us apply Corollary 1.5.5 (and the bijection principle) and obtain |{subsets of S}| =
2n . So let us construct such a bijection:
   We define the map A : {subsets of S} → {0, 1}n by setting96
           A ( T ) = ([s1 ∈ T ] , [s2 ∈ T ] , . . . , [sn ∈ T ])         for each subset T of S.
(This is well-defined, since each of the truth values [s1 ∈ T ] , [s2 ∈ T ] , . . . , [sn ∈ T ]
belongs to {0, 1}.) For example, if n = 5 and T = {s2 , s4 , s5 }, then A ( T ) =
(0, 1, 0, 1, 1). (Some call A ( T ) the indicator vector of T, since its i-th entry indicates
whether si belongs to T or not.)
  In order to prove that A is a bijection, we shall next construct a map B in the
other direction, and then show that it is inverse to A.
  We define the map B : {0, 1}n → {subsets of S} by setting
                   B ((i1 , i2 , . . . , in )) = {sk | k ∈ [n] and ik = 1}
                                                    for each (i1 , i2 , . . . , in ) ∈ {0, 1}n .
95 And   we know where exactly it appears in the list, because a1 , a2 , . . . , ak are fixed.
96 We   are using the Iverson bracket notation (defined in Definition 1.3.15).
Enumerative Combinatorics: class notes                                                                             page 134
   • In order to show that A ◦ B = id, we fix some (i1 , i2 , . . . , in ) ∈ {0, 1}n . We shall show
     that ( A ◦ B) ((i1 , i2 , . . . , in )) = (i1 , i2 , . . . , in ).
         Set T = B ((i1 , i2 , . . . , in )). Thus, T = B ((i1 , i2 , . . . , in )) = {sk | k ∈ [n] and ik = 1}
         (by the definition of B). Now,
                                                                                      
       Now, forget that we fixed (i1 , i2 , . . . , in ). We thus have proven (100) for each (i1 , i2 , . . . , in ) ∈
       {0, 1}n . Hence, A ◦ B = id.
    • In order to prove that B ◦ A = id, we fix T ∈ {subsets of S}. We are going to show
      that ( B ◦ A) ( T ) = T.
       We know that T is a subset of S (since T ∈ {subsets of S}). In other words, T ⊆ S.
       We have A ( T ) = ([s1 ∈ T ] , [s2 ∈ T ] , . . . , [sn ∈ T ]) by the definition of A. Now,
                                                                         
                            ( B ◦ A) ( T ) = B                A (T )
                                                                                         
                                                                                          
                                                               | {z }
                                                   =([s1 ∈ T ],[s2 ∈ T ],...,[sn ∈ T ])
Hence, 2n = |{subsets of S}| = (# of subsets of S). This proves Theorem 1.4.1 once
again.101
99 Proof.   Let s ∈ ( B ◦ A) ( T ). Thus, s ∈ ( B ◦ A) ( T ) = {sk | k ∈ [n] and [sk ∈ T ] = 1}. In other
     words, s = sk for some k ∈ [n] satisfying [sk ∈ T ] = 1. Consider this k. From [sk ∈ T ] = 1, we
     conclude that sk ∈ T must be true (by the definition of the Iverson bracket notation). Hence,
     s = sk ∈ T.
       Forget that we fixed s. We thus have proved that s ∈ T for each s ∈ ( B ◦ A) ( T ). In other
     words, ( B ◦ A) ( T ) ⊆ T.
100 Proof. Let s ∈ T. Then, s ∈ T ⊆ S = { s , s , . . . , s }. In other words, s = s for some j ∈ [ n ].
                                                    1 2     n                       j
     Consider this j. Then, s j = s ∈ T. Hence, s j ∈ T = 1. Thus, j is a k ∈ [n] satisfying [sk ∈ T ] = 1
                                      
     (because j ∈ [n] and s j ∈ T = 1). Hence, s j ∈ {sk | k ∈ [n] and [sk ∈ T ] = 1}. In view of
     (101), this rewrites as s j ∈ ( B ◦ A) ( T ). Thus, s = s j ∈ ( B ◦ A) ( T ).
       Forget that we fixed s. We thus have proved that s ∈ ( B ◦ A) ( T ) for each s ∈ T. In other
     words, T ⊆ ( B ◦ A) ( T ).
101 This proof has been taken from [19f-hw0s, solution to Exercise 1 (a)] (but slightly adapted for the
     fact that we are using the set S rather than [n] here).
Enumerative Combinatorics: class notes                                                     page 136
   The key idea in the above proof of Theorem 1.4.1 was to encode any subset of
the n-element set S as an n-tuple (i1 , i2 , . . . , in ) ∈ {0, 1}n . Instead of using an n-
tuple, we could have just as well used a map from [n] to {0, 1}, since we learned to
translate between tuples and maps in the above proof of Theorem 1.5.7. The reader
can easily restate our above proof of Theorem 1.4.1 using maps instead of tuples.
   Here are some other counting exercises that can easily be reduced to counting
tuples or maps:
Class of 2019-10-11
  Theorem 1.6.1 ((Finite) Fubini principle). Let X and Y be two finite sets. Let
  a( x,y) be a number for each pair ( x, y) ∈ X × Y. Then,
  Theorem 1.6.1 is called the finite Fubini principle or Fubini’s theorem for finite sums,
since it is a discrete analogue of Fubini’s principle for double integrals. A proof of
Enumerative Combinatorics: class notes                                                page 137
Theorem 1.6.1 is outlined in [Grinbe15, §1.4.2] (and an alternative proof can easily
be obtained by induction on | X |); here I shall restrict myself to illustrating it on an
example:
  Example 1.6.2. Let n ∈ N and m ∈ N. Let a( x,y) be a number for each pair
  ( x, y) ∈ [n] × [m]. Then, (102) (applied to X = [n] and Y = [m]) yields
                      n   m                                             m       n
                     ∑ ∑ a(x,y) =              ∑           a( x,y) =   ∑ ∑ a(x,y) .      (103)
                     x =1 y =1            ( x,y)∈[n]×[m]               y =1 x =1
  This equality, when rewritten to avoid the use of summation signs, looks as
  follows:
                                      
      a(1,1) + a(1,2) + · · · + a(1,m)
                                               
             + a(2,1) + a(2,2) + · · · + a(2,m)
           +···
                                              
           + a(n,1) + a(n,2) + · · · + a(n,m)
                                                                                         
    = a(1,1) + a(1,2) + · · · + a(n,m)          this is the sum of all nm numbers a( x,y)
                                      
    = a(1,1) + a(2,1) + · · · + a(n,1)
                                             
           + a(1,2) + a(2,2) + · · · + a(n,2)
           +···
                                            
           + a(1,m) + a(2,m) + · · · + a(n,m) .
then the following three procedures all produce the same result:
    (a) summing up the m numbers in each row of the table separately, and then
        summing up these n “row tallies”;
    (b) summing up all the nm numbers in the table;
    (c) summing up the n numbers in each column of the table separately, and
        then summing up these m “column tallies”.
  This is, of course, exactly how you would expect sums to behave.
Enumerative Combinatorics: class notes                                                                        page 138
                                    ∑ ∑          =        ∑         =   ∑ ∑.
                                    x ∈ X y ∈Y       ( x,y)∈ X ×Y       y ∈Y x ∈ X
   Exercise 1.6.1. Let n ∈ N. Let S be an n-element set. Find the sum of the sizes
   of all subsets of S; in other words, find the sum
                                                        ∑      |T | .
                                                        T ⊆S
                                                 |T | =   ∑ [s ∈ T ] .
                                                          s∈S
     (b) For each s ∈ S, let A (s) be a logical statement (which can be either true
   or false depending on s; for example, A (s) could be “s is even” if S is a set of
   integers, or “s is empty” if S is a set of sets). Then,
102 Ofcourse, you can do this only if X and Y are finite sets that have a well-defined meaning
    independent of x and y. Thus, you cannot replace the sequence “ ∑ ∑ ” by “ ∑ ∑ ”: The
                                                                                     x ∈[n] y∈[ x ]   y∈[ x ] x ∈[n]
     latter sequence would be meaningless, since the “x” under the first summation sign now refers
     to nothing. We will soon see how such double summations can be transformed.
103 For the meaning of the square brackets on the right hand side, see Definition 1.3.15.
Enumerative Combinatorics: class notes                                                                    page 139
  Example 1.6.4. (a) Applying Proposition 1.6.3 (a) to S = [5] and T = {1, 3, 5}, we
  obtain
                 |{1, 3, 5}| = ∑ [s ∈ {1, 3, 5}] = 1 + 0 + 1 + 0 + 1.
                                     s∈[5]
    (b) Applying Proposition 1.6.3 (b) to S = [5] and A (s) = (“s is odd”), we
  obtain
   Why am I calling this “counting by roll call”? Because Proposition 1.6.3 (a) for-
malizes a way to count the elements of the subset T by “calling the roll” of all
elements of S and adding a 1 every time an element of T is encountered. Proposi-
tion 1.6.3 (b) does the same thing, except we are no longer counting the elements
of T, but instead are counting the elements s of S that satisfy A (s). The two parts
of Proposition 1.6.3 are easily seen to be equivalent to each other, since any subset
T of S gives rise to a logical statement A (s) = (“s ∈ T”) for each s ∈ S, and con-
versely, any logical statement A (s) defined for each s ∈ S can be used to carve out
a subset {s ∈ S | A (s) holds} of S.
   The formal proof is not much more complicated:
Proof of Proposition 1.6.3. (b) Let Q be the set of all s ∈ S that satisfy A (s). Then,
Furthermore, the elements s ∈ S for which A (s) is true are precisely the elements
of Q (because this is how Q is defined).
  Now, apply the formula (28) to as = [A (s)]. Thus, we obtain
                  =       ∑          1+         ∑         0=          ∑          1=   ∑1
                         s∈S;                s∈S;                    s∈S;             s∈ Q
                      A(s) is true        A(s) is false           A(s) is true
                                          |      {z       }
                                                 =0
                                                                                                         
                               since the elements s ∈ S for which A (s) is true
                                        are precisely the elements of Q
                  = | Q|       (by (30), applied to Q instead of S)
                  = (# of s ∈ S that satisfy A (s)) .
                   (# of s ∈ S that satisfy s ∈ T ) = {s ∈ S | s ∈ T } = | T | ,
                                                      |      {z      }
                                                                                  =S∩ T = T
First solution to Exercise 1.6.1. Let P (S) denote the powerset of S. This is a finite
set, since S is finite.
  We have |S| = n (since S is an n-element set). But
                    ∑                 |T |                =    ∑ ∑ [s ∈ T ] = ∑ ∑                       [s ∈ T ] ,      (104)
                   T ⊆S                                        T ⊆S s∈S                     s∈S T ⊆S
                                     |{z}
                                  = ∑ [s∈ T ]
                                    s∈S
                          (by Proposition 1.6.3 (a))
where the last equality has been obtained by interchanging the two summation
signs (using the Fubini principle)104 . Hence,
                                 ∑       |T | =     ∑∑         [s ∈ T ] =     ∑ ∑           [x ∈ T]                     (105)
                                 T ⊆S               s∈S T ⊆S                  x ∈S T ⊆S
                            ∑ ∑ [y ∈ x ] =                  ∑           [y ∈ x ] =   ∑ ∑            [y ∈ x ] .
                          x ∈P (S) y∈S                 ( x,y)∈P (S)×S                y∈S x ∈P (S)
    Renaming the summation indices x and y as T and s (in order to match the notations in (104)),
    we rewrite this as
                            ∑ ∑ [s ∈ T ] =                  ∑           [s ∈ T ] =   ∑ ∑            [s ∈ T ] .
                          T ∈P (S) s∈S                 ( T,s)∈P (S)×S                s∈S T ∈P (S)
    Since the summation sign               ∑        is synonymous to ∑ , we can further rewrite this as follows:
                                         T ∈P (S)                          T ⊆S
                                ∑ ∑ [s ∈ T ] =              ∑           [s ∈ T ] =   ∑∑         [s ∈ T ] .
                             T ⊆S s∈S                  ( T,s)∈P (S)×S                s∈S T ⊆S
In other words,
(# of subsets of S \ { x }) = 2n−1 .
Hence,
 Now, forget that we fixed x. We thus have proved that (107) holds for each x ∈ S.
Hence, (105) becomes
               ∑     |T | =   ∑ ∑         [x ∈ T] =         ∑ 2n−1 = |{z}
                                                                      | S | · 2n −1 = n · 2n −1 .
              T ⊆S            x ∈S T ⊆S                    s∈S
                                  |       {z       }                        =n
                                        =2n −1
                                      (by (107))
                ∑                 |T |                 =   ∑ ∑ [s ∈ T ] = ∑ ∑               [s ∈ T ]
                T ⊆S                                       T ⊆S s∈S              s∈S T ⊆S
                                 |{z}
                              = ∑ [s∈ T ]                  | {z }
                                s∈S                        =∑ ∑
                       (by Proposition 1.6.3 (a))           s∈S T ⊆S
                                                       =   ∑ ∑         [x ∈ T]                            (108)
                                                           x ∈S T ⊆S
               ∑     |T | =   ∑ ∑         [x ∈ T] =         ∑ 2n−1 = |{z}
                                                                      | S | · 2n −1 = n · 2n −1 .
              T ⊆S            x ∈S T ⊆S                    s∈S
                                  |       {z       }                        =n
                                        =2n −1
                                      (by (109))
                                    f : P (S) → {0, 1, . . . , n} ,
                                            T 7→ | T | .
Consider this map f . Now, (37) (applied to P (S), {0, 1, . . . , n} and |s| instead of S,
W and as ) yields
                         ∑ |s| = ∑                ∑ |s| .
                              s∈P (S)           w∈{0,1,...,n}    s∈P (S);
                                                                  f (s)=w
In other words,
                                ∑      |T | =       ∑              ∑        |T |
                                T ⊆S            w∈{0,1,...,n}     T ⊆S;
                                                                f ( T )=w
The left hand side of this equality is the sum we want to find; let us get a better
understanding of the right hand side.
107 Proof. Let T ∈ P (S). Thus, T is a subset of S (by the definition of P (S)). Hence, Theorem 1.4.7
    (b) (applied to A = S and B = T) yields | T | ≤ |S| = n (since S is an n-element set). Hence,
    | T | ∈ {0, 1, . . . , n} (since | T | is clearly a nonnegative integer).
Enumerative Combinatorics: class notes                                                               page 144
  Let k ∈ {0, 1, . . . , n}. The definition of f shows that f ( T ) = | T | for each subset T
of S. Hence,
        ∑         |T | =    ∑     |T | =     ∑        k=               ∑                  k
        T ⊆S;               T ⊆S;            T ⊆S;          T ∈{k-element subsets of S}
                                 |{z}
      f ( T )=k            | T |=k =k       | T |=k
                                                                                             
                                     since the subsets T of S satisfying | T | = k
                                       are precisely the k-element subsets of S
                     = |{k-element subsets of S}| ·k                          (by an application of (29))
                       |              {z                 }
                         =(# of k-element
                                        subsets of S )
                                       n
                                    =
                                       k
                                    (by Theorem 1.3.12)
                                 
                        n          n
                     =     ·k = k     .                                                                 (111)
                        k          k
Forget that we fixed k. We thus have proven (111) for each k ∈ {0, 1, . . . , n}. Hence,
(110) becomes
                                                              n  
                                                           n           n
            ∑ |T | = ∑              ∑ |T | = ∑ k k = ∑ k k .
           T ⊆S      k∈{0,1,...,n} T ⊆S;    k∈{0,1,...,n}     k =0
                                                f ( T )=k
                                                |      {z }
                                                       
                                                         n
                                                    =k
                                                         k
                                                 (by (111))
as follows:
                                      ∑       |T | =         ∑            ∑        |T | .      (112)
                                     T ⊆S                k∈{0,1,...,n}    T ⊆S;
                                                                         | T |=k
But for each k ∈ {0, 1, . . . , n}, we have
                                                                              
                                                                     n          n
     ∑ |{z}| T | = ∑ k = (# of all T ⊆ S satisfying | T | = k) ·k =
                                                                     k
                                                                        ·k = k
                                                                                k
                                                                                   .
    T ⊆S;          T ⊆S;
                          |                 {z                }
   | T |=k =k     | T |=k      =(# of k-element
                                              subsets of S)
                                             n
                                          =
                                             k
                                                 (by Theorem 1.3.12)
                                                ∑      | T | = n · 2n −1 .
                                               T ⊆S
     Theorem 1.6.6 (Finite Fubini’s principle with a predicate). Let X and Y be two
     finite sets. For each pair ( x, y) ∈ X × Y, let A ( x, y) be some statement (for
     example, “x + y is even” or “x < y”, if X and Y are sets of numbers). For each
     pair ( x, y) ∈ X × Y satisfying A ( x, y), let a( x,y) be a number. Then,
  The idea behind Theorem 1.6.6 is the same as the one behind Theorem 1.6.1:
We have a table of numbers, and we can add up the numbers in this table in
three different ways (row by row, in a random order, or column by column). The
difference is that this time, the table can have empty cells (more precisely, only the
cells ( x, y) for which A ( x, y) is true have a number in them); of course, these empty
cells don’t contribute to the sums.109
109 We  remark that Theorem 1.6.6 can easily be derived from Theorem 1.6.1. Indeed, if we define
     the (hitherto undefined) number a( x,y) to be 0 whenever ( x, y) ∈ X × Y does not satisfy A ( x, y),
     then we can apply Theorem 1.6.1, and the equality (102) we obtain quickly rewrites as (113).
Enumerative Combinatorics: class notes                                                    page 147
  Corollary 1.6.7 (Triangular Fubini’s principle I). Let n ∈ N. For each pair ( x, y) ∈
  [n] × [n] with x + y ≤ n, let a(x,y) be a number. Then,
                        n n− x                                          n n−y
                       ∑ ∑ a(x,y) =         ∑           a( x,y) =   ∑ ∑ a(x,y) .
                       x =1 y =1      ( x,y)∈[n]×[n];               y =1 x =1
                                           x +y≤n
  Example 1.6.8. If we set n = 4 in Corollary 1.6.7 and rewrite the result without
  using summation signs, then we obtain
                                             
      a(1,1) + a(1,2) + a(1,3) + a(2,1) + a(2,2) + a(3,1) + (empty sum)
                                                                                       
    = a(1,1) + a(1,2) + · · · + a(3,1)       this is the sum of all the numbers a( x,y)
                                                
    = a(1,1) + a(2,1) + a(3,1) + a(1,2) + a(2,2) + a(1,3) + (empty sum) .
then the following three procedures all produce the same result:
    (a) summing up the numbers in each row of the table separately, and then
        summing up these “row tallies”;
    (c) summing up the numbers in each column of the table separately, and then
        summing up these “column tallies”.
Enumerative Combinatorics: class notes                                                                 page 148
Proof of Corollary 1.6.7. Theorem 1.6.6 (applied to X = [n], Y = [n] and A ( x, y) = (“x + y ≤ n”))
yields
                       ∑ ∑ a(x,y) = ∑ a(x,y) = ∑ ∑ a(x,y) .                               (114)
                              x ∈[n] y∈[n];               ( x,y)∈[n]×[n];              y∈[n] x ∈[n];
                                    x +y≤n                     x +y≤n                       x +y≤n
We shall now rewrite the two inner sums in this chain of equalities.
   Let x ∈ [n]. Then, x ≥ 1 ≥ 0, so that n − x ≤ n. Thus, [n − x ] ⊆ [n], so that [n − x ] ∩ [n] =
[n − x ]. Hence, the elements y ∈ [n] that satisfy y ≤ n − x are precisely the elements of
[n − x ] (indeed, they are clearly the elements of [n − x ] ∩ [n]; but we just showed that
[n − x ] ∩ [n] = [n − x ]).
   However, the statement “x + y ≤ n” for an integer y is equivalent to “y ≤ n − x”, and
thus can be replaced by the latter statement whenever it appears under a summation sign.
Thus,
    ∑       a(x,y) =     ∑       a(x,y)
   y∈[n];               y∈[n];
  x +y≤n               y≤n− x
  Forget that we fixed x. We thus have proved (115) for each x ∈ [n]. Likewise, we can
prove that
                                                                            n−y
                                                      ∑        a(x,y) =     ∑ a(x,y)                          (116)
                                                     x ∈[n];                x =1
                                                    x +y≤n
for each y ∈ [n]. In light of the two equalities (115) and (116), we can rewrite the chain of
equalities (114) as follows:
                                       n− x                                                 n−y
                                 ∑ ∑           a(x,y) =         ∑           a(x,y) =    ∑ ∑ a(x,y) .
                                x ∈[n] y=1                ( x,y)∈[n]×[n];              y∈[n] x =1
                                                               x +y≤n
In other words,
                                    n n− x                                              n n−y
                                   ∑ ∑ a(x,y) =                 ∑           a(x,y) =   ∑ ∑ a(x,y)
                                   x =1 y =1              ( x,y)∈[n]×[n];              y =1 x =1
                                                               x +y≤n
                                                                                   n
(since the summation sign ∑ is synonymous to ∑ , whereas the summation sign ∑ is
                                          x ∈[n]                              x =1                       y∈[n]
                        n
synonymous to ∑ ). This proves Corollary 1.6.7.
                       y =1
   Let us apply Corollary 1.6.7 to solving an exercise (arguably, one that could be
more easily solved by other means, but this does not preclude it from being a useful
illustration):
Enumerative Combinatorics: class notes                                                         page 149
Solution to Exercise 1.6.2. For each x ∈ [n], we have n − x ∈ N (since x ∈ [n] entails
x ≤ n and thus n − x ≥ 0), so that
                                 n− x
                                 ∑ 1 = (n − x) · 1 = n − x.                                       (117)
                                 y =1
                                                           n
  Renaming the index k as x in the sum ∑ k (n − k), we obtain
                                                       k =1
                       n                           n                         n         n− x
                      ∑      k (n − k) =          ∑ x (|n {z
                                                          − x) =            ∑ ∑1   x
                      k =1                        x =1                      x =1       y =1
                                                             }
                                                               n− x
                                                           =∑ 1
                                                                                   | {z }
                                                               y =1                    n− x
                                                                                   = ∑ x ·1
                                                        (by (117))                     y =1
                                                                                   (by (32))
                                                   n n− x                   n n− x
                                              =       x · 1 = ∑ ∑ x.
                                                  ∑ ∑ |{z}                                        (118)
                                                  x =1 y =1 = x            x =1 y =1
                             n n− x                                         n n−y
                           ∑ ∑x=                       ∑              x=   ∑ ∑ x.                 (119)
                           x =1 y =1          ( x,y)∈[n]×[n];              y =1 x =1
                                                   x +y≤n
           n+1−y          (n + 1 − y) ((n + 1 − y) − 1)   (n + 1 − y) (n − y)
                   
                       =                                =
               2                        2                          2
Enumerative Combinatorics: class notes                                                                page 150
                                 0 (0 − 1)
                                                                                     
                           n+1                                    n+1                 n+1
                  =            −           =                                  =             .
                           2+1   | {z2 }                          2+1                  3
                                               =0
  Corollary 1.6.9 (Triangular Fubini’s principle II). Let n ∈ N. For each pair
  ( x, y) ∈ [n] × [n] with x ≤ y, let a(x,y) be a number. Then,
                             n      n                                                 n    y
                            ∑ ∑ a(x,y) =                     ∑        a( x,y) =       ∑ ∑ a(x,y) .
                            x =1 y = x              ( x,y)∈[n]×[n];               y =1 x =1
                                                          x ≤y
Enumerative Combinatorics: class notes                                                                    page 151
  Example 1.6.10. If we set n = 4 in Corollary 1.6.9 and rewrite the result without
  using summation signs, then we obtain
                                       
      a(1,1) + a(1,2) + a(1,3) + a(1,4)
                                         
             + a(2,2) + a(2,3) + a(2,4)
                               
             + a(3,3) + a(3,4)
            + a(4,4)
                                                                                                              
     = a(1,1) + a(1,2) + · · · + a(4,4)                       this is the sum of all the numbers a( x,y)
     = a(1,1)
                             
            + a(1,2) + a(2,2)
                                      
            + a(1,3) + a(2,3) + a(3,3)
                                              
            + a(1,4) + a(2,4) + a(3,4) + a(4,4) .
then the following three procedures all produce the same result:
    (a) summing up the numbers in each row of the table separately, and then
        summing up these “row tallies”;
    (c) summing up the numbers in each column of the table separately, and then
        summing up these “column tallies”.
Proof of Corollary 1.6.9. This is similar to the proof of Corollary 1.6.7; we just need to de-
fine the statements A ( x, y) differently. Theorem 1.6.6 (applied to X = [n], Y = [n] and
A ( x, y) = (“x ≤ y”)) yields
                        ∑ ∑            a(x,y) =        ∑            a(x,y) =    ∑ ∑            a(x,y) .      (121)
                       x ∈[n] y∈[n];              ( x,y)∈[n]×[n];              y∈[n] x ∈[n];
                               x ≤y                     x ≤y                          x ≤y
We shall now rewrite the two inner sums in this chain of equalities.
Enumerative Combinatorics: class notes                                                            page 152
  Let x ∈ [n]. Then, 1 ≤ x ≤ n. Hence, the elements y ∈ [n] that satisfy x ≤ y are precisely
the elements of { x, x + 1, . . . , n}. Thus,
                                                                                       n
                                 ∑       a(x,y) =          ∑            a(x,y) =    ∑ a(x,y) .       (122)
                                y∈[n];              y∈{ x,x +1,...,n}              y= x
                                 x ≤y
  Forget that we fixed x. We thus have proved (122) for each x ∈ [n].
  Next, let y ∈ [n]. Then, 1 ≤ y ≤ n. Hence, the elements x ∈ [n] that satisfy x ≤ y are
precisely the elements of {1, 2, . . . , y}. Thus,
                                                                                   y
                                   ∑       a(x,y) =        ∑           a(x,y) =   ∑ a(x,y) .         (123)
                                 x ∈[n];              x ∈{1,2,...,y}              x =1
                                  x ≤y
   Forget that we fixed y. We thus have proved (123) for each y ∈ [n].
   In light of the two equalities (122) and (123), we can rewrite the chain of equalities (121)
as follows:
                                  n                                                        y
                          ∑ ∑            a(x,y) =        ∑             a(x,y) =    ∑ ∑ a(x,y) .
                         x ∈[n] y= x                ( x,y)∈[n]×[n];               y∈[n] x =1
                                                          x ≤y
In other words,
                            n      n                                               n       y
                           ∑∑            a(x,y) =         ∑            a(x,y) =    ∑ ∑ a(x,y)
                          x =1 y = x                ( x,y)∈[n]×[n];               y =1 x =1
                                                          x ≤y
                                                                          n
(since the summation sign ∑ is synonymous to ∑ , whereas the summation sign ∑ is
                                   x ∈[n]                                x =1                       y∈[n]
                   n
synonymous to ∑ ). This proves Corollary 1.6.9.
                  y =1
   Let us illustrate Corollary 1.6.9 on two examples of its use. The first is an exercise
([19f-hw2s, Exercise 1]) about harmonic numbers:
  Prove that
                             H1 + H2 + · · · + Hn = (n + 1) ( Hn+1 − 1)
  for each n ∈ N.
  It is not hard to solve this exercise by induction on n (see [19f-hw2s, First solution
to Exercise 1]); but here is a different solution, using Corollary 1.6.9:
Enumerative Combinatorics: class notes                                                         page 153
                                                    1
Now, Corollary 1.6.9 (applied to a( x,y) =            ) yields
                                                    x
                         n    n                                n         y
                                     1                   1             1
                        ∑∑           x
                                       =       ∑         x
                                                           = ∑    ∑    x
                                                                         .
                        x =1 y = x       ( x,y)∈[n]×[n];     y =1 x =1
                                                x ≤y
      (n + 1) ( Hn+1 − 1)
      = ( n + 1)          Hn+1                  −                ( n + 1)
                          | {z  }                                | {z }
                           n +1 1                                  n +1
                          =∑                                      =∑ 1
                           k =1 k                                  k =1
                 (by (124), applied to m=n+1)             n +1
                                                    (since ∑ 1 = (n + 1) · 1 = n + 1)
                                                          k =1
                 n +1      n +1      n +1            n +1
                        1                       1                      1
      = ( n + 1) ∑
                        k k∑     ∑ ( n + 1) · k − 1 = ∑ ( n − k + 1) · k
                          −    1=
                  k =1      =1   k =1 |      {z       } k =1
                                                   1
                                         =(n−k+1)·
                                                   k
                                       n
                              1                      1
      = ( n − ( n + 1) + 1) ·     + ∑ ( n − k + 1) ·
        |        {z       } n + 1 k =1               k
                 =0
             (here, we have split off the addend for k = n + 1 from the sum)
          n
                         1
      = ∑ ( n − k + 1) · ,
        k =1
                         k
  Exercise 1.6.4 is not too hard to solve by induction (see [Grinbe15, Exercise 3.19]
for such a solution); but for illustrative purposes, let me solve it using Corollary
1.6.9 here:
Solution to Exercise 1.6.4. Let k ∈ [n]. Then, 1 ≤ k ≤ n, so that k ≥ 1 and thus
k − 1 ∈ N. Note that k ≥ 1 also entails k ∈ {1, 2, 3, . . .}. Furthermore, n ≥ 1 (since
1 ≤ n) and thus n − 1 ∈ N. Hence, Theorem 1.3.29 (applied to n − 1 and k − 1
instead of n and k) yields
     k−1         ( k − 1) + 1      ( k − 1) + 2             n−1
                                                          
             +                 +                  +···+
     k−1             k−1               k−1                  k−1
        ( n − 1) + 1
                      
                            n
    =                   =              (since (n − 1) + 1 = n and (k − 1) + 1 = k) .
        ( k − 1) + 1        k
Enumerative Combinatorics: class notes                                                     page 155
Hence,
             k−1     ( k − 1) + 1      ( k − 1) + 2            n−1
                                                           
       n
         =        +                +                  +···+
       k     k−1         k−1               k−1                 k−1
                                                              n 
             k−1                                    n−1           i−1
                                                                
                        k         k+1
         =        +           +          +···+            =∑              .
             k−1     k−1          k−1               k−1     i =k
                                                                  k − 1
                                       (−1)k−1
Multiplying both sides of this equality by     , we obtain
                                          k
        (−1)k−1 n     (−1)k−1 n i − 1
                                    
           k    k
                   =
                          k   ∑ k−1
                             i =k
                       n
                                (−1)k−1          i−1
                                                     
                   =∑                                                              (by (32))
                     i =k       | {zk }          k−1
                                         (−1)k−1 i
                                       =        ·
                                            i     k
                                (since i 6=0 (because i ≥k≥1>0))
                            n
                               (−1)k−1                      i i−1
                                                                  
                         =∑            ·
                          i =k
                                  i                         k k−1
                                                            | {z  }
                                                                i
                                                             =
                                                                k
                                                    (since Proposition 1.3.36
                                             (applied to iand
                                                             k instead
                                                                    of mand n)
                                                            i          i i−1
                                                   yields          =           )
                                                            k          k k−1
                            n
                               (−1)k−1 i
                                       
                         =∑               .                                                    (126)
                          i =k
                                  i    k
  Now forget that we fixed k. We thus have proved (126) for each k ∈ [n]. Hence,
                     n
                           (−1)k−1 n           n n
                                                        (−1)k−1 i
                                                              
                    ∑         k       k
                                           = ∑∑
                                                           i    k
                    k =1 |      {z      }    k =1 i = k
                                  k −1  
                           n (−1)       i
                        =∑
                         i =k   i       k
                                (by (126))
                                                      n     i
                                                             (−1)k−1 i
                                                                     
                                                  =∑∑                   .                      (127)
                                                   i =1 k =1
                                                                i    k
Here, the last equality sign has been obtained by applying Corollary 1.6.9 to a( x,y) =
(−1) x−1 y
          
               (and then renaming the summation indices x and y as k and i).
   y       x
Enumerative Combinatorics: class notes                                            page 156
Hence,
             i                        i      
                     i             i           k i
         0 = ∑ (−1)  k
                        = (−1) 0
                                      + ∑ (−1)
             k =0
                     k    | {z } 0      k =1
                                                 k
                            =1   |{z}
                                           =1
                                        (by (44))
                (here, we have split off the addend for k = 0 from the sum)
                  i                           i                i
                                    i
          = 1 + ∑ (−1)      k
                                        = 1 + ∑ − (−1)      k −1
                k =1
                      | {z }        k         k =1
                                                                    k
                            k −1
                     =−(−1)                   |          {z      }
                                                      i           i
                                                  =− ∑ (−1)k−1
                                                    k =1          k
                  i                
                                  i
          = 1 − ∑ (−1)k−1             .
                k =1
                                 k
In other words,
                                  i                   
                                                      i
                                 ∑ (−1)       k −1
                                                      k
                                                         = 1.                        (128)
                                 k =1
   Now, forget that we fixed i. We thus have proven (128) for each i ∈ [n]. Thus,
(127) becomes
    n
       (−1)k−1 n       n   i
                              (−1)k−1 i         n    i
                                                                  
                                                        1        k −1 i
  ∑ k           k
                   =∑∑
                                 i       k
                                            = ∑ ∑ · (−1)
                                                         i             k
  k =1               i =1 k=1 | {z }          i =1 k =1
                               1
                                                   |           {z   }
                             = ·(−1)k−1                 1 i          i
                               i                      = ∑ (−1)k−1
                                                        i k =1       k
                                                                (by (32))
                        n
                          1 i               n       n
                                      
                                 k −1 i        1       1 1 1 1
                    = ∑ ∑ (−1)           = ∑ ·1 = ∑ = + +···+ .
                          i
                      i =1 k =1
                                      k        i       i 1 2 n
                            |   {z      } i =1    i =1
                                    =1
                                 (by (128))
many nonzero addends; moreover, I claimed that they satisfy the same rules as
finite sums. This is true for all the rules listed above (including the Fubini principle
in all its forms) as long as we assume that each of the sums appearing in the rule
has only finitely many nonzero addends. Usually, it suffices to assume that some
of the sums have only finitely many nonzero addends, and then it follows that so
do the others.
   Let us illustrate this on the example of (31). If S is an arbitrary set (not necessarily
finite), and if as and bs are two numbers for each s ∈ S, then the equality (31) holds
as long as we assume that the two sums ∑ as and ∑ bs have only finitely many
                                               s∈S               s∈S
nonzero addends (i.e., there are only finitely many s ∈ S satisfying as 6= 0, and
there are only finitely many s ∈ S satisfying bs 6= 0). We don’t need to assume
that the sum ∑ ( as + bs ) has only finitely many nonzero addends, because this
               s∈S
follows “for free” from the analogous assumptions on the sums ∑ as and ∑ bs .
                                                                                          s∈S       s∈S
However, it does not suffice to assume that the sum ∑ ( as + bs ) has only finitely
                                                                  s∈S
many nonzero addends, if we don’t also make the analogous assumptions on ∑ as
                                                                                                    s∈S
and ∑ bs . For example, if S is an infinite set, then the following transformation
     s∈S
makes no sense:
           ∑     0
                |{z} =    ∑ (1 + (−1)) = ∑ 1 + ∑ (−1)                               (by (31)) .
           s∈S =1+(−1)    s∈S                s∈S         s∈S
The formula (31) is being misapplied here, since the sums ∑ 1 and ∑ (−1) have
                                                                              s∈S           s∈S
infinitely many nonzero addends.
  Something similar needs to be taken into account when extending Theorem 1.6.1
to infinite sums. It suffices to assume that the sum ∑     a( x,y) has only finitely
                                                               ( x,y)∈ X ×Y
many nonzero addends (i.e., that only finitely many pairs ( x, y) ∈ X × Y satisfy
a( x,y) 6= 0). In other words, the following analogue of Theorem 1.6.1 holds for
infinite sums:
  Theorem 1.6.11. Let X and Y be two sets. Let a( x,y) be a number for each pair
  ( x, y) ∈ X × Y. Assume that only finitely many pairs ( x, y) ∈ X × Y satisfy
  a( x,y) 6= 0. Then, we have
  and in particular, each of the five sums in this equality has only finitely many
  nonzero addends.
  See [19s, proof of Proposition 7.2.11 (specifically, the proof of (227))] for a rigor-
ous proof of this theorem (but the idea is obvious: reduce it to the case of finite X
and Y by restricting the sums appropriately).
Enumerative Combinatorics: class notes                                                                           page 158
  Thus, in order to make Theorem 1.6.1 work for infinite sums, it suffices to as-
sume the middle sum     ∑    a( x,y) to have only finitely many nonzero addends.
                           ( x,y)∈ X ×Y
However, it is tempting to think that even if this middle sum has infinitely many
nonzero addends, we may still get the equality ∑ ∑ a( x,y) = ∑ ∑ a( x,y) as long
                                                                    x ∈ X y ∈Y                y ∈Y x ∈ X
as all the four sums appearing in this equality have only finitely many nonzero
addends. In other words, it is tempting to use the following “fact”:
     Incorrect Fubini rule. Let X and Y be two sets. Let a( x,y) be a number
     for each pair ( x, y) ∈ X × Y. Then,
                                    ∑ ∑ a(x,y) = ∑ ∑                         a( x,y) ,                         (129)
                                    x ∈ X y ∈Y                y ∈Y x ∈ X
     as long as all four sums appearing in this equality have only finitely
     many nonzero addends.
  This, however, is false. Here is a counterexample:
  Example 1.6.12 (“the serial debtor”). Let X = {1, 2, 3, . . .} and Y = {1, 2, 3, . . .}.
  Define a number a( x,y) for each pair ( x, y) ∈ X × Y by setting
                                    a( x,y) = [y = x ] − [y = x + 1] .
  Here is a table showing these numbers:
                x=1            1           −1                                                 ···
                x=2                          1           −1                                   ···
                x=3                                      1           −1                       ···          ,           (130)
                x=4                                                     1                −1   ···
                x=5                                                                      1    ···
                    ..         ..            ..          ..             ..               ..   ...
                     .          .             .           .              .                .
  where empty slots are understood to contain the number 0. It is easy to see that
  all four sums in (129) have only finitely many nonzero addends. Indeed, for each
  x ∈ X, we have
                                      ∑ a(x,y) = 0                           (131)
                                                  y ∈Y
  (since the only nonzero addends of this sum are 1 and −1, which clearly sum up
  to 0). Hence,
                             ∑ ∑ a(x,y) = ∑ 0 = 0.                          (132)
                                       x ∈ X y ∈Y                 x∈X
                                             | {z }
                                                  =0
Enumerative Combinatorics: class notes                                     page 159
  (since the only nonzero addends of this sum are 1 and −1, except that there is
  no −1 when y = 1). Hence,
                                               (
                                                 1, if y = 1;
                    ∑ ∑ a(x,y) = ∑ 0, if y 6= 1 = 1.                       (133)
                    y ∈Y     x∈X          y ∈Y
                             | {z }
                           
                           1, if y = 1;
                         =
                           0, if y 6 = 1
  Comparing this with (132), we see that (129) becomes 0 = 1, which is clearly
  false. Hence, the Incorrect Fubini rule is false. But Theorem 1.6.11 does not
  apply here, since infinitely many pairs ( x, y) ∈ X × Y satisfy a( x,y) 6= 0.
tations”). We are always going to use the word “permutation” for the former, at
least when we are speaking of permutations of a set. Here is how it is defined:
  We shall use the two-line notation for maps (see Definition 1.2.11). Thus, for
example,                                     
                                 0 1 5 7 9
                                 1 7 5 0 9
denotes the map from {0, 1, 5, 7, 9} to {0, 1, 5, 7, 9} that sends 0, 1, 5, 7, 9 to 1, 7, 5, 0, 9,
respectively. This map is a permutation of the set {0, 1, 5, 7, 9}. On the other hand,
the map                                               
                                     0 1 5 7 9
                                     1 7 0 0 9
is not a permutation, since it fails to be injective (indeed, it sends both 5 and 7 to
0) and therefore also fails to be bijective. Also, the map
                                                    
                                      0 1 5 7 9
                                      1 2 3 4 5
is not a permutation, since it is a map between two different sets (while a permu-
tation must be a map from a set to itself).
   The most obvious counting question you can now ask has a simple answer:
(# of permutations of X ) = n!.
  We shall prove this theorem later (in Subsection 2.4.4). (The idea of the proof is
simple, but formalizing it is tricky at this point.)
  Example 1.7.3. The set [3] = {1, 2, 3} has 3! = 6 many permutations; they are
  (written in two-line notation)
                                                          
                  1 2 3                1 2 3            1 2 3
                             ,                  ,                 ,
                  1 2 3                1 3 2            2 1 3
                                                          
                  1 2 3                1 2 3            1 2 3
                             ,                  ,                 .
                  2 3 1                3 1 2            3 2 1
  are 5 and 9. Thus, this map is not a derangement of {0, 1, 5, 7, 9} (even though it
  is a permutation of {0, 1, 5, 7, 9}).
     (b) The map                                 
                                        0 1 5 7 9
                                        1 7 9 0 5
  has no fixed points, and thus is a derangement of {0, 1, 5, 7, 9} (since it is a
  permutation of {0, 1, 5, 7, 9}).
f ( x ) 6= x for all x ∈ X.
  This lemma might be so obvious to you that you would wonder what there is to
be proven about it; shouldn’t it be clear that the # of derangements of a set only
depends on the size of that set? The following proof, which we shall first give in
an informal version, just spells out this idea:
Proof of Lemma 1.7.6 (informal version). We have | X | = n (since X is an n-element
set) and |[n]| = n, so that | X | = n = |[n]|. Thus, the sets X and [n] have the same
size. Hence, Theorem 1.1.7 (applied to Y = [n]) shows that there is a bijection
φ : X → [n]. Fix such a φ.
   We can regard this bijection φ as a way to label the elements of X by the numbers
1, 2, . . . , n (with each element a ∈ X getting the label φ ( a) ∈ [n]). For example, if X
Enumerative Combinatorics: class notes                                                        page 162
                                                                              
                                                                     x y z
is a 3-element set { x, y, z}, and φ : X → [3] is the           bijection110 , then we
                                                                     1 2 3
can think of φ as labeling the elements x, y, z as 1, 2, 3, respectively.
   Now, we claim that any derangement of X can be transformed into a derange-
ment of [n]. Indeed, if a derangement of X is written in two-line notation, then
we can simply replace each a ∈ X appearing in this two-line notation by its
“label” φ ( a) ∈ [n], and thus obtain a derangement of [n] written in two-line
notation.
           For example, if X is a 3-element set { x, y, z}, and φ is the bijection
            
   x y z
              : X → [3], then the derangement
   1 2 3
                                          
                                   x y z
                                                      of X
                                   y z x
becomes the derangement
                                           
                φ ( x ) φ (y) φ (z)     1 2 3
                                     =                                         of [3] .
                φ (y) φ (z) φ ( x )     2 3 1
f ◦ g ◦ h. (See [Grinbe15, Proposition 2.82] for a proof of this fact, and [Grinbe15,
Theorem 2.86] for its analogue for more than three maps.)
   It is easy to see that any composition of bijections is again a bijection. In par-
ticular, if f , g and h are three bijections for which the composition f ◦ g ◦ h makes
sense, then this composition f ◦ g ◦ h is a bijection.
   Now, the bijection from {derangements of X } to {derangements of [n]} that we
have constructed in our above proof of Lemma 1.7.6 can be viewed in a new light:
This bijection sends any derangement ω of X to the composition
φ ◦ ω ◦ φ −1 : [ n ] → [ n ]
then
                                                                           
                      −1           φ ( a1 ) φ ( a2 ) · · ·       φ ( an )
        φ◦ω◦φ              =                                                               in two-line notation
                                   φ (b1 ) φ (b2 ) · · ·         φ ( bn )
φ ◦ ω ◦ φ −1 : [ n ] → [ n ] .
It is easy to see that these two maps A and B are mutually inverse115 . Hence, the
map A is invertible, and thus a bijection. Therefore, the bijection principle yields
In other words,
     and therefore ω φ−1 (y) = φ−1 (y)); but this would contradict the fact that ω has no fixed
                                
     points. Hence, the map φ ◦ ω ◦ φ−1 has no fixed points either. Furthermore, the map ω is a
     permutation of X, that is, a bijection from X to X. Moreover, the maps φ and φ−1 are bijections.
     Hence, the composition φ ◦ ω ◦ φ−1 : [n] → [n] is also a bijection (because it is a composition of
     the three bijections φ, ω and φ−1 ). Thus, φ ◦ ω ◦ φ−1 is a bijection from [n] to [n]. In other words,
     φ ◦ ω ◦ φ−1 is a permutation of [n]. Thus, φ ◦ ω ◦ φ−1 is a permutation of [n] that has no fixed
     points (since we have previously shown that φ ◦ ω ◦ φ−1 has no fixed points). In other words,
     φ ◦ ω ◦ φ−1 is a derangement of [n] (by the definition of a derangement). Qed.
115 Proof. We need to check that A ◦ B = id and B ◦ A = id. We shall only prove that A ◦ B = id, and
    Thus, ( A ◦ B) (η ) = A ( B (η )) = η = id (η ).
      Forget that we fixed η. We thus have proved that ( A ◦ B) (η ) = id (η ) for each derangement
    η of [n]. In other words, A ◦ B = id. As we said, the proof of B ◦ A = id is analogous. Thus, it
    follows that the maps A and B are mutually inverse.
Enumerative Combinatorics: class notes                                        page 165
   Of course, this is not rigorous until we formalize what “does not depend on what
the elements of S are” means. This I am not going to do; but let me delineate it
through a few examples:
   We can apply the “isomorphism principle” to f (S) = (# of derangements of S),
because the # of derangements of S is defined in a way that does not depend on
what the elements of S are. Thus, we obtain Lemma 1.7.6.
   Likewise, we can apply the “isomorphism principle” to
f (S) = (# of permutations of S). Thus, we obtain the fact that if n ∈ N, and if X
is an n-element set, then
                                   ∑    |T | =    ∑       |T | .
                                  T⊆X            T ⊆[n]
For example, if n = 3 and X = {1, 3, 5}, then all 8 subsets of X are lacunar, but
only 5 subsets of [n] = [3] are lacunar.
   Likewise, we cannot apply the “isomorphism principle” to
f (S) = (# of self-counting subsets of S). Indeed, for example, if we relabel the
elements 1 and 2 of the set [2] as 8 and 9, then the self-counting subset [1] will no
longer be self-counting.
   Since I am not proving the “isomorphism principle” in its general form, let me say a
few words on how to prove its specific instances. Essentially, every instance of the “iso-
morphism principle” can be proven by the same strategy that we used in our proof of
Lemma 1.7.6: Namely, we fix a bijection φ : X → [n], and we use it to construct a bijection
from {the objects counted by f (S)} to {the objects counted by f ([n])}, which proceeds by
replacing each element a ∈ X by its “label” φ ( a) ∈ [n]. When formalized, these proofs may
look rather different, but the underlying idea is always this one. In particular, the formal
proof of (134) resembles our formal proof of Lemma 1.7.6 very closely (but is shorter, be-
cause we don’t have to show that φ ◦ ω ◦ φ−1 and φ−1 ◦ η ◦ φ are derangements), whereas
the formal proof of (135) requires a different formula for the maps A and B          116 (but
otherwise, again, proceeds in the same way). I hope it is clear enough how these formal
proofs can be constructed more or less mechanically whenever the need arises.
Dn = (# of derangements of [n]) .
116 namely,
and
   Example 1.7.8. Let us compute D3 . Indeed, we know from Example 1.7.3 that
   the set [3] has 6 permutations (which are all listed in Example 1.7.3). Among
   these 6 permutations, only 2 are derangements, namely
                                                           
                        1 2 3                          1 2 3
                                         and
                        2 3 1                          3 1 2
  In a similar manner, we can count the derangements of any other given finite set.
In particular, we thus obtain
            D0 = 1             (since id : ∅ → ∅ is a derangement) ;
            D1 = 0             (since id : [1] → [1] is not a derangement) ;
                                                                           
                                                                         1 2
            D2 = 1               since the only derangement of [2] is           ;
                                                                         2 1
            D3 = 2             (as we have just seen) ;
            D4 = 9.
   These days, when you have a sequence of integers you want to learn more about,
and you know a few of its values, you can look it up at the OEIS (the Online
Encyclopedia of Integer Sequences, available at https://oeis.org ). Let us try this
on the sequence ( D0 , D1 , D2 , D3 , . . .). We know its first five values D0 = 1, D1 =
0, D2 = 1, D3 = 2, D4 = 9, so let us enter “1,0,1,2,9” into the input field
of the OEIS. We press “Search” and are greeted with a list of several117 known
sequences that contain these five values somewhere in them (in five consecutive
positions). The first hit is a sequence labeled A000166, and named “Subfactorial
or rencontres numbers, or derangements: number of permutations of n elements
with no fixed points”. This is, of course, precisely our sequence (no wonder that
such a simple concept as derangements is well-known). The OEIS has collected a
lot of information on this sequence, including a long list of entries, combinatorial
interpretations, formulas (including many we don’t yet understand), references and
links. Here is only a small selection of the formulas that are claimed in the OEIS
for this sequence:
117 currently   45, but quite possibly more by the time you are reading this
Enumerative Combinatorics: class notes                                             page 168
  Some of these formulas will be proven in Subsection 2.9.5. (Theorem 1.7.9 (b)
follows from Theorem 1.7.9 (a) via [19f-hw1s, Exercise 5].) Note that parts (a)
and (b) of Theorem 1.7.9 are two recurrences for the sequence ( D0 , D1 , D2 , . . .) that
make its computation rather easy; both are due to Euler.
   The OEIS can be used in many ways. It knows thousands of sequences that have ap-
peared in mathematics (not only combinatorics). You can search for them both by entries
(as we did above) and by keywords (such as “permutations” or “derangements”). It even
acts as a bare-bones social network: If two mathematicians encounter the same sequence in
their work, and the first one records it in the OEIS, the second can then find it and contact
the first. This has led to a number of collaborations between mathematicians working in
rather different disciplines; often, the appearance of the same integer sequence in different
places hints at a deeper connection between the theories.
   It is known from basic set theory that there exists a bijection between N and N2 . Thus, a
                                                
“2-dimensional sequence” (i.e., a family ai,j (i,j)∈N2 of numbers whose entries are indexed
by two rather than one nonnegative integers) can be re-parametrized as a (regular, i.e.,
1-dimensional) sequence. Thus, such “2-dimensional sequences” and similar families of
numbers
  can also be found in the OEIS. For example, Pascal’s triangle (i.e., the family
    n
                         ) appears as sequence A007318.
    k     (n,k)∈N2 ; k≤n
But you’ll quickly tire of this notation, since its whole top row is useless: It just
contains the numbers 1, 2, . . . , n in increasing order. Thus, we can omit this top row
and only write the bottom row down118 . The bottom row is usually written as an
n-tuple (so the elements σ (1) , σ (2) , . . . , σ (n) are separated by commas). This is
the so-called one-line notation of σ:
   Warning: This notation clashes with a different notation (the cycle notation),
which is used in many textbooks. We shall avoid this conflict by using a differ-
ent notation for cycles, but you should keep this in mind when consulting other
texts. Other authors often avoid this conflict by using square brackets instead of
parentheses in the one-line notation119 ; but we prefer not to do so, since we are
already using square brackets for myriad other things.
   Example 1.7.11. The 6 permutations of the set [3] have been listed in Example
   1.7.3. In one-line notation, they look as follows:
   Let us observe that the one-line notation (as defined in Definition 1.7.10) can be
used not only for permutations of [n], but for any maps from [n] to an arbitrary set
X.
   Perhaps the most useful thing about one-line notations is that they turn permuta-
tions (a somewhat abstract object) into n-tuples of numbers (a much more tangible
object). Usually, it is easier to manipulate tuples (e.g., by inserting or removing
elements) than to manipulate permutations. Using the one-line notation, we can
substitute the former for the latter. This relies on the following simple fact:
118 Of   course, we can only do this if we agree that the top row is 1, 2, . . . , n rather than some other
      ordering of the elements of [n].
119 i.e., they write the one-line notation of σ as [ σ (1) , σ (2) , . . . , σ ( n )]
Enumerative Combinatorics: class notes                                                                 page 170
The map
       {permutations of [n]} → Tn ,
                           σ 7→ (one-line notation of σ) = (σ (1) , σ (2) , . . . , σ (n))
Proof of Proposition 1.7.12. This is a simple exercise in understanding what bijectivity means:
   (a) Let σ be a permutation of [n]. Thus, σ is a bijection from [n] to [n] (by the definition
of a permutation). Hence, the map σ is bijective, i.e., both injective and surjective.
   The one-line notation of σ is defined to be the n-tuple (σ (1) , σ (2) , . . . , σ (n)). This n-
tuple consists of n distinct entries120 , all of which are elements of [n]. Furthermore, this
n-tuple contains all elements of [n] 121 . Hence, the one-line notation of σ is an n-tuple of
distinct elements of [n] that contains all elements of [n]. This proves Proposition 1.7.12 (a).
   (b) Let (i1 , i2 , . . . , in ) be an n-tuple of distinct elements of [n] that contains all elements of
[n]. Then, i1 , i2 , . . . , in are elements of [n]. Hence, we can define a map
                                                 f : [n] → [n] ,
                                                        j 7→ i j .
Hence, there is at least one permutation σ of [n] such that the one-line notation of σ is
(i1 , i2 , . . . , in ) (namely, σ = f ). Moreover, it is easy to see that there is at most one such
permutation124 . Combining these two observations, we conclude that there is a unique
120 Proof.  If i and j are two distinct elements of [n], then i 6= j and thus σ (i ) 6= σ ( j) (since σ is
     injective). In other words, the n entries of the n-tuple (σ (1) , σ (2) , . . . , σ (n)) are distinct. Qed.
121 Proof. Let x ∈ [ n ]. We must prove that this n-tuple ( σ (1) , σ (2) , . . . , σ ( n )) contains x. In other
     words, we must prove that there exists a y ∈ [n] such that σ (y) = x. But this follows from the
     fact that σ is surjective. Qed.
122 Proof. The elements of the n-tuple (i , i , . . . , i ) are distinct (by the definition of this n-tuple).
                                                     1 2      n
     Now, let a and b be two distinct elements of [n]. Thus, a 6= b, so that i a 6= ib (since the elements
     of the n-tuple (i1 , i2 , . . . , in ) are distinct). The definition of f yields f ( a) = i a and f (b) = ib .
     Hence, f ( a) = i a 6= ib = f (b).
        Forget that we fixed a and b. We thus have shown that if a and b are two distinct elements of
     [n], then f ( a) 6= f (b). In other words, the map f is injective.
123 Proof. Let x ∈ [ n ]. The n-tuple (i , i , . . . , i ) contains all elements of [ n ]. Thus, in particular, it
                                                1 2        n
     contains x. In other words, there exists some j ∈ [n] such that i j = x. Consider this j. The
     definition of f now yields f ( j) = i j = x, so that x = f ( j). In other words, x is an image under
     f.
        Forget that we fixed x. We thus have shown that each x ∈ [n] is an image under f . In other
     words, the map f is surjective.
124 Proof. Let α be any such permutation. We shall prove that α = f .
Enumerative Combinatorics: class notes                                                                               page 171
permutation σ of [n] such that the one-line notation of σ is (i1 , i2 , . . . , in ). This proves
Proposition 1.7.12 (b).
   (c) If σ is a permutation of [n], then the one-line notation of σ is an n-tuple of distinct
elements of [n] that contains all elements of [n] (by Proposition 1.7.12 (a)). In other words,
if σ is a permutation of [n], then the one-line notation of σ belongs to Tn (because of how
Tn was defined). Thus, the map
          {permutations of [n]} → Tn ,
                              σ 7→ (one-line notation of σ) = (σ (1) , σ (2) , . . . , σ (n))
    so that
                      (α (1) , α (2) , . . . , α (n)) = (i1 , i2 , . . . , in ) = ( f (1) , f (2) , . . . , f (n))
     (since ( f (1) , f (2) , . . . , f (n)) = (i1 , i2 , . . . , in )). In other words, α ( x ) = f ( x ) for each x ∈ [n].
     Since both α and f are maps from [n] to [n] (being permutations of [n]), we thus conclude that
     α = f.
        Now, forget that we fixed α. We thus have shown that if α is any permutation σ of [n] such that
     the one-line notation of σ is (i1 , i2 , . . . , in ), then α = f . Hence, there is at most one permutation
     σ of [n] such that the one-line notation of σ is (i1 , i2 , . . . , in ).
125 Proof. Let σ and τ be two permutations of [ n ] such that OLN ( σ ) = OLN ( τ ). Thus, the defini-
     tion of OLN yields OLN (σ ) = (one-line notation of σ) = (σ (1) , σ (2) , . . . , σ (n)) and similarly
     OLN (τ ) = (τ (1) , τ (2) , . . . , τ (n)). Hence,
     In other words, σ ( x ) = τ ( x ) for each x ∈ [n]. Hence, σ = τ (since both σ and τ are maps from
     [n] to [n]).
       Forget that we fixed σ and τ. We thus have shown that if σ and τ are two permutations of [n]
     such that OLN (σ ) = OLN (τ ), then σ = τ. In other words, the map OLN is injective.
126 Proof. Let x ∈ T . Thus, x ∈ T = { n-tuples of distinct elements of [ n ] that contain all elements of [ n ]};
                    n               n
     in other words, x is an n-tuple of distinct elements of [n] that contains all elements of [n]. Hence,
     we can write x in the form x = (i1 , i2 , . . . , in ). Thus, (i1 , i2 , . . . , in ) = x is an n-tuple of distinct
     elements of [n] that contains all elements of [n]. Therefore, Proposition 1.7.12 (b) shows that
     there exists a unique permutation σ of [n] such that the one-line notation of σ is (i1 , i2 , . . . , in ).
     Consider this σ. The definition of OLN yields
Class of 2019-10-16
  The word “short-legged” is my own creation (and refers to the idea that a short-
legged permutation of [n] “carries no i ∈ [n] any further than 1 step”, a way
of visualizing the inequality |σ (i ) − i | ≤ 1). But this type of permutations has
a long history, and appears naturally in the study of determinants (specifically,
of determinants of tridiagonal matrices – see, e.g., [Grinbe15, Second solution to
Exercise 6.27]).
  Example 1.7.14. (a) Among the 6 permutations of [3], exactly 3 are short-legged,
  namely
                       (1, 2, 3) ,   (1, 3, 2) ,    (2, 1, 3)
  (in one-line notation). Indeed, for example, the permutation σ = (1, 3, 2) is short-
  legged (since it has |σ (1) − 1| = |1 − 1| = 0 ≤ 1 and |σ (2) − 2| = |3 − 2| = 1 ≤ 1
  and |σ (3) − 3| = |2 − 3| = 1 ≤ 1), whereas the permutation σ = (2, 3, 1) is not
  short-legged (since it has |σ (3) − 3| = |1 − 3| = 2 > 1).
     (b) Among the 24 permutations of [4], exactly 5 are short-legged, namely
  That makes yet another question answered by the Fibonacci numbers! I will not
prove this proposition in full detail, but let me sketch the main ideas of two proofs:
First proof of Proposition 1.7.15 (sketched). Let wn denote the # of short-legged per-
mutations of [n]. Then, it suffices to show that wn = wn−1 + wn−2 for each n ≥ 2
(because we can then argue as in the proof of Proposition 1.1.11).
  So let n ≥ 2. How do we prove wn = wn−1 + wn−2 ?
Enumerative Combinatorics: class notes                                                       page 173
and
                  (# of green short-legged permutations of [n]) = wn−2 .
  Proposition 1.7.12 (c) allows us to identify each permutation σ of [n] with its
one-line notation (σ (1) , σ (2) , . . . , σ (n)), which is an n-tuple of distinct elements
of [n]. Let us do so.127 Thus:
is well-defined. It is easy to see that this map is a bijection128 . Thus, the bijection
principle yields
is well-defined. It is easy to see that this map is a bijection129 . Thus, the bijection
principle yields
128 Indeed,  its inverse simply appends an n to the end of a short-legged permutation of [n − 1] (where
     the latter is regarded as an (n − 1)-tuple).
129 Indeed, its inverse simply appends an n and then an n − 1 to the end of a short-legged permuta-
is well-defined and is a bijection. Once we have proven this, the bijection principle
will yield
   I leave this to you, dear reader, with the following hint: If σ is a short-legged
permutation, and some a ∈ [n − 2] satisfies σ ( a) = a + 1 and σ ( a + 1) = a + 2, then
prove that σ ( a + 2) = a + 3 (because the values a + 1 and a + 2 are already taken)
and σ ( a + 3) = a + 4 (because the values a + 2 and a + 3 are already taken) and
σ ( a + 4) = a + 5 (likewise) and so on... but this eventually leads to σ (n) = n + 1,
which is absurd.
   Statement 1 shows that F is well-defined. In order to show that F is bijective, we
need to prove the following two facts:
                           
                            j + 1, if j ∈ F (σ) ;
                           
σ will send each j ∈ [n] to j − 1, if j − 1 ∈ F (σ ) ; . Of course, this needs to be
                           
                             j,     otherwise
                           
proven – again, LTTR. Same applies for Statement 3.
   Alternatively, this proof can be restated in terms of domino tilings of Rn,2 . Indeed, we
already know from the Second proof of Proposition 1.4.9 that there is a bijection
                   h : {domino tilings of Rn+1,2 } → {lacunar subsets of [n]} .
Applying this to n − 1 instead of n, we obtain a bijection
                 h0 : {domino tilings of Rn,2 } → {lacunar subsets of [n − 1]} .
Composing the inverse of this bijection h0 with the bijection F above, we obtain a bijection
               {short-legged permutations of [n]} → {domino tilings of Rn,2 } .
We leave it to the reader to describe this bijection more directly and prove its bijectivity
without the detour through lacunar subsets.
for n in range ( 10 ) :
  print ( " The number of long - legged permutations of [ " + str ( n ) + " ] is
                                         " + str ( num_ of_longl egged ( n ) ) )
130 Thiscomputes the #s for n ∈ {0, 1, . . . , 9}. You can try to go further, but keep in mind that the #
    of permutations of [n] is n!, which grows a lot faster than 2n (the # of subsets of [n]).
Enumerative Combinatorics: class notes                                            page 177
  This recurrence is credited to Vaclav Kotesovec (2017), and probably has been
proved by reducing it to another recurrence (by J. Riordan, in an unpublished Bell
Labs memorandum from 1963), which involves the Lucas sequence (a variant of
the Fibonacci sequence: same recursion, but different starting values). The latter
recurrence has been proved (in said memorandum, which can be downloaded from
the OEIS page) using generating functions and an enumerative technique known as
rook theory (see [BCHR11] for an introduction). The argument would be both too
advanced and too intricate to present at this point.
  Thus ends our introductory tour of enumerative combinatorics. We shall next
focus on one of the most basic topics: the binomial coefficients.
Enumerative Combinatorics: class notes                                                      page 178
2. Binomial coefficients
We have already started exploring the binomial coefficients in Section 1.3. In this
chapter, we shall explore them further, with a focus on proving identities involving
them. We will build up a toolbox of techniques for this, some combinatorial and
some algebraic.
  Theorem 2.1.1 (Telescoping sum principle). Let u and v be two integers with
  u ≤ v + 1. Let au , au+1 , . . . , av+1 be any numbers. Then,
                                             v
                                            ∑
                                                                
                                                    a j +1 − a j = a v +1 − a u .
                                            j=u
Hence, Theorem 2.1.1 is proved in the case when u = v + 1. Thus, for the rest of
this proof, we WLOG assume that u 6= v + 1. Hence, u < v + 1 (since u ≤ v + 1),
so that u + 1 ≤ v + 1 (since u and v + 1 are integers). In other words, u ≤ v.
  Now, here is an informal version of how the proof proceeds from here: We have
     v
    ∑ | a j+1{z− a j }
                           
    j=u
          =− a j + a j+1
          v
          ∑
                                  
    =          − a j + a j +1
         j=u
    = (− au + au+1 ) + (− au+1 + au+2 ) + (− au+2 + au+3 ) + · · · + (− av + av+1 ) .
Enumerative Combinatorics: class notes                                                                                 page 179
The right hand side of this equality is a sum of 2 · (v − u + 1) addends (once ex-
panded out), but all but 2 of them cancel out (indeed, the second addend in each
parenthesis cancels the first addend in the next parenthesis). The 2 addends left
over are − au and av+1 . Thus, the sum “contracts” like a telescope (thus the name
“telescoping sum principle”):
    This is precisely the claim of Theorem 2.1.1. Hence, we have showed that Theorem 2.1.1 holds if
    v + 1 − u = 0.
Enumerative Combinatorics: class notes                                                                                              page 180
There is also a different proof of Theorem 2.1.1, relying on basic manipulations of sums:
(and then subtract these two equalities). Unfortunately, these two equalities are false in the
border case u = v + 1, because you cannot split off a (non-existing) addend from an empty
sum. Of course, we could get around this issue by treating this border case separately
Enumerative Combinatorics: class notes                                                                                      page 181
(it is trivial). But it is a bit easier to make a similar argument that avoids this nuisance
                                                          v +1                       v
altogether: Instead of making the sums                     ∑ a j and ∑ a j equal by splitting off an addend
                                                         j = u +1                  j=u
from each, we make them equal by adding an extra addend to each. This can be done as
follows:
                                                                                                                              v +1
  We have u ≤ v + 1. Thus, we can split off the addend for j = v + 1 from the sum ∑ a j ,
                                                                                                                              j=u
and obtain
                                              v +1                            v
                                              ∑ a j = a v +1 + ∑ a j .
                                              j=u                            j=u
Thus,
                                               v             v +1
                                              ∑ a j = ∑ a j − a v +1 .
                                              j=u            j=u
                                                                                           v +1
But we can also split off the addend for j = u from the sum ∑ a j , and obtain
                                                                                           j=u
                                             v +1                          v +1
                                              ∑      a j = au +             ∑        aj.
                                              j=u                         j = u +1
Thus,
                                               v +1              v +1
                                                ∑        aj =       ∑ a j − au .
                                              j = u +1              j=u
  Remark 2.1.2. Equivalent versions of Theorem 2.1.1 abound all across the literature. For
  example, [19f-hw0s, Proposition 2.2] says that if m ∈ N and if a0 , a1 , . . . , am are any m + 1
  numbers, then
                                              m
                                          ∑ ( a i − a i −1 ) = a m − a 0 .
                                          i =1
                                                                                                                      m
  This follows from Theorem 2.1.1, because substituting j + 1 for i in the sum ∑ ( ai − ai−1 )
                                                                                                                     i =1
Enumerative Combinatorics: class notes                                                                        page 182
   yields
                m                       m −1
               ∑ ( a i − a i −1 ) = ∑
                                                           
                                                a j+1 − a j = a(m−1)+1 − a0
               i =1                     j =0                  | {z }
                                                                      = am
                                          (by Theorem 2.1.1, applied to u = 0 and v = m − 1)
                                    = a m − a0 .
   Also, [Grinbe15, (16)] says that if u and v are two integers such that u − 1 ≤ v, and as is
   a number for each s ∈ {u − 1, u, . . . , v}, then
                                                     v
                                                    ∑ ( a s − a s −1 ) = a v − a u −1 .
                                                    s=u
   Let us note that Theorem 2.1.1 is a discrete version of the famous “Second Fundamental
Theorem of Calculus”, which says that any two real numbers u and v with u ≤ v and any
differentiable function F : [u, v]R → R satisfy132
                                               Z v
                                                     F 0 ( x ) dx = F (v) − F (u) .
                                                u
Indeed, the summation sign ∑ is a discrete analogue of the integral sign , whereas the
                                                                                      R
differences a j+1 − a j of consecutive entries of the sequence au , au+1 , . . . , av+1 are a discrete
analogue of (the values of) the derivative of a function.
Hence,
 n                        
                           n
∑                   k
                 (−1)
                           k
k =0             |    {z     } 
               n−1                n−1
                                      
           k                 k −1
     =(−1)             −(−1)
                k                  k−1
      n 
                k n−1                k −1 n − 1
                                             
= ∑ (−1)                     − (−1)
    k =0
                       k                    k−1
     n −1
                  j +1 n − 1             j n−1
                                            
= ∑ (−1)                          − (−1)
    j=−1
                         j + 1                j
      (here, we have substituted j + 1 for k in the sum)
                     n−1                               n−1
                                                            
       (n−1)+1                         −1
= (−1)                          − (−1)
                 ( n − 1) + 1                            −1
               |  {z  }                            | {z }
                     n−1                                  =0
                =          =0             (by (43), applied to n−1 and −1
                      n                          instead of n and k)
                                                                          j n−1
                                                                              
        by Theorem 2.1.1, applied to u = −1, v = n − 1 and a j = (−1)
                                                                             j
= 0 − 0 = 0 = [ n = 0]         (since [n = 0] = 0) .
(b) Explain why Proposition 1.3.28 is a particular case of Exercise 2.1.1 (a).
is equivalent to
We need to actually convince ourselves that this map is well-defined135 and actually
a bijection136 . Thus, (139) is proved. As we have said, this entails Proposition
1.3.28.
  The bijection we have used in this proof can be rewritten in an even simpler way
using a basic set-theoretical operation (almost as basic as union and intersection of
sets), called the symmetric difference:
   Definition 2.1.3. Let X and Y be two sets. Then, the symmetric difference of X and
   Y is the set
                   {all elements that lie in exactly one of the two sets X and Y }
                   = ( X \ Y ) ∪ (Y \ X ) = ( X ∪ Y ) \ ( X ∩ Y ) .
                                                                                 (
135 This                                                                             A ∪ {1} , if 1 ∈
                                                                                                    / A;
           means proving that if A is any subset of [n] of even size, then                               is a
                                                                                     A \ {1} , if 1 ∈ A
    subset of [n] of odd size. This relies on the following facts:
           • We have 1 ∈ [n] (since n 6= 0).
           • If 1 ∈
                  / A, then | A ∪ {1}| = | A| + 1 is odd (since | A| is even).
           • If 1 ∈ A, then | A \ {1}| = | A| − 1 is odd (since | A| is even).
136 Toprove this, we need to find an inverse to it. This is easy: The inverse is given by the exact same
    formula! That is, the inverse is the map
    In order to see that this is really an inverse to our map, we need to show the following:
           • If 1 ∈
                  / A, then 1 ∈ A ∪ {1} and ( A ∪ {1}) \ {1} = A.
           • If 1 ∈ A, then 1 ∈
                              / A \ {1} and ( A \ {1}) ∪ {1} = A.
         Of course, both of these claims are completely obvious.
Enumerative Combinatorics: class notes                                        page 187
   The notion of symmetric difference has the following properties (which are all
straightforward to check using Venn diagrams or elementwise verification):
  Using symmetric differences, we can now rewrite the bijection that we used in
the above Third proof of Proposition 1.3.28 as
This makes it even easier to check that this map is well-defined and a bijection.
                                   n−b
                                  
                  n     a       n
                            =                    for all n, a, b ∈ R.
                   a    b       b   a−b
                                                         n−b
                                                       
                  n     a                          n
                           =0         with                      = 0,
                  a     b                          b     a−b
                      |{z}                       | {z }
                              =0                            =0
                               n−b
                              
            n     a       n
we obtain             =                . Thus, Proposition 1.3.35 is proven in Case 1.
             a    b       b    a−b
  Let us now consider Case  2. In this case, we have b ∈ N and a ∈  / N. Hence, (43)
                            n
(applied to k = a) yields        = 0. Also, a − b ∈/ N 137 . Hence, (43) (applied to
                            a
                                               n−b
                                                   
n − b and a − b instead of n and k) yields             = 0. Now, comparing
                                               a−b
                                                          n−b
                                                        
                    n   a                           n
                            =0          with                      = 0,
                    a   b                            b    a−b
                 | {z }                                 | {z }
                        =0                                          =0
                              n−b
                            
            n    a        n
we obtain            =               . Thus, Proposition 1.3.35 is proven in Case 2.
            a    b        b   a−b
  Let us now consider Case 3. In this case, we have b ∈ N and a ∈ N but a < b.
From a < b, we obtain a − b < 0, sothat a −b ∈/ N. Hence, (43) (applied to n − b
                                       n−b
and a − b instead of n and k) yields          = 0. Also, b > a (since a < b). Hence,
                                       a−b                           
                                                                      a
Proposition 1.3.6 (applied to a and b instead of n and k) yields         = 0. Now,
                                                                      b
comparing
                                                        n−b
                                                      
                   n    a                         n
                            =0        with                      = 0,
                   a    b                         b     a−b
                      |{z}                            | {z }
                              =0                                    =0
                             n−b
                            
            n     a      n
we obtain            =               . Thus, Proposition 1.3.35 is proven in Case 3.
             a    b      b    a−b
  Let us finally consider Case 4. In this case, we have b ∈ N and a ∈ N and a ≥ b.
From this, we conclude that a − b ∈ N and b ≤ a. Hence, Theorem 1.3.9 (applied
137 Proof.   Assume the contrary. Thus, a − b ∈ N. Hence, a = a − b + |{z}
                                                                       b ∈ N (since the sum of two
                                                              | {z }
                                                              ∈N     ∈N
    elements of N is always an element of N), which contradicts a ∈
                                                                  / N. Hence, we have obtained a
    contradiction. This shows that our assumption was false, qed.
Enumerative Combinatorics: class notes                                               page 189
                                          n−b
                                       
                              n   a     n
                                      =         .
                              a   b     b a−b
                                        m m−1
                                               
                                 m
                                    =               .
                                 n      n n−1
                                     m−1
                                          
                                 m
                                                m m−1
                                                    
                          m          n−1
                              =              =           .
                          n           n          n n−1
                                           n−j
                                            
                              n   n   j
     (b) Compute the sum ∑                         for every integer n ≥ a. (The result
                             j= a j   a       b
   should contain no summation signs.)
Class of 2019-10-18
B A
                                                                     .
Enumerative Combinatorics: class notes                                            page 192
and | B| = b. How many such pairs ( A, B) are there? We shall refer to such pairs as
CS pairs139 , and we shall count their # in two ways140 :
   First way: In order to construct a CS pair ( A, B), we
                                                         first choose the committee A
                                                      n
and then choose its subcommittee B. We have               many options for A (because
                                                      a
A hastobe an a-element subset of the n-element set N), and after choosing A, we
         a
have         many options for B (because B has to be a b-element subset of A). Thus,
         b                                                 
                                        n                      a
the total # of CS pairs is a sum of          many copies of        . In other words, this #
                                    a                      b
     n     a
is            .
     a     b
   Second way: In order to construct a CS pair ( A, B), wefirst    choose the subcom-
                                                                 n
mittee B and then choose the committee A. We have                     many options for B
                                                                 b
(because B has to be a b-element subset of the n-element set N). After choosing B,
how many options do we have for A ? The committee A has to be an a-element
subset of N, but it is also required to contain the (already chosen) subcommittee
B as a subset, so that b of its a elements are already decided. We only need to
choose the remaining a − b elements of A. These elements have to come from the
(n − b)-element set N \ B (because the elements of B have already been chosen to
lie in A). Thus, we are choosing     an ( a − b)-element subset of the (n − b)-element
                               n−b
                             
set N \ B. Thus, we have               many options for choosing A. Hence, the total
                               a − b
                                                       n−b
                                                         
                               n
# of CS pairs is a sum of          many copies of             . In other words, this # is
                               b                       a−b
        n−b
           
   n
                .
   b    a−b
   Now, we have computed
                       the # of CS pairs in two different ways.         The first way
                                                                                   n−b
                                                                                       
                     n     a                                                  n
gave us the result            , while the second way gave us the result                    .
                      a    b                                                  b    a−b
                                                            n−b
                                                             
                                          n    a        n
Comparing these results, we find                   =                  . Thus, Proposition
                                          a    b        b   a−b
1.3.35 is proven (in the case when n ∈ N).
   How can we formalize this argument? It is clear how to formalize the notion of
a CS pair (just replace “n people” by n mathematical objects, such as the numbers
1, 2, . . . , n). But how do we formalize our two ways of counting the # of CS pairs?
   Let us look at the first way. On its surface, it may seem like we have applied
                                                         n    a
the product rule (Theorem 1.1.4) in order to obtain               (similarly to how we
                                                         a    b
applied it back in the proof of Proposition 1.4.14). But this appearance is mislead-
139 short for “committee-subcommittee pairs”
140 We   will be using Theorem 1.3.12 in both of these ways.
Enumerative Combinatorics: class notes                                                         page 193
                                                                                 
                                                                                 n    a
ing. If we wanted to apply Theorem 1.1.4, we would have to interpret
                                                                                 a   b
as | X | · |Y | for two sets X and Y. Thus, we would need two sets X and Y such
that the CS pairs are elements of X × Y (or at least are in obvious bijection to
the latter141 ). The obvious choice would be X = { a-element subsets of N } and
Y = {b-element subsets of A}, but this does not work: The set Y needs to be de-
fined independently of A; but here it clearly is not. This is no surprise: If we choose
a CS pair ( A, B) by first choosing A, then the options available for B will depend
on which A we have chosen (because we must have B ⊆ A). We are inluck        because
                                                                           a
the number of these options does not depend on A (but always is               ); but the
                                                                           b
set of these options does depend on A. Theorem 1.1.4 is not general enough to
accommodate this situation.
   There are two ways to resolve this problem. One is to generalize Theorem 1.1.4
to cover dependent choices. This results in a “dependent product rule”, which
(informally) says the following:
   To formalize this, we can let X be the set of all available options in choice 1, and
let Y be the set of all options that may be available in choice 2 (including the ones
whose availability depends on what you chose in choice 1), and let S be the set of
all ways to make both choices. Then, our “dependent product rule” turns into the
following rigorous fact:
   Theorem 2.2.2. Let a1 and a2 be two numbers. Let X and Y be finite sets. Let S
   be a subset of X × Y. Assume that | X | = a1 . Assume further that for each x ∈ X,
   there are precisely a2 many elements y ∈ Y such that ( x, y) ∈ S (even though the
   set of these y may depend on x). Then, |S| = a1 a2 .
We leave the proof of this theorem to the reader, as we will not use it:
141 We    are using some basic combinatorial slang here: We say that objects of some type are in bi-
      jection with objects of another type if there exists a bijection from {objects of the first type} to
      {objects of the second type}.
142 i.e., of pairs ( x, y ), where x is an option you can choose in choice 1, and y is an option you can
  Formal versions of this rule can be found in [Loehr11, §1.8] and in [Newste19,
Theorem 7.2.19].
  However, all of this is entirely optional, because there is a simpler way to for-
malize our proof of Proposition 1.3.35. Instead of adapting the product rule, we
can simply apply the sum rule (more precisely, Theorem 1.2.5) and observe that all
addends of the resulting sum are equal (which means that the sum simplifies to a
product). This leads to the following proof:
Second proof of Proposition 1.3.35 for n ∈ N (formal version). Let N = [n]. Thus, N is
an n-element set.
   A CS pair shall mean a pair ( A, B) of sets satisfying B ⊆ A ⊆ N and | A| = a and
| B| = b. Hence, if ( A, B) is a CS pair, then A is an a-element subset of N (since
A ⊆ N and | A| = a), and B is a b-element subset of N (since B ⊆ N and | B| = b).
   We shall compute the number |{CS pairs}| in two ways.
   First way: Let f : {CS pairs} → { a-element subsets of N } be the map that sends
each CS pair ( A, B) to its first entry A. (This is well-defined, because if ( A, B) is a
CS pair, then A is an a-element subset of N.)
   Theorem 1.2.5 (applied to S = {CS pairs} and W = { a-element subsets of N })
yields
         |{CS pairs}|
         =            ∑                      (# of s ∈ {CS pairs} satisfying f (s) = w)
             w∈{ a-element subsets of N }
Clearly, these two maps are mutually inverse. Thus, they are bijections. Hence, the
bijection principle yields
     |{CS pairs}|
     =            ∑                     (# of CS pairs whose first entry is C )                         (145)
        C ∈{ a-element subsets of N }
                                        |                 {z 
                                                                            }
                                                            a
                                                        =
                                                            b
                                                         (by (144))
                                                                                                 
                                      a                                                            a
     =             ∑                  b
                                         =           |{ a-element subsets of N }|               ·
                                                                                                   b
       C ∈{ a-element subsets of N }
                                                     |               {z                }
                                                       =(# of a-element
                                                                      subsets of N )
                                                                      n
                                                                   =
                                                                      a
                                                (by Theorem 1.3.12, applied to S= N and k= a)
         
        n  a
     =        .                                                                                         (146)
        a  b
yields
         |{CS pairs}|
         =            ∑                     (# of s ∈ {CS pairs} satisfying f (s) = w)
             w∈{b-element subsets of N }
Clearly, these two maps are mutually inverse. Thus, they are bijections. Hence, the
bijection principle yields
 |{CS pairs}|
 =            ∑                     (# of CS pairs whose second entry is D )
     D ∈{b-element subsets of N }
                                    |                 {z                }
                                                      n−b
                                                   =
                                                      a−b
                                                            (by (148))
                                        n−b                                                            n−b
                                                                                                          
 =               ∑                      a−b
                                                  =        |{b-element subsets of N }|               ·
                                                                                                       a−b
     D ∈{b-element subsets of N }
                                                           |               {z                }
                                                             =(# of b-element
                                                                            subsets of N )
                                                                            n
                                                                         =
                                                                            b
                                                      (by Theorem 1.3.12, applied to S= N and k=b)
        n−b
         
    n
 =            .                                                                                          (149)
    b   a−b
  Now, comparing (146) with (149), we obtain
                                             n−b
                                          
                           n    a       n
                                    =              .
                            a   b       b    a−b
This proves Proposition 1.3.35 in the case when n ∈ N.
  Remark 2.2.3. Something looks fishy. In the second proof of Proposition 1.3.35
  we gave above, we have assumed that n ∈ N, but we have not assumed that
  a ∈N. But then, how did we manage to
                                              obtain
                                                        a combinatorial interpretation for
    a                                           a
         such as (144), which shows that            is an integer? Doesn’t this contradict
    b                                         b
                  a
  the fact that       is usually not an integer when a ∈     / N ? Where is our mistake?
                  b
     It turns out that there is nothing wrong with our proof. The crux of the
  matter is the little sentence “Now, fix C ∈ { a-element subsets of N }”. This
  sentence provides the context in which the equality (144) was stated. In
  other words, we have only claimed that          the equality (144) holds for each
                                                   a
  C ∈ { a-element subsets of N }. Thus,                 will be an integer for each C ∈
                                                   b
                                                    
                                                     a
  { a-element subsets of N }. Even though                does not depend on C, we can-
                                                     b
  not just throw the “for each C ∈ { a-element subsets of N }” part of this state-
  ment away, because there is no a-priori guarantee that there exists a C ∈
  { a-element subsets of N }. And indeed, such a C can exist only when          a ∈ N
                                                                               a
  (and, even stronger, a ∈ {0, 1, . . . , n}); but if it does not exist, then     will not
                                                                               b
  always be an integer. So the equality (144) leads to a contradiction if we take it
  out of its context, but inside its context it is perfectly correct.
Enumerative Combinatorics: class notes                                            page 198
     The sentence “Now, forget that we fixed C” that appeared later on in the proof
  marks the end of this context. After this sentence, C is no longer a fixed a-element
  subset of N, and the equality (146) can be applied to any a-element subset of N in
  the role of C. (Thus, in particular, (146) can be applied to manipulate the addends
  in the sum appearing in (145), because this sum ranges over all a-element subsets
  of N. Of course, when a ∈  / N, then this sum is an empty sum.)
follows:
                                             n−1     n−1     n−1
                                                      
       n+1    n                n
            =    +                       =        +       +        .
       k+1    k               k+1             k       k      k+1
                           | {z }
                           n−1     n−1
                                       
                        =       +
                            k      k+1
                           (by Theorem 1.3.8)
We could go on like this forever, but let us stop at the point when the  single 
                                                                                 “bad”
                                                                             0
addend (i.e., the binomial coefficient that has a k + 1 at the bottom) is          . We
                                                                            k+1
Enumerative Combinatorics: class notes                                                      page 200
which sends each S to S \ { j}. This map is furthermore a bijection144 . Thus, the
bijection principle yields
(by Theorem 1.3.12, applied to j − 1 and {1, 2, . . . , j − 1} instead of n and S). This
proves (152) formally.]
143 To  be more precise: of Theorem 1.2.5, applied to S = {(k + 1) -element subsets of [n + 1]}, W =
      [n + 1] and f being the map that sends each (k + 1)-element subset of [n + 1] to its largest
     element
144 Its inverse map sends each T to T ∪ { j }. (We leave all the necessary verifications to the reader,
 Either way, we have thus shown that (152) holds. Hence, (151) becomes
       
  n+1
  k+1
= ∑ (# of (k + 1) -element subsets of [n + 1] whose largest element is j)
   j∈[n+1]
           |                            {z                            }
   | {z }                               j−1
      n +1                           =
    =∑                                    k
      j =1                                     (by (152))
   n +1         n  
        j−1
              
                    i
 = ∑          =∑                  (here, we have substituted i for j − 1 in the sum)
   j =1
          k    i =0
                    k
                  
      0     1         n
 =      +     +···+      .
      k     k         k
  Remark 2.3.1. In the above proof of Theorem 1.3.29, we have observed that the
  largest element of a (k + 1)-element subset of [n + 1] not only belongs to [n + 1],
  but actually belongs to the smaller set {k + 1, k + 2, . . . , n + 1} as well. But we
  have not used this observation. What if we had used it, thus obtaining a sum
  over all j ∈ {k + 1, k + 2, . . . , n + 1} instead of a sum over all j ∈ [n + 1] ?
     We would have obtained Corollary 1.3.30 instead of Theorem 1.3.29.
   Now, what if we want to count not all maps, but only some maps?
   Recall that if f : A → B is a map between any two sets, then f ( A) denotes
the image of this map (i.e., the subset { f ( a) | a ∈ A} of B). More generally, if
f : A → B is a map and S is any subset of A, then f (S) denotes the subset
{ f ( a) | a ∈ S} of B.
  Exercise 2.4.1. Let A and B be two sets. Let C be a finite subset of B. Assume
  that A is finite, too.
    (a) Prove that
(# of maps f : A → B satisfying f ( A) ⊆ C ) = |C || A| .
  Definition 2.4.2. Let n ∈ R and k ∈ N. Then, the falling factorial nk is the number
  defined by
                           n k = n ( n − 1) ( n − 2) · · · ( n − k + 1)                (153)
                                  k −1
                              =   ∏ (n − i ) .                                         (154)
                                  i =0
   Falling factorials are also called lower factorials or descending factorials. Let us state
a few of their basic properties:
                  n0 = n (n − 1) (n − 2) · · · (n − 0 + 1) = (empty product) = 1.
                       |              {z                 }
                                  a product with 0 factors
                               n1 = n (n − 1) (n − 2) · · · (n − 1 + 1) = n.                                    (155)
                                    |              {z                 }
                                                a product with 1 factor
                     n ( n − 1) ( n − 2) · · · ( n − k + 1)
           
           n
     k! ·     = k! ·                                        = n ( n − 1) ( n − 2) · · · ( n − k + 1) .
           k                          k!
                                                        
                                               k         n
Comparing this with (153), we obtain n = k! ·               . This proves Proposition 2.4.3 (c).
                                                         k
  (d) Let n ∈ N. Then, (153) (applied to k = n) yields
nn = n (n − 1) (n − 2) · · · (n − n + 1) = n (n − 1) (n − 2) · · · 1 = 1 · 2 · · · · · n = n!
nk · (n − k ) = (n (n − 1) (n − 2) · · · (n − k + 1)) · (n − k ) = n (n − 1) (n − 2) · · · (n − k ) .
n k +1 = n ( n − 1 ) ( n − 2 ) · · · ( n − ( k + 1 ) + 1 ) = n ( n − 1 ) ( n − 2 ) · · · ( n − k ) .
We are now ready to count the injective maps between two finite sets:
  Let us first prove Theorem 2.4.4 in an informal way, using the “dependent prod-
uct rule” for n sets that we have stated in Subsection 2.2.2:
Proof of Theorem 2.4.4 (informal version). Let a1 , a2 , . . . , am be the m elements of A
(listed without repetitions). Then, in order to construct a map f from A to B,
we only have to choose the m values f ( a1 ) , f ( a2 ) , . . . , f ( am ). Moreover, to ensure
that this map f is injective, we need to choose these m values to be distinct. In
other words, we need to choose these m values to satisfy
                                       f ( a1 ) ∈    B;
                                       f ( a2 ) ∈    B \ { f ( a1 )} ;
                                       f ( a3 ) ∈    B \ { f ( a1 ) , f ( a2 )} ;
                                       f ( a4 ) ∈    B \ { f ( a1 ) , f ( a2 ) , f ( a3 )} ;
                                               ..
                                                .
                                      f ( am ) ∈     B \ { f ( a1 ) , f ( a2 ) , . . . , f ( am−1 )} .
    • first choose the value f ( a1 ) to be any element of B (there are n options for it,
      since B is an n-element set);
• and so on;
Thus, by the dependent product rule, the total # of ways to make all m choices is
n (n − 1) (n − 2) · · · (n − (m − 1)) = n (n − 1) (n − 2) · · · (n − m + 1) = nm
induction base.
  Induction step: Let k ∈ N. Assume (as the induction hypothesis) that Theorem
2.4.4 holds for m = k. We must now prove that Theorem 2.4.4 holds for m = k + 1.
                                               n m = n0               (since m = 0)
                                                    =1               (by Proposition 2.4.3 (a)) ,
    we obtain (# of injective maps from A to B) = nm . This proves the equality (156) under the
    assumption that m = 0. Hence, Theorem 2.4.4 holds when m = 0.
Enumerative Combinatorics: class notes                                           page 207
                       | A \ { a}| = | A| −1          (since a ∈ A)
                                     |{z}
                                    = k +1
                                 = (k + 1) − 1 = k.
But Inj ( A \ { a} , B) is the set of all injective maps from A \ { a} to B (since this is
how Inj ( A \ { a} , B) is defined). Thus,
  Now, if h ∈ Inj ( A, B), then h is an injective map from A to B, and therefore the
restriction h | A\{a} of h to A \ { a} is an injective map from A \ { a} to B (since a
restriction of an injective map to a subset is still injective). Thus, the map
                           R : Inj ( A, B) → Inj ( A \ { a} , B) ,
                                         h 7→ h | A\{a}
                               | B \ g ( A \ { a})| = | B| − | g ( A \ { a})| = n − k.
                                                     |{z} |         {z      }
                                                            =n              =k
is well-defined. It is easy to see that this map is a bijection151 . Thus, the bijection principle
yields
                 |{h ∈ Inj ( A, B) | R (h) = g}| = | B \ g ( A \ { a})| = n − k.
Thus,
But recall that Inj ( A, B) is the set of all injective maps from A to B (since this is
how Inj ( A, B) is defined). Thus,
so that
                  (# of injective maps from A to B) = |Inj ( A, B)| = nk+1 .
151 Indeed, we can construct an inverse  ( to it: For each b ∈ B \ g ( A \ { a}), we let hb be the map from
                                           b,      if c = a;
    A to B that sends each c ∈ A to                          . It is easy to see that this map hb is injective.
                                           g (c) , if c 6= a
    (In fact, its values at the elements of A \ { a} are precisely the values of g, and thus are distinct
    because g is injective; but its value at a is b, which is distinct from its values at the elements
    of A \ { a} because b ∈  / g ( A \ { a}).) Hence, for each b ∈ B \ g ( A \ { a}), we have defined an
    injective map hb from A to B which furthermore satisfies R (hb ) = g (since hb (c) = g (c) for all
    c ∈ A \ { a}). Thus, we obtain a map
    It is now completely straightforward to check that this map is inverse to the map (159).
Enumerative Combinatorics: class notes                                                                 page 210
    Theorem 2.4.6 (Pigeonhole Principle for Injections). Let A and B be two finite
    sets. Let f : A → B be an injective map. Then:
      (a) We have | A| ≤ | B|.
      (b) If | A| = | B|, then f is bijective.
    Theorem 2.4.7 (Pigeonhole Principle for Surjections). Let A and B be two finite
    sets. Let f : A → B be a surjective map. Then:
      (a) We have | A| ≥ | B|.
      (b) If | A| = | B|, then f is bijective.
Proof of Theorem 2.4.7. Let a1 , a2 , . . . , ak be the elements of A (listed without repeti-
tions). Thus, | A| = k and A = { a1 , a2 , . . . , ak }. The k elements f ( a1 ) , f ( a2 ) , . . . , f ( ak )
may or may not be distinct; thus, the set { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} has at most k
elements153 . In other words,
                                   |{ f ( a1 ) , f ( a2 ) , . . . , f ( ak )}| ≤ k = | A| .                             (161)
But f is surjective; hence, { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} = B                  154 .
                                                                                           Thus, (161) rewrites
as | B| ≤ | A|. In other words, | A| ≥ | B|. This proves Theorem 2.4.7 (a).
   (b) Assume that | A| = | B|. We must prove that f is bijective. First, we shall show
that f is injective.
   Indeed, let x and y be two distinct elements of A. We shall show that f ( x ) 6=
f ( y ).
   Indeed, assume the contrary. Thus, f ( x ) = f (y). But x ∈ A = { a1 , a2 , . . . , ak };
thus, x can be written in the form x = ai for some i ∈ [k]. Likewise, y can be written
in the form y = a j for some j ∈ [k]. Consider these i and j. If we had i = j, then we
would have ai = a j and thus x = ai = a j = y, which would contradict the fact that
x and y are distinct. Hence, we must have i 6= j.                                          
   But recall that f ( x ) = f (y). This rewrites as f ( ai ) = f a j (since x = ai and
y = a j ). Since i 6= j, this equality reveals that at least two of the k elements
                                                                                         
f ( a1 ) , f ( a2 ) , . . . , f ( ak ) are equal (namely, f ( ai ) and f a j ). Therefore, there are
at most k − 1 distinct elements among these k elements f ( a1 ) , f ( a2 ) , . . . , f ( ak ). In
other words,
                                      |{ f ( a1 ) , f ( a2 ) , . . . , f ( ak )}| ≤ k − 1.
155  In view of { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} = B, this rewrites as | B| ≤ k − 1. Hence,
| B| ≤ k − 1 < k = | A| = | B|. This is, of course, absurd. This contradiction shows
that our assumption was false.
153 Here,  we are tacitly using the following fact: If u1 , u2 , . . . , uk are any k objects (distinct or not),
     then the set {u1 , u2 , . . . , uk } has at most k elements. Shouldn’t this, too, be proved?
       (Yes, but I am leaving this to the texts on foundations. That said, you can easily construct a
     proof by induction on k, using      ( the even more fundamental fact that every finite set A and every
                                           | A| ,      if s ∈ A;
     object s satisfy | A ∪ {s}| =                               .)
                                           | A| + 1, if s ∈ /A
154 Proof. Let b ∈ B. Then, there exists some a ∈ A such that b = f ( a ) (since f is surjective). Consider
                   a∈
     this a. We have      A = { a1 , a2 , . . . , ak }. In other words, a = ai for some i ∈ [k]. Consider this i.
                    a  = f ( ai ) ∈ { f ( a1 ) , f ( a2 ) , . . . , f ( ak )}.
      Now, b = f |{z}
                        = ai
         Forget that we fixed b. We thus have shown that b ∈ { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} for
     each b ∈ B. In other words, B ⊆ { f ( a1 ) , f ( a2 ) , . . . , f ( ak )}. Combining this with
      { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} ⊆ B (which is obvious), we obtain { f ( a1 ) , f ( a2 ) , . . . , f ( ak )} = B.
155 If you insist on proving this more formally than this, here is the argument that we tacitly used
Enumerative Combinatorics: class notes                                                                              page 212
  Remark 2.4.8. The parts (b) of both Pigeonhole Principles become false if the
  sets A and B are not finite. For example:
2.4.4. Permutations
We can now prove Theorem 1.7.2:
Proof of Theorem 1.7.2. The set X is finite (since it is an n-element set) and satisfies
| X | = | X |. Hence, Theorem 2.4.6 (b) shows that if f : X → X is an injective map,
then f is bijective. In other words, every injective map from X to X is bijective.
The converse also holds (by definition). Thus, the injective maps from X to X are
  which collects all of the k elements f ( a1 ) , f ( a2 ) , . . . , f ( ak ) except             for the      j-th one.
                                                                                                                        This set
  G clearly has size | G | ≤ k − 1 (because f ( a1 ) , f ( a2 ) , . . . , f a j−1 , f a j+1 , f a j+2 , . . . , f ( ak )
  are k − 1 elements). Since i  6= j, the                     element f ( ai ) is one of the k − 1 elements
  f ( a1 ) , f ( a2 ) , . . . , f a j−1 , f a j+1 , f a j+2 , . . . , f ( ak ) that constitute the set G (because i 6= j
  entails i ∈ [k] \ { j}), and thus belongs to G. Therefore, { f ( ai )} ⊆ G, so that G ∪ { f ( ai )} = G.
  Hence,
                                                                                              
            G = G ∪ { f ( ai )} = G ∪ f a j                           since f ( ai ) = f a j
                                                                                                           
                = f ( a 1 ) , f ( a 2 ) , . . . , f a j −1 , f a j +1 , f a j +2 , . . . , f ( a k ) ∪ f a j
                                                                                                                    
                             since G = f ( a1 ) , f ( a2 ) , . . . , f a j−1 , f a j+1 , f a j+2 , . . . , f ( ak )
                                                                                                         
                = f ( a 1 ) , f ( a 2 ) , . . . , f a j −1 , f a j +1 , f a j +2 , . . . , f ( a k ) , f a j
              = { f ( a1 ) , f ( a2 ) , . . . , f ( ak )}
                                                                                                           
  (because the k elements f ( a1 ) , f ( a2 ) , . . . , f a j−1 , f a j+1 , f a j+2 , . . . , f ( ak ) , f a j are ex-
  actly the k elements f ( a1 ) , f ( a2 ) , . . . , f ( ak ), up to order). Thus, the inequality | G | ≤ k − 1,
  which we have previously proved, rewrites as |{ f ( a1 ) , f ( a2 ) , . . . , f ( ak )}| ≤ k − 1.
Enumerative Combinatorics: class notes                                          page 213
(because the permutations of X are defined to be the bijections from X to X). Hence,
(# of permutations of X ) = n!.
  Definition 2.4.9. Let m ∈ N and n ∈ N. Then, sur (m, n) shall mean the # of
  surjective maps from [m] to [n].
  Example 2.4.10. We have sur (3, 2) = 6, because there are exactly 6 surjective
  maps from [3] to [2]; namely, these maps are
                                                           
                 1 2 3                1 2 3             1 2 3
                            ,                   ,                 ,
                 1 1 2                1 2 1             1 2 2
                                                           
                 1 2 3                1 2 3             1 2 3
                            ,                   ,
                 2 1 1                2 1 2             2 2 1
   A priori, these numbers sur (m, n) only count surjective maps between the spe-
cific finite sets [m] and [n]; but it is easy to see that they also count surjective maps
between any two finite sets:
(since sur (m, n) is defined as the # of surjective maps from [m] to [n]).
   Let us next determine some values of sur (m, n) (with heavy use of Iverson brack-
ets):
and
    are well-defined and mutually inverse; thus, they are bijections. Hence, the bijection principle
    yields
Hence, there is exactly one surjective map from [0] to [0]. In other words, sur (0, 0) = 1
(since sur (0, 0) is defined as the # of surjective maps from [0] to [0]). Comparing sur (0, 0) =
1 with [0 = 0] = 1, we obtain sur (0, 0) = [0 = 0].
   (a) Let m ∈ N. Recall that sur (0, 0) = [0 = 0]. In other words, Proposition 2.4.12
(a) holds for m = 0. Thus, for the rest of this proof, we WLOG assume that m 6= 0.
Hence, m > 0 (since m ∈ N). Thus, 1 ∈ [m]. Hence, there exists no map from [m] to
[0] (because such a map would have to send 1 to some element of [0], but there is no
element of [0] to send it to). Thus, a fortiori, there exists no surjective map from [m] to
[0]. In other words, sur (m, 0) = 0 (since sur (m, 0) is defined as the # of surjective maps
from [m] to [0]). Comparing this with [m = 0] = 0 (which follows from m 6= 0), we obtain
sur (m, 0) = [m = 0]. Thus, Proposition 2.4.12 (a) is proved.
   (f) Let m, n ∈ N be such that m < n. Theorem 2.4.7 (a) (applied to A = [m] and
B = [n]) shows that if f : [m] → [n] is a surjective map, then |[m]| ≥ |[n]|; but this
contradicts |[m]| = m < n = |[n]|. Thus, we obtain a contradiction for each surjective map
f : [m] → [n]. Hence, there exists no such map. In other words, there is no surjective
map from [m] to [n]. In other words, sur (m, n) = 0 (since sur (m, n) is defined as the # of
surjective maps from [m] to [n]). This proves Proposition 2.4.12 (f).
   (d) Let k ∈ N. Recall that sur (0, 0) = [0 = 0]. In other words, Proposition 2.4.12 (d)
holds for k = 0. Hence, for the rest of this proof, we WLOG assume that k 6= 0. Hence,
k > 0 (since k ∈ N), so that 0 < k. Thus, Proposition 2.4.12 (f) (applied to m = 0 and
n = k) yields sur (0, k ) = 0. Comparing this with [k = 0] = 0 (which follows from k 6= 0),
we obtain sur (0, k ) = [k = 0]. This proves Proposition 2.4.12 (d).
   (b) Let m ∈ N. We need to prove the chain of equalities sur (m, 1) = [m 6= 0] = 1 −
[m = 0]. The second of these equalities is easily checked158 . Thus, it remains to prove the
first equality, i.e., the equality sur (m, 1) = [m 6= 0].
   Proposition 2.4.12 (d) (applied to k = 1) yields sur (0, 1) = [1 = 0] = 0 (since 1 6= 0).
Comparing this with [0 6= 0] = 0 (since 0 = 0), we obtain sur (0, 1) = [0 6= 0]. In other
words, the equality sur (m, 1) = [m 6= 0] (which we intend to prove) holds for m = 0. Thus,
for the rest of this proof, we WLOG assume that m 6= 0. Hence, m > 0 (since m ∈ N),
so that 1 ∈ [m]. Now, the set [1] has only one element, namely 1. Thus, there is exactly
one map from [m] to [1]: namely, the map f that sends each element of [m] to 1 (because
the only possible value for this map is 1). This map is surjective, because the only element
of [1] (namely, 1) is a value of this map (indeed, it is the value of this map at 1 ∈ [m]).
Thus, there is exactly one surjective map from [m] to [1]. In other words, sur (m, 1) = 1
(since sur (m, 1) is defined as the # of surjective maps from [m] to [1]). Comparing this with
[m 6= 0] = 1 (which follows from m 6= 0), we obtain sur (m, 1) = [m 6= 0]. This completes
our proof of Proposition 2.4.12 (b).
   (e) Let k ∈ N. Proposition 2.4.12 (b) (applied to m = 1) yields sur (1, 1) = [1 6= 0] =
1 − [1 = 0]. Hence, sur (1, 1) = [1 6= 0] = 1 (since 1 6= 0). Compared with [1 = 1] = 1, this
yields sur (1, 1) = [1 = 1]. In other words, Proposition 2.4.12 (e) holds for k = 1. Hence,
for the rest of this proof, we WLOG assume that k 6= 1.
   Proposition 2.4.12 (a) (applied to m = 1) yields sur (1, 0) = [1 = 0] = 0 (since 1 6= 0).
Compared with [0 = 1] = 0, this yields sur (1, 0) = [0 = 1]. In other words, Proposition
158 Indeed,it is a particular case of the equality [not A] = 1 − [A], which holds for any logical
    statement A. Applying the latter equality to A = (“m = 0”), we obtain [not (m = 0)] = 1 −
    [m = 0]. In other words, [m 6= 0] = 1 − [m = 0].
Enumerative Combinatorics: class notes                                                       page 216
2.4.12 (e) holds for k = 0. Hence, for the rest of this proof, we WLOG assume that k 6= 0.
   We now have k 6= 0 and k 6= 1. Hence, k ≥ 2 (since k ∈ N). Thus, k ≥ 2 > 1, so that
1 < k. Hence, Proposition 2.4.12 (f) (applied to m = 1 and n = k) yields sur (1, k ) = 0.
Comparing this with [k = 1] = 0 (which is because k 6= 1), we obtain sur (1, k ) = [k = 1].
This proves Proposition 2.4.12 (e).
   (c) Let m ∈ N. Proposition 2.4.12 (d) (applied to k = 2) yields sur (0, 2) = [2 = 0] = 0.
Comparing this with |{z} 20 −2 + [0 = 0] = 1 − 2 + 1 = 0, we obtain sur (0, 2) = 20 − 2 +
                                  | {z }
                              =1          =1
[0 = 0]. Thus, Proposition 2.4.12 (c) holds for m = 0. Hence, for the rest of this proof, we
WLOG assume that m 6= 0. Hence, 1 ∈ [m]. Now, Theorem 2.4.1 (applied to n = 2, A = [m]
and B = [2]) yields
                            (# of maps from [m] to [2]) = 2m .
In other words, there are exactly 2m maps from [m] to [2]. Which of these 2m maps are
surjective? Obviously, in order for a map f : [m] → [2] to be surjective, it suffices that both
1 and 2 appear as its values; in other words, it must avoid sending all elements of [m] to
1, and it must avoid sending all elements of [m] to 2. Thus, among the 2m maps from [m]
to [2], only two fail to be surjective: namely, the map α that sends all elements of [m] to 1,
and the map β that sends all elements of [m] to 2. Moreover, these two maps α and β are
distinct (because α (1) = 1 6= 2 = β (1)). Hence, exactly 2 out of the 2m maps from [m] to
[2] fail to be surjective. Thus,
                            (# of surjective maps from [m] to [2]) = 2m − 2.
This rewrites as sur (m, 2) = 2m − 2 (since sur (m, 2) is defined as the # of surjective maps
from [m] to [2]). Compared with 2m − 2 + [m = 0] = 2m − 2, this yields sur (m, 2) =
                                               | {z }
                                                         =0
                                                    (since m6=0)
2m − 2 + [m = 0]. Thus, Proposition 2.4.12 (c) is proved.
  Proposition 2.4.12 gives us many values of sur (m, n), but far from all of them –
and certainly not the most interesting ones. For example, what is sur (30, 20) ?
  It thus is reasonable to look for a recursive formula for sur (m, n). We shall show
two different approaches to this question, giving two different recursive formulas.
   1st approach: Fix m ∈ N and a positive integer n > 0. Thus, n ∈ [n].
   Given a surjective map f : [m] → [n], we let J f be the set of all i ∈ [m] such that
f (i ) = n. 159 Clearly, this set J f is a subset of [m] and satisfies J f 6= ∅ (since f
is surjective, so there exists at least one i ∈ [m] such that f (i ) = n). Thus, the sum
rule yields
          (# of all surjective maps f : [m] → [n])
               ∑
                                                                                  
          =              # of all surjective maps f : [m] → [n] satisfying J f = J .             (163)
              J ⊆[m];
                J 6 =∅
159 For
                               = 3, and if f : [m] → [n] is the surjective map written in two-line
        example,if m = 4 and n
                   1 2 3 4
    notation as                 , then J f = {1, 3}, because 1 and 3 are precisely the i ∈ [4] such that
                   3 1 3 2
    f (i ) = 3.
Enumerative Combinatorics: class notes                                                        page 217
   Now, fix a subset J of [m] that satisfies J 6= ∅. What is the # of all surjective maps
f : [m] → [n] satisfying J f = J ? Such a map f must satisfy
                                                                             
           J = J f = {i ∈ [ m ] | f (i ) = n }       by the definition of J f .
In other words, such a map f must send all elements of J, but no other elements, to
n. In other words, it must send all elements of J to n, and send all other elements
of [m] to numbers different from n. The latter numbers are, of course, the elements
of [n] \ {n} = [n − 1]. Thus, a surjective map f : [m] → [n] satisfying J f = J
must send all elements of J to n, and send all elements of [m] \ J to elements of
[n − 1]. Hence, if f is such a map, then f is uniquely determined by its values at
the elements of [m] \ J, and said values must belong to [n − 1]. In other words,
if f is such a map, then f is uniquely determined by its restriction f |[m]\ J , and
furthermore this restriction must “actually” be a map from [m] \ J to [n − 1], in
the sense that all its values belong to [n − 1]. Moreover, in order for the map f to
be surjective, all of the numbers 1, 2, . . . , n must be values of f . Since J 6= ∅, we
know that n will always be a value of f (indeed, f sends any element of J to n,
and there is at least one element of J, since J 6= ∅); we thus only need to ensure
that 1, 2, . . . , n − 1 are values of f as well. Obviously, these values must be taken at
elements of [m] \ J (because f sends all elements of J to n). In other words, if we
restrict f to the set [m] \ J, then the resulting map f |[m]\ J : [m] \ J → [n] needs to
take all the numbers 1, 2, . . . , n − 1 as values; i.e., if we consider f |[m]\ J as a map
from [m] \ J to [n − 1], then f |[m]\ J should be surjective. Thus, in order to construct
a surjective map f : [m] → [n] satisfying J f = J, we need to construct a surjective
map from [m] \ J to [n − 1]. Hence,
                                                                               
                     # of all surjective maps f : [m] → [n] satisfying J f = J
                  = (# of all surjective maps from [m] \ J to [n − 1]) .                          (164)
   that sends each f to its restriction f |[m]\ J (considered as a map from [m] \ J to [n − 1]).
     Here, of course, we are using the fact that if f : [m] → [n] satisfies J f = J, then the restriction
   f |[m]\ J can be considered as a map from [m] \ J to [n − 1], since it does not take the value n.
Enumerative Combinatorics: class notes                                                              page 218
  Now, forget that we fixed J. We thus have proved (165) for each subset J of [m]
satisfying J 6= ∅. Hence, (163) becomes
     =    ∑         sur (m − | J | , n − 1) =           ∑          ∑      sur m − | J | , n − 1
                                                                                               
         J ⊆[m];                                    j∈{1,2,...,m} J ⊆[m];
                                                                                  |{z}
           J 6 =∅                                   | {z } J 6=∅;                  =j
                                                          m       | J |= j
                                                       =∑
                                                         j =1
We shall next simplify the # on the right hand side of this equation. Indeed, let
j ∈ [m]. Thus, j ≥ 1 > 0. Hence, each subset J of [m] satisfying | J | = j must
automatically be nonempty (since | J | = j > 0); in other words, it must satisfy
J 6= ∅. Thus, the requirement J 6= ∅ in “# of J ⊆ [m] such that J 6= ∅ and | J | = j”
is redundant. Hence,
  Forget that we fixed j. We thus have proved (167) for each j ∈ [m]. Hence, (166)
becomes
  Forget that we fixed m and n. Thus, we have proved the following recursive
formula for the numbers sur (m, n):
  Using this proposition and Proposition 2.4.12 (a), it is easy to compute sur (m, n)
recursively.
Class of 2019-10-23
  2nd approach: Here is another way to get a recursive formula for sur (m, n).
  Fix two positive integers m and n. Let us classify the surjections [m] → [n]
according to the image of m.
  A surjection f : [m] → [n] will be called
Enumerative Combinatorics: class notes                                                                    page 220
    [Examples: If m =4 and n = 3, then the surjection f 1 : [m] → [n] written in
                          1 2 3 4
two-line notation as                       is red (since f 1 (m) = f 1 (1) with 1 ∈ [m − 1]),
                          2 1 3 2                                                        
                                                                                1 2 3 4
while the surjection f 2 : [m] → [n] written in two-line notation as
                                                                                2 1 2 3
is green (since f 2 (m) = 3 6= f 2 (i ) for all i ∈ [m − 1]).]
    If f : [m] → [n] is a red surjection, then its restriction f |[m−1] : [m − 1] → [n] is
“still” a surjection161 . Conversely, if f : [m] → [n] is any map whose restriction
f |[m−1] : [m − 1] → [n] is a surjection, then f must be a red surjection162 .
    Thus, we get the following algorithm for constructing a red surjection f : [m] →
[ n ]:
• first, we choose f (m) (there are n choices for this, since we want f (m) ∈ [n]);
    • then, we choose f (1) , f (2) , . . . , f (m − 1); in other words, we choose the re-
      striction f |[m−1] (there are sur (m − 1, n) choices for this, since f |[m−1] has to
      be a surjection from [m − 1] to [n]).
     (since f is surjective). Thus, the map f |[m−1] : [m − 1] → [n] is surjective. In other words,
     f |[m−1] : [m − 1] → [n] is a surjection.
162 Check this! (The idea is: Since f |
                                          [m−1] : [ m − 1] → [ n ] is surjective, we know that each element
     of [n] is a value of f at one of the numbers 1, 2, . . . , m − 1. Hence, f is surjective. Moreover,
     f (m) ∈ [n] must also be a value of f |[m−1] (since f |[m−1] is surjective); but this is saying that
     f (m) = f (i ) for some i ∈ [m − 1]. This shows that the surjection f is red.)
Enumerative Combinatorics: class notes                                                          page 221
   (You might want to see how this argument can be formalized without speaking
of “choices”. See Exercise 2.4.2 further below for the answer.)
   On the other hand, if f : [m] → [n] is a green surjection, then the restriction
f |[m−1] has image [n] \ { f (m)}       163 , and thus can be viewed as a surjection
    • then, we choose f (1) , f (2) , . . . , f (m − 1); in other words, we choose the re-
      striction f |[m−1] (there are sur (m − 1, n − 1) choices for this, because f |[m−1]
      needs to be a surjection [m − 1] →       [n] \ { f (m)}, and Proposition
                                                                           2.4.11 shows
          that the # of such surjections is sur |[m − 1]|, |[n] \ { f (m)}| = sur (m − 1, n − 1)).
                                                                            
                                                  | {z } |         {z      }
                                                        = m −1          = n −1
Hence,
   (Again, see Exercise 2.4.2 further below for a rigorous proof of this equality.)
   Hence, (162) becomes
    sur (m, n)
    = (# of surjections f : [m] → [n])
    = (# of red surjections f : [m] → [n]) + (# of green surjections f : [m] → [n])
       |               {z                } |                   {z                 }
                       =n·sur(m−1,n)                                  =n·sur(m−1,n−1)
                         (by (168))                                       (by (169))
                                                                                        
                  since each surjection f : [m] → [n] is either red or green
                               (but not both at the same time)
     = n · sur (m − 1, n) + n · sur (m − 1, n − 1)
     = n · (sur (m − 1, n) + sur (m − 1, n − 1)) .
Forget that we fixed m and n. Thus, we have proved the following fact:
163 The  proof proceeds roughly as follows: Let f : [m] → [n] be a green surjection. Then, the image
     of f contains all elements of [n] (since f is a surjective), but the value n is taken by f only once,
     namely at m (because f is green). Thus, if we remove m from the domain of f , then f will no
     longer take the value n. In other words, the restriction f |[m−1] no longer takes the value n.
     Other than that, of course, this restriction takes all the values that f takes; thus, it takes all the
     elements of [n] as values except for f (m). In other words, it has image [n] \ { f (m)}.
164 Check this!
Enumerative Combinatorics: class notes                                                            page 222
Exercise 2.4.2. Give rigorous proofs of the equalities (168) and (169) above.
First proof of Corollary 2.4.15 (rough idea). Both parts can easily be shown by induc-
tion using Proposition 2.4.14. (Use induction on n for part (a), and induction on m
for part (b).)
Second proof of Corollary 2.4.15 (rough idea). (a) Let n ∈ N. The surjections [n] →
[n] are bijections (by Theorem 2.4.7 (b)). Thus, they are precisely the bijections
[n] → [n]. In other words, they are precisely the permutations of [n]. Hence, their
number is n! (according to Theorem 1.7.2). Thus, sur (n, n) = n!. This proves
Corollary 2.4.15 (a).
  (b) Here is just the idea behind the proof (as we are, so far, missing the language
for formalizing it): Each surjection f : [m] → [n] provides a way of “grouping” the
elements of [m] into n nonempty (disjoint) subsets – namely, the subsets
(These n subsets are nonempty, since f is surjective.) For example, the surjection
f : [6] → [3] that is given in two-line notation as
                                                   
                                    1 2 3 4 5 6
                                    2 1 2 3 3 2
Conversely, each such “grouping” comes from a unique surjection f : [m] → [n]
(namely, the surjection which sends the elements of the 1-st subset to 1, the ele-
ments of the 2-nd subset to 2, and so on). Hence, the # of such “groupings” is
Enumerative Combinatorics: class notes                                               page 223
sur (m, n). However, if we forget the order of the subsets in each grouping (i.e., we
forget which subset is the 1-st subset, which subset is the 2-nd subset, and so on,
and only remember the set of these subsets), then the # of all such “groupings”
becomes sur (m, n) /n!, because each unordered “grouping” can be ordered in pre-
cisely n! many different ways. Thus, sur (m, n) /n! ∈ N. This proves Corollary
2.4.15 (b).
   For the details of this argument, see [18s-hw3s, §0.3 (on “set partitions”)] (specif-
ically, [18s-hw3s, Definition 0.13]).
(Of course, the expression “sur (m, n) /n!” is to be interpreted as (sur (m, n)) /n!.)
  Here is the most explicit formula known for sur (m, n):
  The most conceptual proof of Theorem 2.4.17 uses the Principle of Inclusion and
Exclusion, which we have not learned yet; this proof will appear in Subsection
2.9.4165 . But there is also an alternative proof, which requires nothing that we have
not already seen:
Likewise, we can recover parts (a), (b) and (c) of Proposition 2.4.12 by applying
Theorem 2.4.17 to n = 0, n = 1 and n = 2, respectively.
  The following exercise gives some variations on the formula in Theorem 2.4.17:
2.5. 1m + 2m + ... + nm
We have still not proved Theorem 1.2.10. But we are getting close. The crucial tool
will be the following fact:
Proof of Theorem 2.5.1. We shall prove the theorem by double counting. Let us com-
pute the # of all maps f : [m] → [k ]. We shall compute this # in two ways:
  1st way: We have
    • First, we choose the number | f ([m])| (this is the size of the image of f , i.e.,
      the # of distinct values of f ). This is an integer in {0, 1, . . . , m} 166 . Let us
      call this integer i.
        we choose the set f ([m]) (this is the set of all values of f ). There are
    • Then,
       k
          many choices for this (since f ([m]) must be an i-element subset of [k ]).
       i
    • Finally, we choose the map f itself. The image of this map f must be the
      already chosen i-element set f ([m]). Thus, what we are choosing is essentially
      a surjection from the m-element set [m] to the already chosen i-element set
      f ([m]). Hence, there are sur (m, i ) many choices here (by Proposition 2.4.11).
166 since   the set f ([m]) = f ({1, 2, . . . , m}) = { f (1) , f (2) , . . . , f (m)} clearly has at most m elements
Enumerative Combinatorics: class notes                                                   page 225
k =0 i =0
                           k =0     i =0
Enumerative Combinatorics: class notes                                                        page 226
we obtain
                                      n           m           
                                                          n+1
                                     ∑ i = ∑ sur (m, i) · i + 1 .
                                          m
                                     i =1  i =0
  Now, forget that we fixed m. We thus have proved that
          n        m                
                                 n+1
        ∑ i = ∑ sur (m, i) · i + 1
             m
                                             for each positive integer m.
        i =1     i =0
Class of 2019-10-25
  Here, the summation sign “∑” on the right hand side of (173) means a sum
                                              k
  over all k ∈ Z. (We are thus implicitly claiming that this sum over all k ∈ Z is
  well-defined, i.e., that it has only finitely many nonzero addends.)
Enumerative Combinatorics: class notes                                             page 227
  Remark 2.6.2. Before proving Theorem 2.6.1, let us explain why the right hand
  sides of (172) and (173) are equal. Indeed, fix n ∈ N andx, y ∈ R. Now, consider
                                                                  x
  any k ∈ Z. If k < 0, then we have k ∈           / N and thus        = 0 (by (43)), and
                                                              k
                           x      y
  thus the product                      is 0. But if k > n, then we have n − k ∈/ N and
                         k    n−k                                         
            y                                                       x      y
  thus                 = 0 (again by (43)), and thus the product                  is again
           n−k                                                  k    n−k
                                x      y
  0. Thus, the product                        is 0 whenever the integer k satisfies either
                                k    n − k          
                                             x      y
  k < 0 or k > n. In other words,                        = 0 whenever k ∈ / {0, 1, . . . , n}
                                             k     n−k
  (because an integer k satisfies either k < 0 or k > n if and only if it satisfies
  k ∈/ {0, 1, . . . , n}). Therefore, even though the sums on the right hand sides of
  (172) and (173) differ in some addends, these addends in which they differ are
  all 0. Thus, these sums are equal.
                                   0
     We shall use the symbol “=” (an equality sign with a 0 on top of it) to describe
  situations like this. More specifically: If A and B are two sums that only differ in
                                                 0                     0
  addends that are 0, then we will write A = B. (Of course, A = B implies A = B,
  which is why we are using the equality sign.) Thus, the argument we have just
  made shows that
                          n                       
                             x     y            x     y
                        ∑ k n−k = ∑ k n−k .
                                         0
                        k =0                k
    Likewise,
                             n          n
                            ∑k= ∑k
                                   0
                                                 for each n ∈ N.
                            k =0       k =1
    Likewise, each n ∈ N satisfies
                        n     n +1                  
                             n 0      n 0       n 0       n
                       ∑ k =∑ k = ∑ k =∑ k
                       k =0      k =0     k ∈N      k ∈Z
          
          n
  (since     = 0 whenever k ∈ / {0, 1, . . . , n}). Likewise, the equality that we spent
           k
  the main part of our proof of Corollary 1.3.30 arguing can be written as
                                                                    
      0      1      2            n 0 k                k+1        k+2              n
          +     +       +···+         =           +          +           +···+       .
      k      k      k            k            k         k          k               k
  We will give two proofs of Theorem 2.6.1 and a reference to a third one; but none
of our two proofs will be complete right away. Instead, our first proof will only
Enumerative Combinatorics: class notes                                                    page 228
prove Theorem 2.6.1 in the particular case when x ∈ N, and our second proof will
only prove Theorem 2.6.1 in the (even more particular) case when both x and y
belong to N. Later – in Subsection 2.6.3 – we will see how to regain the generality
of Theorem 2.6.1 and transform these proofs into complete proofs of Theorem 2.6.1.
First proof of Theorem 1.3.37 for x ∈ N (informal version). Let u ∈ R and v ∈ N. Then,
Theorem 1.3.8 yields
                                       u−1          u−1
                                                    
                                u
                                    =          +            .
                                n      n−1            n
Let us now apply Theorem 1.3.8 again to each addend on the right hand side of
this equation:
                  u−1                  u−1
                                       
      u
          =                  +
      n           n−1                    n
               | {z  }          | {z  }
               u−2     u−2         u−2      u−2
                                                
            =       +           =         +
               n−2     n−1         n−1        n
                    (by Theorem 1.3.8)       (by Theorem 1.3.8)
                   u−2                  u−2                u−2
                                                           
            =                  +2                  +
                   n−2                  n−1                 n
                 | {z  }          | {z  }         | {z  }
                 u−3     u−3         u−3     u−3        u−3     u−3
                                                                   
              =       +           =       +          =       +
                 n−3     n−2         n−2     n−1        n−1        n
                    (by Theorem 1.3.8)           (by Theorem 1.3.8)       (by Theorem 1.3.8)
                u−3        u−3        u−3         u−3
                                                               
            =         +3         +3           +
                n−3        n−2        n−1           n
                u−4        u−4        u−4          u−4       u−4
                                                           
            =         +4         +6           +4         +
                n−4        n−3        n−2          n−1         n
                 (by applying Theorem 1.3.8 to each addend again) .
  We can keep applying Theorem 1.3.8 like this indefinitely. After v steps, we
obtain an equality of the form
                 u−v                 u−v                          u−v            u−v
                                                                            
    u
       = αv,v          + αv,v−1                  + · · · + αv,1         + αv,0
    n            n−v              n − ( v − 1)                    n−1             n
            v
                    u−v
                       
       = ∑ αv,k           ,                                                         (174)
          k =0
                    n−k
where αv,0 , αv,1 , . . . , αv,v are certain numbers. Due to how we are combining terms,
we see that these numbers satisfy
                                                 v−1         v−1
                                                        
  v                v                    v
     = 1,             = 1,      and         =            +          for each i ∈ [v − 1]
  0                v                     i          i        i−1
   Now, forget that we fixed u and v. We thus have proved the identity
                                       v  
                                              u−v
                                                 
                               u          v
                                  = ∑                                                          (175)
                               n     k =0
                                          k   n−k
Thus, (172) is proved. Hence, (173) follows as well168 . This proves Theorem 2.6.1
for x ∈ N.
   The above proof was informal, but it is easy to formalize:
   Exercise 2.6.1. Transform the above informal proof of Theorem 2.6.1 into a rig-
   orous proof. (Of course, this proof will still require x ∈ N.)
  Now, let us come to our second proof of Theorem 2.6.1. As I said, it is even less
complete than the first one: it only covers the case when x, y ∈ N. However, it is
neater:
167 Here,                   0
         we are using the “=” notation that we introduced in Remark 2.6.2.
168 because we have seen in Remark 2.6.2 that the right hand sides of (172) and of (173) are equal
Enumerative Combinatorics: class notes                                                       page 230
169 because   we have seen in Remark 2.6.2 that the right hand sides of (172) and of (173) are equal
Enumerative Combinatorics: class notes                                            page 231
  Exercise 2.6.2. We have so far not proved Theorem 2.6.1 in full generality. How-
  ever, our first proof of Theorem 2.6.1 above proves the particular case of Theorem
  2.6.1 for x ∈ N.
     Give an alternative proof of Corollary 2.6.3 which relies only on this particular
  case.
   (See [Stanle01, Exercise 6.54 b] for this formula, which was found by Franel in
   1894. Recursions
            r          like this, although increasingly more complicated, exist for all
     n    n
    ∑          . Note that the sequence ( a0 , a1 , a2 , . . .) is OEIS sequence A000172.)
   k =0 k
       The situation
                 r is somewhat nicer for alternating sums – i.e., sums of the forms
     n
             k n
    ∑ (−1)           . Indeed, there are simple formulas for these sums for all r ∈
   k =0           k
   {1, 2, 3}. We have already seen the formula for r = 1 (this is Proposition 1.3.28),
   and will soon see a formula for r = 2 (in Exercise 2.8.1 (c)). The formula for
   r = 3 is a special case of Dixon’s identity ([Ward91, (∗)]), which we may see later
   too.
   Exercise 2.6.3. Explain why Exercise 2.1.1 (a) is also a particular case of Theorem
   1.3.37.
      [Hint: Apply Theorem 1.3.37 to y = −1.]
αX a + βX b + γX c + · · · + ωX z with α, β, γ, . . . , ω ∈ R and a, b, c, . . . , z ∈ N
For example,
                                    3 1
               2X 3 + 7X 5 ,          X + 6X 0 ,          7X 5 ,        (−2) X 0 ,         0
                                    2
are polynomials (where 0 is understood to be an empty sum). Two such expressions
are understood to be equal to each other if they can be transformed into one another
by the following rules:
Subtraction is defined like addition, except that the terms of the subtrahend get
their signs flipped:
                                     
           αX a + βX b − γX c + δX d = αX a + βX b + (−γ) X c + (−δ) X d .
All of these facts are true and can be proven, but it requires some work. Thus,
it is more common to define polynomials in a different way, namely as infinite
sequences ( a0 , a1 , a2 , . . .) of real numbers having only finitely many nonzero en-
tries. (Such a sequence ( a0 , a1 , a2 , . . .) corresponds to the polynomial a0 X 0 + a1 X 1 +
a2 X 2 + · · · .) This definition of polynomials can be found in [Grinbe15, §1.5] or
[Loehr11, Sections 7.1–7.3] or [19s, §7.4] or most good algebra textbooks; we will
also outline it in the generating functions chapter of this course.
   We shall silently identify each number u with the polynomial uX 0 (which is
called a constant polynomial, and has degree 0 when u 6= 0 and degree −∞ when
u = 0).
   Let us now discuss roots of polynomials:
Enumerative Combinatorics: class notes                                     page 235
  A crucial property of polynomials is that they cannot have too many roots (unless
they are the zero polynomial):
  Example 2.6.8. (a) The polynomial X 2 − 2X − 3 has degree 2; thus, Theorem 2.6.7
  (applied to n = 2) shows that it has ≤ 2 roots. And indeed, it has 2 roots: 3 and
  −1.
    (b) The polynomial X 2 − 2X + 1 has degree 2; thus, Theorem 2.6.7 (applied to
  n = 2) shows that it has ≤ 2 roots. And indeed, it has 1 root: 1. (We could say
  that 1 is a “double root” of this polynomial, since X 2 − 2X + 1 = ( X − 1)2 ; but
  this requires the somewhat subtle concept of “double roots” and, more generally,
  “multiple roots”, which I don’t want to introduce here.)
   Theorem 2.6.7 is often called the “easy half of the Fundamental Theorem of Al-
gebra”. We will not prove it here, but proofs of this theorem are not hard to find.
I believe any good textbook on abstract algebra contains a proof of Theorem 2.6.7
somewhere. (In particular, proofs appear in [Goodma15, Corollary 1.8.24], [Joyce17,
Theorem 1.58], [Walker87, Corollary 4.5.10], [CoLiOs15, Chapter 1, §5, Corollary 3],
[19s, Theorem 7.6.11], [Elman19, Corollary 33.7] and [Knapp16, Corollary 1.14].)
   The following corollary of Theorem 2.6.7 is almost trivial:
  Corollary 2.6.9. If a polynomial P has infinitely many roots, then P is the zero
  polynomial.
                 ( P − Q) ( x ) = P ( x ) − Q ( x ) = 0       (by (176)) .
In other words, each x ∈ N is a root of P − Q. Hence, P − Q has infinitely many
roots (since there are infinitely many x ∈ N). Thus, Corollary 2.6.9 (applied to
P − Q instead of P) shows that P − Q is the zero polynomial. In other words,
P − Q = 0. Hence, P = Q. This proves Corollary 2.6.10.
  Since polynomials are not usually denoted byn,let me restate this definition: If
                                                       P
P is any polynomial and k is any number, then             is a polynomial defined by
                                                       k
                     P ( P − 1) ( P − 2) · · · ( P − k + 1)
               
               P
                  =                                               if k ∈ N
               k                      k!
and                              
                                 P
                                    =0                 / N.
                                                  if k ∈
                                 k
  Note the following fact:
   This proposition is intuitively clear (it is just saying that it does notmatter
                                                                               
                                                                             P
whether we substitute n for X before computing the binomial coefficient          or
                                                                             k
after it). For a formal proof, see [19s, Corollary 7.6.16 (c)].
Enumerative Combinatorics: class notes                                                       page 237
  Let us now come back to our first proof of Theorem 2.6.1. In that proof, we only
showed that Theorem 2.6.1 holds for all x ∈ N. We shall now extend it to all real
values of x:
Completion of the first proof of Theorem 2.6.1. Fix y ∈ R and n ∈ N. We have already
proved that Theorem 2.6.1 holds for x ∈ N. Thus, the equality
                                           n         
                                 x+y             x     y
                                        = ∑                                     (177)
                                   n       k =0
                                                 k    n−k
holds for all x ∈ N. We now want to prove this equality for all x ∈ R.
  Define two polynomials P and Q (in 1 variable X, with real coefficients) by
                                                 n            
                     X+y                              X        y
                P=               and        Q= ∑                     .
                       n                         k =0
                                                       k    n −  k
These are well-defined polynomials, and can be written explicitly as follows:
                        ( X + y ) ( X + y − 1) ( X + y − 2) · · · ( X + y − n + 1)
                  
             X+y
       P=            =
                n                                   n!
and
                 n            n
                                 X ( X − 1) ( X − 2) · · · ( X − k + 1)
                                                                         
                X    y                                                     y
       Q= ∑               = ∑                                                   .
          k =0
                k   n−k     k =0
                                                  k!                      n−k
   Now, for each x ∈ R, we have
                                                                   
                 x+y                                               X+y
      P (x) =                   by Proposition 2.6.12, since P =
                   n                                                n
and
                                      n       
                                         x    y
                           Q (x) = ∑                             (likewise) .
                                   k =0
                                         k   n−k
In view of these two equalities, we can rewrite (177) as
                                            P (x) = Q (x) .
Hence, we know that P ( x ) = Q ( x ) holds for all x ∈ N (because we know that (177)
holds for all x ∈ N). Therefore, Corollary 2.6.10 yields P = Q. Thus, P ( x ) = Q ( x )
for all x ∈ R. In other words,
                                         n            
                                 x+y           x        y
                                       = ∑
                                  n      k =0
                                               k     n−k
                                                              
                                 x+y                    n   x   y
for all x ∈ R (since P ( x ) =         and Q ( x ) = ∑               for each x ∈ R).
                                  n                   k =0 k   n−k
Thus, we have proved the equality (172) for all x ∈ R. Hence, (173) holds for all
x ∈ R as well172 . Therefore, Theorem 2.6.1 is proved (this time for all values of x
and y).
172 because   we have seen in Remark 2.6.2 that the right hand sides of (172) and of (173) are equal
Enumerative Combinatorics: class notes                                                     page 238
   Our use of Corollary 2.6.10 in the proof we just gave is an instance of what I call
the “polynomial identity trick”: We wanted to prove the equality P ( x ) = Q ( x ) for
all x ∈ R, where P and Q were two given polynomials. We did this as follows:
We first proved it for all x ∈ N; then, we used this to conclude that P = Q (by
Corollary 2.6.10); finally we substituted x in P = Q to obtain P ( x ) = Q ( x ) for all
x ∈ R. What made this argument possible is that the equality that we were aiming
to show (in our case, (177)) was an equality between two polynomials in x (that
is, we could rewrite it as P ( x ) = Q ( x ) for two polynomials P and Q). Corollary
2.6.10 allows us to use this kind of argument in proving any such equality. This
is called the “polynomial identity trick” or (in [GrKnPa94, §5.1]) the “polynomial
argument”.
   We can also salvage our second proof of Theorem 2.6.1 in a similar way. Here we
need to apply the polynomial identity trick twice:
        • Step 1: Fix y ∈ N and n ∈ N. Use the same argument as before to prove that
          (177) holds for all x ∈ R. Thus, (177) is proved for all x ∈ R and y ∈ N.
        • Step 2: Fix x ∈ R and n ∈ N. Use an analogous argument (using y instead of
          x) to prove that (177) holds for all y ∈ R.
See [19s, §2.17.3] for the details of this argument173 , and [Grinbe15, Second proof
of Theorem 3.30] for a different variant of this argument (using polynomials in 2
variables).
P (n) = Q (n) ,
     Our second proof of Proposition 1.3.35 thus shows that P (n) = Q (n) for
     all n ∈ N. Hence, using the polynomial identity trick, we conclude that
     P (n) = Q (n) for all n ∈ R. This completes the second proof of Proposition
     1.3.35.
     holds for all n ∈ N. Can we use the polynomial identity trick to generalize
     this to all n ∈ R ? No, because n appears as a summation bound on the left
     hand side, and it would make no sense to replace it by a non-integer number
                              √
                                  2
     (because what would “ ∑ ” even mean?).
                              k =0
     We could try to sneak past this issue by rewriting the left hand side somewhat.
     For any n ∈ N, we can rewrite the identity (179) as
                                            
                                          k n
                                 ∑ (−1) k = [n = 0]                            (180)
                                k ∈N
                                         
                n         n 0
                        k               k n
     (because ∑ (−1)         = ∑ (−1)         ). But even in this form, we cannot
               k =0       k     k ∈N        k
     generalize it to n ∈ R using the polynomial identity trick, because the right
     hand side of (180) cannot be written as a polynomial in n. In other words,
     there exists no polynomial Q such that
Q ( n ) = [ n = 0] for all n ∈ N
     (in fact, such a polynomial Q would have infinitely many roots, contradicting
     Corollary 2.6.9).
     Note that we cannot generalize (180) to all n ∈ R in any way (by the polyno-
     mial identity trick or otherwise), because if we try to substitute n = −1 into
     (180), then the left hand side will become
                             k −1
                               
                    ∑ (−1) k = ∑ (−              1)k (−1)k = ∑ 1,
                   k ∈N       | {z } k∈N                        k ∈N
                                              |    {z    }
                                                     k+k
                                                      =(−1) =1
                               =(−1)k            (since k+k=2k is even)
                               (by (47))
Class of 2019-10-28
                                                   n−k
                                                     
                                               k
                                                           = 0.
                                               x     y
                                                               n−k
                                                                                
                                                          k                          k
  [Proof of Claim 1: Assume the contrary. Thus,                       6= 0. Hence,       6= 0 and
                                                          x      y                   x
  n−k
      
         6= 0. Note that k ∈ {0, 1, . . . , n}, so that both k and n − k are nonnegative integers.
   y
Thus, k ∈ N and n − k ∈ N.
174 i.e.,   Proposition 1.3.7 and Theorem 1.3.11
Enumerative Combinatorics: class notes                                                  page 242
                        
                         k
   From k ∈ N and            6= 0, we obtain k ≥ x, because otherwise, Proposition 1.3.6
                         x                             
                                                        k
(applied to k and x instead of n and k) would yield        = 0.
                                                        x
                           n−k
                               
   From n − k ∈ N and              6= 0, we obtain n − k ≥ y, because otherwise, Proposition
                             y
                                                                 n−k
                                                                     
1.3.6 (applied to n − k and y instead of n and k) would yield           = 0.
                                                                   y
   We have thus found k ≥ x and n − k ≥ y. This contradicts the assumption that k < x
or n − k < y. This contradiction shows that our assumption was wrong. Hence, Claim 1 is
proven.]
  We are in one of the following two cases:
  Case 1: We have n < x + y.
  Case 2: We have n ≥ x + y.
  Let us first consider Case 1. In this case, we have n < x + y. Therefore, each
k ∈ {0, 1, . . . , n} satisfies either k < x or n − k < y 175 . Hence, each k ∈ {0, 1, . . . , n}
satisfies
                                               n−k
                                                  
                                          k
                                                       =0                                 (183)
                                          x       y
(by Claim 1).
  Now, n < x + y, thus n + 1 < x + y + 1. Thus, Proposition
                                                            1.3.6 (applied to n + 1
                                            n+1
and x + y + 1 instead of n and k) yields             = 0. Comparing this with
                                          x+y+1
                             n              n
                                     n−k
                                          
                                  k
                           ∑ x         y
                                            = ∑ 0 = 0,
                           k =0 |   {z     } k =0
                                          =0
                                       (by (183))
we obtain
                                                    n
                                                          n−k
                                                         
                                  n+1                 k
                                              = ∑               .
                                 x+y+1          k =0
                                                      x    y
Thus, Proposition 2.6.13 is proven in Case 1.
  Let us now consider Case 2. In this case, we have n ≥ x + y. Thus, n − y ≥ x.
Thus, x ≤ n − y, so that 0 ≤ x ≤ n − y ≤ n (since y ∈ N). Therefore, the integer
interval [ x, n − y] = { x, x + 1, . . . , n − y} is a subset of [0, n] = {0, 1, . . . , n}. Thus,
the elements k ∈ {0, 1, . . . , n} that satisfy k ≥ x and k ≤ n − y are precisely the
elements of { x, x + 1, . . . , n − y}.
  Now, each k ∈ {0, 1, . . . , n} satisfies
(butnot
       both of
               these statements simultaneously). Thus, we can split the sum
  n  k   n−k
 ∑               as follows:176
k =0 x     y
                   n
                           n−k
                            
                       k
                 ∑ x        y
                 k =0
                                                            n−k                                n−k
                                                                                            
                                                        k                                   k
                  =                      ∑              x    y
                                                                  +                ∑        x    y
                                 k∈{0,1,...,n};                          k∈{0,1,...,n};   |   {z   }
                                k≥ x and n−k≥y                          k< x or n−k<y              =0
                                |        {z        }                                          (by Claim 1)
                                =       ∑
                                   k∈{0,1,...,n};
                                 k≥ x and k≤n−y
                         (since the inequality n−k≥y
                            is equivalent to k≤n−y)
                                                   n−k
                                                    
                                               k
                  =             ∑              x    y
                                                         +        ∑            0
                          k∈{0,1,...,n};                      k∈{0,1,...,n};
                         k≥ x and k≤n−y                      k< x or n−k<y
                                                   n−k
                                                    
                                               k
                  =             ∑              x    y
                          k∈{0,1,...,n};
                         k≥ x and k≤n−y
                         n−y 
                                             n−k
                                                 
                                    k
                  =      ∑          x         y
                                                                                                                (184)
                         k= x
                                      − (−k)
                                        
            k          k
                =              =                      (since k = − (−k))
            x        k−x               k−x
                         k− x −k + k − x − 1
                                                 
                = (−1)
                                       k−x
                                                                             
                           by Proposition 1.3.7, applied to − k and k − x
                                             instead of n and k
                                 −x − 1
                                        
                = (−1)k−x                                                            (185)
                                   k−x
      n−k          n−k            − (k − n)
                                       
             =               =                       (since n − k = − (k − n))
       y          n−k−y           n−k−y
                     n−k−y k − n + n − k − y − 1
                                                  
             = (−1)
                                   n−k−y
                                                                           
                      by Proposition 1.3.7, applied to k − n and n − k − y
                                        instead of n and k
                              −y − 1
                                     
             = (−1)n−k−y                                                       (186)
                             n−y−k
                n−k            k− x − x − 1                   −y − 1
                                                              
            k                                        n−k−y
                        = (−1)                  (−1)
            x     y                     k−x                  n−y−k
                                                        −x − 1     −y − 1
                                                                       
                                   k− x      n−k−y
                        =    (−1)       (−1)
                             |          {z       }       k−x      n−y−k
                          =(−1)(k− x)+(n−k−y) =(−1)n− x−y
                          (since (k− x )+(n−k−y)=n− x −y)
                                              −x − 1         −y − 1
                                                                 
                                n− x −y
                       = (−1)                                         .        (187)
                                               k−x          n−y−k
  Now, forget that we fixed k. We thus have proved the equality (187) for each
Enumerative Combinatorics: class notes                                                                  page 245
   Let us now look at the sum on the right hand side of this equality more carefully.
It is a sum of products of binomial coefficients, and this time the running index k
of the sum appears only in the bottom arguments of these coefficients. This looks
similar to the right hand side of (172), and indeed we can easily recognize the right
hand side of (172) in our sum, with n − x − y, − x − 1 and −y − 1 substituted for n,
x and y.
   Let us see how this works in detail: We have n − x − y ≥ 0 (since n ≥ x + y) and
thus n − x − y ∈ N. Thus, (172) (applied to n − x − y, − x − 1 and −y − 1 instead
of n, x and y) yields
                                                          n− x −y 
                  (− x − 1) + (−y − 1)                                −x − 1          −y − 1
                                                                                         
                        n−x−y
                                                      =      ∑          k           n−x−y−k
                                                                                               .
                                                             k =0
                          n−x−y
                                              =       ∑            k           n−x−y−k
                                                                                          .                (189)
                                                      k =0
Enumerative Combinatorics: class notes                                                  page 246
   • First, we choose the ( x + 1)-st smallest element of the subset U. Let us call it
     m. Thus, m ∈ [n + 1].
                                                                   m−1     n−m+1
                                                                               
The total # of ways to make these decisions is clearly ∑                            .
                                                        m∈[n+1]     x        y
Thus,
                                 m−1          n−m+1
                                                   
           n+1
                    = ∑
          x+y+1        m∈[n+1]
                                   x               y
                                            |     {z     }
                                                −     −
                       | {z }               
                          n +1                n   ( m   1 )
                        = ∑               =
                         m =1                       y
                                                (since n−m+1=n−(m−1))
                           n +1                                     n
                                    m−1        n − ( m − 1)                   n−k
                                                                            
                                                                          k
                       =   ∑         x               y
                                                                  = ∑
                                                                          x    y
                           m =1                                     k =0
  For example, the 3-tuple (3, 2, 5) is injective (since 3, 2, 5 are distinct), whereas
the 3-tuple (4, 2, 4) is not (since 4 = 4).
  In probability theory, injective k-tuples are called “ordered k-samples without
replacement” (while arbitrary k-tuples are called “ordered k-samples with replace-
ment”).
  Warning: Some authors also refer to injective k-tuples (s1 , s2 , . . . , sk ) ∈ Sk as k-
permutations of S. But this is not the meaning that the word “permutation” has in
this text!
  We promised that the injective k-tuples (the “legs”) would be easy to count; let
us do this:
  Here, we are using the falling factorial notation nk (as defined in Definition 2.4.2).
  It is easy to prove Proposition 2.7.2 using the “dependent product rule”178 . How-
ever, we have already made more or less the same argument when we proved The-
orem 2.4.4, so instead of doing it again, I find it easier to piggyback on Theorem
2.4.4:
Proof of Proposition 2.7.2. Note that S is a |S|-element set, whereas [k] is a k-element
set.
  The injective k-tuples (s1 , s2 , . . . , sk ) ∈ Sk are in one-to-one correspondence with
the injective maps from [k] to S. More precisely: If f is an injective map from [k ]
to S, then the k-tuple ( f (1) , f (2) , . . . , f (k )) ∈ Sk is injective (since the injectivity
of f forces the values f (1) , f (2) , . . . , f (k ) to be distinct) and thus belongs to Sinjk .
This map α simply sends every injective map f : [k ] → S to its list of values. It is
easy to see that this map α is a bijection179 . Thus, the bijection principle yields
                                                                   k
                               |{injective maps from [k] to S}| = Sinj .
Hence,
                           k
                          Sinj = |{injective maps from [k] to S}|
                                 = (# of injective maps from [k] to S) = |S|k
If k ∈/ N, then both sides of this equality are 0 (because S has no k-element subsets
when k ∈     / N), and thus the equality is clearly true. Hence, for the rest of this proof,
we WLOG assume that k ∈ N.
   We have |S| = n (since S is an n-element set).
   For each injective k-tuple s = (s1 , s2 , . . . , sk ) ∈ Sinj     k , we let set s denote the set
179 Indeed,  α has an inverse, which can be constructed as follows: For each injective k-tuple
                                   k , we let f : [ k ] → S be the map that sends 1, 2, . . . , k to s , s , . . . , s , re-
    s = (s1 , s2 , . . . , sk ) ∈ Sinj         s                                                      1 2             k
    spectively. This map f s is injective (since its values s1 , s2 , . . . , sk are distinct (because (s1 , s2 , . . . , sk )
    is an injective k-tuple)), and thus belongs to {injective maps from [k ] to S}. Hence, we can de-
    fine a map
                                         k
                                    β : Sinj → {injective maps from [k] to S} ,
                                           s 7→ f s .
     It is straightforward to see that the maps α and β are mutually inverse. Hence, the map α is
     invertible, i.e., bijective, i.e., a bijection.
180 since ( s , s , . . . , s ) is an injective k-tuple
             1 2             k
181 since ( s , s , . . . , s ) ∈ Sk ⊆ Sk
             1 2             k      inj
Enumerative Combinatorics: class notes                                                              page 251
[Proof of Claim 1.1: Let s ∈ Sinj k be an injective k-tuple satisfying set s = W. We must prove
   Write the k-tuple s as s = (s1 , s2 , . . . , sk ). Then, set s = {s1 , s2 , . . . , sk } (by the definition
of set s), so that {s1 , s2 , . . . , sk } = set s = W. Hence, the elements s1 , s2 , . . . , sk belong to W
(because they clearly belong to {s1 , s2 , . . . , sk }). Therefore, (s1 , s2 , . . . , sk ) ∈ W k . In other
words, s ∈ W k (since s = (s1 , s2 , . . . , sk )). Since the k-tuple s is injective, this shows that
s ∈ Winjk . Hence, s is an injective k-tuple in W k . This completes the proof of Claim 1.1.]
                                                          inj
   [Proof of Claim 1.2: Let w be an injective k-tuple in Winj           k . We must prove that w is an
injective k-tuple s ∈ Sinj k satisfying set s = W. In other words, we must prove that w is an
other words, w ∈ Sinj       k . Now, write the k-tuple w in the form w = w , w , . . . , w . Then,
                                                                                     ( 1 2           k)
                                                                   k        k
w1 , w2 , . . . , wk ∈ W (since (w1 , w2 , . . . , wk ) = w ∈ Winj ⊆ W ), so that {w1 , w2 , . . . , wk } is
a subset of W. Moreover, the k-tuple (w1 , w2 , . . . , wk ) = w is injective; in other words,
w1 , w2 , . . . , wk are distinct. Thus, {w1 , w2 , . . . , wk } is a k-element set. In other words,
|{w1 , w2 , . . . , wk }| = k. Hence, |{w1 , w2 , . . . , wk }| = k = |W | (since |W | = k). Hence, The-
orem 1.4.7 (c) (applied to A = W and B = {w1 , w2 , . . . , wk }) yields {w1 , w2 , . . . , wk } = W.
Now, from w = (w1 , w2 , . . . , wk ), we obtain set w = {w1 , w2 , . . . , wk } (by the definition of
set w), so that set w = {w1 , w2 , . . . , wk } = W. Thus, altogether, we have shown that w is an
injective k-tuple that belongs to Sinj        k and satisfies set w = W. This proves Claim 1.2.]
   Combining Claim 1.1 with Claim 1.2, we obtain precisely the claim of Observation 1.
Hence, Observation 1 is proven.]
   Now, Observation 1 shows that
                                                                 
                                          k
           # of injective k-tuples s ∈ Sinj satisfying set s = W
                                             
                                            k
         = # of injective k-tuples in Winj
                                                                              
                k                                    k
         = Winj              since all elements of Winj are injective k-tuples
we obtain                     
                              n
                        k! ·     = (# of k-element subsets of S) · k!.
                              k
We can divide both sides of this equality by k! (since k! = 1 · 2 · · · · · k is clearly a
nonzero integer), and thus obtain
                        
                        n
                            = (# of k-element subsets of S) .
                        k
                                        Class of 2019-10-30
Enumerative Combinatorics: class notes                                         page 253
Proof of Lemma 2.8.1 (sketched). We have stated Theorem 1.3.24 only for the case
when x and y are real numbers; however, it also holds when x and y are poly-
nomials (and the same proof that we gave applies in this case). Thus, we can apply
Theorem 1.3.24 to n = p, x = X and y = 1. We thus obtain182
                                  p                p              
                                      p                 p             p
                     ( X + 1) = ∑
                            p
                                         X 1|{z} = ∑
                                          k p−k
                                                           X = ∑
                                                            k 0
                                                                         Xk.
                                k =0
                                      k            k =0
                                                        k       k ∈N
                                                                      k
                                               =1
                 0
  the “=” sign is owed to the fact that all integers k satisfying
Here,                                                                k > p satisfy
  p                                                             p
      = 0 (by Proposition 1.3.6, applied to n = p) and thus       X k = 0. This also
  k                                                           k
                                    p
shows that the infinite sum ∑          X k has only finitely many nonzero addends,
                             k ∈N   k
and thus is well-defined. Now,
                                                      
                                         p               p
                      ( X + 1) = ∑
                              p
                                            X = ∑
                                              k
                                                             Xm
                                  k ∈N
                                         k        m ∈N
                                                         m
182 See                                        0
          Remark 2.6.2 for the meaning of the “=” sign.
Enumerative Combinatorics: class notes                                      page 254
  Let us work with polynomials in one variable X, with real coefficients. Lemma
2.8.1 (applied to p = a) yields
                                                   
                                        a            a
                       (1 + X ) = ∑
                                a
                                           X = ∑
                                            m
                                                        Xi
                                  m ∈N
                                        m      i ∈N
                                                     i
     (1 + X ) a · (1 + X ) b
                  !                          !
                    a                         b
     = ∑                 Xi · ∑                    Xj
           i ∈N
                    i                j ∈N
                                              j
                                                         
                a                  b                        a         b
     = ∑              X ∑
                        i
                                        X = ∑ ∑
                                            j
                                                                Xi       Xj
        i ∈N
                i          j ∈N
                                   j            i ∈N j ∈N |
                                                            i         j
              |              {z            }                   {z  }
                         
                         a i b j                              a     b i+ j
                                                          =             X
              = ∑             X         X                     i     j
                j ∈N      i        j
                                                      
                       a        b                         a     b
     = ∑ ∑                         X = ∑
                                       i+ j
                                                                    X i+ j
        i ∈N j ∈N
                       i        j              (i,j)∈N2
                                                          i     j
                                  by the first equality sign in Theorem 1.6.11,
                                                                                              
                                                                              
                                                                             a  b
                   since only finitely many (i, j) ∈ N satisfy        2            X i+ j 6= 0
                                                                                              
                                                                             i  j
                               
                               a      b
     = ∑           ∑ i j                        X i+ j
                                                |{z}
        m ∈N    (i,j)∈N ;2
                                           =X       m
                 i + j=m              (since i + j=m)
         (1 + X ) a · (1 + X ) b
          = (1 + X ) a + b
                                                                           !
                  since the product rule for exponents, u a · ub = u a+b ,
                   holds for polynomials just as it holds for numbers
                      
                  a+b
          = ∑            Xm       (by Lemma 2.8.1, applied to p = a + b) ,
           m ∈N
                    m
Enumerative Combinatorics: class notes                                                              page 256
we obtain                                                 
                                                                    
                                                  a  b            a + b
                          ∑            ∑                X = ∑
                                                          m
                                                                           Xm.
                                
                                                                                                       (194)
                         m ∈N
                                                 i  j     m ∈N
                                                                     m
                                    (i,j)∈N2 ;
                                     i + j=m
(here, we have substituted (k, n − k ) for (i, j) in the sum, since the map
                                       n                         o
                    {0, 1, . . . , n} → (i, j) ∈ N | i + j = n ,
                                                    2
k 7→ (k, n − k )
is a bijection183 ). This is precisely the equality (193) (since the summation sign
  n
 ∑ is a synonym for                   ∑          ). Thus, (193) holds. As we have said, this proves
k =0                            k∈{0,1,...,n}
Theorem 2.6.1 in the case when x, y ∈ N.
183 In  informal terms, this is just saying that each pair (i, j) ∈ N2 of nonnegative integers satisfying
      i + j = n has the form (k, n − k) for a unique k ∈ {0, 1, . . . , n} (namely, for k = i), and conversely,
      any pair of the latter form is a pair (i, j) ∈ N2 of nonnegative integers satisfying i + j = n.
Enumerative Combinatorics: class notes                                                      page 257
   The proof we just gave used polynomials, but not via the polynomial identity
trick. Instead, we obtained an equality between two polynomials (viz., (194)), and
then compared coefficients (i.e., argued that two equal polynomials have equal
n-th coefficients). This relies on the fact that any polynomial has a well-defined
n-th coefficient for each n ∈ N, which does not depend on how the polynomial
is expressed. This is a versatile tactic, and we will later apply it to more general
objects than polynomials. But even when restricted to polynomials, it is rather
useful. Instead of proving Theorem 2.6.1 again and again, we can apply it to obtain
a new equality:
     (b) Prove that the claim of Exercise 2.8.1 (a) holds, more generally, for all n ∈ R
  (rather than only for n ∈ N).
     (c) Conclude that every n ∈ N satisfies
                                                     
                   n         2            n/2     n
                              n       (−1)              , if n is even;
                  ∑ (−1)k k =                     n/2                   .
                 k =0                0,                    if n is odd
                          | A1 ∪ A2 | = | A1 | + | A2 | − | A1 ∩ A2 |                          (196)
Enumerative Combinatorics: class notes                                                                  page 258
for any two finite sets A1 and A2 . This is fairly easy to check. A similar but more
complicated formula holds for 3 sets: namely,
      | A1 ∪ A2 ∪ A3 | = | A1 | + | A2 | + | A3 | − | A1 ∩ A2 | − | A1 ∩ A3 | − | A2 ∩ A3 |
                               + | A1 ∩ A2 ∩ A3 |                                           (197)
for any three finite sets A1 , A2 and A3 . A further formula of the same kind holds
for 4 sets: namely,
  | A1 ∪ A2 ∪ A3 ∪ A4 |
  = | A1 | + | A2 | + | A3 | + | A4 |
          − | A1 ∩ A2 | − | A1 ∩ A3 | − | A1 ∩ A4 | − | A2 ∩ A3 | − | A2 ∩ A4 | − | A3 ∩ A4 |
          + | A1 ∩ A2 ∩ A3 | + | A1 ∩ A2 ∩ A4 | + | A1 ∩ A3 ∩ A4 | + | A2 ∩ A3 ∩ A4 |
          − | A1 ∩ A2 ∩ A3 ∩ A4 |                                                        (198)
for any four finite sets A1 , A2 , A3 and A4 . These three formulas (along with the
trivial formula | A1 | = | A1 | for a single set A1 ) all are particular cases of one general
fact, which expresses the size of the union of n finite sets through the sizes of their
intersections (more precisely, of the intersection of each k of these sets):
  Theorem 2.9.1 (Principle of Inclusion and Exclusion (union form)). Let n ∈ N.
  Let A1 , A2 , . . . , An be n finite sets. Then,
                     | A1 ∪ A2 ∪ · · · ∪ A n |
                           n
                      =   ∑      (−1)m−1              ∑                 A i1 ∩ A i2 ∩ · · · ∩ A i m .      (199)
                          m =1               (i1 ,i2 ,...,im )∈[n]m ;
                                                i1 <i2 <···<im
 The nested sum on the right hand side of (199) is somewhat daunting, so let us
write it out: It is
        | A1 | + | A2 | + · · · + | A n |
        |              {z              }
               the sizes of all Ai
            (summed with + signs)
                 − | A 1 ∩ A 2 | − | A 1 ∩ A 3 | − · · · − | A n −1 ∩ A n |
                 |                         {z                            }
                        the sizes of all intersections Ai ∩ A j (with i < j)
                                    (summed with − signs)
                 + | A 1 ∩ A 2 ∩ A 3 | + | A 1 ∩ A 2 ∩ A 4 | + · · · + | A n −2 ∩ A n −1 ∩ A n |
                 |                                    {z                                      }
                                  the sizes of all intersections Ai ∩ A j ∩ Ak (with i < j<k)
                                                  (summed with + signs)
                 ±···
                 +               (−1)n−1 | A1 ∩ A2 ∩ · · · ∩ An |                         .
                                 |             {z              }
                           the size of the intersection A1 ∩ A2 ∩···∩ An
                     (summed with a + or − sign depending on the parity of n)
Enumerative Combinatorics: class notes                                                                                page 259
Thus, it is a sum that contains the sizes of all possible intersections of some of the
sets A1 , A2 , . . . , An , each with a + or − sign depending on how many sets are being
intersected. Clearly, the right hand sides of (196), (197) and (198) are the particular
cases of this sum obtained for n = 2, n = 3 and n = 4, respectively.
   Theorem 2.9.1 is known as the Principle of Inclusion and Exclusion (often abbre-
viated PIE) or the Sylvester sieve formula. We will not prove it right away, since
this will become easier once we have restated it in a more abstract form. This ab-
stract form (which also makes it more convenient to apply) relies on the following
notation from set theory:
  Definition 2.9.2. Let I be a nonempty set. For each i ∈ I, let Ai be a set. Then,
  T
    Ai denotes the set
  i∈ I
                                                  { x | x ∈ Ai for each i ∈ I } .
                        Ai is called the intersection of all Ai with i ∈ I.
                 T
  This set
                i∈ I
   It is easy to see that if I = {i1 , i2 , . . . , im } is a finite set, and if Ai is a set for each
i ∈ I, then                    \
                                  A i = A i1 ∩ A i2 ∩ · · · ∩ A i m .                           (200)
                                                i∈ I
  Example 2.9.3. Let I = [5].                 For each i ∈ I, let Ai = [i − 8, i ] =
  {i − 8, i − 7, . . . , i − 1, i } (where we are using the notation from Definition 1.4.17).
  Then,
                              \
                                     Ai =       A1 ∩ A2 ∩ A3 ∩ A4 ∩ A5
                                               |{z}  |{z} |{z} |{z} |{z}
                              i∈ I                          =[2−8,2]   =[3−8,3]                      =[5−8,5]
                                              =[1−8,1]                              =[4−8,4]
                                              =[−7,1]       =[−6,2]    =[−5,3]      =[−4,4]          =[−3,5]
                                       = [−7, 1] ∩ [−6, 2] ∩ [−5, 3] ∩ [−4, 4] ∩ [−3, 5]
                                       = [−3, 1] = {−3, −2, −1, 0, 1} .
                                                                        T
  Note the similarity between the notation                                    Ai (for the intersection of a family of
                                                                       i∈ I
sets) and the notation ∑ ai (for the sum of a finite family of numbers). However, in
                                       i∈ I
                              Ai , the set I must be nonempty (unlike in ∑ ai ) but can be infinite
                       T
the notation
                       i∈ I                                                                 i∈ I
(unlike in ∑ ai , which is usually undefined when I is infinite).
                i∈ I
  We can now rewrite the right hand side of (199) as follows:
  Proposition 2.9.4. Let n ∈ N. Let A1 , A2 , . . . , An be n finite sets. Then,
          n
         ∑      (−1)m−1                   ∑                                                 ∑        (−1)| I |−1
                                                                                                                   \
                                                           A i1 ∩ A i2 ∩ · · · ∩ A i m =                                  Ai .
         m =1                                          m
                                 (i1 ,i2 ,...,im )∈[n] ;                                   I ⊆[n];                 i∈ I
                                    i1 <i2 <···<im                                          I 6 =∅
Enumerative Combinatorics: class notes                                                                               page 260
         (−1)1−1 (| A1 | + | A2 | + | A3 |)
                + (−1)2−1 (| A1 ∩ A2 | + | A1 ∩ A3 | + | A2 ∩ A3 |)
                + (−1)3−1 | A1 ∩ A2 ∩ A3 |
                + (−1)|{1,2}|−1                        Ai + (−1)|{1,3}|−1
                                              \                                        \
                                                                                                  Ai
                                            i ∈{1,2}                                 i ∈{1,3}
                + (−1)|{2,3}|−1                        Ai + (−1)|{1,2,3}|−1
                                              \                                            \
                                                                                                       Ai
                                            i ∈{2,3}                                   i ∈{1,2,3}
                          ∑                                                        ∑
                                                                                           \
                                            A i1 ∩ A i2 ∩ · · · ∩ A i m =                         Ai .
                 (i1 ,i2 ,...,im )∈[n]m ;                                         I ⊆[n]; i ∈ I
                    i1 <i2 <···<im                                                 I 6=∅;
                                                                                  | I |=m
                        ∑                         ∑
                                 \                        \
                                      Ai =                       Ai
                      I ⊆[n]; i ∈ I              I ⊆[n]; i ∈ I
                       I 6=∅;                    | I |=m
                      | I |=m
                                                                 ∑
                                                                                      \
                                             =                                             Ai .                           (201)
                                                 I ∈{m-element subsets of [n]} i ∈ I
Enumerative Combinatorics: class notes                                                                              page 261
  For any m-tuple (i1 , i2 , . . . , im ) ∈ [n]m satisfying i1 < i2 < · · · < im , the set
{i1 , i2 , . . . , im } is an m-element subset of [n] 184 . Thus, the map
( i1 , i2 , . . . , i m ) 7 → { i1 , i2 , . . . , i m }
                          ∑                                         ∑
                                             \                                               \
                                                   Ai =                                                      Ai
                                                                               m
             I ∈{m-element subsets of [n]} i ∈ I           (i1 ,i2 ,...,im )∈[n] ;    i ∈{i1 ,i2 ,...,im }
                                                              i1 <i2 <···<im          |         {z            }
                                                                                     = Ai1 ∩ Ai2 ∩···∩ Aim
                                                                                          (by (200))
                                                       =            ∑          m
                                                                                     A i1 ∩ A i2 ∩ · · · ∩ A i m .
                                                           (i1 ,i2 ,...,im )∈[n] ;
                                                              i1 <i2 <···<im
  ∑                                  ∑                                               ∑
         \                                               \
                Ai =                                          Ai =                                  A i1 ∩ A i2 ∩ · · · ∩ A i m .
I ⊆[n]; i ∈ I          I ∈{m-element subsets of [n]} i ∈ I               (i1 ,i2 ,...,im )∈[n]m ;
 I 6=∅;                                                                     i1 <i2 <···<im
| I |=m
184 Proof.   Let (i1 , i2 , . . . , im ) ∈ [n]m be an m-tuple satisfying i1 < i2 < · · · < im . Thus, i1 , i2 , . . . , im ∈
     [n]; hence, {i1 , i2 , . . . , im } is a subset of [n]. Moreover, the numbers i1 , i2 , . . . , im are distinct (since
     i1 < i2 < · · · < im ), and thus the set {i1 , i2 , . . . , im } has m elements. Hence, {i1 , i2 , . . . , im } is an
     m-element set. Therefore, {i1 , i2 , . . . , im } is an m-element subset of [n].
185 Indeed, this can easily be derived from Proposition 1.4.13.
186 Proof. Let I be a subset of [ n ] satisfying I 6 = ∅. Then, Theorem 1.4.7 (b) (applied to A = [ n ] and
     B = I) yields | I | ≤ |[n]| = n. Also, | I | > 0 (since I 6= ∅) and thus | I | ≥ 1. Combining this with
     | I | ≤ n, we obtain | I | ∈ {1, 2, . . . , n}, qed.
Enumerative Combinatorics: class notes                                                                                          page 262
                                                 ∑                ∑     (−1)m−1
                                                                                             \
                                     =                                                              Ai
                                         m∈{1,2,...,n}        I ⊆[n];                        i∈ I
                                                               I 6=∅;
                                                              | I |=m
                                                              |                  {z                     }
                                                                  =(−1)m−1            ∑
                                                                                             T
                                                                                              Ai
                                                                                 I ⊆[n]; i∈ I
                                                                                  I 6=∅;
                                                                                 | I |=m
                                                 ∑           (−1)m−1                                ∑
                                                                                                            \
                                     =                                                                            Ai
                                         m∈{1,2,...,n}                                         I ⊆[n]; i ∈ I
                                                                                                I 6=∅;
                                                                                               | I |=m
                                                                                               |            {z      }
                                                                             =                ∑           | Ai1 ∩ Ai2 ∩···∩ Aim |
                                                                                 (i1 ,i2 ,...,im )∈[n]m ;
                                                                                    i1 <i2 <···<im
                                                                                                  (by Claim 1)
                                     =           ∑           (−1)m−1                   ∑                    A i1 ∩ A i2 ∩ · · · ∩ A i m
                                         m∈{1,2,...,n}                       (i1 ,i2 ,...,im )∈[n]m ;
                                         |       {z      }                      i1 <i2 <···<im
                                                   n
                                                 = ∑
                                                  m =1
                                             n
                                     =   ∑        (−1)m−1                  ∑                  A i1 ∩ A i2 ∩ · · · ∩ A i m .
                                         m =1                     (i1 ,i2 ,...,im )∈[n]m ;
                                                                     i1 <i2 <···<im
                                                                           ∑       (−1)| I |−1
                                                                                                         \
                                 | A1 ∪ A2 ∪ · · · ∪ A n | =                                                     Ai .               (202)
                                                                         I ⊆[n];                         i∈ I
                                                                          I 6 =∅
  We will soon prove Theorem 2.9.6 (and thus conclude Theorem 2.9.1 from it).
First, let us state yet another equivalent version of this principle:
Enumerative Combinatorics: class notes                                                                                    page 263
                                                                              ∑       (−1)| I |
                                                                                                   \
                            |U \ ( A1 ∪ A2 ∪ · · · ∪ An )| =                                              Ai .               (203)
                                                                             I ⊆[n]                i∈ I
                                                  T
   Here, the “empty” intersection                        Ai is understood to mean the set U.
                                                 i ∈∅
   Example 2.9.8. Let U be a finite set, and let A1 and A2 be two subsets of U. Then,
   Theorem 2.9.7 (applied to n = 2) says that
                                     ∑       (−1)| I |
                                                           \
            |U \ ( A1 ∪ A2 )| =                                  Ai
                                    I ⊆[2]                i∈ I
                                 = (−1)|∅|                               + (−1)|{1}|
                                                         \                                         \
                                                                Ai                                         Ai
                                                         i ∈∅
                                   | {z }                                  | {z }
                                       =1                                         =−1             i ∈{1}
                                                         | {z }                                   | {z }
                                                       =U                                           = A1
                                                  (by definition)
                                         + (−1)|{2}|                    Ai + (−1)|{1,2}|
                                                                     \                                       \
                                                                                                  Ai
                                           | {z }                            | {z }
                                                  =−1            i ∈{2}         =1       i ∈{1,2}
                                                                 | {z }                  | {z }
                                                                      = A2                                  = A1 ∩ A2
                                        (since the subsets of [2] are ∅, {1} , {2} , {1, 2})
                                 = |U | + (−1) | A1 | + (−1) | A2 | + | A1 ∩ A2 |
                                 = |U | − | A 1 | − | A 2 | + | A 1 ∩ A 2 | .
                                                                                                                  T
   A remark is in order here. In Definition 2.9.2, we have defined                                                      Ai for any
                                                                                                                 i∈ I
nonempty set I. This definition cannot be extended to the case when I = ∅,
                             T
because it would entail that   Ai should be the set of all objects whatsoever, but
                                       i ∈∅
there is no such set187 . However, in order for the right hand side of (203) to make
                                       Ai for all I ⊆ [n], including I = ∅. Thus, we
                                    T
sense, we need a well-defined set
                      T                           i∈ I                                        T
need to define              Ai somehow. It turns out that defining                                   Ai to be U is the right
                     i ∈∅                                                                    i ∈∅
thing to do (in this particular situation). It is justified here, because all of the sets
involved are subsets of U, so “all objects” can be interpreted as “all elements of U”
187 See   [LeLeMe16, §8.3] for an explanation.
Enumerative Combinatorics: class notes                                                                            page 264
(and then the set of all objects really becomes U). This is, by the way, the reason
why we chose the letter U in Theorem 2.9.7; it stands for “universe”.
  Finally, let us restate Theorem 2.9.7 in an equivalent form that is slightly easier to
                                              T
actually use, because it shuns the notation     Ai (and thus avoids having to define
                                                                    i∈ I
it separately for I = ∅):
  Note that the addend corresponding to I = ∅ on the right hand side of this
equality is simply |U | 188 .
                                                  ∑ (−1)| I | = [S = ∅] .
                                                 I ⊆S
Once again, we are using the Iverson bracket notation here (see Definition 1.3.15).
    Example 2.9.11. The subsets of {1, 2} are ∅, {1}, {2} and {1, 2}. Thus, applying
    Proposition 2.9.10 to S = {1, 2}, we find
    Indeed, both sides of this equality are 0 (the left hand side because the addends
    cancel; the right hand side because {1, 2} 6= ∅).
First proof of Proposition 2.9.10. This will be similar to the proof of Theorem 1.4.1
that we gave in Subsection 1.4.2.
  We have S = ∅ if and only if |S| = 0. In other words, “S = ∅” and “|S| = 0”
are two equivalent logical statements. Hence, Exercise 1.3.3 (a) (applied to A =
(“S = ∅”) and B = (“ |S| = 0”)) yields [S = ∅] = [|S| = 0].
  Let n = |S|. Hence, S is an n-element set. If I is any subset of S, then Theorem
1.4.7 (b) (applied to A = S and B = I) yields | I | ≤ |S| = n and therefore | I | ∈
{0, 1, . . . , n}. Hence, an application of (37) yields
       ∑ (−1)| I |
       I ⊆S
       =         ∑             ∑          (−1)| I | =     ∑                               ∑        (−1)k
             k∈{0,1,...,n}     I ⊆S;                  k∈{0,1,...,n}                       I ⊆S;
                                          | {z }
                              | I |=k      =(−1)k                                        | I |=k
                                        (since | I |=k)                                  |         {z   }
                                                                        =(# of subsets I of S satisfying | I |=k)·(−1)k
Hence, there exists some g ∈ S. Consider this g. (We can have many choices for g,
but we just pick one.)
  Each subset I of S must satisfy either g ∈ I or g ∈
                                                    / I (but not both at the same
                                           |I|
time). Hence, we can split the sum ∑ (−1) as follows:
                                                         I ⊆S
We shall now “set the two sums on the right hand side up to fight each other”.
  Each subset J of S satisfies J ∪ { g} ⊆ S (because g ∈ S) and g ∈ J ∪ { g} (obvi-
ously). Thus, the map190
                                  {I ⊆ S | g ∈
                                             / I} → {I ⊆ S | g ∈ I} ,
                                                J 7→ J ∪ { g}
                                  {I ⊆ S | g ∈ I} → {I ⊆ S | g ∈
                                                               / I} ,
                                                K 7→ K \ { g}
is also well-defined. These two maps are mutually inverse191 , and thus are bijec-
tions. Hence, in particular, the map
                                  {I ⊆ S | g ∈
                                             / I} → {I ⊆ S | g ∈ I} ,
                                                J 7→ J ∪ { g}
                            =−       ∑       (−1)| I |                                                           (205)
                                     I ⊆S;
                                       ∈I
                                      g/
190 The notation “{ I ⊆ S | g ∈/ I }” means “the set of all subsets I of S satisfying g ∈/ I”. Similarly,
     the notation “{ I ⊆ S | g ∈ I }” means “the set of all subsets I of S satisfying g ∈ I”.
191 because of the following two (easily proven) facts:
[ S = ∅] = 0 (since S 6= ∅) ,
                                    ∑       (−1)| I | = (−1)|T | [S = T ] .
                                    I ⊆S;
                                    T⊆ I
  We are now ready to prove the Principle of Inclusion and Exclusion in all its
forms. We begin with Theorem 2.9.9:
Proof of Theorem 2.9.9. We shall use the Iverson bracket notation (see Definition
1.3.15).
  Here is the plan: We will approach the sum
sum ∑ (−1)| I | [s ∈ Ai for all i ∈ I ] for a single s ∈ U first. Then, we will sum it
     I ⊆[n]
over all s ∈ U, and obtain (206), because of Proposition 1.6.3 (b).
  Here are the details: Fix s ∈ U. Define a subset S of [n] by
S = {i ∈ [ n ] | s ∈ Ai } .
Thus, S is the set of all i ∈ [n] such that s ∈ Ai . Hence, S = ∅ holds if and only if
there exists no i ∈ [n] such that s ∈ Ai . Thus, we have the following chain of logical
equivalences:
[S = ∅] = [s ∈ U \ ( A1 ∪ A2 ∪ · · · ∪ An )] . (207)
  On the other hand, let I be any subset of [n]. Then, we have the following chain
of logical equivalences:
           (s ∈ Ai for each i ∈ I )
        ⇐⇒ (i ∈ S for each i ∈ I )
                                                                         
                     because for any given i ∈ I, the statement “s ∈ Ai ”
                       is equivalent to “i ∈ S” (by the definition of S)
        ⇐⇒ ( I ⊆ S) .
Now,
=    ∑       (−1)| I | [ I ⊆ S]
    I ⊆[n]
=                    ∑                    (−1)| I | [ I ⊆ S] +               ∑        (−1)| I |           [ I ⊆ S]
                    I ⊆[n];                                                 I ⊆[n];
                                                    | {z }                                                | {z }
                      I ⊆S                                   =1            not I ⊆S
                                                                                                             =0
                    | {z }                              (since I ⊆S)                              (since we don’t have I ⊆S)
                    =∑
                      I ⊆S
           (since S⊆[n],
    and thus any subset I of S
        is a subset of [n])
           (since each subset I of [n] satisfies either I ⊆ S or not I ⊆ S)
=   ∑ (−1)| I | + ∑                      (−1)| I | 0 =           ∑ (−1)| I | = [S = ∅]                     (by Proposition 2.9.10)
    I ⊆S                       I ⊆[n];                       I ⊆S
                              not I ⊆S
                              |          {z            }
                                         =0
= [s ∈ U \ ( A1 ∪ A2 ∪ · · · ∪ An )]                                                                                           (209)
(by (207)).
  Forget that we fixed s. We thus have proved (209) for each s ∈ U. Now, if I is
any subset of [n], then
                                  |{s ∈ U | s ∈ Ai for all i ∈ I }|
                                  = (# of s ∈ U that satisfy (s ∈ Ai for all i ∈ I ))
                                  =   ∑ [s ∈ Ai for all i ∈ I ]                                                                (210)
                                      s ∈U
(by Proposition 1.6.3 (b), applied to S = U and A (s) = (“s ∈ Ai for all i ∈ I”)).
Hence,
               |U \ ( A1 ∪ A2 ∪ · · · ∪ An )| =           ∑ [s ∈ U \ ( A1 ∪ A2 ∪ · · · ∪ An )] .
                                                          s ∈U
{s ∈ U | s ∈ Ai for all i ∈ I }
= {s ∈ U | s ∈ Ai for all i ∈ ∅}         (since I = ∅)
                                                                                 
                           since each s ∈ U satisfies (s ∈ Ai for all i ∈ ∅)
= {s ∈ U }
                    (indeed, this is vacuously true, since there exists no i ∈ ∅)
 = U,
                       Ai = {s ∈ U | s ∈ Ai for all i ∈ I }. Thus, Statement 1 is proved in
                T
we obtain
                i∈ I
Case 1.
  Let us next consider Case 2. In this case, we have I 6= ∅. Thus, the set I is
                                   T
nonempty. Hence, the definition of   Ai yields
                                                   i∈ I
                                  \
                                         Ai = { x | x ∈ Ai for each i ∈ I } .
                                  i∈ I
(here, we have renamed the index x as s). Thus, Statement 1 is proved in Case 2.
  We have now proved Statement 1 in both Cases 1 and 2. Hence, Statement 1 is
always proved.]
  Now, Theorem 2.9.9 yields
we obtain
                                                                         ∑       (−1)| I |
                                                                                              \
                          |U \ ( A1 ∪ A2 ∪ · · · ∪ An )| =                                           Ai .
                                                                        I ⊆[n]                i∈ I
             ∑       (−1)| I |
                                 \
        =                               Ai
            I ⊆[n]               i∈ I
        = (−1)|∅|                                   ∑         (−1)| I |
                             \                                                   \
                                    Ai +                                                 Ai
                             i ∈∅               I ⊆[n];               i∈ I
          | {z }                                              | {z }
                  =1         | {z }              I 6=∅ =−(−1)
                                                              | I |−1
            (since |∅|=0
                                 =U
               is even)
                 (here, we have split off the addend for I = ∅ from the sum)
                                                                             \
        =             U
                     |{z}               +       ∑         − (−1)| I |−1                        Ai
             = A1 ∪ A2 ∪···∪ An             I ⊆[n];                                 i∈ I
                                             I 6 =∅
                                            |                      {z                           }
                                                                        | I |−1 T
                                                =−             ∑ (−1)                   Ai
                                                          I ⊆[n];                i∈ I
                                                           I 6 =∅
                                                          ∑      (−1)| I |−1
                                                                                        \
        = | A1 ∪ A2 ∪ · · · ∪ A n | −                                                          Ai .
                                                       I ⊆[n];                          i∈ I
                                                        I 6 =∅
                                                                   ∑        (−1)| I |−1
                                                                                                    \
                      | A1 ∪ A2 ∪ · · · ∪ A n | −                                                          Ai = 0.
                                                                  I ⊆[n];                           i∈ I
                                                                   I 6 =∅
In other words,
                                                                        ∑        (−1)| I |−1
                                                                                                       \
                         | A1 ∪ A2 ∪ · · · ∪ A n | =                                                          Ai .
                                                                     I ⊆[n];                           i∈ I
                                                                      I 6 =∅
                                                ∑      (−1)| I |−1
                                                                          \
     | A1 ∪ A2 ∪ · · · ∪ A n | =                                                 Ai
                                             I ⊆[n];                      i∈ I
                                              I 6 =∅
                                                 n
                                        =       ∑   (−1)m−1                      ∑                    A i1 ∩ A i2 ∩ · · · ∩ A i m
                                             m =1                    (i1 ,i2 ,...,im )∈[n]m ;
                                                                        i1 <i2 <···<im
   We thus have proved all three forms of the Principle of Inclusion and Exclusion.
We notice that Theorem 2.9.6 also appears in [Smid09] (with a proof by induction),
in [Galvin17, Theorem 16.1] (with two proofs) and in [Grinbe15, Theorem 3.42] (in a
slightly more general form). Likewise, Theorem 2.9.7 also appears in [White10], in
[Galvin17, (12)] and in [Grinbe15, Theorem 3.43] (again, in a slightly more general
form). Several generalizations of the Principle can be found in [Grinbe15, Theorems
3.44, 3.45 and 3.46].
   The following exercise provides an analogue of Theorem 2.9.1 with the roles of
∪ and ∩ swapped:
   We shall now explore some applications of the Principle of Inclusion and Exclu-
sion.
This is a finite set. Thus, the elements f ∈ U are the maps f : [m] → [n]. For each
i ∈ {1, 2, . . . , n}, we define a subset Ai of U by
(This is the set of all maps f : [m] → [n] which never take i as a value.) Then,
A1 , A2 , . . . , An are n subsets of U. Let us check that they satisfy (211).
192 unless   you count the inductive proof in Exercise 2.4.4 as a such
Enumerative Combinatorics: class notes                                        page 274
Indeed, we have
(because a map f : [m] → [n] is surjective if and only if every i ∈ [n] is taken as a
value by f ). But from (213), we obtain
and thus
      U \ ( A1 ∪ A2 ∪ · · · ∪ A n )
      =           U
                 |{z}
           ={maps from [m] to [n]}
            ={maps f :[m]→[n]}
           \ {maps f : [m] → [n] | at least one i ∈ [n] satisfies i ∈
                                                                    / f ([m])}
      = {maps f : [m] → [n]}
           \ {maps f : [m] → [n] | at least one i ∈ [n] satisfies i ∈
                                                                    / f ([m])}
      = {maps f : [m] → [n] | every i ∈ [n] satisfies i ∈ f ([m])}
                                                          
                 since the negation of the statement
            “at least one i ∈ [n] satisfies i ∈
                                               / f ([m]) ” 
               is “every i ∈ [n] satisfies i ∈ f ([m]) ”
      = {maps f : [m] → [n] | every i ∈ [n] is taken as a value by f }
                                                                         
               since the statement “every i ∈ [n] satisfies i ∈ f ([m]) ”
             means the same as “every i ∈ [n] is taken as a value by f ”
      = {surjective maps from [m] to [n]}                                        (215)
                  |U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
                  = |{surjective maps from [m] to [n]}|
                  = (# of surjective maps from [m] to [n]) = sur (m, n)          (216)
(since sur (m, n) was defined as the # of surjective maps from [m] to [n]).
   In order to apply Theorem 2.9.9 successfully, we want to understand the sets
{s ∈ U | s ∈ Ai for all i ∈ I } (or at least their sizes). But this is easy: If I is a
subset of [n], then
                        {s ∈ U | s ∈ Ai for all i ∈ I }
                        = {maps f : [m] → [n] | f ([m]) ⊆ [n] \ I } .            (217)
Enumerative Combinatorics: class notes                                                   page 275
    {s ∈ U | s ∈ Ai for all i ∈ I }
    = {s ∈ U | s ∈ Ai for each i ∈ I }
    = { f ∈ U | f ∈ Ai for each i ∈ I }      (here, we have renamed the index s as f )
    = {maps f : [m] → [n] | f ∈ Ai for each i ∈ I }                                 (218)
          (since the elements f ∈ U are the maps f : [m] → [n]) .
But if f : [m] → [n] is any map, then we have the following chain of logical equivalences:
        ( f ∈ Ai for each i ∈ I )
        ⇐⇒ (i ∈ / f ([m]) for each i ∈ I )
              (because an i ∈ I satisfies f ∈ Ai if and only if i ∈
                                                                  / f ([m]) (by (213)))
        ⇐⇒ (none of the elements of I is contained in f ([m]))
        ⇐⇒ (the sets f ([m]) and I are disjoint)
        ⇐⇒ ( f ([m]) is disjoint from I )
        ⇐⇒ ( f ([m]) ⊆ [n] \ I )
(because f ([m]) is a subset of [n], and thus is disjoint from I if and only if f ([m]) ⊆ [n] \ I).
In light of this equivalence, we can rewrite (218) as
  Now, let us note that each subset I of [n] satisfies | I | ∈ {0, 1, . . . , n} (since Theo-
Enumerative Combinatorics: class notes                                                                   page 276
     |U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
     =    ∑     (−1)| I | |{s ∈ U | s ∈ Ai for all i ∈ I }|
         I ⊆[n]
                          |            {z                 }
                                            =(n−| I |)m
                                            (by (219))
                                               n
     =    ∑       (−1)| I | (n − | I |)m =      ∑ ∑            (−1)| I | (n − | I |)m
         I ⊆[n]                                 k =0   I ⊆[n];
                                                               |         {z         }
                                                       | I |=k    =(−1)k (n−k)m
                                                                   (since | I |=k)
                                                                                       
                           by an application of (37), since
                    each subset I of [n] satisfies | I | ∈ {0, 1, . . . , n}
          n
     =   ∑                        ∑     (−1)k (n − k)m
         k =0                 I ⊆[n];
                              | I |=k
                              |            {z              }
                =(# of subsets I of [n] satisfying | I |=k)·(−1)k (n−k)m
          n
     =   ∑ |(# of subsets I of         [n] satisfying | I | = k) · (−1)k (n − k)m
         k =0
                                        {z                   }
                                                         n
                      =(# of k-element subsets of [n])=
                                                         k
                        (by Theorem 1.3.12, applied to S=[n])
         n                        n                                                
            n                                                                         n
     = ∑       · (−1)k (n − k)m = ∑                              (−1) k
                                                                                                    (n − k )m
       k =0
            k                     k =0
                                                                 | {z }                k
                                                            =(−1)n−(n−k)           | {z } 
                                                         (since k=n−(n−k))              n
                                                                                 =
                                                                                     n−k
                                                                              (by Theorem 1.3.11)
          n                                         n         
                                       n                   n −i n m
     =   ∑ (−1)       n−(n−k)
                                      n−k
                                          (n − k) = ∑ (−1)
                                                 m
                                                                i
                                                                   i
         k =0                                       i =0
(here, we have substituted i for n − k in the sum). Comparing this with (216), we
obtain
                                         n          
                                               n −i n m
                         sur (m, n) = ∑ (−1)           i .
                                       i =0
                                                    i
This proves Theorem 2.4.17.
  We shall use the following notation (which is fairly widespread in abstract alge-
bra):
  Definition 2.9.13. Let X be any set. Then, the set of all permutations of X is
  denoted by SX .
  Thus, if X is a finite set, then
                              SX = {permutations of X }
and therefore
                       |SX | = (# of permutations of X ) = | X |!                 (220)
(by Theorem 1.7.2, applied to n = | X |), since X is an | X |-element set.
  In order to count the derangements of [n] for some n ∈ N, we can try to apply
Theorem 2.9.9 to
                                                n                       o
              U = S[ n ]     and          A i = σ ∈ S[ n ] | σ ( i ) = i .
This would shift our problem to the computation of |{s ∈ U | s ∈ Ai for all i ∈ I }|
for subsets I of [n]. The following proposition will help us do so:
  Proposition 2.9.14. Let X be a set. Let I be a subset of X. Then, there is a bijection
  Example 2.9.15. For this example, set X = [4] and I = {1, 3}. Then, Proposition
  2.9.14 claims that there is a bijection
                      n                                      o
               from σ ∈ S[4] | σ (i ) = i for each i ∈ {1, 3} to S{2,4}
  (since X \ I = [4] \ {1, 3} = {2, 4}). Let us check this: The permutations σ ∈ S[4]
  satisfying (σ (i ) = i for each i ∈ {1, 3}) are
                                                                
                       1 2 3 4                           1 2 3 4
                                            and
                       1 2 3 4                           1 4 3 2
  The following proof of Proposition 2.9.14 generalizes the bijection we have found
in this example:
Proof of Proposition 2.9.14 (sketched). Here is the rough idea of the proof: If a per-
mutation σ ∈ SX satisfies (σ (i ) = i for each i ∈ I ), then it has to map each element
of I to itself, and therefore must permute the remaining elements of X among
themselves (i.e., it must send any element of X \ I to an element of X \ I), since
it would otherwise fail to be injective. Thus, a permutation σ ∈ SX satisfying
(σ (i ) = i for each i ∈ I ) is “nothing but” a permutation of the set X \ I (since the
requirement (σ (i ) = i for each i ∈ I ) uniquely determines its values on the set I).
This is not rigorous, because strictly speaking a permutation of X cannot be a per-
mutation of X \ I (after all, the former has domain X while the latter only has
domain X \ I). Here is a rigorous version of the argument we just made:
   To each permutation σ ∈ SX satisfying (σ (i ) = i for each i ∈ I ), we can assign a
permutation e   σ of X \ I by letting
                           σ ( p) = σ ( p)
                           e                        for each p ∈ X \ I.
193   This defines a map
                      A : {σ ∈ SX | σ (i ) = i for each i ∈ I } → SX \ I ,
                                                                   σ 7→ e
                                                                        σ.
                      B : SX \ I → {σ ∈ SX | σ (i ) = i for each i ∈ I } ,
                              τ 7→ τb.
The maps A and B are well-defined and mutually inverse195 . Hence, they are
bijections. Thus, there is a bijection from the set {σ ∈ SX | σ (i ) = i for each i ∈ I }
to the set SX \ I (namely, A). This proves Proposition 2.9.14.
193 Why              σ well-defined, and why is it really a permutation of X \ I ? Try to answer these
         is this map e
     questions (and similar questions that we leave unanswered in this proof) on your own, or look
     up the answers in the solution to Exercise 2.9.3 below.
194 Once again: This should be proved! (Proving this is part of Exercise 2.9.3 below.)
195 Once again: This should be proved! (Proving this is part of Exercise 2.9.3 below.)
Enumerative Combinatorics: class notes                                           page 279
  Exercise 2.9.3. Fill in the missing details in the above (sketched) proof of Propo-
  sition 2.9.14.
Proof of Corollary 2.9.16. The set X is finite (since it is an n-element set). Hence, its
subset X \ I is finite as well. Moreover, I is a subset of X; thus, Theorem 1.4.7 (a)
(applied to A = X and B = I) yields
  [Proof of (222): Let σ be a permutation of [n]. Hence, σ ∈ S[n] (by the definition of
S[n] ). Hence, for any i ∈ [n], we have the equivalence (σ ∈ Ai ) ⇐⇒ (σ (i ) = i ) (by
(221)). Thus, we have the following equivalence:
   Forget that we fixed σ. We thus have proved the equivalence (224) for each
permutation σ of [n].
   Recall that a derangement of [n] is defined as a permutation of [n] that has no
fixed points. Hence,
          {derangements of [n]}
          = {permutations of [n] that have no fixed points}
          = {σ is a permutation of [n] | σ has no fixed points}
          = {σ is a permutation of [n] | σ ∈   / A1 ∪ A2 ∪ · · · ∪ A n }
                (by the equivalence (224))
            n                                       o
          = σ ∈ S[ n ] | σ ∈/ A1 ∪ A2 ∪ · · · ∪ A n
                                                                        
                  since the permutations of [n] are the elements of S[n]
          = S[ n ] \ ( A1 ∪ A2 ∪ · · · ∪ A n ) = U \ ( A1 ∪ A2 ∪ · · · ∪ A n ) .
            |{z}
              =U
                          |U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
                          = |{derangements of [n]}|
                          = (# of derangements of [n]) = Dn                              (225)
                       {s ∈ U | s ∈ Ai for all i ∈ I }
                          n                                  o
                       = σ ∈ S[n] | σ (i ) = i for each i ∈ I .                          (226)
Enumerative Combinatorics: class notes                                             page 281
                 {s ∈ U | s ∈ Ai for all i ∈ I }
                 = {s ∈ U | s ∈ Ai for each i ∈ I }
                 = {σ ∈ U | σ ∈ Ai for each i ∈ I }
                       (here, we have renamed the index s as σ)
                    n                                o                     
                 = σ ∈ S[n] | σ ∈ Ai for each i ∈ I          since U = S[n]
                    n                                   o
                 = σ ∈ S[n] | σ (i ) = i for each i ∈ I
196 by   (221)
Enumerative Combinatorics: class notes                                                     page 282
       |U \ ( A1 ∪ A2 ∪ · · · ∪ An )|
       =    ∑     (−1)| I | |{s ∈ U | s ∈ Ai for all i ∈ I }|
           I ⊆[n]
                            |            {z                 }
                                               =(n−| I |)!
                                               (by (227))
                                                 n
       =    ∑       (−1)| I | (n − | I |)! =      ∑ ∑         (−1)| I | (n − | I |)!
           I ⊆[n]                              k =0   I ⊆[n];
                                                              |         {z         }
                                                       | I |=k   =(−1)k (n−k)!
                                                                  (since | I |=k)
                                                                                      
                             by an application of (37), since
                      each subset I of [n] satisfies | I | ∈ {0, 1, . . . , n}
            n
       =   ∑                        ∑     (−1)k (n − k)!
           k =0                 I ⊆[n];
                                | I |=k
                                |            {z              }
                  =(# of subsets I of [n] satisfying | I |=k)·(−1)k (n−k)!
            n
       =   ∑ |(# of subsets I of          [n] satisfying | I | = k) · (−1)k (n − k)!
           k =0
                                           {z                   }
                                                            n
                         =(# of k-element subsets of [n])=
                                                            k
                          (by Theorem 1.3.12, applied to S=[n])
            n                                        n
                          n                                     n!
       =   ∑              k
                                   · (−1) (n − k)! = ∑
                                         k
                                                          k! · (n − k )!
                                                                         · (−1)k (n − k)!
           k =0        | {z }                        k =0 |               {z            }
                          n!                                                 n!
                  =                                                  =(−1)k
                    k! · (n − k )!                                           k!
                  (by Theorem 1.3.9)
            n
                           n!
       =   ∑ (−1)k k! .
           k =0
Exercise 2.9.4. Prove parts (a), (b) and (c) of Theorem 1.7.9.
   • The greatest common divisor of two positive integers a and b is defined to be the
     greatest positive integer that divides both a and b. It is denoted by gcd ( a, b).
     For example, gcd (4, 6) = 2 and gcd (3, 7) = 1 and gcd (10, 25) = 5.
   • Two positive integers a and b are said to be coprime (or relatively prime) if
     gcd ( a, b) = 1.
   • A positive integer a is said to be coprime to a positive integer b if gcd ( a, b) = 1
     (that is, if a and b are coprime).
(These definitions can be extended to arbitrary integers, if we set gcd (0, 0) = 0
(despite 0 not literally being the greatest common divisor of 0 and 0). But we will
only need them for positive integers.)
  We now define a function that has many uses in number theory (see, e.g., [19s,
§2.14]):
  Definition 2.9.17. The function φ : {1, 2, 3, . . .} → N (called Euler’s totient function
  or Euler’s φ-function) is defined by
  See [Tou17] for a history of this function (and an attempt at explaining its name).
  Example 2.9.18. (a) The definition of φ yields
  Among the elements 1, 2 of [2], only 1 is coprime to 2 (since gcd (1, 2) = 1 and
  gcd (2, 2) = 2). Thus, the # of all m ∈ [2] that are coprime to 2 is 1. Hence, (228)
  becomes
                                       φ (2) = 1.
    (b) The definition of φ yields
φ (4) = 2.
    (c) Likewise,
                                         φ (6) = 2,
  since the only elements among 1, 2, 3, 4, 5, 6 that are coprime to 6 are 1 and 5.
    (d) Likewise,
                                     φ (7) = 6,
Enumerative Combinatorics: class notes                                                         page 284
    n     1   2   3    4 5   6   7      8 9     10 11          12 13 14      15          ···
                                                                                                     .
  φ (n)   1   1   2    2 4   2   6      4 6         4     10   4   12    6   8           ···
                                            ∑           i = nφ (n) /2.
                                    i ∈{1,2,...,n};
                                 i is coprime to n
  We shall apply the Principle of Inclusion and Exclusion to proving the following
“explicit” formula for φ (u):
  Example 2.9.20. Let u = 18. What does Theorem 2.9.19 say in this case? The
  distinct primes that divide u are 2 and 3 (since u = 18 = 2 · 32 ). Hence, we can
  apply Theorem 2.9.19 to n = 2, p1 = 2 and p2 = 3. We thus obtain
                                  2                                         
                                               1                1            1
                      φ (u) = u · ∏         1−          = u· 1−           1−         .
                                 i =1
                                               pi               2            3
Enumerative Combinatorics: class notes                                                      page 285
This is easy to verify by actually counting all m ∈ [18] that are coprime to 18.
  There are many ways to prove Theorem 2.9.19; for example, one can be found
in [19s, §2.16.3]. We shall give a combinatorial proof that uses the Principle of
Inclusion and Exclusion as well as a few elementary lemmas. The first lemma is a
pair of simple identities:
(b) We have
                         ∑       (−1)| I | ∏ ai = (1 − a1 ) (1 − a2 ) · · · (1 − an ) .
                        I ⊆[n]              i∈ I
1 + a1 + a2 + a3 + a1 a2 + a1 a3 + a2 a3 + a1 a2 a3 = (1 + a1 ) (1 + a2 ) (1 + a3 ) .
    This is no surprise: The left hand side is what you obtain if you expand the right
    hand side.
  The remaining lemmas that we will need come from elementary number theory.
The first is a simple counting exercise:197
Lemma 2.9.23. Let u and v be two positive integers such that v divides u. Then,
Proof of Lemma 2.9.23 (sketched). The positive integers u and v have the property that
v divides u. Hence, u/v is a positive integer. Moreover, if m ∈ [u], then m ≤ u.
197 Inthe following, we will (mostly) avoid using the symbol “|” for the word “divides” (in the
    notation “a | b”). Instead, we will just write out the word “divides”. We will do this in order to
    avoid confusing expressions like “{m ∈ [u] | v | m}”, because the symbol “|” is already used in
    set-builder notation (e.g., in “{m ∈ [u] | v divides m}”).
Enumerative Combinatorics: class notes                                            page 286
Hence, if m ∈ [u] has the property that v divides m, then m/v is a positive integer
satisfying m/v ≤ u/v (since m ≤ u), and thus belongs to [u/v]. Hence, the map
                        A : {m ∈ [u] | v divides m} → [u/v] ,
                                                  m 7→ m/v
is well-defined. Consider this map A.
   On the other hand, if j ∈ [u/v], then jv is an element of [u] (because j ∈ [u/v]
yields 0 < j ≤ u/v and thus 0 < jv ≤ u) and has the property that v divides jv.
Hence, the map
                        B : [u/v] → {m ∈ [u] | v divides m} ,
                                j 7→ jv
is well-defined. Consider this map B.
   The maps A and B are mutually inverse (since A divides the input by v, whereas
B multiplies the input by v), and hence are bijections. Thus, the bijection principle
yields
                    |{m ∈ [u] | v divides m}| = |[u/v]| = u/v
(since u/v is a positive integer). Hence,
    (# of m ∈ [u] such that v divides m) = |{m ∈ [u] | v divides m}| = u/v.
This proves Lemma 2.9.23.
  The next lemma is a particular case of [19s, Exercise 2.10.3]:
  Lemma 2.9.26. Let I be a finite set. For each i ∈ I, let pi be a prime. Assume that
  all these primes pi (for different i ∈ I) are distinct. Let m be an integer. Then, we
  have the equivalence
                                                                        !
                 p j divides m for each j ∈ I ⇐⇒ ∏ pi divides m .
                                              
                                                                                  (230)
                                                         i∈ I
Enumerative Combinatorics: class notes                                            page 287
The next lemma stems easily from the definition of a greatest common divisor:
U = [u] .
Ai = {m ∈ U | pi divides m} . (231)
(m ∈ Ai ) ⇐⇒ ( pi divides m) (232)
                       (m ∈
                          / Ai ) ⇐⇒ ( pi does not divide m) .                         (233)
We claim that
               {m ∈ U | m is coprime to u}
               = {m ∈ U | ( pi does not divide m) for each i ∈ [n]} .                 (235)
Enumerative Combinatorics: class notes                                                page 288
  [Proof of (238): Let I be a subset of [n]. All the primes pi (for different i ∈ I) are
distinct (since p1 , p2 , . . . , pn are the distinct primes that divide u). Furthermore, p j
divides u for each j ∈ I (for the same reason). But Lemma 2.9.26 (applied to m = u)
shows that we have the equivalence
                                                                           !
                 p j divides u for each j ∈ I ⇐⇒ ∏ pi divides u .
                                                   
                                                         i∈ I
Hence, ∏ pi divides u (since p j divides u for each j ∈ I). Thus, Lemma 2.9.23
        i∈ I
(applied to v = ∏ pi ) yields that
                    i∈ I
                                                             !                        !
                   # of m ∈ [u] such that   ∏ pi divides m       = u/       ∏ pi          .
                                            i∈ I                            i∈ I
  Exercise 2.9.12. Let S be a finite set. Let X and Y be two distinct subsets of S.
  Prove that
                                ∑ (−1)|X∩ I |+|Y∩ I | = 0.
                                         I ⊆S
Class of 2019-11-04
2.10.1. Compositions
How many ways are there to write 5 as a sum of 3 positive integers, if the order
matters? In other words, how many 3-tuples ( x1 , x2 , x3 ) of positive integers satisfy
x1 + x2 + x3 = 5 ? The answer is that there are 6 such 3-tuples (i.e., there are 6 ways
to write 5 as a sum of 3 positive integers), namely
Indeed,
5 = 1 + 1 + 3 = 1 + 3 + 1 = 3 + 1 + 1 = 1 + 2 + 2 = 2 + 1 + 2 = 2 + 2 + 1.
   Theorem 2.10.1. Let P = {1, 2, 3, . . .} be the set of all positive integers. Let n ∈ N
   and k ∈ N. Then,
                                                                                    
              # of ( x1 , x2 , . . . , xk ) ∈ Pk satisfying x1 + x2 + · · · + xk = n
                 n−1
                        
            =                                                                          (239)
                 n−k
               
                n − 1 , if n > 0;
                           
               
            =       k−1                        .                                       (240)
               
                [ k = 0] ,          if n = 0
  Before we prove Theorem 2.10.1, let us introduce some terminology for the tuples
counted in it:
   Definition 2.10.2. (a) A composition shall mean a tuple (i.e., a finite list) of positive
   integers.
     (b) If k ∈ N, then a composition into k parts shall mean a k-tuple of positive
   integers.
     (c) If n ∈ N, then a composition of n shall mean a tuple of positive integers
   whose sum is n.
     (d) If n ∈ N and k ∈ N, then a composition of n into k parts shall mean a k-tuple
   of positive integers whose sum is n.
   The first of these is a composition into 1 part; the last is a composition into 3
   parts; the other two are compositions into 2 parts.
     (c) The only composition of 0 is the 0-tuple (); it is a composition into 0 parts.
by setting
     C (( a1 , a2 , . . . , ak )) = { a1 + a2 + · · · + ai | i ∈ [k − 1]}
                                  = { a 1 , a 1 + a 2 , a 1 + a 2 + a 3 , . . . , a 1 + a 2 + · · · + a k −1 }
                                          for all compositions ( a1 , a2 , . . . , ak ) of n into k parts.
D ( S ) = ( s 1 − s 0 , s 2 − s 1 , . . . , s k − s k −1 ) .
  Exercise 2.10.1. The purpose of this exercise is to supply some missing details
  for the above proof of Theorem 2.10.1.
    (a) Prove that any n ∈ N and k ∈ N satisfy
                                    
                                         n−1
                                               
                                
                           n−1
                                               , if n > 0;
                                 =       k−1                 .
                           n−k      
                                     [ k = 0] ,   if n = 0
  Remark 2.10.6. Tuples of nonnegative integers are called weak compositions. Thus,
  Theorem 2.10.5 can be considered as a formula for counting (certain) weak com-
  positions.
because
    2 = 0 + 0 + 2 = 0 + 2 + 0 = 2 + 0 + 0 = 0 + 1 + 1 = 1 + 0 + 1 = 1 + 1 + 0.
                                                                 2+3−1
                                                                        
                                                                          4
  Thus, their # is 6. This is exactly what (243) yields, since          =    = 6.
                                                                   2      2
Proof of Theorem 2.10.5. Let P denote the set {1, 2, 3, . . .} of all positive integers.
   If x is a nonnegative integer, then x + 1 is a positive integer. In other words,
if x ∈ N, then x + 1 ∈ P. Hence, if a k-tuple ( x1 , x2 , . . . , xk ) belongs to Nk and
satisfies x1 + x2 + · · · + xk = n, then the k-tuple ( x1 + 1, x2 + 1, . . . , xk + 1) belongs
to Pk and satisfies
( x1 + 1) + ( x2 + 1) + · · · + ( xk + 1) = ( x1 + x2 + · · · + xk ) + 1| + 1 +{z· · · + 1} = n + k.
                                            |         {z          }
                                                      =n                     k times
                                                                        |       {z        }
                                                                               =k
Enumerative Combinatorics: class notes                                                             page 297
In other words,
                                                                           
                                         k
      # of ( x1 , x2 , . . . , xk ) ∈ N satisfying x1 + x2 + · · · + xk = n
                                                                                 
     = # of ( x1 , x2 , . . . , xk ) ∈ Pk satisfying x1 + x2 + · · · + xk = n + k
         (n + k) − 1
                          
     =                                 (by (239), applied to n + k instead of n)
         (n + k) − k
         n+k−1
                      
     =                               (since (n + k) − 1 = n + k − 1 and (n + k) − k = n) .
              n
This proves (243).
  Continuing this computation, we obtain
                                                                                   
             # of ( x1 , x2 , . . . , xk ) ∈ Nk satisfying x1 + x2 + · · · + xk = n
                                       
                                            n+k−1
                                                     
                               
                n+k−1
                                                     , if k > 0;
           =                       =          k−1
                     n                 
                                        [ n = 0] ,      if k = 0
(by Theorem 1.3.11 and an easy distinction of cases204 ). This proves (244). Thus,
Theorem 2.10.5 is proven.
  The equality (243) also appears in [Grinbe15, Exercise 3.15] (with a proof by
induction).
204 See   Exercise 2.10.4 below for a detailed justification of the last equality sign.
Enumerative Combinatorics: class notes                                                           page 298
     [Hint: Use the Principle of Inclusion and Exclusion, keeping in mind that
   { 1, . . . , p − 1} = N \ {i ∈ N | i ≥ p}.]
    0,
  The next exercise is a simple-looking identity for binomial coefficients, which can
be nicely solved using weak compositions despite not explicitly involving them:
  Rather than count the compositions of an integer, we can also count them “with
weight” – i.e., sum certain values over them. Perhaps the simplest such value is the
length. Recall that the length of a tuple ( x1 , x2 , . . . , xk ) is defined to be the integer k.
In other words, the length of a tuple α is the k ∈ N such that α is a k-tuple. Thus,
each composition has a well-defined length (since it is a tuple).
   Exercise 2.10.9. Let n be a positive integer. Prove that the sum of the lengths of
   all compositions of n is (n + 1) 2n−2 .
2.11. Multisubsets
2.11.1. Definitions
The notion of a set is sufficiently versatile that it is often used as a foundation to
build all of mathematics upon. But as it is, it has its limitations; in particular, a set
cannot contain multiple copies of the same element. (More precisely, a set S can
either contain or not contain an element x; it makes no sense to ask “how often” it
contains x.) Often, one wants to use a kind of collection that can contain elements
with multiplicities205 . The notion of a multiset addresses this need (at least if the
205 For   example, the roots of a polynomial naturally come with multiplicities.
Enumerative Combinatorics: class notes                                                        page 300
multiplicities of the elements are nonnegative integers206 ). Rather than define this
notion, we shall however introduce a slight modification thereof, namely the notion
of a multisubset of a given set T:
   For example, if T = [8], then the map from [8] to N given in two-line notation as
                                                     
                                1 2 3 4 5 6 7 8
                                1 0 0 2 1 0 3 0
is a multisubset of [8], namely the multisubset {1, 4, 4, 5, 7, 7, 7}multi (that is, the
multisubset of [8] in which 1 appears 1 time, 4 appears 2 times, 5 appears 1 time,
and 7 appears 3 times). Of course, it can be written in many other ways, too
(for example, as {7, 5, 4, 7, 4, 1, 7}multi ). Note that {1, 1}multi 6= {1}multi , despite
{1, 1} = {1}.
   The requirement that “only finitely many t ∈ T satisfy f (t) 6= 0” in Definition
2.11.1 prevents us from having infinite multisubsets. Of course, if the set T is finite,
then this requirement is automatically satisfied.
   We note that many authors use the notation {{ a1 , a2 , . . . , ak }} instead of our
notation { a1 , a2 , . . . , ak }multi for a multisubset. However, the former notation can
be misunderstood to mean a set consisting of the set { a1 , a2 , . . . , ak }; thus we are
avoiding it.
   As we said, instead of defining multisubsets of a set T, we could have defined
multisets in general.207 We are preferring multisubsets of T here, as they are better
adapted to counting purposes.
                                                           n+k−1
                                                                  
                (# of multisubsets of T having size n) =             .
                                                             n
   In terms of their definition, these multisubsets are the maps from [3] to N with
   the two-line notations
                                                               
                   1 2 3                1 2 3                1 2 3
                              ,                    ,                  ,
                   2 0 0                1 1 0                1 0 1
                                                               
                   1 2 3                1 2 3                1 2 3
                              ,                    ,                  ,
                   0 2 0                0 1 1                0 0 2
X ∪ Y = { x1 , x2 , . . . , xk , y1 , y2 , . . . , y` }multi , (245)
of {1, 2, . . . , 10}.
   Remark 2.11.8. Definition 2.11.7 can be extended to the case when A and B are not
   disjoint. However, there are two non-equivalent ways to do so. In other words, there are
   two different reasonable notions of X ∪ Y when A and B are not disjoint.
      One of these two notions can be defined by the equality (245). Equivalently, it can be
   defined by regarding X and Y as maps f : A → N and g : B → N (as in Definition
   2.11.7), and defining X ∪ Y as the map h : A ∪ B → N given by
                         
                          f (u) ,
                                                 if u ∈ A \ B;
                  h (u) = g (u) ,                 if u ∈ B \ A;           for each u ∈ A ∪ B.
                         
                           f (u) + g (u) ,        if u ∈ A ∩ B
                         
   For example, this definition entails that the multiset union of the multisubset
   {1, 2, 2, 3}multi of [3] with the multisubset {2, 3, 3, 4}multi of [4] is the multisubset
   of [4].
      The second notion of X ∪ Y can be defined by regarding X and Y as maps f : A → N
   and g : B → N (as in Definition 2.11.7), and defining X ∪ Y as the map h0 : A ∪ B → N
   given by
                     
                      f (u) ,
                                                     if u ∈ A \ B;
               0
              h (u) = g (u) ,                         if u ∈ B \ A;            for each u ∈ A ∪ B
                     
                       max { f (u) , g (u)} ,         if u ∈ A ∩ B
                     
   (where max S denotes the largest element of any given set S ⊆ N). For example, this
   definition entails that the multiset union of the multisubset {1, 2, 2, 3}multi of [3] with the
   multisubset {2, 3, 3, 4}multi of [4] is the multisubset
   of [4].
      These two notions of X ∪ Y coincide when X and Y have no elements in common;
   otherwise, the first notion of X ∪ Y has larger size than the second. Note that the second
   notion (unlike the first) does not satisfy (245) in general.
  It is easy to check that if A and B are two disjoint sets, then any multisubset of
A ∪ B can be uniquely split up as a multiset union of a multisubset of A with a
multisubset of B, in the following sense:
  Let S be a lacunar subset of [2m] with exactly a even and b odd elements. Thus,
|S| = a + b, so that we can write S uniquely in the form S = {s1 < s2 < · · · < s a+b }
(by Proposition 1.4.13). Let us consider these s1 , s2 , . . . , s a+b . Then, since S is lacu-
nar, we have
                     s1 − 0 ≤ s2 − 2 ≤ s3 − 4 ≤ · · · ≤ s a + b − 2 ( a + b − 1)                          (247)
209 .   Moreover, all the a + b entries si − 2 (i − 1) (for i ∈ [ a + b]) of this chain of
                          s1 − 0 ≤ s2 − 2 ≤ s3 − 4 ≤ · · · ≤ s a + b − 2 ( a + b − 1) .
Enumerative Combinatorics: class notes                                                                 page 306
inequalities belong to the set [2g] 210 . Hence, we can define the multisubset211
of [2g]. This multisubset MS has exactly a even and b odd elements212 (since the
integers s1 − 0, s2 − 2, s3 − 4, . . . , s a+b − 2 ( a + b − 1) have the same parities213 as the
integers s1 , s2 , s3 , . . . , s a+b , respectively214 ). In other words, the multisubset MS has
exactly a elements from E and exactly b elements from O.
  Recall that MS is a multisubset of [2g] = E ∪ O. Hence, we can (using Lemma
2.11.9) uniquely split MS up as a multiset union MS,even ∪ MS,odd , where
MS,even is a multisubset of E
and
                                      MS,odd is a multisubset of O.
Moreover, the multisubset MS,even here has size a (since MS has exactly a elements
from E), and the multisubset MS,odd here has size b (since MS has exactly b elements
from O).
   Forget that we fixed S. Thus, for each lacunar subset S of [2m] with exactly a
even and b odd elements, we have constructed a size-a multisubset MS,even of E
and a size-b multisubset MS,odd of O. Hence, we can define a map
210 Proof. We must show that si − 2 (i − 1) ∈ [2g] for each i ∈ [ a + b]. So let us fix i ∈ [ a + b].
    Then, 1 ≤ i ≤ a + b. Hence, s1 − 0 ≤ si − 2 (i − 1) ≤ s a+b − 2 ( a + b − 1) (by (247)). Hence,
    si − 2 (i − 1) ≥ s1 − 0 = s1 ≥ 1 (since s1 ∈ {s1 < s2 < · · · < s a+b } = S ⊆ [2m]). Also, s a+b ≤ 2m
    (since s a+b ∈ {s1 < s2 < · · · < s a+b } = S ⊆ [2m]), and si − 2 (i − 1) ≤ s a+b −2 ( a + b − 1) ≤
                                                                                   |{z}
                                                                                          ≤2m
    2m − 2 ( a + b − 1) = 2 (m − a − b + 1) = 2g. Combining si − 2 (i − 1) ≥ 1 with si − 2 (i − 1) ≤
                            |     {z      }
                                      =g
     2g, we obtain si − 2 (i − 1) ∈ {1, 2, . . . , 2g} = [2g], qed.
211 We are using an analogue of the notation from Definition 1.4.12 for multisets here: If T is a set of
     ` have the same parity if and only if they are either both even or both odd.
214 because the former integers differ from the latter integers by a multiple of 2 (to wit: s − 2 (i − 1)
                                                                                                      i
     differs from si by 2 (i − 1)).
Enumerative Combinatorics: class notes                                                               page 307
This map is easily seen to be a bijection215 . Hence, the bijection principle yields
(See [18s-mt1s, solution to Exercise 3 (f)] for more details on how this is proved.)
215 The inverse map sends any pair ( X, Y ) ∈ {size-a multisubsets of E} × {size-b multisubsets of O}
    to the lacunar subset S of [2m] constructed as follows: Write the multiset union X ∪ Y in the
    form X ∪ Y = {t1 ≤ t2 ≤ · · · ≤ t a+b }multi (Proposition 2.11.6 guarantees that this can be done in
    a unique way), and define S by
      (a) We have
                                       k
                                           n − n 1 − n 2 − · · · − n i −1
                                                                       
              n
                                  =∏
      n1 , n2 , . . . , n k         i =1
                                                        ni
                                             n − n1      n − n1 − n2              n − n 1 − n 2 − · · · − n k −1
                                                                                                          
                                       n
                                  =                                         ···
                                       n1      n2               n3                             nk
                                                                                |              {z                }
                                                                                                =1
                                      k −1 
                                                 n − n 1 − n 2 − · · · − n i −1
                                                                              
                                  =   ∏                       ni
                                                                                .
                                      i =1
                                                         
                                          n
      (b) We have                                             ∈ N.
                                  n1 , n2 , . . . , n k
                                                          Class of 2019-11-06
Enumerative Combinatorics: class notes                                                             page 310
                                        { a ∈ [n]   | f ( a ) = 1} ,
                                        { a ∈ [n]   | f ( a ) = 2} ,
                                        { a ∈ [n]   | f ( a ) = 3} ,
                                        ...,
                                        { a ∈ [n]   | f ( a) = k} .
These k sets should be k disjoint subsets of [n] 217 , and their union must be
[n]     218 . If we want the map f to be relevant, then these k sets should have sizes
n1 , n2 , n3 , . . . , nk , respectively219 .
    Thus, the following algorithm can be used to construct any relevant map f :
[ n ] → [ k ]:
    • First, choose the set { a ∈ [n] | f ( a) = 1}. This must be a subset of [n] having
      size n1 . In other words,      must be an n1 -element subset of the n-element
                                this
                                 n
      set [n]. Thus, we have          choices for it.
                                 n1
    • Then, choose the set { a ∈ [n] | f ( a) = 2}. This must be a subset of [n] having
      size n2 and disjoint from the already chosen set { a ∈ [n] | f ( a) = 1}. In
      other words, this must be an n2 -element    subset of the (n − n1 )-element set
                                                     n − n1
      [n] \ { a ∈ [n] | f ( a) = 1}. Thus, we have            choices for it.
                                                       n2
    • Then, choose the set { a ∈ [n] | f ( a) = 3}. This must be a subset of [n] hav-
      ing size n3 and disjoint from the two already chosen sets { a ∈ [n] | f ( a) = 1}
      and { a ∈ [n] | f ( a) = 2}. In other words, this must be an n3 -element subset
217 Indeed, they must be disjoint, since any element a in the intersection of two of them would have
     two different values of f ( a) at the same time.
218 since each a ∈ [ n ] should have some value f ( a ) ∈ [ k ] assigned to it, and thus lie in one of these k
     sets
219 because the equality (248) says that |{ a ∈ [ n ] | f ( a ) = i }| = n for each i ∈ [ k ]
                                                                          i
Enumerative Combinatorics: class notes                                                 page 311
              until the last set { a ∈ [n] | f ( a) = k} has been chosen (for which
   • And so on,
              n − n 1 − n 2 − · · · − n k −1
     we have                                 choices).
                           nk
  The dependent product rule thus shows that the total # of relevant maps is
                   n − n1           n − n1 − n2         n − n 1 − n 2 − · · · − n k −1
                                                                                
           n
                                                  ···
           n1        n2                   n3                         nk
              k 
                    n − n 1 − n 2 − · · · − n i −1
                                                   
          =∏
            i =1
                                       ni
                                    
                       n
          =                                  (by Proposition 2.12.4 (a)) .
               n1 , n2 , . . . , n k
Thus, Proposition 2.12.5 is proved.
  Exercise 2.12.2. Give a formal proof of Proposition 2.12.5 (using induction in-
  stead of the dependent product rule).
  If A is any set and n ∈ N, then the maps from [n] to A are in bijection with the
n-tuples of elements of A (as we have seen, e.g., in the proof of Theorem 1.5.7).
Thus, any properties of the former can be restated in terms of the latter (and vice
versa). For example, we can restate Proposition 2.12.5 in terms of n-tuples:
This map Φ sends each relevant map f : [n] → [k ] to its list of values at the points220
1, 2, . . . , n. It is clear that this map Φ is a bijection221 . Thus, the bijection principle
yields
                            |{relevant maps}| = |{relevant n-tuples}| .
In other words,
  “Anagrams” are often called “permutations”, but the latter terminology risks
confusion with the notion of permutations defined in Definition 1.7.1.
220 I   am just using “point” as just a suggestive way of saying “element of [n]” here.
221 Indeed,      the definition of a “relevant map” requires the map to take the value i exactly ni many
        times (for each i ∈ [k]), whereas the definition of a “relevant n-tuple” requires the n-tuple to
        contain the entry i exactly ni many times (for each i ∈ [k]). It is clear that if we encode a map by
        its list of values, then the former requirement translates into the latter requirement.
Enumerative Combinatorics: class notes                                                       page 313
   Example 2.12.9. (a) The anagrams of the 3-tuple (1, 4, 6) are (1, 4, 6), (1, 6, 4),
   (4, 1, 6), (4, 6, 1), (6, 1, 4) and (6, 4, 1).
     (b) The anagrams of the 3-tuple (1, 4, 1) are (1, 4, 1), (4, 1, 1) and (1, 1, 4).
   (There are 6 ways to permute the 3 entries of (1, 4, 1), but they only produce
   3 different results.)
     (c) The only anagram of the 3-tuple (2, 2, 2) is (2, 2, 2) itself. (All 6 ways of
   permuting the 3 entries of (2, 2, 2) yield the same result.)
   Then, the # of distinct anagrams ofα (that is, n-tuples obtained from α by per-
                                   n
   muting its entries) is                        .
                           n1 , n2 , . . . , n k
   Example 2.12.11. How many anagrams does the word “anagram” have? (Here,
   we regard a word as a tuple of letters; it doesn’t have to make any sense in
   English. For example, “nagrama” is an anagram of “anagram”. And yes, a word
   counts as its own anagram.)
     Equivalently, how many anagrams does the word “aaagmnr” have? (This is an
   equivalent question, because the words “anagram” and “aaagmnr” are anagrams
   of one another, and thus have the same set of anagrams.)
     Equivalently, how many anagrams does the 7-tuple “(1, 1, 1, 2, 3, 4, 5)” have?
   (This is an equivalent question, because “(1, 1, 1, 2, 3, 4, 5)” is obtained from
   “aaagmnr” by replacing each letter by a number222 .)
     Proposition 2.12.10 (applied to n = 7, k = 5 and (n1 , n2 , . . . , nk ) = (3, 1, 1, 1, 1))
   says that the answer to the last question is
                               
                        7                     7!             7!
                                  =                        =    = 7 · 6 · 5 · 4 = 840.
                  3, 1, 1, 1, 1     3! · 1! · 1! · 1! · 1!   3!
  Once Exercise 2.12.4 is solved, we no longer have need for sorting. Instead, we
can apply Exercise 2.12.4 to X = [k], and thus conclude that if β ∈ [k]n is an n-tuple
that satisfies (252), then β is an anagram of α. So the second gap in the above proof
of Proposition 2.12.10 is filled again.
  Note that Exercise 2.12.4 is a weaker version of [19s, Lemma 2.13.20].
                                                                                        
                                                                         n                                                n!
(since the multinomial coefficient                                                           is defined to be                          ).
                                                                 n1 , n2 , . . . , n k                             n1 !n2 ! · · · nk !
   This proves Proposition 2.12.14.
Proof. LTTR.
  Just as we tabulated the binomial    coefficients         in Pascal’s triangle, we can tab-
                                                n
ulate the multinomial coefficients                              for a given value of k in a k-
                                        n1 , n2 , . . . , n k
dimensional pyramid-like table, called “Pascal’s pyramid” (see [Uecker17, p. 20,
Figure 10] fora picture). Theorem 2.12.15 shows that each entry in this table (ex-
                     0
cept for the                   = 1 at its apex) is the sum of its k upper neighbors
               0, 0, . . . , 0
(generalizing the analogous property of Pascal’s triangle).
  The following theorem generalizes the binomial formula (because of Proposition
2.12.13):
Proof. LTTR. There are many ways to prove this: Either do it combinatorially using
Proposition 2.12.5 (see [Galvin17, Theorem 11.7] for this proof); or use induction
on n; or use induction on k (see [Grinbe15, Exercise 6.2] for this proof223 ).
of these (such as tuples of subsets). While these problems were often interconnected
(in particular, many of them were solved using the same methods, and bijections let
us translate between differently looking objects), the problems themselves followed
no system other than “what else can we count using the methods seen so far?”.
Historically, this has led to combinatorics being regarded more as a hodgepodge of
problems and tricks rather than as a systematic theory.
   To some extent, this is still the case, and it is not just an artifact of viewpoint;
combinatorics really is a broad field with much less of a clear direction than many
other mathematical subjects.224 Nevertheless, there is more structure in combina-
torics than meets the eye, and there have been several successful attempts to classify
and organize the most common enumerative problems in a coherent theory. One
of the most successful attempts of this kind is the twelvefold way, introduced in
the 1960s by Gian-Carlo Rota under the name of “theory of distribution and occu-
pancy” (or, less grandiloquently, “placing balls in boxes”) and since popularized as
the “twelvefold way”.
   Convention 3.1.1. For the rest of Chapter 3, we fix two finite sets A and X. We
   shall refer to the elements of A as balls, and we shall refer to the elements of X
   as boxes. (The letters A and X have been chosen because “a” appears in “ball”
   while “x” appears in “box”. I cannot use “B” for both sets...)
  A placement shall mean a way to distribute all the balls a ∈ A into the boxes
x ∈ X. Rigorously, we can think of a placement as a map from A to X. More
precisely, this is what we will call an “L → L placement”; other kinds of placements
will be defined below.
  How many L → L placements are there? Of course, there are | X || A| many (by
Theorem 2.4.1). But let us look at them more closely.
    We will draw such placements as follows: We will always draw the boxes in
  increasing order:
                                                   |        {z         }    |        {z        }
                                                           box 1                 box 2
  We draw each ball as a pair of parentheses with a number inside – so, for exam-
  ple, the ball 3 will be drawn as “(3)”.
    So the L → L placements of the balls 1, 2, 3 ∈ A in the boxes 1, 2 ∈ X are
  As we said, counting these L → L placements was easy. But we can consider the
following variations of the problem:
   • What if we require our maps f : A → X to be injective (i.e., each box contains
     ≤ 1 ball) or surjective (i.e., each box contains ≥ 1 ball)?
   • What if the balls are unlabelled (i.e., indistinguishable)?
     For example, the two L → L placements
       were counted as different, because the former has ball 1 in box 1 whereas
       the latter has ball 1 in box 2. But if the balls are indistinguishable, then this
       difference disappears, and these placements become identical, thus reducing
       the count.
       Intuitively, it may be clear what “indistinguishable” means, but it is a bit
       tricky to make this mathematically rigorous. After all, if we define place-
       ments as maps, then we cannot just pretend that two different maps are equal
       because we “chose to think of the balls as indistinguishable”. (There is no
       notion of a “set with indistinguishable elements” in mathematics.225 )
       We will make this rigorous using the notion of equivalence classes (which we
       will introduce in Section 3.3). These are sets of mutually equivalent objects
       (in our case, maps f : A → X), where the word “equivalent” is understood
       with respect to a specific relation. Equivalent objects will contribute to the
       same equivalence class; thus, if we want to “count objects up to equivalence”,
       all we will have to do is counting their equivalence classes. This is a valid
       and (once you have gotten used to it) fairly convenient rigorous alternative to
       “pretending” that equivalent objects are “the same”.
       Here is how this general idea will be applied to our question about indistin-
       guishable balls: We will say that two maps f , g : A → X are “ball-equivalent”
       if there is a permutation τ of the balls (i.e., formally: a permutation τ of the
       set A) that transforms one into the other (i.e., that satisfies f = g ◦ τ). Then,
       “U → L placements” (i.e., placements of unlabelled balls in labelled boxes)
       will be defined as the equivalence classes of ball-equivalence.
       For example, the two L → L placements
225 Actually,
            there is: the notion of a multiset, as defined in Section 2.11. However, it would only help
    us if we defined maps between multisets (as well as maps between multisets and sets), which
    we are not going to do (as it comes with its own difficulties).
Enumerative Combinatorics: class notes                                                     page 321
(1)(3) (2) .
   • What if both the boxes and the balls are indistinguishable? This kind of place-
     ments will be called “U → U placements”. We shall draw them in the same
     way as we draw L → L placements, but representing balls by “•” symbols
     and without marking the boxes.
                        L→L          | X || A|
                        U→L
                        L→U
                        U→U
Here:
Enumerative Combinatorics: class notes                                                                             page 322
  Example 3.1.3. Let X = [2] and A = [3]. Then, let us count how many placements
  of each kind we have:
                                           arbitrary injective surjective
                            L→L                   8                   0                   6
                         U→L                      4                   0                   2
                         L→U                      4                   0                   3
                         U→U                      2                   0                   1
    In fact:
     • The U → L placements are
                      •••                                         ,                 ••                  •           ,
                 |     {z }           |     {z        }                       |     {z }           |    {z     }
                      box 1                box 2                                   box 1               box 2
                       •                   ••             ,                                            •••          .
                 |     {z     }   |        {z }                           |        {z      }   |        {z }
                      box 1               box 2                                   box 1                box 2
                      •••                                         ,                 ••                  •          .
Enumerative Combinatorics: class notes                                        page 323
  In general, not every of the 12 questions in the table above has a closed-form
answer. But each has, at least, a good recursive answer, and there is much to be
learned from attempting to answer all the questions. We shall thus strive to fill in
the whole “twelvefold way” table, row by row.
3.2. L → L
We begin with the first row of the twelvefold way: the counting of L → L place-
ments. Let us repeat how we defined them above:
                         (# of L → L placements A → X )
                         = (# of maps from A to X ) = | X || A| .
Proof. The first equality sign follows from Definition 3.2.1. The second equality
sign follows from Theorem 2.4.1 (applied to m = | A|, n = | X | and B = X).
                    (# of injective L → L placements A → X )
                    = (# of injective maps from A to X ) = | X || A| .
Proof. The first equality sign follows from Definition 3.2.1. The second equality
sign follows from Theorem 2.4.4 (applied to m = | A|, n = | X | and B = X).
               (# of surjective L → L placements A → X )
               = (# of surjective maps from A to X ) = sur (| A| , | X |) .
Proof. The first equality sign follows from Definition 3.2.1. The second equality
sign follows from Theorem 2.4.11 (applied to m = | A|, n = | X | and B = X).
  Example 3.2.5. Here are some typical counting problems that boil down to count-
  ing L → L placements:
Enumerative Combinatorics: class notes                                                     page 324
     • How many ways are there to assign grades (from a finite set X) to students
       (from a finite set A) ? These assignments are arbitrary L → L placements.
     • How many ways are there to assign IP addresses to a given set of com-
       puters? These assignments are injective L → L placements, since IP
       addresses should be distinct and come from a well-specified set (say,
       {32-bit numbers} for IPv4 addresses).
     • How many 8-digit telephone numbers are there with no 2 equal digits?
        Of course, these telephone numbers are precisely the injective 8-tuples
        (i1 , i2 , . . . , i8 ) ∈ {0, 1, . . . , 9}8inj (see Definition 2.7.1 for the meaning of these
        words), and thus Proposition 2.7.2 shows that there are 108 many of them.
        Alternatively, let us restate this counting problem in terms of L → L place-
        ments: The 8-digit telephone numbers with no 2 equal digits correspond to
        injective L → L placements with A = [8] and X = {0, 1, . . . , 9}; for exam-
        ple, the telephone number 20354986 corresponds to the L → L placement
Class of 2019-11-08
3.3.1. Relations
I will follow [19s, Chapter 3] in this subsection.
{( x, y) ∈ S × S | x R y} .
         {( a, b) ∈ S × S | a = b}
         = {(c, c) | c ∈ S} = {. . . , (−2, −2) , (−1, −1) , (0, 0) , (1, 1) , (2, 2) , . . .} .
                                       a−b
                                               
          a ≡ b ⇐⇒ (1 | a − b) ⇐⇒           ∈ Z ⇐⇒ ( a − b ∈ Z) ⇐⇒ (true) .
            1                            1
  Thus, the relation ≡ always holds (i.e., we have a ≡ b for all ( a, b) ∈ S × S).
                           1                                        1
  Thus, it equals the whole set S × S (when considered as a subset of S × S).
Enumerative Combinatorics: class notes                                           page 326
( a N b) ⇐⇒ (false) .
( a A b) ⇐⇒ (true) .
  There are other examples on other sets. For example, “parallel” is a relation
between lines in plane geometry.
  Example 3.3.10. The relation “directly similar” (= similar with the same orienta-
  tion) on {triangles in the plane} is an equivalence relation.
  Example 3.3.11. The relation “indirectly similar” (= similar with opposite ori-
  entation) on {triangles in the plane} is not an equivalence relation, because it is
  not reflexive.
  Example 3.3.13. Let S be {all points on the landmass of the Earth}, and define a
  relation ∼ by
  Define a relation ∼ on S by
                      ∗
                                                        
                              ( a1 , a2 ) ∼ (b1 , b2 )       ⇐⇒ ( a1 b2 = a2 b1 ) .
                                         ∗
[ a]∼ = {b ∈ S | b ∼ a} .
  This subset [ a]∼ is called the equivalence class of a (for the relation ∼), or the
  ∼-equivalence class of a.
    (b) The equivalence classes of ∼ are defined to be the sets [ a]∼ for a ∈ S. They
  are also known as the ∼-equivalence classes.
  and
                                                      
                [3] ≡ =             b∈Z | b≡3              = {b ∈ Z | b ≡ 3 mod 3}
                        3                      3
                            = {3 + 3k | k ∈ Z} = {. . . , −6, −3, 0, 3, 6, 9, . . .}
  and
                                              
              [2] ≡ =           b∈Z | b≡2              = {b ∈ Z | b ≡ 2 mod 3}
                    3                     3
                        = {2 + 3k | k ∈ Z} = {. . . , −4, −1, 2, 5, 8, 11, 14, . . .} .
Let us state some basic properties of equivalence classes. For their proofs, see [19s,
§3.3.2] or any sufficiently thorough introduction to proofs.
[ a]∼ = {b ∈ S | a ∼ b} .
  Then, ∼ is an equivalence relation, and its equivalence classes are the rational
         ∗
  numbers. This is how the rational numbers are rigorously defined! So the re-
  lation ∼ tells us which pairs of integers give the same rational number. The
         ∗
                                                a
  equivalence class [( a1 , a2 )]∼ is denoted by 1 .
                                 ∗              a2
  Example 3.3.21. Let S be {all points on the landmass of the Earth}, and consider
  the relation ∼ defined by
  Example 3.3.23. Let n ∈ Z. The equivalence classes of the relation ≡ are called
                                                                                n
  “integers modulo n”, and their set is denoted by Z/nZ or Zn or Z/n or Zn or
  Cn (depending on author and context). In particular, the sets Z/12Z and Z/24Z
  have well-known meanings: they stand for the hours on a clock (a 12-hour clock
  or a 24-hour clock, respectively). For example, when you say “3 hours after 11 is
  2”, you are really saying that 11 + 3 ≡ 2 mod 12 or, equivalently, [11]≡ + [3]≡ =
                                                                                 12       12
  [2]≡ for an appropriate definition of addition of equivalence classes.
     12
                                                  box
     • f is box-equivalent to g (written f ∼ g) if and only if there is a permuta-
       tion σ of X such that f = σ ◦ g (in other words, f can be obtained from g
       by permuting boxes).
                                                  ball
     • f is ball-equivalent to g (written f ∼ g) if and only if there is a permuta-
       tion τ of A such that f = g ◦ τ (in other words, f can be obtained from g
       by permuting balls).
                                                         box
     • f is box-ball-equivalent to g (written f ∼ g) if and only if there is a
                                                         ball
          permutation σ of X and a permutation τ of A such that f = σ ◦ g ◦ τ.
  are box-equivalent to one another (since they can be obtained from one another
  by swapping the two boxes), but they are not ball-equivalent to one another
Enumerative Combinatorics: class notes                                                     page 331
  (since a permutation of balls cannot change the fact that the first placement has
  1 ball in the first box, whereas the second placement has 2).
     (b) The two L → L placements
  are ball-equivalent to one another (since they can be obtained from one another
  by swapping the balls 1 and 2), but they are not box-equivalent to one another
  (since a permutation of boxes cannot change the fact that balls 2 and 3 are to-
  gether in a single box in the first placement, but not in the second).
     (c) The two L → L placements
  are box-ball-equivalent to one another (since they can be obtained from one an-
  other by swapping the two boxes and swapping balls 1 and 2). But they are
  neither box-equivalent nor ball-equivalent.
    (d) The two L → L placements
                                                       box
     • L → U placements to be the ∼ -equivalence classes.
                                                         box
     • U → U placements to be the ∼ -equivalence classes.
                                                         ball
  Example 3.3.28. Consider again our running example, with X = [2] and A = [3].
  Let g be the L → L placement
                                                  (1)                    (2)(3) .
                                           |      {z         }       |    {z }
                                                 box 1                   box 2
            box
    (a) The ∼ -equivalence class of g is
                                                                                                                               
         
                                                                                                                               
                                                                                                                                
                                                                                                                               
                 (1)         (2)(3)      ,                                       (2)(3)                       (1)                   .
                                                                                                                               
          | {z } | {z }
                                                                        |        {z }            |           {z        }       
                                                                                                                                
                      box 1                box 2                                 box 1                    box 2
             ball
    (b) The ∼ -equivalence class of g is
          
          
          
          
                  (1)         (2)(3)                             ,                   (2)                      (1)(3)            ,
          
              |  {z    }  |    {z }                                         |       {z       }       |        {z }
          
                         box 1                 box 2                                 box 1                    box 2
                                                                         
                                                                         
                                                                         
                                                                         
                                  (3)                  (1)(2)                    .
                            |     {z      }      |      {z }             
                                                                         
                                                                         
                                 box 1                 box 2
            box
    (c) The ∼ -equivalence class of g is
            ball
       
       
       
       
                 (1)(2)     (3)        ,                                 (1)(3)                       (2)                   ,
       
           |     {z    } |  {z   }                                  |    {z }                |       {z            }
       
                    box 1                box 2                           box 1                        box 2
3.4. U → L
                                         ball
Recall: The U → L placements are the ∼ -equivalence classes.
Enumerative Combinatorics: class notes                                                                                                     page 334
  Example 3.4.1. For X = [2] and A = [3], there are 4 different U → L placements:
                                        
        
                                        
                                         
                                        
                (1)(2)(3)                   ,
        
              |   {z    } |   {z   }    
                                         
                                        
                      box 1                     box 2
           
           
           
           
                      (1)(2)                    (3)               ,                (1)(3)                          (2)                 ,
           
               |      {z }             |       {z          }                 |     {z }                     |     {z          }
           
                      box 1                     box 2                                  box 1                       box 2
                                                                              
                                                                              
                                                                              
                                                                              
                              (2)(3)                        (1)                    ,
                         |     {z }              |          {z    }           
                                                                              
                                                                              
                              box 1                     box 2
           
           
           
           
                        (1)                     (2)(3)            ,                    (2)                        (1)(3)               ,
           
               |       {z        }     |        {z }                         |        {z        }           |     {z }
           
                      box 1                     box 2                                  box 1                       box 2
                                                                              
                                                                              
                                                                              
                                                                              
                              (3)                       (1)(2)                     ,
                         |    {z            }    |       {z }                 
                                                                              
                                                                              
                              box 1                     box 2
                                                                 
           
                                                                 
                                                                  
                                                                 
                                         (1)(2)(3)                    .
           
               |       {z        }     | {z }                    
                                                                  
                                                                 
                      box 1                     box 2
                •••                                         ,                          ••                         •                ,
            |    {z }             |     {z        }                           |        {z }              |        {z       }
                box 1                  box 2                                       box 1                         box 2
                 •                     ••               ,                                                    •••                   .
            |    {z      }    |        {z }                               |        {z        }       |        {z }
                box 1                 box 2                                       box 1                      box 2
Enumerative Combinatorics: class notes                                                              page 335
         (# of U → L placements A → X )
                                                                                   
                                           |X|
         = # of x1 , x2 , . . . , x|X | ∈ N satisfying x1 + x2 + · · · + x|X | = | A|
              | A| + | X | − 1
                              
         =                       .
                    | A|
where
                                  f −1 ( x ) : = { a ∈ A | f ( a ) = x } .
To see that this is a bijection, we need to show that if f , g : A → X are two maps
such that
                        f −1 ( x ) = g −1 ( x )   for all x ∈ X,
         ball
then f ∼ g.)
  Thus, the bijection principle yields
       (# of U → L placements A → X )
                                                                                
                                         |X|
       = # of x1 , x2 , . . . , x|X | ∈ N satisfying x1 + x2 + · · · + x|X | = | A| .
       (# of surjective U → L placements A → X )
                                                                                 
                                         |X|
       = # of x1 , x2 , . . . , x|X | ∈ P satisfying x1 + x2 + · · · + x|X | = | A|
              | A| − 1
                        
       =                   .
            | A| − | X |
Proof. The first equality sign is proved similarly to the first equality sign in Propo-
sition 3.4.2.
   The second equality sign follows from (239).
  Recall: An L → L placement is injective if and only if each box has at most one
ball in it.
                                                                              ball
  We define injectivity of U → L placements in the same way. Thus, a ∼ -
equivalence class is an injective U → L placement if and only if all its elements
are injective maps.
     (# of injective U → L placements A → X )
                                                                                        
                                             |X|
     = # of x1 , x2 , . . . , x|X | ∈ {0, 1}     satisfying x1 + x2 + · · · + x|X | = | A|
         
          |X|
     =         .
          | A|
Proof. The first equality sign is proved similarly to the first equality sign in Propo-
sition 3.4.2.
   The second equality sign follows from Theorem 2.10.4.
  Thus, our “twelvefold way” table now looks as follows:
3.5. L → U
                                             box
Recall: The L → U placements are the ∼ -equivalence classes. They are placements
of labelled balls in unlabelled boxes.
  Example 3.5.1. For X = [2] and A = [3], there are 4 different L → U placements:
                                                                       
       
                                                                       
                                                                        
                                                                       
              (1)(2)(3)                ,                    (1)(2)(3)     ,
                                            | {z } | {z } 
        | {z } | {z }
                                                                       
                                                                        
                    box 1        box 2                     box 1           box 2
                                                                                   
          
                                                                                   
                                                                                    
                                                                                   
                    (1)(2)       (3)               ,       (3)             (1)(2)       ,
          
               |    {z }    |   {z      }             |   {z      }   |    {z }    
                                                                                    
                                                                                   
                    box 1        box 2                     box 1           box 2
                                                                                   
          
                                                                                   
                                                                                    
                                                                                   
                    (1)(3)       (2)               ,       (2)             (1)(3)       ,
          
               |    {z }    |   {z      }             |   {z      }   |    {z }    
                                                                                    
                                                                                   
                    box 1        box 2                     box 1           box 2
                                                                                   
          
                                                                                   
                                                                                    
                                                                                   
                    (2)(3)       (1)               ,       (1)             (2)(3)       .
          
               |    {z }    |   {z      }             |   {z      }   |    {z }    
                                                                                    
                                                                                   
                    box 1        box 2                     box 1           box 2
(# of injective L → U placements A → X ) = [| A| ≤ | X |] .
Proof. If | A| > | X |, then the Pigeonhole Principle shows that no such placements
exist, and thus (# of injective L → U placements) = 0.
   Now assume that | A| ≤ | X |. WLOG assume that X = [| X |], so that the boxes are
labelled 1, 2, . . . , | X |. Thus, injective L → U placements do exist: for example, we
can place each ball i into box i (thus leaving the last | X | − | A| many boxes empty).
Furthermore, any two injective L → U placements are identical. (Indeed, any such
placement consists of one box with ball 1, one box with ball 2, one box with ball
3, and so on, totalling to | A| many boxes filled with 1 ball each, and furthermore
| X | − | A| many empty boxes. It is clear that this uniquely describes it as an L → U
placement, because any two L → L placements of this form can be turned into one
Enumerative Combinatorics: class notes                                                                        page 338
     box
      ∼              (1)                   (2)             (3)                                                   .
                 |   {z       }     |      {z    }     |   {z      }   |    {z        }   |       {z      }
                     box 1              box 2              box 3           box 4                 box 5
Thus, any two injective L → U placements are identical.) Hence, the total # of
injective L → U placements is 1. But this is precisely [| A| ≤ | X |], since | A| ≤
| X |.
                                      
                                      n
   Recall: If n ∈ N and k ∈ N, then        := sur (n, k ) /k! is called a Stirling
                                       k
number of the second kind.
  Proposition 3.5.3. We have
                                                                                     
                                                                               | A|           sur (| A| , | X |)
          (# of surjective L → U placements A → X ) =                                     =                      .
                                                                               |X|                 | X |!
Class of 2019-11-13
Proof. We can prove a better claim: For each k ∈ {0, 1, . . . , | X |}, we have
                                                                            
                                                                             | A|
        (# of L → U placements with exactly k nonempty boxes) =                   .
                                                                               k
(This is not hard to see, because in an L → U placement, we can WLOG assume
that all empty boxes are at the end, and thus we can simply ignore the empty
boxes.)
   Adding these equalities up for all k ∈ {0, 1, . . . , | X |}, we obtain precisely the
claim of Proposition 3.5.4. (Details LTTR.)
  Thus, our table now looks as follows:
Example 3.5.6. Here are all set partitions of the set [3] = {1, 2, 3}:
  And here are the same set partitions, drawn as pictures (each part of the set
  partition corresponds to a blob):
            3                                    3                  3
                             3                                                       3
      1         2                            1         2        1       2
                        1        2                                               1        2
                 Let n ∈ N and k ∈ N.
  Proposition 3.5.8.
                  n
    (a) We have      = [ n = 0].
                0 
                  0
    (b) We have      = [ k = 0].
                 k
                  n
    (c) We have      = 0 if k > n.
                k  
                          n−1            n−1
                                              
                  n
    (d) We have      =            +k              if n > 0 and k > 0.
                   k      k − 1             k
                       n −1 n
                                    
                  n                   j
    (e) We have      = ∑                    /k if k > 0.
                  k    j =0   j    k−1
                                       
                  n    1 k         k −i k n
    (f) We have      =     ∑ (−1)             i .
                  k    k! i=0             i
  Remark 3.5.9. Let n ∈ N. The n-th Bell number B (n) is defined as the # of all
  set partitions of [n]. Thus, Proposition 3.5.3 yields
                                                     
                                    n        n           n
                           B (n) =       +       +···+      .
                                    0        1           n
    See [Guicha20, Theorem 1.4.3] for a proof of this recurrence relation, and
  [18s-hw3s, §0.3.2] for more about the Bell numbers.
        •••                   •          ••                   ••                  ,
Enumerative Combinatorics: class notes                                                   page 342
with the understanding that the boxes, too, are interchangeable. Thus, we can
order the boxes by decreasing number of balls:
••• •• •• • .
You can encode this U → U placement by a sequence of numbers, which say how
many balls lie in each box:
                              (3, 2, 2, 1, 0, 0, 0) .
The decreasing order makes this sequence unique.
  Let us introduce a name for such sequences, more precisely, for such sequences
that don’t contain zeroes:
Proof. (a) A sum of positive integers is never negative. Thus, there exist no parti-
tions of n when n < 0.
   (b) If ( a1 , a2 , . . . , ak ) is a partition of n into k parts, then
                  n = a1 + a2 + · · · + ak ≥ 1| + 1 +{z· · · + 1} = k.
                     |{z} |{z}         |{z}
                        ≥1       ≥1            ≥1          k times
  Any red partition of n must end with a 1 (since it contains a 1 but is weakly
decreasing). Thus, the map
(where d x e denotes the ceiling of the real number x). So there are bn/2c many of
them.
This is a bijection.
(# of injective U → U placements A → X ) = [| A| ≤ | X |] .
  By the way, what happens if we add an extra column for “bijective”? Here is this
column:
                                      bijective
                                L→L          [| A| = | X |] · | X |!
                                U→L             [| A| = | X |]            .
                                L→U             [| A| = | X |]
                               U→U              [| A| = | X |]
(See [17f-hw1s, Exercise 7] for the proofs.) So that’s not a very interesting column.
Class of 2019-11-15
p ( n ) = p0 ( n ) + p1 ( n ) + · · · + p n ( n ) for each n ∈ Z
(b) Let
(b) We have
Proof. Here is a rough outline. See [Andrew16] or [Galvin17, Proposition 18.1] for
a more detailed version (albeit with a slightly different version of the bijection).
  We construct a map
which transforms a partition as follows: Repeatedly merge two equal parts until no
more equal parts can be found. “Merging two equal parts” means replacing two
equal parts a, a by the single part 2a, and (if necessarily) rearranging the resulting
tuple back into weakly decreasing order.
  (Examples: Let us compute A (5, 5, 3, 1, 1, 1):
                                                      
                      5, 5, 3, 1, 1, 1 → 10, 3, 1, 1, 1 → (10, 3, 2, 1)
(where we underline equal entries that are about to get merged). Thus, A (5, 5, 3, 1, 1, 1) =
(10, 3, 2, 1).
  Let us compute A (5, 3, 1, 1, 1, 1):
                                                          
               5, 3, 1, 1, 1, 1 → 5, 3, 2, 1, 1 → 5, 3, 2, 2 → (5, 4, 3) .
Proof. Picture proof: e.g., let n = 14 and k = 4. Start with the partition λ =
(5, 4, 4, 1) of n into k parts. Draw a table of k left-aligned rows, where the length of
each row equals the corresponding part of λ:
                             5→
                             4→
                                                          .
                             4→
                             1→
  Now, flip the table across the main diagonal (i.e., the diagonal going from the
top-left to the bottom-right), so that the rows become columns and vice versa:
                                    5    4   4   1
                                    ↓    ↓   ↓   ↓
   The lengths of the rows of the resulting table again form a partition of n. The
largest part of this new partition is k (because our original table had k rows, so the
flipped table has k columns). In our example, this new partition is (4, 3, 3, 3, 1).
   Thus, we obtain a map
     {partitions of n into k parts} → {partitions of n whose largest part is k} ,
which transforms a partition by flipping its table.
   This map is a bijection; indeed, its inverse map is defined in the same way. This
bijection is called conjugation of partitions. The bijection principle now yields the
proposition.
   (Note: The table that we constructed above is called the Young diagram of λ, or
the Ferrers diagram of λ.)
Enumerative Combinatorics: class notes                                       page 348
                                                   (3k − 1) k
                                         wk =                 .
                                                       2
  This is called a pentagonal number.
  Theorem 3.7.7 (Euler’s recursion for the partition numbers). For each n > 0, we
  have
    p (n)
    = p (n − 1) + p (n − 2) − p (n − 5) − p (n − 7) + p (n − 12) + p (n − 15) ± · · ·
    =    ∑       (−1)k−1 p (n − wk ) .
        k∈Z;
        k 6 =0
  We might get to prove this later on, using the technique of generating functions.
  There is, of course, much more to say about partitions. See [Wilf09] or [AndEri04]
for two introductions.
Class of 2019-11-18
4. Permutations
4.1. Introduction
We will now talk about permutations in more detail. For deeper treatments, see
[Bona12], [Sagan01] and [Stanle11, Chapter 1]. See also [Grinbe15, Chapter 5] for a
detailed exposition of the basics.
  Recall: A permutation of a set X is a bijection from X to X.
Enumerative Combinatorics: class notes                                                                page 350
4.2. Definitions
  Definition 4.2.1. Let n ∈ N. Let Sn be the set of all permutations of [n]. This
  set Sn is called the n-th symmetric group. It is closed under composition (i.e.,
  for any α ∈ Sn and β ∈ Sn , we have α ◦ β ∈ Sn ) and under inverses (i.e., for any
  σ ∈ Sn , we have σ−1 ∈ Sn ), and contains the identity map id[n] .
  Example 4.2.3. Let σ : [10] → [10] be the map that sends the elements
  1, 2, 3, 4, 5, 6, 7, 8, 9, 10 to 5, 4, 3, 2, 6, 10, 1, 9, 8, 7, respectively. Then, σ is a bijection,
  hence a permutation of [10]. The one-line notation of σ is (5, 4, 3, 2, 6, 10, 1, 9, 8, 7).
  The cycle digraph of σ is
5 9 8
1 6
                 7                            10                     2                      4
                                                                                                  .
             1, 2, . . . , i − 1 , j, i + 1, i + 2, . . . , j − 1, i, j + 1, j + 2, . . . , n  .
                                                                                              
              |       {z        }      |          {z             } |            {z           }
               integers from 1 to i −1   integers from i +1 to j−1       integers from j+1 to n
Enumerative Combinatorics: class notes                                                      page 351
Proof. Straightforward verification that both sides send each k ∈ [n] to the same
value. (The “hardest” part is part (c), which is proved in [Grinbe15, solution to
Exercise 5.1 (a)].)
Remark 4.3.7. People often write (i1 , i2 , . . . , ik ) for cyci1 ,i2 ,...,ik . (But we won’t.)
  Example 4.3.8. Let X = [8]. Then, the permutation cyc2,6,5 of [8] has two-line
                                 
             1 2 3 4 5 6 7 8
  notation                          .
             1 6 3 4 2 5 7 8
Enumerative Combinatorics: class notes                                                                       page 352
(h) We have
Proof. All of these are doable with some bookkeeping and induction.
  (a) This is [Grinbe15, Exercise 5.16].
Enumerative Combinatorics: class notes                                                                  page 353
  So the length of π is 3.
                                               
                                                 n
  Remark 4.4.3. If σ ∈ Sn , then 0 ≤ ` (σ) ≤       .
                                                 2
    The only σ ∈ Sn with ` (σ) = 0 isid.
                                     n
    The only σ ∈ Sn with ` (σ) =         is w0 .
                                     2
    Inbetween, there are many permutations with a given ` (σ).
Class of 2019-11-20
Proof. Recall: An inversion of σ is a pair (i, j) ∈ [n] × [n] such that i < j and
σ (i ) > σ ( j). An inversion of σ−1 is a pair (u, v) ∈ [n] × [n] such that u < v and
σ −1 ( u ) > σ −1 ( v ).
   The map
                                            n                   o
                         {inversions of σ} → inversions of σ−1 ,
                                   (i, j) 7→ (σ ( j) , σ (i ))
is well-defined and bijective (its inverse map sends each (u, v) ∈ inversions of σ−1
                                                                   
to σ−1 (v) , σ−1 (u) ). So the bijection principle yields ` (σ) = ` σ−1 .
                                                                      
   • the transpositions ti,j (swapping i with j while leaving all other numbers un-
     changed), and
     (b) We have
                                     (
                                         ` (σ) + 1, if σ−1 (k) < σ−1 (k + 1) ;
                     ` (sk ◦ σ ) =
                                         ` (σ) − 1, if σ−1 (k) > σ−1 (k + 1) .
   • if σ−1 (k ) > σ−1 (k + 1), then we lose an existing inversion σ−1 (k + 1) , σ−1 (k ) .
                                                                                         
of (b).
   (a) Apply part (b) to σ−1 instead of σ. We get
                          
                      ` σ−1  + 1, if σ−1 −1 (k ) < σ−1 −1 (k + 1) ;
          ` s k ◦ σ −1 =
                          ` σ−1  − 1, if σ−1 −1 (k ) > σ−1 −1 (k + 1)
                          (
                             ` (σ) + 1, if σ (k) < σ (k + 1) ;
                       =
                             ` (σ) − 1, if σ (k) > σ (k + 1)
                                                                      −1
(since ` σ−1 = ` (σ ) (by previous Proposition) and σ−1
               
                                                                           = σ). On the other
hand, the previous Proposition yields
                                                
                                                                                             
                                                
                                                
                                             −1
                                                          −1 −1
                                                                                      
                                                                                       −1
       ` s k ◦ σ −1 = `         s k ◦ σ −1        =   `                ◦      ( s   )
                                                                                            
                                                            σ                    k          
                                                       | {z }               |   {z   }     
                                                                                  =sk
                              |       {z      } 
                         = σ−1 −1 ◦(s )−1                     =σ        (since sk ◦sk =id )
                                ( )          k
                             (since (α◦ β)−1 = β−1 ◦α−1 )
                     = ` (σ ◦ sk ) .
Enumerative Combinatorics: class notes                                            page 356
(See [Grinbe15, Exercise 5.2 (a)] for a similar proof in more detail.)
  Remark 4.4.7. Let n ∈ N and σ ∈ Sn . Let i, j ∈ [n] be such that i < j and
  σ (i ) > σ ( j). Is                 
                            ` σ ◦ ti,j < ` (σ) ?
     It’s not obvious, but the answer is “yes”. See [Grinbe15, Exercise 5.20].
                  σ = s2 ◦ s3 ◦ s2 ◦ s1 = s3 ◦ s2 ◦ s3 ◦ s1 = s3 ◦ s2 ◦ s1 ◦ s3
                      | {z }                        | {z }
                        = s3 ◦ s2 ◦ s3               = s1 ◦ s3
                    = s2 ◦ s1 ◦ s1 ◦ s3 ◦ s2 ◦ s1 = · · · .
σ ◦ s k = s i1 ◦ s i2 ◦ · · · ◦ s i h for some i1 , i2 , . . . , ih ∈ [n − 1] .
              σ = s i1 ◦ s i2 ◦ · · · ◦ s i h ◦ ( s k ) −1
                                             
                                                | {z }
                                                   =sk
                                             
                = s i1 ◦ s i2 ◦ · · · ◦ s i h ◦ s k = s i1 ◦ s i2 ◦ · · · ◦ s i h ◦ s k .
Proof. (Proof of Corollary) See [Grinbe15, Exercises 5.2 and 5.3]. (Or do it yourself,
e.g., by induction on ` (σ ).)
                                  
    (d) We have ` cyci1 ,i2 ,...,ik ≥ k − 1 for all distinct i1 , i2 , . . . , ik ∈ [n].
                                               
                                                n
    (e) We have ` (id) = 0 and ` (w0 ) =            . (Recall: w0 is the “reflection across
                                                2
  the middle of [n]”.)
Proof. (a) follows from (b).
  (b) is [Grinbe15, Exercise 5.10 (a)], but also easy to check.
  (c) and (d) are parts of [Grinbe15, Exercise 5.17].
  (e) is trivial.
                                           Class of 2019-11-25
  Remark 4.4.13. For a given k and n, how many σ ∈ Sn have length k ?
      ∑       x `(w)
    w ∈ Sn
         n −1                               
     =      ∏      1 + x + x2 + · · · + xi
            i =1
                                                                                   
     = (1 + x ) · 1 + x + x 2 · 1 + x + x 2 + x 3 · · · · · 1 + x + x 2 + · · · + x n −1 .
Proof. The proposition is [Grinbe15, Corollary 5.53], and a proof appears in [Grinbe15,
solution to Exercise 5.18].
4.5. Descents
  Definition 4.5.1. Let n ∈ N and σ ∈ Sn .
   A descent of σ means a k ∈ [n − 1] such that σ (k ) > σ (k + 1).
   The descent set of σ, denoted Des σ, is the set of all descents of σ.
  Example 4.5.2. Let π ∈ S4 be the permutation with one-line notation (3, 1, 4, 2).
  Then, 1 is a descent of π (since π (1) = 3 > 1 = π (2)), and so is 3, but not 2.
  Thus, Des π = {1, 3}.
                         n!
  (e) The answer is         .
                         3!
   For the detailed proof, see [18s-mt1s, solution to Exercise 2 (b)].
                           n!     n!
   (f) The answer is            = .
                        2! · 2!   4
   For the detailed proof, see [18s-mt1s, solution to Exercise 2 (a)].
   More generally, you can ask how many permutations σ ∈ Sn have a given bunch
of numbers in their descent set. A similar question is answered in [18f-hw4s, Exer-
cise 4 (a)].
   (b) First of all, fix i ∈ [n − 1]. How many σ ∈ Sn have Des σ = {i } ?
   In other words, how many σ ∈ Sn satisfy
We have
(# of σ ∈ Sn such that σ (1) < σ (2) < · · · < σ (i ) and σ (i + 1) < σ (i + 2) < · · · < σ (n))
    
     n
=
     i
(# of σ ∈ Sn such that σ (1) < σ (2) < · · · < σ (i ) > σ (i + 1) < σ (i + 2) < · · · < σ (n))
= (# of σ ∈ Sn such that σ (1) < σ (2) < · · · < σ (i ) and σ (i + 1) < σ (i + 2) < · · · < σ (n))
   |                                             {z                                            }
                                                   n
                                               =
                                                   i
− (# of σ ∈ Sn such that σ (1) < σ (2) < · · · < σ (i ) < σ (i + 1) < σ (i + 2) < · · · < σ (n))
  |                                            {z                                              }
                                               =1
    
     n
=       − 1.
     i
Now, forget that we fixed i. Summing this over all i ∈ [n − 1], we get
4.6. Signs
Enumerative Combinatorics: class notes                                                     page 361
                                                σ (i ) − σ ( j )
                   (−1)σ =            ∏              i−j
                                                                       for each σ ∈ Sn .
                                   1≤ i < j ≤ n
Proof. Most of this follows easily from what we have proved above, but here are
references to complete proofs:
  (a) This is [Grinbe15, Proposition 5.15 (a)].
  (b) This is [Grinbe15, Exercise 5.10 (b)].
  (c) This is [Grinbe15, Exercise 5.17 (d)].
  (d) This is [Grinbe15, Proposition 5.15 (c)].
  (e) This is [Grinbe15, Proposition 5.28].
  (f) This is [Grinbe15, Proposition 5.15 (d)].
  (g) This is [Grinbe15, Exercise 5.13 (c)].
  (h) This is [Grinbe15, Exercise 5.13 (a)].
  Remark 4.6.6. For any n ∈ N, the set of all even permutations σ ∈ Sn is called
  the alternating group An .
2019-12-04 notes
  Definition 5.0.1. The integer lattice (or, for short, lattice) is the set Z2 = Z × Z.
     Its elements are called points; indeed, any element ( a, b) ∈ Z2 can be identi-
  fied with the point with coordinates a and b on the plane.
     Points can be added and subtracted entrywise: e.g.,
( a, b) − (c, d) = ( a − c, b − d) .
     If ( a, b) ∈ Z2 and (c, d) ∈ Z2 are two points, then a lattice path (for short, LP)
  from ( a, b) to (c, d) means
                                 v0 = ( a, b)         and            vn = (c, d)
                                                               
                                      
                                                               
                                                                
              and         vi − vi−1 ∈ (0, 1) ,      (1, 0)              for each i ∈ [n] .
                                       | {z }
                                                   | {z } 
                                                           
                                         up-step   right-step
  Example 5.0.2. The following picture shows an LP from (0, 0) to (5, 3):
Enumerative Combinatorics: class notes                                                             page 364
((0, 0) , (1, 0) , (1, 1) , (2, 1) , (3, 1) , (4, 1) , (4, 2) , (4, 3) , (5, 3)) .
  Its “step sequence” (i.e., the sequence of the directions of its steps) is
  RURRRUUR (meaning that its first step is a right-step, its second step is an
  up-step, its third step is a right-step, and so on).
  Note that any LP is uniquely determined by its starting point and its “step se-
quence”.
Proof. In each LP, the x-coordinates of the points weakly increase at each step, and
so do the y-coordinates. Thus, LPs from ( a, b) to (c, d) can only exist when c ≥ a
and d ≥ b.
  Furthermore, each step of a LP increases
                               (x-coordinate) + (y-coordinate)
by exactly 1 (in the sense that if ( xi , yi ) and ( xi+1 , yi+1 ) are two consecutive points
on an LP, then xi+1 + yi+1 = ( xi + yi ) + 1). Hence, each LP (v0 , v1 , . . . , vn ) from
( a, b) to (c, d) must have n = c + d − a − b. Thus, if c + d < a + b, then the # of LPs
from ( a, b) to (c, d) is 0. Otherwise, the bijection
   {LPs from ( a, b) to (c, d)} → {(c − a) -element subsets of [c + d − a − b]} ,
                (v0 , v1 , . . . , vn ) 7→ {i ∈ [n] | vi − vi−1 = (1, 0)}
                                    c+d−a−b
                                                 
shows that the # of LPs is                          .
                                         c−a
  Definition 5.0.4. Let v = (v0 , v1 , . . . , vn ) be a LP from ( a, b) to (c, d). Let p ∈ Z2 .
  We say that p ∈ v (in words: p lies on v) if p ∈ {v0 , v1 , . . . , vn }.
  Exercise 5.0.1. Find the # of LPs v from (0, 0) to (6, 6) such that (2, 2) ∈ v.
Proof. (Solution sketch.) Each such v consists of a LP from (0, 0) to (2, 2) and a LP
from (2, 2) to (6, 6). Thus, the product rule yields
         (# of LPs v from (0, 0) to (6, 6) such that (2, 2) ∈ v)
         = (# of LPs from (0, 0) to (2, 2)) · (# of LPs from (2, 2) to (6, 6)) .
            |             {z               } |              {z               }
                      2+2−0−0                            6+6−2−2
                                                                  
                  =                                  =
                         2−0                                6−2
Enumerative Combinatorics: class notes                                         page 365
  (Here, the region shaded cyan is the set of all ( x, y) ∈ R2 satisfying x ≥ y; this is
  the region in which a Catalan LP must stay.)
    The following LP from (0, 0) to (4, 4) is not Catalan:
  Proposition 5.0.8. (a) We have Ln,m = Ln−1,m + Ln,m−1 for any n ∈ Z and m ∈ Z
  satisfying n ≥ m and (n, m) 6= (0, 0).
    (b) If n ∈ N and m ∈ N satisfy n < m, then Ln,m = 0.
    (c) If n ∈ N and m ∈ N satisfy n ≥ m − 1, then
                                                   
                                      n+m       n+m
                            Ln,m =          −           .
                                         m      m−1
Enumerative Combinatorics: class notes                                                      page 366
                                    n+1−m n+m
                                                   
                           Ln,m =                     .
                                      n+1        m
Proof. Main idea: Recall the notion of “upsided tuples” from MT3 exercise 4. There
is a bijection
                              {Catalan LPs from (0, 0) to (n, m)}
                              → {upsided (n + m) -tuples (i1 , i2 , . . . , in+m ) with i1 + i2 + · · · + in+m = n} ,
( v0 , v1 , . . . , v n + m ) 7 → ( i1 , i2 , . . . , i n + m ) , where ik = [vk − vk−1 = (1, 0)] .
Thus, the claims of (b) and (c) follow from MT3 exercise 4. The claim of (d) follows
by simple algebra from (c). The claim of (e) follows by applying (d) to m = n. The
claim of (a) follows by looking at the last step of a Catalan LP.
                                                                           
                                                                1  2n         2n
   Definition 5.0.9. For any n ∈ N, the number Ln,n =                   =          −
                                                            n+1 n            n
      2n
             is called the n-th Catalan number and is denoted by Cn .
     n−1
  A whole book ([Stanle15]) has been written about Catalan numbers. A few other
places where they appear are:
   • Let us say that a permutation σ ∈ Sn is 123-avoiding if there exist no i < j < k
     in [n] such that σ (i ) < σ ( j) < σ (k ). Then, the # of 123-avoiding permutations
     σ ∈ Sn is Cn .
   • Consider all possible ways to fully parenthesize a given expression a1 + a2 +
     · · · + an . For example, for n = 4, these are
                        ( a1 + a2 ) + ( a3 + a4 ) ,        ( a1 + ( a2 + a3 )) + a4 ,
                        a1 + (( a2 + a3 ) + a4 ) ,         a1 + ( a2 + ( a3 + a4 )) ,
                        (( a1 + a2 ) + a3 ) + a4 .
      For any n ∈ N, there are Cn−1 ways to do this.
   • Fix an n ≥ 3, and a convex n-gon Gn . How many ways are there to triangulate
     Gn (i.e., to subdivide Gn into triangles whose vertices are vertices of Gn ) ?
      The answer is Cn−2 .
  There are several variations on Catalan numbers and Catalan LPs, such as r-
Catalan numbers.
Enumerative Combinatorics: class notes                                                                      page 367
f 0 = 0, f 1 = 1, f n = f n −1 + f n −2 .
                  F ( x ) = f 0 + f 1 x + f 2 x2 + · · ·
                          = 0 + 1x + 1x2 + 2x3 + 3x4 + 5x5 + 8x6 + · · · .
Then,
    F ( x ) = f 0 + f 1 x + f 2 x2 + f 3 x3 + f 4 x4 + · · ·
                                        2
                {z1x} + |( f 1 + f 0 ) x + ( f 2 + f 1{z
           = 0| +                                         ) x3 + ( f 3 + f 2 ) x4 + · · ·
                                                                                       }
                =x
                                          =( f 1 x2 + f 2 x3 + f 3 x4 +··· )
                                          +( f 0 x2 + f 1 x3 + f 2 x4 +··· )
                                                                                       
                       2          3        4                           2      3       4
           = x + f1 x + f2 x + f3 x + · · · + f0 x + f1 x + f2 x + · · ·
                  |                 {z                  }
                       = f 0 x + f 1 x2 + f 2 x3 + f 3 x4 +···
                                  (since f 0 =0)
                                                                                                           
                                     2            3              4               2         3            4
           = x + f0 x + f1 x + f2 x + f3 x + · · · + f0 x + f1 x + f2 x + · · ·
                |               {z                } |            {z             }
                                          = xF ( x )                                     = x2 F ( x )
           = x + xF ( x ) + x2 F ( x ) .
                                   x           1     1    1     1
               F (x) =                        =√ ·       −√ ·       .
                          (1 − φx ) (1 − ψx )   5 1 − φx   5 1 − ψx
Enumerative Combinatorics: class notes                                      page 368
                                         1
  Now, what are the coefficients of          for α ∈ C ?
                                      1 − αx
  Well:
                             1
                                = 1 + x + x2 + x3 + · · · ,
                            1−x
because
                                                 
               (1 − x ) 1 + x + x 2 + x 3 + · · ·
                                                                  
               = 1 + x + x2 + x3 + · · · − x 1 + x + x2 + x3 + · · ·
                                                          
                            2     3                  2 3
               = 1 + x + x + x + · · · − x + x + x + · · · = 1.
If we substitute αx for x here, we obtain
                          1
                               = 1 + αx + (αx )2 + (αx )3 + · · ·
                       1 − αx
                               = 1 + αx + α2 x2 + α3 x3 + · · · .
Thus, our formula for F ( x ) becomes
         1     1       1       1
F (x) = √ ·        −√ ·
          5 1 − φx      5 1 − ψx
         1                                      1                            
      = √ · 1 + φx + φ2 x2 + φ3 x3 + · · · − √ · 1 + ψx + ψ2 x2 + ψ3 x3 + · · ·
          5                                        5
        1−1 φ−ψ            2     2
                          φ −ψ 2 φ −ψ 3   3     3
      = √ + √ x+ √                 x + √          x +··· .
           5      5           5              5
Now, comparing coefficients before x n , we get
                              φn − ψn
                         fn =   √            for each n ∈ N.
                                  5
This is exactly Binet’s formula. Unlike the first time we saw it, we now have a
motivated “proof” of it.
  However, of course, this is only a proof if we can explain
   • what a power series is;
   • what x is;
   • why we can divide by power series like 1 − x − x2 ;
   • why we can substitute αx for x into a power series;
   • why we can expand infinite sums;
   • ...
   This is done nicely in [Loehr11, Chapter 7 (in the 1st edition)] and [19s, Chapter
7] and [21s] and in most detailed textbooks on abstract algebra.
   [18f, Chapter 8] gives a quick overview. So does [Niven69]. Many applications
are found in [Wilf09].
Enumerative Combinatorics: class notes                                                    page 369
= n · 2n −1 .
Second solution to Exercise 1.3.6. The following solution uses the same “Little Gauss”
trick that you have seen in the second proof of Theorem 1.2.1, except that we are
now using the summation sign. We have
         n         n           n         n         n                  
            n             n            n           n                       n
    2· ∑ k      = ∑k          +∑k          = ∑k        + ∑ (n − k)
       k =0
             k     k =0
                          k      k =0
                                       k     k =0
                                                    k    k =0
                                                                         n−k
                                                                       | {z  }
                                                                            n
                                                                         =
                                                                            k
                                                                       (by Theorem 1.3.11)
  (# of subsets of S) = (# of subsets of ∅)
                                                                             
                                   since the empty set ∅ has only one subset,
                      =1
                                           namely the empty subset ∅
                                              
                      = 20         since 20 = 1 .
  Induction step: Let m ∈ N. Assume (as the induction hypothesis) that Theorem
1.4.1 holds for n = m.
  Let S be an (m + 1)-element set. We must prove that
(# of subsets of S) = 2m+1 .
  The set S is an (m + 1)-element set; thus, its size is |S| = m + 1 ≥ 1 > 0. Hence,
the set S is nonempty, i.e., there exists a t ∈ S. Fix such a t.
  Now, we shall call a subset of S
Thus, each subset of S is either red or green (but not both at the same time). Thus,
by the sum rule, we have
We shall now compute the two addends on the right hand side.
  The green subsets of S are the subsets of S that don’t contain t. In other words,
the green subsets of S are exactly the subsets of S \ {t}. Hence,
  But S is an (m + 1)-element set, and thus S \ {t} is an m-element set (since t ∈ S).
Hence, our induction hypothesis shows that Theorem 1.4.1 can be applied to m and
S \ {t} instead of n and S. We thus obtain
(# of subsets of S \ {t}) = 2m .
In other words,
  But S \ {t} is an m-element set. Hence, our induction hypothesis shows that
Theorem 1.4.1 can be applied to m and S \ {t} instead of n and S. We thus obtain
(# of subsets of S \ {t}) = 2m .
= 2m + 2m = 2 · 2m = 2m +1 .
  Now, forget that we fixed S. We thus have shown that every (m + 1)-element set
S satisfies
                           (# of subsets of S) = 2m+1 .
In other words, Theorem 1.4.1 holds for n = m + 1. This completes the induction
step, and thus the proof of Theorem 1.4.1.
                                                                                      
   Recall that the tuple t1 , t2 , . . . , t p is a p-tuple of integers satisfying t1 , t2 , . . . , t p =
S and t1 < t2 < · · · < t p . In view of p = m, we can rewrite this as follows: The
tuple (t1 , t2 , . . . , tm ) is an m-tuple of integers satisfying {t1 , t2 , . . . , tm } = S and
t1 < t2 < · · · < tm . Hence, there exists at least one m-tuple (s1 , s2 , . . . , sm ) of in-
tegers satisfying {s1 , s2 , . . . , sm } = S and s1 < s2 < · · · < sm (namely, the m-tuple
(t1 , t2 , . . . , tm )). Furthermore, there exists at most one such m-tuple (s1 , s2 , . . . , sm )
229 . Combining the claims of the preceding two sentences, we conclude that there
229 Proof.
                                                 
                Recall that t1 , t2 , . . . , t p is the unique tuple (s1 , s2 , . . . , sk ) of integers satisfying
    {s1 , s2 , . . . , sk } = S and s1 < s2 < · · · < sk . Hence, if (s1 , s2 , . . . , sk ) is any tuple of integers sat-      
    isfying {s1 , s2 , . . . , sk } = S and s1 < s2 < · · · < sk , then (s1 , s2 , . . . , sk ) must equal t1 , t2 , . . . , t p .
    Applying this to k = m, we conclude that if (s1 , s2 , . . . , sm ) is any m-tuple of integers satisfying           
    {s1 , s2 , . . . , sm } = S and s1 < s2 < · · · < sm , then (s1 , s2 , . . . , sm ) must equal t1 , t2 , . . . , t p . Thus,
    there exists at most one such m-tuple (s1 , s2 , . . . , sm ).
Enumerative Combinatorics: class notes                                             page 376
just as well to the general case. Only the third solution to [18f-hw2s, Exercise 4]
really requires n to be a positive integer.)
   Let us solve Exercise 2.1.1 (b) now. In order to do so, we need to prove Proposi-
tion 1.3.28 again:
Alternative proof of Proposition 1.3.28 using Exercise 2.1.1 (a). If n = 0, then
         n         0               
               n         k 0           0
        ∑ (−1) k = ∑ (−1) k = (−
                 k
                                 1) 0
                              | {z } 0
                                           =1
        k =0       k =0
                                =1    |{z}
                                                            =1
                                                         (by (44))
                        = [ n = 0]            (since [n = 0] = 1 (because n = 0)) .
Thus, Proposition 1.3.28 is proved in the case when n = 0. Hence, for the rest of this
proof, we WLOG assume that n 6= 0. Thus, [n = 0] = 0. Also, n is a positive integer
(since n ∈ N and n 6= 0), and thus n − 1 ∈ N. Furthermore, n > n− 1. Hence,
                                                                        n−1
                                                                              
Proposition 1.3.6 (applied to n − 1 and n instead of n and k) yields             = 0.
                                                                          n
Now, Exercise 2.1.1 (a) (applied to m = n) yields
                    n
                                          n n−1
                                               
                            k n
                   ∑ (−1) k = (−1)             n
                                                    = 0 = [ n = 0]
                  k =0                      | {z }
                                                    =0
  Now, fix w ∈ X. We have assumed that for each x ∈ X, there are precisely a2
many elements y ∈ Y such that ( x, y) ∈ S. Applying this to x = w, we conclude
that there are precisely a2 many elements y ∈ Y such that (w, y) ∈ S. In other
words,
                  (# of elements y ∈ Y such that (w, y) ∈ S) = a2 .       (260)
   We shall next prove that
    (# of elements y ∈ Y such that (w, y) ∈ S) = (# of s ∈ S satisfying f (s) = w) .
Indeed, this will follow from the bijection principle, once we have set up the ap-
propriate bijections. Let us do this now:
  If y is an element of Y satisfying (w, y) ∈ S, then the pair (w, y) is an s ∈ S
satisfying f (s) = w (since the definition of f yields f ((w, y)) = w). Hence, the
map
                     α : {y ∈ Y | (w, y) ∈ S} → {s ∈ S | f (s) = w} ,
                                            y 7→ (w, y)
is well-defined.
   On the other hand, recall again that the elements of S are pairs ( x, y) ∈ X × Y
with x ∈ X and y ∈ Y. In other words, they are pairs (u, v) ∈ X × Y with u ∈ X
and v ∈ Y. If (u, v) is an element s of S satisfying f (s) = w, then v is an element
y ∈ Y such that (w, y) ∈ S 230 . Hence, the map
                     β : {s ∈ S | f (s) = w} → {y ∈ Y | (w, y) ∈ S} ,
                                        (u, v) 7→ v
is well-defined.
   It is straightforward to see that our maps α and β are mutually inverse231 . Thus,
α and β are bijections. Hence, the bijection principle yields
                      |{y ∈ Y | (w, y) ∈ S}| = |{s ∈ S | f (s) = w}| .
230 Proof. Let (u, v) be an element s of S satisfying f (s) = w. Thus, (u, v) ∈ S and f ((u, v)) = w. But
     the definition of f yields f ((u, v)) = u, so that u = f ((u, v)) = w. Hence, (u, v) = (w, v), so
     that (w, v) = (u, v) ∈ S. In other words, v is an element y ∈ Y such that (w, y) ∈ S.
231 Proof. We need to show that α ◦ β = id and β ◦ α = id. The second of these two equalities is easy
In other words,
  (# of elements y ∈ Y such that (w, y) ∈ S) = (# of s ∈ S satisfying f (s) = w) .
Comparing this with (260), we find
                            (# of s ∈ S satisfying f (s) = w) = a2 .                    (261)
  Now, forget that we fixed w. We thus have proved (261) for each w ∈ X. Thus,
(259) becomes
       |S| =   ∑      (# of s ∈ S satisfying f (s) = w) = ∑ a2 = | X | · a2 = a1 a2 .
               w∈ X
                      |               {z              } w∈ X     |{z}
                                      = a2                             = a1
                                   (by (261))
                                         f |C : A → C,
                                                a 7→ f ( a)
                                             g | B : A → B,
                                                     a 7→ g ( a)
In other words,
{red surjections f : [m] → [n] such that f (m) = i } → {surjections from [m − 1] to [n]} ,
                                                   f 7 → f | [ m −1]
233 since the options available for f (1) , f (2) , . . . , f (m − 1) in our proof of (169) depend on the choice
     of f (m)
234 Indeed, its inverse is the map
      {surjections from [m − 1] to [n]} → {red surjections f : [m] → [n] such that f (m) = i } ,
                                      g 7→ (the extension of g to [m] that sends m to i ) .
(266) becomes
But let i ∈ [n]. Thus, [n] \ {i } is an (n − 1)-element set (since [n] is an n-element
set). Also, [m − 1] is an (m − 1)-element set. Now, the map235
  {surjections from [m − 1] to [n] \ {i }} → {green surjections f : [m] → [n] such that f (m) = i } ,
                                         g 7→ (the extension of g to [m] that sends m to i ) .
  Now, forget that we fixed i. Hence, we have proved (269) for each i ∈ [n]. Thus,
(268) becomes
      (# of green surjections f : [m] → [n])
       =      ∑       (# of green surjections f : [m] → [n] such that f (m) = i )
             i ∈[n]
                      |                            {z                          }
                                              =sur(m−1,n−1)
                                                 (by (269))
238 Proof.Assume that n = 0. Thus, n! = 0! = 1. Hence, every integer is a multiple of n!. Thus, in
    particular, sur (k, n) is a multiple of n!.
Enumerative Combinatorics: class notes                                                      page 384
                         (here, we have split off the addend for j = n from the sum)
                    n −1    
                           n j
                  = ∑          x + xn .
                    j =0
                           j
                                                                             n −1
                                                                                   
                                                                  n                n j
Subtracting       xn   from this equality, we find ( x + 1) −         xn   = ∑        x . This proves
                                                                             j =0  j
Corollary 7.21.1.
Proof of Theorem 2.4.17. We shall prove Theorem 2.4.17 by strong induction over m:
  Induction step: Let q ∈ N. Assume that Theorem 2.4.17 holds for all m < q. We
must now prove that Theorem 2.4.17 holds for m = q.
  We have assumed that Theorem 2.4.17 holds for all m < q. In other words, we
have
                                          n        
                                              n −i n m
                          sur (m, n) = ∑ (−1)          i                     (270)
                                        i =0
                                                    i
for every m ∈ N and n ∈ N satisfying m < q.
  Now, let n ∈ N. We are going to prove that
                                                   n               
                                                                   n q
                                  sur (q, n) =    ∑ (−1)   n −i
                                                                   i
                                                                      i .                       (271)
                                                  i =0
  [Proof of (271): If q = 0, then (271) is easy to check239 . Hence, for the rest of this
proof, we WLOG assume that q 6= 0. Hence, q ∈ {1, 2, 3, . . .} (since q ∈ N), so that
q > 0. Since q 6= 0, we have [q = 0] = 0.
239 Proof.   Assume that q = 0. Thus, sur (q, n) = sur (0, n) = [n = 0] (by Proposition 2.4.12 (d),
Enumerative Combinatorics: class notes                                                            page 385
 If n = 0, then (271) is also easy to check240 . Hence, for the rest of this proof, we
WLOG assume that n 6= 0. Hence, n ∈ {1, 2, 3, . . .} (since n ∈ N), so that n > 0.
Hence, n − 1 ∈ N. Therefore, for every m ∈ N satisfying m < q, we have
                                                        n −1
                                                                                n−1 m
                                                                                  
                                sur (m, n − 1) =        ∑ (−1)    (n−1)−i
                                                                                 i
                                                                                     i                (272)
                                                        i =0
                       n                        0          
                                         n q            0− i 0 q
                      ∑ (−1)     n −i
                                         i
                                            i = ∑ (−1)
                                                              i
                                                                i       (since n = 0)
                      i =0                      i =0
                                                          
                                                          0 q
                                              = (−1)0−0       0 = 0q = 0        (since q > 0) ,
                                                | {z } 0
                                                     =1  |{z}
                                                           =1
                                          
                                n
                                     n −i n q
       we obtain sur (q, n) = ∑ (−1)         i . Thus, we have proven (271) under the assumption that
                              i =0        i
       n = 0.
Enumerative Combinatorics: class notes                                              page 386
Hence,
               q −1      
                        q
sur (q, n) =   ∑        j
                            ·         sur ( j, n − 1)
               j =0
                                      |      {z  } 
                                 n −1             n−1 j
                                = ∑ (−1)(n−1)−i       i
                                 i =0               i
                                  (by (272) (applied to m= j)
                                 (since j≤q−1<q and j∈N))
               q −1                                    q −1 n −1  
                        q n −1       (n−1)−i n − 1 j                       (n−1)−i n − 1 j
                                                                                    
                                                                   q
          =    ∑        j
                            · ∑ (−1)
                                               i
                                                    i = ∑ ∑
                                                                   j
                                                                      (−1)
                                                                                     i
                                                                                          i
               j =0           i =0                      j =0 i =0
                                                        | {z }
                                                                n −1 q −1
                                                                =∑ ∑
                                                                 i =0 j =0
               n −1 q −1 
                                        n−1 j
                                                          
                      q
          =    ∑∑      j
                         (−1)(n−1)−i
                                           i
                                               i
            i =0 j =0
            n −1                     q −1  
                      (n−1)−i n − 1
                             
                                             q j
          = ∑ (−1)                    ∑        i.                                      (273)
            i =0
                                i     j =0
                                             j
241 This   solution has been taken from [17f-hw2s, Exercise 4].
Enumerative Combinatorics: class notes                                                                    page 389
sur (m, n)
     n                                                                    n                    
                       n m         n −0 n                                                          n m
=   ∑ (−1)     n −i
                       i
                          i = (−1)
                                        0
                                                          0 m
                                                         |{z}              + ∑ (−1)        n −i
                                                                                                   i
                                                                                                      i
    i =0                                                  =0                 i =1
                                                  (since m is positive)
     (here, we have split off the addend for i = 0 from the sum)
                  n                   n                
       n −0 n              n −i n m                         n
= (−1)          0 + ∑ (−1)          i = ∑ (−1)   n −i
                                                                                                            im
             0                   i                           i                                             |{z}
  |      {z     } i =1                  i =1              | {z }                                          =iim−1
         =0                                                                                         (since m is positive)
                                                         n n−1
                                                          
                                                       =
                                                         i i−1
                                                                          (by Proposition 1.3.36,
                                                                             applied to n and i
                                                                            instead of m and n)
     n                             n
              n n − 1 m −1                    n − 1 m −1
                                                
= ∑ (−1)       n −i
                         ii    = ∑ (−1) n
                                       n −i
                                                     i
  i =1
               i i−1             i = 1
                                              i−1
              |  {z  }
                   n − 1 m −1
              =n           i
                   i−1
       n
           n − i n − 1 m −1
                      
= n ∑ (−1)               i   .
     i =1
                  i−1
we obtain
                                                        n
                                                                           n − 1 m −1
                                                                               
                                    sur (m, n) = n ∑ (−1)       n −i
                                                                                  i   .
                                                       i =0
                                                                           i−1
This solves Exercise 2.4.5 (a).                    
                                                     m
   (b) The definition of the Stirling number            (in Remark 2.4.16) yields
                                                     n
                                                        1 n
                                                                             
     m                        1                                                  n
         = sur (m, n) /n! =           sur (m, n)      =    · ∑ (−1) n −i
                                                                                          im
     n                       n!       | {z  }         n! i=0                   i
                                               n m
                                                                              | {z }
                                    n
                                          n −i                                   n!
                                = ∑ (−1)          i
                                  i =0         i                         =
                                 (by Theorem 2.4.17)                       i! · (n − i )!
                                                                                           (by Theorem 1.3.9,
                                                                                             applied to k=i)
                 1 n                 n!             1      n
                                                                            1
             =     · ∑ (−1)n−i                im =    · n! ∑ (−1)n−i                im
                 n! i=0        i! · (n − i )!      n!
                                                   | {z } i=0        i! ( n − i ) !
                                                               =1
                  n                                      n
                                          1                           im
             =   ∑ (−1)n−i           i! (n − i )!
                                                  im = ∑ (−1)n−i
                                                                 i! (n − i )!
                                                                              .
                 i =0                                  i =0
242 This solution to Exercise 2.4.5 has been taken from [17f-hw3s, Exercise 2].
243 Proof.  Let f : [m] → [k ]. Then, [m] = {1, 2, . . . , m} and thus f ([m]) = f ({1, 2, . . . , m}) =
    { f (1) , f (2) , . . . , f (m)}. But the set { f (1) , f (2) , . . . , f (m)} has at most m elements (since
    f (1) , f (2) , . . . , f (m) are m elements). In other words, |{ f (1) , f (2) , . . . , f (m)}| ≤ m. In view of
    f ([m]) = { f (1) , f (2) , . . . , f (m)}, this rewrites as | f ([m])| ≤ m. Hence, | f ([m])| ∈ {0, 1, . . . , m}
    (since | f ([m])| is clearly a nonnegative integer).
Enumerative Combinatorics: class notes                                                   page 391
   Now, fix i ∈ {0, 1, . . . , m}. If f : [m] → [k ] is any map satisfying | f ([m])| = i, then
f ([m]) is an i-element subset of [k ] (since f ([m]) ⊆ [k ] and | f ([m])| = i). Thus, the
sum rule yields
  Now, forget that we fixed i. We thus have proved (281) for each i ∈ {0, 1, . . . , m}.
Enumerative Combinatorics: class notes                                                     page 392
        Claim 1: We have
                                              v  
                                                     u−v
                                                       
                                       u         v
                                          = ∑
                                       n    k =0
                                                 k   n−k
        for any u ∈ R and v ∈ N.
                                   u−0
                                  
                     u      0  0
    In other words,     = ∑              , qed.
                     n    k =0 k   n−k
Enumerative Combinatorics: class notes                                                     page 393
  We intend to show that the right hand sides of the equalities (282) and (284) are
equal. To that aim, we transform the sums on the right hand side of the latter. Let
us begin with the first sum:
       w +1 
                     u−w−1
                          
               w
       ∑ k−1           n−k
       k =0
                              w +1 
                      u−w−1                  u−w−1
                                              
               w                       w
       =                      + ∑
              0−1       n−0     k =1
                                      k−1     n−k
            | {z }
               w
          =       =0
              −1
              (here, we have split off the addend for k = 0 from the sum)
         w +1                            w 
                         u−w−1                                   u−w−1
                                                                        
                  w                                  w
       = ∑                           = ∑
         k =1
                k − 1     n − k         k =0 |
                                               ( k + 1) − 1     n − ( k + 1)
                                                    {z  } |  {z           }
                                                      w          u−w−1
                                                  =           =
                                                      k           n−k−1
                                            (since (k+1)−1=k) (since n−(k+1)=n−k−1)
              (here, we have substituted k + 1 for k in the sum)
           w
                     u−w−1
                           
                w
       = ∑                      .                                                     (285)
         k =0
                k    n−k−1
In other words, Claim 1 holds for v = w + 1. This completes the induction step.
Thus, Claim 1 is proven by induction.]
  Now, let x ∈ N and y ∈ R. Applying Claim 1 to u = x + y and v = x, we get
                           x                       x  
                                   ( x + y) − x
                                                              
                x+y           x                          x    y
                       = ∑                        = ∑                     (287)
                  n      k =0
                              k        n−k          k =0
                                                         k   n−k
(since ( x + y) − x = y).
   Now, recall that x ∈ N. Hence, every k ∈ N satisfying k > x must satisfy
                                       
                                         x
                                            =0                               (288)
                                         k
                                                                   
                                                             x     y
(by Proposition 1.3.6, applied to x instead of n) and thus              = 0. Thus,
                                                              k   n−k
                                                           | {z }
                                                         =0
                           x     y
in the infinite sum ∑                  , every addend with k > x is 0. Hence, this
                     k ∈N k    n−k
infinite sum has only finitely many nonzero addends (namely, the addends with
Enumerative Combinatorics: class notes                                                       page 396
Thus, (172) is proved. Hence, (173) follows as well245 . This proves Theorem 2.6.1
for x ∈ N.
   Thus, Exercise 2.6.1 is solved.
245 because   we have seen in Remark 2.6.2 that the right hand sides of (172) and of (173) are equal
Enumerative Combinatorics: class notes                                                 page 397
But
                      y                             y         
                          x           y                      x    y
                    ∑ k                k
                                                     = ∑
                                                             k   y−k
                                                                       .
                    k =0                               k =0
                                    |{z} 
                                        y
                                  =
                                     y−k
                               (by Theorem 1.3.11,
                                 applied to n=y)
and thus                              
                    0   1   2         n    n+1
                      +   +    +···+    =        .
                    x   x   x         x    x+1
Renaming x as k in this statement, we obtain the following: For each k ∈ N, we
have                                              
                   0       1      2           n       n+1
                       +      +      +···+        =          .
                   k       k      k            k      k+1
Thus, Theorem 1.3.29 is proved again.
   • Exercise 2.8.1 (a) is [Grinbe15, Lemma 7.49] (with n and x renamed as m and
     n).
   • Exercise 2.8.1 (b) follows from [Grinbe15, Exercise 3.22]. (Namely, rename
     n as m in [Grinbe15, Exercise 3.22], and substitute n for X in the resulting
     equality between polynomials; then, you obtain precisely the claim of Exercise
     2.8.1 (b).)
U \ ( P1 ∪ P2 ∪ · · · ∪ Pk ) = (U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ Pk ) .
(b) We have
U \ ( P1 ∩ P2 ∩ · · · ∩ Pk ) = (U \ P1 ) ∪ (U \ P2 ) ∪ · · · ∪ (U \ Pk ) .
Proof of Proposition 7.33.2. (a) We shall prove Proposition 7.33.2 (a) by induction on
k:
   Induction base: It is easy to see that Proposition 7.33.2 (a) holds for k = 1 246 .
This completes the induction base.
   Induction step: Let m be a positive integer. Assume that Proposition 7.33.2 (a)
holds for k = m. We must prove that Proposition 7.33.2 (a) holds for k = m + 1.
   Let U be a set. Let P1 , P2 , . . . , Pm+1 be any m + 1 sets. We have assumed that
Proposition 7.33.2 (a) holds for k = m. Thus, Proposition 7.33.2 (a) (applied to
246 Proof.   If U is a set, and if P1 , P2 , . . . , P1 are any 1 sets, then
                    U \ ( P1 ∪ P2 ∪ · · · ∪ P1 ) = U \ P1 = (U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ P1 )
                        |         {z          }
                                   = P1
k = m) yields
U \ ( P1 ∪ P2 ∪ · · · ∪ Pm ) = (U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ Pm ) .
Now,
U \ ( P1 ∪ P2 ∪ · · · ∪ Pm+1 )
    |          {z           }
       =( P1 ∪ P2 ∪···∪ Pm )∪ Pm+1
 = U \ (( P1 ∪ P2 ∪ · · · ∪ Pm ) ∪ Pm+1 )
 = (U \ ( P1 ∪ P2 ∪ · · · ∪ Pm )) ∩ (U \ Pm+1 )
   |            {z              }
     =(U \ P1 )∩(U \ P2 )∩···∩(U \ Pm )
      (by Proposition 7.33.1 (a), applied to X = P1 ∪ P2 ∪ · · · ∪ Pm and Y = Pm+1 )
 = ((U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ Pm )) ∩ (U \ Pm+1 )
 = (U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ Pm+1 ) .
   Now, forget that we fixed U and P1 , P2 , . . . , Pm+1 . We thus have shown that if U
is a set, and if P1 , P2 , . . . , Pm+1 are any m + 1 sets, then
U \ ( P1 ∪ P2 ∪ · · · ∪ Pm+1 ) = (U \ P1 ) ∩ (U \ P2 ) ∩ · · · ∩ (U \ Pm+1 ) .
In other words, Proposition 7.33.2 (a) holds for k = m + 1. This completes the
induction step. Hence, Proposition 7.33.2 (a) is proved by induction.
   (b) In order to obtain a proof of Proposition 7.33.2 (b), it suffices to make some
simple modifications to our above proof of Proposition 7.33.2 (a) (namely: replace
all “∪” signs by “∩” signs and vice versa, and replace the reference to Proposition
7.33.1 (a) by a reference to Proposition 7.33.1 (b)).
  Now, let us solve Exercise 2.9.2:
Solution to Exercise 2.9.2. Let U be the set A1 ∪ A2 ∪ · · · ∪ An . Thus, U is the union
of the n finite sets A1 , A2 , . . . , An , and thus itself a finite set. Moreover, all the n sets
A1 , A2 , . . . , An clearly are subsets of their union A1 ∪ A2 ∪ · · · ∪ An . In other words,
all the n sets A1 , A2 , . . . , An are subsets of U (since U = A1 ∪ A2 ∪ · · · ∪ An ).
   For each i ∈ {1, 2, . . . , n}, we define a set Bi by Bi = U \ Ai . Thus, for each
i ∈ {1, 2, . . . , n}, the set Bi is a subset of the set U (since Bi = U \ Ai ), and thus is
finite (since U is finite). Hence, Theorem 2.9.1 (applied to Bi instead of Ai ) yields
                      | B1 ∪ B2 ∪ · · · ∪ Bn |
                            n
                      =    ∑     (−1)m−1            ∑                 Bi1 ∩ Bi2 ∩ · · · ∩ Bim .      (293)
                          m =1             (i1 ,i2 ,...,im )∈[n]m ;
                                              i1 <i2 <···<im
Enumerative Combinatorics: class notes                                                                   page 402
                                       n
           | ∪U∪
           U   {z· · · ∪ U} =         ∑      (−1)m−1            ∑           m
                                                                                   | ∩U∩
                                                                                   U    {z· · · ∩ U}
                  n times             m =1             (i1 ,i2 ,...,im )∈[n] ;        m times
                                                          i1 <i2 <···<im           |    {z         }
                                                                                               =U
                                                                                           (since m≥1)
                                       n
                                  =   ∑      (−1)m−1            ∑                 |U | .
                                      m =1             (i1 ,i2 ,...,im )∈[n]m ;
                                                          i1 <i2 <···<im
In view of
                    | ∪U∪
                    U   {z· · · ∪ U} = U                   (since n is positive) ,
                            n times
this rewrites as
                                       n
                            |U | =    ∑      (−1)m−1            ∑          m
                                                                                  |U | .                    (294)
                                      m =1             (i1 ,i2 ,...,im )∈[n] ;
                                                          i1 <i2 <···<im
Statement 1: We have
| B1 ∪ B2 ∪ · · · ∪ Bn | = |U | − | A1 ∩ A2 ∩ · · · ∩ An | .
|U \ ( A1 ∩ A2 ∩ · · · ∩ An )| = |U | − | A1 ∩ A2 ∩ · · · ∩ An | . (295)
                     ( B1 , B2 , . . . , Bn ) = (U \ A1 , U \ A2 , . . . , U \ An ) .
Thus,
              B1 ∪ B2 ∪ · · · ∪ Bn = (U \ A1 ) ∪ (U \ A2 ) ∪ · · · ∪ (U \ An ) .
But Proposition 7.33.2 (b) (applied to k = n and Pj = A j ) yields
          U \ ( A 1 ∩ A 2 ∩ · · · ∩ A n ) = (U \ A 1 ) ∪ (U \ A 2 ) ∪ · · · ∪ (U \ A n ) .
Enumerative Combinatorics: class notes                                                     page 403
U \ ( A1 ∩ A2 ∩ · · · ∩ An ) = B1 ∪ B2 ∪ · · · ∪ Bn .
| B1 ∪ B2 ∪ · · · ∪ Bn | = |U | − | A1 ∩ A2 ∩ · · · ∩ An | .
Thus,                                                  
             Bi1 ∩ Bi2 ∩ · · · ∩ Bim = U \ Ai1 ∩ U \ Ai2 ∩ · · · ∩ (U \ Aim ) .
But Proposition 7.33.2 (a) (applied to k = m and Pj = Ai j ) yields
                                                           
        U \ A i1 ∪ A i2 ∪ · · · ∪ A i m = U \ A i1 ∩ U \ A i2 ∩ · · · ∩ (U \ A i m ) .
| B1 ∪ B2 ∪ · · · ∪ Bn |
        n
=   ∑       (−1)m−1                    ∑            m
                                                           Bi1 ∩ Bi2 ∩ · · · ∩ Bim
    m =1                    (i1 ,i2 ,...,im )∈[n]       ;
                                                          |           {z              }
                               i1 <i2 <···<im             =|U |−| Ai1 ∪ Ai2 ∪···∪ Aim |
                                                                (by Statement 2)
        n
    ∑       (−1)m−1                      ∑
                                                                                                                   
=                                                           |U | − A i1 ∪ A i2 ∪ · · · ∪ A i m
    m =1                        (i1 ,i2 ,...,im )∈[n]m ;
                                   i1 <i2 <···<im
                                |                                        {z                                        }
                            =                ∑           |U |−              ∑           | Ai1 ∪ Ai2 ∪···∪ Aim |
                                (i1 ,i2 ,...,im )∈[n]m ;       (i1 ,i2 ,...,im )∈[n]m ;
                                   i1 <i2 <···<im                 i1 <i2 <···<im
                                                                                                                                     
        n
    ∑       (−1)m−1                      ∑                                       ∑
                                                                                                                            
=                                                          |U | −                               A i1 ∪ A i2 ∪ · · · ∪ A i m 
                                                                                                                             
    m =1                         (i1 ,i2 ,...,im )∈[n]m ;             (i1 ,i2 ,...,im )∈[n]m ;
                                    i1 <i2 <···<im                       i1 <i2 <···<im
            |                                                              {z                                                          }
                  =(−1)m−1                       ∑           |U |−(−1)     m −1
                                                                                               ∑           | Ai1 ∪ Ai2 ∪···∪ Aim |
                                    (i1 ,i2 ,...,im )∈[n]m ;                      (i1 ,i2 ,...,im )∈[n]m ;
                                       i1 <i2 <···<im                                i1 <i2 <···<im
                                                                                                                                                 
        n
    ∑       (−1)m−1                      ∑                 |U | − (−1)m−1                       ∑
                                                                                                                                                  
=                                                                                                                     A i1 ∪ A i2 ∪ · · · ∪ A i m 
                                                                                                                                                   
    m =1                         (i1 ,i2 ,...,im )∈[n]m ;                               (i1 ,i2 ,...,im )∈[n]m ;
                                    i1 <i2 <···<im                                         i1 <i2 <···<im
        n                                                            n
=   ∑       (−1)     m −1
                                       ∑                 |U | −     ∑      (−1)m−1                   ∑                   A i1 ∪ A i2 ∪ · · · ∪ A i m
    m =1                    (i1 ,i2 ,...,im )∈[n]m ;                m =1                   (i1 ,i2 ,...,im )∈[n]m ;
                               i1 <i2 <···<im                                                 i1 <i2 <···<im
    |                        {z                             }
                          =|U |
                        (by (294))
                 n
= |U | −        ∑      (−1)m−1                    ∑             m
                                                                     A i1 ∪ A i2 ∪ · · · ∪ A i m .                                           (297)
                m =1                    (i1 ,i2 ,...,im )∈[n] ;
                                           i1 <i2 <···<im
                             | B1 ∪ B2 ∪ · · · ∪ Bn | = |U | − | A1 ∩ A2 ∩ · · · ∩ An | .
Enumerative Combinatorics: class notes                                                                            page 405
          | A1 ∩ A2 ∩ · · · ∩ A n |
          = |U | −                  | B ∪ B2 ∪ · · · ∪ Bn |
                                    | 1      {z            }
                            n
                                    m −1
                   =|U |− ∑ (−1)             ∑
                                                      m
                                                        | Ai1 ∪ Ai2 ∪···∪ Aim |
                            m =1               (i1 ,i2 ,...,im )∈[n] ;
                                                  i1 <i2 <···<im
                                                     (by (297))
                                                                                                               
                                     n
                                   ∑     (−1)m−1                    ∑
                                                                                                                 
          = |U | − 
                    |U | −                                                           A i1 ∪ A i2 ∪ · · · ∪ A i m 
                                                                                                                  
                                  m =1                     (i1 ,i2 ,...,im )∈[n]m ;
                                                              i1 <i2 <···<im
                 n
          =     ∑      (−1)m−1            ∑          m
                                                           A i1 ∪ A i2 ∪ · · · ∪ A i m .
                m =1             (i1 ,i2 ,...,im )∈[n] ;
                                    i1 <i2 <···<im
                             σ ( p) = σ ( p)
                             e                                    for each p ∈ X \ I.
                              σ ( p) = σ ( p)
                              e                           for each p ∈ X \ I.
Hence, for the rest of this proof, we WLOG assume that p ∈        / I. Hence, p ∈ X \ I
(since p ∈ X and p ∈  / I), so that τ ( p) is well-defined (since τ is a permutation of
X \ I). Moreover,
    (
      τ ( p) , if p ∈
                    / I;
                         = τ ( p) ∈ X \ I        (since τ is a permutation of X \ I )
       p,      if p ∈ I
                           ⊆ X.
        (
            τ ( p) , if p ∈
                          / I;
Thus,                          ∈ X is proved.
            p,       if p ∈ I
                                                           (
                                                        τ ( p) , if p ∈
                                                                      / I;
  Now, forget that we fixed p. We thus have shown that                     ∈ X for
                                                         p,      if p ∈ I
each p ∈ X. Hence, we can define a map τb : X → X by setting
                          (
                            τ ( p) , if p ∈
                                          / I;
                τb ( p) =                       for each p ∈ X.
                            p,       if p ∈ I
                              (
                   −1 ( p ) =
                                τ −1 ( p) , if p ∈
                                                 / I;
                  τd                                       for each p ∈ X.
                                p,          if p ∈ I
  Case 2: We have q ∈   / I.
  Let us first consider ( Case 1. In this case, we have q ∈ I. Now, the definition of
 −1 yields τ −1 ( q ) =
                          τ −1 (q) , if q ∈ / I;
τd          d                                    = q (since q ∈ I). Applying the map τb to
                          q,           if q ∈ I
both sides of this equality, we find
                  
                                 (
          −1                       τ (q) , if q ∈ / I;
              (q) = τb (q) =                                 (by the definition of τb)
                   
      τb τd
           | {z }                   q,        if q ∈ I
                  =q
                           =q   (since q ∈ I ) .
                                                          
Hence, τb ◦ τ d− 1            − 1
                   (q) = τb τ (q) = q. Thus, τb ◦ τ
                             d                           d−  1   (q) = q is proven in Case
1.
   Let us next consider Case 2. In this case, we have q ∈         / I. Combining q ∈ X
with q ∈ / I, we find q ∈ X \ I. Hence, τ −1 (q) is well-defined (since τ −1 is a map
from from X \ I to X \ I) and satisfies τ −1 (q) ∈ X \ I (for the same reason). From
τ −1 (q) ∈ X \ I, we obtain τ −1 (q) ∈ X and(τ −1 (q) ∈ / I.
                                                  − 1
                                                 τ (q) , if q ∈  / I;
   The definition of τd−1 yields τd−1 ( q ) =                         = τ −1 (q) (since q ∈
                                                                                          /
                                                 q,       if q ∈ I
I). Applying the map τb to both sides of this equality, we find
              
                              
          − 1            −1
    τ τ (q) = τ τ (q)
      d       
    b                b
        | {z }
                =q
                           (
                           τ τ −1 ( q ) ,     if τ −1 (q) ∈
                                          
                                                          / I;
                        =                                            (by the definition of τb)
                           τ −1 ( q ) ,       if τ −1 (q) ∈ I
                                                                  
                        = τ τ −1 ( q )             since τ −1 (q) ∈
                                                                  /I
                   = q.
                                                         
Hence, τb ◦ τd  −1 ( q ) = τ
                           b τd−1 ( q ) = q. Thus, τ        −1 ( q ) = q is proven in Case
                                                       b ◦ τd
2.                                  
   We have now proved τb ◦ τd    −1 ( q ) = q in each of the two Cases 1 and 2. Thus,
                                                    
  τ◦τ
  b  d− 1   (q) = q always holds. Hence, τ ◦ τb   d− 1   (q) = q = id (q).
                                                                   
   Now, forget that we fixed q. We thus know that τb ◦ τd       −1 ( q ) = id ( q ) for each
q ∈ X. In other words, τb ◦ τd −1 = id. The same argument (but with the roles of τ
          ( A ◦ B) (τ ) = A ( B (τ )) = B]
                                         (τ )        (by the definition of A) .
                           ( B ◦ A) (γ) = B ( A (γ)) = \
                                                       A ( γ ).
Enumerative Combinatorics: class notes                                         page 410
Proof of Theorem 1.7.9 (b). Let n be an integer such that n ≥ 1. Thus, n is a positive
integer, so that n ∈ N and n − 1 ∈ N. Hence, Theorem 1.7.9 (d) (applied to n − 1
instead of n) yields
                                      n −1
                                                 ( n − 1) !
                              Dn−1 = ∑ (−1)k                .                   (300)
                                      k =0
                                                     k!
Also, Theorem 1.7.9 (d) yields
             n                               n −1
                           n!          n!                               n!
     Dn =   ∑      (−1)k
                           k!
                              = (−1)n
                                       n!
                                           + ∑ (−1)k
                                                                        k!
            k =0                      |{z}   k =0                      |{z}
                                             =1                     ( n − 1) ! · n
                                                                =
                                                                         k!
                                                             (since Proposition 1.3.2
                                                               yields n!=(n−1)!·n)
                   (here, we have split off the addend for k = n from the sum)
                       n −1                                       n −1
                                   k ( n − 1) ! · n                              ( n − 1) !
         = (−1)n +     ∑    (− 1 )                   = (− 1 ) n
                                                                +  ∑   n (−1)k
                       k =0 |          {z k!                                         k!
                                                                  |k=0
                                                   }
                                        ( n − 1) !
                                                                            {z            }
                              =n(−1)  k                                n −1    ( n − 1) !
                                            k!                      =n ∑ (−1)k
                                                                       k =0         k!
                           n −1
                                        ( n − 1) !
         = (−1)n + n       ∑ (−1)k          k!
                                                   = (−1)n + nDn−1 = nDn−1 + (−1)n .
                           |k=0       {z        }
                                   = Dn −1
                                  (by (300))
  Lemma 7.35.1. Let (u0 , u1 , u2 , . . .) be a sequence of real numbers such that every
  integer n ≥ 1 satisfies
                                    un = nun−1 + (−1)n .                            (301)
  Then, un = (n − 1) (un−1 + un−2 ) for each integer n ≥ 2.
Thus,
                                    un−1 + (−1)n = (n − 1) un−2 .                              (302)
But n ≥ 2 ≥ 1. Hence, (301) yields
             un =       n
                       |{z}     un−1 + (−1)n = ((n − 1) + 1) un−1 + (−1)n
                                               |       {z       }
                     =(n−1)+1                  =(n−1)un−1 +un−1
                 =   (n − 1) un−1 + un−1 + (−1)n = (n − 1) un−1        + ( n − 1 ) u n −2
                                        |       {z        }
                                            =(n−1)un−2
                                             (by (302))
                 = ( n − 1 ) ( u n −1 + u n −2 ) .
   Definition 7.35.2. Let X be a set. Let f : X → X be any map. Then, Fix f shall
   denote the set of all fixed points of f .
Proof of Proposition 7.35.3. Let us first give a sketch of the proof (similarly to the
proof of Proposition 2.9.14 we sketched), and then fill in the details (similarly to
the solution of Exercise 2.9.3):
  To each permutation σ ∈ SX satisfying Fix σ = I, we can assign a derangement e     σ
of X \ I by letting
                         σ ( p) = σ ( p)
                         e                    for each p ∈ X \ I.
252   This defines a map
                   A : {σ ∈ SX | Fix σ = I } → {derangements of X \ I } ,
                                          σ 7→ e
                                               σ.
252 Why               σ well-defined, and why is it really a derangement of X \ I ? This will follow
          is this map e
      from Statement 1’ and Statement 2’ further below.
Enumerative Combinatorics: class notes                                                 page 413
                 B : {derangements of X \ I } → {σ ∈ SX | Fix σ = I } ,
                                            τ 7→ τb.
The maps A and B are well-defined and mutually inverse254 . Hence, they are bi-
jections. Thus, there is a bijection from the set {σ ∈ SX | Fix σ = I } to the set
{derangements of X \ I } (namely, A). This proves Proposition 7.35.3, once the de-
tails are filled in.
   Let us now fill in the details. Here are the statements that were left unproved in
our above proof:255
                          σ ( p) = σ ( p)
                          e                      for each p ∈ X \ I.
     defined. Statement 5’ and Statement 6’ (when combined) show that the maps A and B are
     mutually inverse.
Enumerative Combinatorics: class notes                                                               page 414
we obtain
                                                                                          
                   n! =               ∑             # of σ ∈ S [n] satisfying    Fix σ = I
                             I is a subset of [n] |                  {z                    }
                                                            =|{σ∈S[n] | Fix σ= I }|
                                                                         = Dn−| I |
                                                          (by Corollary 7.35.4, applied to X =[n])
                       =             ∑              Dn−| I | .                                                                   (303)
                             I is a subset of [n]
  Now, let us note that each subset I of [n] satisfies | I | ∈ {0, 1, . . . , n} (since Theo-
rem 1.4.7 (b) yields | I | ≤ |[n]| = n). Hence, we can split the sum            ∑       Dn−| I |
                                                                                                          I is a subset of [n]
according to the value of | I |, obtaining the following:
              ∑              Dn−| I | =            ∑                    ∑                 Dn−| I |
      I is a subset of [n]                 k∈{0,1,...,n}        I is a subset of [n];     | {z }
                                                                        | I |=k            = Dn − k
                                                                                        (since | I |=k)
                                      =            ∑                               ∑               Dn − k
                                           k∈{0,1,...,n}                  I is a subset of [n];
                                           |       {z     }                       | I |=k
                                                    n
                                                   =∑
                                                                          |               {z               }
                                                   k =0         =(# of subsets I of [n] satisfying | I |=k) Dn−k
                                               n
                                      =    ∑ (|# of subsets I of             [n] satisfying | I | = k) Dn−k
                                           k =0
                                                                              {z                     }
                                                                =(# of k-element
                                                                               subsets of [ n ])
                                                                               n
                                                                            =
                                                                               k
                                                              (by Theorem 1.3.12, applied to S=[n])
                                          n  
                                             n
                                      = ∑       Dn − k .
                                        k =0
                                             k
Enumerative Combinatorics: class notes                                                               page 417
  Lemma 7.38.1 appears (with detailed proof) in [Grinbe15, Exercise 6.1 (a)]. Now,
Lemma 2.9.21 can easily be derived from it:
Proof of Lemma 2.9.21. (a) Lemma 7.38.1 (applied to bi = 1) yields
                                         !         
                  n
                 ∏ ( a i + 1) = ∑ ∏ a i                           ∏         1 =         ∑ ∏ ai .
                 i =1                I ⊆[n]    i∈ I            i ∈[n]\ I              I ⊆[n] i ∈ I
                                                           |        {z        }
                                                                    =1
Enumerative Combinatorics: class notes                                                            page 418
Hence,
                               n                       n
          ∑     ∏ ai =              + 1) = ∏ (1 + a i ) = (1 + a1 ) (1 + a2 ) · · · (1 + a n ) .
                             ∏ (|ai {z
         I ⊆[n] i ∈ I        i =1
                                       } i =1
                                     =1+ a i
                                      ∑ ∏ (−ai )                  =    ∑       (−1)| I | ∏ ai ,
                                     I ⊆[n] i ∈ I                     I ⊆[n]            i∈ I
                                               |      {z      }
                                           =(−1)| I | ∏ ai
                                                           i∈ I
we obtain
                           ∑       (−1)| I | ∏ ai = (1 − a1 ) (1 − a2 ) · · · (1 − an ) .
                          I ⊆[n]               i∈ I
Proof of Lemma 7.39.1. Let p and q be two distinct primes. We must prove that p
and q are coprime. In other words, we must prove that gcd ( p, q) = 1 (since this is
what it means for p and q to be coprime).
   Assume the contrary. Thus, gcd ( p, q) 6= 1.
   The definition of gcd ( p, q) shows that gcd ( p, q) is the greatest positive integer
that divides both p and q. Thus, gcd ( p, q) is a positive integer and divides both p
and q. In particular, gcd ( p, q) is a positive divisor of p (since gcd ( p, q) is positive
and divides p).
   But p is prime. In other words, p is an integer greater than 1 and having the prop-
erty that the only positive divisors of p are 1 and p. In particular, the only positive
divisors of p are 1 and p. Hence, gcd ( p, q) must be either 1 or p (since gcd ( p, q)
is a positive divisor of p). Since gcd ( p, q) cannot be 1 (because gcd ( p, q) 6= 1), we
thus conclude that gcd ( p, q) = p.
   Similarly, we obtain gcd ( p, q) = q (since gcd ( p, q) divides not only p but also q).
Enumerative Combinatorics: class notes                                                              page 419
259 Proof.Let u and v be two elements of [k] such that u 6= v. We shall show that phu 6= phv .
       The elements h1 , h2 , . . . , hk are distinct (since they are all elements of I, listed with no repeti-
    tions). Hence, from u 6= v, we obtain hu 6= hv . Therefore, phu 6= phv , since all the primes pi (for
    different i ∈ I) are distinct.
       Forget that we fixed u and v. We thus have shown that if u and v are two elements of [k] such
    that u 6= v, then phu 6= phv . In other words, the primes ph1 , ph2 , . . . , phk are distinct.
Enumerative Combinatorics: class notes                                                                   page 420
   Proposition 7.41.1. Let n > 1 be an integer. Then, there exists at least one prime
   p such that p | n.
                       (m is coprime to u)
                       ⇐⇒ (( pi does not divide m) for each i ∈ [n]) .                                        (304)
We shall do this by separately proving the “=⇒” and “⇐=” implications of this
equivalence:
   Proof of the “=⇒” implication of (304): Assume that m is coprime to u. We must
show that ( pi does not divide m) for each i ∈ [n].
   Fix i ∈ [n]. We shall show that pi does not divide m.
   Indeed, assume the contrary. Thus, pi divides m. But pi is a prime that divides u
(since all of p1 , p2 , . . . , pn are primes that divide u); thus, pi divides u. Hence, the
positive integer pi divides both m and u. Since pi is a prime, we have pi > 1.
260 Here we are using the transitivity of divisibility (i.e., the fact that if a, b and c are three integers
    satisfying a | b and b | c, then a | c). This is [19s, Proposition 2.2.4 (b)] (and is easy to prove).
Enumerative Combinatorics: class notes                                                            page 421
   We have assumed that m is coprime to u. In other words, gcd (m, u) = 1 (by the
definition of “coprime”). But gcd (m, u) is defined to be the greatest positive integer
that divides both m and u. Therefore, if r is any positive integer that divides both
m and u, then r ≤ gcd (m, u). Applying this to r = pi , we obtain pi ≤ gcd (m, u)
(since pi is a positive integer that divides both m and u). Thus, pi ≤ gcd (m, u) = 1.
This contradicts pi > 1.
   This contradiction shows that our assumption was wrong. Hence, pi does not
divide m.
   Forget that we fixed i. We thus have proved that ( pi does not divide m) for each
i ∈ [ n ].
   We thus have shown that if m is coprime to u, then ( pi does not divide m) for
each i ∈ [n]. In other words, we have proved the “=⇒” implication of (304).
   Proof of the “⇐=” implication of (304): Assume that ( pi does not divide m) for each
i ∈ [n]. We must show that m is coprime to u. In other words, we must show that
gcd (m, u) = 1 (because this is what it means for m to be coprime to u).
   Indeed, assume the contrary. Thus, gcd (m, u) 6= 1. But gcd (m, u) is the great-
est positive integer that divides both m and u (by the definition of gcd (m, u)).
Hence, gcd (m, u) is a positive integer. Therefore, from gcd (m, u) 6= 1, we obtain
gcd (m, u) > 1. Hence, Proposition 7.41.1 (applied to gcd (m, u) instead of n) yields
that there exists at least one prime p such that p | gcd (m, u). Consider this p.
   Recall that gcd (m, u) divides both m and u. In other words, gcd (m, u) | m and
gcd (m, u) | u.
   We have p | gcd (m, u) and gcd (m, u) | m. Combining these two divisibilities, we
find p | gcd (m, u) | m, thus p | m 261 . Likewise, combining p | gcd (m, u) with
gcd (m, u) | u, we find p | gcd (m, u) | u, so that p | u 262 . Thus, p is a prime that
divides u (since p is a prime). Hence, p must be one of the n primes p1 , p2 , . . . , pn
(since these n primes p1 , p2 , . . . , pn are precisely the distinct primes that divide u).
In other words, p = p j for some j ∈ [n]. Consider this j.
   Recall that we assumed that ( pi does not divide m) for each i ∈ [n]. Applying
this to i = j, we conclude that p j does not divide m. In other words, p does not
divide m (since p = p j ). But this contradicts p | m. This contradiction shows that
our assumption was false. Hence, we have proved that gcd (m, u) = 1. In other
words, m is coprime to u.
   We thus have shown that if ( pi does not divide m) for each i ∈ [n], then m is
coprime to u. In other words, we have proved the “⇐=” implication of (304).
   We now have proved both “=⇒” and “⇐=” implications of (304). Thus, (304)
holds, and therefore Lemma 2.9.27 is proved.
   This solves Exercise 2.9.10.
261 Here  we are using the transitivity of divisibility (i.e., the fact that if a, b and c are three integers
     satisfying a | b and b | c, then a | c). This is [19s, Proposition 2.2.4 (b)] (and is easy to prove).
262 again, by the transitivity of divisibility
Enumerative Combinatorics: class notes                                                           page 422
            ∑ (− 1)| I \T | = ∑ 1 = (# of subsets I of S) · 1
          I ⊆S                    I ⊆S
              | {z }
                    =1
                 (by (305))
we obtain                                              (
                                                           2|S| , if S ⊆ T;
                                ∑ (−1)   | I \T|
                                                   =
                                                           0,     otherwise
                                                                            .
                                I ⊆S
The map263
                               {I ⊆ S | g ∈
                                          / I} → {I ⊆ S | g ∈ I} ,
                                             J 7→ J ∪ { g}
is a bijection. (This can be proved in the exact same way as it was proved during
our second proof of Proposition 2.9.10.)
   Moreover, every subset J of S satisfying g ∈
                                              / J must satisfy
                        =−        ∑    (−1)| I \T |                                                                   (308)
                               I ⊆S;
                                 ∈I
                                g/
263 Thenotation “{ I ⊆ S | g ∈/ I }” means “the set of all subsets I of S satisfying g ∈/ I”. Similarly,
    the notation “{ I ⊆ S | g ∈ I }” means “the set of all subsets I of S satisfying g ∈ I”.
Enumerative Combinatorics: class notes                                                     page 424
we obtain                                             (
                                                          2|S| , if S ⊆ T;
                              ∑      (−1)| I \T | =
                                                          0,     otherwise
                                                                           .
                              I ⊆S
   Let us next consider Subcase 1.2. In this subcase, we have k 6= 0. Hence, k > 0
(since k ∈ N), so that −k < 0 and therefore −k ∈   / N. Thus, |{z}n −k = 0 − k =
                                                                       =0
−  / N.
k ∈  Therefore, (43) (applied to n − 1 and n − k instead of n and k) yields
 n−1
       = 0. Comparing this with
 n−k
             
              n − 1 , if n > 0;
                        
             
                  k−1              = [ k = 0]    (since n = 0)
             
              [ k = 0] , if n = 0
                                         =0         (since k 6= 0) ,
                     
                          n−1
                                
                     
           n−1
                                , if n > 0;
we find            =      k−1                  . Thus, (309) is proved in Subcase 1.2.
           n−k       
                      [ k = 0] ,    if n = 0
   We have now proved (309) in each of the two Subcases 1.1 and 1.2. Hence, (309)
is proved in Case 1 (since Subcases 1.1 and 1.2 cover Case 1).
   Let us next consider Case 2. In this case, we have n 6= 0. Hence, n is a positive
integer (since n ∈ N). Thus, n ≥ 1, so that n − 1 ∈ N. Therefore, Theorem 1.3.11
(applied to n − 1 and n − k instead of n and k) yields
             = # of ( x1 , x2 , . . . , x0 ) ∈ P0 satisfying x1 + x2 + · · · + x0 = |{z}
                                                                                      n 
                                                                                         
                                                              |       {z         }
                                                                           =(empty sum)=0                =0
                                                                              
             = # of ( x1 , x2 , . . . , x0 ) ∈ P0 satisfying 0 = 0
                                                  
             = # of ( x1 , x2 , . . . , x0 ) ∈ P 0
                                                                             
                    since every ( x1 , x2 , . . . , x0 ) ∈ P0 satisfies 0 = 0
             =1
                  n−1         0−1
                               
                          =                 (since n = 0 and k = 0)
                  n−k         0−0
                              0−1
                                 
                          =          =1           (by (44)) ,
                                0
we obtain
                                                                            n − 1
                                       k
      # of ( x1 , x2 , . . . , xk ) ∈ P satisfying x1 + x2 + · · · + xk = n =         .
                                                                               n−k
    are positive integers (since P is the set of all positive integers). Thus, x1 + x2 + · · · + xk is a sum
    of k positive integers. Thus, x1 + x2 + · · · + xk is a positive integer itself (since any sum of k
    positive integers is a positive integer (because k 6= 0)). Hence, x1 + x2 + · · · + xk > 0, so that
    x1 + x2 + · · · + xk 6= 0. In other words, x1 + x2 + · · · + xk 6= n (since n = 0). Qed.
Enumerative Combinatorics: class notes                                                                 page 427
                                  n−1
                                       
Comparing this with                          = 0, we obtain
                                  n−k
                                                                                                   n−1
                                                                                                    
                                         k
             # of ( x1 , x2 , . . . , xk ) ∈ P satisfying x1 + x2 + · · · + xk = n =                     .
                                                                                                   n−k
Hence, (239) is proved in Case 2.
  Hence, we have proved (239) in each of the two Cases 1 and 2. Thus, (239) always
holds.
  Now, (239) yields
                                                                                
          # of ( x1 , x2 , . . . , xk ) ∈ Pk satisfying x1 + x2 + · · · + xk = n
                             
                                    n−1
                                          
                      
             n−1
                                          , if n > 0;
        =               =           k−1                        (by Exercise 2.10.1 (a)) .
             n−k             
                              [ k = 0] ,      if n = 0
                                  n−1
                                       
Comparing this with                          = 0, we obtain
                                  n−k
                                                                                      
                # of ( x1 , x2 , . . . , xk ) ∈ Pk satisfying x1 + x2 + · · · + xk = n
                                   
                                          n−1
                                                
                            
                   n−1
                                                , if n > 0;
               =              =           k−1                        (by Exercise 2.10.1 (a)) .
                   n−k             
                                    [ k = 0] ,      if n = 0
                 n−1
                             
         =                                                                            (310)
              n − ( q − 1)
for each n ∈ N.
  Now, let n ∈ N. We shall compute the # of x1 , x2 , . . . , xq ∈ Pq satisfying
                                                                         
x1 + x2 + · · · + xq = n.
  First, we notice that if x1 , x2 , . . . , xq ∈ Pq satisfies x1 + x2 + · · · + xq = n, then
                                               
   # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n
                                                                     
  = ∑ # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n and xq = p .
                                                                                         
       p∈[n]
to n − p instead of n) yields
                                                                                         
                                           q −1
          # of x1 , x2 , . . . , xq−1 ∈ P
                                     
                                                satisfying x1 + x2 + · · · + xq−1 = n − p
                    (n − p) − 1
                                    
        =                              .                                                    (311)
              ( n − p ) − ( q − 1)
                 x1 , x2 , . . . , xq ∈ Pq | x1 + x2 + · · · + xq = n and xq = p
                                    
                  n                                                                       o
                → x 1 , x 2 , . . . , x q −1 ∈ Pq −1 | x 1 + x 2 + · · · + x q −1 = n − p
                                            
                                                                                   
that sends each q-tuple x1 , x2 , . . . , xq to x1 , x2 , . . . , xq−1 . Conversely, we can
define a map
                 n                                                                           o
                                                   q −1
                    x 1 , x 2 , . . . , x q −1 ∈ P
                                              
                                                        | x 1 + x 2 + · · · + x q −1 = n − p
                 → x1 , x2 , . . . , xq ∈ Pq | x1 + x2 + · · · + xq = n and xq = p
                                              
                                                                                              
that sends each (q − 1)-tuple x1 , x2 , . . . , xq−1 to x1 , x2 , . . . , xq−1 , p (because if
 x1 , x2 , . . . , xq−1 ∈ Pq−1 satisfies x1 + x2 + · · · + xq−1 = n − p, then the entries of
                         
                                                 
the q-tuple x1 , x2 , . . . , xq−1 , p sum up to x1 + x2 + · · · + xq−1 + p = (n − p) + p =
                                                              |          {z           }
                                                                     =n− p
n). These two maps are mutually inverse, and thus are bijections. Hence, the
bijection principle yields
         x1 , x2 , . . . , xq ∈ Pq | x1 + x2 + · · · + xq = n and xq = p
                               
         n                                                                            o
              x 1 , x 2 , . . . , x q −1 ∈ Pq −1 | x 1 + x 2 + · · · + x q −1 = n − p
                                        
     =
                                                                                       
     = # of x1 , x2 , . . . , xq−1 ∈ Pq−1 satisfying x1 + x2 + · · · + xq−1 = n − p
                                           
               (n − p) − 1
                                        
     =                                          (by (311)) .                            (312)
          ( n − p ) − ( q − 1)
Forget that we fixed p. We thus have proved (312) for each p ∈ [n]. Now, we can
267 because
                                                                                                        
              n = x 1 + x 2 + · · · + x q = x 1 + x 2 + · · · + x q −1 + x q = x 1 + x 2 + · · · + x q −1 + p
                                                                        |{z}
                                                                       =p
Enumerative Combinatorics: class notes                                                  page 430
   # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n
                                                                                  
  = ∑ # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n and xq = p
                                                                                         
     p∈[n]
           |                                                {z                            }
                              =|{( x1 ,x2 ,...,xq )∈Pq | x1 + x2 +···+ xq =n and xq = p}|
                                                       (n − p) − 1
                                                                          
                                             =
                                                   ( n − p ) − ( q − 1)
                                                                (by (312))
                                                   n
                       (n − p) − 1                               (n − p) − 1
                                                                                 
  =    ∑           ( n − p ) − ( q − 1)
                                              =   ∑          ( n − p ) − ( q − 1)
      p∈[n]                                       p =1
      |{z}
         n
      =∑
        p =1
      n −1 
                  j−1
                              
  =   ∑        j − ( q − 1)
                                                                                           (313)
      j =0
                                                                        j−1
                                                                                 
(since j − (q − 1) − 1 = j − q). Solving this equation for                          , we obtain
                                                                     j − ( q − 1)
                      j−1                                                 j−1
                                                                           
                                                        j
                                   =                                  −
                   j − ( q − 1)                  j − ( q − 1)             j−q
                                               |       {z     }
                                                  ( j + 1) − 1
                                                                  
                                      =
                                          (( j + 1) − 1) − (q − 1)
                                                         (since j=( j+1)−1)
                                                     ( j + 1) − 1          j−1
                                                                            
                                          =                             −
                                              (( j + 1) − 1) − (q − 1)     j−q
                                              ( j + 1) − 1        j−1
                                                                   
                                          =                   −                            (314)
                                              ( j + 1) − q        j−q
(since (( j + 1) − 1) − (q − 1) = ( j + 1) − q).
   Forget that we fixed j. We thus have proved (314) for each j ∈ Z.
Enumerative Combinatorics: class notes                                              page 431
   # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n
                                                                     
     n −1
                         j−1
                               
  = ∑
     j =0
                   j − ( q − 1)
             |           {z  }
             ( j + 1) − 1        j−1
                                     
          =                   −
             ( j + 1) − q        j−q
                    (by (314))
     n−1 
             ( j + 1) − 1     j−1          ((n − 1) + 1) − 1     0−1
                                                                
   = ∑                     −          =                       −
     j =0
             ( j + 1) − q     j−q          ((n − 1) + 1) − q     0−q
                                                                         j−1
                                                                           
            by Theorem 2.1.1, applied to u = 0 and v = n − 1 and a j =
                                                                         j−q
        n−1         0−1
                       
   =             −              (since (n − 1) + 1 = n and 0 − q = −q) .
        n−q           −q
  But q is positive, and thus −q is negative.            −q ∈
                                                  Hence,      / N. Hence, (43) (applied
                                                   0−1
to 0 − 1 and −q instead of n and k) yields                = 0. Thus, we obtain
                                                    −q
             # of x1 , x2 , . . . , xq ∈ Pq satisfying x1 + x2 + · · · + xq = n
                                                                               
                                                                                  n−1
                                                                                       
                                  q
       # of x1 , x2 , . . . , xq ∈ P satisfying x1 + x2 + · · · + xq = n =
                                                                         
                                                                                  n−q
for each n ∈ N. In other words, (239) holds for k = q. This completes the induction
step.
   Thus, we have proved (239) by induction. Now, for each n ∈ N and k ∈ N, we
have
                                                                                   
                                               k
              # of ( x1 , x2 , . . . , xk ) ∈ P satisfying x1 + x2 + · · · + xk = n
                 n−1
                        
            =                           (by (239))
                 n−k
               
                n − 1 , if n > 0;
                           
               
            =       k−1                               (by Exercise 2.10.1 (a)) .
               
                [ k = 0] ,          if n = 0
    we obtain
                                                                                                  
             
                                                      k                                           k
                                                                                                  
                    # of ( x1 , x2 , . . . , xk ) ∈ {0, 1} satisfying x1 + x2 + · · · + xk = n =     .
                                                                                                  n
    In other words, Theorem 2.10.4 holds for our k and n. We have thus shown that Theorem 2.10.4
    holds under the assumption that k = 0. Hence, Theorem 2.10.4 holds for k = 0.
Enumerative Combinatorics: class notes                                                                 page 433
  Induction step: Let q be a positive integer. Assume (as the induction hypothesis)
that Theorem 2.10.4 holds for k = q − 1. We must show that Theorem 2.10.4 holds
for k = q.
  We have assumed that Theorem 2.10.4 holds for k = q − 1. In other words, we
have
                                                                                     
        # of x1 , x2 , . . . , xq−1 ∈ {0, 1}q−1 satisfying x1 + x2 + · · · + xq−1 = n
                                   
           q−1
               
      =                                                                                 (315)
             n
for each n ∈ Z.
   Now, let n ∈ Z. We shall compute the # of x1 , x2 , . . . , xq ∈ {0, 1}q satisfying
                                                                        
x1 + x2 + · · · + xq = n.
   Clearly, if x1 , x2 , . . . , xq ∈ {0, 1}q satisfies x1 + x2 + · · · + xq = n, then xq ∈
                                   
         q−1
                 
    =                .                                                                    (316)
         n−p
                                                                                    
that sends each (q − 1)-tuple x1 , x2 , . . . , xq−1 to x1 , x2 , . . . , xq−1 , p (because if
 x1 , x2 , . . . , xq−1 ∈ {0, 1}q−1 satisfies x1 + x2 + · · · + xq−1 = n − p, then the entries
                         
269 because
                                                                                                        
              n = x 1 + x 2 + · · · + x q = x 1 + x 2 + · · · + x q −1 + x q = x 1 + x 2 + · · · + x q −1 + p
                                                                        |{z}
                                                                       =p
Enumerative Combinatorics: class notes                                                   page 434
                                         
of the q-tuple x1 , x2 , . . . , xq−1 , p sum up to x1 + x2 + · · · + xq−1 + p = (n − p) +
                                                    |        {z          }
                                                                        =n− p
p = n). These two maps are mutually inverse, and thus are bijections. Hence, the
bijection principle yields
        q−1
                 
   =                            (by (316)) .                                        (317)
        n−p
  Forget that we fixed p. We thus have proved (317) for each p ∈ {0, 1}. Now, we
can continue our computation from before:
          q−1       q−1
                                                                                       
   q                                                   by Theorem 1.3.8, applied to q and n
      =           +                                                                               ,
   n      n−1        n                                         instead of n and k
we obtain
                                                                                       
                                             q                                       q
      # of x1 , x2 , . . . , xq        ∈ {0, 1} satisfying x1 + x2 + · · · + xq = n =     .
                                                                                       n
for each n ∈ Z. In other words, Theorem 2.10.4 holds for k = q. This completes the
induction step. Thus, Theorem 2.10.4 is proved by induction.
Enumerative Combinatorics: class notes                                             page 435
and then use the bijection principle (and Proposition 1.1.11). All these approaches
can be easily adapted to yield Exercise 2.10.5 (b) as well.
    We shall, however, use the conceptually simplest approach: We will first solve
Exercise 2.10.5 (b) by deriving it from Theorem 2.10.4, and then solve Exercise 2.10.5
(a) by summing the result over all k. So let us start with the solution to Exercise
2.10.5 (b):
    (b) If (u1 , u2 , . . . , uk ) is a {1, 2}-composition of n into k parts, then
(u1 − 1, u2 − 1, . . . , uk − 1) is a k-tuple ( x1 , x2 , . . . , xk ) ∈ {0, 1}k satisfying x1 + x2 +
· · · + xk = n − k 270 . Hence, we can define a map
      Thus, we have shown that (u1 − 1, u2 − 1, . . . , uk − 1) ∈ {0, 1}k and (u1 − 1) + (u2 − 1) + · · · +
    (uk − 1) = n − k. In other words, (u1 − 1, u2 − 1, . . . , uk − 1) is a k-tuple ( x1 , x2 , . . . , xk ) ∈ {0, 1}k
    satisfying x1 + x2 + · · · + xk = n
                                      n − k. Qed.                                                          o
271 Proof.   Let ( p1 , p2 , . . . , pk ) ∈   ( x1 , x2 , . . . , xk ) ∈ {0, 1}k | x1 + x2 + · · · + xk = n − k .      Thus,
                                                                      k
    ( p1 , p2 , . . . , pk ) is a k-tuple ( x1 , x2 , . . . , xk ) ∈ {0, 1} satisfying x1 + x2 + · · · + xk = n − k. In
    other words, ( p1 , p2 , . . . , pk ) ∈ {0, 1}k is a k-tuple satisfying p1 + p2 + · · · + pk = n − k. We must
    prove that ( p1 + 1, p2 + 1, . . . , pk + 1) is a {1, 2}-composition of n into k parts.
        We have ( p1 , p2 , . . . , pk ) ∈ {0, 1}k . In other words, p1 , p2 , . . . , pk ∈ {0, 1}. Hence,
    p1 + 1, p2 + 1, . . . , pk + 1 ∈ {1, 2} (since q + 1 ∈ {1, 2} for each q ∈ {0, 1}). Hence,
    ( p1 + 1, p2 + 1, . . . , pk + 1) ∈ {1, 2}k ⊆ Pk (since {1, 2} ⊆ P).                                In other words,
      p
    ( 1   +  1,   p 2  +  1, . . . , p k + 1 ) is a k-tuple  of  positive integers (since P is the set of all positive inte-
Enumerative Combinatorics: class notes                                                              page 438
   Clearly, the maps A and B are mutually inverse (since the map A subtracts 1
from each entry of the k-tuple it is applied to, whereas the map B adds 1 to each
entry of the k-tuple it is applied to). Thus, the map A is invertible, i.e., is a bijection.
Hence, the bijection principle yields
Hence,
 ( p1 + 1) + ( p2 + 1) + · · · + ( pk + 1) = ( p1 + p2 + · · · + pk ) + (1 + 1 + · · · + 1) = (n − k) + k = n.
                                             |         {z          } |           {z       }
                                                     =n−k                     k times
                                                                        |        {z       }
                                                                             =k
Hence,
               (# of {1, 2} -compositions of n)
               =      ∑ |(# of {1, 2} -compositions    of n whose length is k )
                  k∈{0,1,...,n}                    {z                      }
                  | {z }                             k
                        n                       =
                     =∑                            n−k
                          k =0                                  (by (318))
                     n                     n
                                                    n−k
                                                          
                               k
               =   ∑          n−k
                                        = ∑
                                                 n − (n − k)
                   k =0                   k =0 |
                                                    {z  }
                                                    n−k
                                                 =
                                                       k
                                               (since n−(n−k)=k)
                      (here, we have substituted n − k for k in the sum)
                   n
                        n−k
                            
               = ∑             .
                 k =0
                         k
272 Proof.   Let s be a {1, 2}-composition of n. We must prove that the length of s is an element of
    {0, 1, . . . , n}.
       We know that s is a {1, 2}-composition of n. In other words, s is a composition ( x1 , x2 , . . . , xk )
    of n such that x1 , x2 , . . . , xk ∈ {1, 2} (by the definition of a “{1, 2}-composition of n”). Hence,
    s has the form s = ( x1 , x2 , . . . , xk ), where ( x1 , x2 , . . . , xk ) is a composition of n such that
    x1 , x2 , . . . , xk ∈ {1, 2}. Consider this ( x1 , x2 , . . . , xk ). From s = ( x1 , x2 , . . . , xk ), we conclude
    that the length of s is k.
       Lemma 7.48.1 yields k ≤ n. Hence, k ∈ {0, 1, . . . , n} (since k ∈ N). In other words, k is an
    element of {0, 1, . . . , n}. In other words, the length of s is an element of {0, 1, . . . , n} (since the
    length of s is k). Qed.
Enumerative Combinatorics: class notes                                                                  page 440
                                                                                                   n+k−1
                                                                                                      
                                            k
           # of ( x1 , x2 , . . . , xk ) ∈ N satisfying x1 + x2 + · · · + xk = n =                         .
                                                                                                     n
Proof of Lemma 7.49.1. If n ∈ N, then this follows immediately from (243). Hence,
for the rest of this proof, we WLOG assume             that n ∈ / N. Hence, (43) (applied to
                                                        n+k−1
                                                                 
n + k − 1 and n instead of n and k) yields                         = 0.
                                                            n
  But there exists no ( x1 , x2 , . . . , xk ) ∈ Nk satisfying x1 + x2 + · · · + xk = n 273 .
Hence,
                                                                                 
            # of ( x1 , x2 , . . . , xk ) ∈ Nk satisfying x1 + x2 + · · · + xk = n = 0.
                                  n+k−1
                                               
Comparing this with                                 = 0, we obtain
                                    n
                                                                                                 n+k−1
                                                                                                    
                                        k
         # of ( x1 , x2 , . . . , xk ) ∈ N satisfying x1 + x2 + · · · + xk = n =                         .
                                                                                                   n
Thus,
                        n                                                                    o
                                                      k
              |U | =        ( x1 , x2 , . . . , x k ) ∈ N | x1 + x2 + · · · + x k = n
                                                                                                             
                   = # of ( x1 , x2 , . . . , xk ) ∈ Nk satisfying x1 + x2 + · · · + xk = n
                       n+k−1
                                
                   =                             (by Lemma 7.49.1) .
                         n
This shows that U is a finite set. Also, clearly, U ⊆ Nk (by the definition of U).
  For each i ∈ {1, 2, . . . , k }, we define a subset Ai of U by
Ai = {( x1 , x2 , . . . , xk ) ∈ U | xi ≥ p} . (320)
(by (320)).
  Now, we claim the following:
Statement 1: We have
              U \ ( A1 ∪ A2 ∪ · · · ∪ A k )
                 n                                                                         o
                                                                k
              = ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1} | x1 + x2 + · · · + xk = n .
          U \ ( A1 ∪ A2 ∪ · · · ∪ A k )
             n                                                                          o
          ⊆ ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k | x1 + x2 + · · · + xk = n .                          (322)
274
      not have (y1 , y2 , . . . , yk ) ∈ Ai (since t = (y1 , y2 , . . . , yk )). Because of the equivalence (321), we can
      thus conclude that we do not have yi ≥ p. In other words, we have yi < p. But yi ∈ N (since
      (y1 , y2 , . . . , yk ) ∈ Nk ). Hence, yi ∈ {0, 1, . . . , p − 1} (since yi ∈ N and yi < p).
        Forget that we fixed i. We thus have proved that yi ∈ {0, 1, . . . , p − 1} for each i ∈ {1, 2, . . . , k}.
      Therefore, (y1 , y2 , . . . , yk ) ∈ {0, 1, . . . , p − 1}k . Thus, (y1 , y2 , . . . , yk ) is an ( x1 , x2 , . . . , xk ) ∈
      {0, 1, . . . , p − 1}k satisfying x1 + x2 + · · · + xk = n (since y1 + y2 + · · · + yk = n). In other words,
                                        n                                                                            o
               (y1 , y2 , . . . , yk ) ∈ ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k | x1 + x2 + · · · + xk = n .
             U \ ( A1 ∪ A2 ∪ · · · ∪ A k )
                n                                                                         o
                                                               k
             = ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1} | x1 + x2 + · · · + xk = n .
 [Proof of Statement 2: We shall use the Iverson bracket notation (as defined in
Definition 1.3.15). Corollary 1.6.3 (a) (applied to S = [k ] and T = I) yields
                                                 |I| =     ∑      [s ∈ I ] =      ∑        [i ∈ I ]                             (324)
                                                          s∈[k]                  i ∈[k]
                  q1 + q2 + · · · + q k
                                k
                   =          ∑                        qi                 =   ∑        p [i ∈ I ] = p   ∑        [i ∈ I ]
                             i =1                                             i ∈[k]                    i ∈[k]
                                                      |{z}
                            |{z}                     = p [i ∈ I ]                                       |        {z      }
                       =         ∑           (by the definition of qi )                                        =| I |
                           i ∈{1,2,...,k }
                                                                                                            (by (324))
                            = ∑
                               i ∈[k ]
                   = p |I| .
   n                                                                               o
       ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k | x1 + x2 + · · · + xk = n . In other words,
    n                                                                               o
        ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k | x1 + x2 + · · · + xk = n ⊆ U \ ( A1 ∪ A2 ∪ · · · ∪ Ak ) .
                                                 α : P → Q,
                                ( y1 , y2 , . . . , y k ) 7 → ( y1 − q1 , y2 − q2 , . . . , y k − q k ) .
   ( y1 − q1 ) + ( y2 − q2 ) + · · · + ( y k − q k ) = ( y1 + y2 + · · · + y k ) − ( q1 + q2 + · · · + q k ) = n − p | I | .
                                                       |         {z           } |            {z           }
                                                                        =n                           = p| I |
    In
    n        other            words,    (y1 − q1 , y2 − q2 , . . . , yk − qo
                                                                           k)  ∈                      Q           (since      Q     =
      ( x1 , x2 , . . . , xk ) ∈ N | x1 + x2 + · · · + xk = n − p | I | ). Qed.
                                  k
define a map
                                          β : Q → P,
                          ( z1 , z2 , . . . , z k ) 7 → ( z1 + q1 , z2 + q2 , . . . , z k + q k ) .
The maps α and β are mutually inverse278 , and thus are bijective. Hence, in
For each i ∈ {1, 2, . . . , k}, we have zi ∈ N (since (z1 , z2 , . . . , zk ) is an element of Nk ) and thus
                                            zi +              qi                ∈ N.
                                           |{z}              |{z}
                                           ∈N             = p[i ∈ I ]∈N
                                                   (since p∈N and [i ∈ I ]∈N)
                  ( z1 + q1 ) + ( z2 + q2 ) + · · · + ( z k + q k )
                  = (z1 + z2 + · · · + zk ) + (q1 + q2 + · · · + qk ) = (n − p | I |) + p | I | = n.
                      |        {z           } |              {z     }
                              =n− p| I |                    = p| I |
(z1 + q1 , z2 + q2 , . . . , zk + qk ) ∈ {( x1 , x2 , . . . , xk ) ∈ U | xi ≥ p} .
                                                     n − p |I| + k − 1
                                                                      
              |{s ∈ U | s ∈ Ai for all i ∈ I }| =                        .
                                                        n − p |I|
         U \ ( A1 ∪ A2 ∪ · · · ∪ A k )
            n                                                                         o
                                                           k
         = ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1} | x1 + x2 + · · · + xk = n .
Hence,
  |U \ ( A1 ∪ A2 ∪ · · · ∪ Ak )|
      n                                                                          o
  = ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k | x1 + x2 + · · · + xk = n
                                                                                             
  = # of ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k satisfying x1 + x2 + · · · + xk = n .
Enumerative Combinatorics: class notes                                                          page 447
Thus,
                                                                                                    
        # of ( x1 , x2 , . . . , xk ) ∈ {0, 1, . . . , p − 1}k satisfying x1 + x2 + · · · + xk = n
    = |U \ ( A1 ∪ A2 ∪ · · · ∪ Ak )|
    =     ∑     (−1)| I | |{s ∈ U | s ∈ Ai for all i ∈ I }|
         I ⊆[k]
                          |               {z              }
                                   n − p |I| + k − 1
                                                    
                               =
                                      n − p |I|
                                         (by Statement 2)
      • we let a // b denote the quotient obtained when dividing a by b (in the sense
        of division with remainder);
Proof of Proposition 7.50.2. (a) Proposition 7.50.2 (a) is [19s, Corollary 2.6.9 (d)] (with
u and n renamed as a and b).
  (b) Proposition 7.50.2 (b) is the first claim of [19s, Corollary 2.6.9 (a)] (with u and
n renamed as a and b).
  (c) Let a ∈ N. Then, Proposition 7.50.2 (b) yields a%b ∈ {0, 1, . . . , b − 1}, so that
a%b ≤ b − 1 < b. But Proposition 7.50.2 (a) yields
              a = ( a // b) · b + ( a%b) < ( a // b) · b + b = (( a // b) + 1) b.
                                  | {z }
                                   <b
Hence,
                      (( a // b) + 1) b > a ≥ 0         (since a ∈ N) .
We can divide both sides of this inequality by b (since b is positive), and thus obtain
( a // b) + 1 > 0. In other words, a // b > −1. Since a // b ∈ Z, we thus conclude
that a // b ≥ (−1) + 1 = 0. In other words, a // b ∈ N. This proves Proposition
7.50.2 (c).
   (d) Proposition 7.50.2 (d) is [19s, Exercise 2.6.4 (c)] (with n renamed as b).
   (e) Proposition 7.50.2 (e) is [19s, Exercise 2.6.4 (d)] (with n renamed as b).
Solution to Exercise 2.10.7. This will be a proof by double counting. We shall count
the n-tuples ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k in two different
ways.
  The first way is easy: The equality (243) (applied to k and n instead of n and k)
shows that
                                                                                 k+n−1
                                                                                         
                                       n
    (# of ( x1 , x2 , . . . , xn ) ∈ N satisfying x1 + x2 + · · · + xn = k) =
                                                                                    k
         n+k−1
                      
    =                                                                                     (326)
              k
Enumerative Combinatorics: class notes                                                         page 449
(since k + n = n + k).
   The second way is trickier. Let me first outline the idea, before showing the
argument in full detail.
→ {n-tuples ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k}
that sends
                                                                    
                                                q1 q2 · · ·     qn
                      each 2 × n-table
                                                r1 r2 · · ·     rn
                      to the n-tuple (2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn ) .
          (# of n-tuples ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k)
           = (# of nice tables) ,                                                                  (327)
                                                                           
                                                           q1 q2 · · · q n
where a “nice table” shall mean a 2 × n-table                                  with q1 , q2 , . . . , qn ∈
                                                           r1 r2 · · · r n
N and r1 , r2 , . . . , rn ∈ {0, 1} satisfying 2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) =
k. It thus remains to count the nice tables.               But we can do  this using the sum
                                                        q1 q2 · · · q n
rule: Define the top-sum of a nice table                                     to be the sum q1 +
                                                         r1 r2 · · · r n
q2 + · · · + qn . The top-sum of a nice table is always a nonnegative integer ≤ k
(actually, ≤ bk/2c, but we will not use this stronger statement), i.e., an element of
{0, 1, . . . , k}. Moreover, for each i ∈ {0, 1, . . . , k}, the product rule yields
                                                               n+i−1
                                                                                
                                                                               n
                   (# of nice tables with top-sum i ) =                              ,
                                                                   i        k − 2i
Enumerative Combinatorics: class notes                                                        page 450
                                                                          
                                                        q1 q2 · · ·   qn
because we can construct a nice table                                          with top-sum i by the
                                                        r1 r2 · · ·   rn
following algorithm:
      • First, choose the n entries q1 , q2 , . . . , qn of the top row of the table. These n
        entries must belong to N and sum to q1 + q2 + · · · + qn = i; in other words, we
        are choosing an n-tuple (q1 , q2 , . . . , qn ) ∈ Nn satisfying q1 + q2 + · · · + qn = i.
        Thus, (243) (applied  to i 
                                   and n
                                        instead of      n and k) shows that the # of options
                          i+n−1           n+i−1
                        
        at this step is              =                    .
                            i                     i
      • Then, choose the n entries r1 , r2 , . . . , rn of the bottom row of the table. These n
        entries must belong to {0, 1} and sum to r1 + r2 + · · · + rn = k − 2i (since we
        want to have 2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) = k, but we have q1 +
        q2 + · · · + qn = i); in other words, we are choosing an n-tuple (r1 , r2 , . . . , rn ) ∈
        {0, 1}n satisfying r1 + r2 + · · · + rn = k − 2i. Thus, Theorem 2.10.4 (applied
         k − 2i and n instead of n and k) shows that the # of options at this step is
        to
             n
                    .
          k − 2i
Combining these observations using the sum rule, we obtain (# of nice tables) =
       n+i−1
                    
  k               n
  ∑                      . In view of (327), this rewrites as
i =0     i      k − 2i
              (# of n-tuples ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k)
                   k 
                       n+i−1
                                              
                                         n
              =∑                                  .
                 i =0
                          i          k − 2i
   Detailed argument: Here comes the detailed (and formalized) version of the argu-
ment we just outlined.                                                        
                                                     279   q1 q2 · · · q n
   We define a nice table to mean a 2 × n-table                                   with q1 , q2 , . . . , qn ∈
                                                           r1 r2 · · · r n
N and r1 , r2 , . . . , rn ∈ {0, 1} satisfying 2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) =
k.                                                        
                                          q1 q2 · · · q n
   The top-sum of a nice table                                  is defined to be the sum q1 +
                                          r1 r2 · · · r n
q2 + · · · + q n .
   We now state our first observation:
Statement 1: We have
                   (# of ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k)
                   = (# of nice tables) .
279 i.e.,   a rectangular table with 2 rows and n columns
Enumerative Combinatorics: class notes                                                                       page 451
                                                     
                                    q1 q2 · · · q n
  [Proof of Statement 1: If                             is a nice table, then
                                    r1 r2 · · · r n
(2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn ) is an n-tuple ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 +
x2 + · · · + xn = k 280 . Hence, we can define a map
              A : {nice tables} → {( x1 , x2 , . . . , xn ) ∈ Nn | x1 + x2 + · · · + xn = k } ,
                             
             q1 q2 · · · q n
                                7→ (2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn ) .
             r1 r2 · · · r n
                                        
280 Proof.           q1 q2 · · · q n
           Let                               be a nice table. According to the definition of a “nice ta-
                     r1 r2 · · · r n
    ble”, this means that q1 , q2 , . . . , qn ∈ N and r1 , r2 , . . . , rn ∈ {0, 1} and 2 (q1 + q2 + · · · + qn ) +
    (r1 + r2 + · · · + rn ) = k. Hence, for each i ∈ [n], we have qi ∈ N (since q1 , q2 , . . . , qn ∈ N)
    and ri ∈ {0, 1} (since r1 , r2 , . . . , rn ∈ {0, 1}) and thus, 2 qi +               ri     ∈ N. In other
                                                                               |{z}    |{z}
                                                                                ∈N      ∈{0,1}⊆N
    words, the n numbers 2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn all belong to N. In other words,
    (2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn ) ∈ Nn .
        Hence, (2q1 + r1 , 2q2 + r2 , . . . , 2qn + rn ) is an n-tuple ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 +
    · · · + xn = k (since
    ). Qed.
Enumerative Combinatorics: class notes                                                                        page 452
         B : {( x1 , x2 , . . . , xn ) ∈ Nn | x1 + x2 + · · · + xn = k } → {nice tables} ,
                                                                                                   
                                                                      x1 // 2 x2 // 2 · · · xn // 2
                                      ( x1 , x2 , . . . , x n ) 7 →                                   .
                                                                      x1 %2 x2 %2 · · · xn %2
281 Proof.    Let ( x1 , x2 , . . . , xn ) ∈ Nn be an n-tuple satisfying x1 + x2 + · · · + xn = k. We have
    x1 , x2 , . . . , xn ∈ N (since ( x1 , x2 , . . . , xn ) ∈ Nn ). Thus, for each i ∈ [n], we have xi ∈ N and there-
    fore xi // 2 ∈ N (by Proposition 7.50.2 (c), applied to a = xi and b = 2). In other words, the n
    numbers x1 // 2, x2 // 2, . . . , xn // 2 all belong to N. In other words, x1 // 2, x2 // 2, . . . , xn // 2 ∈ N.
       Furthermore, for each i ∈ [n], we have
    In other words, the n numbers x1 %2, x2 %2, . . . , xn %2 all belong to {0, 1}. In other words,
    x1 %2, x2 %2, . . . , xn %2 ∈ {0, 1}.
       Finally, for each i ∈ [n], we have xi = ( xi // 2) · 2 + ( xi %2) (by Proposition 7.50.2 (a), applied
    to a = xi and b = 2). In other words, we have the n equalities
                                             x1 = ( x1 // 2) · 2 + ( x1 %2) ,
                                             x2 = ( x2 // 2) · 2 + ( x2 %2) ,
                                               ..
                                                .
                                             xn = ( xn // 2) · 2 + ( xn %2) .
             x1 + x2 + · · · + x n
             = (( x1 // 2) · 2 + ( x1 %2)) + (( x2 // 2) · 2 + ( x2 %2)) + · · · + (( xn // 2) · 2 + ( xn %2))
             = (( x1 // 2) + ( x2 // 2) + · · · + ( xn // 2)) · 2 + (( x1 %2) + ( x2 %2) + · · · + ( xn %2))
             = 2 (( x1 // 2) + ( x2 // 2) + · · · + ( xn // 2)) + (( x1 %2) + ( x2 %2) + · · · + ( xn %2)) .
    In other words,                                                            
                                         x1 // 2 x2 // 2 · · · xn // 2
                                         x1 %2      x2 %2 · · · xn %2
                                             
                         q1 q2 · · · q n
    is a 2 × n-table                             with q1 , q2 , . . . , qn ∈ N and r1 , r2 , . . . , rn ∈ {0, 1} satisfying
                          r1 r2 · · · r n
    2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) = k. In other words,
                                                                               
                                         x1 // 2 x2 // 2 · · · xn // 2
                                         x1 %2      x2 %2 · · · xn %2
    is a nice table (because this is how a “nice table” was defined). Qed.
Enumerative Combinatorics: class notes                                                                               page 453
                                               x1 = 2 ( x1 // 2) + ( x1 %2) ,
                                               x2 = 2 ( x2 // 2) + ( x2 %2) ,
                                                 ..
                                                  .
                                               xn = 2 ( xn // 2) + ( xn %2) .
Hence,
A ( B (x)) = ( x1 , x2 , . . . , xn ) = x = id (x) .
        We have          T ∈ {nice tables}; in other words, T is a nice table. In other words, T is a
                             q1 q2 · · · q n
     2 × n-table                                     with q1 , q2 , . . . , qn ∈ N and r1 , r2 , . . . , rn ∈ {0, 1} satisfying
                             r1 r2 · · · r n
     2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) = k (since this is how a “nice table” is defined). Con-
     sider these q1 , q2 , . . . , qn and r1 , r2 , . . . , rn . Thus,
                                                                                
                                                              q1 q2 · · · q n
                                                T=                                 .                                      (329)
                                                              r1 r2 · · · r n
Enumerative Combinatorics: class notes                                                                                  page 454
                      |{( x1 , x2 , . . . , xn ) ∈ Nn | x1 + x2 + · · · + xn = k}|
                      = |{nice tables}| .
In other words,
              (# of ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k)
              = (# of nice tables) .
(by the definition of A). Define an integer xi by xi = 2qi + ri for each i ∈ [n]. Thus,
   Comparing this with (330), we obtain A (T) = ( x1 , x2 , . . . , xn ). Applying the map B to both sides
   of this equality, we find
                                                                                          
                                                             x1 // 2 x2 // 2 · · · xn // 2
                 B ( A (T)) = B ( x1 , x2 , . . . , xn ) =                                           (331)
                                                             x1 %2   x2 %2 · · · xn %2
xi // 2 = qi and xi %2 = ri
   [Proof of Statement 2: Let T be a nice table. We must show that the top-sum of T
belongs to {0, 1, . . . , k }.
   We have assumed that T is a nice table.        According to            the definition of a “nice
                                                      q1 q2 · · · q n
table”, this means that T is a 2 × n-table                                    with q1 , q2 , . . . , qn ∈ N
                                                      r1 r2 · · · r n
and r1 , r2 , . . . , rn ∈ {0, 1} satisfying 2 (q1 + q2 + · · · + qn ) + (     r1 + r2 + · · · + r n )  =
                                                                                   q1 q2 · · · q n
k. Consider these q1 , q2 , . . . , qn and r1 , r2 , . . . , rn . Thus, T =                                .
                                                                                   r1 r2 · · · r n
Hence, the top-sum of T is q1 + q2 + · · · + qn (by the definition of “top-sum”).
   We have r1 , r2 , . . . , rn ∈ {0, 1}. Thus, r1 , r2 , . . . , rn are nonnegative integers. Hence,
their sum r1 + r2 + · · · + rn is a nonnegative integer. Thus, r1 + r2 + · · · + rn ≥ 0.
   Moreover, from q1 , q2 , . . . , qn ∈ N, we obtain q1 + q2 + · · · + qn ∈ N. Thus,
q1 + q2 + · · · + qn ≥ 0, so that
                          2 ( q1 + q2 + · · · + q n ) ≥ q1 + q2 + · · · + q n .
But from 2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) = k, we obtain
                       k = 2 ( q1 + q2 + · · · + q n ) + (r1 + r2 + · · · + r n )
                                                         |        {z           }
                                                                      ≥0
                         ≥ 2 ( q1 + q2 + · · · + q n ) ≥ q1 + q2 + · · · + q n .
In other words, q1 + q2 + · · · + qn ≤ k. Combining this with q1 + q2 + · · · + qn ∈ N,
we obtain q1 + q2 + · · · + qn ∈ {0, 1, . . . , k }. In other words, q1 + q2 + · · · + qn
belongs to {0, 1, . . . , k }. In other words, the top-sum of T belongs to {0, 1, . . . , k }
(since the top-sum of T is q1 + q2 + · · · + qn ). This completes the proof of Statement
2.]
   Finally, let us count the nice tables with a given top-sum i ∈ {0, 1, . . . , k }:
       Statement 3: Let i ∈ {0, 1, . . . , k }. Then,
                                                                    n+i−1
                                                                                      
                                                                                    n
               (# of nice tables having top-sum i ) =                                      .
                                                                      i           k − 2i
Define a set
           R = ( x1 , x2 , . . . , xn ) ∈ {0, 1}n | x1 + x2 + · · · + xn = k − 2i .
              
Thus,
   | R| = ( x1 , x2 , . . . , xn ) ∈ {0, 1}n | x1 + x2 + · · · + xn = k − 2i
          
                        ((q1 , q2 , . . . , qn ) , (r1 , r2 , . . . , rn )) ∈ Q × R
Enumerative Combinatorics: class notes                                                                           page 457
                                                        
284 Proof.                 q1 q2 · · · q n
               Let                                          be a nice table having top-sum i. We must prove that
                           r1 r2 · · · r n
    ((q1 , q2 , . . . , qn ) , (r1 , r2 , . . . , rn )) ∈ Q × 
                                                               R.
                                      q1 q2 · · · q n
      We know that                                                is a nice table. According to the definition of a “nice
                                      r1 r2 · · · r n
    table”, this means that q1 , q2 , . . . , qn ∈ N and r1 , r2 , . . . , rn ∈ {0, 1} and 2 (q1 + q2 + · · · + qn ) +
    (r1 + r2 + · · · + rn ) = k.                                                  
                                                                q1 q2 · · · q n
      Also, we know that the nice table                                              has top-sum i. Hence, the top-sum of
                                                                r1 r2 · · · r n
                                                          
                               q1 q2 · · · q n
    the nice table                                           is i. Thus,
                                r1 r2 · · · r n
                                                                                
                                                             q1   q2   ···   qn
               i=        the top-sum of the nice table                                 = q1 + q2 + · · · + q n
                                                             r1   r2   ···   rn
                                r1 + r2 + · · · + rn = k − 2 (q1 + q2 + · · · + qn ) = k − 2i.
                                                             |        {z          }
                                                                       =i
                                                                                                                            
285 Proof.                                                                                             q1   q2   ···    qn
             Let ((q1 , q2 , . . . , qn ) , (r1 , r2 , . . . , rn )) ∈ Q × R. We must prove that                                 ∈
                                                                                                       r1   r2   ···    rn
    {nice tables having top-sum i }.
      We have ((q1 , q2 , . . . , qn ) , (r1 , r2 , . . . , rn )) ∈ Q × R. In other words, (q1 , q2 , . . . , qn ) ∈ Q and
    (r1 , r2 , . . . , rn ) ∈ R.
      We have (q1 , q2 , . . . , qn ) ∈ Q = {( x1 , x2 , . . . , xn ) ∈ Nn | x1 + x2 + · · · + xn = i }. In other
    words, (q1 , q2 , . . . , qn ) is an ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = i. In other
    words, (q1 , q2 , . . . , qn ) ∈ Nn and q1 + q2 + · · · + qn = i.
      We have (r1 , r2 , . . . , rn ) ∈ R = ( x1 , x2 , . . . , xn ) ∈ {0, 1}n | x1 + x2 + · · · + xn = k − 2i . In
    other words, (r1 , r2 , . . . , rn ) is an ( x1 , x2 , . . . , xn ) ∈ {0, 1}n satisfying x1 + x2 + · · · + xn = k − 2i.
    In other words, (r1 , r2 , . . . , rn ) ∈ {0, 1}n and r1 + r2 + · · · + rn = k − 2i.
      Now,
                             2 (q1 + q2 + · · · + qn ) + (r1 + r2 + · · · + rn ) = 2i + (k − 2i ) = k.
                               |        {z          } |               {z        }
                                      =i                       =k−2i
Hence,
            (# of ( x1 , x2 , . . . , xn ) ∈ Nn satisfying x1 + x2 + · · · + xn = k)
                                               k 
                                                   n+i−1
                                                                   
                                                                n
            = (# of nice tables) = ∑                                   .
                                             i =0
                                                     i        k − 2i
                         k
                                  n+i−1                                    n+k−1
                                                                            
                                                        n
                       ∑            i                 k − 2i
                                                                   =
                                                                             k
                                                                                   .
                       i =0
                                         k
                                                  x+i−1                                     x+k−1
                                                                                               
                                                                        x
                                     ∑              i                 k − 2i
                                                                                   =
                                                                                              k
                                                                                                                       (334)
                                     i =0
                     k
                               X+i−1                                                                    X+k−1
                                                                                                         
                                                           X
              P=    ∑            i                       k − 2i
                                                                               and             Q=
                                                                                                          k
                                                                                                                .
                   i =0
             x+k−1                                                X+k−1
                                                                    
  Q (x) =                      by Proposition 2.6.12, since Q =
                 k                                                  k
and
                                              k
                                                        x+i−1
                                                                                 
                                                                             x
                         P (x) =             ∑            i                k − 2i
                                                                                               (likewise) .
                                             i =0
In view of these two equalities, we can rewrite (334) as
P (x) = Q (x) .
                           k
                                     X+i−1
                                                               
                                                           X
                   P=     ∑            i                 k − 2i
                          i =0
                           k
                               ( X + i − 1) ( X + i − 2) · · · ( X + 1) X
                     =    ∑                        i!
                          i =0
                                 
                                  X ( X − 1) ( X − 2) · · · ( X − (k − 2i ) + 1) , if k − 2i ∈ N;
                                 
                               ·                      (k − 2i )!
                                                                                              /N
                                 
                                 0,                                                if k − 2i ∈
   and
                                         X+k−1                  ( X + k − 1) ( X + k − 2) · · · ( X + 1) X
                                                       
                          Q=                                =                                              .
                                           k                                       k!
Enumerative Combinatorics: class notes                                         page 461
Hence, we know that P ( x ) = Q ( x ) holds for all x ∈ N (because we know that (334)
holds for all x ∈ N). Therefore, Corollary 2.6.10 yields P = Q. Thus, P ( x ) = Q ( x )
for all x ∈ R. In other words,
                       k
                                 x+i−1                             x+k−1
                                                                      
                                                x
                      ∑            i          k − 2i
                                                           =
                                                                     k
                      i =0
                               x+k−1                          x+i−1
                                                                         
                                                         k               x
for all x ∈ R (since Q ( x ) =           and P ( x ) = ∑                        for
                                  k                    i =0     i      k − 2i
each x ∈ R). Applying this to x = n, we obtain
                       k
                                 n+i−1                             n+k−1
                                                                    
                                                n
                      ∑            i          k − 2i
                                                           =
                                                                     k
                                                                           .
                      i =0
                                                           n−1
                                                                                  
                                                                               n
   We can split off the addend for k = 0 from the sum ∑ k        . This yields
                                                      k =0 k−1
             n                      n              n 
             n−1             n−1        n−1             n−1
                                                       
        ∑ k k−1           =0
                             0−1
                                   +∑k
                                        k − 1
                                                = ∑k
                                                        k−1
        k =0               | {z } k=1             k =1
                                    =0
                             n −1
                                            n−1
                                                    
                          = ∑ ( k + 1)
                            k =0
                                        ( k + 1) − 1
                                       |  {z  }
                                             n−1
                                        =
                                               k
                                 (here, we have substituted k + 1 for k in the sum)
                            n −1                         n −1  
                                             n−1                    n−1       n−1
                                                                              
                          = ∑ ( k + 1)                 = ∑ k              +
                            k =0
                                                k        k = 0
                                                                     k          k
                                    |      {z      }
                                      n−1        n−1
                                          
                                 =k          +
                                        k         k
                                 n −1                      n −1 
                                         n−1                      n−1
                                                                     
                          =       ∑k k              +      ∑ k
                                 k =0                      k =0
                                 |      {z     }           |     {z    }
                                  =(n−1)·2(n−1)−1                          =2n −1
                                  (by Exercise 1.3.6,              (by Corollary 1.3.27,
                             applied to n−1 instead of n)       applied to n−1 instead of n)
                          = (n − 1) · 2| (n− 1)−1   n −1
                                           {z } + 2|{z} = (n − 1) · 2
                                                                      n −2
                                                                           + 2 · 2n −2
                                             =2n −2       =2 ·2n −2
                                                  n −2
                          = ((n − 1) + 2) 2              = ( n + 1 ) 2n −2 .
                            |    {z     }
                                    = n +1
Therefore,
Now,
         =           ∑                    ∑                (the length of α)
             k ∈{0,1,...,n}     α is a composition of n;
                                                           |       {z      }
                                  (the length of α)=k                =k
                                                                                      
                          by (37), because if α is any composition of n,
                              then (the length of α) ∈ {0, 1, . . . , n}
         =           ∑                                     ∑                k
             k∈{0,1,...,n}                    α is a composition of n;
                                                (the length of α)=k
                                              |            {z               }
                                =|{α is a composition of n | (the length of α)=k}|·k
         =           ∑        |{α is a composition of n | (the length of α) = k}| ·k
             k∈{0,1,...,n}
                              |                      {z                       }
             |       {z     }                         n−1
                      n                           =
                     =∑                               k−1
                     k =0                                      (by (335))
                 n                        n
                         n−1           n−1
                                                        
         =   ∑           k−1
                             ·k = ∑ k
                                       k−1
                                                                = ( n + 1 ) 2n −2       (by Lemma 7.52.1) .
             k =0                 k =0
                                          T → N,
                                          t 7→ (# of i ∈ [k ] satisfying ai = t) .
  Indeed, Definition 7.53.1 is simply a more explicit restatement of the last sentence
of Definition 2.11.1.289
289 Infact, in the last sentence of Definition 2.11.1, we said that a multisubset of T given as a map
    f : T → N shall be denoted by { a1 , a2 , . . . , ak }multi if ( a1 , a2 , . . . , ak ) is a list of elements of T such
    that each t ∈ T appears in this list exactly f (t) times. In other words, { a1 , a2 , . . . , ak }multi is the
Enumerative Combinatorics: class notes                                                                   page 465
Solution to Exercise 2.11.1. Definition 7.53.1 shows that { a1 , a2 , . . . , ak }multi is the mul-
tisubset of T defined as the map
                                T → N,
                                t 7→ (# of i ∈ [k ] satisfying ai = t) .
Let us denote this map by f . Thus, { a1 , a2 , . . . , ak }multi = f . Hence,
(the size of { a1 , a2 , . . . , ak }multi ) = (the size of f )
                                             =∑             f (t)                               (by Definition 2.11.2)
                                               t∈ T
                                                            |{z}
                                                        =(# of i ∈[k] satisfying ai =t)
                                                          (by the definition of f )
                                             =   ∑ (# of i ∈ [k]          satisfying ai = t) .
                                                 t∈ T
                          T → N,
                           t 7→ (# of times t appears in the list ( a1 , a2 , . . . , ak )) .
   But this is equivalent to the definition of { a1 , a2 , . . . , ak }multi in Definition 7.53.1, because each
   t ∈ T satisfies
  Definition 7.54.3. Let T be a set. Let f and g be two multisubsets of T. Then, the
  map
                                      T → N,
                                      t 7→ f (t) + g (t)
  The multisubset f ∪ g is an analogue of the union of two sets, but it takes the
multiplicities into account: If an element of T appears a times in f and appears b
times in g, then it appears a + b times in f ∪ g. For example, {1, 3, 4, 4, 5}multi ∪
{2, 3, 4}multi = {1, 2, 3, 3, 4, 4, 4, 5}multi .
  Let us prove a few properties of this “multisubset union” f ∪ g:
                                      T → N,
                                      t 7→ f (t) + g (t)
  is a multisubset of T.
     (b) We have | f ∪ g| = | f | + | g|.
     (c) We have f ⊆ f ∪ g and g ⊆ f ∪ g.
     (d) We have f ∪ g = g ∪ f .
Enumerative Combinatorics: class notes                                                               page 467
Proof of Proposition 7.54.4. We know that f and g are multisubsets of T; thus, f and
g are maps from T to N.
   We know that f is a multisubset of T. According to Definition 2.11.1, this means
that only finitely many t ∈ T satisfy f (t) 6= 0. Hence, we know that only finitely
many t ∈ T satisfy f (t) 6= 0. In other words, the set {t ∈ T | f (t) 6= 0} is finite.
Similarly, the set {t ∈ T | g (t) 6= 0} is finite.
   (a) We know that f and g are maps from T to N. Hence, each t ∈ T satisfies
f (t) ∈ N and g (t) ∈ N and therefore f (t) + g (t) ∈ N. Thus, the map
                                            T → N,
                                            t 7→ f (t) + g (t)
                                              T → N,
                                               t 7→ f (t) + g (t)
    is a multisubset of T. According to Definition 2.11.1, this means showing that only finitely many
    t ∈ T satisfy f (t) + g (t) 6= 0. Thus, we need to show that only finitely many t ∈ T satisfy
    f (t) + g (t) 6= 0. In other words, we need to show that the set {t ∈ T | f (t) + g (t) 6= 0} is
    finite.
       Let s ∈ {t ∈ T | f (t) + g (t) 6= 0}.        We shall show that s ∈ {t ∈ T | f (t) 6= 0} ∪
    { t ∈ T | g ( t ) 6 = 0}.
       Indeed, assume the contrary. Hence, s ∈    / {t ∈ T | f (t) 6= 0} ∪ {t ∈ T | g (t) 6= 0}. In other
    words, we have both s ∈   / {t ∈ T | f (t) 6= 0} and s ∈
                                                           / { t ∈ T | g ( t ) 6 = 0}.
       But s ∈ {t ∈ T | f (t) + g (t) 6= 0}. Thus, s is a t ∈ T satisfying f (t) + g (t) 6= 0. In other
    words, s ∈ T and f (s) + g (s) 6= 0.
       If we had f (s) 6= 0, then s would be an element t ∈ T satisfying f (t) 6= 0, and therefore
    we would have s ∈ {t ∈ T | f (t) 6= 0}; but this would contradict s ∈            / { t ∈ T | f ( t ) 6 = 0}.
    Hence, we cannot have f (s) 6= 0. Thus, we must have f (s) = 0. Similarly, g (s) = 0. Hence,
    f (s) + g (s) = 0, which contradicts f (s) + g (s) 6= 0.
    |{z} |{z}
      =0       =0
      This contradiction shows that our assumption was false. Hence, s ∈ {t ∈ T | f (t) 6= 0} ∪
    {t ∈ T | g (t) 6= 0} is proved.
      Now, forget that we fixed s. We thus have proved that s ∈ {t ∈ T | f (t) 6= 0} ∪
    {t ∈ T | g (t) 6= 0} for each s ∈ {t ∈ T | f (t) + g (t) 6= 0}. In other words,
                                              T → N,
                                               t 7→ f (t) + g (t)
    is a multisubset of T. Qed.
Enumerative Combinatorics: class notes                                                                           page 468
  (b) The equality (336) yields | f | = ∑ f (t). Also, applying (336) to g instead of
                                                         t∈ T
f , we find | g| = ∑ g (t). Adding these two equalities together, we obtain
                        t∈ T
           =   ∑ ( f (t) + g (t)) ,
               t∈ T
Proof of Proposition 7.54.5. Definition 7.53.1 says that { a1 , a2 , . . . , ak }multi is the mul-
tisubset of T defined as the map
                                  T → N,
                                  t 7→ (# of i ∈ [k ] satisfying ai = t) .
                    { a1 , a2 , . . . , ak }multi (t)
                    = (# of i ∈ [k] satisfying ai = t)
                    = (# of times t appears in the k-tuple ( a1 , a2 , . . . , ak )) .                  (339)
       { a1 , a2 , . . . , ak , b1 , b2 , . . . , b` }multi (t)
       = (# of times t appears in the (k + `) -tuple ( a1 , a2 , . . . , ak , b1 , b2 , . . . , b` )) .
       { a1 , a2 , . . . , ak , b1 , b2 , . . . , b` }multi (t)
       = (# of times t appears in the (k + `) -tuple ( a1 , a2 , . . . , ak , b1 , b2 , . . . , b` ))
       = (# of times t appears in the k-tuple ( a1 , a2 , . . . , ak ))
           |                                          {z              }
                                     ={ a1 ,a2 ,...,ak }multi (t)
                                            (by (339))
                 + (# of times t appears in the `-tuple (b1 , b2 , . . . , b` ))
                   |                        {z                                 }
                                               ={b1 ,b2 ,...,b` }multi (t)
                                                     (by (340))
        = { a1 , a2 , . . . , ak }multi (t) + {b1 , b2 , . . . , b` }multi (t) .                        (341)
                                                     T → N,
                                                     t 7→ g (t) − f (t)
   Proposition 7.54.7. Let T be a set. Let f and g be two multisubsets of T such that
   f ⊆ g.
     (a) The map
                                                     T → N,
                                                     t 7→ g (t) − f (t)
   is a multisubset of T.
      (b) We have ( g \ f ) ∪ f = g.
      (c) We have g \ f ⊆ g.
Proof of Proposition 7.54.7. (a) We have f ⊆ g. In other words, each t ∈ T satisfies
f (t) ≤ g (t) (by Definition 7.54.2). Hence, each t ∈ T satisfies g (t) − f (t) ∈ N
(since the previous sentence says that f (t) ≤ g (t), hence g (t) ≥ f (t) and therefore
g (t) − f (t) ∈ N 292 ). Thus, the map
                                                   T → N,
                                                   t 7→ g (t) − f (t)
is well-defined. Moreover, it is easy to see that this map is a multisubset of T                                             293 .
Proof of Proposition 7.54.8. Proposition 7.54.4 (c) (applied to g and f instead of f and
g) yields g ⊆ g ∪ f and f ⊆ g ∪ f . Hence, ( g ∪ f ) \ f is well-defined. Moreover, for
each t ∈ T, we have
                                ( g ∪ f ) (t) = g (t) + f (t)                       (343)
(by the definition of g ∪ f ). Hence, for each t ∈ T, we have
Supp ({ a1 , a2 , . . . , ak }multi ) = { a1 , a2 , . . . , ak } .
                           T → N,
                           t 7→ (# of i ∈ [1] satisfying u = t) .
Hence,
                      {u}multi (t) = (# of i ∈ [1] satisfying u = t)                    (346)
for each t ∈ T.
   Let t ∈ T. We shall show that {u}multi (t) ≤ f (t).
   Indeed, assume the contrary. Thus, {u}multi (t) > f (t). But f (t) ∈ N (since
f is a map from T to N), hence f (t) ≥ 0. Thus, {u}multi (t) > f (t) ≥ 0. In
view of (346), this rewrites as (# of i ∈ [1] satisfying u = t) > 0. In other words,
there exists at least one i ∈ [1] satisfying u = t. Thus, of course, we have u = t
(since the statement “u = t” does not depend on i). Hence, t = u ∈ Supp f =
{s ∈ T | f (s) 6= 0}. In other words, t is an s ∈ T such that f (s) 6= 0. In other
words, t ∈ T and f (t) 6= 0. From f (t) 6= 0, we obtain f (t) ≥ 1 (since f (t) ∈ N).
Hence, {u}multi (t) > f (t) ≥ 1.
   But (346) becomes
This contradicts {u}multi (t) > 1. This contradiction shows that our assumption
was wrong. Hence, {u}multi (t) ≤ f (t) is proven.
   Forget that we fixed t. We thus have showed that each t ∈ T satisfies {u}multi (t) ≤
f (t). This means that {u}multi ⊆ f (according to Definition 7.54.2). Thus, we have
shown that {u}multi ⊆ f . This proves Proposition 7.54.11 (a).
   (b) Exercise 2.11.1 (applied to 1 and the 1-tuple (u) instead of k and the k-tuple
( a1 , a2 , . . . , ak )) yields that the multisubset {u}multi of T has size 1. In other words,
|{u}multi | = 1 (since the size of {u}multi is denoted by |{u}multi |).
Enumerative Combinatorics: class notes                                                             page 474
  We have {u}multi ⊆ f (by Proposition 7.54.11 (a)). Thus, Proposition 7.54.7 (b)
(applied to {u}multi and f instead of f and g) yields ( f \ {u}multi ) ∪ {u}multi = f .
Hence, f = ( f \ {u}multi ) ∪ {u}multi . Thus,
                                               ∑                    f (t) =    ∑         f (t) ,
                                          t∈Supp f                              t∈ T;
                                          | {z }                              f (t)6=0
                                          =  ∑
                                            t∈ T;
                                          f (t)6=0
                            (since Supp f ={t∈ T | f (t)6=0})
  We shall prove this by induction on the size of this multisubset; the induction
base will rely on the following simple fact (an analogue of [Grinbe15, Proposition
2.48]):
Enumerative Combinatorics: class notes                                                               page 476
                                  T → N,
                                  t 7→ (# of i ∈ [0] satisfying ai = t) .
294    Hence, for each t ∈ T, we have
294 Being   able to write down this map is the reason why we denoted the 0-tuple () by ( a1 , a2 , . . . , a0 ).
Enumerative Combinatorics: class notes                                                         page 477
In other words, f = {}multi (since both f and {}multi are maps from T to N). This
proves Proposition 7.54.16 (a).
   (b) The empty list () satisfies f = {}multi (as we have just proved). Thus, the
empty list () is a tuple (s1 , s2 , . . . , sk ) of elements of T such that f = {s1 , s2 , . . . , sk }multi
and s1 ≤ s2 ≤ · · · ≤ sk (indeed, the chain of inequalities s1 ≤ s2 ≤ · · · ≤ sk is vac-
uously true for the empty list (), because it contains no inequality signs). In other
words, the empty list () is an increasing list of f (by the definition of an increasing
list). It remains to show that it is the only increasing list of f .
   Let (s1 , s2 , . . . , sk ) be any increasing list of f . Thus, (s1 , s2 , . . . , sk ) is a tuple of
elements of T such that f = {s1 , s2 , . . . , sk }multi and s1 ≤ s2 ≤ · · · ≤ sk (by the
definition of an increasing list). But Exercise 2.11.1 (applied to ai = si ) yields that
the multisubset {s1 , s2 , . . . , sk }multi of T has size k. In other words, the multisubset f
of T has size k (since f = {s1 , s2 , . . . , sk }multi ). In other words, | f | = k (since the size
of f is denoted by | f |). Thus, k = | f | = 0. Hence, (s1 , s2 , . . . , sk ) = (s1 , s2 , . . . , s0 ) =
().
   Now, forget that we fixed (s1 , s2 , . . . , sk ). We thus have shown that if (s1 , s2 , . . . , sk )
is any increasing list of f , then (s1 , s2 , . . . , sk ) = (). In other words, any increasing
list of f is (). Therefore, the multisubset f has exactly one increasing list: namely,
the empty list () (since we already know that () is an increasing list of f ). This
proves Proposition 7.54.16 (b).
  The induction step of our proof of Proposition 7.54.15 will rely on the following
fact (an analogue of [Grinbe15, Proposition 2.49]):
                                        = f \ {m}multi .
Thus, f \ {m}multi = {s1 , s2 , . . . , sk−1 }multi .
  Now, we know that (s1 , s2 , . . . , sk−1 ) is a list of elements of T such that f \
{m}multi = {s1 , s2 , . . . , sk−1 }multi and s1 ≤ s2 ≤ · · · ≤ sk−1 . In other words,
(s1 , s2 , . . . , sk−1 ) is an increasing list of f \ {m}multi (by the definition of an “in-
creasing list”). This proves Proposition 7.54.17 (c).
   We are now ready to prove Proposition 7.54.15:
Proof of Proposition 7.54.15. We shall prove Proposition 7.54.15 by induction on | f |:
  Induction base: Proposition 7.54.15 holds under the condition that | f | = 0 295 .
This completes the induction base.
295 Proof.
         Let f be as in Proposition 7.54.15, and assume that | f | = 0. We must show that the claim
    of Proposition 7.54.15 holds.
      Indeed, Proposition 7.54.16 (b) shows that the multisubset f has exactly one increasing list.
    Thus, the claim of Proposition 7.54.15 holds. This completes our proof.
Enumerative Combinatorics: class notes                                                       page 479
  Induction step: Let g ∈ N. Assume that Proposition 7.54.15 holds under the
condition that | f | = g. We shall now show that Proposition 7.54.15 holds under the
condition that | f | = g + 1.
  We have assumed that Proposition 7.54.15 holds under the condition that | f | = g.
In other words,
                                                                      
                      if f is a multisubset of T satisfying | f | = g,
                                                                         .     (350)
                          then f has exactly one increasing list
Hence,                
                          t1 , t2 , . . . , t j = Supp ( f \ {m}multi ) ⊆ Supp f .
  We claim that
                                        t 1 ≤ t 2 ≤ · · · ≤ t j +1 .                             (351)
   [Proof of (351): If j + 1 ≤ 1, then the chain of inequalities (351) is vacuously true
(since it contains no inequality signs). Thus, for the rest of this proof of (351), we
Enumerative Combinatorics: class notes                                                         page 480
WLOG assume that we don’t have j + 1 ≤ 1. Hence, j + 1 > 1, so that j > 0 and
thus j ≥ 1 (since j is an integer). Hence, t j is well-defined. We have j ≥ 1 and thus
                          
j ∈ [ j]. Hence, t j ∈ t1 , t2 , . . . , t j ⊆ Supp f .
    But m is the largest element of Supp f . Hence, m ≥ x for each x ∈ Supp f .
Applying this to x = t j , we obtain m ≥ t j (since t j ∈ Supp f ). Thus, t j ≤ m = t j+1
(since t j+1 = m). Combining the chain of inequalities t1 ≤ t2 ≤ · · · ≤ t j with the
single inequality t j ≤ t j+1 , we obtain the longer chain of inequalities t1 ≤ t2 ≤
· · · ≤ t j ≤ t j+1 . In other words, t1 ≤ t2 ≤ · · · ≤ t j+1 . This proves (351).]
    Next, we shall prove that
                                             
                                       f = t1 , t2 , . . . , t j+1 multi .          (352)
  It is now easy to prove the two propositions that Exercise 2.11.2 wants us to
prove:
Proof of Proposition 2.11.5. Proposition 7.54.15 (applied to f = S) shows that S has
exactly one increasing list. In other words, there exists exactly one increasing list of
S. In other words, there exists a unique increasing list of S. In other words, there ex-
ists a unique tuple (s1 , s2 , . . . , sk ) of elements of T such that S = {s1 , s2 , . . . , sk }multi
and s1 ≤ s2 ≤ · · · ≤ sk (because an increasing list of S is defined to be a tuple
(s1 , s2 , . . . , sk ) of elements of T such that S = {s1 , s2 , . . . , sk }multi and s1 ≤ s2 ≤
· · · ≤ sk ). In other words, there exists a unique tuple (s1 , s2 , . . . , sk ) of integers in T
satisfying S = {s1 , s2 , . . . , sk }multi and s1 ≤ s2 ≤ · · · ≤ sk (because elements of T are
the same as integers in T). In other words, there exists a unique tuple (s1 , s2 , . . . , sk )
of integers in T satisfying {s1 , s2 , . . . , sk }multi = S and s1 ≤ s2 ≤ · · · ≤ sk (because
“S = {s1 , s2 , . . . , sk }multi ” is equivalent to “{s1 , s2 , . . . , sk }multi = S”). This proves
Proposition 2.11.5.
   Now, Proposition 2.11.6 can be derived from Proposition 2.11.5 in the same way
as Proposition 1.4.13 was derived from Proposition 1.4.11 (in the solution to Exer-
cise 1.4.2):
Enumerative Combinatorics: class notes                                                                                  page 482
Proof of Proposition 2.11.6. Proposition 2.11.5 yields that there exists a unique tuple
(s1 , s2 , . . . , sk ) of integers in T satisfying {s1 , s2 , . . . , sk }multi
                                                                                = S and s1 ≤ s2 ≤
                                                                                                  ··· ≤
sk . Consider this tuple, and denote it by t1 , t2 , . . . , t p . Thus, t1 , t2 , . . . , t p is the
unique tuple of integers in T satisfying t1 , t2 , . . . , t p multi = S and t1 ≤ t2 ≤ · · · ≤
tp.
 Exercise 2.11.1 (applied to p and ti instead of k and ai ) yields that the multisubset
  t1 , t2 , . . . , t p multi of T has size p. In other words, the multisubset S of T has size
                
p (since t1 , t2 , . . . , t p multi = S). This rewrites as |S| = p (since the size of S is
denoted by |S|). But we know that S has size m; in other words, we have |S| = m
(since the size of S is denoted by |S|). Comparing this with |S| = p, we obtain
p = m.                                         
 Recall that the tuple t1 , t2 , . . . , t p is a p-tuple of integers in T satisfying
  t1 , t2 , . . . , t p multi = S and t1 ≤ t2 ≤ · · · ≤ t p . In view of p = m, we can rewrite
this as follows: The tuple (t1 , t2 , . . . , tm ) is an m-tuple of integers in T satisfying
{t1 , t2 , . . . , tm }multi = S and t1 ≤ t2 ≤ · · · ≤ tm . Hence, there exists at least one
m-tuple (s1 , s2 , . . . , sm ) of integers in T satisfying {s1 , s2 , . . . , sm }multi = S and s1 ≤
s2 ≤ · · · ≤ sm (namely, the m-tuple (t1 , t2 , . . . , tm )). Furthermore, there exists at
most one such m-tuple (s1 , s2 , . . . , sm ) 296 . Combining the claims of the preceding
two sentences, we conclude that there exists a unique m-tuple (s1 , s2 , . . . , sm ) of
integers in T satisfying {s1 , s2 , . . . , sm }multi = S and s1 ≤ s2 ≤ · · · ≤ sm . This proves
Proposition 2.11.6.
   Thus, Proposition 2.11.5 and Proposition 2.11.6 are proven, so that Exercise 2.11.2
is solved.
         n
        |{z}          − n 1 − n 2 − · · · − n i −1 = ( n 1 + n 2 + · · · + n k ) − n 1 − n 2 − · · · − n i −1
  =n1 +n2 +···+nk
                                                          = n i + n i +1 + · · · + n k = s i                                  (355)
296 Proof.
                                                    
              Recall that t1 , t2 , . . . , t p is the unique tuple (s1 , s2 , . . . , sk ) of integers in T satisfying
    {s1 , s2 , . . . , sk }multi = S and s1 ≤ s2 ≤ · · · ≤ sk . Hence, if (s1 , s2 , . . . , sk ) is any tuple of integers
    in T satisfying        {s1 , s2 , . . . , sk }multi = S and s1 ≤ s2 ≤ · · · ≤ sk , then (s1 , s2 , . . . , sk ) must equal
     t1 , t2 , . . . , t p . Applying this to k = m, we conclude that if (s1 , s2 , . . . , sm ) is any m-tuple of
    integers in T satisfying            {s1 , s2 , . . . , sm }multi = S and s1 ≤ s2 ≤ · · · ≤ sm , then (s1 , s2 , . . . , sm ) must
    equal t1 , t2 , . . . , t p . Thus, there exists at most one such m-tuple (s1 , s2 , . . . , sm ).
Enumerative Combinatorics: class notes                                                                         page 483
    are all empty products (since k = 0) and thus equal 1 as well. Hence, the claim of Proposition
    2.12.4 (a) boils down to 1 = 1 = 1 = 1, which is obvious. Thus, Proposition 2.12.4 (a) is proved
    under the assumption that k = 0.
Enumerative Combinatorics: class notes                                                                 page 484
                   n − n 1 − n 2 − · · · − n i −1
                                                   
                                                      s          si !
                                                   = i =                    .
                                ni                    ni   n i ! · s i +1 !
This proves Observation 1.]
                                                  n − n 1 − n 2 − · · · − n k −1
                                                                                  
       Observation 2: We have                                                          = 1.
                                                               nk
      n
     |{z}          − n 1 − n 2 − · · · − n k −1 = ( n 1 + n 2 + · · · + n k ) − n 1 − n 2 − · · · − n k −1 = n k .
=n1 +n2 +···+nk
            n − n 1 − n 2 − · · · − n k −1
                                              
                                                nk
Hence,                                       =     = 1 (by Exercise 1.3.2, applied to nk
                               nk               nk
instead of n). This proves Observation 2.]
    Now,
   k 
        n − n 1 − n 2 − · · · − n i −1
                                       
 ∏                     n
 i =1 |                {zi             }
                        si !
                =
                  n i ! · s i +1 !
               (by Observation 1)
                                          k
   k                           ∏ si !
         si !
=∏                  =        i =1
     n ! · s i +1 !
                                          
                       k             k
 i =1 i
                       ∏ n i ! · ∏ s i +1 !
                                 i =1             i =1
                 s1 ! · (s2 !s3 ! · · · sk !)
=
    (n1 !n2 ! · · · nk !) · (s2 !s3 ! · · · sk !) · sk+1 !
                                                                                             
                             k
                 since ∏ si ! = s1 !s2 ! · · · sk ! = s1 ! · (s2 !s3 ! · · · sk !)           
                           i =1                                                              
                                                                                             
                                          k                                                  
         
                                   and ∏ ni ! = n1 !n2 ! · · · nk !                          
                                                                                              
                                        i =1                                                 
                      k                                                                      
           and ∏ si+1 ! = s2 !s3 ! · · · sk+1 ! = (s2 !s3 ! · · · sk !) · sk+1 !
                                                                                             
                   i =1
                                                                                                  
               s1 !                          n!
=                                =                                since s1 = n and sk+1 ! = 0! = 1
  (n1 !n2 ! · · · nk !) · sk+1 !   (n1 !n2 ! · · · nk !) · 1                        |{z}
                                                                                                  =0
           n!
=                       .                                                                                 (356)
    n1 !n2 ! · · · nk !
Enumerative Combinatorics: class notes                                                                             page 485
                                                                     
                                                      n
   But the definition of                                                  yields
                                              n1 , n2 , . . . , n k
                             
              n                             n!
                                  =
      n1 , n2 , . . . , n k         n1 !n2 ! · · · nk !
                                      k 
                                            n − n 1 − n 2 − · · · − n i −1
                                                                           
                                  =∏                                                 (by (356))
                                    i =1
                                                         ni
                                               n − n1      n − n1 − n2             n − n 1 − n 2 − · · · − n k −1
                                                                                                           
                                       n
                                  =                                          ···
                                       n1         n2             n3                             nk
                                               n − n1      n − n1 − n2             n − n 1 − n 2 − · · · − n k −2
                                                                                                           
                                       n
                                  =                                          ···
                                       n1         n2             n3                           n k −1
                                              n − n 1 − n 2 − · · · − n k −1
                                                                            
                                          ·
                                                            nk
                                            |               {z                }
                                                                 =1
                                                          (by Observation 2)
                                         (here, we have split off the last factor from our product)
                                             n − n1      n − n1 − n2             n − n 1 − n 2 − · · · − n k −2
                                                                                                         
                                       n
                                  =                                        ···
                                       n1      n2              n3                           n k −1
                                    k −1 
                                           n − n 1 − n 2 − · · · − n i −1
                                                                          
                                  =∏                                        .
                                    i =1
                                                        ni
(since any product of elements of N must itself belong to N). This proves Proposi-
tion 2.12.4 (b). 298
298 This   proof of Proposition 2.12.4 (b) is essentially taken from [Grinbe15, solution to Exercise 3.1].
Enumerative Combinatorics: class notes                                                                              page 486
    Example 7.56.2. The map f : {2, 5, 6, 9, 10} → [2] that sends 2, 6, 9 to 1 and sends
    5, 10 to 2 is (3, 2)-fine, since it satisfies
299 Proof.
         Consider the situation of Proposition 7.56.3, and assume that k = 0. We must show that
    Proposition 7.56.3 holds.
      Definition 2.12.1 yields
                                 
                    n                        n!                    0!
                                    =                     =                         (since k = 0 and n = 0)
            n1 , n2 , . . . , n k     n1 !n2 ! · · · nk !   n1 !n2 ! · · · n0 !
                                      0!
                                    =               (since n1 !n2 ! · · · n0 ! = (empty product) = 1)
                                       1
                                    = 0! = 1.
We have
                  | A | = n = n1 + n2 + · · · + n k = n1 + n2 + · · · + n0                  (since k = 0)
                        = (empty sum) = 0.
    Hence, A = ∅. Also, k = 0 and thus [k] = [0] = ∅. Thus, there exists no i ∈ [k].
       Both sets A and [k] are empty (since A = ∅ and [k ] = ∅). Hence, there exists exactly
    one map f : A → [k] (namely, the map that sends nothing to nothing). This map f satisfies
    (357) (since (357) is a vacuously true statement (because there exists no i ∈ [k])), and thus is
    (n1 , n2 , . . . , nk )-fine (by the definition of “(n1 , n2 , . . . , nk )-fine”). Thus, there exists exactly one
    (n1 , n2 , . . . , nk )-fine map f : A → [k] (namely, the map         we just found).        In other words, the # of
                                                                                    n
    (n1 , n2 , . . . , nk )-fine maps f : A → [k] is 1. In view of                                  = 1, we can rewrite this as
                                                                            n1 , n
                                                                                  2 , . . . , nk           
                                                                                               n
    follows: The # of (n1 , n2 , . . . , nk )-fine maps f : A → [k] is                                       . Hence, Proposition
                                                                                     n1 , n2 , . . . , n k
    7.56.3 is proved (under the assumption that k = 0). Thus, Proposition 7.56.3 holds when k = 0.
Enumerative Combinatorics: class notes                                                             page 487
300 For example,if A = {2, 5, 6, 9, 13 } and m = 2, and if f : A → [m] is the map written in two-line
                      2 5 6 9 13
     notation as                          , then J f = {2, 6, 9}, because 2, 6, 9 are precisely the a ∈ A such
                      2 1 2 2 1
     that f ( a) = 2.
301 Proof. Let f : A → [ m ] be an ( n , n , . . . , n )-fine map. Thus, we have
                                      1 2             m
yields
In other words, such a map f must send all elements of J, but no other elements,
to m. In other words, it must send all elements of J to m, and send all other
elements of A to numbers different from m. The latter numbers are, of course, the
elements of [m] \ {m} = [m − 1]. Thus, an (n1 , n2 , . . . , nm )-fine map f : A → [m]
satisfying J f = J must send all elements of J to m, and send all elements of A \ J
to elements of [m − 1]. Hence, if f is such a map, then f is uniquely determined
by its values at the elements of A \ J, and said values must belong to [m − 1]. In
other words, if f is such a map, then f is uniquely determined by its restriction
f | A\ J , and furthermore this restriction must “actually” be a map from A \ J to
[m − 1], in the sense that all its values belong to [m − 1]. Moreover, in order for
the map f to be (n1 , n2 , . . . , nm )-fine, its restriction f | A\ J (regarded as a map from
A \ J to [m − 1]) must be (n1 , n2 , . . . , nm−1 )-fine302 . This is actually a necessary
    (by the definition of “(n1 , n2 , . . . , nm )-fine”). We can apply this to i = m (since m ∈ [m]), and
    thus obtain
                                 (# of a ∈ A such that f ( a) = m) = nm .
    But J f was defined as the set of all a ∈ A such that f ( a) = m. Hence,
J f = (# of a ∈ A such that f ( a) = m) = nm .
    Qed.
302 Proof.   Let f : A → [m] be a map satisfying J f = J. We must prove that the map f is
    (n1 , n2 , . . . , nm )-fine if and only if its restriction f | A\ J (regarded as a map from A \ J to [m − 1])
    is (n1 , n2 , . . . , nm−1 )-fine.
       For each i ∈ [m], we let Ai be the logical statement “(# of a ∈ A such that f ( a) = i ) = ni ”.
       Recall that J f = J, so that
                                                                                               
                           J = J f = { a ∈ A | f ( a) = m}              by the definition of J f .
(# of a ∈ A such that f ( a) = m) = | J | = nm .
    In other words, the statement Am holds (since Am was defined to be the logical statement
    “(# of a ∈ A such that f ( a) = m) = nm ”). In logical notation, this rewrites as follows: Am ⇐⇒
    (true).
Enumerative Combinatorics: class notes                                                                            page 489
     (# of a ∈ A such that f ( a) = i )
     = (# of a ∈ A such that f ( a) = i and a ∈ J ) + (# of a ∈ A such that f ( a) = i and a ∈
                                                                                             / J)
        |                   {z                   }
                                   =0
      = (# of a ∈ A such that f ( a) = i and a ∈
                                               / J)
      = (# of a ∈ A such that a ∈
                                / J and f ( a) = i )
      = (# of a ∈ A \ J such that f ( a) = i )
                                        (# of a ∈ A such that f ( a) = i )
                                        = (# of a ∈ A \ J such that f ( a) = i )                                       (362)
then the map f itself must be (n1 , n2 , . . . , nm )-fine303 . Thus, in order to construct
an (n1 , n2 , . . . , nm )-fine map f : A → [m] satisfying J f = J, we need to construct an
(n1 , n2 , . . . , nm−1 )-fine map f : A \ J → [m − 1]. Hence,
                                                                                           
                # of all (n1 , n2 , . . . , nm ) -fine maps f : A → [m] satisfying J f = J
            = (# of all (n1 , n2 , . . . , nm−1 ) -fine maps f : A \ J → [m − 1]) .                                    (364)
          ( f is (n1 , n2 , . . . , nm ) -fine)
                                                                                                              
                                                                                                               
                                                                                                               
         ⇐⇒ 
                              (# of a ∈ A such that f ( a) = i ) = ni                          for each i ∈ [m]
                                                                                                                
                              |                {z                   }                                          
                                                 ⇐⇒ (Ai holds)
                    (since Ai is the logical statement “(# of a∈ A such that f ( a)=i )=ni ”)
         ⇐⇒ (A1 ∧ A2 ∧ · · · ∧ Am−1 ) ∧ Am 
                                             
                                         |{z}
                                                        ⇐⇒(true)
         ⇐⇒ ((A1 ∧ A2 ∧ · · · ∧ Am−1 ) ∧ (true))
         ⇐⇒ (A1 ∧ A2 ∧ · · · ∧ Am−1 )
                                                                                                  
         ⇐⇒ f | A\ J (regarded as a map from A \ J to [m − 1] ) is (n1 , n2 , . . . , nm−1 ) -fine
     (by (363)). In other words, the map f is (n1 , n2 , . . . , nm )-fine if and only if its restriction f | A\ J
     (regarded as a map from A \ J to [m − 1]) is (n1 , n2 , . . . , nm−1 )-fine. Qed.
303 This was proven in the previous footnote.
304 More precisely, we need to apply the bijection principle to the bijection
                       n                                                                   o
                         (n1 , n2 , . . . , nm ) -fine maps f : A → [m] satisfying J f = J
                          → {(n1 , n2 , . . . , nm−1 ) -fine maps f : A \ J → [m − 1]}
                                         n − nm
                                                            
f : A \ J → [m − 1] is                                         . In other words,
                                  n 1 , n 2 , . . . , n m −1
             (# of all (n1 , n2 , . . . , nm−1 ) -fine maps f : A \ J → [m − 1])
                          n − nm                           (n − nm )!
                                               
              =                                    =
                   n 1 , n 2 , . . . , n m −1          n1 !n2 ! · · · nm−1 !
                                     n − nm
                                                      
(by the definition of                                    ). Thus, (364) becomes
                            n 1 , n 2 , . . . , n m −1
                                                                                                     
               # of all (n1 , n2 , . . . , nm ) -fine maps f : A → [m] satisfying J f = J
               = (# of all (n1 , n2 , . . . , nm−1 ) -fine maps f : A \ J → [m − 1])
                     (n − nm )!
               =                       .                                                                    (365)
                 n1 !n2 ! · · · nm−1 !
  Now, forget that we fixed J. We thus have proved (365) for each subset J of A
satisfying | J | = nm . Hence, (360) becomes
(# of all (n1 , n2 , . . . , nm ) -fine maps f : A → [m])
        ∑
                                                                                                      
=              # of all ( n 1 , n 2 , . . . , n m ) -fine  maps      f : A → [ m ] satisfying J f = J
      J ⊆ A; |                                                {z                                      }
    | J |=nm                                              (n − nm )!
                                                    =
                                                      n1 !n2 ! · · · nm−1 !
                                                      (by (365))
                   (n − nm )!                                                          (n − nm )!
=     ∑        n1 !n2 ! · · · nm−1 !
                                     = (# of subsets J of A satisfying | J | = nm )
                                                                                 } n1 !n2 ! · · · nm−1 !
      J ⊆ A;
                                       |                    {z
    | J |=nm                                                 n!
                                                   =
                                                     nm ! · (n − nm )!
                                                              (by (359))
               n!                   (n − nm )!                   n!                           n!
=                              ·                =                                   =
    nm ! · (n − nm )! n1 !n2 ! · · · nm−1 !        nm ! · (n1 !n2 ! · · · nm−1 !)      n1 !n2 ! · · · nm !
          (since nm ! · (n1 !n2 ! · · · nm−1 !) = (n1 !n2 ! · · · nm−1 !) · nm ! = n1 !n2 ! · · · nm !)
                             
                  n
 =
       n1 , n2 , . . . , n m
                                  
                       n                                        n!
(since                               was defined to be                        ). In other words, the # of
             n1 , n2 , . . . , n m                     n1 !n2 ! · · · nm ! 
                                                                   n
(n1 , n2 , . . . , nm )-fine maps f : A → [m] is                                 . This proves Statement
                                                          n1 , n2 , . . . , n m
2.]
   Now, Statement 2 is proven. In other words, Proposition 7.56.3 holds when
k = m. This completes the induction step. Thus, Proposition 7.56.3 is proved.
Proof of Proposition 2.12.5. We have |[n]| = n. Hence, Proposition 7.56.3          (applied to
                                                                                           n
A = [n]) yields that the # of (n1 , n2 , . . . , nk )-fine maps f : [n] → [k ] is                        .
                                                                                   n1 , n2 , . . . , n k
Enumerative Combinatorics: class notes                                                        page 492
                                                  n                     o
                     f : { a ∈ [ n ] | α a = i } → b ∈ [ n ] | ασ(b) = i ,
                                                 a 7 → σ −1 ( a )
    b ∈ [n] such that ασ(b) = i (since σ−1 ( a) ∈ [n] and ασ(σ−1 (a)) = i). Qed.
Enumerative Combinatorics: class notes                                                             page 493
   If b ∈ [n] satisfies ασ(b) = i, then the element σ (b) is an a ∈ [n] such that α a = i
307 .Hence, the map
                        n                     o
                     g : b ∈ [ n ] | ασ(b) = i → { a ∈ [ n ] | α a = i } ,
                                                       b 7→ σ (b)
is well-defined. Consider this map g.
   It is easy to see that f ◦ g = id 308 . Similarly, g ◦ f = id. Combining f ◦ g = id
with g ◦ f = id, we conclude thatnthe maps f and g are  o mutually inverse. Hence, the
map f : { a ∈ [n] | α a = i } → b ∈ [n] | ασ(b) = i is invertible, i.e., is bijective.
Thus, the bijection principle yields
                                            n                   o
                   |{ a ∈ [n] | α a = i }| = b ∈ [n] | ασ(b) = i .
                                    (# of a ∈ A such that f ( a) = i )
                                    = (# of b ∈ B such that g (b) = i )                                (369)
307 Proof.Let b ∈ [n] satisfy ασ(b) = i. We must prove that the element σ (b) is an a ∈ [n] such that
    α a = i. In other
                   n words, we must prove
                                       o    that σ (b) ∈ [n] and ασ(b) = i. But this is obvious. Qed.
308 Proof.   Let c ∈ b ∈ [n] | ασ(b) = i . We shall show that ( f ◦ g) (c) = id (c).
                                                       ). But ( f ◦ g) (c) = f ( g (c)) = σ−1 ( g (c)) (by the
        Indeed, the definition of g yields g (c)= σ (c
Proof of Theorem 7.58.1. The set A is finite; i.e., there are only finitely many a ∈ A.
Likewise, there are only finitely many b ∈ B.
   Let Y be the subset { f ( a) | a ∈ A} of X. Then, Y is finite (since there are only
finitely many a ∈ A).
   Let Z be the subset { g (b) | b ∈ B} of X. Then, Z is finite (since there are only
finitely many b ∈ B).
   Let W be the union Y ∪ Z. This set W is a finite set (since it is the union of the
two finite sets Y and Z) and is a subset of X (since Y and Z are subsets of X).
   It is easy to see that
         |{ a ∈ A | f ( a) = i }| = (# of a ∈ A such that f ( a) = i )
                                  = (# of b ∈ B such that g (b) = i )               (by (369))
                                  = |{b ∈ B | g (b) = i }| .
309 Proof.  Let c ∈ A. We have Y = { f ( a) | a ∈ A} (by the definition of Y). But from c ∈ A, we obtain
      f (c) ∈ { f ( a) | a ∈ A} = Y ⊆ Y ∪ Z = W (since W was defined to be Y ∪ Z). This proves (370).
310 If you are aware of the Axiom of Choice, you might wonder whether we have used it here. The
     answer is “no, not really”. We have made a choice (namely, choosing a bijection hi ) for each
      i ∈ W. This amounts to finitely many choices (since W is a finite set). But you can make
     finitely many choices without invoking the Axiom of Choice (indeed, this can easily be proved
     by induction on the number of choices). Thus, we are not using the Axiom of Choice here.
Enumerative Combinatorics: class notes                                                               page 495
  For each c ∈ A, the element h f (c) (c) ∈ B is well-defined311 . Hence, we can define
a map
                               u : A → B,
                                     c 7 → h f (c) ( c ) .
                                     −1
  For each d ∈ B, the element h g(d)      (d) ∈ A is well-defined312 . Hence, we can
define a map
                                         v : B → A,
                                                          −1
                                             d 7 → h g(d)      (d) .
Define a map
                                                f : [n] → X,
                                                      a 7→ β a .
    In other words, c ∈ { a ∈ A | f ( a) = i }.
      But i = f (c) ∈ W (by (370)). Hence, hi is a bijection from { a ∈ A | f ( a) = i } to
    {b ∈ B | g (b) = i } (by the definition of hi ). Therefore, hi (c) is a well-defined element of
    {b ∈ B | g (b) = i } (since c ∈ { a ∈ A | f ( a) = i }). Thus, hi (c) ∈ {b ∈ B | g (b) = i } ⊆ B.
      But the definition of u yields u (c) = h f (c) (c) = hi (c) (since f (c) = i).
      Also, u (c) = hi (c) ∈ {b ∈ B | g (b) = i }. In other words, u (c) is a b ∈ B satisfying g (b) = i.
    In other words, u (c) ∈ B and g (u (c)) = i. Now,
                                                   −1
               (v ◦ u) (c) = v (u (c)) = h g(u(c))      (u (c))        (by the definition of v)
                          = (hi )−1 (u (c))       (since g (u (c)) = i )
                          =c         (since u (c) = hi (c))
                          = id (c) .
        Forget that we fixed c. We thus have proved that (v ◦ u) (c) = id (c) for each c ∈ A. In other
     words, v ◦ u = id.
315 Proof. Let c ∈ A. Let i = f ( c ). Then, c is an a ∈ A satisfying f ( a ) = i (since c ∈ A and f ( c ) = i).
     In other words, c ∈ { a ∈ A | f ( a) = i }.
        But i = f (c) ∈ W (by (370)). Hence, hi is a bijection from { a ∈ A | f ( a) = i } to
     {b ∈ B | g (b) = i } (by the definition of hi ). Therefore, hi (c) is a well-defined element of
     {b ∈ B | g (b) = i } (since c ∈ { a ∈ A | f ( a) = i }). Thus, hi (c) ∈ {b ∈ B | g (b) = i }.
        But the definition of u yields u (c) = h f (c) (c) = hi (c) (since f (c) = i). Hence, u (c) = hi (c) ∈
     {b ∈ B | g (b) = i }. In other words, u (c) is a b ∈ B satisfying g (b) = i. In other words,
     u (c) ∈ B and g (u (c)) = i. Comparing f (c) = i with ( g ◦ u) (c) = g (u (c)) = i, we obtain
     f ( c ) = ( g ◦ u ) ( c ).
        Forget that we fixed c. We thus have proved that f (c) = ( g ◦ u) (c) for each c ∈ A. In other
     words, f = g ◦ u.
Enumerative Combinatorics: class notes                                                            page 497
Define a map
                                                g : [n] → X,
                                                      b 7→ αb .
Hence, Theorem 7.58.1 (applied to A = [n] and B = [n]) yields that there exists a
bijection σ : [n] → [n] such that f = g ◦ σ. Consider this σ.
   The map σ is a bijection from [n] to [n]. In other words, σ is a permutation
of [n]. Moreover, we have β i = ασ(i) for each i ∈ [n]                         316 . In other words,
                                                                  
( β 1 , β 2 , . . . , β n ) = α σ (1) , α σ (2) , . . . , α σ ( n ) .
                                                                        
   Hence, β = ( β 1 , β 2 , . . . , β n ) = ασ(1) , ασ(2) , . . . , ασ(n) . Thus, the n-tuple β is ob-
tained from the n-tuple (α1 , α2 , . . . , αn ) by permuting its entries (namely, using the
permutation σ). In other words, β is an anagram of (α1 , α2 , . . . , αn ) (by the definition
of an anagram). In other words, β is an anagram of α (since α = (α1 , α2 , . . . , αn )).
This solves Exercise 2.12.4.
References
[17f-hw1s] Darij Grinberg, UMN Fall 2017 Math 4707 & Math 4990 homework
           set #1 with solutions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/
           hw1s.pdf
[17f-hw2s] Darij Grinberg, UMN Fall 2017 Math 4707 & Math 4990 homework
           set #2 with solutions, http://www.cip.ifi.lmu.de/~grinberg/t/17f/
           hw2s.pdf
[17f-hw3s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #3 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw3os.pdf
[17f-hw4s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #4 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw4os.pdf
[17f-hw5s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #5 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw5os.pdf
[17f-hw6s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #6 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw6os.pdf
[17f-hw7s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #7 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw7os.pdf
[17f-hw8s] Darij Grinberg, UMN Fall 2017 Math 4990 homework set #8 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw8os.pdf
[18f]        Darij Grinberg, UMN Fall 2018 Math 5705: “black”board notes, https:
             //www.cip.ifi.lmu.de/~grinberg/t/18f/
[18f-hw1s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #1 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw1s.pdf
[18f-hw2s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #2 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw2s.pdf
[18f-hw3s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #3 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw3s.pdf
[18f-hw4s] Darij Grinberg, UMN Fall 2018 Math 5705 homework set #4 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw4s.pdf
[18f-mt1s]   Darij Grinberg, UMN Fall 2018 Math 5705 midterm #1 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/18f/mt1s.pdf
[18f-mt2s]   Darij Grinberg, UMN Fall 2018 Math 5705 midterm #2 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/18f/mt2s.pdf
Enumerative Combinatorics: class notes                                     page 499
[18f-mt3s]   Darij Grinberg, UMN Fall 2018 Math 5705 midterm #3 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/18f/mt3s.pdf
[18s]        Darij Grinberg, UMN Spring 2018 Math 4707: “black”board notes, https:
             //www.cip.ifi.lmu.de/~grinberg/t/18s/
[18s-hw1s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #1 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw1s.pdf
[18s-hw2s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #2 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw2s.pdf
[18s-hw3s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #3 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw3s.pdf
[18s-hw4s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #4 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw4s.pdf
[18s-hw5s] Darij Grinberg, UMN Spring 2018 Math 4707 homework set #5 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw5s.pdf
[18s-mt1s]   Darij Grinberg, UMN Spring 2018 Math 4707 midterm #1 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt1s.pdf
[18s-mt2s]   Darij Grinberg, UMN Spring 2018 Math 4707 midterm #2 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt2s.pdf
[19f-hw0s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #0 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw0s.pdf
[19f-hw1s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #1 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw1s.pdf
[19f-hw2s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #2 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw2s.pdf
[19f-hw3s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #3 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw3s.pdf
[19f-hw4s] Darij Grinberg, Drexel Fall 2019 Math 222 homework set #4 with solutions,
           http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw4s.pdf
[19f-mt1s]   Darij Grinberg, Drexel Fall 2019 Math 222 midterm #1 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/19fco/mt1s.pdf
[19f-mt2s]   Darij Grinberg, Drexel Fall 2019 Math 222 midterm #2 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/19fco/mt2s.pdf
[19f-mt3s]   Darij Grinberg, Drexel Fall 2019 Math 222 midterm #3 with solutions,
             http://www.cip.ifi.lmu.de/~grinberg/t/19fco/mt3s.pdf
Enumerative Combinatorics: class notes                                     page 500
[19s]        Darij Grinberg, Introduction to Modern Algebra (UMN Spring 2019 Math
             4281 notes), 29 June 2019.
             http://www.cip.ifi.lmu.de/~grinberg/t/19s/notes.pdf
[19s-hw0s] Darij Grinberg, UMN Spring 2019 Math 4281 homework set #0 with solu-
           tions, http://www.cip.ifi.lmu.de/~grinberg/t/19s/hw0s.pdf
[21s]        Darij Grinberg, Algebraic Combinatorics (Drexel Spring 2021 Math 701
             lecture notes), 4 May 2021.
             https://www.cip.ifi.lmu.de/~grinberg/t/21s/lecs.pdf
[AigZie14] Martin Aigner, Günter M. Ziegler, Proofs from the Book, 6th edition,
           Springer 2018.
[BCHR11]     Fred Butler, Mahir Can, Jim Haglund, Jeffrey B. Remmel, Rook Theory
             Notes, 3 January 2011.
             http://www.math.ucsd.edu/~remmel/files/Book.pdf
[BenQui03] Arthur T. Benjamin and Jennifer J. Quinn, Proofs that Really Count: The
           Art of Combinatorial Proof, The Mathematical Association of America,
           2003.
[BenQui04] Arthur T. Benjamin and Jennifer J. Quinn, Proofs that Really Count: The
           Magic of Fibonacci Numbers and More, Mathematical Adventures for Stu-
           dents and Amateurs, (David F. Hayes and Tatiana Shubin, editors),
           Spectrum Series of MAA, pp. 83–98, 2004.
Enumerative Combinatorics: class notes                                       page 501
[Chu19]      Hùng Viê.t Chu, The Fibonacci Sequence and Schreier-Zeckendorf Sets,
             Journal of Integer Sequences, 22 (2019), Article 19.6.5.
             https://cs.uwaterloo.ca/journals/JIS/VOL22/Chu2/chu9.html
[CoLiOs15] David A. Cox, John Little, Donal O’Shea, Ideals, Varieties, and Algo-
           rithms: An Introduction to Computational Algebraic Geometry and Commu-
           tative Algebra, 4th edition, Springer 2015.
[Comtet74] Louis Comtet, Advanced Combinatorics: The Art of Finite and Infinite Ex-
           pansions, D. Reidel Publishing Company, 1974.
[GalQua19] Jean Gallier and Jocelyn Quaintance, Algebra, Topology, Differential Cal-
           culus, and Optimization Theory For Computer Science and Engineering, 2
           August 2019.
           https://www.cis.upenn.edu/~jean/gbooks/geomath.html
[Grinbe17] Darij Grinberg, The Lucas and Babbage congruences, 10 January 2019.
           https://www.cip.ifi.lmu.de/~grinberg/lucascong.pdf
[Knuth93]    Donald E. Knuth, Johann Faulhaber and sums of powers, Math. Comp. 61
             (1993), no. 203, 277–294.
             https://www.ams.org/journals/mcom/1993-61-203/
             S0025-5718-1993-1197512-7/
[Mestro14] Romeo Meštrović, Lucas’ theorem: its generalizations, extensions and ap-
           plications (1878–2014), arXiv:1409.3820v1.
[Newste19] Clive Newstead, An Infinite Descent into Pure Mathematics, version 0.4,
           1 January 2020.
           https://infinitedescent.xyz
[Niven69]    Ivan Niven, Formal Power Series, The American Mathematical Monthly
             76, No. 8 (Oct., 1969), pp. 871–889.
             https://www.maa.org/programs/maa-awards/writing-awards/
             formal-power-series
[Sagan01]    Bruce Sagan, The Symmetric Group, Graduate Texts in Mathematics 203,
             2nd edition 2001.
             https://doi.org/10.1007/978-1-4757-6804-6
             See https://users.math.msu.edu/users/bsagan/Books/Sym/errata.
             pdf for errata.
[sage]       The Sage Developers, SageMath, the Sage Mathematics Software System
             (Version 9.0), 2019, https://www.sagemath.org .
[Tou17]      Erik R. Tou, Math Origins: The Totient Function, Convergence (Septem-
             ber 2017), DOI:10.4169/convergence20170923.
             https://www.maa.org/press/periodicals/convergence/
             math-origins-the-totient-function
Enumerative Combinatorics: class notes                                     page 505
[Ward91]     James Ward, 100 years of Dixon’s identity, Irish Mathematical Society
             Bulletin 27 (1991), pp. 46–54.
             https://www.maths.tcd.ie/pub/ims/bull27/bull27_46-54.pdf