\documentclass[numbers=enddot,12pt,final,onecolumn,notitlepage]{scrartcl}%
\usepackage[headsepline,footsepline,manualmark]{scrlayer-scrpage}
\usepackage[all,cmtip]{xy}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{framed}
\usepackage{comment}
\usepackage{color}
\usepackage{hyperref}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{needspace}
\usepackage{tabls}
\usepackage{wasysym}
\usepackage{easytable}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Wednesday, December 04, 2019 14:18:52}
%TCIDATA{SuppressPackageManagement}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Language=American English}
%BeginMSIPreambleData
\providecommand{\U}[1]{\protect\rule{.1in}{.1in}}
%EndMSIPreambleData
\usetikzlibrary{arrows}
\newcounter{exer}
\newcounter{exera}
\numberwithin{exer}{subsection}
\theoremstyle{definition}
\newtheorem{theo}{Theorem}[subsection]
\newenvironment{theorem}[1][]
{\begin{theo}[#1]\begin{leftbar}}
{\end{leftbar}\end{theo}}
\newtheorem{lem}[theo]{Lemma}
\newenvironment{lemma}[1][]
{\begin{lem}[#1]\begin{leftbar}}
{\end{leftbar}\end{lem}}
\newtheorem{prop}[theo]{Proposition}
\newenvironment{proposition}[1][]
{\begin{prop}[#1]\begin{leftbar}}
{\end{leftbar}\end{prop}}
\newtheorem{defi}[theo]{Definition}
\newenvironment{definition}[1][]
{\begin{defi}[#1]\begin{leftbar}}
{\end{leftbar}\end{defi}}
\newtheorem{remk}[theo]{Remark}
\newenvironment{remark}[1][]
{\begin{remk}[#1]\begin{leftbar}}
{\end{leftbar}\end{remk}}
\newtheorem{coro}[theo]{Corollary}
\newenvironment{corollary}[1][]
{\begin{coro}[#1]\begin{leftbar}}
{\end{leftbar}\end{coro}}
\newtheorem{conv}[theo]{Convention}
\newenvironment{convention}[1][]
{\begin{conv}[#1]\begin{leftbar}}
{\end{leftbar}\end{conv}}
\newtheorem{quest}[theo]{Question}
\newenvironment{question}[1][]
{\begin{quest}[#1]\begin{leftbar}}
{\end{leftbar}\end{quest}}
\newtheorem{warn}[theo]{Warning}
\newenvironment{conclusion}[1][]
{\begin{warn}[#1]\begin{leftbar}}
{\end{leftbar}\end{warn}}
\newtheorem{conj}[theo]{Conjecture}
\newenvironment{conjecture}[1][]
{\begin{conj}[#1]\begin{leftbar}}
{\end{leftbar}\end{conj}}
\newtheorem{exam}[theo]{Example}
\newenvironment{example}[1][]
{\begin{exam}[#1]\begin{leftbar}}
{\end{leftbar}\end{exam}}
\newtheorem{exmp}[exer]{Exercise}
\newenvironment{exercise}[1][]
{\begin{exmp}[#1]\begin{leftbar}}
{\end{leftbar}\end{exmp}}
\newenvironment{statement}{\begin{quote}}{\end{quote}}
\newenvironment{fineprint}{\begin{small}}{\end{small}}
\iffalse
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{question}[1][Question]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{teachingnote}[1][Teaching note]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\fi
\let\sumnonlimits\sum
\let\prodnonlimits\prod
\let\cupnonlimits\bigcup
\let\capnonlimits\bigcap
\renewcommand{\sum}{\sumnonlimits\limits}
\renewcommand{\prod}{\prodnonlimits\limits}
\renewcommand{\bigcup}{\cupnonlimits\limits}
\renewcommand{\bigcap}{\capnonlimits\limits}
\setlength\tablinesep{3pt}
\setlength\arraylinesep{3pt}
\setlength\extrarulesep{3pt}
\voffset=0cm
\hoffset=-0.7cm
\setlength\textheight{22.5cm}
\setlength\textwidth{15.5cm}
\newcommand\arxiv[1]{\href{http://www.arxiv.org/abs/#1}{\texttt{arXiv:#1}}}
\newenvironment{verlong}{}{}
\newenvironment{vershort}{}{}
\newenvironment{noncompile}{}{}
\newenvironment{teachingnote}{}{}
\excludecomment{verlong}
\includecomment{vershort}
\excludecomment{noncompile}
\excludecomment{teachingnote}
\newcommand{\CC}{\mathbb{C}}
\newcommand{\RR}{\mathbb{R}}
\newcommand{\QQ}{\mathbb{Q}}
\newcommand{\NN}{\mathbb{N}}
\newcommand{\ZZ}{\mathbb{Z}}
\newcommand{\KK}{\mathbb{K}}
\newcommand{\id}{\operatorname{id}}
\newcommand{\lcm}{\operatorname{lcm}}
\newcommand{\rev}{\operatorname{rev}}
\newcommand{\powset}[2][]{\ifthenelse{\equal{#2}{}}{\mathcal{P}\left(#1\right)}{\mathcal{P}_{#1}\left(#2\right)}}
\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\abs}[1]{\left| #1 \right|}
\newcommand{\tup}[1]{\left( #1 \right)}
\newcommand{\ive}[1]{\left[ #1 \right]}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\lf}[2]{#1^{\underline{#2}}}
\newcommand{\underbrack}[2]{\underbrace{#1}_{\substack{#2}}}
\newcommand{\horrule}[1]{\rule{\linewidth}{#1}}
\newcommand{\nnn}{\nonumber\\}
\newcommand{\sslash}{\mathbin{/\mkern-6mu/}}
\newcommand{\numboxed}[2]{\underbrace{\boxed{#1}}_{\text{box } #2}}
\newcommand{\ig}[2]{\includegraphics[scale=#1]{#2.png}}
\iffalse
\NOEXPAND{\today}{\today}
\NOEXPAND{\sslash}{\sslash}
\NOEXPAND{\numboxed}[2]{\numboxed}
\fi
\ihead{Enumerative Combinatorics: class notes}
\ohead{page \thepage}
\cfoot{}
\begin{document}

\title{Enumerative Combinatorics: class notes (temp version for in-class use)}
\author{Darij Grinberg}
\date{\today\ (unfinished!)}
\maketitle

\section*{Preface}

These are the class notes from my Math 5705 (Enumerative Combinatorics) class
at the UMN in Fall 2018, revised (and digitized) for use in my Math 222
(Enumerative Combinatorics) class at Drexel University in Fall 2019. The
websites of these two classes can be found at%
\begin{align*}
&  \text{\url{http://www.cip.ifi.lmu.de/~grinberg/t/18f}}%
\ \ \ \ \ \ \ \ \ \ \text{and}\\
&  \text{\url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco}}%
\end{align*}
and include some extra materials (such as homeworks, solutions and references).

\textbf{This document is not a textbook, not even a set of lecture notes meant
to be read on a standalone basis.} It is mostly a digitalized (and slightly
improved) version of the things I wrote down on the \textquotedblleft
blackboard\textquotedblright\ (actually, on papers I projected on a screen
through a document camera) during classes. Thus, \textbf{proofs are mostly
outlined} and hindsight is often missing.

\subsection*{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
familiar with the basics of rigorous mathematics (such as proof methods, the
constructions of integers and rationals, and basic properties of finite sets),
as covered (for example) in \cite[Chapters 1--5]{LeLeMe16}, \cite{Day-proofs}
and \cite{Hammac15}. We will not rely on any analysis, linear algebra or
abstract algebra except for the little that we introduce ourselves.

\begin{thebibliography}{99999999}                                                                                         %


\bibitem[18f-hw1s]{18f-hw1s}Darij Grinberg, \textit{UMN Fall 2018 Math 5705
homework set \#1 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/18f/hw1s.pdf}

\bibitem[17f-hw1s]{17f-hw1s}Darij Grinberg, \textit{UMN Fall 2017 Math 4707
homework set \#1 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/17f/hw1s.pdf}

\bibitem[19f-hw0s]{19f-hw0s}Darij Grinberg, \textit{Drexel Fall 2019 Math 222
homework set \#0 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw0s.pdf}

\bibitem[19f-hw1s]{19f-hw1s}Darij Grinberg, \textit{Drexel Fall 2019 Math 222
homework set \#1 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw1.pdf}

\bibitem[19s-hw0s]{19s-hw0s}Darij Grinberg, \textit{UMN Spring 2019 Math 4281
homework set \#0 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19s/hw0s.pdf}

\bibitem[Aigner07]{Aigner07}%
\href{http://doi.org/10.1007/978-3-540-39035-0}{Martin Aigner, \textit{A
Course in Enumeration}, Graduate Texts in Mathematics \#238, Springer 2007.}

\bibitem[AigZie14]{AigZie}%
\href{https://doi.org/10.1007/978-3-662-44205-0}{Martin Aigner, G\"{u}nter M.
Ziegler, \textit{Proofs from the Book}, 6th edition, Springer 2018.}

\bibitem[AndFen04]{AndFen04}Titu Andreescu, Zuming Feng, \textit{A Path to
Combinatorics for Undergraduates: Counting Strategies}, Springer 2004.

\bibitem[ArdSta10]{ArdSta10}%
\href{https://doi.org/10.1007/s00283-010-9160-9}{Federico Ardila, Richard P.
Stanley, \textit{Tilings}, The Mathematical Intelligencer \textbf{32} (2010),
pp. 32--43}. A preprint can be found at
\href{https://arxiv.org/abs/math/0501170v3}{arXiv:math/0501170v3} .

\bibitem[BenDre07]{BenDre-Vand}%
\href{https://web.archive.org/web/20160729183227/http://home.wlu.edu/~dresdeng/papers/VDM.pdf}{Arthur
T. Benjamin and Gregory P. Dresden, \textit{A Combinatorial Proof of
Vandermonde's Determinant}, The American Mathematical Monthly, Vol. 114, No. 4
(Apr., 2007), pp. 338--341.} \newline(Also available at
\url{http://scholarship.claremont.edu/hmc_fac_pub/524/} .)

\bibitem[BenQui03]{BenQui03}Arthur T. Benjamin and Jennifer J. Quinn,
\textit{Proofs that Really Count: The Art of Combinatorial Proof}, The
Mathematical Association of America, 2003.

\bibitem[BenQui04]{BenQui-fib}%
\href{https://www.math.hmc.edu/~benjamin/papers/bama.pdf}{Arthur T. Benjamin
and Jennifer J. Quinn, \textit{Proofs that Really Count: The Magic of
Fibonacci Numbers and More}, Mathematical Adventures for Students and
Amateurs, (David F. Hayes and Tatiana Shubin, editors), Spectrum Series of
MAA, pp. 83--98, 2004.}

\bibitem[BenQui08]{BenQui08}%
\href{https://www.math.hmc.edu/~benjamin/papers/DIE.pdf}{Arthur T. Benjamin
and Jennifer J. Quinn, \textit{An Alternate Approach to Alternating Sums: A
Method to DIE for}, The College Mathematics Journal, Volume 39, Number 3, May
2008, pp. 191-202(12).}

\bibitem[Bourba68]{Bourba68}Nicolas Bourbaki, \textit{Theory of Sets},
Springer 1968.

\bibitem[Day16]{Day-proofs}Martin V. Day, \textit{An Introduction to Proofs
and the Mathematical Vernacular}, 7 December 2016. \newline%
\url{https://www.math.vt.edu/people/day/ProofsBook/IPaMV.pdf} .

\bibitem[Grinbe15]{detnotes}Darij Grinberg, \textit{Notes on the combinatorial
fundamentals of algebra}, 10 January 2019.\newline%
\url{http://www.cip.ifi.lmu.de/~grinberg/primes2015/sols.pdf} \newline The
numbering of theorems and formulas in this link might shift when the project
gets updated; for a \textquotedblleft frozen\textquotedblright\ version whose
numbering is guaranteed to match that in the citations above, see
\url{https://github.com/darijgr/detnotes/releases/tag/2019-01-10} .

\bibitem[Grinbe16]{Gri-lina}Darij Grinberg, \textit{Notes on linear algebra},
version of 13 December 2016.\newline\url{https://github.com/darijgr/lina}

\bibitem[GrKnPa94]{GKP}Ronald L. Graham, Donald E. Knuth, Oren Patashnik,
\textit{Concrete Mathematics, Second Edition}, Addison-Wesley 1994.\newline
See \url{https://www-cs-faculty.stanford.edu/~knuth/gkp.html} for errata.

\bibitem[Hammac15]{Hammac15}Richard Hammack, \textit{Book of Proof}, 3rd
edition.\newline\url{https://www.people.vcu.edu/~rhammack/BookOfProof/}

\bibitem[Joyner08]{Joyner08}W. D. Joyner, \textit{Mathematics of the Rubik's
cube}, 19 August 2008.\newline%
\url{https://web.archive.org/web/20160304122348/http://www.permutationpuzzles.org/rubik/webnotes/}
(link to the PDF at the bottom).

\bibitem[Kastel61]{Kastel61}P. W. Kasteleyn, \textit{The statistics of dimers
on a lattice: I. The number of dimer arrangements on a quadratic lattice},
Physica \textbf{27} (1961), pp. 1209--1225.\newline\url{https://doi.org/10.1016/0031-8914(61)90063-5}

\bibitem[LeLeMe16]{LeLeMe16}Eric Lehman, F. Thomson Leighton, Albert R. Meyer,
\textit{Mathematics for Computer Science}, revised Tuesday 6th June 2018,
\newline\url{https://courses.csail.mit.edu/6.042/spring18/mcs.pdf} .

\bibitem[LLPT95]{LLPT95}D. Laksov, A. Lascoux, P. Pragacz, and A. Thorup,
\textit{The LLPT Notes}, edited by A. Thorup, 1995,\newline%
\url{http://www.math.ku.dk/~thorup/notes/sympol.pdf} .

\bibitem[Loehr11]{Loehr-BC}%
\href{http://www.math.vt.edu/people/nloehr/bijbook.html}{Nicholas A. Loehr,
\textit{Bijective Combinatorics}, Chapman \& Hall/CRC 2011.}

\bibitem[Read80]{Read80}Ronald C. Read, \textit{A Note on Tiling Rectangles
with Dominoes}, Fibonacci Quarterly \textbf{18} (1980), pp. 24--27.\newline\url{https://www.fq.math.ca/Scanned/18-1/read.pdf}

\bibitem[Strick13]{Strick13}Neil Strickland, \textit{MAS201 Linear Mathematics
for Applications}, lecture notes, 28 September 2013.\newline\url{http://neil-strickland.staff.shef.ac.uk/courses/MAS201/}

\bibitem[Stucky15]{Stucky15}Eric Stucky, \textit{An Exposition of Kasteleyn's
Solution of the Dimer Model}, senior thesis at Harvey Mudd College,
2015.\newline\url{https://scholarship.claremont.edu/hmc_theses/89/}

\bibitem[Vorobi02]{Vorobi02}%
\href{https://doi.org/10.1007/978-3-0348-8107-4}{Nicolai N. Vorobiev,
\textit{Fibonacci Numbers}, Translated from the Russian by Mircea Martin,
Springer 2002 (translation of the 6th Russian edition)}.
\end{thebibliography}

\begin{center}
\fbox{\textbf{Class of 2019-09-23}}
\end{center}

\section{\label{chp.intro}Introduction}

This is a class on \textit{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:

\begin{itemize}
\item \textbf{Counting} -- i.e., finding formulas for the sizes of certain
finite sets. For example, we count the permutations of the set $\left\{
1,2,\ldots,n\right\}  $, or the $k$-subsets of $\left\{  1,2,\ldots,n\right\}
$ that contain no two consecutive elements. \textquotedblleft
Count\textquotedblright\ means finding a formula that expresses the number of
such permutations or $k$-subsets in terms of $n$ and $k$.

\item \textbf{Proving polynomial identities} (such as the binomial formula
$\left(  x+y\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}{k}x^{k}y^{n-k}$ or various
deeper ones).

\item \textbf{Finding and studying interesting maps between finite sets}. A
basic example of such a map is the \textquotedblleft bit-set
encoding\textquotedblright: the bijection from the set of all subsets of
$\left\{  1,2,\ldots,n\right\}  $ (for a fixed positive integer $n$) to the
set of all $n$-tuples $\left(  i_{1},i_{2},\ldots,i_{n}\right)  \in\left\{
0,1\right\}  ^{n}$ (known as \textquotedblleft length-$n$
bitstrings\textquotedblright) which sends each subset $S$ of $\left\{
1,2,\ldots,n\right\}  $ to the $n$-tuple $\left(  i_{1},i_{2},\ldots
,i_{n}\right)  $, where $i_{k}=%
\begin{cases}
1, & \text{if }k\in S;\\
0, & \text{if }k\notin S
\end{cases}
$. We will care particularly about bijections, since they directly help in
counting, but even non-bijective maps are fundamental to enumerative combinatorics.
\end{itemize}

You will see more examples of each of these three threads all over this class,
starting with this introductory chapter.

\begin{fineprint}
We will also occasionally see some connections to linear algebra, abstract
algebra, number 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!
\end{fineprint}

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.

\subsection{\label{sect.intro.domino}Domino tilings}

\subsubsection{The problem}

Let $n\in\mathbb{N}$ and $m\in\mathbb{N}$. Here and in the following,
$\mathbb{N}$ means the set $\left\{  0,1,2,\ldots\right\}  $.

Let $R_{n,m}$ denote an $n\times m$\textit{-rectangle}, i.e., a rectangle with
width $n$ and height $m$. (We imagine a specific such rectangle drawn
somewhere in the plane.) For example, $R_{3,4}$ looks like this:\footnote{We
subdivide it with grid lines just to show its dimensions.}%
\begin{equation}%
\begin{array}
[c]{cc}%
\begin{tabular}
[c]{|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
&
\begin{array}
[c]{c}%
{{\left\downarrow \vbox to 0.69cm{}\right.  \kern-\nulldelimiterspace}}\\
4\\
{{\left\uparrow \vbox to 0.69cm{}\right.  \kern-\nulldelimiterspace}}%
\end{array}
\\
\xrightarrow{\hspace*{.6cm}}3\xleftarrow{\hspace*{.6cm}} &
\end{array}
\label{eq.domino.R34}%
\end{equation}


A \textit{domino} shall mean a $1\times2$-rectangle or a $2\times1$-rectangle.
More specifically: A \textit{vertical domino} shall mean a $1\times
2$-rectangle; a \textit{horizontal domino} shall mean a $2\times1$-rectangle.
Here is how they look like:%
\[
\underbrace{\
\begin{tabular}
[c]{|l|}\hline
\phantom{w}\\\hline
\phantom{w}\\\hline
\end{tabular}
\ }_{\text{vertical domino}}\text{;}\ \ \ \ \ \ \ \ \ \ \underbrace{\
\begin{tabular}
[c]{|l|l|}\hline
\phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ }_{\text{horizontal domino}}\text{.}%
\]


A \textit{domino tiling} of $R_{n,m}$ is a way to cover the rectangle
$R_{n,m}$ with non-overlapping dominos.

For example, here are three domino tilings of the rectangle $R_{3,4}$ (which
rectangle you have seen in (\ref{eq.domino.R34})):%
\[%
\begin{tabular}
[c]{|lll|}\hline
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\cline{1-2}%
\cline{1-2}%
\multicolumn{1}{|l|}{\phantom{w}} & \multicolumn{1}{l|}{\phantom{w}} &
\phantom{w}\\\cline{3-3}%
\multicolumn{1}{|l|}{\phantom{w}} & \multicolumn{1}{l|}{\phantom{w}} &
\phantom{w}\\\cline{1-2}\cline{2-2}%
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\qquad%
\begin{tabular}
[c]{|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{4-4}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{4-4}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ ,\qquad%
\begin{tabular}
[c]{|ll|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ .
\]
(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 $R_{n,m}$ have?

As we just saw, $R_{3,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:

\begin{example}
\label{exa.domino.R32}Here are all domino tilings of $R_{3,2}$:%
\[%
\begin{tabular}
[c]{|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{4-4}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ ,\qquad%
\begin{tabular}
[c]{|ll|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ ,\qquad%
\begin{tabular}
[c]{|l|ll|}\hline
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} & \phantom{w}\\\cline{2-3}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ .
\]

\end{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 $R_{n,m}$ with non-overlapping dominos. What does \textquotedblleft
cover\textquotedblright\ mean, and what does \textquotedblleft
non-overlapping\textquotedblright\ mean? Visually, it is pretty clear, but we
do not have bulletproof mathematical definitions yet. There are two ways to
create such definitions:

\begin{itemize}
\item \textbf{The geometric way:} We really define $R_{n,m}$ as a rectangle of
width $n$ and height $m$ in the Euclidean plane; for example, let us pick the
rectangle with vertices $\left(  0,0\right)  $, $\left(  n,0\right)  $,
$\left(  n,m\right)  $ and $\left(  0,m\right)  $ (where we model the
Euclidean plane through a Cartesian coordinate system as usual). We say that a
set of dominos \textit{covers} $R_{n,m}$ if their union (as sets) is $R_{n,m}%
$. It is harder to define what it means for a set of dominos to be
\textit{non-overlapping}; clearly, this is not quite the same as them being
disjoint as sets (because they are allowed to have edges or vertices in
common). There are several good ways to define
non-overlappingness\footnote{For example, you can say that two dominos are
\textit{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
\textit{non-overlapping} if any two distinct dominos in it are
non-overlapping.}. Unfortunately, once all these definitions are made, it is
still far from clear how to \textbf{reason} about them rigorously! For
example, it may seem obvious, but why exactly must all the dominos in a domino
tiling of $R_{n,m}$ be \textquotedblleft snapped to the grid\textquotedblright%
\ (i.e., why must their corners be grid points\footnote{A \textit{grid point}
means a point with integer coordinates.})? This is indeed true, but proving
this would take nontrivial amounts of work. Thus, even our previous
observation that $R_{3,2}$ has three domino tilings (shown visually in Example
\ref{exa.domino.R32}) would become a nontrivial theorem. Thus, we leave this
geometric model of domino tilings aside, and instead define things in $\ldots$

\item \textbf{The combinatorial way:} We redefine $R_{n,m}$ as the set
$\left[  n\right]  \times\left[  m\right]  $, where we set $\left[  k\right]
=\left\{  1,2,\ldots,k\right\}  $ for each $k\in\mathbb{N}$.

Its elements thus are the pairs $\left(  i,j\right)  $ with $i\in\left[
n\right]  $ and $j\in\left[  m\right]  $; we call these pairs
\textquotedblleft\textit{squares}\textquotedblright. Thus, $R_{n,m}$ is a
\textbf{finite} set of size $\left\vert R_{n,m}\right\vert =nm$.

A \textit{vertical domino} shall mean a set of the form $\left\{  \left(
i,j\right)  ,\ \left(  i,j+1\right)  \right\}  $ for some $i,j\in\mathbb{Z}$.

A \textit{horizontal domino} shall mean a set of the form $\left\{  \left(
i,j\right)  ,\ \left(  i+1,j\right)  \right\}  $ for some $i,j\in\mathbb{Z}$.

A \textit{domino} shall mean a set that is either a vertical domino or a
horizontal domino.

If $S$ is a set of squares (for example, $R_{n,m}$), then a \textit{domino
tiling} of $S$ shall mean a set $\left\{  S_{1},S_{2},\ldots,S_{k}\right\}  $
of \textbf{disjoint} dominos whose union is $S$ (that is, $S_{1}\cup S_{2}%
\cup\cdots\cup S_{k}=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 $R_{n,m}$ to be a
\textquotedblleft rectangle\textquotedblright? Because we are no longer
thinking in terms of all points in the plane, but rather thinking in terms of
\textit{grid squares} (as in (\ref{eq.domino.R34})). Thus, the rectangle
$R_{n,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 $\left(
i,j\right)  $ of Cartesian coordinates of its northeastern
corner\footnote{Here is how $R_{3,4}$ looks like with each square labeled:%
\[%
\begin{tabular}
[c]{|c|c|c|}\hline
$\left(  1,4\right)  \vphantom{\dfrac{1}{2f}}$ & $\left(  2,4\right)
\vphantom{\dfrac{1}{2f}}$ & $\left(  3,4\right)  \vphantom{\dfrac{1}{2f}}$%
\\\hline
$\left(  1,3\right)  \vphantom{\dfrac{1}{2f}}$ & $\left(  2,3\right)
\vphantom{\dfrac{1}{2f}}$ & $\left(  3,3\right)  \vphantom{\dfrac{1}{2f}}$%
\\\hline
$\left(  1,2\right)  \vphantom{\dfrac{1}{2f}}$ & $\left(  2,2\right)
\vphantom{\dfrac{1}{2f}}$ & $\left(  3,2\right)  \vphantom{\dfrac{1}{2f}}$%
\\\hline
$\left(  1,1\right)  \vphantom{\dfrac{1}{2f}}$ & $\left(  2,1\right)
\vphantom{\dfrac{1}{2f}}$ & $\left(  3,1\right)  \vphantom{\dfrac{1}{2f}}$%
\\\hline
\end{tabular}
\ \
\]
}; thus, the southwesternmost square of $R_{n,m}$ is labeled $\left(
1,1\right)  $, and the eastern neighbor of a square $\left(  i,j\right)  $ is
$\left(  i+1,j\right)  $, whereas the northern neighbor of a square $\left(
i,j\right)  $ is $\left(  i,j+1\right)  $). In other words, the square in
column $i$ (counted from the left) and row $j$ (counted from the bottom) is
labelled by the pair $\left(  i,j\right)  $.

Having thus redefined the rectangle $R_{n,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 $\left(  i,j\right)  $ and $\left(  i,j+1\right)  $ for some
$i,j\in\mathbb{Z}$), and it is a horizontal domino if these grid squares
differ in their x-coordinate (i.e., have the forms $\left(  i,j\right)  $ and
$\left(  i+1,j\right)  $ for some $i,j\in\mathbb{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
\textbf{discrete model}. It is much more manageable than the geometric one,
and in particular, 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
\ref{exa.domino.R32} saying that $R_{3,2}$ has $3$ domino tilings. In the
discrete model, these domino tilings are\footnote{listed here in the same
order in which they appeared in Example \ref{exa.domino.R32}}%
\begin{align*}
&  \left\{  \underbrace{\left\{  \left(  1,1\right)  ,\left(  1,2\right)
\right\}  }_{\substack{\text{vertical domino}\\\text{covering the}%
\\\text{leftmost column}}},\ \underbrace{\left\{  \left(  2,1\right)  ,\left(
2,2\right)  \right\}  }_{\substack{\text{vertical domino}\\\text{covering
the}\\\text{middle column}}},\ \underbrace{\left\{  \left(  3,1\right)
,\left(  3,2\right)  \right\}  }_{\substack{\text{vertical domino}%
\\\text{covering the}\\\text{righmost column}}}\right\}  ,\\
&  \left\{  \underbrace{\left\{  \left(  1,1\right)  ,\left(  2,1\right)
\right\}  }_{\substack{\text{horizontal domino}\\\text{in the bottom row}%
}},\ \underbrace{\left\{  \left(  1,2\right)  ,\left(  2,2\right)  \right\}
}_{\substack{\text{horizontal domino}\\\text{in the top row}}%
},\ \underbrace{\left\{  \left(  3,1\right)  ,\left(  3,2\right)  \right\}
}_{\substack{\text{vertical domino}\\\text{covering the}\\\text{righmost
column}}}\right\}  ,\\
&  \left\{  \underbrace{\left\{  \left(  1,1\right)  ,\left(  1,2\right)
\right\}  }_{\substack{\text{vertical domino}\\\text{covering the}%
\\\text{leftmost column}}},\ \underbrace{\left\{  \left(  2,1\right)  ,\left(
3,1\right)  \right\}  }_{\substack{\text{horizontal domino}\\\text{in the
bottom row}}},\ \underbrace{\left\{  \left(  2,2\right)  ,\left(  3,2\right)
\right\}  }_{\substack{\text{horizontal domino}\\\text{in the top row}%
}}\right\}  .
\end{align*}
You do need a bit of work to verify that no other domino tilings of $R_{3,2}$
exist; but it is very much doable. The surefire (but boring) way is to simply
check all possibilities by \textbf{brute force}: There are only $7$ dominos
that lie inside\footnote{To \textquotedblleft lie inside\textquotedblright%
\ $R_{3,2}$ means to be a subset of $R_{3,2}$ here.} $R_{3,2}$, and clearly
any domino tiling must consist of some of these $7$ dominos; now, you can
check all the $2^{7}$ possible subsets. (Of course, you can be a lot less stupid.)
\end{itemize}

From now on, we shall always be using the discrete model when we study domino
tilings -- i.e., we define $R_{n,m}$, dominos and domino tilings via the
combinatorial way.

If $n,m\in\mathbb{N}$, then let us define an integer $d_{n,m}$ by%
\[
d_{n,m}=\left(  \text{\# of domino tilings of }R_{n,m}\right)  .
\]
Here and in the following, the symbol \textquotedblleft\#\textquotedblright%
\ always means \textquotedblleft number\textquotedblright\ (or
\textquotedblleft the number\textquotedblright, depending on context).

Our problem thus asks us to compute $d_{n,m}$. In Example \ref{exa.domino.R32}%
, we have seen that $d_{3,2}=3$. For any fixed $n$ and $m$, we can technically
compute $d_{n,m}$ by brute force (i.e., trying out all possible subsets of the
set of dominoes lying inside $R_{n,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 $d_{n,m}$ if possible, and otherwise at least for faster
algorithms that compute $d_{n,m}$.

\subsubsection{The odd-by-odd case and the sum rule}

We begin with a particularly simple case:

\begin{proposition}
\label{prop.1.1}Assume that $n$ and $m$ are odd. Then, $d_{n,m}=0$.
\end{proposition}

\begin{proof}
[Proof sketch.]We have assumed that $n$ and $m$ are odd. Thus, the product
$nm$ is odd as well. In other words, the size $\left\vert R_{n,m}\right\vert $
is odd (since $\left\vert R_{n,m}\right\vert =nm$).

But each domino has even size (in fact, it has size $2$).

If the set $R_{n,m}$ had a domino tiling, then the size $\left\vert
R_{n,m}\right\vert $ of $R_{n,m}$ would equal the sum of the sizes of all the
dominos in the tiling (because $R_{n,m}$ is the union of the dominos, and the
dominos are disjoint). But the size $\left\vert R_{n,m}\right\vert $ 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 $R_{n,m}$ has no domino tilings. In other words, the \# of
domino tilings of $R_{n,m}$ is $0$. In other words, $d_{n,m}=0$.
\end{proof}

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:

\begin{theorem}
[The sum rule]\label{thm.1.2}If a finite set $S$ is the union of $k$ disjoint
sets $S_{1},S_{2},\ldots,S_{k}$, then%
\[
\left\vert S\right\vert =\left\vert S_{1}\right\vert +\left\vert
S_{2}\right\vert +\cdots+\left\vert S_{k}\right\vert .
\]

\end{theorem}

Theorem \ref{thm.1.2} is known as the \textit{sum rule} or the
\textit{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
\ref{prop.1.1} above. We shall not prove Theorem \ref{thm.1.2}, since this is
a job for \textquotedblleft axiomatic foundations of
mathematics\textquotedblright\ courses and depends on the \textquotedblleft
implementation details\textquotedblright\ of your mathematical
\textquotedblleft standard library\textquotedblright\ (such as: how do you
define the size of a finite set?).\footnote{For example, if you define your
sets and numbers in the old-fashioned Bourbakist way, then you can find
Theorem \ref{thm.1.2} with proof in \cite[Chapter III, \S 3.3, Corollary]%
{Bourba68}. If you are using constructivist foundations, then Theorem
\ref{thm.1.2} can be proven by induction on $k$ (see \cite[proof of
1.2]{Loehr-BC} for the details of this induction proof), relying on the fact
that any two disjoint finite sets $A$ and $B$ of $\left\vert A\cup
B\right\vert =\left\vert A\right\vert +\left\vert B\right\vert $. The latter
fact (which is, of course, essentially equivalent to the particular case of
Theorem \ref{thm.1.2} for $k=2$) can be proven directly by explicitly
constructing a bijection $A\cup B\rightarrow\left[  n+m\right]  $ out of two
bijections $A\rightarrow\left[  n\right]  $ and $B\rightarrow\left[  m\right]
$ (see \cite[proof of 1.32]{Loehr-BC} for the details of this construction).
But we will not dwell on fundamental issues like this here.}

We have also used the visually obvious fact that $\left\vert R_{n,m}%
\right\vert =nm$ (that is, $R_{n,m}$ has $nm$ squares). Formally speaking,
this is a consequence of another basic fact:

\begin{theorem}
[The product rule for two sets]\label{thm.prodrule2}Let $X$ and $Y$ be two
finite sets. Then, $X\times Y$ is a finite set with size $\left\vert X\times
Y\right\vert =\left\vert X\right\vert \cdot\left\vert Y\right\vert $.
\end{theorem}

Again, we will not prove Theorem \ref{thm.prodrule2}, as it is sufficiently
elementary.\footnote{See \cite[1.5]{Loehr-BC} for a proof (even of a more
general statement).}

Let us now restate our above proof of Proposition \ref{prop.1.1} in a way that
makes the uses of Theorem \ref{thm.1.2} and of Theorem \ref{thm.prodrule2} in
it explicit:

\begin{fineprint}
\begin{proof}
[Proof of Proposition \ref{prop.1.1} (detailed version).]For each
$k\in\mathbb{N}$, we have $\left[  k\right]  =\left\{  1,2,\ldots,k\right\}  $
and thus $\left\vert \left[  k\right]  \right\vert =\left\vert \left\{
1,2,\ldots,k\right\}  \right\vert =k$. Hence, $\left\vert \left[  n\right]
\right\vert =n$ and $\left\vert \left[  m\right]  \right\vert =m$. But
$R_{n,m}=\left[  n\right]  \times\left[  m\right]  $ and thus%
\begin{align*}
\left\vert R_{n,m}\right\vert  &  =\left\vert \left[  n\right]  \times\left[
m\right]  \right\vert =\underbrace{\left\vert \left[  n\right]  \right\vert
}_{=n}\cdot\underbrace{\left\vert \left[  m\right]  \right\vert }%
_{=m}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.prodrule2}, applied
to }X=\left[  n\right]  \text{ and }Y=\left[  m\right]  \right) \\
&  =nm.
\end{align*}


We have assumed that $n$ and $m$ are odd. Thus, the product $nm$ is odd as
well. In other words, the size $\left\vert R_{n,m}\right\vert $ is odd (since
$\left\vert R_{n,m}\right\vert =nm$).

Our next goal is to show that the set $R_{n,m}$ has no domino tilings.

Indeed, let $T$ be a domino tiling of $R_{n,m}$. We will derive a contradiction.

Write $T$ in the form $T=\left\{  S_{1},S_{2},\ldots,S_{k}\right\}  $, where
$S_{1},S_{2},\ldots,S_{k}$ are distinct dominos\footnote{Here, we are tacitly
using the fact that $T$ is finite. Why is $T$ finite? Intuitively it is
obvious. More rigorously, you can argue this as follows: There are only
finitely many dominos that are subsets of $R_{n,m}$. The set $T$, being a
domino tiling of $R_{n,m}$, must consist entirely of such dominos; thus, it
must be a subset of the (finite) set of these dominos. Hence, $T$ is itself
finite (since a subset of a finite set is always finite).
\par
We trust you to make such arguments whenever necessary; we will not dwell on
them in the future.}. Then, the sets $S_{1},S_{2},\ldots,S_{k}$ are dominos;
thus, their sizes $\left\vert S_{1}\right\vert ,\left\vert S_{2}\right\vert
,\ldots,\left\vert S_{k}\right\vert $ are even (since the size of each domino
is even\footnote{Indeed, the size of each domino is $2$.}). Hence, the sum
$\left\vert S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert $ is even (being a sum of even integers).

But the finite set $R_{n,m}$ is a union of the $k$ disjoint sets $S_{1}%
,S_{2},\ldots,S_{k}$ (since $\left\{  S_{1},S_{2},\ldots,S_{k}\right\}  =T$ is
a domino tiling of $R_{n,m}$). Hence, Theorem \ref{thm.1.2} (applied to
$S=R_{n,m}$) yields $\left\vert R_{n,m}\right\vert =\left\vert S_{1}%
\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert S_{k}\right\vert
$. Hence, $\left\vert R_{n,m}\right\vert $ is even (since $\left\vert
S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert $ is even). This contradicts the fact that $\left\vert
R_{n,m}\right\vert $ is odd.

Now, forget that we fixed $T$. We thus have found a contradiction for each
domino tiling $T$ of $R_{n,m}$. This shows that there exists no domino tiling
of $R_{n,m}$. In other words, the \# of domino tilings of $R_{n,m}$ is $0$. In
other words, $d_{n,m}=0$. This proves Proposition \ref{prop.1.1}.
\end{proof}
\end{fineprint}

In the future, we will be using the sum rule (Theorem \ref{thm.1.2}) many
times, usually without even mentioning it.

\subsubsection{The symmetry and the bijection rule}

Thus we have handled at least one case of our counting problem: the case when
$n$ and $m$ are odd. It remains to handle the case when at least one of $n$
and $m$ is even. More precisely, it suffices to handle the case when $n$ is
even, because of the following symmetry in the problem:

\begin{proposition}
\label{prop.domino.symm}Let $n,m\in\mathbb{N}$. Then, $d_{n,m}=d_{m,n}$.
\end{proposition}

\begin{proof}
[Proof sketch.]The idea is very simple: The rectangle $R_{m,n}$ can be
obtained by \textquotedblleft flipping\textquotedblright\ the rectangle
$R_{n,m}$ across the line with equation $x=y$ (in Cartesian coordinates). This
\textquotedblleft flip\textquotedblright\ operation turns domino tilings of
$R_{m,n}$ into domino tilings of $R_{n,m}$ and vice versa; here is an example:%
\[%
\begin{tabular}
[c]{|lll|}\hline
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\cline{1-2}%
\cline{1-2}%
\multicolumn{1}{|l|}{\phantom{w}} & \multicolumn{1}{l|}{\phantom{w}} &
\phantom{w}\\\cline{3-3}%
\multicolumn{1}{|l|}{\phantom{w}} & \multicolumn{1}{l|}{\phantom{w}} &
\phantom{w}\\\cline{1-2}\cline{2-2}%
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ \ \overset{\text{flip}}{\longrightarrow}\ \ \ \
\begin{tabular}
[c]{|llll|}\hline
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w} &
\phantom{w}\\\hline
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\cline{2-3}%
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ .
\]
Thus, the domino tilings of $R_{m,n}$ are in 1-to-1 correspondence with the
domino tilings of $R_{n,m}$. This entails that the \# of the former equals the
\# of the latter. Since the \# of the former is $d_{m,n}$ (by the definition
of $d_{m,n}$), whereas the \# of the latter is $d_{n,m}$ (by the definition of
$d_{n,m}$), we can rewrite this as follows: $d_{m,n}=d_{n,m}$. This proves
Proposition \ref{prop.domino.symm}.
\end{proof}

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 $R_{m,n}$ are not literally the same as the domino tilings
of $R_{n,m}$ (unless $n=m$ or one of $n$ and $m$ is $0$); yet, we have argued
that the former are in 1-to-1 correspondence 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)\footnote{We refer to
places like \cite[\S 4.4--4.5]{LeLeMe16}, \cite[\S 12.2]{Hammac15} or
\cite[\S 3.F]{Day-proofs} for basic properties of bijections and bijectivity.
Here come some brief reminders: A map $f:X\rightarrow Y$ between two sets $X$
and $Y$ is said to be
\par
\begin{itemize}
\item \textit{injective} if it has the property that $\left(  f\left(
x_{1}\right)  =f\left(  x_{2}\right)  \right)  \Longrightarrow\left(
x_{1}=x_{2}\right)  $ for any two elements $x_{1},x_{2}\in X$ (or,
equivalently, if it maps any two distinct elements of $X$ to two distinct
elements of $Y$);
\par
\item \textit{surjective} if it has the property that for each $y\in Y$, there
exists at least one $x\in X$ satisfying $f\left(  x\right)  =y$ (in other
words, every element of $Y$ is a value of $f$);
\par
\item \textit{bijective} if it is both injective and surjective.
\end{itemize}
\par
It is easy to see that a map is bijective if and only if it is invertible
(i.e., has an inverse).}. 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:

\begin{theorem}
\label{thm.bij-rule}If $X$ and $Y$ are two sets, and if $f:X\rightarrow Y$ is
a bijection (i.e., a bijective map), then
\begin{equation}
\left\vert X\right\vert =\left\vert Y\right\vert .
\label{eq.thm.bij-rule.sizes-equal}%
\end{equation}

\end{theorem}

Theorem \ref{thm.bij-rule} is known as the \textit{bijection principle} or the
\textit{bijection rule}, and is sufficiently 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
\textquotedblleft flip\textquotedblright\ operation that was used in our proof
of Proposition \ref{prop.domino.symm}:

\begin{fineprint}
\begin{proof}
[Proof of Proposition \ref{prop.domino.symm} (detailed version).]Define the
map%
\begin{align*}
F:R_{n,m}  &  \rightarrow R_{m,n},\\
\left(  i,j\right)   &  \mapsto\left(  j,i\right)  .
\end{align*}
(This notation is saying \textquotedblleft the map $F$ from $R_{n,m}$ to
$R_{m,n}$ that sends each element $\left(  i,j\right)  $ of $R_{n,m}$ to the
element $\left(  j,i\right)  $ of $R_{m,n}$\textquotedblright. To see why this
map is well-defined, just recall that $R_{n,m}=\left[  n\right]  \times\left[
m\right]  $ and $R_{m,n}=\left[  m\right]  \times\left[  n\right]  $, which is
why $\left(  i,j\right)  \in R_{n,m}$ will always lead to $\left(  j,i\right)
\in R_{m,n}$.)

Visually speaking, this map $F$ simply flips each square of the rectangle
$R_{n,m}$ across the line with equation $x=y$. This yields a square of the
rectangle $R_{m,n}$, of course. Thus, it is clear that the map $F$ is a
bijection. This can be proved rigorously as follows: The map%
\begin{align*}
G:R_{m,n}  &  \rightarrow R_{n,m},\\
\left(  i,j\right)   &  \mapsto\left(  j,i\right)
\end{align*}
is well-defined\footnote{This is proved in the same way as we showed that $F$
is well-defined.} and inverse to $F$\ \ \ \ \footnote{since $F\circ
G=\operatorname*{id}$ (because each $\left(  i,j\right)  \in R_{m,n}$
satisfies $\left(  F\circ G\right)  \left(  i,j\right)  =F\left(
\underbrace{G\left(  i,j\right)  }_{=\left(  j,i\right)  }\right)  =F\left(
j,i\right)  =\left(  i,j\right)  =\operatorname*{id}\left(  i,j\right)  $) and
$G\circ F=\operatorname*{id}$ (for similar reasons)}. Thus, the map $F$ is
invertible, i.e., is a bijection. 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 \ref{thm.bij-rule} to. (If we applied Theorem \ref{thm.bij-rule}
to $f=F$, then we would conclude that $\left\vert R_{n,m}\right\vert
=\left\vert R_{m,n}\right\vert $, that is, $nm=mn$, which is reassuring but
not what we are trying to prove.)

The map $F$ merely flips the squares of $R_{n,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:

\begin{itemize}
\item Define the map%
\begin{align*}
F_{\operatorname*{dom}}:\left\{  \text{dominos inside }R_{n,m}\right\}   &
\rightarrow\left\{  \text{dominos inside }R_{m,n}\right\}  ,\\
D  &  \mapsto\left\{  F\left(  d\right)  \ \mid\ d\in D\right\}  .
\end{align*}
(To spell this out: The map $F_{\operatorname*{dom}}$ sends each domino $D$ to
the domino $\left\{  F\left(  d\right)  \ \mid\ d\in D\right\}  $, which is
obtained from $D$ by flipping each square $d\in 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 $F_{\operatorname*{dom}}$ is a bijection.
(Indeed, it has an inverse $G_{\operatorname*{dom}}$, which is defined in the
same way but with the roles of $n$ and $m$ interchanged.)

\item Define the map%
\begin{align*}
F_{\operatorname*{til}}:\left\{  \text{domino tilings of }R_{n,m}\right\}   &
\rightarrow\left\{  \text{domino tilings of }R_{m,n}\right\}  ,\\
T  &  \mapsto\left\{  F_{\operatorname*{dom}}\left(  D\right)  \ \mid\ D\in
T\right\}  .
\end{align*}
(To spell this out: The map $F_{\operatorname*{til}}$ sends each domino tiling
$T$ to the domino tiling $\left\{  F_{\operatorname*{dom}}\left(  D\right)
\ \mid\ D\in T\right\}  $, which is obtained from $T$ by flipping each domino
$D\in T$. In other words, it flips each domino tiling by applying the flip map
$F_{\operatorname*{dom}}$ to each domino of the tiling.)

It is easy to see that this map $F_{\operatorname*{til}}$ is a bijection.
(Indeed, it has an inverse $G_{\operatorname*{til}}$, which is defined in the
same way but with the roles of $n$ and $m$ interchanged.)
\end{itemize}

To be fully rigorous, we would have to check that these two maps
$F_{\operatorname*{dom}}$ and $F_{\operatorname*{til}}$ are well-defined
(i.e., that flipping a domino inside $R_{n,m}$ really results in a domino
inside $R_{m,n}$, and that flipping a domino tiling of $R_{n,m}$ really
results in a domino tiling of $R_{m,n}$), but this is intuitively clear, and
the formal proof can easily be constructed by just \textquotedblleft following
your nose\textquotedblright\footnote{For example: If $D$ is a horizontal
domino $\left\{  \left(  i,j\right)  ,\left(  i+1,j\right)  \right\}  $, then
flipping it yields the vertical domino $\left\{  \left(  j,i\right)  ,\left(
j,i+1\right)  \right\}  $. 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!)}, which is why we omit it.

Anyway, we now have constructed a map\newline$F_{\operatorname*{til}}:\left\{
\text{domino tilings of }R_{n,m}\right\}  \rightarrow\left\{  \text{domino
tilings of }R_{m,n}\right\}  $ and showed that it is a bijection. Hence,
(\ref{eq.thm.bij-rule.sizes-equal}) (applied to $X=\left\{  \text{domino
tilings of }R_{n,m}\right\}  $ and $Y=\left\{  \text{domino tilings of
}R_{m,n}\right\}  $ and $f=F_{\operatorname*{til}}$) shows that%
\begin{equation}
\left\vert \left\{  \text{domino tilings of }R_{n,m}\right\}  \right\vert
=\left\vert \left\{  \text{domino tilings of }R_{m,n}\right\}  \right\vert .
\label{pf.prop.domino.symm.at}%
\end{equation}
But the definition of $d_{n,m}$ yields%
\[
d_{n,m}=\left(  \text{\# of domino tilings of }R_{n,m}\right)  =\left\vert
\left\{  \text{domino tilings of }R_{n,m}\right\}  \right\vert .
\]
The same reasoning shows that%
\[
d_{m,n}=\left\vert \left\{  \text{domino tilings of }R_{m,n}\right\}
\right\vert .
\]
In view of the latter two equalities, we can rewrite
(\ref{pf.prop.domino.symm.at}) as $d_{n,m}=d_{m,n}$. Thus Proposition
\ref{prop.domino.symm} is proven.
\end{proof}
\end{fineprint}

\subsubsection{The $m=1$ case}

Let us bite another piece off the problem:

\begin{proposition}
\label{prop.1.3}Assume that $m=1$ and that $n$ is even. Then, $d_{n,m}=1$.
\end{proposition}

\begin{proof}
[Proof sketch.]We must show that there is exactly one domino tiling of
$R_{n,m}$. But this is visually obvious: The rectangle $R_{n,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:%
\[%
\begin{tabular}
[c]{|llll|ll|ll|lll|}\hline
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w} & \phantom{w} & \phantom{w} &
\multicolumn{1}{l|}{\phantom{w}} &
\multicolumn{1}{|l|}{\phantom{aaaaaaa}$\cdots$\phantom{aaaaaaa}} &
\phantom{w} & \phantom{w}\\\cline{1-12}\cline{6-11}%
\end{tabular}
\ \ \ .
\]


\begin{fineprint}
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 is\footnote{Pay
attention to where the set braces are! This is a set of sets of pairs of
numbers.}%
\begin{align}
&  \left\{  \left\{  \left(  1,1\right)  ,\left(  2,1\right)  \right\}
,\ \left\{  \left(  3,1\right)  ,\left(  4,1\right)  \right\}  ,\ \left\{
\left(  5,1\right)  ,\left(  6,1\right)  \right\}  ,\ \ldots,\ \left\{
\left(  n-1,1\right)  ,\left(  n,1\right)  \right\}  \right\} \nonumber\\
&  =\left\{  \left\{  \left(  2k-1,1\right)  ,\left(  2k,1\right)  \right\}
\ \mid\ k\in\left\{  1,2,\ldots,n/2\right\}  \right\}  .
\label{pf.prop.1.3.til}%
\end{align}
It is instantly clear that this is a domino tiling of $R_{n,m}$. In order to
show that this is the only domino tiling of $R_{n,m}$, we can let $T$ be any
domino tiling of $R_{n,m}$, and then argue as follows:

\begin{itemize}
\item The square $\left(  1,1\right)  $ must be contained in some domino
$A_{1}\in T$ (since $T$ is a domino tiling). This domino $A_{1}$ must be
either $\left\{  \left(  1,1\right)  ,\left(  2,1\right)  \right\}  $ or
$\left\{  \left(  0,1\right)  ,\left(  1,1\right)  \right\}  $ or $\left\{
\left(  1,1\right)  ,\left(  1,2\right)  \right\}  $ or $\left\{  \left(
1,0\right)  ,\left(  1,1\right)  \right\}  $ (since these are the only dominos
that contain $\left(  1,1\right)  $). But out of these four dominos, only
$\left\{  \left(  1,1\right)  ,\left(  2,1\right)  \right\}  $ is a subset of
$R_{n,m}$. Hence, $A_{1}$ must be the domino $\left\{  \left(  1,1\right)
,\left(  2,1\right)  \right\}  $. Thus, $\left(  2,1\right)  $ is also
contained in $A_{1}$.

Now we know that our tiling $T$ looks like this:%
\[%
\begin{tabular}
[c]{|lllllllllll|}\hline
$A_{1}$ & \multicolumn{1}{l|}{$A_{1}$} & $?$ & $?$ & $?$ & $?$ & $?$ & $?$ &
$?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ \cdots\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?$
& $?$ & $?$\\\cline{1-12}\cline{6-11}%
\end{tabular}
\]
(where we have labeled the leftmost two squares with \textquotedblleft$A_{1}%
$\textquotedblright\ to signify that they are contained in the domino $A_{1}$).

\item The square $\left(  3,1\right)  $ must be contained in some domino
$A_{2}$ from $T$. This domino $A_{2}$ must be either $\left\{  \left(
3,1\right)  ,\left(  4,1\right)  \right\}  $ or $\left\{  \left(  2,1\right)
,\left(  3,1\right)  \right\}  $ or $\left\{  \left(  3,1\right)  ,\left(
3,2\right)  \right\}  $ or $\left\{  \left(  3,0\right)  ,\left(  3,1\right)
\right\}  $ (since these are the only dominos that contain $\left(
3,1\right)  $). But out of these four dominos, only $\left\{  \left(
3,1\right)  ,\left(  4,1\right)  \right\}  $ and $\left\{  \left(  2,1\right)
,\left(  3,1\right)  \right\}  $ are subsets of $R_{n,m}$. Hence, $A_{2}$ must
be either $\left\{  \left(  3,1\right)  ,\left(  4,1\right)  \right\}  $ or
$\left\{  \left(  2,1\right)  ,\left(  3,1\right)  \right\}  $. But the
dominos in a domino tiling must be disjoint (by definition); hence, $A_{2}$
cannot be $\left\{  \left(  2,1\right)  ,\left(  3,1\right)  \right\}  $
(because if $A_{2}$ was $\left\{  \left(  2,1\right)  ,\left(  3,1\right)
\right\}  $, then it would fail to be disjoint from $A_{1}=\left\{  \left(
1,1\right)  ,\left(  2,1\right)  \right\}  $). Thus, $A_{2}$ must be $\left\{
\left(  3,1\right)  ,\left(  4,1\right)  \right\}  $. Hence, $\left(
4,1\right)  $ is also contained in $A_{2}$.

Now we know that our tiling $T$ looks like this:%
\[%
\begin{tabular}
[c]{|lllllllllll|}\hline
$A_{1}$ & \multicolumn{1}{l|}{$A_{1}$} & $A_{2}$ & \multicolumn{1}{l|}{$A_{2}%
$} & $?$ & $?$ & $?$ & $?$ & $?\ \ ?\ \ ?\ ?\ ?\ ?\ ?\ \ \cdots
\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?\ \ ?$ & $?$ & $?$\\\cline{1-12}\cline{3-4}%
\cline{6-11}%
\end{tabular}
\]


\item The square $\left(  5,1\right)  $ must be contained in some domino
$A_{2}$ from $T$. This domino $A_{2}$ must be either $\left\{  \left(
5,1\right)  ,\left(  6,1\right)  \right\}  $ or $\left\{  \left(  4,1\right)
,\left(  5,1\right)  \right\}  $ or $\left\{  \left(  5,1\right)  ,\left(
5,2\right)  \right\}  $ or $\left\{  \left(  5,0\right)  ,\left(  5,1\right)
\right\}  $ (since these are the only dominos that contain $\left(
5,1\right)  $). But out of these four dominos, only $\left\{  \left(
5,1\right)  ,\left(  6,1\right)  \right\}  $ and $\left\{  \left(  4,1\right)
,\left(  5,1\right)  \right\}  $ are subsets of $R_{n,m}$. Hence, $A_{3}$ must
be either $\left\{  \left(  5,1\right)  ,\left(  6,1\right)  \right\}  $ or
$\left\{  \left(  4,1\right)  ,\left(  5,1\right)  \right\}  $. But the
dominos in a domino tiling must be disjoint (by definition); hence, $A_{3}$
cannot be $\left\{  \left(  4,1\right)  ,\left(  5,1\right)  \right\}  $
(because if $A_{3}$ was $\left\{  \left(  4,1\right)  ,\left(  5,1\right)
\right\}  $, then it would fail to be disjoint from $A_{2}=\left\{  \left(
3,1\right)  ,\left(  4,1\right)  \right\}  $). Thus, $A_{3}$ must be $\left\{
\left(  5,1\right)  ,\left(  6,1\right)  \right\}  $. Hence, $\left(
6,1\right)  $ is also contained in $A_{3}$.

Now we know that our tiling $T$ looks like this:%
\[%
\begin{tabular}
[c]{|lllllllllll|}\hline
$A_{1}$ & \multicolumn{1}{l|}{$A_{1}$} & $A_{2}$ & \multicolumn{1}{l|}{$A_{2}%
$} & $A_{3}$ & \multicolumn{1}{l|}{$A_{3}$} & $?$ & $?$ &
$?\ ?\ ?\ ?\ ?\ ?\ ?\ \ \cdots\ \ ?\ ?\ ?\ \ ?\ \ ?\ \ ?\ \ ?$ & $?$ &
$?$\\\cline{1-12}\cline{3-11}%
\end{tabular}
\]

\end{itemize}

\noindent$\ldots$ and so on, proceeding further and further right until you
hit the \textquotedblleft eastern wall\textquotedblright\ of $R_{n,m}$ (that
is, the square $\left(  n,1\right)  $). Thus, the dominos appearing in $T$ are
uniquely determined: They must be $A_{1}=\left\{  \left(  1,1\right)  ,\left(
2,1\right)  \right\}  $, $A_{2}=\left\{  \left(  3,1\right)  ,\left(
4,1\right)  \right\}  $, $A_{3}=\left\{  \left(  5,1\right)  ,\left(
6,1\right)  \right\}  $ and so on. This is precisely the one tiling that we
presented in (\ref{pf.prop.1.3.til}). Thus, that one tiling is the only domino
tiling of $R_{n,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 $R_{n,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).
\end{fineprint}
\end{proof}

\subsubsection{The $m=2$ case and Fibonacci numbers}

Between Proposition \ref{prop.1.1} and Proposition \ref{prop.1.3}, we have
fully covered the case $m=1$ of our problem. Let us now move on to the case
$m=2$. We compute $d_{n,m}=d_{n,2}$ for some small values of $n$ simply by
listing all domino tilings of $R_{n,m}$:%
\[%
\begin{tabular}
[c]{|c|c|l|}\hline
$n$ & $d_{n,m}$ & domino tilings\\\hline\hline
$0$ & $d_{0,2}=1$ &
\begin{tabular}
[c]{|l}%
\phantom{w}\\
\phantom{w}
\end{tabular}
\\\hline
$1$ & $d_{1,2}=1$ &
\begin{tabular}
[c]{|l|}\hline
\phantom{w}\\\cline{2-2}%
\phantom{w}\\\hline
\end{tabular}
\\\hline
$2$ & $d_{2,2}=2$ &
\begin{tabular}
[c]{|l|l|}\hline
\phantom{w} & \phantom{w}\\\cline{3-3}%
\phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ $,\ \ \ $%
\begin{tabular}
[c]{|ll|}\hline
\phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w}\\\hline
\end{tabular}
\\\hline
$3$ & $d_{3,2}=3$ & $%
\begin{tabular}
[c]{|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{4-4}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ \ ,\ \ \
\begin{tabular}
[c]{|ll|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ \ ,\ \ \
\begin{tabular}
[c]{|l|ll|}\hline
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} & \phantom{w}\\\cline{2-3}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ $\\\hline
$4$ & $d_{4,2}=5$ &
\begin{tabular}
[c]{|l|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{5-5}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\ \ \
\begin{tabular}
[c]{|ll|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\ \ \
\begin{tabular}
[c]{|l|ll|l|}\hline
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} & \phantom{w} &
\phantom{w}\\\cline{2-3}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
, $\vphantom{\dfrac{1}{\dfrac{1}{1}}}$\\
&  &
\begin{tabular}
[c]{|l|l|ll|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{3-4}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\ \ \
\begin{tabular}
[c]{|ll|ll|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}\cline{3-4}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
$\vphantom{\dfrac{1}{\dfrac{1}{1}}}$\\\hline
\end{tabular}
\ \ \ \ .
\]
If the $n=0$ case confuses you, keep in mind that the rectangle $R_{0,2}$ is
the empty set (since $R_{0,2}=\underbrace{\left[  0\right]  }_{=\varnothing
}\times\left[  2\right]  =\varnothing\times\left[  2\right]  =\varnothing$)
and thus has exactly one domino tiling -- namely, the tiling that contains no
dominos (i.e., the empty set).

Can you find $d_{5,2}$?

Here is a quick way to the answer, at least as far as counting is concerned:

\begin{proposition}
\label{prop.1.4}For each integer $n\geq2$, we have $d_{n,2}=d_{n-1,2}%
+d_{n-2,2}$.
\end{proposition}

\begin{center}
\fbox{\textbf{Class of 2019-09-25}}
\end{center}

\begin{proof}
[Proof sketch.]Let $n\geq2$ be an integer. Consider the last\footnote{i.e.,
easternmost} column of $R_{n,2}$ (that is, the set $\left\{  \left(
n,1\right)  ,\left(  n,2\right)  \right\}  $).

In any domino tiling $T$ of $R_{n,2}$, this last column is \textbf{either}
covered by $1$ vertical domino, \textbf{or} covered by (parts of) $2$
horizontal dominos.

In the former case, we shall call $T$ a \textit{type-1 tiling}; in the latter
case, we shall call $T$ a \textit{type-2 tiling}. Visually, these look as
follows:%
\[
\underbrace{\
\begin{tabular}
[c]{|c|l|}\hline
$???????????????$ & \phantom{w}\\\cline{3-3}%
$???????????????$ & \phantom{w}\\\hline
\end{tabular}
\ }_{\text{type-1 tiling}},\ \ \ \ \ \ \ \ \ \ \underbrace{\
\begin{tabular}
[c]{|l|ll|}\hline
$???????????????$ & \phantom{w} & \phantom{w}\\\cline{2-3}%
$???????????????$ & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ }_{\text{type-2 tiling}}%
\]
(where the question marks mean an unknown arrangement of dominos).

Let us now analyze type-1 tilings. A type-1 tiling consists of the single
vertical domino $\left\{  \left(  n,1\right)  ,\left(  n,2\right)  \right\}  $
that covers its last column, and a bunch of dominos that cover all the
remaining $n-1$ columns. This latter bunch must thus be a domino tiling of
$R_{n-1,2}$. Thus, a type-1 tiling consists of the single vertical domino
$\left\{  \left(  n,1\right)  ,\left(  n,2\right)  \right\}  $ and an
arbitrary domino tiling of $R_{n-1,2}$. (Visually, this means that it looks as
follows: $\
\begin{tabular}
[c]{|c|l|}\hline
some domino & \phantom{w}\\\cline{3-3}%
tiling of $R_{n-1,2}$ & \phantom{w}\\\hline
\end{tabular}
\ $.) Hence,\footnote{When we say \textquotedblleft type-1
tiling\textquotedblright, we mean \textquotedblleft type-1 tiling of $R_{n,2}%
$\textquotedblright, of course. (The same will apply to \textquotedblleft
type-2 tiling\textquotedblright\ later on.)}%
\begin{align}
\left(  \text{\# of type-1 tilings}\right)   &  =\left(  \text{\# of domino
tilings of }R_{n-1,2}\right) \label{pf.prop.1.4.1}\\
&  =d_{n-1,2} \label{pf.prop.1.4.1b}%
\end{align}
(since $d_{n-1,2}$ was defined as the \# of domino tilings of $R_{n-1,2}$).

Let us next analyze type-2 tilings. In a type-2 tiling, the last column is
covered by (parts of) $2$ horizontal dominos. These $2$ dominos must extend to
the left (because there is no space for them to extend to the right), and thus
also cover the second-to-last column. Explicitly speaking, these $2$ dominos
must be $\left\{  \left(  n-1,1\right)  ,\left(  n,1\right)  \right\}  $ and
$\left\{  \left(  n-1,2\right)  ,\left(  n,2\right)  \right\}  $. All the
other dominos in the tiling must then cover the remaining $n-2$ columns, i.e.,
must form a domino tiling of $R_{n-2,2}$. Thus, a type-2 tiling consists of
the two horizontal dominos $\left\{  \left(  n-1,1\right)  ,\left(
n,1\right)  \right\}  $ and $\left\{  \left(  n-1,2\right)  ,\left(
n,2\right)  \right\}  $ and an arbitrary domino tiling of $R_{n-2,2}$.
(Visually, this means that it looks as follows:
\begin{tabular}
[c]{|l|ll|}\hline
some domino & \phantom{w} & \phantom{w}\\\cline{2-3}%
tiling of $R_{n-2,2}$ & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
.) Hence,%
\begin{align}
\left(  \text{\# of type-2 tilings}\right)   &  =\left(  \text{\# of domino
tilings of }R_{n-2,2}\right) \label{pf.prop.1.4.2}\\
&  =d_{n-2,2} \label{pf.prop.1.4.2b}%
\end{align}
(since $d_{n-2,2}$ was defined as the \# of domino tilings of $R_{n-2,2}$).

Now, recall that each domino tiling of $R_{n,2}$ is either a type-1 tiling or
a type-2 tiling (but cannot be both at the same time). Hence,%
\begin{align}
&  \left(  \text{\# of domino tilings of }R_{n,2}\right) \nonumber\\
&  =\left(  \text{\# of type-1 tilings}\right)  +\left(  \text{\# of type-2
tilings}\right) \label{pf.prop.1.4.1+2}\\
&  =d_{n-1,2}+d_{n-2,2} \label{pf.prop.1.4.3}%
\end{align}
(by adding the equalities (\ref{pf.prop.1.4.1b}) and (\ref{pf.prop.1.4.2b})
together). Now, the definition of $d_{n,2}$ yields%
\[
d_{n,2}=\left(  \text{\# of domino tilings of }R_{n,2}\right)  =d_{n-1,2}%
+d_{n-2,2}%
\]
(by (\ref{pf.prop.1.4.3})). This proves Proposition \ref{prop.1.4}.
\end{proof}

\begin{fineprint}
Again, let us analyze what we have actually done in this proof:

\begin{enumerate}
\item The equality (\ref{pf.prop.1.4.1}) follows from the bijection principle.
Indeed, our argument for it boils down to the (easily established) fact that
there is a bijection%
\[
f:\left\{  \text{domino tilings of }R_{n-1,2}\right\}  \rightarrow\left\{
\text{type-1 tilings}\right\}
\]
(which takes any domino tiling of $R_{n-1,2}$, and adds the vertical domino
$\left\{  \left(  n,1\right)  ,\left(  n,2\right)  \right\}  $ to it). Once
you have convinced yourself of this fact, you can apply Theorem
\ref{thm.bij-rule} to $X=\left\{  \text{domino tilings of }R_{n-1,2}\right\}
$ and $Y=\left\{  \text{type-1 tilings of }R_{n,2}\right\}  $, and conclude
that%
\[
\left\vert \left\{  \text{domino tilings of }R_{n-1,2}\right\}  \right\vert
=\left\vert \left\{  \text{type-1 tilings}\right\}  \right\vert .
\]
In other words, $\left(  \text{\# of domino tilings of }R_{n-1,2}\right)
=\left(  \text{\# of type-1 tilings}\right)  $. Thus, the equality
(\ref{pf.prop.1.4.1}) is proven. The equality (\ref{pf.prop.1.4.2}) is
obtained similarly.

\item The equality (\ref{pf.prop.1.4.1+2}) follows from the sum rule. Indeed,
the sets $\left\{  \text{type-1 tilings}\right\}  $ and $\left\{  \text{type-2
tilings}\right\}  $ are disjoint, and their union is the set $\left\{
\text{domino tilings of }R_{n,2}\right\}  $. Hence, Theorem \ref{thm.1.2}
(applied to $S=\left\{  \text{domino tilings of }R_{n,2}\right\}  $, $k=2$,
$S_{1}=\left\{  \text{type-1 tilings}\right\}  $ and $S_{2}=\left\{
\text{type-2 tilings}\right\}  $) yields%
\[
\left\vert \left\{  \text{domino tilings of }R_{n,2}\right\}  \right\vert
=\left\vert \left\{  \text{type-1 tilings}\right\}  \right\vert +\left\vert
\left\{  \text{type-2 tilings}\right\}  \right\vert .
\]
In other words, $\left(  \text{\# of domino tilings of }R_{n,2}\right)
=\left(  \text{\# of type-1 tilings}\right)  +\left(  \text{\# of type-2
tilings}\right)  $. This proves (\ref{pf.prop.1.4.1+2}).
\end{enumerate}
\end{fineprint}

Proposition \ref{prop.1.4} lets us compute the numbers $d_{n,2}$ rather
easily, if we compute them in the appropriate order (i.e., start with
$d_{0,2}$ and $d_{1,2}$, then compute $d_{2,2}$, then compute $d_{3,2}$, then
compute $d_{4,2}$, and so on). For example, we get%
\begin{align*}
d_{5,2}  &  =\underbrace{d_{4,2}}_{=5}+\underbrace{d_{3,2}}_{=3}=5+3=8;\\
d_{6,2}  &  =\underbrace{d_{5,2}}_{=8}+\underbrace{d_{4,2}}_{=5}=8+5=13;\\
d_{7,2}  &  =\underbrace{d_{6,2}}_{=13}+\underbrace{d_{5,2}}_{=8}=13+8=21;\\
&  \ldots.
\end{align*}
But what if we want to compute (say) $d_{900,2}$ without having to first
compute all the previous numbers $d_{0,2},d_{1,2},\ldots,d_{899,2}$ ? Is there
an explicit formula?

Before we answer this question, let us forget for a moment about domino
tilings, and define the sequence of integers:

\begin{definition}
The \textit{Fibonacci sequence} is the sequence $\left(  f_{0},f_{1}%
,f_{2},\ldots\right)  $ of nonnegative integers defined recursively by%
\[
f_{0}=0,\ \ \ \ \ \ \ \ \ \ f_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ f_{n}=f_{n-1}+f_{n-2}\text{ for all }n\geq2.
\]

\end{definition}

This is a \textit{recursive definition} -- i.e., it tells us how to compute
$f_{n}$ assuming that the previous entries $f_{0},f_{1},\ldots,f_{n-1}$ of the
sequence are already known. Thus, if we want to compute $f_{5}$ using this
definition, we have to compute $f_{0},f_{1},f_{2},f_{3},f_{4}$ first. (Let us
do this: The definition yields $f_{0}=0$ and $f_{1}=1$ immediately.
Furthermore, setting $n=2$ in the equality $f_{n}=f_{n-1}+f_{n-2}$, we obtain
$f_{2}=\underbrace{f_{1}}_{=1}+\underbrace{f_{0}}_{=0}=1+0=1$. Next, setting
$n=3$ in the equality $f_{n}=f_{n-1}+f_{n-2}$, we obtain $f_{3}%
=\underbrace{f_{2}}_{=1}+\underbrace{f_{1}}_{=1}=1+1=2$. Likewise,
$f_{4}=\underbrace{f_{3}}_{=2}+\underbrace{f_{2}}_{=1}=2+1=3$. Likewise,
$f_{5}=\underbrace{f_{4}}_{=3}+\underbrace{f_{3}}_{=2}=5$.)

Here is a little table of Fibonacci numbers (this is how the entries $f_{n}$
of the Fibonacci sequence are called):%
\[%
\begin{tabular}
[c]{|c||c|c|c|c|c|c|c|c|c|c|c}\hline
$n$ & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ &
$\ \ \ \ \ \ \cdots\ \ \ \ \ \ $\\\hline
$f_{n}$ & $0$ & $1$ & $1$ & $2$ & $3$ & $5$ & $8$ & $13$ & $21$ & $34$ &
$\ \ \ \ \ \ \cdots\ \ \ \ \ \ $\\\hline
\end{tabular}
\ \ \ .
\]


The Fibonacci sequence is famous -- just look at
\href{https://en.wikipedia.org/wiki/Fibonacci_number}{its Wikipedia page}! It
also has several books dedicated to it, such as Vorobiev's \cite{Vorobi02}
(although, to be fully honest, Vorobiev often uses it as a plug to pivot to
other mathematics); there is also \href{https://www.fq.math.ca}{a journal
called \textit{The Fibonacci Quarterly}} (again, however, its actual scope is
broader). Now, we can reduce our problem of computing $d_{n,2}$ to the problem
of computing Fibonacci numbers:

\begin{proposition}
\label{prop.1.5}We have $d_{n,2}=f_{n+1}$ for each $n\in\mathbb{N}$.
\end{proposition}

\begin{proof}
Here is the main idea of the proof: We must show that the two sequences
$\left(  d_{0,2},d_{1,2},d_{2,2},d_{3,2},\ldots\right)  $ and $\left(
f_{1},f_{2},f_{3},f_{4},\ldots\right)  $ are identical. Both of them have the
property that their first entries are $1$'s (that is, $d_{0,2}=1$ and
$f_{1}=1$), their second entries are $1$'s (that is, $d_{1,2}=1$ and $f_{2}%
=1$), and each of their further entries equals the sum of the preceding two
entries (because Proposition \ref{prop.1.4} shows that the $d_{n,2}$ satisfy
$d_{n,2}=d_{n-1,2}+d_{n-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 \ref{prop.1.5}.

\begin{fineprint}
If you find this insufficiently rigorous, here is a formal version of this argument:

We shall prove Proposition \ref{prop.1.5} by strong induction on $n$.

A strong induction needs no induction base\footnote{See \cite[\S 2.8]%
{detnotes} for how strong induction works.}. Thus, we only do the induction step:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Proposition \ref{prop.1.5} holds for each $n<m$. We must
prove that Proposition \ref{prop.1.5} holds for $n=m$.

Our induction hypothesis says that Proposition \ref{prop.1.5} holds for each
$n<m$. In other words, we have%
\begin{equation}
d_{n,2}=f_{n+1}\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}\text{
satisfying }n<m. \label{pf.prop.1.5.IH}%
\end{equation}


Now, we must prove that Proposition \ref{prop.1.5} holds for $n=m$. In other
words, we must prove that $d_{m,2}=f_{m+1}$. If $m=0$, then this is true
(since $d_{0,2}=1=f_{1}=f_{0+1}$). If $m=1$, then this is also true (since
$d_{1,2}=1=f_{2}=f_{1+1}$). Hence, it remains to prove this in the case
$m\geq2$. So let us WLOG\footnote{\textquotedblleft WLOG\textquotedblright%
\ means \textquotedblleft without loss of generality\textquotedblright. We can
assume that $m\geq2$ without loss of generality, since we have already proven
our claim (that $d_{m,2}=f_{m+2}$) in all other cases.} assume that $m\geq2$.
Then, $m-2\in\mathbb{N}$. Hence, we can apply (\ref{pf.prop.1.5.IH}) to
$n=m-2$ (since $m-2<m$), and obtain $d_{m-2,2}=f_{\left(  m-2\right)
+1}=f_{m-1}$. Furthermore, $m-1\in\mathbb{N}$ (since $m\geq2\geq1$). Thus, we
can apply (\ref{pf.prop.1.5.IH}) to $n=m-1$ (since $m-1<m$), and obtain
$d_{m-1,2}=f_{\left(  m-1\right)  +1}=f_{m}$. However, Proposition
\ref{prop.1.4} (applied to $n=m$) shows that%
\[
d_{m,2}=\underbrace{d_{m-1,2}}_{=f_{m-1}}+\underbrace{d_{m-2,2}}_{=f_{m-2}%
}=f_{m-1}+f_{m-2}.
\]
Comparing this with%
\[
f_{m}=f_{m-1}+f_{m-2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
the Fibonacci sequence}\right)  ,
\]
we obtain $d_{m,2}=f_{m}$. In other words, Proposition \ref{prop.1.5} holds
for $n=m$. This completes the induction step. Thus, Proposition \ref{prop.1.5}
is proven.
\end{fineprint}
\end{proof}

So we have identified our numbers $d_{n,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:

\begin{theorem}
[Binet's formula]\label{thm.1.6}For each $n\in\mathbb{N}$, we have%
\[
f_{n}=\dfrac{1}{\sqrt{5}}\left(  \varphi^{n}-\psi^{n}\right)  ,
\]
where
\[
\varphi=\dfrac{1+\sqrt{5}}{2}\approx1.618\ldots\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \psi=\dfrac{1-\sqrt{5}}{2}\approx-0.618\ldots.
\]

\end{theorem}

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 $\sqrt{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 $\varphi$ and $\psi$ in Theorem \ref{thm.1.6} are known as the
\textit{golden ratios} (although usually only $\varphi$ is considered
\textquotedblleft the golden ratio\textquotedblright). They are the two roots
of the quadratic polynomial $x^{2}-x-1$, so they satisfy $\varphi^{2}%
=\varphi+1$ and $\psi^{2}=\psi+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.

\begin{fineprint}
How do you compute $f_{900}$ using Theorem \ref{thm.1.6}? 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 $\sqrt{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, $\sqrt{5}$ is an \textit{algebraic
number} (i.e., a root of a polynomial with rational coefficients), and this
means that it \textbf{is} possible to make \textbf{exact} computations with
it. You just need to restrict yourself to the \textquotedblleft$\sqrt{5}%
$-rationals\textquotedblright\ (i.e., the numbers of the form $a+b\sqrt{5}$
with $a,b\in\mathbb{Q}$), and instead of approximating them with decimals, you
just keep them in the $a+b\sqrt{5}$ form. It is easy to find rules for adding,
subtracting, multiplying and dividing $\sqrt{5}$-rationals by one
another\footnote{To wit:%
\begin{align*}
\left(  a+b\sqrt{5}\right)  +\left(  c+d\sqrt{5}\right)   &  =\left(
a+c\right)  +\left(  b+d\right)  \sqrt{5};\\
\left(  a+b\sqrt{5}\right)  -\left(  c+d\sqrt{5}\right)   &  =\left(
a-c\right)  +\left(  b-d\right)  \sqrt{5};\\
\left(  a+b\sqrt{5}\right)  \left(  c+d\sqrt{5}\right)   &  =\left(
ac+5bd\right)  +\left(  ad+bc\right)  \sqrt{5};\\
\dfrac{a+b\sqrt{5}}{c+d\sqrt{5}}  &  =\dfrac{\left(  a+b\sqrt{5}\right)
\left(  c-d\sqrt{5}\right)  }{\left(  c+d\sqrt{5}\right)  \left(  c-d\sqrt
{5}\right)  }=\dfrac{\left(  ac-5bd\right)  +\left(  bc-ad\right)  \sqrt{5}%
}{c^{2}-5d^{2}}.
\end{align*}
Note in particular the last equation: This is why they taught you to
rationalize denominators in high school!}; thus you don't need approximate
values. Using the
\href{https://en.wikipedia.org/wiki/Exponentiation_by_squaring}{\textquotedblleft
exponentiation by squaring\textquotedblright} trick, it is now easy to compute
very high powers of $\varphi$ and $\psi$, and then Theorem \ref{thm.1.6}
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 \ref{thm.1.6} 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, $\left\vert \psi\right\vert <1$, so that $\psi
^{n}\rightarrow0$ when $n\rightarrow\infty$. Hence, for high enough $n$, we
have $f_{n}\approx\dfrac{1}{\sqrt{5}}\varphi^{n}$. Of course, the sequence of
$\dfrac{1}{\sqrt{5}}\varphi^{n}$ for $n\in\mathbb{N}$ is a geometric sequence
with ratio $\varphi\approx1.618\ldots$, and grows exponentially. Thus, we see
that the Fibonacci numbers $f_{n}$ grow exponentially -- slower than the
powers of $2$ (since $1.618\ldots<2$), but still faster than any polynomial.
The Fibonacci number $f_{n}$ will have $\approx\left(  \log_{10}%
\varphi\right)  \cdot n\approx0.209\cdot n$ many digits.
\end{fineprint}

Theorem \ref{thm.1.6} is easy to prove:

\begin{proof}
[Proof of Theorem \ref{thm.1.6} (sketched).]This can be proven by the same
argument that we used for Proposition \ref{prop.1.5}: We have to show that the
sequences $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ and $\left(  \dfrac
{1}{\sqrt{5}}\left(  \varphi^{0}-\psi^{0}\right)  ,\dfrac{1}{\sqrt{5}}\left(
\varphi^{1}-\psi^{1}\right)  ,\dfrac{1}{\sqrt{5}}\left(  \varphi^{2}-\psi
^{2}\right)  ,\ldots\right)  $ are identical. Both of them 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 entries\footnote{Indeed, for the Fibonacci
sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $, this is clear. For the
second sequence, this boils down to proving the identity%
\[
\dfrac{1}{\sqrt{5}}\left(  \varphi^{n}-\psi^{n}\right)  =\dfrac{1}{\sqrt{5}%
}\left(  \varphi^{n-1}-\psi^{n-1}\right)  +\dfrac{1}{\sqrt{5}}\left(
\varphi^{n-2}-\psi^{n-2}\right)  ,
\]
which however follows by subtracting the two easily verified identities%
\[
\varphi^{n}=\varphi^{n-1}+\varphi^{n-2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \psi^{n}=\psi^{n-1}+\psi^{n-2}%
\]
and dividing the result by $\sqrt{5}$.}. 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
\ref{thm.1.6}.
\end{proof}

This proof should convince you that Theorem \ref{thm.1.6} holds, but does not
explain how you could have come up with Theorem \ref{thm.1.6}. If time allows,
we will later explain this when we explore the concept of \textit{generating
functions}.

\subsubsection{Kasteleyn's formula (teaser)}

Now we have computed $d_{n,2}$ for each $n\in\mathbb{N}$. What about $d_{n,3}$ ?

Proposition \ref{prop.1.1} shows that $d_{n,3}=0$ when $n$ is odd. But
computing $d_{n,3}$ when $n$ is even is a lot harder. You might try to find a
recursive formula such as Proposition \ref{prop.1.4}, but this isn't so easy
any more. You can still try to separate the domino tilings of $R_{n,3}$ into
types according to how the last column looks like; however, there will be
three of these types now, and two of them will not fall into a 1-to-1
correspondence with domino tilings of a smaller rectangle. For example,
consider the following domino tiling of $R_{6,3}$:%
\[%
\begin{tabular}
[c]{|cccccc|}\hline
\multicolumn{1}{|c|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{c|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{c|}{\phantom{w}} & \phantom{w}\\\cline{2-5}\cline{4-5}%
\multicolumn{1}{|c|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{c|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{c|}{\phantom{w}} & \phantom{w}\\\hline
\phantom{w} & \multicolumn{1}{c|}{\phantom{w}} & \phantom{w} &
\multicolumn{1}{c|}{\phantom{w}} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ .
\]
There is no tiling of $R_{5,3}$ anywhere in it, nor of $R_{4,3}$, nor of
$R_{3,3}$, nor of $R_{2,3}$, nor of $R_{1,3}$. This thwarts our recursive approach.

Nevertheless, there \textbf{is} a nice recursion for $d_{n,3}$:

\begin{proposition}
\label{prop.domino.dn3}We have $d_{n,3}=4d_{n-2,3}-d_{n-4,3}$ for each
$n\geq4$.
\end{proposition}

As I said, there is no proof as easy as the one we gave for Proposition
\ref{prop.1.4}. We will later learn the technique of \textit{generating
functions}, which can be used to give a reasonably simple proof (see
\cite{Read80}), and probably a more complicated induction could also do the trick.

What about $d_{n,4}$ ? There is a recursion, too, according to \cite[\S 2]%
{Read80}:%
\[
d_{n,4}=d_{n-1,4}+5d_{n-2,4}+d_{n-3,4}-d_{n-4,4}.
\]
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 \ref{thm.1.6}). However, these formulas become more and more
complicated as well, and in particular they no longer involve
\textquotedblleft nice\textquotedblright\ irrational numbers like $\sqrt{5}$,
but rather roots of higher-degree polynomials, which at some point can no
longer be expressed using rational numbers, sums, differences, products,
quotients and radicals (i.e., $\sqrt[a]{b}$ terms)\footnote{The roots of a
quadratic polynomial $x^{2}+ax+b$ can be expressed in this way: They are
$\dfrac{-a\pm\sqrt{a^{2}-4b}}{2}$. The roots of a degree-$3$ or degree-$4$
polynomial can also be expressed in this way, using complicated formulas due
to Tartaglia, Ferrari, Cardano and Descartes. But the
\href{https://en.wikipedia.org/wiki/Abel-Ruffini_theorem}{\textit{Abel--Ruffini
theorem}} says that for $k\geq5$, there is no formula that expresses the roots
of a (general) degree-$k$ polynomial using only $+$, $-$, $\cdot$, $/$ and
$\sqrt{\ }$.}. This looks like a dead end.

In the 20th Century, however, theoretical physicists studying thermodynamics
got interested in computing $d_{n,m}$, as they considered a domino tiling to
be a (rather idealized) model for a liquid consisting of \textquotedblleft
dimers\textquotedblright\ (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 \cite{Kastel61}). In 1961, Kasteleyn
found the following surprising formula for $d_{n,m}$:

\begin{theorem}
[Kasteleyn's formula]\label{thm.1.7}Assume that $m$ is even and $n\geq1$.
Then,%
\[
d_{n,m}=2^{mn/2}\prod_{j=1}^{m/2}\prod_{k=1}^{n}\sqrt{\left(  \cos\dfrac{j\pi
}{m+1}\right)  ^{2}+\left(  \cos\dfrac{k\pi}{n+1}\right)  ^{2}}.
\]
(Here, we are using the product sign $\prod$: That is, if $a_{1},a_{2}%
,\ldots,a_{p}$ are any numbers, then $\prod_{i=1}^{p}a_{i}$ means the product
$a_{1}a_{2}\cdots a_{p}$. The presence of two product signs directly following
one another means that we are taking a product of products.)
\end{theorem}

Actually, \textquotedblleft surprising\textquotedblright\ is an
understatement; why cosines of angles would appear in a formula for the
integer $d_{n,m}$ is even less transparent than why $\sqrt{5}$ should appear
in a formula for Fibonacci numbers!

We won't even get close to proving Theorem \ref{thm.1.7}. A proof outline
appears in \cite[Theorem 12.85]{Loehr-BC}, serving as a culmination of a
graduate-level combinatorics textbook. A more self-contained exposition of the
proof has been given by Stucky in \cite{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 \ref{thm.1.7} actually provides a
good way of computing $d_{n,m}$. Indeed, cosines like $\cos\dfrac{j\pi}{m+1}$
and $\cos\dfrac{k\pi}{n+1}$ are algebraic numbers 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 $d_{8,8}=12\ 988\ 816$. This wouldn't be so easy to check by a brute
force search for domino tilings!

\begin{center}
\fbox{\textbf{Class of 2019-09-27}}
\end{center}

\subsubsection{Axisymmetric domino tilings}

Let us solve a few more counting exercises around domino tilings.

\begin{exercise}
\label{exe.1.8}Let $n\in\mathbb{N}$. Say that a domino tiling $T$ of $R_{n,2}$
is \textit{axisymmetric} if reflecting it across the vertical axis of symmetry
of $R_{n,2}$ leaves it unchanged (i.e., for each domino $\left\{  \left(
i,j\right)  ,\left(  i^{\prime},j^{\prime}\right)  \right\}  \in T$, the
\textquotedblleft mirror domino\textquotedblright\ $\left\{  \left(
n+1-i,j\right)  ,\left(  n+1-i^{\prime},j^{\prime}\right)  \right\}  $ also
belongs to $T$).

For example, the tilings%
\[%
\begin{tabular}
[c]{|l|ll|l|c|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w} &
\phantom{w}\\\cline{2-3}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \
\begin{tabular}
[c]{|l|lll|c|}\hline
\multicolumn{1}{|l|}{\phantom{w}} & \multicolumn{1}{|l|}{\phantom{w}} &
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{3-4}%
\phantom{w} & \multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} & \phantom{w} &
\phantom{w}\\\hline
\end{tabular}
\
\]
are not axisymmetric (indeed, reflecting them across the vertical line
transforms them into one another, and they are not the same), but the tilings%
\[%
\begin{tabular}
[c]{|l|l|l|l|c|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w} &
\phantom{w}\\\cline{6-6}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \
\begin{tabular}
[c]{|clllc|}\hline
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w} & \phantom{w}\\\cline{1-2}%
\cline{4-5}\cline{4-6}%
\phantom{w} & \multicolumn{1}{l|}{\phantom{w}} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\]
are axisymmetric.

How many axisymmetric domino tilings does $R_{n,2}$ have?
\end{exercise}

\begin{example}
Let us list the axisymmetric domino tilings for $R_{n,2}$ when $n$ is small:%
\[%
\begin{tabular}
[c]{|c|l|c|}\hline
$n$ & axisymmetric domino tilings & $%
\begin{array}
[c]{c}%
\text{their}\\
\text{number}%
\end{array}
$\\\hline\hline
$0$ &
\begin{tabular}
[c]{|l}%
\phantom{w}\\
\phantom{w}
\end{tabular}
& $1$\\\hline
$1$ &
\begin{tabular}
[c]{|l|}\hline
\phantom{w}\\\cline{2-2}%
\phantom{w}\\\hline
\end{tabular}
& $2$\\\hline
$2$ &
\begin{tabular}
[c]{|l|l|}\hline
\phantom{w} & \phantom{w}\\\cline{3-3}%
\phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ $,\ \ \ $%
\begin{tabular}
[c]{|ll|}\hline
\phantom{w} & \phantom{w}\\\hline
\phantom{w} & \phantom{w}\\\hline
\end{tabular}
& $1$\\\hline
$3$ & $%
\begin{tabular}
[c]{|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w}\\\cline{4-4}%
\phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ $ & $3$\\\hline
$4$ &
\begin{tabular}
[c]{|l|l|l|l|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{5-5}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\ \ \
\begin{tabular}
[c]{|l|ll|l|}\hline
\multicolumn{1}{|l|}{\phantom{w}} & \phantom{w} & \phantom{w} &
\phantom{w}\\\cline{2-3}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
\ \ \ ,\ \ \
\begin{tabular}
[c]{|ll|ll|}\hline
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\cline{1-2}\cline{3-4}%
\phantom{w} & \phantom{w} & \phantom{w} & \phantom{w}\\\hline
\end{tabular}
& $2$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]

\end{example}

\begin{proof}
[Solution sketch to Exercise \ref{exe.1.8}.]Let us only show the main steps; a
(more) detailed solution to Exercise \ref{exe.1.8} can be found in
\cite[Exercise 5]{17f-hw1s}.

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 $R_{n,2}$ has one of the following two forms:

\begin{itemize}
\item \textbf{Form 1:} a domino tiling $J$ of $R_{n/2,2}$ covering the left
half of $R_{n,2}$, and its mirror image across the vertical axis covering the
right half:%
\[%
\begin{tabular}
[c]{|p{4cm}|p{4cm}|}\hline
domino tiling $J$ & mirror image\\\cline{3-3}%
of $R_{n/2,2}$ & of $J$\\\hline
\end{tabular}
\ \ \ \ \ \ ;
\]
(Note that the vertical axis cuts through the middle of this picture.)

\item \textbf{Form 2:} a domino tiling $J$ of $R_{n/2-1,2}$ covering the
leftmost $n/2-1$ columns of $R_{n,2}$, and two horizontal dominos covering the
$\left(  n/2\right)  $-th and $\left(  n/2+1\right)  $-th columns\footnote{We
count columns from the left.}, and the mirror image of $J$ across the vertical
axis covering the rightmost $n/2-1$ columns of $R_{n,2}$:%
\[%
\begin{tabular}
[c]{|p{3.5cm}|cc|p{3.5cm}|}\hline
domino tiling $J$ & \phantom{w} & \multicolumn{1}{c|}{\phantom{w}} & mirror
image\\\cline{2-3}%
of $R_{n/2-1,2}$ & \phantom{w} & \multicolumn{1}{c|}{\phantom{w}} & of
$J$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
(Again, the vertical axis cuts through the middle of this picture.)
\end{itemize}

\noindent If you agree with me that these are the only possible forms of an
axisymmetric domino tiling of $R_{n,2}$, then it follows (by the same logic as
in the proof of Proposition \ref{prop.1.4}) that the \# of axisymmetric domino
tilings of $R_{n,2}$ is%
\begin{align*}
&  \underbrace{\left(  \text{\# of domino tilings of }R_{n/2,2}\right)
}_{\substack{=d_{n/2,2}=f_{n/2+1}\\\text{(by Proposition \ref{prop.1.5},
applied to }n/2\\\text{instead of }n\text{)}}}+\underbrace{\left(  \text{\# of
domino tilings of }R_{n/2-1,2}\right)  }_{\substack{=d_{n/2-1,2}%
=f_{n/2}\\\text{(by Proposition \ref{prop.1.5}, applied to }%
n/2-1\\\text{instead of }n\text{)}}}\\
&  =f_{n/2+1}+f_{n/2}=f_{n/2+2}%
\end{align*}
(by the recursive definition of the Fibonacci numbers). But why are the
above-mentioned two forms the only possible forms of an axisymmetric domino
tiling of $R_{n,2}$ ?

To prove this, we fix an axisymmetric domino tiling $T$ of $R_{n,2}$. We must
show that $T$ has one of the above two forms. We can consider what dominos
cover the $\left(  n/2\right)  $-th column in $T$. If this column is covered
by one vertical domino, then no domino of $T$ straddles the vertical axis, and
thus the tiling $T$ has Form 1 (indeed, the part of $T$ to the right of the
vertical axis is a mirror image of the part to the left, since $T$ is
axisymmetric). It remains to deal with the case when the $\left(  n/2\right)
$-th column is covered by two horizontal dominos in $T$. The question is now
where these horizontal dominos fall. If both of them fall into columns $n/2-1$
and $n/2$, then our tiling $T$ has Form 1. If both of them fall into columns
$n/2$ and $n/2+1$, then our tiling $T$ has Form 2. What about the remaining
\textquotedblleft rogue\textquotedblright\ possibility, that one of them falls
into columns $n/2-1$ and $n/2$, while the other falls into columns $n/2$ and
$n/2+1$ ? Here is a picture (which assumes that the former domino is in the
top row and the latter domino is in the bottom row; but the argument will be
the same in the opposite case):%
\[%
\begin{tabular}
[c]{|lllll|}\hline
some dominos & \multicolumn{1}{|l}{\phantom{w}} &
\multicolumn{1}{l|}{\phantom{w}} & \phantom{w} & some further\\\cline{2-4}%
\cline{2-4}%
$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $ & \phantom{w} &
\multicolumn{1}{|l}{\phantom{w}} & \multicolumn{1}{l|}{\phantom{w}} &
\ \ \ \ \ \ \ \ \ dominos$\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\\\hline
\end{tabular}
\ \ \ \ .
\]
Note, however, that the part marked \textquotedblleft some
dominos\textquotedblright\ in this picture has an odd number of squares
(namely, $2\left(  n/2-1\right)  +1=n-1$ many squares), so that it cannot
actually be covered by dominos!\footnote{This is the same logic that we used
to prove Proposition \ref{prop.1.1}.} Thus, we obtain a contradiction. Hence,
this \textquotedblleft rogue\textquotedblright\ possibility is actually
impossible. This shows that every axisymmetric domino tiling $T$ of $R_{n,2}$
either has Form 1 or has Form 2.

Thus, we have proved that the \# of axisymmetric domino tilings of $R_{n,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 $R_{n,2}$ has the following form:

\begin{itemize}
\item \textbf{Form 1:} a domino tiling $J$ of $R_{\left(  n-1\right)  /2,2}$
covering the leftmost $\left(  n-1\right)  /2$ columns of $R_{n,2}$, and one
vertical domino covering the $\left(  n+1\right)  /2$-th column, and the
mirror image of $J$ across the vertical axis covering the rightmost $\left(
n-1\right)  /2$ columns of $R_{n,2}$:%
\[%
\begin{tabular}
[c]{|p{3.5cm}|l|p{3.5cm}|}\hline
domino tiling $J$ & \phantom{w} & mirror image\\\cline{4-4}%
of $R_{\left(  n-1\right)  /2,2}$ & \phantom{w} & of $J$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
(Again, the vertical axis cuts through the middle of this picture, which in
this case means cutting through the middle of the vertical domino.)
\end{itemize}

\noindent 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 that if an axisymmetric tiling $T$ of $R_{n,2}$ contained any
horizontal domino intersect with its $\left(  n+1\right)  /2$-th column, then
it would also contain the mirror image of this tile across the vertical axis
(since $T$ is axisymmetric), but then this tile and its mirror image would be
distinct but overlapping\footnote{They would overlap in the $\left(
n+1\right)  /2$-th column.}, which would contradict the definition of a domino tiling.

Thus, when $n$ is odd, the \# of axisymmetric domino tilings of $R_{n,2}$
equals the \# of domino tilings of $R_{\left(  n-1\right)  /2,2}$, which (by
Proposition \ref{prop.1.5}) is $f_{\left(  n-1\right)  /2+1}=f_{\left(
n+1\right)  /2}$.

Thus, the general formula for the \# of axisymmetric domino tilings of
$R_{n,2}$ is:%
\[
\left(  \text{\# of axisymmetric domino tilings of }R_{n,2}\right)  =%
\begin{cases}
f_{n/2+2}, & \text{if }n\text{ is even};\\
f_{\left(  n+1\right)  /2}, & \text{if }n\text{ is odd}%
\end{cases}
.
\]

\end{proof}

\subsubsection{\label{subsect.intro.domino.k-brick}Tiling rectangles with
$k$-bricks}

Now, let us look at another related problem.

For the rest of Subsection \ref{subsect.intro.domino.k-brick}, fix a positive
integer $k$.

A $k$\textit{-brick} shall mean a $1\times k$-rectangle or a $k\times
1$-rectangle. More specifically: A \textit{vertical }$k$\textit{-brick} shall
mean a $1\times k$-rectangle (i.e., a set of the form%
\[
\left\{  \left(  i,j\right)  ,\left(  i,j+1\right)  ,\left(  i,j+2\right)
,\ldots,\left(  i,j+k-1\right)  \right\}
\]
for some $i,j\in\mathbb{Z}$); a \textit{horizontal }$k$\textit{-brick} shall
mean a $k\times1$-rectangle (i.e., a set of the form%
\[
\left\{  \left(  i,j\right)  ,\left(  i+1,j\right)  ,\left(  i+2,j\right)
,\ldots,\left(  i+k-1,j\right)  \right\}
\]
for some $i,j\in\mathbb{Z}$). Here is how they look like:%
\[
\underbrace{\ \
\begin{tabular}
[c]{|l|}\hline
$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$\\\hline
\end{tabular}
\ \ }_{\text{vertical }k\text{-brick}}\text{;}%
\ \ \ \ \ \ \ \ \ \ \underbrace{\ \
\begin{tabular}
[c]{|l|}\hline
$\phantom{wwwwwk}$\\\hline
\end{tabular}
\ \ }_{\text{horizontal }k\text{-brick}}\text{.}%
\]


If $S$ is a set of squares, then a $k$\textit{-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 $R_{n,m}$ have a $k$-brick tiling? The answer is
surprisingly simple:

\begin{proposition}
\label{prop.1.9}Let $n,m\in\mathbb{N}$, and let $k$ be a positive integer.
Then, the rectangle $R_{n,m}$ has a $k$-brick tiling if and only if we have
$k\mid m$ or $k\mid n$.
\end{proposition}

In the case when $k=2$, Proposition \ref{prop.1.9} says that the rectangle
$R_{n,m}$ has a domino tiling if and only if we have $2\mid m$ or $2\mid 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 \textquotedblleft%
$\Longrightarrow$\textquotedblright\ direction: i.e., the direction saying
that if $R_{n,m}$ has a domino tiling, then at least one of $m$ and $n$ is
even) follows from Proposition \ref{prop.1.1}, whereas the other direction is
easy. We could use a similar argument to prove Proposition \ref{prop.1.9}
whenever the number $k$ is prime. Indeed, our proof of Proposition
\ref{prop.1.1} generalizes to show that if the rectangle $R_{n,m}$ has a
$k$-brick tiling, then $k\mid mn$. When $k$ is prime, the divisibility $k\mid
mn$ implies that $k\mid m$ or $k\mid n$; thus, the \textquotedblleft%
$\Longrightarrow$\textquotedblright\ direction of Proposition \ref{prop.1.9}
would follow immediately in this case. But when $k$ is prime, we need a better argument.

\begin{proof}
[Proof of Proposition \ref{prop.1.9}.]The claim we want to prove is an
\textquotedblleft if and only if\textquotedblright\ claim, so it has two
directions: the \textquotedblleft$\Longleftarrow$\textquotedblright\ direction
(also known as the \textquotedblleft if\textquotedblright\ direction), and the
\textquotedblleft$\Longrightarrow$\textquotedblright\ direction (also known as
the \textquotedblleft only if\textquotedblright\ direction). The former
direction claims that if we have $k\mid m$ or $k\mid n$, then the rectangle
$R_{n,m}$ has a $k$-brick tiling. The latter claims the converse of this statement.

We shall prove these two directions separately:

$\Longleftarrow:$ Assume that $k\mid m$ or $k\mid n$.

If $k\mid m$, then $R_{n,m}$ has a $k$-brick tiling consisting entirely of
vertical $k$-bricks. It looks as follows:%
\[%
\begin{tabular}
[c]{cccc}\cline{1-2}\cline{4-4}%
\multicolumn{1}{|c}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} &
\multicolumn{1}{|c|}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} & \multicolumn{1}{|c}{$\cdots$} &
\multicolumn{1}{|c|}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
}\\\cline{1-2}\cline{4-4}%
\multicolumn{1}{|c}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} &
\multicolumn{1}{|c|}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} & \multicolumn{1}{|c}{$\cdots$} &
\multicolumn{1}{|c|}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
}\\\cline{1-2}\cline{4-4}%
$\substack{\vdots\vspace{-0.4pc} \\ \vdots\vspace{0.4pc} }$ & $\substack
{\vdots\vspace{-0.4pc} \\ \vdots\vspace{0.4pc} }$ & $\ddots$ & $\substack
{\vdots\vspace{-0.4pc} \\ \vdots\vspace{0.4pc} }$\\\cline{1-2}\cline{4-4}%
\multicolumn{1}{|c}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} &
\multicolumn{1}{|c}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
} & \multicolumn{1}{|c}{$\cdots$} &
\multicolumn{1}{|c|}{$\vphantom{\dfrac{\dfrac{1}{1}}{\dfrac{1}{1}}}\phantom{w}$%
}\\\cline{1-2}\cline{4-4}%
\end{tabular}
\]
(with each column being covered by $m/k$ many vertical $k$-bricks). Similarly,
if $k\mid n$, then $R_{n,m}$ has a $k$-brick tiling consisting entirely of
horizontal $k$-bricks. Thus, in either case, $R_{n,m}$ has a $k$-brick tiling.
This proves the \textquotedblleft$\Longleftarrow$\textquotedblright\ direction
of Proposition \ref{prop.1.9}.

$\Longrightarrow:$ Assume that the rectangle $R_{n,m}$ has a $k$-brick tiling.
We must prove that we have $k\mid m$ or $k\mid n$.

Assume the contrary (for the sake of contradiction). Thus, $k\nmid m$ and
$k\nmid n$.

We shall use the following notations from elementary number theory: If $a$ is
an integer and $b$ is a positive integer, then

\begin{itemize}
\item we let $a\mathbin{/\mkern-6mu/} b$ denote the quotient obtained when
dividing $a$ by $b$ (in the sense of division with remainder);

\item we let $a\%b$ denote the remainder obtained when dividing $a$ by $b$.
\end{itemize}

Both of these numbers $a\mathbin{/\mkern-6mu/}b$ and $a\%b$ are integers, and
they satisfy $0\leq a\%b<b$ and $a=\left(  a\mathbin{/\mkern-6mu/}b\right)
\cdot b+\left(  a\%b\right)  $.

Let $r=n\%k$ and $s=m\%k$. We have $r=n\%k\neq0$ (since $k\nmid 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 $R_{n,m}$ with $k$ colors. The $k$
colors we are going to use will be numbered $0,1,\ldots,k-1$. Each square
$\left(  i,j\right)  \in R_{n,m}$ will be colored with the color $\left(
i+j-2\right)  \%k$. Here is how this coloring looks like (in the example where
$k=4$, $n=10$ and $m=7$):%
\[%
\begin{tabular}
[c]{|cccccccccc|}\hline
$2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$\\\cline{11-11}%
$1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$\\\cline{11-11}%
$0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$\\\cline{11-11}%
$3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$\\\cline{11-11}%
$2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$\\\cline{11-11}%
$1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$\\\cline{11-11}%
$0$ & $1$ & $2$ & $3$ & $0$ & $1$ & $2$ & $3$ & $0$ & $1$\\\hline
\end{tabular}
\]
(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:

\begin{itemize}
\item The southwesternmost square $R_{n,m}$ is $\left(  1,1\right)  $, and
thus has color $\left(  1+1-2\right)  \%2=0\%2=0$.

\item As we move eastwards, the colors of the squares increase by $1$ at each
step, until they reach $k-1$, at which point they \textquotedblleft fall back
down\textquotedblright\ to $0$ at the next step.

\item The same happens as we move northwards.

\item Along each \textquotedblleft northwest-to-southeast\textquotedblright%
\ diagonal (i.e., each line with slope $-1$), the color stays constant.
\end{itemize}

Let us say that a finite set $S$ of squares is \textit{balanced} if it has
equally many squares of each color. In other words, a finite set $S$ of
squares is \textit{balanced} if and only if for any color $h\in\left\{
0,1,\ldots,k-1\right\}  $, 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:%
\[%
\begin{tabular}
[c]{|llllllll|}\hline
$\phantom{1}u\phantom{1}$ & $u+1$ & $\cdots$ & $k-1$ &
$\phantom{1}0\phantom{1}$ & $\phantom{1}1\phantom{1}$ & $\cdots$ &
$u-1$\\\hline
\end{tabular}
\
\]
(where $u$ is the color of the leftmost square of the $k$-brik). Thus, each
horizontal $k$-brick is balanced. Likewise, each vertical $k$-brick is
balanced. Thus, we have shown that each $k$-brick is balanced.

But we have assumed that the rectangle $R_{n,m}$ has a $k$-brick tiling.
Hence, $R_{n,m}$ must, too, be balanced (by the sum rule)\footnote{Here is the
argument in details:
\par
We have assumed that the rectangle $R_{n,m}$ has a $k$-brick tiling. Let $T$
be this $k$-brick tiling. Write $T$ in the form $T=\left\{  S_{1},S_{2}%
,\ldots,S_{j}\right\}  $, where $S_{1},S_{2},\ldots,S_{j}$ are distinct
$k$-bricks. Hence, each square in $R_{n,m}$ belongs to exactly one of
$S_{1},S_{2},\ldots,S_{j}$. Now, for each color $h\in\left\{  0,1,\ldots
,k-1\right\}  $, we have%
\begin{align*}
&  \left(  \text{\# of all squares in }R_{n,m}\text{ that have color }h\right)
\\
&  =\left(  \text{\# of all squares in }R_{n,m}\text{ that belong to }%
S_{1}\text{ and have color }h\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of all squares in }R_{n,m}\text{ that
belong to }S_{2}\text{ and have color }h\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of all squares in }R_{n,m}\text{ that
belong to }S_{j}\text{ and have color }h\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the sum rule, since each square in }R_{n,m}\\
\text{belongs to exactly one of }S_{1},S_{2},\ldots,S_{j}%
\end{array}
\right) \\
&  =\sum_{i=1}^{j}\underbrace{\left(  \text{\# of all squares in }%
R_{n,m}\text{ that belong to }S_{i}\text{ and have color }h\right)
}_{\substack{=\left(  \text{\# of all squares in }S_{i}\text{ that have color
}h\right)  \\\text{(since }S_{i}\subseteq R_{n,m}\text{)}}}\\
&  =\sum_{i=1}^{j}\underbrace{\left(  \text{\# of all squares in }S_{i}\text{
that have color }h\right)  }_{\substack{\text{independent of }h\\\text{(since
}S_{i}\text{ is balanced)}}}.
\end{align*}
Hence, for each $h\in\left\{  0,1,\ldots,k-1\right\}  $, the \# of all squares
in $R_{n,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, $R_{n,m}$ is
balanced.}.

Let us now subdivide the rectangle $R_{n,m}$ into several (disjoint)
\textit{zones} $Z_{u,v}$ by cutting it with several lines\footnote{We will
give a rigorous definition further below.}. 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 $R_{n,m}$:%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
\multicolumn{1}{|c|}{$Z_{0,2}$} & \multicolumn{1}{|c|}{$Z_{1,2}$} &
\multicolumn{1}{|c|}{$Z_{2,2}$} & $Z_{3,2}$\\\hline
$\vphantom{\dfrac{\int^\int}{\int_\int}}\ \ \ Z_{0,1}%
\ \ \ \vphantom{\dfrac{\int^\int}{\int_\int}}$ & $Z_{1,1}$ & $Z_{2,1}$ &
$Z_{3,1}$\\\hline
$\vphantom{\dfrac{\int^\int}{\int_\int}}\ \ \ Z_{0,0}%
\ \ \ \vphantom{\dfrac{\int^\int}{\int_\int}}$ &
$\vphantom{\dfrac{\int^\int}{\int_\int}}\ \ \ Z_{1,0}%
\ \ \ \vphantom{\dfrac{\int^\int}{\int_\int}}$ &
$\vphantom{\dfrac{\int^\int}{\int_\int}}\ \ \ Z_{2,0}%
\ \ \ \vphantom{\dfrac{\int^\int}{\int_\int}}$ & $Z_{3,0}$\\\hline
\end{tabular}
\ \ .
\]


Formally speaking, our zones $Z_{u,v}$ are defined as follows:%
\begin{align*}
Z_{u,v}  &  =\left\{  \left(  i,j\right)  \in R_{n,m}\ \mid\ \left(
i-1\right)  \mathbin{/\mkern-6mu/} k=u\text{ and }\left(  j-1\right)
\mathbin{/\mkern-6mu/} k=v\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \text{for all }u\in\left\{  0,1,\ldots,\left(
n-1\right)  \mathbin{/\mkern-6mu/} k\right\}  \text{ and }v\in\left\{
0,1,\ldots,\left(  m-1\right)  \mathbin{/\mkern-6mu/} k\right\}  .
\end{align*}


All these zones $Z_{u,v}$ are rectangles. More precisely: Let us call a zone
$Z_{u,v}$ (with $u\in\left\{  0,1,\ldots,\left(  n-1\right)
\mathbin{/\mkern-6mu/} k\right\}  $ and $v\in\left\{  0,1,\ldots,\left(
m-1\right)  \mathbin{/\mkern-6mu/} k\right\}  $)

\begin{itemize}
\item \textit{generic} if $u<\left(  n-1\right)  \mathbin{/\mkern-6mu/} k$ and
$v<\left(  m-1\right)  \mathbin{/\mkern-6mu/} k$;

\item \textit{northern} if $u<\left(  n-1\right)  \mathbin{/\mkern-6mu/} k$
and $v=\left(  m-1\right)  \mathbin{/\mkern-6mu/} k$;

\item \textit{eastern} if $u=\left(  n-1\right)  \mathbin{/\mkern-6mu/} k$ and
$v<\left(  m-1\right)  \mathbin{/\mkern-6mu/} k$;

\item \textit{northeastern} if $u=\left(  n-1\right)  \mathbin{/\mkern-6mu/}
k$ and $v=\left(  m-1\right)  \mathbin{/\mkern-6mu/} k$.
\end{itemize}

\noindent Then,\footnote{Recall that $r=n\%k$ and $s=m\%k$.}

\begin{itemize}
\item each generic zone is a $k\times k$-rectangle;

\item each northern zone is a $k\times s$-rectangle;

\item each eastern zone is an $r\times k$-rectangle;

\item the northeastern zone is an $r\times s$-rectangle.
\end{itemize}

\noindent Note that all these zones are nonempty, since $r>0$ and $s>0$ and
$k>0$.

Each northern zone is a $k\times 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\in\left\{  0,1,\ldots
,k-1\right\}  $,%
\begin{equation}
\text{the \# of all squares in }Z\text{ that have color }h\text{ is
independent of }h. \label{pf.prop.1.9.indep42}%
\end{equation}


But the zones are disjoint and their union is the whole rectangle $R_{n,m}$.
Hence, it follows that the northeastern zone is balanced as
well\footnote{\textit{Proof.} For any color $h\in\left\{  0,1,\ldots
,k-1\right\}  $, we have%
\begin{align*}
&  \left(  \text{\# of all squares in }R_{n,m}\text{ that have color }h\right)
\\
&  =\sum_{Z\text{ is a zone}}\left(  \text{\# of all squares in }Z\text{ that
have color }h\right) \\
&  =\left(  \text{\# of all squares in the northeastern zone that have color
}h\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\sum_{\substack{Z\text{ is a zone;}\\Z\text{ is not
the northeastern zone}}}\left(  \text{\# of all squares in }Z\text{ that have
color }h\right)  ,
\end{align*}
so that%
\begin{align*}
&  \left(  \text{\# of all squares in the northeastern zone that have color
}h\right) \\
&  =\underbrace{\left(  \text{\# of all squares in }R_{n,m}\text{ that have
color }h\right)  }_{\substack{\text{independent of }h\\\text{(since }%
R_{n,m}\text{ is balanced)}}}\\
&  \ \ \ \ \ \ \ \ \ \ -\sum_{\substack{Z\text{ is a zone;}\\Z\text{ is not
the northeastern zone}}}\underbrace{\left(  \text{\# of all squares in
}Z\text{ that have color }h\right)  }_{\substack{\text{independent of
}h\\\text{(by (\ref{pf.prop.1.9.indep42}))}}},
\end{align*}
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.}.

But let us take a closer look at the northeastern zone. We denote this zone by
$\mathfrak{Z}$. This zone $\mathfrak{Z}$ is an $r\times s$-rectangle, and
(just as for any zone) its southwestern corner has color $0$. Thus, the colors
of its squares look as follows:%
\begin{equation}%
\begin{tabular}
[c]{|cccccc|}\hline
$\vphantom{\dfrac{1}{2}}s-1$ & $s$ & $\ast$ & $\cdots$ & $\ast$ & $\ast
$\\\cline{7-7}%
$\vphantom{\dfrac{1}{2}}s-2$ & $s-1$ & $\phantom{-}s\phantom{-}$ & $\cdots$ &
$\ast$ & $\ast$\\\cline{7-7}%
$\vphantom{\dfrac{1}{2}}\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ &
$\vdots$\\\cline{7-7}%
$\vphantom{\dfrac{1}{2}}1$ & $2$ & $3$ & $\cdots$ & $r-1$ & $r$\\\cline{7-7}%
$\vphantom{\dfrac{1}{2}}0$ & $1$ & $2$ & $\cdots$ & $r-2$ & $r-1$\\\hline
\end{tabular}
\ \ \ \label{pf.prop.1.9.nezone}%
\end{equation}
(where each asterisk $\ast$ stands for some entry we don't need to know about).

We shall now show that this northeastern zone is \textbf{not} balanced. This
will give us a contradiction.

We WLOG assume that $s\leq r$ (since otherwise, the argument is similar).
Recall that $0<r<k$ and $0<s<k$. From $0<s$, we obtain $s\geq1$, so that
$s-1\leq0$. Thus, $0\leq\underbrace{s}_{\leq r}-1\leq r-1$. Therefore, each
row of $\mathfrak{Z}$ contains at least one square with color $s-1$. Since
$\mathfrak{Z}$ has $s$ rows, we thus conclude that
\begin{equation}
\mathfrak{Z}\text{ contains at least }s\text{ squares with color }s-1.
\label{pf.prop.1.9.Z1}%
\end{equation}
(We can easily see that $\mathfrak{Z}$ contains exactly $s$ squares with color
$s-1$, but we won't need this.)

On the other hand, the bottommost row of $\mathfrak{Z}$ only contains squares
with colors $0,1,\ldots,r-1$. Hence, it does not contain a square with color
$r$ (since $s-1<s\leq r$). But each row of $\mathfrak{Z}$ has width $r<k$, and
thus contains \textbf{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 $\geq k$ apart from one another, but the row only has width
$r<k$). So we know that the zone $\mathfrak{Z}$ has $s$ rows, one of which
(the bottommost one) contains no square with color $r$, while each of the
other $s-1$ rows contains \textbf{at most} one square with color $r$. Hence,
altogether,%
\begin{equation}
\mathfrak{Z}\text{ contains at most }s-1\text{ squares with color }r.
\label{pf.prop.1.9.Z2}%
\end{equation}
Comparing this with (\ref{pf.prop.1.9.Z1}), we conclude that the \# of squares
with color $r$ contained in $\mathfrak{Z}$ is different from the \# of squares
with color $s-1$ contained in $\mathfrak{Z}$ (since the former number is $\leq
s-1$, while the latter number is $\geq s$). Hence, $\mathfrak{Z}$ is not
balanced. In other words, the northeastern zone is not balanced (since
$\mathfrak{Z}$ is the northeastern zone). This contradicts the fact that the
northeastern zone is balanced. This contradiction shows that our assumption
was false. Hence, the \textquotedblleft$\Longrightarrow$\textquotedblright%
\ direction of Proposition \ref{prop.1.9} is proven.
\end{proof}

This was just a little taste of the theory of tilings of discrete (plane)
shapes. See the survey \cite{ArdSta10} by Ardila and Stanley for an
introduction to the varied questions and ideas of this theory. See also
\cite[Exercises 4 and 5]{18f-hw1s} and \cite[Exercises 1, 2, 3]{19f-hw1s} for
further exercises on counting tilings, and \cite[\S 5.1.5]{LeLeMe16} for a
neat exercise in proving existence of tilings. Furthermore, the book
\cite{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
\ref{prop.1.5}). (See \cite{BenQui-fib} for a \textquotedblleft
best-of\textquotedblright\ of sorts.)

\begin{center}
\fbox{\textbf{Class of 2019-09-30}}
\end{center}

\subsection{\label{sect.intro.powersums}Sums of powers}

\subsubsection{\label{subsect.intro.powersums.pow1}The sum $1+2+...+n$}

We now switch the subject and recall a famous result, known colloquially as
the \textit{\textquotedblleft Little Gauss\textquotedblright\ formula} due to
the anecdote of Gauss inventing it in primary school:\footnote{In truth, this
formula was known to the Ancient Greeks.}

\begin{theorem}
[\textquotedblleft Little Gauss\textquotedblright\ formula]\label{thm.1.10}Let
$n\in\mathbb{N}$. Then,
\[
1+2+\cdots+n=\dfrac{n\left(  n+1\right)  }{2}.
\]

\end{theorem}

Keep in mind that $0\in\mathbb{N}$ according to our conventions; thus, Theorem
\ref{thm.1.10} applies to $n=0$. And indeed, Theorem \ref{thm.1.10} holds for
$n=0$, since an \textit{empty sum} (i.e., a sum that consists of no addends)
is defined to be $0$, and thus we have%
\[
1+2+\cdots+n=1+2+\cdots+0=\left(  \text{empty sum}\right)  =0=\dfrac
{0\cdot\left(  0+1\right)  }{2}.
\]


\begin{proof}
[First proof of Theorem \ref{thm.1.10}.]Induction on $n$. The details are
completely straightforward and LTTR.

(The abbreviation \textquotedblleft LTTR\textquotedblright\ stands for
\textquotedblleft left to the reader\textquotedblright. I will usually leave
arguments to the reader when they are straightforward or easy variations of
arguments shown before.)
\end{proof}

\begin{proof}
[Second proof of Theorem \ref{thm.1.10}.]We observe the following fact: If
$a_{1},a_{2},\ldots,a_{n}$ are $n$ numbers (say, real numbers), and
$b_{1},b_{2},\ldots,b_{n}$ are $n$ further numbers, then%
\begin{align}
&  \left(  a_{1}+a_{2}+\cdots+a_{n}\right)  +\left(  b_{1}+b_{2}+\cdots
+b_{n}\right) \nonumber\\
&  =\left(  a_{1}+b_{1}\right)  +\left(  a_{2}+b_{2}\right)  +\cdots+\left(
a_{n}+b_{n}\right)  . \label{pf.thm.1.10.2nd.1}%
\end{align}
(Indeed, both sides of this equality are just two ways to add all the $2n$
numbers $a_{1},a_{2},\ldots,a_{n},b_{1},b_{2},\ldots,b_{n}$. This should
convince you that they are the same, although formally speaking, this is not a
proof. See Subsection \ref{subsect.intro.powersums.what} below for some
references to a formal proof.)

Now,
\begin{align*}
&  2\cdot\left(  1+2+\cdots+n\right) \\
&  =\left(  1+2+\cdots+n\right)  +\underbrace{\left(  1+2+\cdots+n\right)
}_{\substack{=n+\left(  n-1\right)  +\cdots+1\\\text{(here, we have just
reversed}\\\text{the order of summation)}}}\\
&  =\left(  1+2+\cdots+n\right)  +\left(  n+\left(  n-1\right)  +\cdots
+1\right) \\
&  =\left(  1+n\right)  +\left(  2+\left(  n-1\right)  \right)  +\cdots
+\left(  n+1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.thm.1.10.2nd.1}), applied to
}a_{i}=i\text{ and }b_{i}=n+1-i\right) \\
&  =\underbrace{\left(  n+1\right)  +\left(  n+1\right)  +\cdots+\left(
n+1\right)  }_{n\text{ many addends}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since each of the numbers }1+n,2+\left(
n-1\right)  ,\ldots,n+1\text{ equals }n+1\right) \\
&  =n\left(  n+1\right)  .
\end{align*}
Dividing this equality by $2$, we obtain $1+2+\cdots+n=\dfrac{n\left(
n+1\right)  }{2}$. This proves Theorem \ref{thm.1.10} again.
\end{proof}

\begin{proof}
[Third proof of Theorem \ref{thm.1.10} (sketched).]Here is a picture proof
(drawn for the case $n=3$):%
\[%
\begin{tabular}
[c]{cccc}\hline
\multicolumn{1}{|c}{$\ast$} & $\ast$ & $\ast$ & \multicolumn{1}{|c|}{$\ast$%
}\\\cline{3-3}%
\multicolumn{1}{|c}{$\ast$} & $\ast$ & \multicolumn{1}{|c}{$\ast$} &
\multicolumn{1}{c|}{$\ast$}\\\cline{2-2}%
\multicolumn{1}{|c}{$\ast$} & \multicolumn{1}{|c}{$\ast$} & $\ast$ &
\multicolumn{1}{c|}{$\ast$}\\\hline
$\phantom{w}$ & $\phantom{w}$ & $\phantom{w}$ & $\phantom{w}$%
\end{tabular}
\quad.\ \vspace{-1.0076pc}%
\]
This is a $4\times3$-rectangle\footnote{We have put an asterisk into each
little square of the rectangle in order to make the squares easier to
discern.} (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.\footnote{Note that \textquotedblleft
area\textquotedblright\ is normally a geometric concept, but since both parts
consist of full squares, we can redefine it combinatorially as the number of
squares in the respective part.} Hence, the area of either part equals half
the area of the whole rectangle. Since the area of the whole is $3\cdot4$, we
thus conclude that the area of either part equals $\dfrac{3\cdot4}{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
column\footnote{We count columns from the left.}, $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 $0+1+2+3$, but we also know (from before) that it equals $\dfrac{3\cdot
4}{2}$. Hence, $0+1+2+3=\dfrac{3\cdot4}{2}$. In view of $0+1+2+3=1+2+3$, this
rewrites as $=\dfrac{3\cdot4}{2}$. This is precisely the statement of Theorem
\ref{thm.1.10} for $n=3$.

The same argument (but using an $\left(  n+1\right)  \times n$-rectangle
instead of a $4\times3$-rectangle) proves Theorem \ref{thm.1.10} for arbitrary
$n$.

\begin{fineprint}
How can we formalize this argument? Once again (as with domino tilings), it
makes sense to think of the $\left(  n+1\right)  \times n$-rectangle as the
finite set $\left[  n+1\right]  \times\left[  n\right]  $ (where, as before,
we set $\left[  k\right]  =\left\{  1,2,\ldots,k\right\}  $ for each
$k\in\mathbb{N}$) rather than a geometric shape in the real
plane.\footnote{Again, we let $\left(  i,j\right)  $ be the square in column
$i$ (counted from the left) and row $j$ (counted from the bottom).} The two
parts into which this rectangle is divided by the broken line become the two
sets%
\begin{align*}
A  &  :=\left\{  \left(  i,j\right)  \in\left[  n+1\right]  \times\left[
n\right]  \ \mid\ i\leq j\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}\\
B  &  :=\left\{  \left(  i,j\right)  \in\left[  n+1\right]  \times\left[
n\right]  \ \mid\ i>j\right\}  .
\end{align*}
(The letters $A$ and $B$ here stand for \textquotedblleft
above\textquotedblright\ and \textquotedblleft below\textquotedblright.)

So let us redo this proof from scratch, using the combinatorial model (i.e.,
finite sets) throughout it. We consider the finite set $\left[  n+1\right]
\times\left[  n\right]  $, which has $\left(  n+1\right)  \cdot n=n\left(
n+1\right)  $ many elements. Define two subsets%
\begin{align*}
A  &  :=\left\{  \left(  i,j\right)  \in\left[  n+1\right]  \times\left[
n\right]  \ \mid\ i\leq j\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}\\
B  &  :=\left\{  \left(  i,j\right)  \in\left[  n+1\right]  \times\left[
n\right]  \ \mid\ i>j\right\}
\end{align*}
of $\left[  n+1\right]  \times\left[  n\right]  $. These two subsets $A$ and
$B$ are disjoint (since no $\left(  i,j\right)  \in\left[  n+1\right]
\times\left[  n\right]  $ can satisfy $i\leq j$ and $i>j$ at the same time),
and their union is $\left[  n+1\right]  \times\left[  n\right]  $ (since each
$\left(  i,j\right)  \in\left[  n+1\right]  \times\left[  n\right]  $
satisfies either $i\leq j$ or $i>j$). Hence, the sum rule shows that
$\left\vert \left[  n+1\right]  \times\left[  n\right]  \right\vert
=\left\vert A\right\vert +\left\vert B\right\vert $, so that%
\begin{align}
\left\vert A\right\vert +\left\vert B\right\vert  &  =\left\vert \left[
n+1\right]  \times\left[  n\right]  \right\vert =\underbrace{\left\vert
\left[  n+1\right]  \right\vert }_{=n+1}\cdot\underbrace{\left\vert \left[
n\right]  \right\vert }_{=n}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem
\ref{thm.prodrule2}}\right) \nonumber\\
&  =\left(  n+1\right)  \cdot n=n\left(  n+1\right)  .
\label{pf.thm.1.10.3rd.4}%
\end{align}


On the other hand, the map%
\begin{align*}
A  &  \rightarrow B,\\
\left(  i,j\right)   &  \mapsto\left(  n+2-i,n+1-j\right)
\end{align*}
(which, visually, is just the reflection around the center of the $\left(
n+1\right)  \times n$-rectangle) is a bijection\footnote{This needs to be
proven, but the proof is really straightforward. First, you need to check that
this map is well-defined. This means showing that $\left(  n+2-i,n+1-j\right)
\in B$ for each $\left(  i,j\right)  \in A$. Once this is shown, you can show
the bijectivity of this map by explicitly constructing an inverse; namely, the
inverse is the map%
\begin{align*}
B  &  \rightarrow A,\\
\left(  i,j\right)   &  \mapsto\left(  n+2-i,n+1-j\right)  .
\end{align*}
(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.)}.
Hence, the bijection rule yields $\left\vert A\right\vert =\left\vert
B\right\vert $. Thus, $\underbrace{\left\vert A\right\vert }_{=\left\vert
B\right\vert }+\left\vert B\right\vert =\left\vert B\right\vert +\left\vert
B\right\vert =2\cdot\left\vert B\right\vert $. Comparing this with
(\ref{pf.thm.1.10.3rd.4}), we obtain $2\cdot\left\vert B\right\vert =n\left(
n+1\right)  $, so that%
\begin{equation}
\left\vert B\right\vert =\dfrac{n\left(  n+1\right)  }{2}.
\label{pf.thm.1.10.3rd.count1}%
\end{equation}


On the other hand, let us count the squares in $B$ \textquotedblleft by
column\textquotedblright. Recall that, in our combinatorial model, the
x-coordinate $i$ of a square $\left(  i,j\right)  $ tells us which column it
belongs to. Thus, the squares $c\in B$ in the $k$-th column (for any given
$k\in\left\{  1,2,\ldots,n+1\right\}  $) are precisely the squares $c\in 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 $\left\{  c\in
B\ \mid\ c\text{ has x-coordinate }k\right\}  $ for $k\in\left\{
1,2,\ldots,n+1\right\}  $. These $n+1$ subsets are disjoint (since any square
$c\in B$ has only one x-coordinate) and their union is $B$ (since each square
$c\in B$ has x-coordinate $1$ or $2$ or $\cdots$ or $n+1$). Hence, the sum
rule yields%
\begin{align}
\left\vert B\right\vert  &  =\left\vert \left\{  c\in B\ \mid\ c\text{ has
x-coordinate }1\right\}  \right\vert +\left\vert \left\{  c\in B\ \mid
\ c\text{ has x-coordinate }2\right\}  \right\vert \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ +\cdots+\left\vert \left\{  c\in B\ \mid\ c\text{ has
x-coordinate }n+1\right\}  \right\vert \nonumber\\
&  =\sum_{i=1}^{n+1}\left\vert \left\{  c\in B\ \mid\ c\text{ has x-coordinate
}i\right\}  \right\vert . \label{pf.thm.1.10.3rd.5}%
\end{align}
But the addends on the right hand side of this equality are easily
computed:\footnote{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..} For each $i\in\left\{  1,2,\ldots
,n+1\right\}  $, we have%
\begin{align*}
&  \left\{  c\in B\ \mid\ c\text{ has x-coordinate }i\right\} \\
&  =\left\{  c\in B\ \mid\ c=\left(  i,j\right)  \text{ for some }j\in\left[
n\right]  \right\} \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since a square of }\left[  n+1\right]  \times\left[  n\right]  \text{
has x-coordinate }i\\
\text{if and only if it has the form }\left(  i,j\right)  \text{ for some
}j\in\left[  n\right]
\end{array}
\right) \\
&  =\left\{  \left(  i,j\right)  \ \mid\ j\in\left[  n\right]  \text{ such
that }\left(  i,j\right)  \in B\right\} \\
&  =\left\{  \left(  i,j\right)  \ \mid\ j\in\left[  n\right]  \text{ such
that }i>j\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since a square }\left(  i,j\right)  \in\left[  n+1\right]  \times\left[
n\right]  \text{ satisfies }\left(  i,j\right)  \in B\\
\text{if and only if }i>j\text{ (by the definition of }B\text{)}%
\end{array}
\right) \\
&  =\left\{  \left(  i,1\right)  ,\left(  i,2\right)  ,\ldots,\left(
i,i-1\right)  \right\}
\end{align*}
and thus%
\begin{align}
\left\vert \left\{  c\in B\ \mid\ c\text{ has x-coordinate }i\right\}
\right\vert  &  =\left\vert \left\{  \left(  i,1\right)  ,\left(  i,2\right)
,\ldots,\left(  i,i-1\right)  \right\}  \right\vert \nonumber\\
&  =i-1. \label{pf.thm.1.10.3rd.6}%
\end{align}
Hence, (\ref{pf.thm.1.10.3rd.5}) becomes%
\begin{align*}
\left\vert B\right\vert  &  =\sum_{i=1}^{n+1}\underbrace{\left\vert \left\{
c\in B\ \mid\ c\text{ has x-coordinate }i\right\}  \right\vert }%
_{\substack{=i-1\\\text{(by (\ref{pf.thm.1.10.3rd.6}))}}}\\
&  =\sum_{i=1}^{n+1}\left(  i-1\right)  =0+1+2+\cdots+n=1+2+\cdots+n.
\end{align*}
Comparing this with (\ref{pf.thm.1.10.3rd.4}), we obtain $1+2+\cdots
+n=\dfrac{n\left(  n+1\right)  }{2}$. This finally completes our formalized
picture proof of Theorem \ref{thm.1.10}.

The moral of the story: A picture is worth a thousand words!
\end{fineprint}
\end{proof}

\subsubsection{\label{subsect.intro.powersums.what}What is a sum, actually?}

Throughout Subsection \ref{subsect.intro.powersums.pow1}, we have been freely
working with expressions like $1+2+\cdots+n$ and (more generally) $a_{1}%
+a_{2}+\cdots+a_{n}$, where $a_{1},a_{2},\ldots,a_{n}$ are $n$ numbers.
Looking back, you might wonder: Why are these expressions well-defined? How is
\textquotedblleft the sum of $n$ numbers\textquotedblright\ defined to begin with?

Let me explain what I mean by this. Let \textquotedblleft
number\textquotedblright\ mean \textquotedblleft rational
number\textquotedblright, just to be specific here (although the same question
and the same answer apply to integers, real numbers and complex numbers). I
assume you know what the sum of \textbf{two} numbers is. Even when two numbers
$a$ and $b$ are given without specifying their order, their sum is
well-defined, because the \textit{commutativity of addition} (i.e., the rule
saying that $a+b=b+a$ for any two numbers $a$ and $b$) guarantees that the two
possible ways of adding them together yield the same result.

Now, suppose you are given \textbf{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%
\begin{align*}
&  \left(  a+b\right)  +c,\ \ \ \ \ \ \ \ \ \ \left(  a+c\right)
+b,\ \ \ \ \ \ \ \ \ \ \left(  b+a\right)  +c,\ \ \ \ \ \ \ \ \ \ \left(
b+c\right)  +a,\\
&  \left(  c+a\right)  +b,\ \ \ \ \ \ \ \ \ \ \left(  c+b\right)
+a,\ \ \ \ \ \ \ \ \ \ a+\left(  b+c\right)  ,\ \ \ \ \ \ \ \ \ \ a+\left(
c+b\right)  ,\\
&  b+\left(  a+c\right)  ,\ \ \ \ \ \ \ \ \ \ b+\left(  c+a\right)
,\ \ \ \ \ \ \ \ \ \ c+\left(  a+b\right)  ,\ \ \ \ \ \ \ \ \ \ c+\left(
b+a\right)  .
\end{align*}
If we want to make sense of a \textquotedblleft sum of three
numbers\textquotedblright\ without having to specify the precise procedure of
summation, we better hope that these $12$ ways all lead to the same result!
And indeed, they do. This is not hard to derive from the above-mentioned
commutativity of addition, combined with the \textit{associativity of
addition} (i.e., the rule saying that $\left(  a+b\right)  +c=a+\left(
b+c\right)  $ for any three numbers $a$, $b$ and $c$). For example,%
\begin{align*}
a+\left(  b+c\right)   &  =\underbrace{\left(  a+b\right)  }%
_{\substack{=b+a\\\text{(by commutativity)}}}+c\ \ \ \ \ \ \ \ \ \ \left(
\text{by associativity}\right) \\
&  =\left(  b+a\right)  +c=b+\underbrace{\left(  a+c\right)  }%
_{\substack{=c+a\\\text{(by commutativity)}}}\ \ \ \ \ \ \ \ \ \ \left(
\text{by associativity}\right) \\
&  =b+\left(  c+a\right)  =\left(  b+c\right)  +a\ \ \ \ \ \ \ \ \ \ \left(
\text{by associativity}\right)
\end{align*}
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 \textquotedblleft the sum of the three numbers $a$, $b$
and $c$\textquotedblright\ 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 \textbf{four} numbers $a$, $b$, $c$ and $d$. There
are now $120$ ways of adding them together, including such ways as%
\[
\left(  \left(  a+b\right)  +c\right)  +d,\ \ \ \ \ \ \ \ \ \ \left(
a+b\right)  +\left(  c+d\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  b+d\right)
+\left(  c+a\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  b+\left(  d+a\right)
\right)  +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 $a_{1},a_{2},\ldots,a_{n}$, and you
want to prove that all ways of adding them together give the same result. For
example, two of these ways are%
\[
\left(  \cdots\left(  \left(  \left(  a_{1}+a_{2}\right)  +a_{3}\right)
+a_{4}\right)  +\cdots\right)  +a_{n}%
\ \ \ \ \ \ \ \ \ \ \text{(\textquotedblleft left-associative
summation\textquotedblright)}%
\]
and
\[
a_{1}+\left(  \cdots+\left(  a_{n-3}+\left(  a_{n-2}+\left(  a_{n-1}%
+a_{n}\right)  \right)  \right)  \cdots\right)
\ \ \ \ \ \ \ \ \ \ \text{(\textquotedblleft right-associative
summation\textquotedblright);}%
\]
how do we know they are equivalent?

Let us close a ring around this problem. As long as we don't know that all
ways to add $n$ numbers, we cannot define \textquotedblleft\textbf{the}
sum\textquotedblright\ of $n$ numbers. But we can define the \textbf{set of
all possible sums} of $n$ numbers, i.e., the set of all possible results that
can be obtained by adding them together in all possible orders. For example,
for three numbers $a,b,c$, this set will be%
\[
\left\{  \left(  a+b\right)  +c,\left(  a+c\right)  +b,\ldots,c+\left(
b+a\right)  \right\}
\]
(containing all the $12$ ways to add $a,b,c$ together, listed above). This
definition can easily be done by recursion:

\begin{itemize}
\item There is only one way to add $0$ numbers together. Namely, adding $0$
numbers always yields $0$.

\item There is only one way to add $1$ number together. Namely, adding $1$
number $a$ always yields $a$ itself.

\item If $n>1$, then any way of adding $n$ numbers together is given by
splitting them into two (disjoint) groups\footnote{\textquotedblleft
Groups\textquotedblright\ in the sense of \textquotedblleft
batches\textquotedblright, not in the sense of group theory.}, then adding the
numbers in the first group together (in one of the many possible ways), then
adding the numbers in the second group together, and finally adding the two
results together.
\end{itemize}

\noindent Thus we can define the \textbf{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 claim\footnote{known
as the \textit{general commutativity theorem} (\textquotedblleft
general\textquotedblright\ because it applies to any finite number of addends
rather than two)}, 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 \cite[\S 2.14]{detnotes} for a very detailed proof.\footnote{More
precisely, the proof is in \cite[\S 2.14.1--\S 2.14.6]{detnotes}. The
remaining subsections of \cite[\S 2.14]{detnotes} prove properties of sums.}

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, \textquotedblleft the sum of all prime numbers smaller than
$10$\textquotedblright\ is well-defined (and equals $2+3+5+7=17$). Likewise,
if you are given a polygon, then \textquotedblleft the sum of the sidelengths
of the polygon\textquotedblright\ 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):

\begin{definition}
\label{def.sum.sigma-sign}Let $S$ be a finite set. For each $s\in S$, let
$a_{s}$ be a number (e.g., an integer or a rational number or a real number or
a complex number).

Then, $\sum_{s\in S}a_{s}$ shall denote the sum of the numbers $a_{s}$ for all
$s\in S$. This notation is read as \textquotedblleft the sum of $a_{s}$ over
all $s\in S$\textquotedblright\ or \textquotedblleft the sum of $a_{s}$ for
$s$ ranging over $S$\textquotedblright\ or \textquotedblleft the sum of
$a_{s}$ where $s$ runs through $S$\textquotedblright. The \textquotedblleft%
$\sum$\textquotedblright\ sign in this notation is called the
\textit{summation sign}.
\end{definition}

\begin{example}
\label{exa.sum.1}\textbf{(a)} We have $\sum_{s\in\left\{  1,2,3,4\right\}
}s=1+2+3+4=10$.

\textbf{(b)} We have $\sum_{s\in\left\{  1,2,3,4\right\}  }s^{2}=1^{2}%
+2^{2}+3^{2}+4^{2}=30$.

\textbf{(c)} We have $\sum_{s\in\left\{  1,2,3,4\right\}  }\dfrac{1}{s}%
=\dfrac{1}{1}+\dfrac{1}{2}+\dfrac{1}{3}+\dfrac{1}{4}=\dfrac{25}{12}$.

\textbf{(d)} We have $\sum_{s\in\left\{  3,4,9\right\}  }s=3+4+9=16$.
\end{example}

We need to note a few things about the summation sign:

\begin{itemize}
\item The letter \textquotedblleft$s$\textquotedblright\ in the notation
\textquotedblleft$\sum_{s\in S}a_{s}$\textquotedblright\ is an instance of
what is called a \textit{bound variable} (or \textit{running index}, or
\textit{dummy variable}): Its only purpose is to mark the \textquotedblleft
moving part\textquotedblright\ of the sum. So it plays the same role as the
letter \textquotedblleft$s$\textquotedblright\ in the set-comprehension
notation \textquotedblleft$\left\{  s\in\mathbb{Z}\ \mid\ s>2\right\}
$\textquotedblright, or the letter \textquotedblleft$s$\textquotedblright\ in
\textquotedblleft the map $\mathbb{Z}\rightarrow\mathbb{Z},\ s\mapsto
s+3$\textquotedblright,\ or the letter \textquotedblleft$s$\textquotedblright%
\ in the sentence \textquotedblleft There exists no $s\in\mathbb{Z}$ such that
$s^{2}=2$\textquotedblright. Thus, it is perfectly legitimate to replace it by
any other symbol (that is not used otherwise). For example, we can rewrite the
sum $\sum_{s\in\left\{  1,2,3,4\right\}  }\dfrac{1}{s}$ as $\sum_{i\in\left\{
1,2,3,4\right\}  }\dfrac{1}{i}$ or as $\sum_{k\in\left\{  1,2,3,4\right\}
}\dfrac{1}{k}$ or as $\sum_{\mathfrak{S}\in\left\{  1,2,3,4\right\}  }%
\dfrac{1}{\mathfrak{S}}$ or as $\sum_{\spadesuit\in\left\{  1,2,3,4\right\}
}\dfrac{1}{\spadesuit}$; it will still be the same sum.

\item In the notation \textquotedblleft$\sum_{s\in S}a_{s}$\textquotedblright,
the letter \textquotedblleft$s$\textquotedblright\ is called the
\textit{summation index}; the set $S$ is called the \textit{indexing set}; and
the numbers $a_{s}$ are called the \textit{addends} of the sum.

\item Our definition of sums forces $\sum_{s\in\varnothing}a_{s}$ to always be
$0$. This is called an \textit{empty sum}. Thus, empty sums are $0$. If this
sounds like an arbitrary convention to you, you should check that it is the
only convention that makes (\ref{eq.sum.split-off}) hold for one-element sets
$S$.

\item Sums can have equal addends. For example,%
\[
\sum_{s\in\left\{  -2,-1,0,1,2\right\}  }s^{2}=\left(  -2\right)  ^{2}+\left(
-1\right)  ^{2}+0^{2}+1^{2}+2^{2}=4+1+0+1+4=10.
\]
However,
\[
\sum_{s\in\left\{  \left(  -2\right)  ^{2},\left(  -1\right)  ^{2},0^{2}%
,1^{2},2^{2}\right\}  }s=0^{2}+1^{2}+2^{2}=0+1+4=5,
\]
because the \textbf{set} $\left\{  \left(  -2\right)  ^{2},\left(  -1\right)
^{2},0^{2},1^{2},2^{2}\right\}  $ is only a $3$-element set (with elements
$0^{2},1^{2},2^{2}$). 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 \textbf{set} of these $5$ numbers, because if
some of these $5$ numbers are equal, then the set \textquotedblleft
forgets\textquotedblright\ that they appear more than once.

\item 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 $\sum_{\left(
x,y\right)  \in S}a_{\left(  x,y\right)  }$ (meaning the same as $\sum_{s\in
S}a_{s}$). Here is an example of this notation:%
\[
\sum_{\left(  x,y\right)  \in\left\{  1,2,3\right\}  ^{2}}\dfrac{x}{y}%
=\dfrac{1}{1}+\dfrac{1}{2}+\dfrac{1}{3}+\dfrac{2}{1}+\dfrac{2}{2}+\dfrac{2}%
{3}+\dfrac{3}{1}+\dfrac{3}{2}+\dfrac{3}{3}.
\]

\end{itemize}

Here are some more examples, coming from more combinatorial questions:

\begin{example}
\label{exa.sum.2}\textbf{(a)} Let $\mathcal{P}\left(  A\right)  $ 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 $\left\{  1,2,3\right\}  $ as
follows:%
\begin{align*}
\sum_{B\in\mathcal{P}\left(  \left\{  1,2,3\right\}  \right)  }\left\vert
B\right\vert  &  =\left\vert \varnothing\right\vert +\left\vert \left\{
1\right\}  \right\vert +\left\vert \left\{  2\right\}  \right\vert +\left\vert
\left\{  3\right\}  \right\vert \\
&  \ \ \ \ \ \ \ \ \ \ +\left\vert \left\{  1,2\right\}  \right\vert
+\left\vert \left\{  1,3\right\}  \right\vert +\left\vert \left\{
2,3\right\}  \right\vert +\left\vert \left\{  1,2,3\right\}  \right\vert \\
&  =0+1+1+1+2+2+2+3=12.
\end{align*}


\textbf{(b)} If $A$ and $B$ are two sets, then $B^{A}$ denotes the set of all
maps from $A$ to $B$. Then, we can write the sum of the sizes of the images of
all maps from $\left\{  1,2\right\}  $ to $\left\{  1,2\right\}  $ as follows:%
\begin{align*}
\sum_{f\in B^{A}}\left\vert f\left(  A\right)  \right\vert  &
=\underbrace{\left\vert \left\{  1\right\}  \right\vert }%
_{\substack{\text{corresponding}\\\text{to the map }\left(
\begin{array}
[c]{cc}%
1 & 2\\
1 & 1
\end{array}
\right)  }}+\underbrace{\left\vert \left\{  1,2\right\}  \right\vert
}_{\substack{\text{corresponding}\\\text{to the map }\left(
\begin{array}
[c]{cc}%
1 & 2\\
1 & 2
\end{array}
\right)  }}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left\vert \left\{  1,2\right\}
\right\vert }_{\substack{\text{corresponding}\\\text{to the map }\left(
\begin{array}
[c]{cc}%
1 & 2\\
2 & 1
\end{array}
\right)  }}+\underbrace{\left\vert \left\{  2\right\}  \right\vert
}_{\substack{\text{corresponding}\\\text{to the map }\left(
\begin{array}
[c]{cc}%
1 & 2\\
2 & 2
\end{array}
\right)  }}\\
&  =1+2+2+1=6.
\end{align*}
(Here, we have written out each map in two-line notation: That is, the map
sending $1$ and $2$ to $a_{1}$ and $a_{2}$ has been written as $\left(
\begin{array}
[c]{cc}%
1 & 2\\
a_{1} & a_{2}%
\end{array}
\right)  $.)
\end{example}

There are several variants of the summation sign:

\begin{itemize}
\item The expression $\sum_{\substack{s\in\left\{  1,2,3,4,5,6\right\}
;\\s\text{ is odd}}}s^{2}$ stands for the sum of the squares of all
\textbf{odd} elements of $\left\{  1,2,3,4,5,6\right\}  $. In general, if $S$
is a set, and if $\mathcal{A}\left(  s\right)  $ is a logical statement
defined for each $s\in S$, then the notation $\sum_{\substack{s\in
S;\\\mathcal{A}\left(  s\right)  }}a_{s}$ stands for the sum $\sum
_{s\in\left\{  t\in S\ \mid\ \mathcal{A}\left(  t\right)  \right\}  }a_{s}$
(that is, the sum of $a_{s}$ not over all $s\in S$, but only over the ones
which satisfy $\mathcal{A}\left(  s\right)  $). For this sum to be
well-defined, we do not need $S$ to be finite; we only need the subset
$\left\{  t\in S\ \mid\ \mathcal{A}\left(  t\right)  \right\}  $ to be finite
(i.e., we need there to only be finitely many $s\in S$ satisfying
$\mathcal{A}\left(  s\right)  $).

\item The expression $\sum_{i=5}^{8}i^{2}$ stands for the sum $\sum
_{i\in\left\{  5,6,7,8\right\}  }i^{2}$. In general, if $p$ and $q$ are two
integers, then the notation $\sum_{i=p}^{q}a_{i}$ stands for the sum
$\sum_{i\in\left\{  p,p+1,\ldots,q\right\}  }a_{i}$. Here it should be kept in
mind that the set $\left\{  p,p+1,\ldots,q\right\}  $ is understood to be
empty if $p>q$. (Be warned that some authors have different conventions for
the latter case.)

\item The summation sign $\sum_{B\subseteq A}$ (where $A$ is a given set) is
shorthand for $\sum_{B\in\mathcal{P}\left(  A\right)  }$. Thus, the result of
Example \ref{exa.sum.2} \textbf{(a)} could be rewritten as $\sum
_{B\subseteq\left\{  1,2,3\right\}  }\left\vert B\right\vert =12$.

\item The summation sign $\sum_{f:A\rightarrow B}$ (where $A$ and $B$ are two
sets) is shorthand for $\sum_{f\in B^{A}}$. Thus, the result of Example
\ref{exa.sum.2} \textbf{(b)} could be rewritten as $\sum_{f:A\rightarrow
B}\left\vert f\left(  A\right)  \right\vert =6$.
\end{itemize}

These notations can be mixed and matched. For example, you can write
$\sum_{\substack{f:A\rightarrow B;\\f\text{ is injective}}}\left\vert f\left(
A\right)  \right\vert $ to obtain a sum of the sizes of the images of all
\textbf{injective} maps from $A$ to $B$.

\subsubsection{\label{subsect.intro.powersums.powk}The sums $1^{k}%
+2^{k}+...+n^{k}$}

Let us now go back to Theorem \ref{thm.1.10}. That theorem gave an explicit
formula for the sum of the first $n$ positive integers. A similar formula
exists for the sum of the squares of the first $n$ positive integers:

\begin{proposition}
\label{prop.1.11}Let $n\in\mathbb{N}$. Then,
\[
1^{2}+2^{2}+\cdots+n^{2}=\dfrac{n\left(  n+1\right)  \left(  2n+1\right)  }%
{6}.
\]

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.1.11} (sketched).]Again, this can be shown by
a straightforward induction (LTTR).
\end{proof}

Is there a picture proof for Proposition \ref{prop.1.11} as well, similar to
the one we gave for Theorem \ref{thm.1.10}? Yes, but the picture will be
$3$-dimensional and thus much harder to reason about.

Is there a proof of Proposition \ref{prop.1.11} that is analogous to our
second proof of Theorem \ref{thm.1.10} above? Not to my knowledge. The numbers
$1^{2}+n^{2},2^{2}+\left(  n-1\right)  ^{2},\ldots,n^{2}+1^{2}$ are not equal,
and I don't know of a way to reorder the addends in the (expanded) sum
$6\cdot\left(  1^{2}+2^{2}+\cdots+n^{2}\right)  $ to obtain $n\left(
n+1\right)  \left(  2n+1\right)  $.

Next, let us sum the cubes of the first $n$ positive integers:

\begin{proposition}
\label{prop.1.12}Let $n\in\mathbb{N}$. Then,
\[
1^{3}+2^{3}+\cdots+n^{3}=\dfrac{n^{2}\left(  n+1\right)  ^{2}}{4}.
\]

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.1.12} (sketched).]Again, a straightforward
induction (LTTR).
\end{proof}

\fbox{\textbf{Class of 2019-09-30 (to-do)}}

TODO: properties of $\sum$ sign.

TODO: $\prod$ and product signs.

\textbf{Question:} Given $k\in\mathbb{N}$, what is $1^{k}+2^{k}+\cdots+n^{k}$
? Is it a $\left(  k+1\right)  $-degree polynomial in $n$ ?

\begin{definition}
If $a_{p},a_{p+1},\ldots,a_{q}$ (for some integers $p$ and $q$) are numbers,
then $\sum\limits_{i=p}^{q}a_{i}$ means $a_{p}+a_{p+1}+\cdots+a_{q}$ (or,
equivalently, $\sum\limits_{i\in\left\{  p,p+1,\ldots,q\right\}  }a_{i}$).
\end{definition}

Thus, $1^{k}+2^{k}+\cdots+n^{k}$ rewrites as
\[
\sum\limits_{i=1}^{n}i^{k}.
\]


\begin{theorem}
(18th Century?) Let $n,k\in\mathbb{N}$ with $k>0$. Then,%
\[
\sum_{i=1}^{n}i^{k}=\sum_{i=0}^{k}\operatorname*{sur}\left(  k,i\right)
\cdot\dbinom{n+1}{i+1},
\]
where:

\begin{itemize}
\item as before, we set $\left[  k\right]  =\left\{  1,2,\ldots,k\right\}  $
for each $k\in\mathbb{N}$;

\item $\operatorname*{sur}\left(  k,i\right)  $ means the number of surjective
maps from $\left[  k\right]  \rightarrow\left[  i\right]  $ (remember:
$\left[  k\right]  =\left\{  1,2,\ldots,k\right\}  $ and $\left[  i\right]
=\left\{  1,2,\ldots,i\right\}  $, and $\left[  0\right]  =\varnothing$).

\item $\dbinom{x}{j}=\dfrac{x\left(  x-1\right)  \left(  x-2\right)
\cdots\left(  x-j+1\right)  }{j\left(  j-1\right)  \left(  j-2\right)
\cdots1}$ for all $x\in\mathbb{R}$ and $j\in\mathbb{N}$.
\end{itemize}
\end{theorem}

\begin{example}
Let $k=2$. Then, this theorem yields%
\begin{align*}
1^{2}+2^{2}+\cdots+n^{2}  &  =\sum_{i=0}^{2}\operatorname*{sur}\left(
2,i\right)  \cdot\dbinom{n+1}{i+1}\\
&  =\underbrace{\operatorname*{sur}\left(  2,0\right)  }_{=0}\cdot
\underbrace{\dbinom{n+1}{0+1}}_{\substack{=\dbinom{n+1}{1}\\=\dfrac{n+1}{1}%
}}+\underbrace{\operatorname*{sur}\left(  2,1\right)  }_{=1}\cdot
\underbrace{\dbinom{n+1}{1+1}}_{\substack{=\dbinom{n+1}{2}\\=\dfrac{\left(
n+1\right)  n}{2\cdot1}}}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\operatorname*{sur}\left(  2,2\right)
}_{=2}\cdot\underbrace{\dbinom{n+1}{2+1}}_{\substack{=\dbinom{n+1}{3}%
\\=\dfrac{\left(  n+1\right)  n\left(  n-1\right)  }{3\cdot2\cdot1}}}\\
&  =0\cdot\dfrac{n+1}{1}+1\cdot\dfrac{\left(  n+1\right)  n}{2\cdot1}%
+2\cdot\dfrac{\left(  n+1\right)  n\left(  n-1\right)  }{3\cdot2\cdot1}\\
&  =\dfrac{n\left(  n+1\right)  \left(  2n+1\right)  }{6}.
\end{align*}
Thus, our formula for $1^{2}+2^{2}+\cdots+n^{2}$ follows from the Theorem.
Similarly we can get formulas for sums of all other powers.
\end{example}

We will prove the Theorem later.

\subsection{Factorials and binomial coefficients}

\begin{definition}
For any $n\in\mathbb{N}$, set $n!=1\cdot2\cdot\cdots\cdot n$.

This is understood to be $1$ when $n=0$, since generally, empty products are
defined to be $1$. (Same logic as for why $0^{0}=1$, or more generally
$k^{0}=1$ for all $k$.)

We shall refer to $n!$ as \textquotedblleft$n$ factorial\textquotedblright.
\end{definition}

\begin{remark}
If $n$ is a positive integer, then%
\begin{align*}
n!  &  =1\cdot2\cdot\cdots\cdot n=\underbrace{\left(  1\cdot2\cdot\cdots
\cdot\left(  n-1\right)  \right)  }_{=\left(  n-1\right)  !}\cdot n\\
&  =\left(  n-1\right)  !\cdot n.
\end{align*}

\end{remark}

\begin{example}%
\begin{align*}
0!  &  =1,\\
1!  &  =1,\\
2!  &  =1\cdot2=2,\\
3!  &  =1\cdot2\cdot3=6,\\
4!  &  =1\cdot2\cdot3\cdot4=24,\\
5!  &  =1\cdot2\cdot3\cdot4\cdot5=120,\\
6!  &  =1\cdot2\cdot3\cdot4\cdot5\cdot6=720,\\
7!  &  =5\ 040,\\
8!  &  =40\ 320,\\
&  \vdots
\end{align*}

\end{example}

\begin{definition}
Let $n$ be any number ($n\in\mathbb{N}$ or $n\in\mathbb{Z}$ or $n\in
\mathbb{R}$ or $n\in\mathbb{C}$).

\textbf{(a)} For any $k\in\mathbb{N}$, we set%
\[
\dbinom{n}{k}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  }{k!}.
\]


\textbf{(b)} If $k\notin\mathbb{N}$, we set%
\[
\dbinom{n}{k}=0.
\]
(This is the convention of [Graham, Knuth and Patashnik].)

We call $\dbinom{n}{k}$ a \textbf{binomial coefficient}, and we refer to it as
\textquotedblleft$n$ \textbf{choose }$k$\textquotedblright.
\end{definition}

\begin{remark}
For any number $n$ and any $k\in\mathbb{N}$, we have%
\[
\dbinom{n}{k}=\dfrac{n^{\underline{k}}}{k!}\ \ \ \ \ \ \ \ \ \ \text{using the
notation of HW0 exercise 2.}%
\]

\end{remark}

\begin{example}%
\begin{align*}
\dbinom{n}{0}  &  =\dfrac{\left(  \text{empty product}\right)  }{0!}=\dfrac
{1}{1}=1;\\
\dbinom{n}{1}  &  =\dfrac{n}{1!}=\dfrac{n}{1}=n;\\
\dbinom{n}{2}  &  =\dfrac{n\left(  n-1\right)  }{2!}=\dfrac{n\left(
n-1\right)  }{2};\\
\dbinom{n}{3}  &  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)  }%
{3!}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  }{6};\\
\dbinom{-1}{5}  &  =\dfrac{\left(  -1\right)  \left(  -2\right)  \left(
-3\right)  \left(  -4\right)  \left(  -5\right)  }{5!}=\dfrac{\left(
-1\right)  \left(  -2\right)  \left(  -3\right)  \left(  -4\right)  \left(
-5\right)  }{1\cdot2\cdot3\cdot4\cdot5}=-1;\\
\dbinom{-1}{k}  &  =\dfrac{\left(  -1\right)  \left(  -2\right)  \cdots\left(
-k\right)  }{k!}=\left(  -1\right)  ^{k}=%
\begin{cases}
1, & \text{if }k\text{ is even;}\\
-1, & \text{if }k\text{ is odd}%
\end{cases}
.
\end{align*}

\end{example}

------------------------ 2019-10-02

\begin{example}%
\begin{align*}
\dbinom{\sqrt{2}}{2}  &  =\dfrac{\sqrt{2}\left(  \sqrt{2}-1\right)  }{2};\\
\dbinom{2}{\sqrt{2}}  &  =0\ \ \ \ \ \ \ \ \ \ \text{since }\sqrt{2}%
\notin\mathbb{N}.
\end{align*}

\end{example}

One of the major topics in combinatorics is properties of binomial coefficients.

\begin{proposition}
If $n\in\mathbb{N}$ and $k>n$, then $\dbinom{n}{k}=0$.
\end{proposition}

\begin{proof}
WLOG $k\in\mathbb{N}$, since otherwise $\dbinom{n}{k}=0$ by definition.

So
\[
\dbinom{n}{k}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  }{k!}=0,
\]
because one of the factors $n,n-1,n-2,\ldots,n-k+1$ is $n-n=0$.
\end{proof}

(Cf. the old math joke: Simplify $\left(  x-a\right)  \left(  x-b\right)
\cdots\left(  x-z\right)  $.)

\begin{proposition}
(\textquotedblleft Upper negation\textquotedblright) Let $n\in\mathbb{R}$ and
$k\in\mathbb{Z}$. Then,%
\[
\dbinom{-n}{k}=\left(  -1\right)  ^{k}\dbinom{n+k-1}{k}.
\]

\end{proposition}

\begin{proof}
We can have two cases:

\textit{Case 1:} We have $k\notin\mathbb{N}$. Then, both sides are $0$, qed.

\textit{Case 2:} We have $k\in\mathbb{N}$. Then,%
\begin{align*}
\dbinom{-n}{k}  &  =\dfrac{\left(  -n\right)  \left(  -n-1\right)  \left(
-n-2\right)  \cdots\left(  -n-k+1\right)  }{k!}\\
&  =\dfrac{\left(  -1\right)  ^{k}\cdot n\left(  n+1\right)  \left(
n+2\right)  \cdots\left(  n+k-1\right)  }{k!}\\
&  =\dfrac{\left(  -1\right)  ^{k}\cdot\left(  n+k-1\right)  \left(
n+k-2\right)  \left(  n+k-3\right)  \cdots n}{k!}\\
&  =\left(  -1\right)  ^{k}\cdot\underbrace{\dfrac{\left(  n+k-1\right)
\left(  n+k-2\right)  \left(  n+k-3\right)  \cdots n}{k!}}_{=\dbinom{n+k-1}%
{k}}\\
&  =\left(  -1\right)  ^{k}\cdot\dbinom{n+k-1}{k}.
\end{align*}

\end{proof}

Here are some more results, to be proven later.

\begin{theorem}
(Recurrence of the BC). Let $n\in\mathbb{R}$ and $k\in\mathbb{Z}$. Then,%
\[
\dbinom{n}{k}=\dbinom{n-1}{k-1}+\dbinom{n-1}{k}.
\]

\end{theorem}

This theorem gives a quick way to compute a given $\dbinom{n}{k}$ when
$n,k\in\mathbb{N}$. Usually, these numbers $\dbinom{n}{k}$ with $n,k\in
\mathbb{N}$ are tabulated in a triangular table called \textit{Pascal's
triangle}, where the rows correspond to the values of $n$ and the diagonals
(of $\diagup$ form) correspond to the values of $k$. In this triangle, each
number is the sum of two numbers on the previous row, namely the one
left-above and the one right-above. (See Wikipedia.)

\begin{theorem}
(Symmetry of the BC) Let $n\in\mathbb{N}$ and $k\in\mathbb{Z}$. Then,%
\[
\dbinom{n}{k}=\dbinom{n}{n-k}.
\]

\end{theorem}

\begin{theorem}
(Integrality of the BC) Let $n\in\mathbb{Z}$ and $k\in\mathbb{Z}$. Then,
$\dbinom{n}{k}\in\mathbb{Z}$.
\end{theorem}

\begin{theorem}
(Combinatorial interpretation of the BC)

Let $n\in\mathbb{N}$ and $k\in\mathbb{Z}$. Let $S$ be an $n$-element set.
Then,%
\[
\dbinom{n}{k}=\left(  \text{\# of }k\text{-element subsets of }S\right)  .
\]

\end{theorem}

\begin{example}
Let $n=4$ and $k=2$ and $S=\left\{  1,2,3,4\right\}  $. Then, the $2$-element
subsets of $S$ are $\left\{  1,2\right\}  ,\ \left\{  1,3\right\}  ,\ \left\{
1,4\right\}  ,\ \left\{  2,3\right\}  ,\ \left\{  2,4\right\}  $ and $\left\{
3,4\right\}  $. Their number is $6=\dbinom{4}{2}$, as the theorem above predicts.
\end{example}

We will prove these later ([detnotes, Ch. 3], or [Graham, Knuth, Patashnik],
or essentially any other text on combinatorics).

The combinatorial interpretation of the BC is the reason why $\dbinom{n}{k}$
is called \textquotedblleft$n$ choose $k$\textquotedblright: It is the number
of ways to \textbf{choose} $k$ distinct elements (without an order) from $n$
given elements. The $k$-element subsets of $S$ are called the $k$%
\textbf{-combinations} of $S$.

\begin{warn}
The combinatorial interpretation of the BC says nothing about $\dbinom{n}{k}$
when $n\notin\mathbb{N}$. Neither does the symmetry property.
\end{warn}

\begin{theorem}
(\textquotedblleft Hockey-stick identity\textquotedblright). Let
$n\in\mathbb{N}$ and $k\in\mathbb{N}$. Then,%
\[
\dbinom{0}{k}+\dbinom{1}{k}+\dbinom{2}{k}+\cdots+\dbinom{n}{k}=\dbinom
{n+1}{k+1}.
\]

\end{theorem}

\begin{proof}
HW0 Exercise 2 says that%
\[
0^{\underline{k}}+1^{\underline{k}}+\cdots+n^{\underline{k}}=\dfrac{1}%
{k+1}\left(  n+1\right)  ^{\underline{k+1}}.
\]
Dividing it by $k!$ yields%
\begin{align*}
\dbinom{0}{k}+\dbinom{1}{k}+\dbinom{2}{k}+\cdots+\dbinom{n}{k}  &  =\dfrac
{1}{\left(  k+1\right)  \cdot k!}\left(  n+1\right)  ^{\underline{k+1}}\\
&  =\dfrac{1}{\left(  k+1\right)  !}\cdot\left(  n+1\right)  ^{\underline{k+1}%
}=\dbinom{n+1}{k+1}.
\end{align*}

\end{proof}

Alternatively, this can be proven by induction or combinatorially; we will see
those proofs later.

\begin{theorem}
(The binomial formula) Let $x,y\in\mathbb{R}$. Let $n\in\mathbb{N}$. Then,%
\[
\left(  x+y\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}{k}x^{k}y^{n-k}.
\]

\end{theorem}

This is why the $\dbinom{n}{k}$ are called \textit{binomial coefficients} --
they appear as coefficients in the binomial formula.

\begin{corollary}
Let $n\in\mathbb{N}$. Then, $\sum\limits_{k=0}^{n}\dbinom{n}{k}=2^{n}$.
\end{corollary}

\begin{proof}
Apply the binomial formula to $x=1$ and $y=1$.
\end{proof}

\begin{proposition}
Let $n\in\mathbb{N}$. Let $a,b\in\left\{  0,1,\ldots,2^{n}-1\right\}  $. Then:

\textbf{(a)} $\dbinom{2^{n}+a}{b}\equiv\dbinom{a}{b}\operatorname{mod}2$.

\textbf{(b)} $\dbinom{2^{n}+a}{2^{n}+b}\equiv\dbinom{a}{b}\operatorname{mod}2$.
\end{proposition}

\begin{theorem}
Let $p$ be a prime. Let $k\in\left\{  1,2,\ldots,p-1\right\}  $. Then,
$p\mid\dbinom{p}{k}$.
\end{theorem}

\begin{proposition}
Let $n\in\mathbb{N}$. Then, the Fibonacci number $f_{n+1}$ is%
\[
f_{n+1}=\sum_{k=0}^{n}\dbinom{n-k}{k}=\dbinom{n-0}{0}+\dbinom{n-1}{1}%
+\dbinom{n-2}{2}+\cdots+\dbinom{n-n}{n}.
\]

\end{proposition}

\begin{theorem}
(Cauchy's binomial formula) Let $x,y,z\in\mathbb{R}$. Then,%
\[
\sum_{k=0}^{n}\dbinom{n}{k}\left(  x+kz\right)  ^{k}\left(  y-kz\right)
^{n-k}=\sum_{k=0}^{n}\dfrac{n!}{k!}\left(  x+y\right)  ^{k}z^{n-k}.
\]

\end{theorem}

\begin{theorem}
(Abel's binomial formula) Let $x,y,z\in\mathbb{R}$. Then,%
\[
\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{x\left(  x+kz\right)  ^{k-1}%
}_{\substack{\text{This should be read}\\\text{as }1\text{ if }k=0}}\left(
y-kz\right)  ^{n-k}=\left(  x+y\right)  ^{n}.
\]

\end{theorem}

\begin{proof}
(Proof of the Recurrence of the BC).

We are in one of the following three cases:

\textit{Case 1:} We have $k\in\left\{  1,2,3,\ldots\right\}  $.

\textit{Case 2:} We have $k=0$.

\textit{Case 3:} We have $k\notin\mathbb{N}$.

Case 3 is easy: If $k\notin\mathbb{N}$, then $k-1\notin\mathbb{N}$, so
$\dbinom{n-1}{k-1}=0$, but also $\dbinom{n}{k}=0$ and $\dbinom{n-1}{k}=0$
(since $k\notin\mathbb{N}$). Thus, we have to prove that $0=0+0$.

Case 2: Assume $k=0$. Then, $\dbinom{n}{k}=\dbinom{n}{0}=1$, and similarly
$\dbinom{n-1}{k}=1$. Also, $\dbinom{n-1}{k-1}=\dbinom{n-1}{-1}=0$. So we have
to prove that $1=0+1$.
\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-09-04}}
\end{center}

\begin{proof}
Case 1: Assume $k\in\left\{  1,2,3,\ldots\right\}  $. Thus, both $k$ and $k-1$
belong to $\mathbb{N}$.

Now, by the definition of BCs,%
\begin{align*}
&  \dbinom{n-1}{k-1}+\dbinom{n-1}{k}\\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-k+1\right)  }{\left(  k-1\right)  !}+\dfrac{\left(
n-1\right)  \left(  n-2\right)  \left(  n-3\right)  \cdots\left(  n-k\right)
}{k!}\\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-k+1\right)  }{\left(  k-1\right)  !}\underbrace{\left(
1+\dfrac{n-k}{k}\right)  }_{=\dfrac{n}{k}}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }k!=\left(  k-1\right)  !\cdot k\right) \\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-k+1\right)  }{\left(  k-1\right)  !}\cdot\dfrac{n}{k}\\
&  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-k+1\right)  }{\left(  k-1\right)  !\cdot k}=\dfrac{n\left(
n-1\right)  \left(  n-2\right)  \left(  n-3\right)  \cdots\left(
n-k+1\right)  }{k!}=\dbinom{n}{k}.
\end{align*}
Thus, the theorem is proven in Case 1 as well.
\end{proof}

\begin{theorem}
(Factorial formula for the BCs)

Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$ be such that $k\leq n$. Then,%
\[
\dbinom{n}{k}=\dfrac{n!}{k!\cdot\left(  n-k\right)  !}.
\]

\end{theorem}

\begin{proof}%
\begin{align*}
k!\cdot\left(  n-k\right)  !\cdot\dbinom{n}{k}  &  =k!\cdot\left(  n-k\right)
!\cdot\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  }{k!}\\
&  =\left(  n-k\right)  !\cdot\left(  n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-k+1\right)  \right) \\
&  =n\left(  n-1\right)  \cdots1=n!.
\end{align*}

\end{proof}

\begin{theorem}
(Symmetry of the BC) Let $n\in\mathbb{N}$ and $k\in\mathbb{Z}$. Then,%
\[
\dbinom{n}{k}=\dbinom{n}{n-k}.
\]

\end{theorem}

\begin{proof}
\textit{Case 1:} $k\in\left\{  0,1,\ldots,n\right\}  $.

\textit{Case 2:} $k\notin\mathbb{Z}$.

\textit{Case 3:} Neither.

In Case 1, the previous theorem yields%
\begin{align*}
\dbinom{n}{k}  &  =\dfrac{n!}{k!\cdot\left(  n-k\right)  !}%
\ \ \ \ \ \ \ \ \ \ \text{and}\\
\dbinom{n}{n-k}  &  =\dfrac{n!}{\left(  n-k\right)  !\cdot\left(  n-\left(
n-k\right)  \right)  !}=\dfrac{n!}{\left(  n-k\right)  !\cdot k!}=\dfrac
{n!}{k!\cdot\left(  n-k\right)  !}.
\end{align*}
Comparing these yields $\dbinom{n}{k}=\dbinom{n}{n-k}$. Thus, we are done in
Case 1.

In Case 2, we just need to prove $0=0$.

Now let us look at Case 3. Here, $k\in\mathbb{Z}$ but $k\notin\left\{
0,1,\ldots,n\right\}  $. Thus, either $k<0$ or $k>n$. Hence, again, we just
need to prove $0=0$, because we know that $\dbinom{n}{\text{something
negative}}=0$ and $\dbinom{n}{\text{an integer }>n}=0$.
\end{proof}

\begin{proposition}
Let $k\in\mathbb{R}$. Then, $\dbinom{0}{k}=\left[  k=0\right]  $.
\end{proposition}

Recall: We are using the \textit{Iverson bracket notation}: i.e., for any
statement $\mathcal{A}$, we let $\left[  \mathcal{A}\right]  $ denote the
\textit{truth value} of $\mathcal{A}$, defined to be $%
\begin{cases}
1, & \text{if }\mathcal{A}\text{ is true};\\
0, & \text{if }\mathcal{A}\text{ is false}%
\end{cases}
$.

\begin{proof}
(Proof of the Proposition.) Again, there are three cases to consider: $k=0$,
$k\notin\mathbb{N}$ or $k\in\left\{  1,2,3,\ldots\right\}  $.
\end{proof}

\begin{theorem}
(Combinatorial interpretation of the BC)

Let $n\in\mathbb{N}$ and $k\in\mathbb{Z}$. Let $S$ be an $n$-element set.
Then,%
\[
\dbinom{n}{k}=\left(  \text{\# of }k\text{-element subsets of }S\right)  .
\]

\end{theorem}

\begin{proof}
Forget that we fixed $n$ and $k$. Induction on $n$.

\textit{Induction base:} If $S$ is a $0$-element set, then $S=\varnothing$ and
thus%
\begin{align*}
&  \left(  \#\text{ of }k\text{-element subsets of }S\right) \\
&  =\left(  \#\text{ of }k\text{-element subsets of }\varnothing\right) \\
&  =%
\begin{cases}
1, & \text{if }k=0;\\
0, & \text{if }k\neq0
\end{cases}
=\left[  k=0\right]  =\dbinom{0}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the
previous proposition}\right)  .
\end{align*}
Thus, the theorem is proven for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as IH) that the Theorem
holds for $n=m$.

Let $S$ be an $\left(  m+1\right)  $-element set. We must prove that%
\[
\dbinom{m+1}{k}=\left(  \text{\# of }k\text{-element subsets of }S\right)  .
\]


The set $S$ is nonempty, since its size is $\left\vert S\right\vert
=m+1\geq1>0$. Thus, there exists a $t\in S$. Fix such a $t$.

Now, there are two types of subsets of $S$:

\begin{itemize}
\item \textbf{red subsets}: those that contain $t$;

\item \textbf{green subsets:} those that don't contain $t$.
\end{itemize}

So, by the sum rule,%
\begin{align*}
&  \left(  \text{\# of }k\text{-element subsets of }S\right) \\
&  =\left(  \text{\# of }k\text{-element red subsets of }S\right)  +\left(
\text{\# of }k\text{-element green subsets of }S\right)  .
\end{align*}


But the green subsets of $S$ are exactly the subsets of $S\setminus\left\{
t\right\}  $. Hence,%
\begin{align*}
&  \left(  \text{\# of }k\text{-element green subsets of }S\right) \\
&  =\left(  \text{\# of }k\text{-element subsets of }S\setminus\left\{
t\right\}  \right) \\
&  =\dbinom{m}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the IH, since
}S\setminus\left\{  t\right\}  \text{ is an }m\text{-element set}\right)  .
\end{align*}


What about the red subsets?

Informally: The $k$-element red subsets of $S$ \textquotedblleft correspond
to\textquotedblright\ the $\left(  k-1\right)  $-element subsets of
$S\setminus\left\{  t\right\}  $.

Formally: The map%
\begin{align*}
\left\{  k\text{-element red subsets of }S\right\}   &  \rightarrow\left\{
\left(  k-1\right)  \text{-element subsets of }S\setminus\left\{  t\right\}
\right\}  ,\\
Q  &  \mapsto Q\setminus\left\{  t\right\}
\end{align*}
is a bijection. (Its inverse is%
\begin{align*}
\left\{  \left(  k-1\right)  \text{-element subsets of }S\setminus\left\{
t\right\}  \right\}   &  \rightarrow\left\{  k\text{-element red subsets of
}S\right\}  ,\\
P  &  \mapsto P\cup\left\{  t\right\}  .
\end{align*}
) Therefore, the bijection principle yields%
\begin{align*}
&  \left\vert \left\{  k\text{-element red subsets of }S\right\}  \right\vert
\\
&  =\left\vert \left\{  \left(  k-1\right)  \text{-element subsets of
}S\setminus\left\{  t\right\}  \right\}  \right\vert .
\end{align*}
In other words,%
\begin{align*}
&  \left(  \text{\# of }k\text{-element red subsets of }S\right) \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}S\setminus\left\{  t\right\}  \right) \\
&  =\dbinom{m-1}{k-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the IH, applied to
}k-1\text{ instead of }k\right)  .
\end{align*}


Now,
\begin{align*}
&  \left(  \text{\# of }k\text{-element subsets of }S\right) \\
&  =\underbrace{\left(  \text{\# of }k\text{-element red subsets of }S\right)
}_{=\dbinom{m-1}{k-1}}+\underbrace{\left(  \text{\# of }k\text{-element green
subsets of }S\right)  }_{=\dbinom{m-1}{k}}\\
&  =\dbinom{m-1}{k-1}+\dbinom{m-1}{k}=\dbinom{m}{k}\ \ \ \ \ \ \ \ \ \ \left(
\text{by the recurrence of the BCs}\right)  .
\end{align*}
And this completes the induction step.
\end{proof}

\begin{theorem}
(Integrality of the BC) Let $n\in\mathbb{Z}$ and $k\in\mathbb{Z}$. Then,
$\dbinom{n}{k}\in\mathbb{Z}$.
\end{theorem}

\begin{proof}
Three cases are possible:

\textit{Case 1:} $k\notin\mathbb{N}$.

\textit{Case 2:} $k\in\mathbb{N}$ and $n\in\mathbb{N}$.

\textit{Case 3:} $k\in\mathbb{N}$ and $n\notin\mathbb{N}$.

In Case 1, we just need to prove that $0\in\mathbb{Z}$.

In Case 2, the claim follows from the Combinatorial interpretation of the BCs.

In Case 3, we must have $n<0$. Now, the Upper negation formula (applied to
$-n$ instead of $n$) yields%
\[
\dbinom{n}{k}=\left(  -1\right)  ^{k}\underbrace{\dbinom{-n+k-1}{k}%
}_{\substack{\in\mathbb{Z}\\\text{(according to the}\\\text{Combinatorial
interpretation}\\\text{of the BCs, because }-n+k-1\in\mathbb{N}\text{)}}%
}\in\mathbb{Z}.
\]

\end{proof}

\begin{theorem}
(The binomial formula) Let $x,y\in\mathbb{R}$. Let $n\in\mathbb{N}$. Then,%
\[
\left(  x+y\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}{k}x^{k}y^{n-k}.
\]

\end{theorem}

\begin{proof}
I will rewrite $\sum\limits_{k=0}^{n}\dbinom{n}{k}x^{k}y^{n-k}$ as
$\sum\limits_{k\in\mathbb{Z}}\dbinom{n}{k}x^{k}y^{n-k}$ (that is, a sum over
\textbf{all} integers $k$).

Why is this latter \textbf{infinite} sum well-defined?

Let us look at the case $n=3$. In this case, this sum has the form%
\[
\cdots+0+0+0+y^{3}+3xy^{2}+3x^{2}y+x^{3}+0+0+0+\cdots.
\]
So it is infinite, but only finitely many of its addends are nonzero. The same
is true for any $n\in\mathbb{N}$.

An infinite sum that has only finitely many nonzero addends is always
well-defined: Its value is obtained by discarding the $0$'s (and summing the
nonzero addends).

(To be fully precise: We have to agree to interpret a product of the form $ab$
as $0$ whenever $a=0$, even if $b$ is undefined. This matters, because of
$x=0$, then for negative $k$, the power $x^{k}$ will be undefined.)

We have now made sense of $\sum\limits_{k\in\mathbb{Z}}\dbinom{n}{k}%
x^{k}y^{n-k}$. Since $\dbinom{n}{k}=0$ whenever $k\notin\left\{
0,1,\ldots,n\right\}  $, this sum just equals $\sum\limits_{k=0}^{n}\dbinom
{n}{k}x^{k}y^{n-k}$.

Thus, it remains to prove that%
\begin{equation}
\left(  x+y\right)  ^{n}=\sum\limits_{k\in\mathbb{Z}}\dbinom{n}{k}x^{k}%
y^{n-k}. \label{2}%
\end{equation}


We will prove this by induction:

\textit{Base:} $1=1$.

\textit{Step:} Fix $m\in\mathbb{N}$. Assume (2) holds for $n=m$. We must prove
that (2) holds for $n=m+1$.

We have%
\begin{align*}
\left(  x+y\right)  ^{m+1}  &  =\underbrace{\left(  x+y\right)  ^{m}%
}_{\substack{=\sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k}\\\text{(by
our IH)}}}\left(  x+y\right) \\
&  =\left(  \sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k}\right)
\left(  x+y\right) \\
&  =\left(  \sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k}\right)
x+\left(  \sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k}\right)  y\\
&  =\sum\limits_{k\in\mathbb{Z}}x\dbinom{m}{k}x^{k}y^{m-k}+\sum\limits_{k\in
\mathbb{Z}}y\dbinom{m}{k}x^{k}y^{m-k}\\
&  =\sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k+1}y^{m-k}+\sum
\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k+1}\\
&  =\sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k-1}x^{\left(  k-1\right)
+1}y^{m-\left(  k-1\right)  }+\sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k}%
x^{k}y^{m-k+1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }k-1\text{ for
}k\text{ in the first sum}\right) \\
&  =\sum\limits_{k\in\mathbb{Z}}\dbinom{m}{k-1}x^{k}y^{m-k+1}+\sum
\limits_{k\in\mathbb{Z}}\dbinom{m}{k}x^{k}y^{m-k+1}\\
&  =\sum\limits_{k\in\mathbb{Z}}\underbrace{\left(  \dbinom{m}{k-1}+\dbinom
{m}{k}\right)  }_{\substack{=\dbinom{m+1}{k}\\\text{(by the recurrence of the
BCs)}}}x^{k}\underbrace{y^{m-k+1}}_{=y^{m+1-k}}\\
&  =\sum\limits_{k\in\mathbb{Z}}\dbinom{m+1}{k}x^{k}y^{m+1-k}.
\end{align*}
Thus, (2) holds for $n=m+1$. This completes the induction step.
\end{proof}

So why did we take the trouble to turn our finite sum into an infinite sum?
Because this saved us the headache of having to combine two sums with
different ranges.

Knuth advises to always make sums infinite when possible. It is not always
possible, because sometimes when you extend a sum to a larger range, the new
addends you get will not all be $0$.

\subsection{Counting}

\subsubsection{Subsets}

We have already seen the following enumerations:

\begin{itemize}
\item An $n$-element set has $2^{n}$ subsets. (This was HW0 exercise 1
\textbf{(a)}.)

\item An $n$-element set has $\dbinom{n}{k}$ many $k$-element subsets.
\end{itemize}

Now, we can ask subtler questions.

\begin{definition}
A set $S$ of integers is called \textbf{lacunar} if it contains no two
consecutive integers (i.e., there is no integer $i$ such that both $i\in S$
and $i+1\in S$).
\end{definition}

For example, $\left\{  1,5,7\right\}  $ is lacunar, but $\left\{
1,5,6\right\}  $ is not.

Some people say \textquotedblleft sparse\textquotedblright\ instead of
\textquotedblleft lacunar\textquotedblright.

\textbf{Questions:}

\textbf{(a)} How many lacunar subsets does $\left[  n\right]  $ have?

\textbf{(b)} How many $k$-element lacunar subsets does $\left[  n\right]  $ have?

\textbf{(c)} What is the largest size of a lacunar subset of $\left[
n\right]  $ ?

Let us start with \textbf{(c)}:

\begin{definition}
Let $x\in\mathbb{R}$. Then:

\begin{itemize}
\item $\left\lfloor x\right\rfloor $ denotes the largest integer $\leq x$
(called the \textbf{floor of }$x$, or \textquotedblleft\textbf{rounding down}
$x$\textquotedblright).

\item $\left\lceil x\right\rceil $ denotes the smallest integer $\geq x$
(called the \textbf{ceiling of }$x$, or \textquotedblleft\textbf{rounding up
}$x$\textquotedblright).
\end{itemize}
\end{definition}

\begin{example}
$\left\lfloor 3\right\rfloor =3,\ \ \ \ \ \ \ \ \ \ \left\lfloor \sqrt
{2}\right\rfloor =1,\ \ \ \ \ \ \ \ \ \ \left\lfloor \pi\right\rfloor
=3,\ \ \ \ \ \ \ \ \ \ \left\lfloor -\pi\right\rfloor =-4$.

$\left\lceil 3\right\rceil =3,\ \ \ \ \ \ \ \ \ \ \left\lceil \sqrt
{2}\right\rceil =2,\ \ \ \ \ \ \ \ \ \ \left\lceil \pi\right\rceil
=4,\ \ \ \ \ \ \ \ \ \ \left\lceil -\pi\right\rceil =-3$.
\end{example}

\begin{proposition}
Let $n\in\mathbb{N}$. Then, the largest size of a lacunar subset of $\left[
n\right]  $ is $\left\lceil n/2\right\rceil $.
\end{proposition}

\begin{proof}
The lacunar subset%
\[
\left\{  1,3,5,\ldots,\left(  n\text{ or }n-1\right)  \right\}  =\left\{
1<3<5<\cdots<\left(  n\text{ or }n-1\right)  \right\}
\]
(where the last element is $n$ if $n$ is odd, and $n-1$ if $n$ is even) has
size $\left\lceil n/2\right\rceil $.

Thus, we only need to prove that no higher size is possible.
\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-09-07}}
\end{center}

\begin{proof}
(Continuing the proof:) Let $L$ be a lacunar subset of $\left[  n\right]  $.
We want to prove that $\left\vert L\right\vert \leq\left\lceil n/2\right\rceil
$.

Indeed, let $L^{+}$ be the set $\left\{  s+1\ \mid\ s\in L\right\}  $.

Then, the sets $L$ and $L^{+}$ are disjoint, since $L$ is lacunar. Hence, the
sum principle yields $\left\vert L\cup L^{+}\right\vert =\left\vert
L\right\vert +\underbrace{\left\vert L^{+}\right\vert }_{=\left\vert
L\right\vert }=2\cdot\left\vert L\right\vert $.

But $L\cup L^{+}$ is a subset of $\left[  n+1\right]  $. Hence,%
\[
\left\vert L\cup L^{+}\right\vert \leq\left\vert \left[  n+1\right]
\right\vert =n+1.
\]
Since $\left\vert L\cup L^{+}\right\vert =2\cdot\left\vert L\right\vert $,
this becomes $2\cdot\left\vert L\right\vert \leq n+1$. Thus,
\[
\left\vert L\right\vert \leq\dfrac{n+1}{2}<\dfrac{n}{2}+1\leq\left\lceil
\dfrac{n}{2}\right\rceil +1.
\]
Since $\left\vert L\right\vert $ and $\left\lceil \dfrac{n}{2}\right\rceil +1$
are integers, this yields%
\[
\left\vert L\right\vert \leq\left(  \left\lceil \dfrac{n}{2}\right\rceil
+1\right)  -1=\left\lceil \dfrac{n}{2}\right\rceil .
\]
This is what we wanted to prove.
\end{proof}

\subsubsection{Intermezzo: SageMath}

Now to Question \textbf{(b)}: How many lacunar subsets does $\left[  n\right]
$ have?

Let us try it for small values of $n$:

\subsubsection{Counting lacunar subsets}

\begin{definition}
If $k\in\mathbb{Z}$, then $\left[  k\right]  $ means the set $\left\{
1,2,\ldots,k\right\}  $. If $k\leq0$, then this is understood to be
$\varnothing$.
\end{definition}

\begin{proposition}
Let $n\in\left\{  -1,0,1,\ldots\right\}  $. Then,%
\[
\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)  =f_{n+2}.
\]

\end{proposition}

One way to prove this is by induction, similarly to how we counted $k$-element
subsets of $n$. Indeed, we can call a subset of $\left[  n\right]  $

\begin{itemize}
\item \textbf{red} if it contains $n$, and

\item \textbf{green} if it does not contain $n$.
\end{itemize}

Then, for each $n\geq1$, we have%
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  n\right]  \right) \\
&  =\left(  \text{\# of lacunar red subsets of }\left[  n\right]  \right)
+\left(  \text{\# of lacunar green subsets of }\left[  n\right]  \right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  n-2\right]  \right)
+\left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \right)  .
\end{align*}
So the sequence of $\left(  \text{\# of lacunar subsets of }\left[  n\right]
\right)  $ follows the same recursion as the Fibonacci sequence. Now check the
starting values and you're done.

Sketch of a different proof: There is a bijection between
\[
\left\{  \text{lacunar subsets of }\left[  n\right]  \right\}
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left\{  \text{domino
tilings of }R_{n+1,2}\right\}  .
\]


\subsubsection{Counting $k$-element lacunar subsets}

Let us answer part \textbf{(c)} of the question now:

\begin{proposition}
Let $n\in\mathbb{Z}$ and $k\in\mathbb{N}$ be such that $k\leq n+1$. Then,%
\[
\left(  \text{\# of }k\text{-element lacunar subsets of }\left[  n\right]
\right)  =\dbinom{n+1-k}{k}.
\]

\end{proposition}

This is plausible but not quite obvious.

One way to prove this proposition is by strong induction on $n$, just as we
proved the previous proposition.

Here is a different proof -- a \textit{bijective proof}:

\begin{proof}
Define a map%
\begin{align*}
A:\left\{  k\text{-element lacunar subsets of }\left[  n\right]  \right\}   &
\rightarrow\left\{  k\text{-element subsets of }\left[  n+1-k\right]
\right\}  ,\\
\left\{  s_{1}<s_{2}<\cdots<s_{k}\right\}   &  \mapsto\left\{  s_{1}%
-0<s_{2}-1<s_{3}-2<\cdots<s_{k}-\left(  k-1\right)  \right\}  .
\end{align*}
This is a bijection, with inverse%
\begin{align*}
B:\left\{  k\text{-element subsets of }\left[  n+1-k\right]  \right\}   &
\rightarrow\left\{  k\text{-element lacunar subsets of }\left[  n\right]
\right\}  ,\\
\left\{  t_{1}<t_{2}<\cdots<t_{k}\right\}   &  \mapsto\left\{  t_{1}%
+0<t_{2}+1<t_{3}+2<\cdots<t_{k}+\left(  k-1\right)  \right\}  .
\end{align*}
Thus, the bijection principle yields%
\begin{align*}
&  \left\vert \left\{  k\text{-element lacunar subsets of }\left[  n\right]
\right\}  \right\vert \\
&  =\left\vert \left\{  k\text{-element subsets of }\left[  n+1-k\right]
\right\}  \right\vert =\dbinom{n+1-k}{k}.
\end{align*}

\end{proof}

Now, we can also prove:

\begin{proposition}
Let $n\in\mathbb{N}$. Then, the Fibonacci number $f_{n+1}$ is%
\[
f_{n+1}=\sum_{k=0}^{n}\dbinom{n-k}{k}=\dbinom{n-0}{0}+\dbinom{n-1}{1}%
+\dbinom{n-2}{2}+\cdots+\dbinom{n-n}{n}.
\]

\end{proposition}

\begin{proof}
Consider the lacunar subsets of $\left[  n-1\right]  $. Their sizes range from
$0$ to $n$ (actually, $n$ can only be a size when $n=0$, but that's OK). So
the sum principle yields%
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \right) \\
&  =\sum_{k=0}^{n}\underbrace{\left(  \text{\# of }k\text{-element lacunar
subsets of }\left[  n-1\right]  \right)  }_{\substack{=\dbinom{\left(
n-1\right)  +1-k}{k}\\\text{(by previous proposition,}\\\text{applied to
}n-1\text{ instead of }n\text{)}}}\\
&  =\sum_{k=0}^{n}\dbinom{\left(  n-1\right)  +1-k}{k}=\sum_{k=0}^{n}%
\dbinom{n-k}{k}.
\end{align*}
But the pre-previous proposition yields%
\[
\left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \right)
=f_{\left(  n-1\right)  +2}=f_{n+1}.
\]
Comparing these, we get%
\[
f_{n+1}=\sum_{k=0}^{n}\dbinom{n-k}{k}.
\]

\end{proof}

We have now answered all our three questions on lacunar subsets.

\subsubsection{A little exercise}

\begin{exercise}
Let $n,a,b$ be nonnegative integers such that $n$ is even. Find%
\[
\left(  \text{\# of subsets of }\left[  n\right]  \text{ that have }a\text{
even and }b\text{ odd elements}\right)  .
\]

\end{exercise}

Solution idea: In order to choose such a subset, we have to choose two
independent things:

\begin{itemize}
\item an $a$-element subset of $\left\{  2,4,6,\ldots,n\right\}  $;

\item a $b$-element subset of $\left\{  1,3,5,\ldots,n-1\right\}  $.
\end{itemize}

The former can be chosen in $\dbinom{n/2}{a}$ many ways, while the latter can
be chosen in $\dbinom{n/2}{b}$ many ways. So the total \# of subsets is%
\[
\dbinom{n/2}{a}\cdot\dbinom{n/2}{b}.
\]
Why exactly? This is the product rule in action. Formally speaking, there is a
bijection%
\begin{align*}
&  \left\{  \text{subsets of }\left[  n\right]  \text{ that have }a\text{ even
and }b\text{ odd elements}\right\} \\
&  \rightarrow\left\{  a\text{-element subsets of }\left\{  2,4,6,\ldots
,n\right\}  \right\}  \times\left\{  b\text{-element subsets of }\left\{
1,3,5,\ldots,n-1\right\}  \right\}  ,\\
S  &  \mapsto\left(  S\cap\left\{  2,4,6,\ldots,n\right\}  ,S\cap\left\{
1,3,5,\ldots,n-1\right\}  \right)  .
\end{align*}


\begin{center}
\fbox{\textbf{Class of 2019-09-09}}
\end{center}

\subsubsection{The Fibonacci addition formula}

\begin{theorem}
Let $m,n\in\mathbb{N}$. Then, $f_{m+n+1}=f_{m}f_{n}+f_{m+1}f_{n+1}$.
\end{theorem}

\begin{proof}
It is not hard to prove this by induction (see references in notes).

Proof by \textquotedblleft double counting\textquotedblright:

WLOG assume that $m,n>0$.

How many lacunar subsets of $\left[  m+n-1\right]  $ are there?

\textit{1st method:} One of our propositions says that the \# is $f_{\left(
m+n-1\right)  +2}=f_{m+n+1}$.

\textit{2nd method:} Call a lacunar subset $S$ of $\left[  m+n-1\right]  $

\begin{itemize}
\item \textbf{red} if it contains $m$;

\item \textbf{green} if it does not contain $m$.
\end{itemize}

A green lacunar subset of $\left[  m+n-1\right]  $ is just a union of

\begin{itemize}
\item a lacunar subset of $\left[  m-1\right]  $, and

\item a lacunar subset of $\left\{  m+1,m+2,\ldots,m+n-1\right\}  $.
\end{itemize}

Conversely, any such union is a green lacunar subset of $\left[  m+n-1\right]
$.

Thus, we get a bijection%
\begin{align*}
&  \left\{  \text{green lacunar subsets of }\left[  m+n-1\right]  \right\} \\
&  \rightarrow\left\{  \text{lacunar subsets of }\left[  m-1\right]  \right\}
\times\left\{  \text{lacunar subsets of }\left\{  m+1,m+2,\ldots
,m+n-1\right\}  \right\}  .
\end{align*}
Thus, by the bijection principle and the product rule,%
\begin{align*}
&  \left(  \text{\# of green lacunar subsets of }\left[  m+n-1\right]  \right)
\\
&  =\underbrace{\left(  \text{\# of lacunar subsets of }\left[  m-1\right]
\right)  }_{=f_{\left(  m-1\right)  +2}=f_{m+1}}\\
&  \ \ \ \ \ \ \ \ \ \ \cdot\underbrace{\left(  \text{\# of lacunar subsets of
}\left\{  m+1,m+2,\ldots,m+n-1\right\}  \right)  }_{\substack{=f_{\left(
n-1\right)  +1}=f_{n+1}\\\text{(here, we have shifted our subsets}\\\text{to
the left by }m\text{)}}}\\
&  =f_{m+1}f_{n+1}.
\end{align*}


A red lacunar subset of $\left[  m+n-1\right]  $ is just a union of

\begin{itemize}
\item a lacunar subset of $\left[  m-2\right]  $,

\item a lacunar subset of $\left\{  m+2,m+3,\ldots,m+n-1\right\}  $, and

\item the one-element set $\left\{  m\right\}  $.
\end{itemize}

Conversely, any such union is a red lacunar subset of $\left[  m+n-1\right]  $.

Hence, we have a bijection%
\begin{align*}
&  \left\{  \text{red lacunar subsets of }\left[  m+n-1\right]  \right\} \\
&  \rightarrow\left\{  \text{lacunar subsets of }\left[  m-2\right]  \right\}
\times\left\{  \text{lacunar subsets of }\left\{  m+2,m+3,\ldots
,m+n-1\right\}  \right\}  .
\end{align*}
Thus, by the bijection principle and the product rule,%
\begin{align*}
&  \left(  \text{\# of red lacunar subsets of }\left[  m+n-1\right]  \right)
\\
&  =\underbrace{\left(  \text{\# of lacunar subsets of }\left[  m-2\right]
\right)  }_{=f_{\left(  m-2\right)  +2}=f_{m}}\\
&  \ \ \ \ \ \ \ \ \ \ \cdot\underbrace{\left(  \text{\# of lacunar subsets of
}\left\{  m+2,m+3,\ldots,m+n-1\right\}  \right)  }_{\substack{=f_{n+1}%
=f_{n}\\\text{(here, we have shifted our subsets}\\\text{to the left by
}m+1\text{)}}}\\
&  =f_{m}f_{n}.
\end{align*}
Hence,%
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  m+n-1\right]  \right) \\
&  =\underbrace{\left(  \text{\# of red lacunar subsets of }\left[
m+n-1\right]  \right)  }_{=f_{m}f_{n}}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{\# of green lacunar subsets
of }\left[  m+n-1\right]  \right)  }_{=f_{m+1}f_{n+1}}\\
&  =f_{m}f_{n}+f_{m+1}f_{n+1}.
\end{align*}


So we have computed $\left(  \text{\# of lacunar subsets of }\left[
m+n-1\right]  \right)  $ in two ways, and we have obtained $f_{m+n+1}$ and
$f_{m}f_{n}+f_{m+1}f_{n+1}$, respectively. Comparing these, we obtain
$f_{m+n+1}=f_{m}f_{n}+f_{m+1}f_{n+1}$.
\end{proof}

See [Benjamin \& Quinn] for more examples of \textquotedblleft double
counting\textquotedblright.

\subsubsection{Some counting exercises}

\begin{exercise}
A set $S$ of integers is said to be \textbf{self-counting} if $\left\vert
S\right\vert \in S$.

(For example, $\left\{  1,3,5\right\}  $ is self-counting, since $\left\vert
\left\{  1,3,5\right\}  \right\vert =3\in\left\{  1,3,5\right\}  $. But
$\left\{  4\right\}  $ and $\left\{  1,3\right\}  $ and $\left\{
1,2,4\right\}  $ are not self-counting.)

Let $n$ be a positive integer.

\textbf{(a)} For a given $k\in\left[  n\right]  $, how many self-counting
$k$-element subsets does $\left[  n\right]  $ have?

\textbf{(b)} How many self-counting subsets does $\left[  n\right]  $ have?
\end{exercise}

\begin{proof}
\textbf{(a)} Fix $k\in\left[  n\right]  $. A $k$-element subset of $\left[
n\right]  $ is self-counting if and only if it contains $k$. So%
\begin{align*}
&  \left(  \text{\# of self-counting }k\text{-element subsets of }\left[
n\right]  \right) \\
&  =\left(  \text{\# of }k\text{-element subsets of }\left[  n\right]  \text{
that contain }k\right) \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}\left[  n\right]  \setminus\left\{  k\right\}  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the bijection principle}\right) \\
&  =\dbinom{n-1}{k-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the Combinatorial
interpretation of BCs}\right)  .
\end{align*}


\textbf{(b)} Each self-counting subset of $\left[  n\right]  $ has size $1$ or
$2$ or $\cdots$ or $n$. Thus, the sum rule shows that%
\begin{align*}
&  \left(  \text{\# of self-counting subsets of }\left[  n\right]  \right) \\
&  =\sum_{k=1}^{n}\left(  \text{\# of self-counting subsets of }\left[
n\right]  \text{ of size }k\right) \\
&  =\sum_{k=1}^{n}\underbrace{\left(  \text{\# of self-counting }%
k\text{-element subsets of }\left[  n\right]  \right)  }_{=\dbinom{n-1}{k-1}%
}\\
&  =\sum_{k=1}^{n}\dbinom{n-1}{k-1}=\sum_{k=0}^{n-1}\dbinom{n-1}%
{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }k\text{ for
}k-1\right) \\
&  =2^{n-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the }\sum_{k=0}^{n}\dbinom
{n}{k}=2^{n}\text{ formula, applied to }n-1\text{ instead of }n\right)  .
\end{align*}

\end{proof}

\begin{exercise}
A set $S$ of integers is said to be \textbf{self-starting} if $\left\vert
S\right\vert $ is the smallest element of $S$.

(For example, $\left\{  1\right\}  $ and $\left\{  2,5\right\}  $ and
$\left\{  3,5,9\right\}  $ are self-starting. But $\left\{  4\right\}  $ and
$\left\{  1,3\right\}  $ and $\left\{  1,2,4\right\}  $ and $\left\{
1,3,5\right\}  $ are not self-starting.)

Let $n$ be a positive integer.

\textbf{(a)} For a given $k\in\left[  n\right]  $, how many self-starting
$k$-element subsets does $\left[  n\right]  $ have?

\textbf{(b)} How many self-starting subsets does $\left[  n\right]  $ have?
\end{exercise}

\begin{proof}
\textbf{(a)} Fix $k\in\left[  n\right]  $. Then, the self-starting $k$-element
subsets of $\left[  n\right]  $ are just the $k$-element subsets of $\left[
n\right]  $ that contain $k$ and whose all other elements are in $\left\{
k+1,k+2,\ldots,n\right\}  $. Thus, we have
\begin{align*}
&  \left(  \text{\# of self-starting }k\text{-element subsets of }\left[
n\right]  \right) \\
&  =\left(
\begin{array}
[c]{c}%
\text{\# of }k\text{-element subsets of }\left[  n\right]  \text{ that contain
}k\\
\text{and whose all other elements are in }\left\{  k+1,k+2,\ldots,n\right\}
\end{array}
\right) \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}\left\{  k+1,k+2,\ldots,n\right\}  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the bijection principle}\right) \\
&  =\dbinom{n-k}{k-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the Combinatorial
interpretation of BCs}\right)  .
\end{align*}


\textbf{(b)} The sum rule again yields%
\begin{align*}
&  \left(  \text{\# of self-starting subsets of }\left[  n\right]  \right) \\
&  =\sum_{k=1}^{n}\underbrace{\left(  \text{\# of self-starting }%
k\text{-element subsets of }\left[  n\right]  \right)  }_{=\dbinom{n-k}{k-1}%
}\\
&  =\sum_{k=1}^{n}\dbinom{n-k}{k-1}=\sum_{k=0}^{n-1}\dbinom{n-k-1}%
{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }k\text{ for
}k-1\right) \\
&  =\sum_{k=0}^{n-1}\dbinom{n-1-k}{k}=f_{n},
\end{align*}
since one of our previous propositions said that
\[
f_{n+1}=\sum_{k=0}^{n}\dbinom{n-k}{k}%
\]
(we have applied this to $n-1$ instead of $n$).
\end{proof}

\begin{exercise}
A set $S$ of integers is said to be \textbf{self-ending} if $\left\vert
S\right\vert $ is the largest element of $S$.

(For example, $\left\{  1\right\}  $ and $\left\{  1,2,3\right\}  $ are
self-ending. But $\left\{  4\right\}  $ and $\left\{  1,3\right\}  $ and
$\left\{  1,2,4\right\}  $ and $\left\{  1,3,5\right\}  $ are not self-starting.)

Let $n$ be a positive integer.

\textbf{(a)} For a given $k\in\left[  n\right]  $, how many self-ending
$k$-element subsets does $\left[  n\right]  $ have?

\textbf{(b)} How many self-ending subsets does $\left[  n\right]  $ have?
\end{exercise}

\begin{proof}
\textbf{(a)} Fix $k\in\left[  n\right]  $. The only self-ending $k$-element
subset of $\left[  n\right]  $ is $\left[  k\right]  $. So the \# of such
subsets is $1$.

\textbf{(b)} By the sum rule, the \# is $\sum\limits_{k=1}^{n}1=n$.
\end{proof}

\subsubsection{Counting maps and tuples}

Recall: If $A_{1},A_{2},\ldots,A_{n}$ are $n$ sets, then $A_{1}\times
A_{2}\times\cdots\times A_{n}$ means the set of all $n$-tuples
\[
\left(  a_{1},a_{2},\ldots,a_{n}\right)  \ \ \ \ \ \ \ \ \ \ \text{with }%
a_{1}\in A_{1}\text{ and }a_{2}\in A_{2}\text{ and }\cdots\text{ and }a_{n}\in
A_{n}.
\]
This is called the \textbf{Cartesian product} of $A_{1},A_{2},\ldots,A_{n}$.
If $n=0$, then this is an empty Cartesian product, and is a $1$-element set,
consisting only of the $0$-tuple $\left(  {}\right)  $. If $n=1$, then this is
\textquotedblleft more or less\textquotedblright\ the set $A_{1}$. Formally,
this means that the map%
\begin{align*}
\left(  \text{the set }A_{1}\right)   &  \rightarrow\left(  \text{the
Cartesian product of the single set }A_{1}\right)  ,\\
a_{1}  &  \mapsto\left(  a_{1}\right)
\end{align*}
is a bijection.

The Cartesian is not literally associative: If $A$, $B$ and $C$ are three
sets, then
\[
A\times B\times C\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left(
A\times B\right)  \times C\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ A\times\left(  B\times C\right)
\]
are not the same set. Their elements have the forms%
\[
\left(  a,b,c\right)  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \left(  \left(  a,b\right)  ,c\right)
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left(  a,\left(
b,c\right)  \right)  .
\]
But there are bijections between these sets, so at least they all have the
same size.

More generally, if $A_{1},A_{2},\ldots,A_{n}$ are any $n$ sets, and
$k\in\left\{  0,1,\ldots,n\right\}  $, then the sets%
\[
A_{1}\times A_{2}\times\cdots\times A_{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \left(  A_{1}\times A_{2}\times\cdots\times A_{k}\right)
\times\left(  A_{k+1}\times A_{k+2}\times\cdots\times A_{n}\right)
\]
have the same size.

\begin{theorem}
(The product rule for $n$ sets)

Let $A_{1},A_{2},\ldots,A_{n}$ be any $n$ finite sets. Then, $A_{1}\times
A_{2}\times\cdots\times A_{n}$ is also finite and its size is%
\[
\left\vert A_{1}\times A_{2}\times\cdots\times A_{n}\right\vert =\left\vert
A_{1}\right\vert \cdot\left\vert A_{2}\right\vert \cdot\cdots\cdot\left\vert
A_{n}\right\vert .
\]

\end{theorem}

\begin{proof}
Induction on $n$. The induction base is $\left\vert \left\{  \left(
{}\right)  \right\}  \right\vert =1=\left(  \text{empty product}\right)  $.
The induction step uses the product rule for $2$ sets.
\end{proof}

Intuitively, this is just saying that when choosing an $n$-tuple, we can
choose each of its entries separately, and then the total \# of options is the
product of the \#s of choices at each step.

Now, this theorem has a corollary about counting maps between sets:

\begin{theorem}
(The power rule)

Let $A$ and $B$ be two finite sets. Let $B^{A}=\left\{  \text{maps
}A\rightarrow B\right\}  $. Then,%
\[
\left\vert B^{A}\right\vert =\left\vert B\right\vert ^{\left\vert A\right\vert
}.
\]

\end{theorem}

\begin{proof}
Write $A$ as $A=\left\{  a_{1},a_{2},\ldots,a_{k}\right\}  $ with $k$ distinct
elements $a_{1},a_{2},\ldots,a_{k}$. Then, each map $f:A\rightarrow B$ can be
uniquely written in two-line notation as follows:%
\[
f=\left(
\begin{array}
[c]{cccc}%
a_{1} & a_{2} & \cdots & a_{k}\\
b_{1} & b_{2} & \cdots & b_{k}%
\end{array}
\right)
\]
for some $b_{1},b_{2},\ldots,b_{k}\in B$. Thus, there a bijection%
\begin{align*}
\left\{  \text{maps }A\rightarrow B\right\}   &  \rightarrow
\underbrace{B\times B\times\cdots\times B}_{k\text{ times}},\\
f  &  \mapsto\left(  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right)  .
\end{align*}
Thus, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of maps }A\rightarrow B\right) \\
&  =\left\vert \underbrace{B\times B\times\cdots\times B}_{k\text{ times}%
}\right\vert =\underbrace{\left\vert B\right\vert \cdot\left\vert B\right\vert
\cdot\cdots\cdot\left\vert B\right\vert }_{k\text{ times}}=\left\vert
B\right\vert ^{k}=\left\vert B\right\vert ^{\left\vert A\right\vert }%
\end{align*}
(since $k=\left\vert A\right\vert $). In other words, $\left\vert
B^{A}\right\vert =\left\vert B\right\vert ^{\left\vert A\right\vert }$.
\end{proof}

For example, the \# of maps from $\left[  3\right]  $ to $\left[  5\right]  $
is $5^{3}=125$.

In one of the next chapters, we will count certain kinds of maps (injective,
surjective, ...).

\begin{center}
\fbox{\textbf{Class of 2019-09-11}}
\end{center}

\subsection{Interchanging summation signs}

\begin{theorem}
(Finite Fubini's principle)

Let $X$ and $Y$ be two finite sets. For each pair $\left(  x,y\right)  \in
X\times Y$, let $a_{\left(  x,y\right)  }$ be a number. Then,%
\[
\sum_{x\in X}\sum_{y\in Y}a_{\left(  x,y\right)  }=\sum_{\left(  x,y\right)
\in X\times Y}a_{\left(  x,y\right)  }=\sum_{y\in Y}\sum_{x\in X}a_{\left(
x,y\right)  }.
\]

\end{theorem}

\begin{example}
Let $X=\left[  n\right]  $ and $Y=\left[  m\right]  $ for some $n,m\in
\mathbb{N}$. Then, this becomes%
\[
\sum_{x\in\left[  n\right]  }\sum_{y\in\left[  m\right]  }a_{\left(
x,y\right)  }=\sum_{\left(  x,y\right)  \in\left[  n\right]  \times\left[
m\right]  }a_{\left(  x,y\right)  }=\sum_{y\in\left[  m\right]  }\sum
_{x\in\left[  n\right]  }a_{\left(  x,y\right)  },
\]
i.e.%
\[
\sum_{x=1}^{n}\sum_{y=1}^{m}a_{\left(  x,y\right)  }=\sum_{\left(  x,y\right)
\in\left[  n\right]  \times\left[  m\right]  }a_{\left(  x,y\right)  }%
=\sum_{y=1}^{m}\sum_{x=1}^{n}a_{\left(  x,y\right)  },
\]
i.e.%
\begin{align*}
&  \left(  a_{\left(  1,1\right)  }+a_{\left(  1,2\right)  }+\cdots+a_{\left(
1,m\right)  }\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  a_{\left(  2,1\right)  }+a_{\left(
2,2\right)  }+\cdots+a_{\left(  2,m\right)  }\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  a_{\left(  n,1\right)  }+a_{\left(
n,2\right)  }+\cdots+a_{\left(  n,m\right)  }\right) \\
&  =\left(  \text{the sum of \textbf{all} }a_{\left(  x,y\right)  }\right) \\
&  =\left(  a_{\left(  1,1\right)  }+a_{\left(  2,1\right)  }+\cdots
+a_{\left(  n,1\right)  }\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  a_{\left(  1,2\right)  }+a_{\left(
2,2\right)  }+\cdots+a_{\left(  n,2\right)  }\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  a_{\left(  1,m\right)  }+a_{\left(
2,m\right)  }+\cdots+a_{\left(  n,m\right)  }\right)  .
\end{align*}
In other words, if we have a rectangular table of numbers:%
\[
\left(
\begin{array}
[c]{cccc}%
a_{\left(  1,1\right)  } & a_{\left(  1,2\right)  } & \cdots & a_{\left(
1,m\right)  }\\
a_{\left(  2,1\right)  } & a_{\left(  2,2\right)  } & \cdots & a_{\left(
2,m\right)  }\\
\vdots & \vdots & \ddots & \vdots\\
a_{\left(  n,1\right)  } & a_{\left(  n,2\right)  } & \cdots & a_{\left(
n,m\right)  }%
\end{array}
\right)  ,
\]
then the following three procedures lead to the same result:

\begin{itemize}
\item summing together the $m$ entries of each row, and then summing these
\textquotedblleft row tallies\textquotedblright;

\item summing all $nm$ entries of the table;

\item summing together the $n$ entries of each column, and then summing these
\textquotedblleft column tallies\textquotedblright.
\end{itemize}
\end{example}

Fubini's principle allows us to swap any two summation signs that stand near
each other and don't \textquotedblleft depend\textquotedblright\ upon each other.

\begin{exercise}
Let $S$ be an $n$-element set. Find the sum of the sizes of all subsets of
$S$, that is,%
\[
\sum_{T\subseteq S}\left\vert T\right\vert .
\]

\end{exercise}

We shall prove this using the following simple fact:

\begin{proposition}
(\textquotedblleft Counting by roll call\textquotedblright) Let $S$ be a
finite set. Let $T$ be a subset of $S$. Then,%
\[
\left\vert T\right\vert =\sum_{s\in S}\left[  s\in T\right]  .
\]

\end{proposition}

\begin{proof}
[Proof of Proposition.]%
\begin{align*}
\sum_{s\in S}\left[  s\in T\right]   &  =\sum_{\substack{s\in S;\\s\in
T}}\underbrace{\left[  s\in T\right]  }_{=1}+\sum_{\substack{s\in S;\\s\notin
T}}\underbrace{\left[  s\in T\right]  }_{=0}\\
&  =\sum_{\substack{s\in S;\\s\in T}}1+\underbrace{\sum_{\substack{s\in
S;\\s\notin T}}0}_{=0}=\sum_{\substack{s\in S;\\s\in T}}1=\sum_{s\in S\cap
T}1=\left\vert S\cap T\right\vert =\left\vert T\right\vert ,
\end{align*}
since $T\subseteq S$ yields $S\cap T=T$.
\end{proof}

\begin{proof}
[Solution of the exercise.]Applying the Proposition, we have
\begin{align*}
\sum_{T\subseteq S}\underbrace{\left\vert T\right\vert }_{=\sum_{s\in
S}\left[  s\in T\right]  }  &  =\sum_{T\subseteq S}\sum_{s\in S}\left[  s\in
T\right]  =\sum_{s\in S}\sum_{T\subseteq S}\left[  s\in T\right] \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{we interchanged the summation signs}\\
\text{using Fubini's principle}%
\end{array}
\right)  .
\end{align*}


But for a given $s\in S$, we have%
\begin{align*}
\sum_{T\subseteq S}\left[  s\in T\right]   &  =\sum_{\substack{T\subseteq
S;\\s\in T}}\underbrace{\left[  s\in T\right]  }_{=1}+\sum
_{\substack{T\subseteq S;\\s\notin T}}\underbrace{\left[  s\in T\right]
}_{=0}\\
&  =\sum_{\substack{T\subseteq S;\\s\in T}}1=\sum_{\substack{T\text{ is a
subset of }S\\\text{that contains }s}}1=\left(  \text{\# of subsets }T\text{
of }S\text{ that contain }s\right) \\
&  =\left(  \text{\# of subsets of }S\setminus\left\{  s\right\}  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since there is a bijection}\\
\left\{  \text{subsets }T\text{ of }S\text{ that contain }s\right\}
\rightarrow\left\{  \text{subsets of }S\setminus\left\{  s\right\}  \right\}
\end{array}
\right) \\
&  =2^{n-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }S\setminus\left\{
s\right\}  \text{ is an }\left(  n-1\right)  \text{-element set}\right)  .
\end{align*}
Hence,%
\[
\sum_{T\subseteq S}\left\vert T\right\vert =\sum_{s\in S}\underbrace{\sum
_{T\subseteq S}\left[  s\in T\right]  }_{=2^{n-1}}=\sum_{s\in S}%
2^{n-1}=\underbrace{\left\vert S\right\vert }_{=n}\cdot2^{n-1}=n\cdot2^{n-1}.
\]


(2nd solution:) Each subset of $S$ has size in $\left\{  0,1,\ldots,n\right\}
$. Thus, by the \textquotedblleft splitting out\textquotedblright\ principle
for sums,%
\begin{align*}
\sum_{T\subseteq S}\left\vert T\right\vert  &  =\sum_{k=0}^{n}\sum
_{\substack{T\subseteq S;\\\left\vert T\right\vert =k}}\underbrace{\left\vert
T\right\vert }_{=k}=\sum_{k=0}^{n}\underbrace{\sum_{\substack{T\subseteq
S;\\\left\vert T\right\vert =k}}k}_{=k\cdot\left(  \text{\# of }%
k\text{-element subsets of }S\right)  }\\
&  =\sum_{k=0}^{n}k\cdot\underbrace{\left(  \text{\# of }k\text{-element
subsets of }S\right)  }_{\substack{=\dbinom{n}{k}\\\text{(by the Combinatorial
interpretation of BCs)}}}\\
&  =\sum_{k=0}^{n}k\dbinom{n}{k}.
\end{align*}


By comparing the results of the two solutions, we get the following identity
for free:%
\[
\sum_{k=0}^{n}k\dbinom{n}{k}=n\cdot2^{n-1}.
\]

\end{proof}

Some variants of Fubini's principle are:

\begin{theorem}
(Finite Fubini's principle with a predicate)

Let $X$ and $Y$ be two finite sets. Let $\mathcal{A}\left(  x,y\right)  $ be
some statement for each $\left(  x,y\right)  \in X\times Y$. For each pair
$\left(  x,y\right)  \in X\times Y$ satisfying $\mathcal{A}\left(  x,y\right)
$, let $a_{\left(  x,y\right)  }$ be a number. Then,%
\[
\sum_{x\in X}\sum_{\substack{y\in Y;\\\mathcal{A}\left(  x,y\right)
}}a_{\left(  x,y\right)  }=\sum_{\substack{\left(  x,y\right)  \in X\times
Y;\\\mathcal{A}\left(  x,y\right)  }}a_{\left(  x,y\right)  }=\sum_{y\in
Y}\sum_{\substack{x\in X;\\\mathcal{A}\left(  x,y\right)  }}a_{\left(
x,y\right)  }.
\]

\end{theorem}

For example:%
\[
\sum_{x=1}^{n}\sum_{\substack{y\in\left[  m\right]  ;\\x+y\text{ is even}%
}}a_{\left(  x,y\right)  }=\sum_{\substack{\left(  x,y\right)  \in\left[
n\right]  \times\left[  m\right]  ;\\x+y\text{ is even}}}a_{\left(
x,y\right)  }=\sum_{y=1}^{m}\sum_{\substack{x\in\left[  n\right]  ;\\x+y\text{
is even}}}a_{\left(  x,y\right)  }.
\]


\begin{corollary}
(Triangular Fubini's principle I)

Let $n\in\mathbb{N}$. For each pair $\left(  x,y\right)  \in\left[  n\right]
\times\left[  n\right]  $ with $x+y\leq n$, let $a_{\left(  x,y\right)  }$ be
a number. Then,%
\[
\sum_{x=1}^{n}\sum_{y=1}^{n-x}a_{\left(  x,y\right)  }=\sum_{\substack{\left(
x,y\right)  \in\left[  n\right]  \times\left[  n\right]  ;\\x+y\leq
n}}a_{\left(  x,y\right)  }=\sum_{y=1}^{n}\sum_{x=1}^{n-y}a_{\left(
x,y\right)  }.
\]

\end{corollary}

\begin{corollary}
(Triangular Fubini's principle II)

Let $n\in\mathbb{N}$. For each pair $\left(  x,y\right)  \in\left[  n\right]
\times\left[  n\right]  $ with $x\leq y$, let $a_{\left(  x,y\right)  }$ be a
number. Then,%
\[
\sum_{x=1}^{n}\sum_{y=1}^{x}a_{\left(  x,y\right)  }=\sum_{\substack{\left(
x,y\right)  \in\left[  n\right]  \times\left[  n\right]  ;\\x\leq
y}}a_{\left(  x,y\right)  }=\sum_{y=1}^{n}\sum_{x=y}^{n}a_{\left(  x,y\right)
}.
\]

\end{corollary}

\subsection{Counting permutations -- an introduction}

There are two different things called \textquotedblleft
permutations\textquotedblright\ in mathematics. One is a kind of maps
(\textquotedblleft active permutations\textquotedblright); the other is a kind
of lists (\textquotedblleft passive permutations\textquotedblright). We are
always going to use the word \textquotedblleft permutation\textquotedblright%
\ for the former, at least in the context of \textquotedblleft permutation of
a set\textquotedblright.

\begin{definition}
A \textbf{permutation} of a set $X$ is a bijection from $X$ to $X$.
\end{definition}

For example,%
\[
\left(
\begin{array}
[c]{ccccc}%
0 & 1 & 5 & 7 & 9\\
1 & 7 & 5 & 0 & 9
\end{array}
\right)
\]
is a permutation of $\left\{  0,1,5,7,9\right\}  $.

\begin{theorem}
Let $n\in\mathbb{N}$. Let $X$ be an $n$-element set. Then,%
\[
\left(  \text{\# of permutations of }X\right)  =n!.
\]

\end{theorem}

We shall prove this later.

\begin{definition}
A \textbf{derangement} of a set $X$ means a permutation $\sigma$ of $X$ such
that%
\[
\sigma\left(  x\right)  \neq x\ \ \ \ \ \ \ \ \ \ \text{for all }x\in X.
\]

\end{definition}

For example,%
\[
\left(
\begin{array}
[c]{ccccc}%
0 & 1 & 5 & 7 & 9\\
1 & 7 & 9 & 0 & 5
\end{array}
\right)
\]
is a derangement of $\left\{  0,1,5,7,9\right\}  $.

How many derangements does an $n$-element set have?

A first simplification: Instead of studying an arbitrary $n$-element set, it
suffices to study $\left[  n\right]  $, because:

\begin{lemma}
Let $X$ be any $n$-element set. Then,%
\[
\left(  \text{\# of derangements of }X\right)  =\left(  \text{\# of
derangements of }\left[  n\right]  \right)  .
\]

\end{lemma}

\begin{proof}
The sets $X$ and $\left[  n\right]  $ have the same number of elements.

Thus, there is a bijection $\phi:X\rightarrow\left[  n\right]  $. Fix such a
$\phi$.

Now, any derangement of $X$ can be transformed into a derangement of $\left[
n\right]  $ by \textquotedblleft relabeling\textquotedblright\ the elements of
$X$ as $1,2,\ldots,n$ using $\phi$.

For example, if $X$ is a $3$-element set $\left\{  x,y,z\right\}  $, and
$\phi$ is the bijection $\left(
\begin{array}
[c]{ccc}%
x & y & z\\
1 & 2 & 3
\end{array}
\right)  :X\rightarrow\left[  3\right]  $, then the derangement%
\[
\omega=\left(
\begin{array}
[c]{ccc}%
x & y & z\\
y & z & x
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{of }X
\]
becomes the derangement%
\[
\left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
2 & 3 & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{of }\left[  3\right]  .
\]
Essentially, what we do is: we take the two-line notation of our derangement
of $X$, and replace each element of $X$ by its label in $\left[  n\right]  $.

More formally: We consider the map%
\begin{align*}
\left\{  \text{derangements of }X\right\}   &  \rightarrow\left\{
\text{derangements of }\left[  n\right]  \right\}  ,\\
\omega &  \mapsto\phi\circ\omega\circ\phi^{-1}.
\end{align*}
(Keep in mind: The composition sign is defined so that $\alpha\circ\beta$
means \textquotedblleft apply $\beta$ first, then $\alpha$\textquotedblright.)
This map is a bijection; its inverse is%
\begin{align*}
\left\{  \text{derangements of }\left[  n\right]  \right\}   &  \rightarrow
\left\{  \text{derangements of }X\right\}  ,\\
\alpha &  \mapsto\phi^{-1}\circ\alpha\circ\phi.
\end{align*}
Thus, by the bijection principle,%
\[
\left(  \text{\# of derangements of }X\right)  =\left(  \text{\# of
derangements of }\left[  n\right]  \right)  .
\]

\end{proof}

So it suffices to study derangements of $\left[  n\right]  $.

\begin{definition}
For each $n\in\mathbb{N}$, let
\[
D_{n}=\left(  \text{\# of derangements of }\left[  n\right]  \right)  .
\]

\end{definition}

\begin{definition}
Let $n\in\mathbb{N}$. The \textbf{one-line notation} for a permutation
$\sigma$ of $\left[  n\right]  $ is the $n$-tuple $\left(  \sigma\left(
1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(  n\right)  \right)  $.
\end{definition}

(\textbf{Warning:} This notation looks like the cycle notation in algebra
textbooks, but is not the cycle notation from algebra textbooks.)

\begin{example}
The permutations of $\left[  3\right]  $ are (in one-line notation)%
\[
\left(  1,2,3\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,3,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  2,1,3\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
2,3,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  3,1,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  3,2,1\right)  .
\]
In two-line notation, these are%
\begin{align*}
&  \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
1 & 2 & 3
\end{array}
\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
1 & 3 & 2
\end{array}
\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
2 & 1 & 3
\end{array}
\right)  ,\\
&  \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
2 & 3 & 1
\end{array}
\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
3 & 1 & 2
\end{array}
\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
3 & 2 & 1
\end{array}
\right)  .
\end{align*}
The only derangements among these are%
\[
\left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
2 & 3 & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
3 & 1 & 2
\end{array}
\right)
\]
Thus, $D_{3}=2$.
\end{example}

\begin{example}%
\begin{align*}
D_{0}  &  =1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\operatorname*{id}%
:\varnothing\rightarrow\varnothing\text{ is a derangement}\right)  ;\\
D_{1}  &  =0\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\operatorname*{id}%
:\left[  1\right]  \rightarrow\left[  1\right]  \text{ is \textbf{not} a
derangement}\right)  ;\\
D_{2}  &  =1\ \ \ \ \ \ \ \ \ \ \left(  \text{since the only derangement of
}\left[  2\right]  \text{ is }\left(
\begin{array}
[c]{cc}%
1 & 2\\
2 & 1
\end{array}
\right)  \right)  ;\\
D_{3}  &  =2;\\
D_{4}  &  =9.
\end{align*}

\end{example}

https://oeis.org suggested A000166\qquad\qquad Subfactorial or rencontres
numbers, or derangements: number of permutations of n elements with no fixed points.

\begin{theorem}
\textbf{(a)} We have $D_{n}=\left(  n-1\right)  \left(  D_{n-1}+D_{n-2}%
\right)  $ for all $n\geq2$.

\textbf{(b)} We have $D_{n}=nD_{n-1}+\left(  -1\right)  ^{n}$ for all $n\geq1$.

\textbf{(c)} We have%
\[
n!=\sum_{k=0}^{n}\dbinom{n}{k}D_{n-k}\ \ \ \ \ \ \ \ \ \ \text{for all }%
n\in\mathbb{N}\text{.}%
\]


\textbf{(d)} We have%
\[
D_{n}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dfrac{n!}{k!}%
\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{N}\text{.}%
\]


\textbf{(e)} We have%
\[
D_{n}=\operatorname*{round}\left(  \dfrac{n!}{e}\right)
\ \ \ \ \ \ \ \ \ \ \text{for all }n\geq1,
\]
where $e=\sum_{k=0}^{\infty}\dfrac{1}{k!}\approx2.718\ldots$ and
$\operatorname*{round}\left(  x\right)  =\left\lfloor x+\dfrac{1}%
{2}\right\rfloor $.
\end{theorem}

Some of these formulas will be proven later. (Part \textbf{(b)} follows from
\textbf{(a)} via a HW1 exercise.)

\begin{center}
\fbox{\textbf{Class of 2019-09-16}}
\end{center}

\subsubsection{Short-legged permutations}

\begin{definition}
Let $n\in\mathbb{N}$. A permutation $\sigma$ of $\left[  n\right]  $ is said
to be \textbf{short-legged} if each $i\in\left[  n\right]  $ satisfies
$\left\vert \sigma\left(  i\right)  -i\right\vert \leq1$.
\end{definition}

\textbf{Question:} How many short-legged permutations does $\left[  n\right]
$ have?

\begin{example}
For $n=2$, the short-legged permutations of $\left[  2\right]  $ are (in
one-line notation)%
\[
\left(  1,2\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,1\right)  .
\]


For $n=3$, the short-legged permutations of $\left[  3\right]  $ are (in
one-line notation)%
\[
\left(  1,2,3\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,3,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  2,1,3\right)  .
\]


For $n=4$, the short-legged permutations of $\left[  4\right]  $ are (in
one-line notation)%
\[
\left(  1,2,3,4\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,2,4,3\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,3,2,4\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
2,1,3,4\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,1,4,3\right)  .
\]
(We have used \textquotedblleft backtracking\textquotedblright.)
\end{example}

\begin{proposition}
Let $n\in\mathbb{N}$. Then,%
\[
\left(  \text{\# of short-legged permutations of }\left[  n\right]  \right)
=f_{n+1}.
\]

\end{proposition}

\begin{proof}
[First proof.]Strong induction on $n$; see notes. (Main idea: We can equate
each permutation $\sigma$ of $\left[  n\right]  $ with its one-line notation
$\left(  \sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  n\right)  \right)  $. If $\sigma$ is short-legged, then the
last entry of this one-line notation is $\sigma\left(  n\right)  \in\left\{
n,n-1\right\}  $.)

[Second proof.] Bijection%
\[
\left\{  \text{short-legged permutations of }\left[  n\right]  \right\}
\rightarrow\left\{  \text{domino tilings of }R_{n,2}\right\}
\]
(see blackboard).
\end{proof}

\subsubsection{Long-legged permutations}

\begin{definition}
Let $n\in\mathbb{N}$. A permutation $\sigma$ of $\left[  n\right]  $ is said
to be \textbf{long-legged} if each $i\in\left[  n\right]  $ satisfies
$\left\vert \sigma\left(  i\right)  -i\right\vert >1$.
\end{definition}

\textbf{Question:} How many long-legged permutations does $\left[  n\right]  $ have?

This is Sequence A001883 in the OEIS.

\section{Binomial coefficients}

Let us study binomial coefficients more systematically, and see some
techniques for manipulating sums and products of them without going into combinatorics.

\subsection{The alternating sum of a row of Pascal's triangle}

\begin{proposition}
Let $n\in\mathbb{N}$. Then,%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}=\left[  n=0\right]  .
\]

\end{proposition}

\begin{proof}
[First proof.]Apply the binomial formula to $-1$ and $1$. You get%
\[
\left(  \left(  -1\right)  +1\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}{k}\left(
-1\right)  ^{k}1^{n-k}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}.
\]
Now compare this with $\left(  \left(  -1\right)  +1\right)  ^{n}%
=0^{n}=\left[  n=0\right]  $.
\end{proof}

For the second proof, we will use the \textbf{telescope principle}:

\begin{theorem}
(Telescoping sum principle).

Let $u$ and $v$ be two integers with $u\leq v+1$. Let $a_{u},a_{u+1}%
,\ldots,a_{v}$ be any numbers. Then,%
\[
\sum_{j=u}^{v}\left(  a_{j+1}-a_{j}\right)  =a_{v+1}-a_{u}.
\]

\end{theorem}

\begin{proof}
[Proof of Theorem (outline).]We have%
\begin{align*}
\sum_{j=u}^{v}\left(  a_{j+1}-a_{j}\right)   &  =\left(  a_{u+1}-a_{u}\right)
+\left(  a_{u+2}-a_{u+1}\right)  +\left(  a_{u+3}-a_{u+2}\right)
+\cdots+\left(  a_{v+1}-a_{v}\right) \\
&  =a_{v+1}-a_{u}\ \ \ \ \ \ \ \ \ \ \left(  \text{since all other addends
cancel}\right)  .
\end{align*}
Formally, this can be proven by induction. See also HW0, where this was proved
for $u=0$ (but of course, the general case can be reduced to this by shifting
the index).

[Second proof of Proposition.] WLOG assume $n>0$ (since the $n=0$ case is just
straightforward verification). Now,%
\begin{align*}
&  \sum_{k=0}^{n}\left(  -1\right)  ^{k}\underbrace{\dbinom{n}{k}%
}_{\substack{=\dbinom{n-1}{k-1}+\dbinom{n-1}{k}\\\text{(by the recurrence of
the BCs)}}}\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\left(  \dbinom{n-1}{k-1}%
+\dbinom{n-1}{k}\right) \\
&  =\sum_{k=0}^{n}\left(  \underbrace{\left(  -1\right)  ^{k}}_{=-\left(
-1\right)  ^{k-1}}\dbinom{n-1}{k-1}+\left(  -1\right)  ^{k}\dbinom{n-1}%
{k}\right) \\
&  =\sum_{k=0}^{n}\left(  -\left(  -1\right)  ^{k-1}\dbinom{n-1}{k-1}+\left(
-1\right)  ^{k}\dbinom{n-1}{k}\right) \\
&  =\sum_{k=0}^{n}\left(  \left(  -1\right)  ^{k}\dbinom{n-1}{k}-\left(
-1\right)  ^{k-1}\dbinom{n-1}{k-1}\right) \\
&  =\sum_{j=-1}^{n-1}\left(  \left(  -1\right)  ^{j+1}\dbinom{n-1}%
{j+1}-\left(  -1\right)  ^{j}\dbinom{n-1}{j}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }j+1\text{ for
}k\right) \\
&  =\left(  -1\right)  ^{n}\underbrace{\dbinom{n-1}{n}}%
_{\substack{=0\\\text{(since }n-1\in\mathbb{N}\text{ and }n>n-1\text{)}%
}}-\left(  -1\right)  ^{-1}\underbrace{\dbinom{n-1}{-1}}_{=0}\\
&  =0-0=0.
\end{align*}

\end{proof}

\begin{proof}
[Third proof of Proposition.]WLOG assume $n>0$ (since the $n=0$ case is just
straightforward verification). We thus need to show that
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}=0.
\]
Rewrite $\sum\limits_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}$ as%
\[
\sum_{k\text{ even}}\dbinom{n}{k}-\sum_{k\text{ odd}}\dbinom{n}{k}%
\]
(where both sums range only over $k\in\left\{  0,1,\ldots,n\right\}  $). Thus,
we only need to prove that%
\begin{equation}
\sum_{k\text{ even}}\dbinom{n}{k}=\sum_{k\text{ odd}}\dbinom{n}{k}. \label{1}%
\end{equation}


We can prove this bijectively:

The LHS of (1) is the \# of subsets of $\left[  n\right]  $ of even size (by
the Combinatorial interpretation of BCs).

The RHS of (1) is the \# of subsets of $\left[  n\right]  $ of odd size.

Thus, we need a bijection%
\[
\left\{  \text{subsets of }\left[  n\right]  \text{ of even size}\right\}
\rightarrow\left\{  \text{subsets of }\left[  n\right]  \text{ of odd
size}\right\}  .
\]
One bijection we can use for this is%
\[
A\mapsto%
\begin{cases}
A\cup\left\{  1\right\}  , & \text{if }1\notin A;\\
A\setminus\left\{  1\right\}  , & \text{if }1\in A.
\end{cases}
\]
This map is a bijection (and its inverse is given by the same formula). This
proves (1). Thus, the Proposition is proved.
\end{proof}

\begin{remark}
If $X$ and $Y$ are two sets, then the \textbf{symmetric difference}
$X\bigtriangleup Y$ of $X$ and $Y$ is defined to be the set%
\begin{align*}
X\bigtriangleup Y:  &  =\left\{  \text{all elements that lie in exactly one of
}X\text{ and }Y\right\} \\
&  =\left(  X\setminus Y\right)  \cup\left(  Y\setminus X\right)  =\left(
X\cup Y\right)  \setminus\left(  X\cap Y\right)  .
\end{align*}
This concept has the following properties:%
\begin{align*}
X\bigtriangleup X  &  =\varnothing;\\
X\bigtriangleup\varnothing &  =X;\\
X\bigtriangleup Y  &  =Y\bigtriangleup X;\\
\left(  X\bigtriangleup Y\right)  \bigtriangleup Z  &  =X\bigtriangleup\left(
Y\bigtriangleup Z\right)  ;\\
X\cap\left(  Y\bigtriangleup Z\right)   &  =\left(  X\cap Y\right)
\bigtriangleup\left(  X\cap Z\right)  .
\end{align*}
The bijection we used in the above third proof is thus given by%
\[
A\mapsto A\bigtriangleup\left\{  1\right\}  .
\]

\end{remark}

\subsection{The trinomial revision formula}

\begin{proposition}
(Trinomial revision)

Let $n,a,b\in\mathbb{R}$. Then,%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\]

\end{proposition}

\begin{proof}
Four cases are possible:

\textit{Case 1:} $b\notin\mathbb{N}$.

\textit{Case 2:} $b\in\mathbb{N}$ and $a\notin\mathbb{N}$.

\textit{Case 3:} $b\in\mathbb{N}$ and $a\in\mathbb{N}$ but $a<b$.

\textit{Case 4:} $b\in\mathbb{N}$ and $a\in\mathbb{N}$ and $a\geq b$.

With a bit of busywork, you can check that the formula boils down to $0=0$ in
the first three cases. Thus, we only need to do Case 4. Here, $b$, $a$ and
$a-b$ all belong to $\mathbb{N}$. Hence, $\dbinom{a}{b}=\dfrac{a!}{b!\left(
a-b\right)  !}$. Now,%
\begin{align*}
\dbinom{n}{b}\dbinom{n-b}{a-b}  &  =\dfrac{n\left(  n-1\right)  \left(
n-2\right)  \cdots\left(  n-b+1\right)  }{b!}\cdot\dfrac{\left(  n-b\right)
\left(  n-b-1\right)  \left(  n-b-2\right)  \cdots\left(  n-a+1\right)
}{\left(  a-b\right)  !}\\
&  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-a+1\right)  }{b!\left(  a-b\right)  !}.
\end{align*}
Comparing this with%
\begin{align*}
\dbinom{n}{a}\dbinom{a}{b}  &  =\dfrac{n\left(  n-1\right)  \left(
n-2\right)  \cdots\left(  n-a+1\right)  }{a!}\cdot\dfrac{a!}{b!\left(
a-b\right)  !}\\
&  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-a+1\right)  }{b!\left(  a-b\right)  !},
\end{align*}
we obtain%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\]

\end{proof}

\begin{corollary}
(Absorption)

Let $m\in\mathbb{R}$ and $n\in\mathbb{R}\setminus\left\{  0\right\}  $. We
have%
\[
\dbinom{m}{n}=\dfrac{m}{n}\dbinom{m-1}{n-1}.
\]

\end{corollary}

\begin{proof}
Apply trinomial revision to $m$, $n$ and $1$ instead of $n$, $a$ and $b$. You
get%
\[
\dbinom{m}{n}\dbinom{n}{1}=\dbinom{m}{1}\dbinom{m-1}{n-1}.
\]
But recall $\dbinom{n}{1}=n$ and $\dbinom{m}{1}=m$; so this becomes%
\[
\dbinom{m}{n}n=m\dbinom{m-1}{n-1}.
\]
Now divide both sides by $n$.
\end{proof}

\begin{remark}
The trinomial revision formula%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}%
\]
has a nice bijective proof at least in the case when $n\in\mathbb{N}$. Can you
find it?
\end{remark}

\begin{center}
\fbox{\textbf{Class of 2019-09-18}}
\end{center}

\begin{proof}
[Bijective proof of the trinomial revision formula for $n\in\mathbb{N}$%
.]Assume $n\in\mathbb{N}$.

Fix a set $N$ of $n$ people.

Then, $\dbinom{n}{a}\dbinom{a}{b}$ is the \# of ways to choose a committee of
$a$ people from $N$ and then to choose a subcommittee of $b$ people from this committee.

On the other hand, $\dbinom{n}{b}\dbinom{n-b}{a-b}$ is the \# of ways to
choose the same thing, but in a different way: first choose the subcommittee,
then choose $a-b$ further people to add to it, forming the committee.
\end{proof}

If we want to formalize this argument, we run into trouble: We would want to
apply the product rule, so we want to interpret $\dbinom{n}{a}\dbinom{a}{b}$
as $\left\vert X\times Y\right\vert $ for two sets $X$ and $Y$. We expect
$X=\left\{  a\text{-element subsets of }N\right\}  $ and $Y=\left\{
b\text{-element subsets of an }a\text{-element set}\right\}  $, which does not
work ($Y$ would depend on the choice of an $a$-element set). In other words,
our two choices are dependent: the choice of the subcommittee depends on the
choice of the committee. Our product rule is not made for this.

The easiest way to correctly formalize this argument is by using the sum rule:

\begin{theorem}
Let $S$ and $W$ be finite sets. Let $f:S\rightarrow W$ be a map. Then,%
\[
\left\vert S\right\vert =\sum_{w\in W}\left(  \text{\# of }s\in S\text{ with
}f\left(  s\right)  =w\right)  .
\]

\end{theorem}

\begin{proof}
[Above proof of trinomial revision for $n\in\mathbb{N}$, rewritten
formally.]Fix an $n$-element set $N$.

Let%
\[
S=\left\{  \left(  B,A\right)  \ \mid\ B\subseteq A\subseteq N\text{ and
}\left\vert B\right\vert =b\text{ and }\left\vert A\right\vert =a\right\}  .
\]
We want to compute $\left\vert S\right\vert $ in two ways.

\textit{First way:}%
\begin{align*}
\left\vert S\right\vert  &  =\sum_{\substack{C\subseteq N;\\\left\vert
C\right\vert =a}}\underbrace{\left(  \text{\# of }\left(  B,A\right)  \in
S\text{ with }A=C\right)  }_{=\left(  \text{\# of }b\text{-element subsets of
}C\right)  }\\
&  =\sum_{\substack{C\subseteq N;\\\left\vert C\right\vert =a}%
}\underbrace{\left(  \text{\# of }b\text{-element subsets of }C\right)
}_{\substack{=\dbinom{\left\vert C\right\vert }{b}=\dbinom{a}{b}\\\text{(since
}\left\vert C\right\vert =a\text{)}}}\\
&  =\sum_{\substack{C\subseteq N;\\\left\vert C\right\vert =a}}\dbinom{a}%
{b}=\underbrace{\left(  \text{\# of }C\subseteq N\text{ satisfying }\left\vert
C\right\vert =a\right)  }_{\substack{=\left(  \text{\# of }a\text{-element
subsets of }N\right)  \\=\dbinom{n}{a}}}\cdot\dbinom{a}{b}\\
&  =\dbinom{n}{a}\dbinom{a}{b}.
\end{align*}


\textit{Second way:}%
\begin{align*}
\left\vert S\right\vert  &  =\sum_{\substack{D\subseteq N;\\\left\vert
D\right\vert =b}}\underbrace{\left(  \text{\# of }\left(  B,A\right)  \in
S\text{ with }A=D\right)  }_{\substack{=\left(  \text{\# of }a\text{-element
sets }A\text{ such that }D\subseteq A\subseteq N\right)  \\=\left(  \text{\#
of }\left(  a-b\right)  \text{-element subsets of }N\setminus D\right)
\\\text{(by the bijection principle)}}}\\
&  =\sum_{\substack{D\subseteq N;\\\left\vert D\right\vert =b}%
}\underbrace{\left(  \text{\# of }\left(  a-b\right)  \text{-element subsets
of }N\setminus D\right)  }_{\substack{=\dbinom{\left\vert N\setminus
D\right\vert }{a-b}=\dbinom{n-b}{a-b}\\\text{(since }\left\vert N\setminus
D\right\vert =n-b\text{)}}}\\
&  =\sum_{\substack{D\subseteq N;\\\left\vert D\right\vert =b}}\dbinom
{n-b}{a-b}=\underbrace{\left(  \text{\# of }D\subseteq N\text{ such that
}\left\vert D\right\vert =b\right)  }_{=\dbinom{n}{b}}\cdot\dbinom{n-b}{a-b}\\
&  =\dbinom{n}{b}\dbinom{n-b}{a-b}.
\end{align*}
Comparing these results, we get%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\]

\end{proof}

Three remarks:

\begin{itemize}
\item What we did in our bijective proof is a kind of \textquotedblleft
product principle\textquotedblright\ that is not actually the product
principle we stated. In the product principle we stated, we are counting
things that can be determined by $2$ (or more) \textbf{independent} choices.
Here, we have $2$ choices of which the second depends on the first, but only
the \textbf{number of options} for the second does not depend on the first. So
we had to use the sum principle instead of the product principle.

There \textbf{is} a version of the product principle that allows for such
dependent choices. Informally speaking, it says that if you are doing a
sequence of $k$ choices, such that you have $a_{1}$ options in choice $1$,
then you have $a_{2}$ options in choice $2$ (no matter what you chose in
choice $1$), then you have $a_{3}$ options in choice $3$ (no matter what you
chose in choices $1$ and $2$), and so on, then the total \# of options will be
$a_{1}a_{2}a_{3}\cdots a_{k}$. This is called the \textbf{dependent choice
principle}, and is formalized in [Loehr, \S 1.8] and [Newstead, Strategy 6.2.21].

I will not formalize this principle, because in practice I find it easier to
just apply the sum rule (and induction on $k$ if necessary).

\item We have assumed that $n\in\mathbb{N}$, but we have not assumed that
$a,b\in\mathbb{N}$. How were to able to avoid those latter assumptions? Didn't
we use $\dbinom{a}{b}=\left(  \text{\# of }b\text{-element subsets of an
}a\text{-element set}\right)  $? Didn't this require $a\in\mathbb{N}$ ?

No, because we were doing these arguments only in relation to an already fixed
$a$-element subset of $N$. Of course, given an $a$-element subset of $N$, you
automatically know that $a\in\mathbb{N}$. If $a\notin\mathbb{N}$, then there
is no $a$-element subset of $N$, so we are manipulating an empty sum.

\item What about the case $n\notin\mathbb{N}$ ? Can we salvage our above proof
of
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}%
\]
to also work in this case?

There is a way, but it requires us to change our point of view. See one of the
later sections.
\end{itemize}

\subsection{The hockey-stick formula revisited}

Recall the hockey-stick formula: It says that%
\[
\dbinom{0}{k}+\dbinom{1}{k}+\cdots+\dbinom{n}{k}=\dbinom{n+1}{k+1}%
\]
for all $n,k\in\mathbb{N}$. We proved this algebraically. Let us see three
more proofs:

\begin{proof}
[2nd proof of the hockey-stick formula.]The recurrence of the BCs yields%
\begin{align*}
\dbinom{n+1}{k+1}  &  =\dbinom{n}{k}+\underbrace{\dbinom{n}{k+1}}%
_{=\dbinom{n-1}{k}+\dbinom{n-1}{k+1}}\\
&  =\dbinom{n}{k}+\dbinom{n-1}{k}+\underbrace{\dbinom{n-1}{k+1}}%
_{=\dbinom{n-2}{k}+\dbinom{n-2}{k+1}}\\
&  =\dbinom{n}{k}+\dbinom{n-1}{k}+\dbinom{n-2}{k}+\underbrace{\dbinom
{n-2}{k+1}}_{=\dbinom{n-3}{k}+\dbinom{n-3}{k+1}}\\
&  =\dbinom{n}{k}+\dbinom{n-1}{k}+\dbinom{n-2}{k}+\dbinom{n-3}{k}+\dbinom
{n-3}{k+1}\\
&  =\cdots\cdots\cdots\ \ \ \ \ \ \ \ \ \ \left(  \text{keep doing the same
transformation}\right) \\
&  =\dbinom{n}{k}+\dbinom{n-1}{k}+\dbinom{n-2}{k}+\cdots+\dbinom{0}%
{k}+\underbrace{\dbinom{0}{k+1}}_{\substack{=0\\\text{(since }k+1>0\text{)}%
}}\\
&  =\dbinom{n}{k}+\dbinom{n-1}{k}+\dbinom{n-2}{k}+\cdots+\dbinom{0}{k}\\
&  =\dbinom{0}{k}+\dbinom{1}{k}+\cdots+\dbinom{n}{k}.
\end{align*}
This can be easily formalized as an induction proof.
\end{proof}

\begin{proof}
[3rd proof of the hockey-stick formula.]For each $i\in\mathbb{Z}$, we have%
\[
\dbinom{i}{k}=\dbinom{i+1}{k+1}-\dbinom{i}{k+1}%
,\ \ \ \ \ \ \ \ \ \ \text{since }\dbinom{i+1}{k+1}=\dbinom{i}{k}+\dbinom
{i}{k+1}.
\]
Thus,%
\begin{align*}
\dbinom{0}{k}+\dbinom{1}{k}+\cdots+\dbinom{n}{k}  &  =\sum_{i=0}%
^{n}\underbrace{\dbinom{i}{k}}_{=\dbinom{i+1}{k+1}-\dbinom{i}{k+1}}\\
&  =\sum_{i=0}^{n}\left(  \dbinom{i+1}{k+1}-\dbinom{i}{k+1}\right) \\
&  =\dbinom{n+1}{k+1}-\underbrace{\dbinom{0}{k+1}}_{=0}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the telescoping sum theorem}\right) \\
&  =\dbinom{n+1}{k+1}.
\end{align*}

\end{proof}

\begin{proof}
[4th proof of the hockey-stick formula.]Recall that%
\begin{align*}
&  \dbinom{n+1}{k+1}\\
&  =\left(  \text{\# of }\left(  k+1\right)  \text{-element subsets of
}\left[  n+1\right]  \right) \\
&  =\sum_{j=1}^{n+1}\left(  \text{\# of }\left(  k+1\right)  \text{-element
subsets of }\left[  n+1\right]  \text{ whose largest element is }j\right)  .
\end{align*}


Now, fix $j\in\left[  n+1\right]  $. How many $\left(  k+1\right)  $-element
subsets of $\left[  n+1\right]  $ have the property that their largest element
is $j$ ? The answer is $\dbinom{j-1}{k}$, since the element $j$ has already
been chosen, and the remaining $k$ elements must be chosen from $\left\{
1,2,\ldots,j-1\right\}  =\left[  j-1\right]  $, which has $j-1$ elements.
(Formally, this is saying that the map%
\begin{align*}
&  \left\{  \left(  k+1\right)  \text{-element subsets of }\left[  n+1\right]
\text{ whose largest element is }j\right\} \\
&  \rightarrow\left\{  k\text{-element subsets of }\left[  j-1\right]
\right\}
\end{align*}
that removes $j$ from each set is a bijection.) Thus, the above computation
becomes%
\begin{align*}
&  \dbinom{n+1}{k+1}\\
&  =\sum_{j=1}^{n+1}\underbrace{\left(  \text{\# of }\left(  k+1\right)
\text{-element subsets of }\left[  n+1\right]  \text{ whose largest element is
}j\right)  }_{=\dbinom{j-1}{k}}\\
&  =\sum_{j=1}^{n+1}\dbinom{j-1}{k}=\sum_{i=0}^{n}\dbinom{i}{k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }i\text{ for
}j-1\right) \\
&  =\dbinom{0}{k}+\dbinom{1}{k}+\cdots+\dbinom{n}{k}.
\end{align*}

\end{proof}

\subsection{Counting maps}

\begin{theorem}
Let $m,n\in\mathbb{N}$. Let $A$ be an $m$-element set. Let $B$ be an
$n$-element set. Then,%
\[
\left(  \text{\# of maps from }A\text{ to }B\right)  =n^{m}.
\]

\end{theorem}

\begin{proof}%
\begin{align*}
\left(  \text{\# of maps from }A\text{ to }B\right)   &  =\left\vert \left\{
\text{maps }A\rightarrow B\right\}  \right\vert =\left\vert B^{A}\right\vert
=\left\vert B\right\vert ^{\left\vert A\right\vert }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{as we proved above}\right) \\
&  =n^{m}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert B\right\vert
=n\text{ and }\left\vert A\right\vert =m\right)  .
\end{align*}

\end{proof}

Now, what if we want to count not all maps, but only some maps?

\subsubsection{Injective maps}

Recall the definition of the lower factorial:

\begin{definition}
Let $n\in\mathbb{R}$ and $m\in\mathbb{N}$. Then,%
\[
n^{\underline{m}}=n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-m+1\right)  .
\]

\end{definition}

\begin{theorem}
Let $m,n\in\mathbb{N}$. Let $A$ be an $m$-element set. Let $B$ be an
$n$-element set. Then,%
\[
\left(  \text{\# of injective maps from }A\text{ to }B\right)
=n^{\underline{m}}.
\]

\end{theorem}

\begin{remark}
\textbf{(a)} If $m=0$, then the RHS is $n^{\underline{0}}=\left(  \text{empty
product}\right)  =1$. And indeed, there is exactly one injective map from
$A=\varnothing$ to $B$ (namely, the \textquotedblleft empty
map\textquotedblright, which sends nothing anywhere).

\textbf{(b)} If $m>n$, then the RHS is%
\[
n^{\underline{m}}=n\left(  n-1\right)  \left(  n-2\right)  \cdots
\underbrace{\left(  n-n\right)  }_{=0}\cdots\left(  n-m+1\right)  =0.
\]
And thus, the theorem yields that there are no injective maps from $A$ to $B$
in this case. This is intuitively clear; we are later going to state this as
\textquotedblleft Pigeonhole Principle for Injections\textquotedblright.
\end{remark}

\begin{proof}
[Informal proof of the Theorem.]Let $a_{1},a_{2},\ldots,a_{m}$ 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 values $f\left(
a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(  a_{m}\right)  $.
Moreover, to ensure that this map $f$ is injective, we need to choose these
values to be distinct. We can construct such an injective map $f$ as follows:

\begin{itemize}
\item choose $f\left(  a_{1}\right)  $ (there are $n$ options for this, since
we want $f\left(  a_{1}\right)  \in B$);

\item choose $f\left(  a_{2}\right)  $ to be distinct from $f\left(
a_{1}\right)  $ (there are $n-1$ options for this, since we want $f\left(
a_{2}\right)  \in B\setminus\left\{  f\left(  a_{1}\right)  \right\}  $);

\item choose $f\left(  a_{3}\right)  $ to be distinct from $f\left(
a_{1}\right)  $ and $f\left(  a_{2}\right)  $ (there are $n-2$ options for
this, since we want $f\left(  a_{3}\right)  \in B\setminus\underbrace{\left\{
f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  \right\}  }_{\substack{\text{a
}2\text{-element set}\\\text{(since }f\left(  a_{1}\right)  \text{ and
}f\left(  a_{2}\right)  \text{ are distinct)}}}$);

\item choose $f\left(  a_{4}\right)  $ to be distinct from $f\left(
a_{1}\right)  $, $f\left(  a_{2}\right)  $ and $f\left(  a_{3}\right)  $
(there are $n-3$ options for this, since we want $f\left(  a_{4}\right)  \in
B\setminus\underbrace{\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,f\left(  a_{3}\right)  \right\}  }_{\substack{\text{a }3\text{-element
set}\\\text{(since }f\left(  a_{1}\right)  \text{, }f\left(  a_{2}\right)
\text{ and }f\left(  a_{3}\right)  \text{ are distinct)}}}$);

\item $\ldots$;

\item last step: choose $f\left(  a_{m}\right)  $; there are $n-\left(
m-1\right)  $ options.
\end{itemize}

Thus, by the dependent choice principle, the total \# of options is%
\begin{align*}
&  n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-\left(
m-1\right)  \right) \\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right)
=n^{\underline{m}}.
\end{align*}

\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-09-21}}
\end{center}

How do we make this proof rigorous? By induction on the \# of choices (which
is $m$ in our case).

Notation: We let $\operatorname*{Inj}\left(  A,B\right)  $ denote the set of
all injective maps from $A$ to $B$.

Thus, the theorem we are proving states that $\left\vert \operatorname*{Inj}%
\left(  A,B\right)  \right\vert =n^{\underline{m}}$, where $n=\left\vert
B\right\vert $ and $m=\left\vert A\right\vert $.

\begin{proof}
(Formal proof.) We proceed by induction on $m$.

\textit{Induction base:} $m=0$. Here, $A=\varnothing$. This is trivial (see
Remark \textbf{(a)} above).

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the IH) that the
theorem holds for $m=k$. We must now prove it for $m=k+1$.

Let $A$ be a $\left(  k+1\right)  $-element set, and let $B$ be an $n$-element
set for some $n\in\mathbb{N}$. We must show that $\left\vert
\operatorname*{Inj}\left(  A,B\right)  \right\vert =n^{\underline{k+1}}$.

Fix $a\in A$. (This exists because $\left\vert A\right\vert =k+1>k\geq0$.)

The set $A\setminus\left\{  a\right\}  $ has size $\left\vert A\setminus
\left\{  a\right\}  \right\vert =\left\vert A\right\vert -1=\left(
k+1\right)  -1=k$. Thus, the IH yields%
\[
\left\vert \operatorname*{Inj}\left(  A\setminus\left\{  a\right\}  ,B\right)
\right\vert =n^{\underline{k}}.
\]
The map%
\begin{align*}
R:\operatorname*{Inj}\left(  A,B\right)   &  \rightarrow\operatorname*{Inj}%
\left(  A\setminus\left\{  a\right\}  ,B\right)  ,\\
h  &  \mapsto h\mid_{A\setminus\left\{  a\right\}  }%
\end{align*}
is well-defined (since a restriction of an injective map to a subset is still injective).

\begin{statement}
\textit{Observation 1:} Let $g\in\operatorname*{Inj}\left(  A\setminus\left\{
a\right\}  ,B\right)  $. Then, there are precisely $n-k$ many maps
$h\in\operatorname*{Inj}\left(  A,B\right)  $ such that $R\left(  h\right)
=g$.
\end{statement}

[\textit{Proof of Observation 1:} To construct an $h\in\operatorname*{Inj}%
\left(  A,B\right)  $ such that $R\left(  h\right)  =g$, we only need to
choose a value $h\left(  a\right)  $. This value $h\left(  a\right)  $ must be
distinct from all values of $g$ (in order for $h$ to be injective); there are
precisely $k$ values to avoid (since $g$ is injective and thus takes exactly
$k$ different values). Thus, in total, there are $n-k$ many options for
$h\left(  a\right)  $. This proves Observation 1.

(This argument, too, can be formalized: We have a bijection%
\begin{align*}
\left\{  h\in\operatorname*{Inj}\left(  A,B\right)  \ \mid\ R\left(  h\right)
=g\right\}   &  \rightarrow B\setminus g\left(  A\right)  ,\\
h  &  \mapsto h\left(  a\right)  .
\end{align*}
You can easily check this, as well as that $\left\vert B\setminus g\left(
A\right)  \right\vert =n-k$.)]

Now,
\begin{align*}
\left\vert \operatorname*{Inj}\left(  A,B\right)  \right\vert  &  =\left(
\text{\# of all }h\in\operatorname*{Inj}\left(  A,B\right)  \right) \\
&  =\sum_{g\in\operatorname*{Inj}\left(  A\setminus\left\{  a\right\}
,B\right)  }\underbrace{\left(  \text{\# of all }h\in\operatorname*{Inj}%
\left(  A,B\right)  \text{ such that }R\left(  h\right)  =g\right)
}_{\substack{=n-k\\\text{(by Observation 1)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the sum rule}\right) \\
&  =\sum_{g\in\operatorname*{Inj}\left(  A\setminus\left\{  a\right\}
,B\right)  }\left(  n-k\right)  =\underbrace{\left\vert \operatorname*{Inj}%
\left(  A\setminus\left\{  a\right\}  ,B\right)  \right\vert }%
_{=n^{\underline{k}}}\cdot\left(  n-k\right) \\
&  =n^{\underline{k}}\cdot\left(  n-k\right)  =n\left(  n-1\right)  \left(
n-2\right)  \cdots\left(  n-k+1\right)  \cdot\left(  n-k\right) \\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k\right)
=n^{\underline{k+1}}.
\end{align*}
This completes the induction step.
\end{proof}

\begin{theorem}
(Pigeonhole Principle for Injections)

Let $f:A\rightarrow B$ be an injective map between finite sets. Then:

\textbf{(a)} $\left\vert A\right\vert \leq\left\vert B\right\vert $.

\textbf{(b)} If $\left\vert A\right\vert =\left\vert B\right\vert $, then $f$
is bijective.
\end{theorem}

\begin{proof}
Let $a_{1},a_{2},\ldots,a_{k}$ be the elements of $A$ (listed without
repetitions). Thus, $\left\vert A\right\vert =k$. Now, $f\left(  a_{1}\right)
,f\left(  a_{2}\right)  ,\ldots,f\left(  a_{k}\right)  $ are distinct (since
$f$ is injective). Hence,%
\[
\left\vert \left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right\}  \right\vert =k=\left\vert
A\right\vert .
\]
But $\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(
a_{k}\right)  \right\}  \subseteq B$, so that%
\[
\left\vert \left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right\}  \right\vert \leq\left\vert
B\right\vert .
\]
Hence, $\left\vert A\right\vert \leq\left\vert B\right\vert $. This proves
part \textbf{(a)}.

For part \textbf{(b)}, assume that $\left\vert A\right\vert =\left\vert
B\right\vert $. Then, the above inequality must be an equality, and this
entails $\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right\}  =B$. But this means that $f$ is
surjective. Thus, $f$ is bijective.
\end{proof}

\begin{theorem}
(Pigeonhole Principle for Surjections)

Let $f:A\rightarrow B$ be an surjective map between finite sets. Then:

\textbf{(a)} $\left\vert A\right\vert \geq\left\vert B\right\vert $.

\textbf{(b)} If $\left\vert A\right\vert =\left\vert B\right\vert $, then $f$
is bijective.
\end{theorem}

\begin{proof}
Let $a_{1},a_{2},\ldots,a_{k}$ be the elements of $A$ (listed without
repetitions). Thus, $\left\vert A\right\vert =k$. Now,
\[
\left\vert \left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right\}  \right\vert \leq k=\left\vert
A\right\vert .
\]
But $\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(
a_{k}\right)  \right\}  =B$ (since $f$ is surjective), so that%
\[
\left\vert \left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  \right\}  \right\vert =\left\vert B\right\vert
.
\]
Hence, $\left\vert A\right\vert \geq\left\vert B\right\vert $. This proves
part \textbf{(a)}.

\textbf{(b)} Let $\left\vert A\right\vert =\left\vert B\right\vert $. Then,
the inequalities above must be equalities. Thus, $\left\vert \left\{  f\left(
a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(  a_{k}\right)  \right\}
\right\vert =k$. Thus, $f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{k}\right)  $ are distinct (since otherwise, we could omit
one of them and would get the same set; but this would entail $\left\vert
\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(
a_{k}\right)  \right\}  \right\vert \leq k-1<k$). Hence, $f$ is injective.
Thus, $f$ is bijective.
\end{proof}

(These pigeonhole principles are combinatorial analogues of parts of the
\textquotedblleft Inverse Matrix Theorem\textquotedblright\ from linear
algebra -- that long theorem that gives many different criteria for a matrix
to be invertible.)

\begin{remark}
The parts \textbf{(b)} of both Pigeonhole Principles are false if the sets $A$
and $B$ are not finite. For example:

\begin{itemize}
\item The map $\mathbb{N}\rightarrow\mathbb{N},\ i\mapsto i+1$ is injective,
but not bijective.

\item The map $\mathbb{N}\rightarrow\mathbb{N},\ i\mapsto%
\begin{cases}
0, & \text{if }i=0;\\
i-1, & \text{if }i>0
\end{cases}
$ is surjective, but not bijective.
\end{itemize}
\end{remark}

We can now prove something that we claimed in the previous chapter:

\begin{corollary}
Let $X$ be a finite set. Then:%
\[
\left(  \text{\# of permutations of }X\right)  =\left\vert X\right\vert !.
\]

\end{corollary}

\begin{proof}
The Pigeonhole Principle for Injections shows that every injective map from
$X$ to $X$ is bijective. The converse also holds (by definition). Thus,%
\begin{align*}
&  \left\{  \text{injective maps }X\rightarrow X\right\} \\
&  =\left\{  \text{bijective maps }X\rightarrow X\right\} \\
&  =\left\{  \text{permutations of }X\right\}  .
\end{align*}
Hence,%
\begin{align*}
&  \left(  \text{\# of injective maps }X\rightarrow X\right) \\
&  =\left(  \text{\# of permutations of }X\right)  .
\end{align*}
But the LHS is (by the previous Theorem, applied to $m=\left\vert X\right\vert
$, $n=\left\vert X\right\vert $, $A=X$ and $B=X$) equal to%
\begin{align*}
\left\vert X\right\vert ^{\underline{\left\vert X\right\vert }}  &
=\left\vert X\right\vert \cdot\left(  \left\vert X\right\vert -1\right)
\cdot\left(  \left\vert X\right\vert -2\right)  \cdot\cdots\cdot
\underbrace{\left(  \left\vert X\right\vert -\left\vert X\right\vert
+1\right)  }_{=1}\\
&  =\left\vert X\right\vert \cdot\left(  \left\vert X\right\vert -1\right)
\cdot\left(  \left\vert X\right\vert -2\right)  \cdot\cdots\cdot1=\left\vert
X\right\vert !.
\end{align*}
Thus, the RHS is $\left\vert X\right\vert !$ as well.
\end{proof}

After having counted injective maps, let us count surjective maps.

\begin{definition}
Let $m\in\mathbb{N}$ and $n\in\mathbb{N}$. Then, $\operatorname*{sur}\left(
m,n\right)  $ means the \# of surjective maps from $\left[  m\right]  $ to
$\left[  n\right]  $.
\end{definition}

\begin{proposition}
Let $m,n\in\mathbb{N}$. Let $A$ be an $m$-element set. Let $B$ be an
$n$-element set. Then,%
\[
\left(  \text{\# of surjective maps from }A\text{ to }B\right)
=\operatorname*{sur}\left(  m,n\right)  .
\]

\end{proposition}

\begin{proof}
This is a relabeling argument, just as our proof of that lemma about
derangements: Relabel the $m$ elements of $A$ as $1,2,\ldots,m$, and relabel
the $n$ elements of $B$ as $1,2,\ldots,n$. Details are LTTR.
\end{proof}

\begin{proposition}
\textbf{(a)} $\operatorname*{sur}\left(  m,0\right)  =\left[  m=0\right]  $
for all $m\in\mathbb{N}$.

\textbf{(b)} $\operatorname*{sur}\left(  m,1\right)  =\left[  m\neq0\right]
=1-\left[  m=0\right]  $ for all $m\in\mathbb{N}$.

\textbf{(c)} $\operatorname*{sur}\left(  m,2\right)  =2^{m}-2+\left[
m=0\right]  $ for all $m\in\mathbb{N}$.

\textbf{(d)} $\operatorname*{sur}\left(  0,k\right)  =\left[  k=0\right]  $
for all $k\in\mathbb{N}$.

\textbf{(e)} $\operatorname*{sur}\left(  1,k\right)  =\left[  k=1\right]  $
for all $k\in\mathbb{N}$.

\textbf{(f)} $\operatorname*{sur}\left(  m,n\right)  =0$ if $m<n$.
\end{proposition}

\begin{proof}
\textbf{(a)} If $m\neq0$, then there are no surjections from $\left[
m\right]  $ to $\left[  0\right]  $ (since the arrows have nowhere to point
to). If $m=0$, then there is exactly $1$.

\textbf{(b)} There is always exactly $1$ map from $\left[  m\right]  $ to
$\left[  1\right]  $. It is surjective if and only if $m\neq0$.

\textbf{(c)}, \textbf{(d)} and \textbf{(e)} are LTTR.

\textbf{(f)} Part \textbf{(a)} of the Pigeonhole Principle for Surjections
says that surjections from $\left[  m\right]  $ to $\left[  n\right]  $ can
only exist when $m\geq n$; thus their \# is $0$ when $m<n$.
\end{proof}

Now, let us look for a recursive formula for $\operatorname*{sur}\left(
m,n\right)  $.

\textit{1st approach:} Fix $m\in\mathbb{N}$ and $n>0$.

Given a surjective map $f:\left[  m\right]  \rightarrow\left[  n\right]  $, we
let $J_{f}$ be the set of all $i\in\left[  m\right]  $ such that $f\left(
i\right)  =n$. Clearly, $J_{f}\neq\varnothing$, since $f$ is surjective. Thus,
the sum rule yields%
\begin{align*}
&  \left(  \text{\# of all surjective maps }f:\left[  m\right]  \rightarrow
\left[  n\right]  \right) \\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing
}}\underbrace{\left(  \text{\# of all surjective maps }f:\left[  m\right]
\rightarrow\left[  n\right]  \text{ with }J_{f}=J\right)  }%
_{\substack{=\left(  \text{\# of all surjective maps }\left[  m\right]
\setminus J\rightarrow\left[  n-1\right]  \right)  \\\text{(since there is a
bijection}\\\text{from }\left\{  \text{surjective maps }f:\left[  m\right]
\rightarrow\left[  n\right]  \text{ with }J_{f}=J\right\}  \\\text{to
}\left\{  \text{surjective maps }\left[  m\right]  \setminus J\rightarrow
\left[  n-1\right]  \right\}  \\\text{which sends each }f\text{ to }%
f\mid_{\left[  m\right]  \setminus J}\text{)}}}\\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing
}}\underbrace{\left(  \text{\# of all surjective maps }\left[  m\right]
\setminus J\rightarrow\left[  n-1\right]  \right)  }%
_{\substack{=\operatorname*{sur}\left(  \left\vert \left[  m\right]  \setminus
J\right\vert ,\left\vert \left[  n-1\right]  \right\vert \right)  \\\text{(by
the previous proposition)}}}\\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing
}}\operatorname*{sur}\left(  \underbrace{\left\vert \left[  m\right]
\setminus J\right\vert }_{=m-\left\vert J\right\vert },\underbrace{\left\vert
\left[  n-1\right]  \right\vert }_{=n-1}\right)  =\sum_{\substack{J\subseteq
\left[  m\right]  ;\\J\neq\varnothing}}\operatorname*{sur}\left(  m-\left\vert
J\right\vert ,n-1\right) \\
&  =\sum_{j=1}^{m}\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq
\varnothing;\\\left\vert J\right\vert =j}}\operatorname*{sur}\left(
m-\underbrace{\left\vert J\right\vert }_{=j},n-1\right) \\
&  =\sum_{j=1}^{m}\underbrace{\sum_{\substack{J\subseteq\left[  m\right]
;\\J\neq\varnothing;\\\left\vert J\right\vert =j}}\operatorname*{sur}\left(
m-j,n-1\right)  }_{=\left(  \text{\# of }J\subseteq\left[  m\right]  \text{
such that }J\neq\varnothing\text{ and }\left\vert J\right\vert =j\right)
\cdot\operatorname*{sur}\left(  m-j,n-1\right)  }\\
&  =\sum_{j=1}^{m}\underbrace{\left(  \text{\# of }J\subseteq\left[  m\right]
\text{ such that }J\neq\varnothing\text{ and }\left\vert J\right\vert
=j\right)  }_{\substack{=\left(  \text{\# of }J\subseteq\left[  m\right]
\text{ such that }\left\vert J\right\vert =j\right)  \\=\dbinom{m}{j}}%
}\cdot\operatorname*{sur}\left(  m-j,n-1\right) \\
&  =\sum_{j=1}^{m}\dbinom{m}{j}\cdot\operatorname*{sur}\left(  m-j,n-1\right)
=\sum_{j=0}^{m-1}\underbrace{\dbinom{m}{m-j}}_{\substack{=\dbinom{m}%
{j}\\\text{(by symmetry of BCs)}}}\cdot\operatorname*{sur}\left(
\underbrace{m-\left(  m-j\right)  }_{=j},n-1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }m-j\text{ for
}j\right) \\
&  =\sum_{j=0}^{m-1}\dbinom{m}{j}\operatorname*{sur}\left(  j,n-1\right)  .
\end{align*}


Thus, we have proved the following:

\begin{proposition}
Let $m\in\mathbb{N}$ and $n>0$. Then,%
\[
\operatorname*{sur}\left(  m,n\right)  =\sum_{j=1}^{m}\dbinom{m}{j}%
\cdot\operatorname*{sur}\left(  m-j,n-1\right)  =\sum_{j=0}^{m-1}\dbinom{m}%
{j}\operatorname*{sur}\left(  j,n-1\right)  .
\]

\end{proposition}

Using this proposition and the previous one, it is easy to compute
$\operatorname*{sur}\left(  m,n\right)  $ recursively.

\textit{2nd approach:} Fix $m>0$ and $n>0$. Classify the surjections $\left[
m\right]  \rightarrow\left[  n\right]  $ according to the image of $m$.

A surjection $f:\left[  m\right]  \rightarrow\left[  n\right]  $ is called

\begin{itemize}
\item \textbf{red} if $f\left(  m\right)  =f\left(  i\right)  $ for some $i<m$;

\item \textbf{green} if it is not red (i.e., if $f\left(  m\right)  \neq
f\left(  i\right)  $ for all $i<m$).
\end{itemize}

[\textit{Examples:} If $m=4$ and $n=3$, then%
\[
\left(
\begin{array}
[c]{cccc}%
1 & 2 & 3 & 4\\
2 & 1 & 3 & 2
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{is red,}%
\]
while%
\[
\left(
\begin{array}
[c]{cccc}%
1 & 2 & 3 & 4\\
2 & 1 & 2 & 3
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{is green.}%
\]
]

\begin{center}
\fbox{\textbf{Class of 2019-09-23}}
\end{center}

Thus, if a surjection (\textquotedblleft surjection\textquotedblright\ $=$
\textquotedblleft surjective map\textquotedblright) $f:\left[  m\right]
\rightarrow\left[  n\right]  $ is red, then $f\mid_{\left[  m-1\right]  }$ is
\textquotedblleft still\textquotedblright\ a surjection $\left[  m-1\right]
\rightarrow\left[  n\right]  $. Thus, a red surjection $f:\left[  m\right]
\rightarrow\left[  n\right]  $ can be viewed as a surjection $\left[
m-1\right]  \rightarrow\left[  n\right]  $. Thus, we get the following
algorithm for constructing a red surjection $f:\left[  m\right]
\rightarrow\left[  n\right]  $:

\begin{itemize}
\item first, we choose $f\left(  m\right)  $ (there are $n$ choices);

\item then, we choose $f\left(  1\right)  ,f\left(  2\right)  ,\ldots,f\left(
m-1\right)  $; in other words, we choose the restriction $f\mid_{\left[
m-1\right]  }$ (there are $\operatorname*{sur}\left(  m-1,n\right)  $ choices).
\end{itemize}

Hence,%
\[
\left(  \text{\# of red surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right)  =n\cdot\operatorname*{sur}\left(  m-1,n\right)  .
\]


On the other hand, if a surjection $f:\left[  m\right]  \rightarrow\left[
n\right]  $ is green, then the restriction $f\mid_{\left[  m-1\right]  }$ has
image $\left[  n\right]  \setminus\left\{  f\left(  m\right)  \right\}  $, so
it can be viewed as a surjection $\left[  m-1\right]  \rightarrow\left[
n\right]  \setminus\left\{  f\left(  m\right)  \right\}  $. Hence, we get the
following algorithm for constructing a green surjection $f:\left[  m\right]
\rightarrow\left[  n\right]  $:

\begin{itemize}
\item first, we choose $f\left(  m\right)  $ (there are $n$ choices);

\item then, we choose $f\left(  1\right)  ,f\left(  2\right)  ,\ldots,f\left(
m-1\right)  $; in other words, we choose the restriction $f\mid_{\left[
m-1\right]  }$ (there are $\operatorname*{sur}\left(  m-1,n-1\right)  $
choices, because $f\mid_{\left[  m-1\right]  }$ needs to be a surjection
$\left[  m-1\right]  \rightarrow\left[  n\right]  \setminus\left\{  f\left(
m\right)  \right\}  $).
\end{itemize}

Hence,%
\[
\left(  \text{\# of green surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right)  =n\cdot\operatorname*{sur}\left(  m-1,n-1\right)  .
\]


Hence,%
\begin{align*}
&  \operatorname*{sur}\left(  m,n\right) \\
&  =\left(  \text{\# of surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right) \\
&  =\underbrace{\left(  \text{\# of red surjections }f:\left[  m\right]
\rightarrow\left[  n\right]  \right)  }_{=n\cdot\operatorname*{sur}\left(
m-1,n\right)  }\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{\# of green surjections
}f:\left[  m\right]  \rightarrow\left[  n\right]  \right)  }_{=n\cdot
\operatorname*{sur}\left(  m-1,n-1\right)  }\\
&  =n\cdot\operatorname*{sur}\left(  m-1,n\right)  +n\cdot\operatorname*{sur}%
\left(  m-1,n-1\right) \\
&  =n\cdot\left(  \operatorname*{sur}\left(  m-1,n\right)
+\operatorname*{sur}\left(  m-1,n-1\right)  \right)  .
\end{align*}
Thus, we have proved:

\begin{proposition}
Let $m$ and $n$ be positive integers. Then,%
\[
\operatorname*{sur}\left(  m,n\right)  =n\cdot\left(  \operatorname*{sur}%
\left(  m-1,n\right)  +\operatorname*{sur}\left(  m-1,n-1\right)  \right)  .
\]

\end{proposition}

This is an even better recursion than the previous one; it is almost as simple
as that of Pascal's triangle.

\begin{corollary}
\textbf{(a)} We have $\operatorname*{sur}\left(  n,n\right)  =n!$ for all
$n\in\mathbb{N}$.

\textbf{(b)} $\operatorname*{sur}\left(  m,n\right)  $ is a multiple of $n!$
for all $n\in\mathbb{N}$ and $m\in\mathbb{N}$.
\end{corollary}

\begin{proof}
[First proof.]Both parts are easily shown by induction using the previous proposition.

[Second proof.] \textbf{(a)} The surjections $\left[  n\right]  \rightarrow
\left[  n\right]  $ are bijections (by the Pigeonhole Principle for
Surjections). Thus, they are precisely the permutations of $\left[  n\right]
$. Hence, their number is $n!$.

\textbf{(b)} Rough idea (we are, so far, missing the language for formalizing
it): Each surjection $f:\left[  m\right]  \rightarrow\left[  n\right]  $ gives
a way of \textquotedblleft grouping\textquotedblright\ the elements of
$\left[  m\right]  $ into $n$ nonempty (disjoint) groups (= subsets). For
example, the surjection $\left[  6\right]  \rightarrow\left[  3\right]  $
given in two-line notation as%
\[
\left(
\begin{array}
[c]{cccccc}%
1 & 2 & 3 & 4 & 5 & 6\\
2 & 1 & 2 & 3 & 3 & 2
\end{array}
\right)
\]
yields the groups%
\[
\underbrace{\left\{  2\right\}  }_{\substack{\text{the elements}\\\text{sent
to }1}},\ \ \ \ \ \ \ \ \ \ \underbrace{\left\{  1,3,6\right\}  }%
_{\substack{\text{the elements}\\\text{sent to }2}%
},\ \ \ \ \ \ \ \ \ \ \underbrace{\left\{  4,5\right\}  }_{\substack{\text{the
elements}\\\text{sent to }3}}.
\]
If we disregard which group correspond to which value (so we forget the values
$f\left(  i\right)  $, but only keep track of which $i$ and $j$ satisfy
$f\left(  i\right)  =f\left(  j\right)  $), then the \# of all possible such
groupings is $\operatorname*{sur}\left(  m,n\right)  /n!$. Thus,
$\operatorname*{sur}\left(  m,n\right)  /n!\in\mathbb{N}$.

For the details of this argument, see [18s-hw3s] section \S 0.3 on
\textquotedblleft set partitions\textquotedblright.
\end{proof}

\begin{remark}
The number $\operatorname*{sur}\left(  m,n\right)  /n!$ is often denoted $%
%TCIMACRO{\QDATOPD{\{}{\}}{m}{n}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{m}{n}%
%EndExpansion
$ and is called a \textbf{Stirling number of the 2nd kind}.
\end{remark}

Here is the most explicit formula for $\operatorname*{sur}\left(  m,n\right)
$ known:

\begin{theorem}
Let $m\in\mathbb{N}$ and $n\in\mathbb{N}$. Then,%
\[
\operatorname*{sur}\left(  m,n\right)  =\sum_{i=0}^{n}\left(  -1\right)
^{n-i}\dbinom{n}{i}i^{m}.
\]

\end{theorem}

\begin{proof}
[1st proof.]Use induction \& the first recursion we found for
$\operatorname*{sur}\left(  m,n\right)  $. For details, see [17f-hw2s]
Exercise 4.

[2nd proof.] Use the Principle of Inclusion and Exclusion (see later). For
details, see [18s-hw3s] Exercise 2 \textbf{(b)}.
\end{proof}

Applying this theorem to $n=3$, we find%
\begin{align*}
\operatorname*{sur}\left(  m,3\right)   &  =-\underbrace{0^{m}}_{=\left[
m=0\right]  }+3\cdot\underbrace{1^{m}}_{=1}-3\cdot2^{m}+3^{m}\\
&  =3^{m}-3\cdot2^{m}+3-\left[  m=0\right]  .
\end{align*}


\subsection{$1^{m}+2^{m}+...+n^{m}$}

Next goal: prove our theorem we stated previously about $1^{m}+2^{m}%
+\cdots+n^{m}$. First step:

\begin{theorem}
Let $k\in\mathbb{N}$ and $m\in\mathbb{N}$. Then,%
\[
k^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \dbinom{k}{i}.
\]

\end{theorem}

\begin{proof}
Double counting. How many maps $f:\left[  m\right]  \rightarrow\left[
k\right]  $ are there?

\textit{1st way:} $k^{m}$.

\textit{2nd way:} We construct a map $f:\left[  m\right]  \rightarrow\left[
k\right]  $ by the following method:

\begin{itemize}
\item First, we choose the number $\left\vert f\left(  \left[  m\right]
\right)  \right\vert $ (this is the size of the image of $f$, i.e., the \# of
distinct values of $f$). This is an integer in $\left\{  0,1,\ldots,m\right\}
$. Call this integer $i$.

\item Then, we choose the set $f\left(  \left[  m\right]  \right)  $ (this is
the set of all values of $f$). There are $\dbinom{k}{i}$ many choices for this
(since $f\left(  \left[  m\right]  \right)  $ must be an $i$-element subset of
$\left[  k\right]  $).

\item Finally, we choose $f\left(  1\right)  ,f\left(  2\right)
,\ldots,f\left(  m\right)  $. These $m$ numbers must be chosen from the
(already determined) set $f\left(  \left[  m\right]  \right)  $, and must
cover this set. Thus, there are $\operatorname*{sur}\left(  m,i\right)  $ many
choices here (since we are just choosing a surjection from $\left[  m\right]
$ to the already chosen $i$-element set $f\left(  \left[  m\right]  \right)  $).
\end{itemize}

Thus, the total \# of ways is $\sum\limits_{i=0}^{m}\dbinom{k}{i}%
\operatorname*{sur}\left(  m,i\right)  $.

Since our two answers answer the same question, we obtain%
\[
k^{m}=\sum\limits_{i=0}^{m}\dbinom{k}{i}\operatorname*{sur}\left(  m,i\right)
=\sum\limits_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \dbinom{k}{i}.
\]

\end{proof}

\begin{theorem}
Let $n\in\mathbb{N}$ and $m\in\mathbb{N}$. Then,%
\[
\sum_{k=0}^{n}k^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)
\cdot\dbinom{n+1}{i+1}.
\]

\end{theorem}

\begin{proof}
We have%
\begin{align*}
\sum_{k=0}^{n}\underbrace{k^{m}}_{\substack{=\sum\limits_{i=0}^{k}%
\operatorname*{sur}\left(  m,i\right)  \dbinom{k}{i}\\\text{(by the previous
theorem)}}}  &  =\underbrace{\sum_{k=0}^{n}\sum\limits_{i=0}^{m}%
}_{\substack{=\sum\limits_{i=0}^{m}\sum\limits_{k=0}^{n}\\\text{(by Fubini)}%
}}\operatorname*{sur}\left(  m,i\right)  \dbinom{k}{i}\\
&  =\sum\limits_{i=0}^{m}\sum\limits_{k=0}^{n}\operatorname*{sur}\left(
m,i\right)  \dbinom{k}{i}=\sum\limits_{i=0}^{m}\operatorname*{sur}\left(
m,i\right)  \underbrace{\sum\limits_{k=0}^{n}\dbinom{k}{i}}%
_{\substack{=\dbinom{n+1}{i+1}\\\text{(by the hockey-stick}\\\text{identity)}%
}}\\
&  =\sum\limits_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot
\dbinom{n+1}{i+1}.
\end{align*}

\end{proof}

\begin{proof}
[Proof of Theorem 1.2.10.]Rename $k$ as $m$. Thus, we must prove%
\[
\sum_{i=1}^{n}i^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)
\cdot\dbinom{n+1}{i+1}.
\]
But this is exactly what the previous theorem claims, since%
\[
\sum_{k=0}^{n}k^{m}=\underbrace{0^{m}}_{\substack{=0\\\text{(since
}m>0\text{)}}}+1^{m}+2^{m}+\cdots+n^{m}=1^{m}+2^{m}+\cdots+n^{m}=\sum
_{i=1}^{n}i^{m}.
\]

\end{proof}

\subsection{The Vandermonde convolution}

\begin{center}
\fbox{\textbf{Class of 2019-09-25}}
\end{center}

\begin{theorem}
(The Vandermonde convolution, or the Chu--Vandermonde identity.)

Let $n\in\mathbb{N}$ and $x,y\in\mathbb{R}$. Then,%
\[
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}=\sum_{k}\dbinom
{x}{k}\dbinom{y}{n-k}.
\]

\end{theorem}

\begin{remark}
The \textquotedblleft$\sum\limits_{k}$\textquotedblright\ on the right hand
side here means a sum over all $k\in\mathbb{Z}$. Note that $\dbinom{x}%
{k}\dbinom{y}{n-k}=0$ whenever $k\notin\left\{  0,1,\ldots,n\right\}  $
(indeed, $\dbinom{y}{n-k}=0$ if $k>n$, and $\dbinom{x}{k}=0$ if $k<0$). Thus,
the 2nd equality sign in the Theorem is clear.

In the future, I will use the symbol $\overset{0}{=}$ for \textquotedblleft
equal because of zero addends\textquotedblright. For example,%
\begin{align*}
&  \sum_{k=0}^{n}k\overset{0}{=}\sum_{k=1}^{n}k\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \sum_{k=0}^{m}\dbinom{n}{k}\overset{0}{=}\sum_{k=n}%
^{m}\dbinom{n}{k}\ \ \ \ \ \ \ \ \ \ \text{and}\\
&  \sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}\overset{0}{=}\sum_{k}\dbinom
{x}{k}\dbinom{y}{n-k}.
\end{align*}

\end{remark}

We will give two proofs of the theorem and cite another, but none of the
proofs will be complete yet.

\begin{proof}
(First proof of Vandermonde convolution for $x\in\mathbb{N}$.)

For any $u\in\mathbb{R}$ and $v\in\mathbb{N}$, we have%
\begin{align*}
&  \dbinom{u}{n}\\
&  =\underbrace{\dbinom{u-1}{n-1}}_{=\dbinom{u-2}{n-2}+\dbinom{u-2}{n-1}%
}+\underbrace{\dbinom{u-1}{n}}_{=\dbinom{u-2}{n-1}+\dbinom{u-1}{n}}\\
&  =\underbrace{\dbinom{u-2}{n-2}}_{=\dbinom{u-3}{n-3}+\dbinom{u-3}{n-2}%
}+2\underbrace{\dbinom{u-2}{n-1}}_{=\dbinom{u-3}{n-2}+\dbinom{u-3}{n-1}%
}+\underbrace{\dbinom{u-1}{n}}_{=\dbinom{u-3}{n-1}+\dbinom{u-3}{n}}\\
&  =\dbinom{u-3}{n-3}+3\dbinom{u-3}{n-2}+3\dbinom{u-3}{n-1}+\dbinom{u-3}{n}\\
&  =\dbinom{u-4}{n-4}+4\dbinom{u-4}{n-3}+6\dbinom{u-4}{n-2}+4\dbinom{u-4}%
{n-1}+\dbinom{u-4}{n}\\
&  =\cdots\cdots\ \ \ \ \ \ \ \ \ \ \left(  \text{keep applying the recurrence
like this}\right) \\
&  =\dbinom{u-v}{n-v}+\cdots+\dbinom{v}{k}\dbinom{u-v}{n-k}+\cdots
+\dbinom{u-v}{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{this is what we get after
}v\text{ steps}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{convince yourself that the coefficients follow the same}\\
\text{recursion as Pascal's triangle, and thus are }\dbinom{v}{k}%
\end{array}
\right) \\
&  =\sum_{k=0}^{v}\dbinom{v}{k}\dbinom{u-v}{n-k}.
\end{align*}
Applying this to $u=x+y$ and $v=x$, we get%
\begin{align*}
\dbinom{x+y}{n}  &  =\sum_{k=0}^{x}\dbinom{x}{k}\dbinom{\left(  x+y\right)
-x}{n-k}=\sum_{k=0}^{x}\dbinom{x}{k}\dbinom{y}{n-k}\\
&  \overset{0}{=}\sum_{k\in\mathbb{N}}\dbinom{x}{k}\dbinom{y}{n-k}%
\overset{0}{=}\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\end{align*}
This proves the Vandermonde convolution for $x\in\mathbb{N}$.

(This was informal, but formally it's just an induction on $v$.)
\end{proof}

\begin{proof}
(2nd proof of Vandermonde convolution for $x,y\in\mathbb{N}$.)

Double counting. How many ways are there to choose an $n$-element subset of
$\left\{  1,2,\ldots,x\right\}  \cup\left\{  -1,-2,\ldots,-y\right\}  $ ? Let
us answer this in two ways:

\textit{1st way:} $\dbinom{x+y}{n}$.

\textit{2nd way:} First, decide how many positive elements our subset will
have. Let's say it will have $k$ positive elements (with $k\in\left\{
0,1,\ldots,n\right\}  $). Then, choose these $k$ positive elements (there are
$\dbinom{x}{k}$ choices for them). Then, choose the remaining $n-k$ negative
elements (there are $\dbinom{y}{n-k}$ choices for them). Thus, the answer is
$\sum\limits_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}$.

Now, compare the two answers. This proves the Vandermonde convolution when
$x,y\in\mathbb{N}$.
\end{proof}

\begin{proof}
(3rd proof of the Vandermonde convolution, for all $x,y\in\mathbb{R}$.)
Induction on $n$, using the absorption identity $\dbinom{y}{n}=\dfrac{y}%
{n}\dbinom{y-1}{n-1}$. See [detnotes, first proof of Theorem 3.29].
\end{proof}

Before I explain how the first two proofs above can be extended to the general
case ($x,y\in\mathbb{R}$), let me draw a couple conclusions from the theorem:

\begin{corollary}
Let $x\in\mathbb{R}$ and $y\in\mathbb{N}$. Then,%
\[
\sum_{k=0}^{y}\dbinom{x}{k}\dbinom{y}{k}=\dbinom{x+y}{y}.
\]

\end{corollary}

\begin{proof}
We have%
\[
\sum_{k=0}^{y}\dbinom{x}{k}\underbrace{\dbinom{y}{k}}_{\substack{=\dbinom
{y}{y-k}\\\text{(by symmetry)}}}=\sum_{k=0}^{y}\dbinom{x}{k}\dbinom{y}%
{y-k}=\dbinom{x+y}{y}%
\]
(by Vandermonde convolution, applied to $n=y$).
\end{proof}

\begin{corollary}
Let $n\in\mathbb{N}$. Then,
\[
\sum_{k=0}^{n}\dbinom{n}{k}^{2}=\dbinom{2n}{n}.
\]

\end{corollary}

\begin{proof}
Apply the previous corollary to $x=n$ and $y=n$.
\end{proof}

\begin{remark}
No formula for $\sum\limits_{k=0}^{n}\dbinom{n}{k}^{3}$ is known.

However, there are such formulas for $\sum\limits_{k=0}^{n}\left(  -1\right)
^{k}\dbinom{n}{k}^{i}$ with $i=1,2,3$. We have already seen the formula for
$i=1$, and we will soon see the $i=2$ one. (The formula for $i=3$ is a special
case of Dixon's identity.)
\end{remark}

\subsubsection{The polynomial identity trick}

Next, I claim that just one trick suffices to complete the first two proofs of
the Vandermonde convolution (i.e., to prove the theorem in full generality,
not just for $x,y\in\mathbb{N}$). This is the \textquotedblleft%
\textit{polynomial identity trick}\textquotedblright.

\textbf{A reminder on polynomials:} I will not formally define polynomials
here (I might get to it later, in the chapter on generating functions).
Polynomials are not functions, but you can substitute numbers into them.
Informally, a polynomial (with real coefficients, in $1$ variable $X$) is a
\textquotedblleft formal expression\textquotedblright\ of the form%
\[
\alpha X^{a}+\beta X^{b}+\gamma X^{c}+\cdots+\omega X^{z}%
\ \ \ \ \ \ \ \ \ \ \text{with }\alpha,\beta,\gamma,\ldots,\omega\in
\mathbb{R}\text{ and }a,b,c,\ldots,z\in\mathbb{N}.
\]
These expressions are understood to obey rules:%
\begin{align*}
\varphi X^{n}+\psi X^{n}  &  =\left(  \varphi+\psi\right)  X^{n}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{\textquotedblleft combining like
terms\textquotedblright}\right)  ;\\
&  0X^{a}\text{ can be removed};\\
&  \text{terms can be swapped.}%
\end{align*}
We write $X^{0}$ as $1$ (so $\alpha X^{0}$ is written as $\alpha$), and we
write $X^{1}$ as $X$.

Addition of polynomials is defined by, e.g.,%
\[
\left(  \alpha X^{a}+\beta X^{b}\right)  +\left(  \gamma X^{c}+\delta
X^{d}\right)  =\alpha X^{a}+\beta X^{b}+\gamma X^{c}+\delta X^{d}.
\]
Subtraction is defined by%
\[
\left(  \alpha X^{a}+\beta X^{b}\right)  -\left(  \gamma X^{c}+\delta
X^{d}\right)  =\alpha X^{a}+\beta X^{b}+\left(  -\gamma\right)  X^{c}+\left(
-\delta\right)  X^{d}.
\]
Multiplication is defined by distributivity and $\left(  \alpha X^{a}\right)
\left(  \beta X^{b}\right)  =\left(  \alpha\beta\right)  X^{a+b}$. For
example,%
\begin{align*}
\left(  \alpha X^{a}+\beta X^{b}\right)  \left(  \gamma X^{c}+\delta
X^{d}\right)   &  =\left(  \alpha X^{a}\right)  \left(  \gamma X^{c}\right)
+\left(  \alpha X^{a}\right)  \left(  \delta X^{d}\right)  +\left(  \beta
X^{b}\right)  \left(  \gamma X^{c}\right)  +\left(  \beta X^{b}\right)
\left(  \delta X^{d}\right) \\
&  =\alpha\gamma X^{a+c}+\alpha\delta X^{a+d}+\beta\gamma X^{b+c}+\beta\delta
X^{b+d}.
\end{align*}
The \textbf{degree} of a polynomial is the largest exponent appearing in it
with coefficient $\neq0$. For example, the degree of $2X^{2}+7X^{5}-X$ is $5$.
(We say that the degree of the polynomial $0$ is $-\infty$.)

\textbf{Substituting} a number (or square matrix, or another polynomial) $x$
into a polynomial $P=\alpha X^{a}+\beta X^{b}+\gamma X^{c}+\cdots$ yields
$\alpha x^{a}+\beta x^{b}+\gamma x^{c}+\cdots$. This result is called
$P\left(  x\right)  $.

A number $x$ (say, a rational or real or complex number) is a \textbf{root} of
a polynomial $P$ if and only if $P\left(  x\right)  =0$.

For a formal definition of polynomials, see [detnotes, \S 1.5] or [Loehr,
Chapter 7] (most recommended) or most good algebra textbooks or the generating
functions chapter of this course.

\begin{theorem}
(The \textquotedblleft polynomial identity trick\textquotedblright)

\textbf{(a)} A polynomial (with real coefficients, in $1$ variable $X$) of
degree $\leq n$ (for a given $n\in\mathbb{N}$) has $\leq n$ roots (in
$\mathbb{Q}$, in $\mathbb{R}$, or in $\mathbb{C}$), unless it is the $0$
polynomial (i.e., its coefficients are all $0$).

\textbf{(b)} If a polynomial $P$ has infinitely many roots, then $P$ is the
$0$ polynomial.

\textbf{(c)} Let $P$ and $Q$ be polynomials. If
\[
P\left(  x\right)  =Q\left(  x\right)  \ \ \ \ \ \ \ \ \ \ \text{for all }%
x\in\mathbb{N},
\]
then $P=Q$.
\end{theorem}

\begin{proof}
See [Goodman, \textquotedblleft Algebra: Abstract and
Concrete\textquotedblright, Corollary 1.8.24] for a proof of part \textbf{(a)}.

Part \textbf{(b)} follows from \textbf{(a)}.

Part \textbf{(c)} follows from \textbf{(b)}, applied to $P-Q$ instead of $P$.
Indeed, if $P\left(  x\right)  =Q\left(  x\right)  $ for all $x\in\mathbb{N}$,
then all nonnegative integers are roots of $P-Q$, and thus $P-Q$ has
infinitely many roots, so that part \textbf{(b)} shows that $P-Q$ is the $0$ polynomial.
\end{proof}

How does this help us prove the Vandermonde convolution?

Let us salvage our first proof of the Vandermonde convolution.

Fix $y\in\mathbb{R}$ and $n\in\mathbb{N}$. We have already proven%
\begin{equation}
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k} \label{7}%
\end{equation}
for all $x\in\mathbb{N}$. We want to prove this equality for all
$x\in\mathbb{R}$.

Define two polynomials $P$ and $Q$ by%
\[
P=\dbinom{X+y}{n}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ Q=\sum
_{k=0}^{n}\dbinom{X}{k}\dbinom{y}{n-k}.
\]
These are well-defined polynomials, since%
\[
P=\dbinom{X+y}{n}=\dfrac{\left(  X+y\right)  \left(  X+y-1\right)  \left(
X+y-2\right)  \cdots\left(  X+y-n+1\right)  }{n!}%
\]
and%
\[
Q=\sum_{k=0}^{n}\dbinom{X}{k}\dbinom{y}{n-k}=\sum_{k=0}^{n}\dfrac{X\left(
X-1\right)  \left(  X-2\right)  \cdots\left(  X-k+1\right)  }{k!}\dbinom
{y}{n-k}.
\]
Thus, $P\left(  x\right)  =Q\left(  x\right)  $ for all $x\in\mathbb{N}$
(since we have proved (7) for all $x\in\mathbb{N}$). Therefore, part
\textbf{(c)} of the \textquotedblleft polynomial identity
trick\textquotedblright\ theorem yields $P=Q$. Thus, $P\left(  x\right)
=Q\left(  x\right)  $ for all $x\in\mathbb{R}$. In other words, (7) holds for
all $x\in\mathbb{R}$. This completes the 1st proof of Vandermonde convolution.

We can also salvage our 2nd proof of Vandermonde convolution in a similar way.
We need to apply our idea twice:

\textit{Step 1:} Fix $y\in\mathbb{N}$ and $n\in\mathbb{N}$. Use the same
argument as before to prove that (7) holds for all $x\in\mathbb{R}$.

\textit{Step 2:} Fix $x\in\mathbb{R}$ and $n\in\mathbb{N}$. Use an analogous
argument (using $y$ instead of $x$) to prove that (7) holds for all
$y\in\mathbb{R}$.

See [detnotes, Chapter 3] for details.

\textbf{Remark.} The polynomial identity trick can be applied to several other
identities. For example:

\begin{itemize}
\item The trinomial revision identity says that%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}%
\ \ \ \ \ \ \ \ \ \ \text{for all }n,a,b\in\mathbb{R}.
\]
We gave a combinatorial proof that required $n\in\mathbb{N}$. Now, using the
polynomial identity trick, we can extend this to all $n\in\mathbb{R}$.

\item We had the identity%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}=\left[  n=0\right]
\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{N}.
\]
This cannot be generalized to $n\in\mathbb{Q}$ or $n\in\mathbb{R}$, since $n$
appears as the upper bound of the sum (and thus cannot be replaced by an $X$
in that position).

We can rewrite the above identity as%
\[
\sum_{k\in\mathbb{N}}\left(  -1\right)  ^{k}\dbinom{n}{k}=\left[  n=0\right]
\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{N}.
\]
This cannot be generalized to $n\in\mathbb{Q}$ or $n\in\mathbb{R}$, since the
sum $\sum\limits_{k\in\mathbb{N}}\left(  -1\right)  ^{k}\dbinom{X}{k}$ is an
ill-defined infinite sum (unlike $\sum\limits_{k\in\mathbb{N}}\left(
-1\right)  ^{k}\dbinom{n}{k}$ for each particular $n\in\mathbb{N}$), and also
since $\left[  n=0\right]  $ is not a polynomial in $n$.
\end{itemize}

\begin{center}
\fbox{\textbf{Class of 2019-09-28}}
\end{center}

\begin{itemize}
\item Remember the theorem saying that%
\[
k^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}%
{i}\ \ \ \ \ \ \ \ \ \ \text{for all }k,m\in\mathbb{N}.
\]


Can we generalize this to all $k\in\mathbb{R}$ ? To all $m\in\mathbb{R}$ ?

To the second question: no, since $k^{m}$ is not a polynomial in $m$ (and for
other reasons).

To the first question: yes, because for any fixed $m\in\mathbb{N}$, both sides
are polynomials in $k$. So the theorem can be generalized to all
$k\in\mathbb{R}$, even though our proof (by double counting) no longer works
when $k\notin\mathbb{N}$.

\item Recall the hockey-stick formula: It says that%
\[
\dbinom{0}{k}+\dbinom{1}{k}+\cdots+\dbinom{n}{k}=\dbinom{n+1}{k+1}%
\]
for all $n,k\in\mathbb{N}$. Can this be generalized to $n\in\mathbb{R}$ ? to
$k\in\mathbb{R}$ ?

No to the first question, since $n$ appears as a (tacit) summation bound on
the LHS.

No to the second question, since $\dbinom{\text{constant}}{k}$ is not a
polynomial in $k$.

And in fact, you can easily find counterexamples with $k=-1$.
\end{itemize}

You can play this game with any other identity you find.

\subsubsection{Mutating the Chu--Vandermonde identity}

We shall now see some \textquotedblleft mutated\textquotedblright\ forms of
the Chu--Vandermonde identity. \textquotedblleft Mutated\textquotedblright%
\ means that these forms are obtained from Chu--Vandermonde by transforming
the binomial coefficients using some simpler identities -- in particular, the
upper negation and symmetry identities. Recall these identities:

\begin{itemize}
\item UpNeg (= upper negation):%
\[
\dbinom{-n}{k}=\left(  -1\right)  ^{k}\dbinom{n+k-1}{k}%
\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{R}\text{ and }k\in
\mathbb{Z}\text{.}%
\]


\item Symm (= symmetry):%
\[
\dbinom{n}{k}=\dbinom{n}{n-k}\ \ \ \ \ \ \ \ \ \ \text{for all }n\in
\mathbb{N}\text{ and }k\in\mathbb{R}\text{.}%
\]

\end{itemize}

Now, an example of a \textquotedblleft mutated\textquotedblright%
\ Chu--Vandermonde identity:

\begin{theorem}
(\textquotedblleft upside-down Vandermonde convolution\textquotedblright)

Let $n,x,y\in\mathbb{N}$. Then,%
\[
\dbinom{n+1}{x+y+1}=\sum_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y}.
\]

\end{theorem}

Compare with the original Chu--Vandermonde identity, which says%
\[
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\]
However, there is an additional difference: In the upside-down identity, we
really need $x,y\in\mathbb{N}$. (For example, $n=3$, $x=-1$ and $y=2$ would be
a counterexample.)

\begin{proof}
[First proof of \textquotedblleft upside-down Vandermonde
convolution\textquotedblright.]If $n<x+y$, then both sides are $0$ (indeed,
the LHS is clearly $0$; furthermore, each addend on the RHS is $0$, because if
$k\in\left\{  0,1,\ldots,n\right\}  $ such that $\dbinom{k}{x}\dbinom{n-k}%
{y}\neq0$, then $\dbinom{k}{x}\neq0\Longrightarrow k\geq x$ and $\dbinom
{n-k}{y}\neq0\Longrightarrow n-k\geq y$, and thus $n=\underbrace{k}_{\geq
x}+\underbrace{\left(  n-k\right)  }_{\geq y}\geq x+y$, contradicting $n<x+y$).

So let us WLOG assume that $n\geq x+y$. Thus,%
\begin{align*}
&  \sum_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y}\\
\overset{0}{=}  &  \sum_{k=x}^{n-y}\underbrace{\dbinom{k}{x}}%
_{\substack{\overset{\text{Symm}}{=}\dbinom{k}{k-x}\\\overset{\text{UpNeg}%
}{=}\left(  -1\right)  ^{k-x}\dbinom{-k+\left(  k-x\right)  -1}{k-x}\\=\left(
-1\right)  ^{k-x}\dbinom{-x-1}{k-x}}}\underbrace{\dbinom{n-k}{y}%
}_{\substack{\overset{\text{Symm}}{=}\dbinom{n-k}{n-k-y}%
\\\overset{\text{UpNeg}}{=}\left(  -1\right)  ^{n-k-y}\dbinom{-\left(
n-k\right)  +\left(  n-k-y\right)  -1}{n-k-y}\\=\left(  -1\right)
^{n-k-y}\dbinom{-y-1}{n-k-y}}}\\
=  &  \sum_{k=x}^{n-y}\underbrace{\left(  -1\right)  ^{k-x}\left(  -1\right)
^{n-k-y}}_{=\left(  -1\right)  ^{n-x-y}}\dbinom{-x-1}{k-x}\dbinom{-y-1}%
{n-k-y}\\
=  &  \left(  -1\right)  ^{n-x-y}\sum_{k=x}^{n-y}\dbinom{-x-1}{k-x}%
\dbinom{-y-1}{n-k-y}\\
=  &  \left(  -1\right)  ^{n-x-y}\underbrace{\sum_{k=0}^{n-x-y}\dbinom
{-x-1}{k}\dbinom{-y-1}{n-x-y-k}}_{\overset{\text{Vandermonde}}{=}%
\dbinom{\left(  -x-1\right)  +\left(  -y-1\right)  }{n-x-y}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }k\text{ for
}k-x\text{ in the sum}\right) \\
=  &  \left(  -1\right)  ^{n-x-y}\underbrace{\dbinom{\left(  -x-1\right)
+\left(  -y-1\right)  }{n-x-y}}_{\overset{\text{UpNeg}}{=}\left(  -1\right)
^{n-x-y}\dbinom{-\left(  \left(  -x-1\right)  +\left(  -y-1\right)  \right)
+\left(  n-x-y\right)  -1}{n-x-y}}\\
=  &  \underbrace{\left(  -1\right)  ^{n-x-y}\left(  -1\right)  ^{n-x-y}}%
_{=1}\underbrace{\dbinom{-\left(  \left(  -x-1\right)  +\left(  -y-1\right)
\right)  +\left(  n-x-y\right)  -1}{n-x-y}}_{=\dbinom{n+1}{n-x-y}}\\
=  &  \dbinom{n+1}{n-x-y}\overset{\text{Symm}}{=}\dbinom{n+1}{\left(
n+1\right)  -\left(  n-x-y\right)  }=\dbinom{n+1}{x+y+1}.
\end{align*}

\end{proof}

\begin{proof}
[Second proof of \textquotedblleft upside-down Vandermonde\textquotedblright%
.]Double-count the \# of $\left(  x+y+1\right)  $-element subsets of $\left[
n+1\right]  $.

\textit{1st way:} $\dbinom{n+1}{x+y+1}$.

\textit{2nd way:} Construct such a subset as follows:

\begin{itemize}
\item Choose the $\left(  x+1\right)  $-st smallest element of this subset.
Call it $k+1$. Thus, $k\in\left\{  0,1,\ldots,n\right\}  $.

\item Choose the $x$ smallest elements of this subset. There are $\dbinom
{k}{x}$ options for this (since they need to be chosen from the $k$-element
set $\left\{  1,2,\ldots,k\right\}  $).

\item Choose the $y$ remaining elements of this subset. There are
$\dbinom{n-k}{y}$ options for this (since they need to be chosen from the
$\left(  n-k\right)  $-element set $\left\{  k+2,k+3,\ldots,n+1\right\}  $).
\end{itemize}

Thus, the total \# of subsets is $\sum\limits_{k=0}^{n}\dbinom{k}{x}%
\dbinom{n-k}{y}$.

Comparing the two answers, we get%
\[
\dbinom{n+1}{x+y+1}=\sum\limits_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y}.
\]

\end{proof}

There are other identities that arise from \textquotedblleft
mutating\textquotedblright\ Chu--Vandermonde; see the notes for three examples.

\subsection{Counting subsets again}

Recall the theorem that said that if $S$ is an $n$-element set and
$k\in\mathbb{R}$, then%
\[
\dbinom{n}{k}=\left(  \text{\# of }k\text{-element subsets of }S\right)  .
\]


We have proved this by induction on $n$. Next, we shall show a new proof,
which illustrates a rather common tactic. The underlying idea of this tactic
is summarized by the saying \textquotedblleft to count sheep, first count the
legs and then divide by $4$\textquotedblright. In our situation, the
\textquotedblleft sheep\textquotedblright\ will be the $k$-element subsets of
$S$, whereas the \textquotedblleft legs\textquotedblright\ will be the
\textbf{injective }$k$-tuples of elements of $S$ -- that is, $k$-tuples
consisting of distinct elements of $S$. What makes this definition of
\textquotedblleft legs\textquotedblright\ useful is that

\begin{itemize}
\item the legs are easier to count than the sheep;

\item each sheep has the same \# of legs (although not $4$).
\end{itemize}

This trick for counting is sometimes called \textquotedblleft multijection
principle\textquotedblright\ or \textquotedblleft overcounting and
correcting\textquotedblright, but it requires no new principles.

Here are the details:

\begin{definition}
Let $S$ be a set. Let $k\in\mathbb{N}$.

\textbf{(a)} A $k$-tuple $\left(  s_{1},s_{2},\ldots,s_{k}\right)  \in S^{k}$
is said to be \textbf{injective} if $s_{1},s_{2},\ldots,s_{k}$ are distinct.

\textbf{(b)} Let $S_{\operatorname*{inj}}^{k}$ be the set of all injective
$k$-tuples in $S^{k}$.
\end{definition}

For example, the $3$-tuple $\left(  3,2,5\right)  $ is injective, but the
$3$-tuple $\left(  4,2,4\right)  $ is not.

Let us count the legs:

\begin{proposition}
Let $S$ be a finite set. Let $k\in\mathbb{N}$. Then,
\[
\left\vert S_{\operatorname*{inj}}^{k}\right\vert =\left\vert S\right\vert
^{\underline{k}}\ \ \ \ \ \ \ \ \ \ \left(  \text{falling factorial}\right)
.
\]

\end{proposition}

\begin{proof}
One way to see this is to apply the dependent product rule.

Alternative: There is a bijection%
\begin{align*}
\left\{  \text{injective maps from }\left[  k\right]  \text{ to }S\right\}
&  \rightarrow S_{\operatorname*{inj}}^{k},\\
f  &  \mapsto\left(  f\left(  1\right)  ,f\left(  2\right)  ,\ldots,f\left(
k\right)  \right)  .
\end{align*}
The bijection principle thus yields%
\[
\left\vert S_{\operatorname*{inj}}^{k}\right\vert =\left(  \text{\# of
injective maps from }\left[  k\right]  \text{ to }S\right)  =\left\vert
S\right\vert ^{\underline{k}}%
\]
(by our theorem about counting injective maps).
\end{proof}

[\textbf{Aside:} Injective $k$-tuples need to have \textbf{all} their entries
distinct. What about \textbf{non-stuttering }$k$-tuples, which only need to
have \textbf{adjacent} entries distinct? I.e., we call a $k$-tuple $\left(
s_{1},s_{2},\ldots,s_{k}\right)  $ \textbf{non-stuttering} if $s_{i}\neq
s_{i+1}$ for all $i\in\left[  k-1\right]  $. Then,%
\[
\left(  \text{\# of non-stuttering }k\text{-tuples in }S^{k}\right)
=\left\vert S\right\vert \cdot\left(  \left\vert S\right\vert -1\right)
^{k-1}\ \ \ \ \ \ \ \ \ \ \text{for }k>0.
\]
These non-stuttering $k$-tuples are also known as Smirnov words or Carlitz
words or ...]

\begin{proof}
(2nd proof of the theorem saying that
\[
\dbinom{n}{k}=\left(  \text{\# of }k\text{-element subsets of }S\right)  .
\]
)

WLOG assume $k\in\mathbb{N}$. Also, $\left\vert S\right\vert =n$, so the
previous proposition yields%
\[
\left\vert S_{\operatorname*{inj}}^{k}\right\vert =\left\vert S\right\vert
^{\underline{k}}=n^{\underline{k}}.
\]
But%
\begin{align*}
\left\vert S_{\operatorname*{inj}}^{k}\right\vert  &  =\left(  \text{\# of
injective }k\text{-tuples }\overrightarrow{s}\in S^{k}\right) \\
&  =\sum_{\substack{W\subseteq S;\\\left\vert W\right\vert =k}}\left(
\text{\# of injective }k\text{-tuples }\overrightarrow{s}\in S^{k}\text{ such
that the set of entries of }\overrightarrow{s}\text{ is }W\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the sum rule}\right)  .
\end{align*}


Now:

\begin{statement}
\textit{Observation 1:} Let $W$ be a $k$-element subset of $S$. Then, the
injective $k$-tuples $\overrightarrow{s}\in S^{k}$ such that the set of
entries of $\overrightarrow{s}$ is $W$ are precisely the injective $k$-tuples
in $W^{k}$.
\end{statement}

[\textit{Proof} uses the fact that any $k$-element subset of $W$ must be $W$
itself. For details, see notes.]

Using Observation 1, we can rewrite our above computation as%
\begin{align*}
\left\vert S_{\operatorname*{inj}}^{k}\right\vert  &  =\sum
_{\substack{W\subseteq S;\\\left\vert W\right\vert =k}}\underbrace{\left(
\text{\# of injective }k\text{-tuples in }W^{k}\right)  }%
_{\substack{=\left\vert W_{\operatorname*{inj}}^{k}\right\vert =\left\vert
W\right\vert ^{\underline{k}}\\\text{(by the previous proposition)}}}\\
&  =\sum_{\substack{W\subseteq S;\\\left\vert W\right\vert =k}%
}\underbrace{\left\vert W\right\vert ^{\underline{k}}}%
_{\substack{=k^{\underline{k}}=k\left(  k-1\right)  \left(  k-2\right)
\cdots1\\=k!}}=\sum_{\substack{W\subseteq S;\\\left\vert W\right\vert =k}}k!\\
&  =\left(  \text{\# of }k\text{-element subsets of }S\right)  \cdot k!.
\end{align*}
Comparing this with $\left\vert S_{\operatorname*{inj}}^{k}\right\vert
=n^{\underline{k}}$, we obtain%
\[
n^{\underline{k}}=\left(  \text{\# of }k\text{-element subsets of }S\right)
\cdot k!.
\]
Solving this for $\left(  \text{\# of }k\text{-element subsets of }S\right)
$, we obtain%
\[
\left(  \text{\# of }k\text{-element subsets of }S\right)  =\dfrac
{n^{\underline{k}}}{k!}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-k+1\right)  }{k!}=\dbinom{n}{k}.
\]

\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-09-30}}
\end{center}

\subsection{Another use for polynomials}

Let us see how else polynomials can be applied. Our first illustration will be
yet another proof of the Chu--Vandermonde identity.

\begin{lemma}
Let $p\in\mathbb{N}$. Then,%
\[
\left(  1+X\right)  ^{p}=\sum_{m\in\mathbb{N}}\dbinom{p}{m}X^{m}.
\]

\end{lemma}

\begin{proof}
We proved the binomial formula for real numbers, but the same argument works
for polynomials. Thus,%
\[
\left(  1+X\right)  ^{p}=\left(  X+1\right)  ^{p}=\sum_{m=0}^{p}\dbinom{p}%
{m}X^{m}\underbrace{1^{p-m}}_{=1}=\sum_{m=0}^{p}\dbinom{p}{m}X^{m}%
\overset{0}{=}\sum_{m\in\mathbb{N}}\dbinom{p}{m}X^{m}.
\]

\end{proof}

\begin{proof}
[Another proof of Chu--Vandermonde convolution for $x,y\in\mathbb{N}$.]Rename
$x$ and $y$ as $a$ and $b$. Thus, we have $a,b,n\in\mathbb{N}$ and we must
prove%
\[
\dbinom{a+b}{n}=\sum_{k=0}^{n}\dbinom{a}{k}\dbinom{b}{n-k}.
\]
Consider the polynomial
\[
\left(  1+X\right)  ^{a+b}=\sum_{m\in\mathbb{N}}\dbinom{a+b}{m}X^{m}.
\]
Compare this with%
\begin{align*}
\left(  1+X\right)  ^{a+b}  &  =\underbrace{\left(  1+X\right)  ^{a}%
}_{\substack{=\sum\limits_{m\in\mathbb{N}}\dbinom{a}{m}X^{m}\\=\sum
\limits_{i\in\mathbb{N}}\dbinom{a}{i}X^{i}}}\cdot\underbrace{\left(
1+X\right)  ^{b}}_{\substack{=\sum\limits_{m\in\mathbb{N}}\dbinom{b}{m}%
X^{m}\\=\sum\limits_{j\in\mathbb{N}}\dbinom{b}{j}X^{j}}%
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }u^{a+b}=u^{a}\cdot u^{b}\right) \\
&  =\left(  \sum\limits_{i\in\mathbb{N}}\dbinom{a}{i}X^{i}\right)
\cdot\left(  \sum\limits_{j\in\mathbb{N}}\dbinom{b}{j}X^{j}\right)
=\sum\limits_{i\in\mathbb{N}}\dbinom{a}{i}X^{i}\cdot\sum\limits_{j\in
\mathbb{N}}\dbinom{b}{j}X^{j}\\
&  =\underbrace{\sum\limits_{i\in\mathbb{N}}\sum\limits_{j\in\mathbb{N}}%
}_{=\sum\limits_{\left(  i,j\right)  \in\mathbb{N}\times\mathbb{N}}}\dbinom
{a}{i}X^{i}\cdot\dbinom{b}{j}X^{j}=\sum\limits_{\left(  i,j\right)
\in\mathbb{N}\times\mathbb{N}}\underbrace{\dbinom{a}{i}X^{i}\cdot\dbinom{b}%
{j}X^{j}}_{=\dbinom{a}{i}\dbinom{b}{j}X^{i+j}}\\
&  =\sum\limits_{\left(  i,j\right)  \in\mathbb{N}\times\mathbb{N}}\dbinom
{a}{i}\dbinom{b}{j}X^{i+j}=\sum_{m\in\mathbb{N}}\sum_{\substack{\left(
i,j\right)  \in\mathbb{N}\times\mathbb{N};\\i+j=m}}\dbinom{a}{i}\dbinom{b}%
{j}\underbrace{X^{i+j}}_{=X^{m}}\\
&  =\sum_{m\in\mathbb{N}}\left(  \sum_{\substack{\left(  i,j\right)
\in\mathbb{N}\times\mathbb{N};\\i+j=m}}\dbinom{a}{i}\dbinom{b}{j}\right)
X^{m},
\end{align*}
we obtain%
\[
\sum_{m\in\mathbb{N}}\dbinom{a+b}{m}X^{m}=\sum_{m\in\mathbb{N}}\left(
\sum_{\substack{\left(  i,j\right)  \in\mathbb{N}\times\mathbb{N}%
;\\i+j=m}}\dbinom{a}{i}\dbinom{b}{j}\right)  X^{m}.
\]
Now, this is an equality between two polynomials in $X$. The coefficient of
$X^{n}$ on the LHS is $\dbinom{a+b}{n}$. The coefficient of $X^{n}$ on the RHS
is $\sum\limits_{\substack{\left(  i,j\right)  \in\mathbb{N}\times
\mathbb{N};\\i+j=n}}\dbinom{a}{i}\dbinom{b}{j}$. But since the LHS and the RHS
are equal, the coefficients of $X^{n}$ on them must be equal, too. Thus,%
\[
\dbinom{a+b}{n}=\sum\limits_{\substack{\left(  i,j\right)  \in\mathbb{N}%
\times\mathbb{N};\\i+j=n}}\dbinom{a}{i}\dbinom{b}{j}=\sum_{k=0}^{n}\dbinom
{a}{k}\dbinom{b}{n-k}%
\]
(since each pair $\left(  i,j\right)  \in\mathbb{N}\times\mathbb{N}$
satisfying $i+j=n$ can be written as $\left(  k,n-k\right)  $ for a unique
$k\in\left\{  0,1,\ldots,n\right\}  $, and conversely, each $\left(
k,n-k\right)  $ with $k\in\left\{  0,1,\ldots,n\right\}  $ is a pair $\left(
i,j\right)  \in\mathbb{N}\times\mathbb{N}$ satisfying $i+j=n$). Thus, we have
proved Chu--Vandermonde for $a,b\in\mathbb{N}$.
\end{proof}

\textbf{Note:} If we plug $p=-1$ in the lemma above, we get%
\begin{align*}
\left(  1+X\right)  ^{-1}  &  =\sum_{m\in\mathbb{N}}\underbrace{\dbinom{-1}%
{m}}_{=\left(  -1\right)  ^{m}}X^{m}=\sum_{m\in\mathbb{N}}\left(  -1\right)
^{m}X^{m}\\
&  =1-X+X^{2}-X^{3}+X^{4}-X^{5}\pm\cdots,
\end{align*}
which is not a polynomial anymore. We will later make sense of it as a formal
power series, and then the above equality will actually make sense and be
true. More generally, the lemma holds for any number $p$, integer or not, but
this requires a reasonable definition of what $\left(  1+X\right)  ^{p}$ means
when $p\notin\mathbb{N}$, and also a reasonable definition of infinite sums
with infinitely many nonzero addends.

\begin{remark}
A similar argument can be used to prove the formula%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{n}{m-k}=%
\begin{cases}
\left(  -1\right)  ^{m/2}\dbinom{n}{m/2}, & \text{if }m\text{ is even};\\
0, & \text{if }m\text{ is odd}%
\end{cases}
\]
for all $n,m\in\mathbb{N}$. (To prove this, proceed as above, but comparing
coefficients in the equality $\left(  1-X\right)  ^{n}\cdot\left(  1+X\right)
^{n}=\left(  1-X^{2}\right)  ^{n}$.) You can extend this to all $n\in
\mathbb{R}$ via the polynomial identity trick.

As a particular case, if we set $m=n$, then we get%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{n}{k}^{2}=%
\begin{cases}
\left(  -1\right)  ^{n/2}\dbinom{n}{n/2}, & \text{if }n\text{ is even};\\
0, & \text{if }n\text{ is odd}%
\end{cases}
.
\]

\end{remark}

\subsection{The principle of inclusion and exclusion}

\subsubsection{The principles}

Let us begin with some easy facts about finite sets:

\begin{itemize}
\item If $A_{1}$ and $A_{2}$ are two finite sets, then%
\[
\left\vert A_{1}\cup A_{2}\right\vert =\left\vert A_{1}\right\vert +\left\vert
A_{2}\right\vert -\left\vert A_{1}\cap A_{2}\right\vert .
\]


\item If $A_{1}$, $A_{2}$ and $A_{3}$ are three finite sets, then%
\[
\left\vert A_{1}\cup A_{2}\cup A_{3}\right\vert =\left\vert A_{1}\right\vert
+\left\vert A_{2}\right\vert +\left\vert A_{3}\right\vert -\left\vert
A_{1}\cap A_{2}\right\vert -\left\vert A_{1}\cap A_{3}\right\vert -\left\vert
A_{2}\cap A_{3}\right\vert +\left\vert A_{1}\cap A_{2}\cap A_{3}\right\vert .
\]

\end{itemize}

These are particular cases of a general fact:

\begin{theorem}
(Principle of Inclusion and Exclusion (union form)).

Let $n\in\mathbb{N}$, and let $A_{1},A_{2},\ldots,A_{n}$ be $n$ finite sets.
Then,%
\begin{align*}
\left\vert A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right\vert  &  =\sum_{m=1}%
^{n}\left(  -1\right)  ^{m-1}\sum_{\substack{\left(  i_{1},i_{2},\ldots
,i_{m}\right)  \in\left[  n\right]  ^{m};\\i_{1}<i_{2}<\cdots<i_{m}%
}}\left\vert A_{i_{1}}\cap A_{i_{2}}\cap\cdots\cap A_{i_{m}}\right\vert \\
&  =\left\vert A_{1}\right\vert +\left\vert A_{2}\right\vert +\cdots
+\left\vert A_{n}\right\vert \\
&  \ \ \ \ \ \ \ \ \ \ -\left\vert A_{1}\cap A_{2}\right\vert -\left\vert
A_{1}\cap A_{3}\right\vert -\cdots-\left\vert A_{n-1}\cap A_{n}\right\vert \\
&  \ \ \ \ \ \ \ \ \ \ +\left\vert A_{1}\cap A_{2}\cap A_{3}\right\vert
+\left\vert A_{1}\cap A_{2}\cap A_{4}\right\vert +\cdots+\left\vert
A_{n-2}\cap A_{n-1}\cap A_{n}\right\vert \\
&  \ \ \ \ \ \ \ \ \ \ \pm\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  -1\right)  ^{n-1}\left\vert A_{1}\cap
A_{2}\cap\cdots\cap A_{n}\right\vert .
\end{align*}

\end{theorem}

We are going to restate this in a somewhat more convenient language before we
prove this.

\begin{definition}
Let $I$ be a nonempty set. For each $i\in I$, let $A_{i}$ be a set. Then, we
set%
\[
\bigcap_{i\in I}A_{i}=\left\{  x\ \mid\ x\in A_{i}\text{ for each }i\in
I\right\}  .
\]
This set $\bigcap\limits_{i\in I}A_{i}$ is called the \textbf{intersection} of
all the $A_{i}$.
\end{definition}

Thus, if $I=\left\{  i_{1},i_{2},\ldots,i_{k}\right\}  $, then $\bigcap
\limits_{i\in I}A_{i}=A_{i_{1}}\cap A_{i_{2}}\cap\cdots\cap A_{i_{k}}$.

This notation $\bigcap\limits_{i\in I}A_{i}$ is similar to $\sum\limits_{i\in
I}a_{i}$, but $I$ has to be nonempty and $I$ can be infinite.

Now, we can restate the above Principle as follows:

\begin{theorem}
(Principle of Inclusion and Exclusion (union form)).

Let $n\in\mathbb{N}$, and let $A_{1},A_{2},\ldots,A_{n}$ be $n$ finite sets.
Then,%
\[
\left\vert A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right\vert =\sum
_{\substack{I\subseteq\left[  n\right]  ;\\I\neq\varnothing}}\left(
-1\right)  ^{\left\vert I\right\vert -1}\left\vert \bigcap_{i\in I}%
A_{i}\right\vert .
\]

\end{theorem}

(See the notes for why this is equivalent to the Theorem above.)

Let us state yet another equivalent version of this Principle:

\begin{theorem}
(Principle of Inclusion and Exclusion (complement form)).

Let $U$ be a finite set. Let $n\in\mathbb{N}$, and let $A_{1},A_{2}%
,\ldots,A_{n}$ be $n$ subsets of $U$. Then,%
\[
\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)
^{\left\vert I\right\vert }\left\vert \bigcap_{i\in I}A_{i}\right\vert .
\]
Here, the \textquotedblleft empty intersection\textquotedblright%
\ $\bigcap\limits_{i\in\varnothing}A_{i}$ is understood to mean $U$.
\end{theorem}

For example, for $n=2$, we obtain%
\begin{align*}
&  \left\vert U\setminus\left(  A_{1}\cup A_{2}\right)  \right\vert \\
&  =\sum_{I\subseteq\left[  2\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left\vert \bigcap_{i\in I}A_{i}\right\vert \\
&  =\left(  -1\right)  ^{\left\vert \varnothing\right\vert }\left\vert
\bigcap_{i\in\varnothing}A_{i}\right\vert +\left(  -1\right)  ^{\left\vert
\left\{  1\right\}  \right\vert }\left\vert \bigcap_{i\in\left\{  1\right\}
}A_{i}\right\vert +\left(  -1\right)  ^{\left\vert \left\{  2\right\}
\right\vert }\left\vert \bigcap_{i\in\left\{  2\right\}  }A_{i}\right\vert
+\left(  -1\right)  ^{\left\vert \left\{  1,2\right\}  \right\vert }\left\vert
\bigcap_{i\in\left\{  1,2\right\}  }A_{i}\right\vert \\
&  =\left\vert \underbrace{\bigcap_{i\in\varnothing}A_{i}}_{=U}\right\vert
-\left\vert \underbrace{\bigcap_{i\in\left\{  1\right\}  }A_{i}}_{=A_{1}%
}\right\vert -\left\vert \underbrace{\bigcap_{i\in\left\{  2\right\}  }A_{i}%
}_{=A_{2}}\right\vert +\left\vert \underbrace{\bigcap_{i\in\left\{
1,2\right\}  }A_{i}}_{=A_{1}\cap A_{2}}\right\vert \\
&  =\left\vert U\right\vert -\left\vert A_{1}\right\vert -\left\vert
A_{2}\right\vert +\left\vert A_{1}\cap A_{2}\right\vert .
\end{align*}


Similarly for $n=3$ and higher.

The three theorems we have stated above are called the \textbf{Principle(s) of
Inclusion and Exclusion} or the \textbf{Sylvester sieve formulas}.

We are going to prove them next time and see at least one application. Note
that there are several proofs, including a pretty straightforward one by
induction on $n$.

\subsubsection{The cancellation lemma}

\begin{theorem}
(The cancellation lemma)

Let $S$ be a finite set. Then,%
\[
\sum_{I\subseteq S}\left(  -1\right)  ^{\left\vert I\right\vert }=\left[
S=\varnothing\right]  .
\]

\end{theorem}

\begin{proof}
(1st proof, sketched.) Let $\left\vert S\right\vert =n$. Then, splitting the
sum according to $\left\vert I\right\vert $, we get%
\begin{align*}
\sum_{I\subseteq S}\left(  -1\right)  ^{\left\vert I\right\vert }  &
=\sum_{k=0}^{n}\dbinom{n}{k}\left(  -1\right)  ^{k}=\sum_{k=0}^{n}\left(
-1\right)  ^{k}\dbinom{n}{k}\\
&  =\left[  \underbrace{n}_{=\left\vert S\right\vert }=0\right]
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by one of the properties}\\
\text{of Pascal's triangle}%
\end{array}
\right) \\
&  =\left[  \left\vert S\right\vert =0\right]  =\left[  S=\varnothing\right]
\end{align*}
(because if two logical statements $\mathcal{A}$ and $\mathcal{B}$ are
equivalent, then $\left[  \mathcal{A}\right]  =\left[  \mathcal{B}\right]  $).
\end{proof}

\begin{proof}
(2nd proof, idea.) If $S=\varnothing$, then this is obvious. Thus, WLOG assume
that $S\neq\varnothing$. Then, there exists some $g\in S$. Choose such $g$.

Now,%
\begin{align*}
\sum_{I\subseteq S}\left(  -1\right)  ^{\left\vert I\right\vert }  &
=\sum_{\substack{I\subseteq S;\\g\in I}}\left(  -1\right)  ^{\left\vert
I\right\vert }+\sum_{\substack{I\subseteq S;\\g\notin I}}\left(  -1\right)
^{\left\vert I\right\vert }\\
&  =\sum_{\substack{J\subseteq S;\\g\notin J}}\left(  -1\right)  ^{\left\vert
J\cup\left\{  g\right\}  \right\vert }+\sum_{\substack{I\subseteq S;\\g\notin
I}}\left(  -1\right)  ^{\left\vert I\right\vert }\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have noticed that the map}\\
\left\{  J\subseteq S\ \mid\ g\notin J\right\}  \rightarrow\left\{  I\subseteq
S\ \mid\ g\in I\right\}  ,\\
J\mapsto J\cup\left\{  g\right\}  \text{ is a bijection,}\\
\text{and thus we have substituted }J\cup\left\{  g\right\}  \text{ for
}I\text{ in the first sum}%
\end{array}
\right) \\
&  =\sum_{\substack{I\subseteq S;\\g\notin I}}\left(  -1\right)  ^{\left\vert
I\cup\left\{  g\right\}  \right\vert }+\sum_{\substack{I\subseteq S;\\g\notin
I}}\left(  -1\right)  ^{\left\vert I\right\vert }=\sum_{\substack{I\subseteq
S;\\g\notin I}}\underbrace{\left(  \left(  -1\right)  ^{\left\vert
I\cup\left\{  g\right\}  \right\vert }+\left(  -1\right)  ^{\left\vert
I\right\vert }\right)  }_{=0}=0=\left[  S=\varnothing\right]
\end{align*}
(since $S\neq\varnothing$).
\end{proof}

Example: For $S=\left\{  1,2\right\}  $, the cancellation lemma says that%
\[
\underbrace{\left(  -1\right)  ^{\left\vert \varnothing\right\vert }}%
_{=1}+\underbrace{\left(  -1\right)  ^{\left\vert \left\{  1\right\}
\right\vert }}_{=-1}+\underbrace{\left(  -1\right)  ^{\left\vert \left\{
2\right\}  \right\vert }}_{=-1}+\underbrace{\left(  -1\right)  ^{\left\vert
\left\{  1,2\right\}  \right\vert }}_{=1}=\underbrace{\left[  \left\{
1,2\right\}  =\varnothing\right]  }_{=0}.
\]


\subsubsection{The proofs}

We shall use the following proposition (\textquotedblleft counting by
roll-call\textquotedblright):

\begin{proposition}
Let $U$ be a finite set. Let $T$ be a subset of $U$. Then,%
\[
\left\vert T\right\vert =\sum_{s\in U}\left[  s\in T\right]  .
\]

\end{proposition}

\begin{center}
\fbox{\textbf{Class of 2019-10-30}}
\end{center}

We are now going to prove the last version of the Principle of Inclusion \& Exclusion:

\begin{theorem}
(Principle of Inclusion and Exclusion (complement form)).

Let $U$ be a finite set. Let $n\in\mathbb{N}$, and let $A_{1},A_{2}%
,\ldots,A_{n}$ be $n$ subsets of $U$. Then,%
\[
\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)
^{\left\vert I\right\vert }\left\vert \bigcap_{i\in I}A_{i}\right\vert .
\]
Here, the \textquotedblleft empty intersection\textquotedblright%
\ $\bigcap\limits_{i\in\varnothing}A_{i}$ is understood to mean $U$.
\end{theorem}

\begin{proof}
The idea is to fix a particular $s\in U$ and see how often it is counted on
both sides of the equality. Once we know that it is counted equally often, we
conclude that the two sides are equal.

Here are the details: Fix $s\in U$. Define a subset $S$ of $\left[  n\right]
$ by%
\[
S=\left\{  i\in\left[  n\right]  \ \mid\ s\in A_{i}\right\}  .
\]
Now,%
\begin{align*}
&  \sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left[  s\in\bigcap_{i\in I}A_{i}\right]
}_{\substack{=\left[  s\in A_{i}\text{ for each }i\in I\right]  \\=\left[
i\in S\text{ for each }i\in I\right]  \\=\left[  I\subseteq S\right]  }}\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left[  I\subseteq S\right]  =\sum_{\substack{I\subseteq\left[
n\right]  ;\\I\subseteq S}}\left(  -1\right)  ^{\left\vert I\right\vert
}\underbrace{\left[  I\subseteq S\right]  }_{\substack{=1\\\text{(since
}I\subseteq S\text{)}}}+\sum_{\substack{I\subseteq\left[  n\right]
;\\I\not \subseteq S}}\left(  -1\right)  ^{\left\vert I\right\vert
}\underbrace{\left[  I\subseteq S\right]  }_{\substack{=0\\\text{(since
}I\not \subseteq S\text{)}}}\\
&  =\sum_{\substack{I\subseteq\left[  n\right]  ;\\I\subseteq S}}\left(
-1\right)  ^{\left\vert I\right\vert }+\underbrace{\sum_{\substack{I\subseteq
\left[  n\right]  ;\\I\not \subseteq S}}\left(  -1\right)  ^{\left\vert
I\right\vert }0}_{=0}=\sum_{\substack{I\subseteq\left[  n\right]
;\\I\subseteq S}}\left(  -1\right)  ^{\left\vert I\right\vert }=\sum
_{I\subseteq S}\left(  -1\right)  ^{\left\vert I\right\vert }\\
&  =\left[  S=\varnothing\right]  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the
cancellation lemma}\right) \\
&  =\left[  \text{there exist no }i\in\left[  n\right]  \text{ such that }s\in
A_{i}\right] \\
&  =\left[  s\notin A_{i}\text{ for all }i\in\left[  n\right]  \right] \\
&  =\left[  s\in U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right]  .
\end{align*}
So we have proved this for each $s\in U$. Now,%
\begin{align*}
&  \sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left\vert \bigcap_{i\in I}A_{i}\right\vert
}_{\substack{=\sum\limits_{s\in U}\left[  s\in\bigcap\limits_{i\in I}%
A_{i}\right]  \\\text{(by \textquotedblleft counting by roll
call\textquotedblright)}}}\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\sum\limits_{s\in U}\left[  s\in\bigcap\limits_{i\in I}%
A_{i}\right] \\
&  =\sum_{I\subseteq\left[  n\right]  }\sum\limits_{s\in U}\left(  -1\right)
^{\left\vert I\right\vert }\left[  s\in\bigcap\limits_{i\in I}A_{i}\right] \\
&  =\sum\limits_{s\in U}\underbrace{\sum_{I\subseteq\left[  n\right]  }\left(
-1\right)  ^{\left\vert I\right\vert }\left[  s\in\bigcap\limits_{i\in I}%
A_{i}\right]  }_{\substack{=\left[  s\in U\setminus\left(  A_{1}\cup A_{2}%
\cup\cdots\cup A_{n}\right)  \right]  \\\text{(by our previous computation)}%
}}\\
&  =\sum_{s\in U}\left[  s\in U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup
A_{n}\right)  \right]  =\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup
\cdots\cup A_{n}\right)  \right\vert
\end{align*}
(by \textquotedblleft counting by roll call\textquotedblright). So the
complement form of the Principle of Inclusion and Exclusion is proved.
\end{proof}

Proof of the union form:

\begin{theorem}
(Principle of Inclusion and Exclusion (union form)).

Let $n\in\mathbb{N}$, and let $A_{1},A_{2},\ldots,A_{n}$ be $n$ finite sets.
Then,%
\[
\left\vert A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right\vert =\sum
_{\substack{I\subseteq\left[  n\right]  ;\\I\neq\varnothing}}\left(
-1\right)  ^{\left\vert I\right\vert -1}\left\vert \bigcap_{i\in I}%
A_{i}\right\vert .
\]

\end{theorem}

\begin{proof}
Set $U=A_{1}\cup A_{2}\cup\cdots\cup A_{n}$. Now, $A_{1},A_{2},\ldots,A_{n}$
are subsets of $U$. From $U=A_{1}\cup A_{2}\cup\cdots\cup A_{n}$, we obtain
$\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert =0$. Now, the Principle of Inclusion and Exclusion (in complement
form) yields%
\[
\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)
^{\left\vert I\right\vert }\left\vert \bigcap_{i\in I}A_{i}\right\vert .
\]
Comparing, we obtain%
\begin{align*}
0  &  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left\vert \bigcap_{i\in I}A_{i}\right\vert \\
&  =\underbrace{\left(  -1\right)  ^{\left\vert \varnothing\right\vert }}%
_{=1}\left\vert \underbrace{\bigcap_{i\in\varnothing}A_{i}}_{=U}\right\vert
+\sum_{\substack{I\subseteq\left[  n\right]  ;\\I\neq\varnothing
}}\underbrace{\left(  -1\right)  ^{\left\vert I\right\vert }}_{=-\left(
-1\right)  ^{\left\vert I\right\vert -1}}\left\vert \bigcap_{i\in I}%
A_{i}\right\vert \\
&  =\left\vert U\right\vert -\sum_{\substack{I\subseteq\left[  n\right]
;\\I\neq\varnothing}}\left(  -1\right)  ^{\left\vert I\right\vert
-1}\left\vert \bigcap_{i\in I}A_{i}\right\vert .
\end{align*}
Thus,%
\[
\sum_{\substack{I\subseteq\left[  n\right]  ;\\I\neq\varnothing}}\left(
-1\right)  ^{\left\vert I\right\vert -1}\left\vert \bigcap_{i\in I}%
A_{i}\right\vert =\left\vert U\right\vert =\left\vert A_{1}\cup A_{2}%
\cup\cdots\cup A_{n}\right\vert ,
\]
qed.
\end{proof}

\subsubsection{Application: Surjections}

Let us see how the Principles above are applied.

Let us compute $\operatorname*{sur}\left(  m,n\right)  $ again. Fix
$m,n\in\mathbb{N}$. Recall that $\operatorname*{sur}\left(  m,n\right)  $ is
the \# of surjective maps from $\left[  m\right]  $ to $\left[  n\right]  $.
In order to compute this using the PIE (= Principle of Inclusion and
Exclusion), we need to find a finite set (\textquotedblleft
universe\textquotedblright) $U$ and $n$ subsets $A_{1},A_{2},\ldots,A_{n}$ of
$U$ such that%
\[
U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  =\left\{
\text{surjective maps from }\left[  m\right]  \text{ to }\left[  n\right]
\right\}  .
\]
To achieve this, we set
\begin{align*}
U  &  =\left\{  \text{maps from }\left[  m\right]  \text{ to }\left[
n\right]  \right\}  ;\\
A_{i}  &  =\left\{  \text{maps from }\left[  m\right]  \text{ to }\left[
n\right]  \text{ that don't take }i\text{ as a value}\right\}  .
\end{align*}
Now, for each subset $I$ of $\left[  n\right]  $, we have%
\begin{align*}
\bigcap_{i\in I}A_{i}  &  =\left\{  \text{maps from }\left[  m\right]  \text{
to }\left[  n\right]  \text{ that don't take any }i\in I\text{ as a
value}\right\} \\
&  =\left\{  \text{maps from }\left[  m\right]  \text{ to }\left[  n\right]
\text{ whose image is contained in }\left[  n\right]  \setminus I\right\}
\end{align*}
and thus%
\begin{align*}
\left\vert \bigcap_{i\in I}A_{i}\right\vert  &  =\left\vert \left\{
\text{maps from }\left[  m\right]  \text{ to }\left[  n\right]  \text{ whose
image is contained in }\left[  n\right]  \setminus I\right\}  \right\vert \\
&  =\left\{  \text{maps from }\left[  m\right]  \text{ to }\left[  n\right]
\setminus I\right\}  =\left(  n-\left\vert I\right\vert \right)  ^{m}.
\end{align*}
\ Now, the Principle of Inclusion and Exclusion (complement form) yields%
\begin{align*}
&  \left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left\vert \bigcap_{i\in I}A_{i}\right\vert
}_{=\left(  n-\left\vert I\right\vert \right)  ^{m}}=\sum_{I\subseteq\left[
n\right]  }\left(  -1\right)  ^{\left\vert I\right\vert }\left(  n-\left\vert
I\right\vert \right)  ^{m}\\
&  =\sum_{k=0}^{n}\sum_{\substack{I\subseteq\left[  n\right]  ;\\\left\vert
I\right\vert =k}}\underbrace{\left(  -1\right)  ^{\left\vert I\right\vert
}\left(  n-\left\vert I\right\vert \right)  ^{m}}_{=\left(  -1\right)
^{k}\left(  n-k\right)  ^{m}}=\sum_{k=0}^{n}\underbrace{\sum
_{\substack{I\subseteq\left[  n\right]  ;\\\left\vert I\right\vert =k}}\left(
-1\right)  ^{k}\left(  n-k\right)  ^{m}}_{=\dbinom{n}{k}\cdot\left(
-1\right)  ^{k}\left(  n-k\right)  ^{m}}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\cdot\left(  -1\right)  ^{k}\left(  n-k\right)
^{m}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\left(  n-k\right)
^{m}\\
&  =\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{n-i}i^{m}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we substituted }n-i\text{ for
}k\right) \\
&  =\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{m}.
\end{align*}
Since $\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup
A_{n}\right)  \right\vert =\operatorname*{sur}\left(  m,n\right)  $ (since
$U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  $ is the set of
all surjective maps from $\left[  m\right]  $ to $\left[  n\right]  $).\ Thus,
we get%
\[
\operatorname*{sur}\left(  m,n\right)  =\sum_{i=0}^{n}\left(  -1\right)
^{n-i}\dbinom{n}{i}i^{m}.
\]
This is Theorem 2.4.17 in the notes.

\subsubsection{Application: Derangements}

Let $n\in\mathbb{N}$. Let us count derangements of $\left[  n\right]  $.
Recall that their \# is called $D_{n}$.

Set
\begin{align*}
U  &  =\left\{  \text{permutations of }\left[  n\right]  \right\}  ;\\
A_{i}  &  =\left\{  \text{permutations of }\left[  n\right]  \text{ that send
}i\text{ to }i\right\}  ,
\end{align*}
so that%
\[
U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  =\left\{
\text{derangements of }\left[  n\right]  \right\}  .
\]


Now, for every subset $I$ of $\left[  n\right]  $, we have%
\[
\bigcap_{i\in I}A_{i}=\left\{  \text{permutations of }\left[  n\right]  \text{
that send }i\text{ to }i\text{ for each }i\in I\right\}
\]
and thus%
\begin{align*}
\left\vert \bigcap_{i\in I}A_{i}\right\vert  &  =\left\vert \left\{
\text{permutations of }\left[  n\right]  \text{ that send }i\text{ to }i\text{
for each }i\in I\right\}  \right\vert \\
&  =\left\vert \left\{  \text{permutations of }\left[  n\right]  \setminus
I\right\}  \right\vert \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since a permutation of }\left[  n\right]  \text{ that sends }i\text{ to
}i\text{ for each }i\in I\\
\text{is \textquotedblleft the same as\textquotedblright\ a permutation of
}\left[  n\right]  \setminus I
\end{array}
\right) \\
&  =\left\vert \left[  n\right]  \setminus I\right\vert !=\left(  n-\left\vert
I\right\vert \right)  !.
\end{align*}
So the Principle of Inclusion and Exclusion (in the complement form) yields%
\begin{align*}
&  \left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left\vert \bigcap_{i\in I}A_{i}\right\vert
}_{=\left(  n-\left\vert I\right\vert \right)  !}=\sum_{I\subseteq\left[
n\right]  }\left(  -1\right)  ^{\left\vert I\right\vert }\left(  n-\left\vert
I\right\vert \right)  !\\
&  =.......\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\underbrace{\dbinom{n}{k}}%
_{=\dfrac{n!}{k!\cdot\left(  n-k\right)  !}}\left(  n-k\right)  !=\sum
_{k=0}^{n}\left(  -1\right)  ^{k}\dfrac{n!}{k!}.
\end{align*}
Since $\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup
A_{n}\right)  \right\vert =D_{n}$ (because $U\setminus\left(  A_{1}\cup
A_{2}\cup\cdots\cup A_{n}\right)  $ is the set of all derangements of $\left[
n\right]  $), this becomes%
\[
D_{n}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dfrac{n!}{k!}.
\]
This is Theorem 1.7.9 \textbf{(d)}.

\subsubsection{Application: Euler's totient function}

\textbf{Reminder:} Two integers $a$ and $b$ are \textbf{coprime} (or
\textbf{relatively prime}) if $\gcd\left(  a,b\right)  =1$.

\begin{definition}
The function $\phi:\left\{  1,2,3,\ldots\right\}  \rightarrow\mathbb{N}$
(called \textbf{Euler's totient function} or \textbf{Euler's }$\phi
$\textbf{-function}) is defined by%
\[
\phi\left(  u\right)  =\left(  \text{\# of all }m\in\left[  u\right]  \text{
that are coprime to }u\right)  .
\]

\end{definition}

\begin{theorem}
If $u$ is a positive integer, and if $p_{1},p_{2},\ldots,p_{n}$ are the
distinct primes that divide $u$, then%
\[
\phi\left(  u\right)  =u\prod_{i=1}^{n}\left(  1-\dfrac{1}{p_{i}}\right)  .
\]

\end{theorem}

This can be proved using the PIE. Here,%
\begin{align*}
U  &  =\left[  u\right]  ;\\
A_{i}  &  =\left\{  m\in\left[  u\right]  \ \mid\ p_{i}\text{ divides
}m\right\}  .
\end{align*}
Thus, $U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  =\left\{
m\in\left[  u\right]  \ \mid\ m\text{ is coprime to }u\right\}  $.

More details will appear in the notes.

\begin{center}
\fbox{\textbf{Class of 2019-11-04}}
\end{center}

\subsection{Compositions, weak compositions and multisets}

\subsubsection{Compositions}

How many ways are there to write $5$ as a sum of $3$ positive integers, if the
order matters?
\begin{align*}
5  &  =1+1+3=1+3+1=3+1+1\\
&  =1+2+2=2+1+2=2+2+1.
\end{align*}


\begin{theorem}
Let $\mathbb{P}=\left\{  1,2,3,\ldots\right\}  $. Let $n,k\in\mathbb{N}$.
Then,%
\begin{align*}
&  \left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{k}\right)  \in
\mathbb{P}^{k}\text{ satisfying }x_{1}+x_{2}+\cdots+x_{k}=n\right) \\
&  =\dbinom{n-1}{n-k}\\
&  =%
\begin{cases}
\dbinom{n-1}{k-1}, & \text{if }n>0;\\
\left[  k=0\right]  , & \text{if }n=0
\end{cases}
.
\end{align*}

\end{theorem}

\begin{remark}
Some terminology:

A \textbf{composition} is a tuple (= finite list) of positive integers.

A \textbf{composition into }$k$ \textbf{parts} is a $k$-tuple of positive integers.

A \textbf{composition of }$n$ is a tuple of positive integers whose sum is $n$.

Thus, the Theorem above says%
\begin{align*}
&  \left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right) \\
&  =\dbinom{n-1}{n-k}\\
&  =%
\begin{cases}
\dbinom{n-1}{k-1}, & \text{if }n>0;\\
\left[  k=0\right]  , & \text{if }n=0
\end{cases}
.
\end{align*}

\end{remark}

\begin{proof}
(Proof of the Theorem.)

WLOG assume $n\geq1$ (else, the claim is straightforward: there is only
composition of $0$, namely $\left(  {}\right)  $).

For each composition $\left(  x_{1},x_{2},\ldots,x_{k}\right)  $ of $n$ into
$k$ parts, we set%
\begin{align*}
D\left(  x_{1},x_{2},\ldots,x_{k}\right)   &  =\left\{  x_{1}+x_{2}%
+\cdots+x_{j}\ \mid\ j\in\left[  k-1\right]  \right\} \\
&  =\left\{  x_{1},\ \ x_{1}+x_{2},\ \ x_{1}+x_{2}+x_{3},\ \ \ldots
,\ \ x_{1}+x_{2}+\cdots+x_{k-1}\right\} \\
&  =\left\{  x_{1}<x_{1}+x_{2}<x_{1}+x_{2}+x_{3}<\cdots<x_{1}+x_{2}%
+\cdots+x_{k-1}\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{the inequalities hold since }x_{1}%
,x_{2},\ldots,x_{k}\text{ are positive}\right)  ;
\end{align*}
this is a subset of $\left[  n-1\right]  $ and has $k-1$ elements.

(For example, the composition $\left(  3,5,2\right)  $ of $10$ has $D\left(
3,5,2\right)  =\left\{  3,8\right\}  $.)

The map%
\begin{align*}
\left\{  \text{compositions of }n\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \left(  k-1\right)  \text{-element subsets of }\left[
n-1\right]  \right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{k}\right)   &  \mapsto D\left(  x_{1}%
,x_{2},\ldots,x_{k}\right)
\end{align*}
is a bijection (the inverse map sends any $\left(  k-1\right)  $-element
subset $\left\{  s_{1}<s_{2}<\cdots<s_{k-1}\right\}  $ of $\left[  n-1\right]
$ to
\[
\left(  s_{1}-s_{0},s_{2}-s_{1},s_{3}-s_{2},\ldots,s_{k}-s_{k-1}\right)  ,
\]
where we set $s_{0}=0$ and $s_{k}=n$). See HW0 Exercise 1 \textbf{(b)} for
details. (The difference is that now, $k$ is fixed.)

Thus, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right) \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}\left[  n-1\right]  \right) \\
&  =\dbinom{n-1}{k-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the combinatorial
interpretation of BCs}\right) \\
&  =\dbinom{n-1}{\left(  n-1\right)  -\left(  k-1\right)  }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the symmetry of Pascal's triangle, since
}n-1\geq0\right) \\
&  =\dbinom{n-1}{n-k}.
\end{align*}
This proves the theorem.
\end{proof}

\subsubsection{Binary compositions}

\begin{theorem}
Let $n,k\in\mathbb{N}$. Then,%
\begin{align*}
&  \left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{k}\right)  \in\left\{
0,1\right\}  ^{k}\text{ satisfying }x_{1}+x_{2}+\cdots+x_{k}=n\right) \\
&  =\dbinom{k}{n}.
\end{align*}

\end{theorem}

\begin{proof}
To construct a $k$-tuple $\left(  x_{1},x_{2},\ldots,x_{k}\right)  \in\left\{
0,1\right\}  ^{k}$ satisfying $x_{1}+x_{2}+\cdots+x_{k}=n$, we just need to
choose which $n$ indices $i\in\left[  k\right]  $ will have $x_{i}=1$. There
are $\dbinom{k}{n}$ many options for this, since this boils down to choosing
an $n$-element subset of $\left[  k\right]  $.
\end{proof}

\subsubsection{Weak compositions}

\begin{theorem}
Let $n,k\in\mathbb{N}$. Then,%
\begin{align*}
&  \left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{k}\right)  \in
\mathbb{N}^{k}\text{ satisfying }x_{1}+x_{2}+\cdots+x_{k}=n\right) \\
&  =\dbinom{n+k-1}{n}\\
&  =%
\begin{cases}
\dbinom{n+k-1}{k-1}, & \text{if }k>0;\\
\left[  n=0\right]  , & \text{if }k=0
\end{cases}
.
\end{align*}

\end{theorem}

\begin{remark}
Tuples of nonnegative integers are called \textbf{weak compositions}.
\end{remark}

\begin{example}
For $n=2$ and $k=3$, the $k$-tuples $\left(  x_{1},x_{2},\ldots,x_{k}\right)
\in\mathbb{N}^{k}$ satisfying $x_{1}+x_{2}+\cdots+x_{k}=n$ are%
\begin{align*}
2  &  =0+0+2=0+2+0=2+0+0\\
&  =1+1+0=1+0+1=0+1+1.
\end{align*}
Thus, their \# is $6$. This is exactly what the theorem yields, since
$\dbinom{2+3-1}{2}=\dbinom{4}{2}=6$.
\end{example}

\begin{proof}
(Proof of the theorem.) The map%
\begin{align*}
&  \left\{  \left(  x_{1},x_{2},\ldots,x_{k}\right)  \in\mathbb{N}^{k}\mid
x_{1}+x_{2}+\cdots+x_{k}=n\right\} \\
&  \rightarrow\left\{  \left(  x_{1},x_{2},\ldots,x_{k}\right)  \in
\mathbb{P}^{k}\mid x_{1}+x_{2}+\cdots+x_{k}=n+k\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{k}\right)   &  \mapsto\left(  x_{1}%
+1,x_{2}+1,\ldots,x_{k}+1\right)
\end{align*}
is a bijection. Thus, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{k}\right)  \in
\mathbb{N}^{k}\text{ satisfying }x_{1}+x_{2}+\cdots+x_{k}=n\right) \\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{k}\right)
\in\mathbb{P}^{k}\text{ satisfying }x_{1}+x_{2}+\cdots+x_{k}=n+k\right) \\
&  =\dbinom{n+k-1}{\left(  n+k\right)  -k}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the second-to-last theorem, applied}\\
\text{to }n+k\text{ instead of }n
\end{array}
\right) \\
&  =\dbinom{n+k-1}{n}=%
\begin{cases}
\dbinom{n+k-1}{k-1}, & \text{if }k>0;\\
\left[  n=0\right]  , & \text{if }k=0
\end{cases}
\end{align*}
(by the symmetry of Pascal's triangle and an easy distinction of cases).
\end{proof}

\subsubsection{Multisubsets}

\begin{definition}
Let $S$ be a set.

A \textbf{finite multisubset of }$S$ is a map from $S$ to $\mathbb{N}$.

We regard such a map $f:S\rightarrow\mathbb{N}$ as a \textquotedblleft set
with multiplicities\textquotedblright, in which each $s\in S$ appears
$f\left(  s\right)  $ many times.

For example, \textquotedblleft the multisubset $\left\{
1,4,4,5,7,7,7\right\}  _{\operatorname*{multi}}$ of $\left[  8\right]
$\textquotedblright\ is encoded as the map from $\left[  8\right]  $ to
$\mathbb{N}$ given in two-line notation as%
\[
\left(
\begin{array}
[c]{cccccccc}%
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8\\
1 & 0 & 0 & 2 & 1 & 0 & 3 & 0
\end{array}
\right)  .
\]


The \textbf{size} of a multisubset $f:S\rightarrow\mathbb{N}$ is defined to be
the nonnegative integer $\sum\limits_{s\in S}f\left(  s\right)  $.
\end{definition}

\begin{corollary}
Let $n,k\in\mathbb{N}$. Let $S$ be a $k$-element set. Then,%
\[
\left(  \text{\# of multisubsets of }S\text{ having size }n\right)
=\dbinom{n+k-1}{n}.
\]

\end{corollary}

\begin{example}
The multisubsets of $\left[  3\right]  $ having size $2$ are%
\[
\left\{  1,1\right\}  _{\operatorname*{multi}},\ \ \ \ \ \ \ \ \ \ \left\{
1,2\right\}  _{\operatorname*{multi}},\ \ \ \ \ \ \ \ \ \ \left\{
1,3\right\}  _{\operatorname*{multi}},\ \ \ \ \ \ \ \ \ \ \left\{
2,2\right\}  _{\operatorname*{multi}},\ \ \ \ \ \ \ \ \ \ \left\{
2,3\right\}  _{\operatorname*{multi}},\ \ \ \ \ \ \ \ \ \ \left\{
3,3\right\}  _{\operatorname*{multi}}.
\]
So there are $6$ of them, and this is what the corollary predicts.
\end{example}

\begin{proof}
Let $s_{1},s_{2},\ldots,s_{k}$ be the $k$ elements of $S$. Then, the map%
\begin{align*}
\left\{  \text{multisubsets of }S\text{ having size }n\right\}   &
\rightarrow\left\{  \left(  x_{1},x_{2},\ldots,x_{k}\right)  \in\mathbb{N}%
^{k}\mid x_{1}+x_{2}+\cdots+x_{k}=n\right\}  ,\\
f  &  \mapsto\left(  f\left(  s_{1}\right)  ,f\left(  s_{2}\right)
,\ldots,f\left(  s_{k}\right)  \right)
\end{align*}
is a bijection. Now, use the bijection principle and the previous theorem.
\end{proof}

\begin{exercise}
Let $m\in\mathbb{N}$ and $a,b\in\left\{  0,1,\ldots,m\right\}  $. Prove that%
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  2m\right]  \text{ with
exactly }a\text{ even and }b\text{ odd elements}\right) \\
&  =\dbinom{m-a}{b}\cdot\dbinom{m-b}{a}.
\end{align*}

\end{exercise}

\begin{proof}
(Solution sketch.) The dependent product principle does not apply here: If we
(say) first choose the $b$ odd elements, then the \# of ways to choose the
remaining $a$ even elements depends on our chosen $b$ odd elements. In
[18s-hw2s], I show two solutions. Here is a simpler one:

Let $S$ be a lacunar subset of $\left[  2m\right]  $ with exactly $a$ even and
$b$ odd elements. Write $S$ as $S=\left\{  s_{1}<s_{2}<\cdots<s_{a+b}\right\}
$. Then, since $S$ is lacunar, we have
\[
s_{1}-0<s_{2}-1<s_{3}-2<\cdots<s_{a+b}-\left(  a+b-1\right)  ,
\]
thus%
\[
s_{1}-0\leq s_{2}-2\leq s_{4}-4\leq\cdots\leq s_{a+b}-2\left(  a+b-1\right)
.
\]
Consider the multisubset%
\[
M_{S}:=\left\{  s_{1}-0\leq s_{2}-2\leq s_{4}-4\leq\cdots\leq s_{a+b}-2\left(
a+b-1\right)  \right\}  _{\operatorname*{multi}}%
\]
of $\left[  2m-2\left(  a+b-1\right)  \right]  $. It has exactly $a$ even and
$b$ odd elements. Thus, we can split $M_{S}$ into a \textquotedblleft multiset
union\textquotedblright\ $M_{S,\operatorname*{even}}\cup
M_{S,\operatorname*{odd}}$ (like a union of sets, but multiplicities get
added), where%
\[
M_{S,\operatorname*{even}}\text{ is a size-}a\text{ multisubset of }\left\{
2,4,6,\ldots,2m-2\left(  a+b-1\right)  \right\}  ,
\]
and where%
\[
M_{S,\operatorname*{odd}}\text{ is a size-}b\text{ multisubset of }\left\{
1,3,5,\ldots,2m-2\left(  a+b-1\right)  -1\right\}  .
\]
Moreover, this encoding%
\begin{align*}
&  \left\{  \text{lacunar subsets of }\left[  2m\right]  \text{ with exactly
}a\text{ even and }b\text{ odd elements}\right\} \\
&  \rightarrow\left\{  \text{size-}a\text{ multisubsets of }\left\{
2,4,6,\ldots,2m-2\left(  a+b-1\right)  \right\}  \right\} \\
&  \ \ \ \ \ \ \ \ \ \ \times\left\{  \text{size-}b\text{ multisubsets of
}\left\{  1,3,5,\ldots,2m-2\left(  a+b-1\right)  -1\right\}  \right\}  ,\\
S  &  \mapsto\left(  M_{S,\operatorname*{even}},M_{S,\operatorname*{odd}%
}\right)
\end{align*}
is a bijection. Hence, the bijection principle and the product rule yield%
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  2m\right]  \text{ with
exactly }a\text{ even and }b\text{ odd elements}\right) \\
&  =\underbrace{\left(  \text{\# of size-}a\text{ multisubsets of }\left\{
2,4,6,\ldots,2m-2\left(  a+b-1\right)  \right\}  \right)  }%
_{\substack{=\dbinom{a+\left(  m-a-b+1\right)  -1}{a}\\=\dbinom{m-b}{a}}}\\
&  \ \ \ \ \ \ \ \ \ \ \cdot\underbrace{\left(  \text{\# of size-}b\text{
multisubsets of }\left\{  1,3,5,\ldots,2m-2\left(  a+b-1\right)  -1\right\}
\right)  }_{\substack{=\dbinom{b+\left(  m-a-b+1\right)  -1}{b}\\=\dbinom
{m-a}{b}}}\\
&  =\dbinom{m-b}{a}\cdot\dbinom{m-a}{b}.
\end{align*}

\end{proof}

Note that, as a consequence, you get the following formula for Fibonacci
numbers:%
\[
f_{2m+1}=\sum_{a=0}^{m}\sum_{b=0}^{m}\dbinom{m-a}{b}\dbinom{m-b}{a}.
\]


\subsection{Multinomial coefficients}

\begin{definition}
Let $n,n_{1},n_{2},\ldots,n_{k}\in\mathbb{N}$ be such that $n_{1}+n_{2}%
+\cdots+n_{k}=n$. Then,%
\[
\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}=\dfrac{n!}{n_{1}!n_{2}!\cdots n_{k}!}.
\]

\end{definition}

\begin{remark}
\textbf{(a)} We are not defining this for negative or non-integer $n$.

\textbf{(b)} If $m\in\left\{  0,1,\ldots,n\right\}  $, then $\dbinom{n}%
{m}=\dbinom{n}{m,n-m}$.
\end{remark}

\begin{proposition}
Let $n,n_{1},n_{2},\ldots,n_{k}\in\mathbb{N}$ be such that $n_{1}+n_{2}%
+\cdots+n_{k}=n$. Then:

\textbf{(a)} We have%
\begin{align*}
\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}  &  =\prod_{i=1}^{k}\dbinom{n-n_{1}%
-n_{2}-\cdots-n_{i-1}}{n_{i}}\\
&  =\dbinom{n}{n_{1}}\dbinom{n-n_{1}}{n_{2}}\dbinom{n-n_{1}-n_{2}}{n_{3}%
}\cdots\underbrace{\dbinom{n-n_{1}-n_{2}-\cdots-n_{k-1}}{n_{k}}}_{=1}\\
&  =\prod_{i=1}^{k-1}\dbinom{n-n_{1}-n_{2}-\cdots-n_{i-1}}{n_{i}}.
\end{align*}


\textbf{(b)} $\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}\in\mathbb{N}$.

\textbf{(c)} The \# of maps $f:\left[  n\right]  \rightarrow\left[  k\right]
$ satisfying%
\[
\left(  \text{\# of }a\in\left[  n\right]  \text{ such that }f\left(
a\right)  =i\right)  =n_{i}\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left[
k\right]
\]
is $\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}$.

\textbf{(d)} Let $\alpha$ be the $n$-tuple%
\[
\left(  \underbrace{1,1,\ldots,1}_{n_{1}\text{ times}},\underbrace{2,2,\ldots
,2}_{n_{2}\text{ times}},\ldots,\underbrace{k,k,\ldots,k}_{n_{k}\text{ times}%
}\right)  .
\]
Then, the \# of distinct anagrams of $\alpha$ (that is, $n$-tuples obtained
from $\alpha$ by permuting its entries) is $\dbinom{n}{n_{1},n_{2}%
,\ldots,n_{k}}$.
\end{proposition}

\textquotedblleft Anagrams\textquotedblright\ are often called
\textquotedblleft permutations\textquotedblright.

\begin{example}
How many anagrams does the word \textquotedblleft anagram\textquotedblright\ have?

Equivalently, how many anagrams does the word \textquotedblleft
aaagmnr\textquotedblright\ have?

Equivalently, how many anagrams does the $7$-tuple \textquotedblleft$\left(
1,1,1,2,3,4,5\right)  $\textquotedblright\ have?

Part \textbf{(d)} of the above proposition says that the answer is $\dbinom
{7}{3,1,1,1,1}=\dfrac{7!}{3!\cdot1!\cdot1!\cdot1!\cdot1!}=\dfrac{7!}%
{3!}=7\cdot6\cdot5\cdot4=\allowbreak840$.
\end{example}

\begin{center}
\fbox{\textbf{Class of 2019-11-06}}
\end{center}

\begin{proof}
(Proof of the above Proposition.) \textbf{(a)} Easy (telescoping product).

\textbf{(b)} follows from \textbf{(a)}.

\textbf{(c)} Here is a way to construct any map $f:\left[  n\right]
\rightarrow\left[  k\right]  $ satisfying%
\[
\left(  \text{\# of }a\in\left[  n\right]  \text{ such that }f\left(
a\right)  =i\right)  =n_{i}\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left[
k\right]  :
\]


\begin{itemize}
\item Choose $\left\{  a\in\left[  n\right]  \ \mid\ f\left(  a\right)
=1\right\}  $. (Here, we have $\dbinom{n}{n_{1}}$ choices.)

\item Choose $\left\{  a\in\left[  n\right]  \ \mid\ f\left(  a\right)
=2\right\}  $. (Here, we have $\dbinom{n-n_{1}}{n_{2}}$ choices.)

\item Choose $\left\{  a\in\left[  n\right]  \ \mid\ f\left(  a\right)
=3\right\}  $. (Here, we have $\dbinom{n-n_{1}-n_{2}}{n_{3}}$ choices.)

\item etc.
\end{itemize}

Altogether, the total \# of $f$'s is therefore%
\[
\prod_{i=1}^{k}\dbinom{n-n_{1}-n_{2}-\cdots-n_{i-1}}{n_{i}}=\dbinom{n}%
{n_{1},n_{2},\ldots,n_{k}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by part
\textbf{(a)}}\right)  .
\]


\textbf{(d)} The map%
\begin{align*}
\left\{  \text{anagram of }\alpha\right\}   &  \rightarrow\left\{  \text{map
}f:\left[  n\right]  \rightarrow\left[  k\right]  \text{ as in part
\textbf{(c)}}\right\}  ,\\
\left(  \beta_{1},\beta_{2},\ldots,\beta_{n}\right)   &  \mapsto\left(
\text{the map }f:\left[  n\right]  \rightarrow\left[  k\right]  \text{ sending
}j\text{ to }\beta_{j}\right)
\end{align*}
is a bijection. [Rigorously proving this would take us a while.] Part
\textbf{(c)} concludes the argument.
\end{proof}

Note that multinomial coefficients generalize the binomial coefficients that
you see in Pascal's triangle:

\begin{proposition}
Let $n\in\mathbb{N}$ and $k\in\left\{  0,1,\ldots,n\right\}  $, then
\[
\underbrace{\dbinom{n}{k}}_{\text{binomial coeff.}}=\underbrace{\dbinom
{n}{k,n-k}}_{\text{multinomial coeff.}}.
\]

\end{proposition}

\begin{proof}
This is just saying $\dbinom{n}{k}=\dfrac{n!}{k!\left(  n-k\right)  !}$, but
we proved this long ago.
\end{proof}

\begin{proposition}
Let $n\in\mathbb{N}$ and $n_{1},n_{2},\ldots,n_{k}\in\mathbb{N}$ such that
$n_{1}+n_{2}+\cdots+n_{k}=n$. Then,%
\[
\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}=\dbinom{n}{n_{\sigma\left(  1\right)
},n_{\sigma\left(  2\right)  },\ldots,n_{\sigma\left(  k\right)  }}%
\]
for any permutation $\sigma$ of $\left[  k\right]  $.
\end{proposition}

\begin{proof}
The definition of multinomial coefficients yields%
\begin{align*}
\dbinom{n}{n_{\sigma\left(  1\right)  },n_{\sigma\left(  2\right)  }%
,\ldots,n_{\sigma\left(  k\right)  }}  &  =\dfrac{n!}{n_{\sigma\left(
1\right)  }!n_{\sigma\left(  2\right)  }!\cdots n_{\sigma\left(  k\right)  }%
!}=\dfrac{n!}{n_{1}!n_{2}!\cdots n_{k}!}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }n_{\sigma\left(  1\right)
}!n_{\sigma\left(  2\right)  }!\cdots n_{\sigma\left(  k\right)  }%
!=n_{1}!n_{2}!\cdots n_{k}!\right) \\
&  =\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}.
\end{align*}

\end{proof}

\begin{theorem}
(Recurrence relation for multinomial coefficients.)

Let $n,n_{1},n_{2},\ldots,n_{k}\in\mathbb{N}$ be such that $n_{1}+n_{2}%
+\cdots+n_{k}=n>0$. Then,%
\[
\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}=\sum_{i=1}^{k}\underbrace{\dbinom
{n-1}{n_{1},\ldots,n_{i-1},n_{i}-1,n_{i+1},\ldots,n_{k}}}_{\text{This should
be interpreted as }0\text{ if }n_{i}=0}.
\]

\end{theorem}

\begin{proof}
LTTR.
\end{proof}

($\Longrightarrow$ Pascal's pyramid.)

\begin{theorem}
(Multinomial formula.)

Let $x_{1},x_{2},\ldots,x_{k}$ be $k$ numbers. Let $n\in\mathbb{N}$. Then,%
\[
\left(  x_{1}+x_{2}+\cdots+x_{k}\right)  ^{n}=\sum_{\substack{\left(
n_{1},n_{2},\ldots,n_{k}\right)  \in\mathbb{N};\\n_{1}+n_{2}+\cdots+n_{k}%
=n}}\dbinom{n}{n_{1},n_{2},\ldots,n_{k}}x_{1}^{k_{1}}x_{2}^{k_{2}}\cdots
x_{n}^{k_{n}}.
\]

\end{theorem}

\begin{proof}
LTTR. Either use part \textbf{(c)} of yesterday's last proposition (see
[Galvin, Thm. 11.7]); or use induction on $n$; or use induction on $k$.
\end{proof}

\section{\label{chp.12fold}The twelvefold way}

\subsection{\label{sect.12fold.what}What is it?}

The \textit{twelvefold way} is a table of $4\cdot3=12$ standard counting
problems that tend to appear often. Let us first introduce it informally, and
then define it formally and study it in detail.

\textbf{Informal description:} Given a set $A$ of balls and a set $X$ of
boxes. A \textbf{placement} means a way to distribute the balls into the
boxes. Rigorously, we can think of a placement as a map from $A$ to $X$; more
precisely, this is what we will call an \textquotedblleft$L\rightarrow L$
\textbf{placement}\textquotedblright.

How many such placements are there? Of course, $\left\vert X\right\vert
^{\left\vert A\right\vert }$ (by Theorem \ref{thm.binom.maps-all}).

\begin{example}
Let $X=\left[  2\right]  $ and $A=\left[  3\right]  $, so that $\left\vert
X\right\vert =2$ and $\left\vert A\right\vert =3$. Thus, we are trying to
place $3$ balls (called $1,2,3$) into $2$ boxes (called $1,2$).

We will draw such placements as follows: We will always draw the boxes in
increasing order:%
\[
\fbox{$%
\ \ \numboxed{\phantom{(1)(2)(3)}}{1}\ \ \ \numboxed{\phantom{(1)(2)(3)}}{2}\ \ $}%
\]
We draw each ball as a pair of parentheses with a number inside -- so, for
example, the ball $3$ will be drawn as \textquotedblleft$\left(  3\right)
$\textquotedblright.

So the $L\rightarrow L$ placements of the balls $1,2,3\in A$ in the boxes
$1,2\in A$ are%
\begin{align*}
&  \fbox{$%
\ \ \numboxed{(1)(2)(3)}{1}\ \ \ \numboxed{\phantom{(1)(2)(3)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{2}\ \ $}%
\ \ ,\\
& \\
&  \fbox{$%
\ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\ \ ,\\
& \\
&  \fbox{$%
\ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\\
& \\
&  \fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)(2)(3)}}{1}\ \ \ \numboxed{(1)(2)(3)}{2}\ \ $}\ \ .
\end{align*}
The order of balls \textbf{within} a single box does not matter:%
\[
\fbox{$%
\ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{2}\ \ $}%
\ \ =\ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(3}(2)(1)\phantom{)}}{2}\ \ $}%
\ \ \ .
\]

\end{example}

This suggests the following variations:

\begin{itemize}
\item What if we require $f:A\rightarrow X$ to be injective (i.e., each box
contains $\leq1$ ball) or surjective (i.e., each box contains $\geq1$ ball)?

\item What if the balls are unlabelled (i.e., indistinguishable)?

To make this rigorous, we will use equivalence classes:

We will say that two maps $f:A\rightarrow X$ are \textquotedblleft
ball-equivalent\textquotedblright\ if there is a permutation of the balls that
transforms one into the other. Then, \textquotedblleft$U\rightarrow L$
\textbf{placements}\textquotedblright\ (= placements of unlabelled balls in
labelled boxes) will be equivalence classes of ball-equivalence.

E.g.: the two $L\rightarrow L$ placements%
\[
\fbox{$%
\ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\]
are ball-equivalent, and therefore contribute to only $1$ ball-equivalence
class -- i.e., they count as one and the same $U\rightarrow L$ placement.

We shall draw $U\rightarrow L$ placements in the same way as we draw
$L\rightarrow L$ placements, but representing balls by \textquotedblleft%
$\bullet$\textquotedblright\ symbols (rather than by numbers in parentheses).
Thus, the $U\rightarrow L$ placement that we have just discussed becomes%
\[
\fbox{$%
\ \ \numboxed{\phantom{(\bullet}\bullet\bullet\phantom{\bullet)}}{1}\ \ \ \numboxed{\phantom{(1)}\bullet\phantom{(2)}}{2}\ \ $}%
\ \ .
\]


\item What if the boxes are unlabelled (i.e., indistinguishable)?

This can be made rigorous in a similar way, but we now have to permute boxes.
This gives \textquotedblleft$L\rightarrow U$ \textbf{placements}%
\textquotedblright. For example, the two $L\rightarrow L$ placements%
\[
\fbox{$%
\ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\]
are box-equivalent (i.e., can be transformed into one another by permuting the
boxes) and thus contribute to only $1$ box-equivalence class -- i.e., they
count as one and the same $L\rightarrow U$ placement.

We shall draw $L\rightarrow U$ placements in the same way as we draw
$L\rightarrow L$ placements, but without marking the boxes as
\textquotedblleft box $1$\textquotedblright, \textquotedblleft box
$2$\textquotedblright\ etc.. Thus, the $U\rightarrow L$ placement that we have
just discussed becomes%
\[
\fbox{$%
\ \ \boxed{\phantom{(2}(1)(3)\phantom{)}}\ \ \ \boxed{\phantom{(1)}(2)\phantom{(3)}}\ \ $}%
\ \ .
\]


\item What if both the boxes and the balls are indistinguishable? This kind of
placements will be called \textquotedblleft$U\rightarrow U$\textbf{
placements}\textquotedblright. We shall draw them in the same way as we draw
$L\rightarrow L$ placements, but representing balls by \textquotedblleft%
$\bullet$\textquotedblright\ symbols and without marking the boxes.
\end{itemize}

In total, we get $3\cdot4=12$ many different counting problems. We list them
in a table:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &  &
\\\hline
$U\rightarrow L$ &  &  & \\\hline
$L\rightarrow U$ &  &  & \\\hline
$U\rightarrow U$ &  &  & \\\hline
\end{tabular}
\
\]
Here:

\begin{itemize}
\item $L\rightarrow L$ means \textquotedblleft balls are labelled, boxes are
labelled\textquotedblright, so we are just counting maps $f:A\rightarrow X$.

\item $U\rightarrow L$ means \textquotedblleft balls are unlabelled, boxes are
labelled\textquotedblright.

\item $L\rightarrow U$ means \textquotedblleft balls are labelled, boxes are
unlabelled\textquotedblright.

\item $U\rightarrow U$ means \textquotedblleft balls are unlabelled, boxes are
unlabelled\textquotedblright.
\end{itemize}

\begin{example}
Let $X=\left[  2\right]  $ and $A=\left[  3\right]  $. Then, let us count how
many placements of each kind we have:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $8$ & $0$ & $6$\\\hline
$U\rightarrow L$ & $4$ & $0$ & $2$\\\hline
$L\rightarrow U$ & $4$ & $0$ & $3$\\\hline
$U\rightarrow U$ & $2$ & $0$ & $1$\\\hline
\end{tabular}
\
\]


In fact:

\begin{itemize}
\item The $U\rightarrow L$ placements are%
\begin{align*}
&  \fbox{$%
\ \ \numboxed{\phantom{((}\bullet\bullet\bullet\phantom{))}}{1}\ \ \ \numboxed{\phantom{(1) \bullet (2)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(\bullet}\bullet\bullet\phantom{\bullet)}}{1}\ \ \ \numboxed{\phantom{(1)}\bullet\phantom{(2)}}{2}\ \ $}%
\ \ ,\\
& \\
&  \fbox{$%
\ \ \numboxed{\phantom{(1)}\bullet\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(\bullet}\bullet\bullet\phantom{\bullet)}}{2}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1) \bullet (2)}}{1}\ \ \ \numboxed{\phantom{((}\bullet\bullet\bullet\phantom{))}}{2}\ \ $}%
\ \ .
\end{align*}


\item The $L\rightarrow U$ placements are%
\begin{align*}
&  \fbox{$\ \ \boxed{(1)(2)(3)}\ \ \ \boxed{\phantom{(1)(2)(3)}}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \boxed{\phantom{(3}(1)(2)\phantom{)}}\ \ \ \boxed{\phantom{(1)}(3)\phantom{(2)}}\ \ $}%
\ \ ,\\
& \\
&  \fbox{$%
\ \ \boxed{\phantom{(2}(1)(3)\phantom{)}}\ \ \ \boxed{\phantom{(1)}(2)\phantom{(3)}}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \boxed{\phantom{(1}(2)(3)\phantom{)}}\ \ \ \boxed{\phantom{(2)}(1)\phantom{(3)}}\ \ $}%
\ \ .
\end{align*}


\item The $U\rightarrow U$ placements are%
\[
\fbox{$%
\ \ \boxed{\phantom{((}\bullet\bullet\bullet\phantom{))}}\ \ \ \boxed{\phantom{(1) \bullet (2)}}\ \ $}%
\ \ ,\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \boxed{\phantom{(\bullet}\bullet\bullet\phantom{\bullet)}}\ \ \ \boxed{\phantom{(1)}\bullet\phantom{(2)}}\ \ $}%
\ \ .
\]

\end{itemize}
\end{example}

In general, not every among the $12$ questions has a closed-form answer. But
there are, at least, good recursions.

\subsection{$L\rightarrow L$}

\begin{definition}
An $L\rightarrow L$ \textbf{placement} from $A$ to $X$ is just a map from $A$
to $X$. The value of this map at some $a\in A$ is called the \textbf{box in
which ball }$a$ \textbf{is placed}.
\end{definition}

\begin{proposition}%
\begin{align*}
&  \left(  \text{\# of }L\rightarrow L\text{ placements }A\rightarrow X\right)
\\
&  =\left(  \text{\# of maps from }A\text{ to }X\right)  =\left\vert
X\right\vert ^{\left\vert A\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
This is Theorem \ref{thm.binom.maps-all}.
\end{proof}

\begin{proposition}%
\begin{align*}
&  \left(  \text{\# of injective }L\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of injective maps from }A\text{ to }X\right)  =\left\vert
X\right\vert ^{\underline{\left\vert A\right\vert }}.
\end{align*}

\end{proposition}

\begin{proof}
This is Theorem \ref{thm.binom.maps-inj}.
\end{proof}

\begin{proposition}%
\begin{align*}
&  \left(  \text{\# of surjective }L\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of surjective maps from }A\text{ to }X\right)
=\operatorname*{sur}\left(  \left\vert A\right\vert ,\left\vert X\right\vert
\right)  ,
\end{align*}

\end{proposition}

\begin{proof}
This is Proposition \ref{prop.binom.maps-surj}.
\end{proof}

Here are some examples of counting problems that boil down to counting
$L\rightarrow L$ placements:

\begin{itemize}
\item assigning grades (from a finite set $X$) to students (from a finite set
$A$): these are arbitrary $L\rightarrow L$ placements.

\item assigning IP addresses to computers: these are injective $L\rightarrow
L$ placements.

\item How many $8$-digit telephone numbers are there with no $2$ equal digits?

These correspond to injective $L\rightarrow L$ placements with $A=\left[
8\right]  $ and $X=\left\{  0,1,\ldots,9\right\}  $; for example, the
telephone number $20354986$ corresponds to the $L\rightarrow L$ placement%
\[
\fbox{$%
\ \ \numboxed{(2)}{0}\ \ \ \numboxed{\phantom{(2)}}{1}\ \ \ \numboxed{(1)}{2}\ \ \ \numboxed{(3)}{3}\ \ \ \numboxed{(5)}{4}\ \ \ \numboxed{(4)}{5}\ \ \ \numboxed{(8)}{6}\ \ \ \numboxed{\phantom{(2)}}{7}\ \ \ \numboxed{(7)}{8}\ \ \ \numboxed{(6)}{9}\ \ $}%
\ \ .
\]


$\Longrightarrow$ The total \# of such numbers is $10^{\underline{8}}%
=10\cdot9\cdot\cdots\cdot3=10!/2!$.
\end{itemize}

\subsection{Equivalence relations}

What does it mean for balls, or boxes, to be unlabelled?

Rigorously, it means that we are counting \textbf{not} the maps
$f:A\rightarrow X$, but rather their \textbf{equivalence classes} wrt some
relation. (The abbreviation \textquotedblleft wrt\textquotedblright\ means
\textquotedblleft with respect to\textquotedblright.)

Before we make sense of this, let us introduce (or recall) the notions of
\textit{relations} and, in particular, \textit{equivalence relations}.

\begin{center}
\fbox{\textbf{Class of 2019-11-08}}
\end{center}

\subsubsection{Relations}

I will follow \cite[Chapter 3]{19s}.

\begin{definition}
Let $S$ be a set. A \textbf{(binary) relation} on $S$ is formally defined as a
subset of $S\times S$. Informally, it is a statement $x\ R\ y$ defined for
every pair of elements $\left(  x,y\right)  \in S\times S$. For each pair
$\left(  x,y\right)  \in S\times S$, this statement $x\ R\ y$ is either true
or false.
\end{definition}

The informal and the formal definitions are equivalent, since:

\begin{itemize}
\item Given a statement $x\ R\ y$ defined for every pair $\left(  x,y\right)
\in S\times S$, we can encode it as a subset of $S\times S$, namely as the
subset%
\[
\left\{  \left(  x,y\right)  \in S\times S\ \mid\ x\ R\ y\right\}  .
\]


\item Conversely, every subset $T$ can be decoded into a statement (namely,
\textquotedblleft$\left(  x,y\right)  \in T$\textquotedblright).
\end{itemize}

In the following, we will say \textquotedblleft\textbf{relation}%
\textquotedblright\ for \textquotedblleft\textbf{binary relation}%
\textquotedblright.

\begin{example}
Let $S=\mathbb{Z}$.

\textbf{(a)} The relation $=$ is a binary relation on $S$. As a subset of
$S\times S$, this relation is%
\begin{align*}
&  \left\{  \left(  a,b\right)  \in S\times S\ \mid\ a=b\right\} \\
&  =\left\{  \left(  c,c\right)  \ \mid\ c\in S\right\}  =\left\{
\ldots,\left(  -2,-2\right)  ,\left(  -1,-1\right)  ,\left(  0,0\right)
,\left(  1,1\right)  ,\left(  2,2\right)  ,\ldots\right\}  .
\end{align*}


\textbf{(b)} The relation $<$ is a binary relation on $S$. As a subset of
$S\times S$, this relation is%
\[
\left\{  \left(  a,b\right)  \in S\times S\ \mid\ a<b\right\}  .
\]


\textbf{(c)} The relation $\leq$ is a binary relation on $S$.

\textbf{(d)} The relation $\neq$ is a binary relation on $S$.

\textbf{(e)} Fix $n\in\mathbb{Z}$. Define a binary relation
$\underset{n}{\equiv}$ on $S=\mathbb{Z}$ by%
\begin{align*}
\left(  a\underset{n}{\equiv}b\right)   &  \Longleftrightarrow\left(  a\equiv
b\operatorname{mod}n\right)  \Longleftrightarrow\left(  n\mid a-b\right) \\
&  \Longleftrightarrow\left(  a=b+kn\text{ for some }k\in\mathbb{Z}\right)  .
\end{align*}
This is called \textbf{congruence modulo }$n$. Note that the relation
$\underset{0}{\equiv}$ is $=$.

When $n$ is positive, $a\equiv b\operatorname{mod}n$ if and only if
$a\%n=b\%n$.

For $n=1$, we have%
\[
\left(  a\underset{1}{\equiv}b\right)  \Longleftrightarrow\left(  1\mid
a-b\right)  \Longleftrightarrow\left(  \dfrac{a-b}{1}\in\mathbb{Z}\right)
\Longleftrightarrow\left(  a-b\in\mathbb{Z}\right)  \Longleftrightarrow\left(
\text{true}\right)  .
\]
Thus, the relation $\underset{1}{\equiv}$ always holds (i.e., we have
$a\underset{1}{\equiv}b$ for all $\left(  a,b\right)  \in S\times S$). Thus,
it equals the whole set $S\times S$ (when considered as a subset of $S\times
S$).

\textbf{(f)} Define a binary relation $N$ on $S$ by%
\[
\left(  a\ N\ b\right)  \Longleftrightarrow\left(  \text{false}\right)  .
\]
That is, there is no pair $\left(  a,b\right)  \in S\times S$ such that
$a\ N\ b$. As a subset of $S\times S$, this relation is $\varnothing$.

\textbf{(g)} Define a binary relation $A$ on $S$ by%
\[
\left(  a\ A\ b\right)  \Longleftrightarrow\left(  \text{true}\right)  .
\]
That is, every pair $\left(  a,b\right)  \in S\times S$ satisfies $a\ N\ b$.
As a subset of $S\times S$, this relation is $S\times S$. This is the above
relation $\underset{1}{\equiv}$, but the way we just defined it, it makes
sense for every set $S$ (not just for $\mathbb{Z}$).

\textbf{(h)} The relation $\mid$ is a binary relation on $S$.

\textbf{(i)} The relation \textquotedblleft is coprime to\textquotedblright%
\ is a binary relation on $S$.
\end{example}

There are other examples on other sets. For example, \textquotedblleft
parallel\textquotedblright\ is a relation between lines in plane geometry.

\subsubsection{Equivalence relations}

\begin{definition}
Let $R$ be a binary relation on a set $S$.

\textbf{(a)} We say that $R$ is \textbf{reflexive} if every $a\in S$ satisfies
$a\ R\ a$.

\textbf{(b)} We say that $R$ is \textbf{symmetric} if every $a,b\in S$
satisfying $a\ R\ b$ satisfy $b\ R\ a$.

\textbf{(c)} We say that $R$ is \textbf{transitive} if every $a,b,c\in S$
satisfying $a\ R\ b$ and $b\ R\ c$ satisfy $a\ R\ c$.
\end{definition}

\begin{example}
Let $S$ be the set $\mathbb{Z}$.

\textbf{(a)} The relation $=$ is reflexive, symmetric and transitive.

\textbf{(b)} The relation $<$ is not reflexive, not symmetric but transitive.

\textbf{(c)} The relation $\leq$ is reflexive, not symmetric but transitive.

\textbf{(d)} The relation $\neq$ is not reflexive, but symmetric. It is not
transitive (e.g., $2\neq3$ and $3\neq2$, but $2=2$).

\textbf{(e)} For every $n\in\mathbb{Z}$, the congruence relation
$\underset{n}{\equiv}$ is reflexive (since $n\mid a-a$), symmetric (since
$n\mid a-b$ implies $n\mid b-a$) and transitive (since $n\mid a-b$ and $n\mid
b-c$ implies $n\mid a-c$).

\textbf{(f)} The relation $N$ is symmetric (vacuously) and transitive
(vacuously), but not reflexive.

\textbf{(g)} The relation $A$ is reflexive, symmetric and transitive.

\textbf{(h)} The divisibility relation $\mid$ is reflexive but not symmetric.
It is transitive (if $a\mid b$ and $b\mid c$, then $a\mid c$).

\textbf{(i)} The coprimality relation is symmetric but neither reflexive nor transitive.
\end{example}

\begin{definition}
An \textbf{equivalence relation} on a set $S$ means a relation on $S$ that is
reflexive, symmetric and transitive.
\end{definition}

\begin{example}
Let $S$ be any set. The relation $=$ on $S$ is an equivalence relation.
\end{example}

\begin{example}
Let $n\in\mathbb{Z}$. Then, the congruence relation $\underset{n}{\equiv}$ on
$\mathbb{Z}$ is an equivalence relation.
\end{example}

\begin{example}
The relation \textquotedblleft parallel\textquotedblright\ on $\left\{
\text{lines in the plane}\right\}  $ is an equivalence relation.
\end{example}

\begin{example}
The relation \textquotedblleft similar\textquotedblright\ on $\left\{
\text{triangles in the plane}\right\}  $ is an equivalence relation.
\end{example}

\begin{example}
The relation \textquotedblleft directly similar\textquotedblright\ (= similar
with the same orientation) on $\left\{  \text{triangles in the plane}\right\}
$ is an equivalence relation.
\end{example}

\begin{example}
The relation \textquotedblleft indirectly similar\textquotedblright\ (=
similar with opposite orientation) on $\left\{  \text{triangles in the
plane}\right\}  $ is not an equivalence relation, because it is not reflexive.
\end{example}

\begin{example}
Let $S$ and $T$ be two sets. Let $f:S\rightarrow T$ be a map. Define a
relation $\underset{f}{\equiv}$ on $S$ by%
\[
\left(  a\underset{f}{\equiv}b\right)  \Longleftrightarrow\left(  f\left(
a\right)  =f\left(  b\right)  \right)  .
\]
This relation $\underset{f}{\equiv}$ is an equivalence relation.
\end{example}

\begin{example}
Let $S$ be $\left\{  \text{all points on the landmass of the Earth}\right\}
$, and define a relation $\sim$ by%
\[
\left(  a\sim b\right)  \Longleftrightarrow\left(  \text{there is a land route
from }a\text{ to }b\right)  .
\]
Then, $\sim$ is an equivalence relation.
\end{example}

\begin{example}
Let
\[
S=\mathbb{Z}\times\left(  \mathbb{Z}\setminus\left\{  0\right\}  \right)
=\left\{  \left(  a_{1},a_{2}\right)  \in\mathbb{Z}^{2}\ \mid\ a_{1}%
\in\mathbb{Z}\text{ and }a_{2}\in\mathbb{Z}\setminus\left\{  0\right\}
\right\}  .
\]
Define a relation $\underset{\ast}{\sim}$ on $S$ by%
\[
\left(  \left(  a_{1},a_{2}\right)  \underset{\ast}{\sim}\left(  b_{1}%
,b_{2}\right)  \right)  \ \Longleftrightarrow\ \left(  a_{1}b_{2}=a_{2}%
b_{1}\right)  .
\]
This relation $\underset{\ast}{\sim}$ is an equivalence relation.
\end{example}

\subsubsection{Equivalence classes}

\begin{definition}
Let $\sim$ be an equivalence relation on a set $S$.

\textbf{(a)} For each $a\in S$, we define a subset $\left[  a\right]  _{\sim}$
of $S$ by%
\[
\left[  a\right]  _{\sim}=\left\{  b\in S\ \mid\ b\sim a\right\}  .
\]
This subset $\left[  a\right]  _{\sim}$ is called the \textbf{equivalence
class of }$a$ (for the relation $\sim$), or the $\sim$\textbf{-equivalence
class of }$a$.

\textbf{(b)} The \textbf{equivalence classes of }$\sim$ are defined to be the
sets $\left[  a\right]  _{\sim}$ for $a\in S$. They are also known as the
$\sim$\textbf{-equivalence classes}.
\end{definition}

\begin{example}
Consider the relation $\underset{3}{\equiv}$ on $\mathbb{Z}$. We have%
\begin{align*}
\left[  5\right]  _{\underset{3}{\equiv}}  &  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\underset{3}{\equiv}5\right\}  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\equiv5\operatorname{mod}3\right\} \\
&  =\left\{  5+3k\ \mid\ k\in\mathbb{Z}\right\}  =\left\{  \ldots
,-4,-1,2,5,8,11,14,\ldots\right\}
\end{align*}
and%
\begin{align*}
\left[  3\right]  _{\underset{3}{\equiv}}  &  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\underset{3}{\equiv}3\right\}  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\equiv3\operatorname{mod}3\right\} \\
&  =\left\{  3+3k\ \mid\ k\in\mathbb{Z}\right\}  =\left\{  \ldots
,-6,-3,0,3,6,9,\ldots\right\}
\end{align*}
and%
\begin{align*}
\left[  2\right]  _{\underset{3}{\equiv}}  &  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\underset{3}{\equiv}2\right\}  =\left\{  b\in\mathbb{Z}%
\ \mid\ b\equiv2\operatorname{mod}3\right\} \\
&  =\left\{  2+3k\ \mid\ k\in\mathbb{Z}\right\}  =\left\{  \ldots
,-4,-1,2,5,8,11,14,\ldots\right\}  .
\end{align*}
Note that $\left[  2\right]  _{\underset{3}{\equiv}}=\left[  5\right]
_{\underset{3}{\equiv}}$.
\end{example}

Let us state some basic properties of equivalence classes. For their proofs,
see \cite[\S 3.3.2]{19s} or any sufficiently thorough introduction to proofs.

\begin{proposition}
Let $\sim$ be an equivalence relation on a set $S$. Let $a\in S$. Then,%
\[
\left[  a\right]  _{\sim}=\left\{  b\in S\ \mid\ a\sim b\right\}  .
\]

\end{proposition}

\begin{proposition}
Let $\sim$ be an equivalence relation on a set $S$. Let $a\in S$. Then,
$a\in\left[  a\right]  _{\sim}$.
\end{proposition}

\begin{proposition}
Let $\sim$ be an equivalence relation on a set $S$. Let $x,y\in S$.

\textbf{(a)} If $x\sim y$, then $\left[  x\right]  _{\sim}=\left[  y\right]
_{\sim}$.

\textbf{(b)} If not $x\sim y$, then $\left[  x\right]  _{\sim}$ and $\left[
y\right]  _{\sim}$ are disjoint.

\textbf{(c)} We have $x\sim y$ if and only if $x\in\left[  y\right]  _{\sim}$.

\textbf{(d)} We have $x\sim y$ if and only if $y\in\left[  x\right]  _{\sim}$.

\textbf{(e)} We have $x\sim y$ if and only if $\left[  x\right]  _{\sim
}=\left[  y\right]  _{\sim}$.
\end{proposition}

As a consequence, any two $\sim$-equivalence classes are either identical or disjoint.

\begin{example}
Consider the relation $\underset{\ast}{\sim}$ defined on the set%
\[
S=\mathbb{Z}\times\left(  \mathbb{Z}\setminus\left\{  0\right\}  \right)
=\left\{  \left(  a_{1},a_{2}\right)  \in\mathbb{Z}^{2}\ \mid\ a_{1}%
\in\mathbb{Z}\text{ and }a_{2}\in\mathbb{Z}\setminus\left\{  0\right\}
\right\}
\]
by%
\[
\left(  \left(  a_{1},a_{2}\right)  \underset{\ast}{\sim}\left(  b_{1}%
,b_{2}\right)  \right)  \ \Longleftrightarrow\ \left(  a_{1}b_{2}=a_{2}%
b_{1}\right)  .
\]
Then, the equivalence classes of $\underset{\ast}{\sim}$ are the rational
numbers. This is how the rational numbers are rigorously defined! So the
relation $\underset{\ast}{\sim}$ tells us which pairs of integers give the
same rational number. The equivalence class $\left[  \left(  a_{1}%
,a_{2}\right)  \right]  _{\underset{\ast}{\sim}}$ is denoted by $\dfrac{a_{1}%
}{a_{2}}$.
\end{example}

\begin{example}
Let $S$ be $\left\{  \text{all points on the landmass of the Earth}\right\}
$, and consider the relation $\sim$ defined by%
\[
\left(  a\sim b\right)  \Longleftrightarrow\left(  \text{there is a land route
from }a\text{ to }b\right)  .
\]
Then, the $\sim$-equivalence classes are the continents/islands.
\end{example}

\begin{example}
Let $A$ be a set, and $k\in\mathbb{N}$. The relation $\underset{\text{perm}%
}{\sim}$ on $A^{k}$ is defined as follows:%
\begin{align*}
\left(  \mathbf{p}\underset{\text{perm}}{\sim}\mathbf{q}\right)   &
\Longleftrightarrow\left(  \mathbf{p}\text{ is an anagram of }\mathbf{q}%
\right) \\
&  \Longleftrightarrow\left(  \mathbf{p}\text{ can be obtained from
}\mathbf{q}\text{ by permuting the entries}\right)  .
\end{align*}
For example, $\left(  3,8,8,2\right)  \underset{\text{perm}}{\sim}\left(
8,3,2,8\right)  $.

The equivalence classes of $\underset{\text{perm}}{\sim}$ are called
\textbf{unordered }$k$\textbf{-tuples} of elements of $A$. They are in
bijection with size-$k$ multisubsets of $A$.
\end{example}

\begin{example}
Let $n\in\mathbb{Z}$. The equivalence classes of the relation
$\underset{n}{\equiv}$ are called \textquotedblleft integers modulo
$n$\textquotedblright, and their set is denoted by $\mathbb{Z}/n\mathbb{Z}$ or
$\mathbb{Z}_{n}$ or $\mathbb{Z}/n$ or $Z_{n}$ or $C_{n}$ (depending on author
and context). In particular, the sets $\mathbb{Z}/12\mathbb{Z}$ and
$\mathbb{Z}/24\mathbb{Z}$ have a fairly known meaning: they stand for the
hours on a clock. For example, when you say \textquotedblleft$3$ hours after
$11$ is $2$\textquotedblright, you are really saying that $11+3\equiv
2\operatorname{mod}12$ or, equivalently, $\left[  11\right]
_{\underset{12}{\equiv}}+\left[  3\right]  _{\underset{12}{\equiv}}=\left[
2\right]  _{\underset{12}{\equiv}}$ for an appropriate definition of addition
of equivalence classes.
\end{example}

Next time, we will define box-equivalence and ball-equivalence on placements
of balls into boxes. Then, by taking equivalence classes, we will be able to
make sense of \textquotedblleft unlabelled balls\textquotedblright\ and
\textquotedblleft unlabelled boxes\textquotedblright.

\begin{center}
\fbox{\textbf{Class of 2019-11-08}}
\end{center}

\subsubsection{Defining unlabelled boxes and balls}

What does it mean for balls, or boxes, to be unlabelled (in the twelvefold way)?

Rigorously, it means that we are counting

\textbf{not} the maps $f:A\rightarrow X$,

\textbf{but} their equivalence classes with respect to certain equivalence relations.

What relations?

\begin{definition}
Let $f,g:A\rightarrow X$. Then, we say that

\begin{itemize}
\item $f$ is \textbf{box-equivalent} to $g$ (written
$f\overset{\operatorname*{box}}{\sim}g$) if and only if there is a permutation
$\sigma$ of $X$ such that $f=\sigma\circ g$ (in other words, $f$ can be
obtained from $g$ by permuting boxes).

\item $f$ is \textbf{ball-equivalent} to $g$ (written
$f\overset{\operatorname*{ball}}{\sim}g$) if and only if there is a
permutation $\tau$ of $A$ such that $f=g\circ\tau$ (in other words, $f$ can be
obtained from $g$ by permuting balls).

\item $f$ is \textbf{box-ball-equivalent} to $g$ (written
$f\underset{\operatorname*{ball}}{\overset{\operatorname*{box}}{\sim}}g$) if
and only if there is a permutation $\sigma$ of $X$ and a permutation $\tau$ of
$A$ such that $f=\sigma\circ g\circ\tau$.
\end{itemize}
\end{definition}

\begin{example}
Let $A=\left[  3\right]  $ and $X=\left[  2\right]  $.

\textbf{(a)} The two $L\rightarrow L$ placements%
\[
\fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\]
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
(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$).

\textbf{(b)} The two $L\rightarrow L$ placements%
\[
\fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\]
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 together in a single box in the first placement, but not in
the second).

\textbf{(c)} The two $L\rightarrow L$ placements%
\[
\fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\]
are box-ball-equivalent to one another (since they can be obtained from one
another by swapping the two boxes and swapping balls $1$ and $2$). But they
are neither box-equivalent nor ball-equivalent.

\textbf{(d)} The two $L\rightarrow L$ placements
\[
\fbox{$%
\ \ \numboxed{(1)(2)(3)}{1}\ \ \ \numboxed{\phantom{(1)(2)(3)}}{2}\ \ $}%
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\]
are not box-ball-equivalent to one another (since no permutation of boxes or
of balls can change the fact that the first placement has an empty box, but
the second does not).
\end{example}

\begin{proposition}
All of $\overset{\operatorname*{box}}{\sim}$, $\overset{\operatorname*{ball}%
}{\sim}$ and $\underset{\operatorname*{ball}}{\overset{\operatorname*{box}%
}{\sim}}$ are equivalence relations on the set $\left\{  \text{maps
}A\rightarrow X\right\}  $.
\end{proposition}

\begin{proof}
Easy. Hint:

\begin{itemize}
\item If $\sigma$ and $\tau$ are two permutations of a set $S$, then
$\sigma\circ\tau$ is a permutation of $S$.

\item If $\sigma$ is a permutation of a set $S$, then $\sigma^{-1}$ is a
permutation of $S$.
\end{itemize}
\end{proof}

\begin{definition}
Now, we define:

\begin{itemize}
\item $U\rightarrow L$ \textbf{placements} to be the
$\overset{\operatorname*{ball}}{\sim}$-equivalence classes.

\item $L\rightarrow U$ \textbf{placements} to be the
$\overset{\operatorname*{box}}{\sim}$-equivalence classes.

\item $U\rightarrow U$ \textbf{placements} to be the
$\underset{\operatorname*{ball}}{\overset{\operatorname*{box}}{\sim}}%
$-equivalence classes.
\end{itemize}
\end{definition}

\begin{example}
Consider again our running example, with $X=\left[  2\right]  $ and $A=\left[
3\right]  $. Let $g$ be the $L\rightarrow L$ placement%
\[
\fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
.
\]


\textbf{(a)} The $\overset{\operatorname*{box}}{\sim}$-equivalence class of
$g$ is
\[
\left\{  \ \ \fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\ \ \right\}  .
\]


\textbf{(b)} The $\overset{\operatorname*{ball}}{\sim}$-equivalence class of
$g$ is
\begin{align*}
&  \left\{  \ \ \fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\right. \\
&  \ \ \ \ \ \ \ \ \ \ \left.  \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{2}\ \ $}%
\ \ \right\}  .
\end{align*}


\textbf{(c)} The $\underset{\operatorname*{ball}}{\overset{\operatorname*{box}%
}{\sim}}$-equivalence class of $g$ is%
\begin{align*}
&  \left\{  \ \ \fbox{$%
\ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{2}\ \ $}%
\ \ ,\ \ \ \fbox{$%
\ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{2}\ \ $}%
\ \ ,\right. \\
& \\
&  \ \ \ \ \ \ \ \ \ \ \left.  \ \ \fbox{$%
\ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{1}\ \ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{2}\ \ $}%
\ \ ,\ \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(3)\phantom{(2)}}{1}\ \ \ \numboxed{\phantom{(3}(1)(2)\phantom{)}}{2}\ \ $}%
\ \ ,\right. \\
&  \ \ \ \ \ \ \ \ \ \ \left.  \ \ \fbox{$%
\ \ \numboxed{\phantom{(1)}(2)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(2}(1)(3)\phantom{)}}{2}\ \ $}%
\ \ ,\ \ \ \fbox{$%
\ \ \numboxed{\phantom{(2)}(1)\phantom{(3)}}{1}\ \ \ \numboxed{\phantom{(1}(2)(3)\phantom{)}}{2}\ \ $}%
\ \ \right\}  .
\end{align*}

\end{example}

Recall the following crucial general fact about equivalence classes:

\begin{proposition}
Let $\sim$ be an equivalence relation on a set $S$. Let $x\in S$ and $y\in S$.
Then, $x\sim y$ if and only if the $\sim$-equivalence classes of $x$ and $y$
are identical (that is, $\left[  x\right]  _{\sim}=\left[  y\right]  _{\sim}$).
\end{proposition}

Thus, \textquotedblleft counting elements of $S$ up to
equivalence\textquotedblright\ means counting $\sim$-equivalence classes. Thus,

\begin{itemize}
\item by counting $\overset{\operatorname*{ball}}{\sim}$-equivalence classes,
we will be counting placements of boxes in balls where the boxes are unlabelled;

\item similarly for $\overset{\operatorname*{box}}{\sim}$ and
$\underset{\operatorname*{ball}}{\overset{\operatorname*{box}}{\sim}}$.
\end{itemize}

\subsection{$U\rightarrow L$}

\textbf{Recall:} The $U\rightarrow L$ placements are the
$\overset{\operatorname*{ball}}{\sim}$-equivalence classes.

\begin{example}
For $X=\left[  2\right]  $ and $A=\left[  3\right]  $, there are $4$ different
$U\rightarrow L$ placements:%
\[
\text{TODO: picture.}%
\]

\end{example}

\textbf{Notation:} When visualizing a $U\rightarrow L$ placement, we will just
draw the balls as circles, without putting any numbers in them. So the $4$
$U\rightarrow L$ placements for $X=\left[  2\right]  $ and $A=\left[
3\right]  $ are [TODO: picture].

Now, we are ready to count the $U\rightarrow L$ placements in the general setting:

\begin{proposition}
We have%
\begin{align*}
&  \left(  \text{\# of }U\rightarrow L\text{ placements }A\rightarrow X\right)
\\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{N}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right) \\
&  =\dbinom{\left\vert A\right\vert +\left\vert X\right\vert -1}{\left\vert
A\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The second equality sign follows from a theorem in the previous chapter
(Theorem 2.10.4, more precisely the first equality in that theorem).

It remains to prove the first equality sign. First, we WLOG assume that
$X=\left[  \left\vert X\right\vert \right]  $ (so the boxes are labelled
$1,2,\ldots,\left\vert X\right\vert $). Then, consider the bijection%
\begin{align*}
\left\{  U\rightarrow L\text{ placements }A\rightarrow X\right\}   &
\rightarrow\left\{  \left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{N}^{\left\vert X\right\vert }\text{ }\mid\text{ }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right\}  ,\\
\fbox{\ \ \boxed{a_1 \text{ balls}}\ \ \ \boxed{a_2 \text{ balls}}\ \ \ $%
\cdots$\ \ \ \boxed{a_{\left|X\right|} \text{ balls}}\ \ }  &  \mapsto\left(
a_{1},a_{2},\ldots,a_{\left\vert X\right\vert }\right)  .
\end{align*}
(More rigorously: The $\overset{\operatorname*{ball}}{\sim}$-equivalence class
of a map $f:A\rightarrow X$ is sent to the weak composition%
\[
\left(  \left\vert f^{-1}\left(  1\right)  \right\vert ,\left\vert
f^{-1}\left(  2\right)  \right\vert ,\ldots,\left\vert f^{-1}\left(
\left\vert X\right\vert \right)  \right\vert \right)  ,
\]
where%
\[
f^{-1}\left(  x\right)  :=\left\{  a\in A\ \mid\ f\left(  a\right)
=x\right\}  .
\]
To see that this is a bijection, we need to show that if $f,g:A\rightarrow X$
are two maps such that%
\[
\left\vert f^{-1}\left(  x\right)  \right\vert =\left\vert g^{-1}\left(
x\right)  \right\vert \ \ \ \ \ \ \ \ \ \ \text{for all }x\in X,
\]
then $f\overset{\operatorname*{ball}}{\sim}g$.)

Thus, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of }U\rightarrow L\text{ placements }A\rightarrow X\right)
\\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{N}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right)  .
\end{align*}
This is exactly the first equality sign of the proposition.
\end{proof}

Recall: An $L\rightarrow L$ placement is surjective if and only if each box
has at least one ball in it.

We define surjectivity of $U\rightarrow L$ placements in the same way. Thus, a
$\overset{\operatorname*{ball}}{\sim}$-equivalence class is a surjective
$U\rightarrow L$ placement if and only if all its elements are surjective maps.

\begin{proposition}
We have%
\begin{align*}
&  \left(  \text{\# of surjective }U\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{P}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right) \\
&  =\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert -\left\vert
X\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The first equality sign is proved similarly to the previous proposition.

The second equality sign follows from a theorem in the last chapter (Theorem 2.10.1).
\end{proof}

Recall: An $L\rightarrow L$ placement is injective if and only if each box has
at most one ball in it.

We define injectivity of $U\rightarrow L$ placements in the same way. Thus, a
$\overset{\operatorname*{ball}}{\sim}$-equivalence class is an injective
$U\rightarrow L$ placement if and only if all its elements are injective maps.

\begin{proposition}
We have%
\begin{align*}
&  \left(  \text{\# of injective }U\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\left\{  0,1\right\}  ^{\left\vert X\right\vert }\text{
satisfying }x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert
A\right\vert \right) \\
&  =\dbinom{\left\vert X\right\vert }{\left\vert A\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The first equality is proven similarly to above.

The 2nd equality follows from Theorem 2.10.3.
\end{proof}

Thus, our table now looks as follows:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &
$\left\vert X\right\vert ^{\underline{\left\vert A\right\vert }}$ &
$\operatorname*{sur}\left(  \left\vert X\right\vert ,\left\vert A\right\vert
\right)  $\\\hline
$U\rightarrow L$ & $\dbinom{\left\vert A\right\vert +\left\vert X\right\vert
-1}{\left\vert A\right\vert }$ & $\dbinom{\left\vert X\right\vert }{\left\vert
A\right\vert }$ & $\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert
-\left\vert X\right\vert }$\\\hline
$L\rightarrow U$ &  &  & \\\hline
$U\rightarrow U$ &  &  & \\\hline
\end{tabular}
\ \ .
\]


\subsection{$L\rightarrow U$}

Recall: The $L\rightarrow U$ placements are the $\overset{\operatorname*{box}%
}{\sim}$-equivalence classes.

\begin{example}
TODO: picture.
\end{example}

\begin{proposition}
We have%
\[
\left(  \text{\# of injective }L\rightarrow U\text{ placements}\right)
=\left[  \left\vert A\right\vert \leq\left\vert X\right\vert \right]  .
\]

\end{proposition}

\begin{proof}
If $\left\vert A\right\vert >\left\vert X\right\vert $, then the Pigeonhole
Principle shows that no such placements exist, and thus $\left(  \text{\# of
injective }L\rightarrow U\text{ placements}\right)  =0$.

Now assume that $\left\vert A\right\vert \leq\left\vert X\right\vert $. Then,
injective $L\rightarrow U$ placements do exist, and are identical; e.g.,%
\[
\text{TODO: picture.}%
\]
Thus, their \# is $1=\left[  \left\vert A\right\vert \leq\left\vert
X\right\vert \right]  $.
\end{proof}

\textbf{Recall:} If $n\in\mathbb{N}$ and $k\in\mathbb{N}$, then $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
:=\operatorname*{sur}\left(  n,k\right)  /k!$ is called a \textbf{Stirling
number of the 2nd kind}.

\begin{proposition}
We have%
\[
\left(  \text{\# of surjective }L\rightarrow U\text{ placements}\right)  =%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
=\dfrac{\operatorname*{sur}\left(  \left\vert A\right\vert ,\left\vert
X\right\vert \right)  }{\left\vert X\right\vert !}.
\]

\end{proposition}

\begin{proof}
The crux of the proof is the following claim:

\begin{statement}
\textit{Claim 1:} Each $\overset{\operatorname*{box}}{\sim}$-equivalence class
of surjective maps (i.e., each surjective $L\rightarrow U$ placement) contains
exactly $\left\vert X\right\vert !$ many maps $A\rightarrow X$.
\end{statement}

[\textit{Proof of Claim 1:} Consider the $\overset{\operatorname*{box}}{\sim}%
$-equivalence class of some surjective map $g:A\rightarrow X$. The elements of
this class are all maps of the form $\sigma\circ g$ with $\sigma$ a
permutation of $X$. There are $\left\vert X\right\vert !$ many permutations of
$X$, and they all lead to \textbf{distinct} maps $\sigma\circ g$ (because
[TODO: picture] you can tell what $\sigma\left(  x\right)  $ is by looking at
a ball placed in box $x$ by $g$, and checking which box contains this ball in
$\sigma\circ g$). Thus, there are exactly $\left\vert X\right\vert !$ many
distinct maps $\sigma\circ g$ in the class of $g$. This proves Claim 1.]

Now,%
\begin{align*}
&  \operatorname*{sur}\left(  \left\vert A\right\vert ,\left\vert X\right\vert
\right) \\
&  =\left(  \text{\# of surjections }A\rightarrow X\right) \\
&  =\sum_{\substack{C\text{ is a }\overset{\operatorname*{box}}{\sim
}\text{-equivalence}\\\text{class of surjections}}}\underbrace{\left\vert
C\right\vert }_{\substack{=\left\vert X\right\vert !\\\text{(by Claim 1)}%
}}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split the sum}\\
\text{according to the }\overset{\operatorname*{box}}{\sim}\text{-equivalence
class}%
\end{array}
\right) \\
&  =\sum_{\substack{C\text{ is a }\overset{\operatorname*{box}}{\sim
}\text{-equivalence}\\\text{class of surjections}}}\left\vert X\right\vert
!=\left(  \text{\# of }\overset{\operatorname*{box}}{\sim}\text{-equivalence
classes of surjections}\right)  \cdot\left\vert X\right\vert !.
\end{align*}

\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-11-10}}
\end{center}

\begin{proof}
Thus, dividing by $\left\vert X\right\vert !$, we obtain%
\begin{align*}
&  \left(  \text{\# of }\overset{\operatorname*{box}}{\sim}\text{-equivalence
classes of surjections}\right) \\
&  =\operatorname*{sur}\left(  \left\vert A\right\vert ,\left\vert
X\right\vert \right)  /\left\vert X\right\vert !=%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
\end{align*}
(since $%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$ was defined to be $\operatorname*{sur}\left(  \left\vert A\right\vert
,\left\vert X\right\vert \right)  /\left\vert X\right\vert !$).
\end{proof}

\begin{proposition}
We have%
\[
\left(  \text{\# of }L\rightarrow U\text{ placements }A\rightarrow X\right)  =%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{0}%
%EndExpansion
+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{1}%
%EndExpansion
+\cdots+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
.
\]

\end{proposition}

\begin{proof}
We can prove a better claim: For each $k\in\left\{  0,1,\ldots,\left\vert
X\right\vert \right\}  $, we have%
\[
\left(  \text{\# of }L\rightarrow U\text{ placements with exactly }k\text{
nonempty boxes}\right)  =%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{k}%
%EndExpansion
.
\]
(This is not hard to see, because in an $L\rightarrow 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\in\left\{  0,1,\ldots,\left\vert
X\right\vert \right\}  $, we obtain precisely the claim of the proposition.
(Details LTTR.)
\end{proof}

Thus, our table now looks as follows:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &
$\left\vert X\right\vert ^{\underline{\left\vert A\right\vert }}$ &
$\operatorname*{sur}\left(  \left\vert X\right\vert ,\left\vert A\right\vert
\right)  $\\\hline
$U\rightarrow L$ & $\dbinom{\left\vert A\right\vert +\left\vert X\right\vert
-1}{\left\vert A\right\vert }$ & $\dbinom{\left\vert X\right\vert }{\left\vert
A\right\vert }$ & $\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert
-\left\vert X\right\vert }$\\\hline
$L\rightarrow U$ & $%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{0}%
%EndExpansion
+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{1}%
%EndExpansion
+\cdots+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$ & $\left[  \left\vert A\right\vert \leq\left\vert X\right\vert \right]  $ &
$%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$\\\hline
$U\rightarrow U$ &  &  & \\\hline
\end{tabular}
\ \ \ .
\]


Let us say a few words about an equivalent version of surjective $L\rightarrow
U$ placements: the set partitions.

\begin{definition}
Let $S$ be a set.

\textbf{(a)} A \textbf{set partition} of $S$ is a set $\mathcal{F}$ of
disjoint nonempty subsets of $S$ such that the union of these subsets is $S$.

In other words, a set partition of $S$ is a set $\left\{  S_{1},S_{2}%
,\ldots,S_{k}\right\}  $ of nonempty subsets of $S$ such that each element of
$S$ lies in exactly one $S_{i}$. (Here, we are assuming that $S$ is finite.)

\textbf{(b)} If $\mathcal{F}$ is a set partition of $S$, then the elements of
$\mathcal{F}$ are called the \textbf{parts} (or \textbf{blocks}) of
$\mathcal{F}$. Keep in mind that they are subsets of $S$.

\textbf{(c)} If a set partition $\mathcal{F}$ of $S$ has $k$ parts, then we
say that $\mathcal{F}$ is a \textbf{set partition of }$S$ \textbf{into }%
$k$\textbf{ parts}.
\end{definition}

\begin{example}
Here are all set partitions of the set $\left[  3\right]  =\left\{
1,2,3\right\}  $:
\begin{align*}
&  \left\{  \left\{  1,2,3\right\}  \right\}  ,\ \ \ \ \ \ \ \ \ \ \left\{
\left\{  1,2\right\}  ,\left\{  3\right\}  \right\}
,\ \ \ \ \ \ \ \ \ \ \left\{  \left\{  1,3\right\}  ,\left\{  2\right\}
\right\}  ,\ \ \ \ \ \ \ \ \ \ \left\{  \left\{  2,3\right\}  ,\left\{
1\right\}  \right\}  ,\\
&  \left\{  \left\{  1\right\}  ,\left\{  2\right\}  ,\left\{  3\right\}
\right\}  .
\end{align*}
And here are the same set partitions, drawn as pictures (each part of the set
partition corresponds to a blob):%
\[%
\begin{array}
[c]{c|c|c|c|c}%
\begin{tikzpicture} \draw (0.7, 0.5) ellipse (1.3 and 1.3); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at +(0: 1.5) {2}; \node (c) at +(60: 1.5) {3}; \end{tikzpicture} &
\begin{tikzpicture} \draw[rotate=-30] (0, 0.6) ellipse (.5 and 1.4); \draw (1.5, 0) ellipse (0.5 and 0.5); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at +(0: 1.5) {2}; \node (c) at +(60: 1.5) {3}; \end{tikzpicture} &
\begin{tikzpicture} \draw (0.75, 0) ellipse (1.4 and .5); \draw (0.8, 1.3) ellipse (0.5 and 0.5); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at +(0: 1.5) {2}; \node (c) at +(60: 1.5) {3}; \end{tikzpicture} &
\begin{tikzpicture} \draw[rotate=30] (1.3, -0.1) ellipse (.5 and 1.4); \draw (0, 0) ellipse (0.5 and 0.5); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at +(0: 1.5) {2}; \node (c) at +(60: 1.5) {3}; \end{tikzpicture} &
\begin{tikzpicture} \draw (0, 0) ellipse (0.5 and 0.5); \draw (1.5, 0) ellipse (0.5 and 0.5); \draw (0.75, 1.3) ellipse (0.5 and 0.5); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at +(0: 1.5) {2}; \node (c) at +(60: 1.5) {3}; \end{tikzpicture}
\end{array}
\]

\end{example}

\begin{proposition}
Let $A$ be an $n$-element set. Let $k\in\mathbb{N}$. Then,
\[
\left(  \text{\# of set partitions of }A\text{ into }k\text{ parts}\right)  =%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
.
\]

\end{proposition}

\begin{proof}
Let $X=\left[  k\right]  $. Then, there is a bijection%
\begin{align*}
\left\{  \text{set partitions of }A\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \text{surjective }L\rightarrow U\text{ placements
}A\rightarrow X\right\}  ,\\
\left\{  S_{1},S_{2},\ldots,S_{k}\right\}   &  \mapsto\left(  \text{all
elements in }S_{i}\text{ go into box }i\right)  .
\end{align*}
(This is well-defined, because the resulting $L\rightarrow U$ placement does
not depend on the order in which we have listed the blocks of our set
partition; any two orders lead to $\overset{\operatorname*{box}}{\sim}%
$-equivalent maps.)
\end{proof}

Recall that we have shown a bunch of properties of $\operatorname*{sur}\left(
m,n\right)  $. Since $%
%TCIMACRO{\QDATOPD{\{}{\}}{m}{n}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{m}{n}%
%EndExpansion
=\operatorname*{sur}\left(  m,n\right)  /n!$, we can translate them into
properties of $%
%TCIMACRO{\QDATOPD{\{}{\}}{m}{n}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{m}{n}%
%EndExpansion
$:

\begin{proposition}
Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$.

\textbf{(a)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{0}%
%EndExpansion
=\left[  n=0\right]  $.

\textbf{(b)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{0}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{0}{k}%
%EndExpansion
=\left[  k=0\right]  $.

\textbf{(c)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
=0$ if $k>n$.

\textbf{(d)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
=%
%TCIMACRO{\QDATOPD{\{}{\}}{n-1}{k-1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n-1}{k-1}%
%EndExpansion
+k%
%TCIMACRO{\QDATOPD{\{}{\}}{n-1}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n-1}{k}%
%EndExpansion
$ if $n>0$ and $k>0$.

\textbf{(e)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
=\sum\limits_{j=0}^{n-1}\dbinom{n}{j}%
%TCIMACRO{\QDATOPD{\{}{\}}{j}{k-1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{j}{k-1}%
%EndExpansion
/k$.

\textbf{(f)} We have $%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{k}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{k}%
%EndExpansion
=\dfrac{1}{k!}\sum\limits_{i=0}^{k}\left(  -1\right)  ^{k-i}\dbinom{k}{i}%
i^{n}$.
\end{proposition}

\begin{proof}
\textbf{(a)} Follows from Proposition \ref{prop.binom.surm0-etc} \textbf{(a)}.

\textbf{(b)} Follows from Proposition \ref{prop.binom.surm0-etc} \textbf{(d)}.

\textbf{(c)} Follows from Proposition \ref{prop.binom.surm0-etc} \textbf{(f)}.

\textbf{(d)} Follows from Proposition \ref{prop.binom.surmn-rec2}.

\textbf{(e)} Follows from Proposition \ref{prop.binom.surmn-rec1}.

\textbf{(f)} Follows from Theorem \ref{thm.binom.surmn-as-altsum}.
\end{proof}

\begin{remark}
Let $n\in\mathbb{N}$. The $n$\textbf{-th Bell number} $B\left(  n\right)  $ is
defined as the \# of all set partitions of $\left[  n\right]  $. Thus,
\[
B\left(  n\right)  =%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{0}%
%EndExpansion
+%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{1}%
%EndExpansion
+\cdots+%
%TCIMACRO{\QDATOPD{\{}{\}}{n}{n}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{n}{n}%
%EndExpansion
.
\]
For example, $B\left(  3\right)  =5$.

There is no explicit formula for $B\left(  n\right)  $, but there is a
recursion:%
\[
B\left(  n+1\right)  =\sum_{i=0}^{n}\dbinom{n}{i}B\left(  i\right)  .
\]


See \cite[\S 0.3.2]{18s-hw3s} for more about these.
\end{remark}

\subsection{$U\rightarrow U$ and integer partitions}

It remains to count $U\rightarrow U$ placements.

A $U\rightarrow U$ placement looks like this:%
\[
\fbox{\ \ \fbox{$\bullet\bullet\bullet$}\ \ \fbox{}\ \ \fbox{$\bullet
$}\ \ \fbox{$\bullet\bullet$}\ \ \fbox{}\ \ \fbox{$\bullet\bullet$}%
\ \ \fbox{}\ \ \ }%
\]
but the boxes, too, are interchangeable. Thus, we can order the boxes by
decreasing number of balls:%
\[
\fbox{\ \ \fbox{$\bullet\bullet\bullet$}\ \ \fbox{$\bullet\bullet$}%
\ \ \fbox{$\bullet\bullet$}\ \ \fbox{$\bullet$}\ \ \fbox{}\ \ \fbox{}%
\ \ \fbox{}\ \ \ }\ \ .
\]
You can encode this $U\rightarrow U$ placement by a sequence of numbers, which
say how many balls lie in each box:%
\[
\left(  3,2,2,1,0,0,0\right)  .
\]
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:

\begin{defi}
A \textbf{partition} of an integer $n$ is a weakly decreasing list $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $ of positive integers whose sum is $n$ (that
is, $a_{1}\geq a_{2}\geq\cdots\geq a_{k}>0$ and $a_{1}+a_{2}+\cdots+a_{k}=n$).

Instead of \textquotedblleft partition\textquotedblright, we can also say
\textquotedblleft integer partition\textquotedblright.

The integers $a_{1},a_{2},\ldots,a_{k}$ are called the \textbf{parts} of the partition.

If a partition of $n$ has $k$ parts, then we say that it is a
\textbf{partition of }$n$ \textbf{into }$k$ \textbf{parts}.
\end{defi}

\begin{example}
The partitions of $5$ are%
\[
\left(  5\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  4,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  3,2\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
3,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,2,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  2,1,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
1,1,1,1,1\right)  .
\]

\end{example}

\begin{remark}
A partition of $n$ is the same as a weakly decreasing composition of $n$.
\end{remark}

\begin{definition}
Let $n\in\mathbb{Z}$ and $k\in\mathbb{N}$. Then, we set%
\[
p_{k}\left(  n\right)  =\left(  \text{\# of partitions of }n\text{ into
}k\text{ parts}\right)  .
\]

\end{definition}

\begin{example}%
\begin{align*}
p_{0}\left(  5\right)   &  =0,\ \ \ \ \ \ \ \ \ \ p_{1}\left(  5\right)
=1,\ \ \ \ \ \ \ \ \ \ p_{2}\left(  5\right)  =2,\ \ \ \ \ \ \ \ \ \ p_{3}%
\left(  5\right)  =2,\\
p_{4}\left(  5\right)   &  =1,\ \ \ \ \ \ \ \ \ \ p_{5}\left(  5\right)
=1,\ \ \ \ \ \ \ \ \ \ p_{k}\left(  5\right)  =0\text{ for }k>5.
\end{align*}

\end{example}

\begin{proposition}
\textbf{(a)} $p_{k}\left(  n\right)  =0$ when $n<0$.

\textbf{(b)} $p_{k}\left(  n\right)  =0$ when $k>n$.

\textbf{(c)} $p_{0}\left(  n\right)  =\left[  n=0\right]  $.

\textbf{(d)} $p_{1}\left(  n\right)  =\left[  n>0\right]  $.

\textbf{(e)} $p_{k}\left(  n\right)  =p_{k}\left(  n-k\right)  +p_{k-1}\left(
n-1\right)  $ for all $n\in\mathbb{Z}$ and $k\geq1$.

\textbf{(f)} $p_{2}\left(  n\right)  =\left\lfloor n/2\right\rfloor $ if
$n\geq0$.
\end{proposition}

\begin{proof}
\textbf{(a)} A sum of positive integers is never negative.

\textbf{(b)} If $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a partition of
$n$ into $k$ parts, then%
\[
n=\underbrace{a_{1}}_{\geq1}+\underbrace{a_{2}}_{\geq1}+\cdots
+\underbrace{a_{k}}_{\geq1}\geq\underbrace{1+1+\cdots+1}_{k\text{ times}}=k.
\]
Thus, no such partition exists if $k>n$.

\textbf{(c)} A partition of $n$ into $0$ parts is a $0$-tuple of positive
integers whose sum is $n$. But the sum of a $0$-tuple is always $0$. So such a
partition exists only for $n=0$, and is unique. Thus, $p_{0}\left(  n\right)
=1$ if $n=0$ and is $0$ otherwise.

\textbf{(d)} If $n>0$, then there is only one partition of $n$ into $1$ part,
namely the $1$-tuple $\left(  n\right)  $. If $n=0$, then there is no
partition of $n$ into $1$ part.

\textbf{(e)} Let us call a partition of $n$

\begin{itemize}
\item \textbf{red} if $1$ is a part of it;

\item \textbf{green} if $1$ is not a part of it.
\end{itemize}

Any red partition of $n$ must end with a $1$ (since it contains a $1$ but is
weakly decreasing). Thus, there is a bijection
\begin{align*}
\left\{  \text{red partitions of }n\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \text{partitions of }n-1\text{ into }k-1\text{
parts}\right\}  ,\\
\left(  a_{1},a_{2},\ldots,a_{k-1},1\right)   &  \mapsto\left(  a_{1}%
,a_{2},\ldots,a_{k-1}\right)  .
\end{align*}
Hence, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of red partitions of }n\text{ into }k\text{ parts}\right)
\\
&  =\left(  \text{\# of partitions of }n-1\text{ into }k-1\text{
parts}\right)  =p_{k-1}\left(  n-1\right)  .
\end{align*}


All entries of a green partition of $n$ are $>1$ (since they are positive
integers and $\neq1$). Thus, there is a bijection%
\begin{align*}
\left\{  \text{green partitions of }n\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \text{partition of }n-k\text{ into }k\text{ parts}\right\}
\\
\left(  a_{1},a_{2},\ldots,a_{k}\right)   &  \mapsto\left(  a_{1}%
-1,a_{2}-1,\ldots,a_{k}-1\right)  .
\end{align*}
Hence, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of green partitions of }n\text{ into }k\text{
parts}\right) \\
&  =\left(  \text{\# of partitions of }n-k\text{ into }k\text{ parts}\right)
=p_{k}\left(  n-k\right)  .
\end{align*}


Adding these two equalities together, we get the claim of \textbf{(e)}.

\textbf{(f)} The partitions of $n$ into $2$ parts are%
\[
\left(  n-1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  n-2,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  n-3,3\right)  ,\ \ \ \ \ \ \ \ \ \ \ldots
,\ \ \ \ \ \ \ \ \ \ \left(  \left\lceil n/2\right\rceil ,\left\lfloor
n/2\right\rfloor \right)
\]
(where $\left\lceil x\right\rceil $ denotes the ceiling of the real number
$x$). So there are $\left\lfloor n/2\right\rfloor $ many of them.
\end{proof}

\begin{proposition}
We have%
\[
\left(  \text{\# of surjective }U\rightarrow U\text{ placements }A\rightarrow
X\right)  =p_{\left\vert X\right\vert }\left(  \left\vert A\right\vert
\right)  .
\]

\end{proposition}

\begin{proof}
Proof idea: Encode a surjective $U\rightarrow U$ placement as a partition of
$\left\vert A\right\vert $ into $\left\vert X\right\vert $ parts: namely the
partition $\left(  a_{1},a_{2},\ldots,a_{\left\vert X\right\vert }\right)  $,
where%
\[
a_{i}=\left(  \text{\# of balls in the box with the }i\text{-th largest \# of
balls}\right)  .
\]
This is a bijection.
\end{proof}

\begin{proposition}
We have%
\[
\left(  \text{\# of injective }U\rightarrow U\text{ placements }A\rightarrow
X\right)  =\left[  \left\vert A\right\vert \leq\left\vert X\right\vert
\right]  .
\]

\end{proposition}

\begin{proof}
This follows from the corresponding fact about $L\rightarrow U$ placements.
\end{proof}

\begin{proposition}
We have%
\[
\left(  \text{\# of }U\rightarrow U\text{ placements }A\rightarrow X\right)
=p_{0}\left(  \left\vert A\right\vert \right)  +p_{1}\left(  \left\vert
A\right\vert \right)  +\cdots+p_{\left\vert X\right\vert }\left(  \left\vert
A\right\vert \right)  .
\]

\end{proposition}

\begin{proof}
Similar to the proof for \# of $L\rightarrow U$ placements.
\end{proof}

Thus, we have obtained a full table:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &
$\left\vert X\right\vert ^{\underline{\left\vert A\right\vert }}$ &
$\operatorname*{sur}\left(  \left\vert X\right\vert ,\left\vert A\right\vert
\right)  $\\\hline
$U\rightarrow L$ & $\dbinom{\left\vert A\right\vert +\left\vert X\right\vert
-1}{\left\vert A\right\vert }$ & $\dbinom{\left\vert X\right\vert }{\left\vert
A\right\vert }$ & $\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert
-\left\vert X\right\vert }$\\\hline
$L\rightarrow U$ & $%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{0}%
%EndExpansion
+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{1}%
%EndExpansion
+\cdots+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$ & $\left[  \left\vert A\right\vert \leq\left\vert X\right\vert \right]  $ &
$%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$\\\hline
$U\rightarrow U$ & $p_{0}\left(  \left\vert A\right\vert \right)
+p_{1}\left(  \left\vert A\right\vert \right)  +\cdots+p_{\left\vert
X\right\vert }\left(  \left\vert A\right\vert \right)  $ & $\left[  \left\vert
A\right\vert \leq\left\vert X\right\vert \right]  $ & $p_{\left\vert
X\right\vert }\left(  \left\vert A\right\vert \right)  $\\\hline
\end{tabular}
\ \ \ .
\]


By the way, what if we add an extra column for \textquotedblleft
bijective\textquotedblright?%
\[%
\begin{tabular}
[c]{|c||c|c|c|c|}\hline
& arbitrary & injective & surjective & bijective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &
$\left\vert X\right\vert ^{\underline{\left\vert A\right\vert }}$ &
$\operatorname*{sur}\left(  \left\vert X\right\vert ,\left\vert A\right\vert
\right)  $ & $\left[  \left\vert A\right\vert =\left\vert X\right\vert
\right]  \cdot\left\vert X\right\vert !$\\\hline
$U\rightarrow L$ & $\dbinom{\left\vert A\right\vert +\left\vert X\right\vert
-1}{\left\vert A\right\vert }$ & $\dbinom{\left\vert X\right\vert }{\left\vert
A\right\vert }$ & $\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert
-\left\vert X\right\vert }$ & $\left[  \left\vert A\right\vert =\left\vert
X\right\vert \right]  $\\\hline
$L\rightarrow U$ & $%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{0}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{0}%
%EndExpansion
+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{1}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{1}%
%EndExpansion
+\cdots+%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$ & $\left[  \left\vert A\right\vert \leq\left\vert X\right\vert \right]  $ &
$%
%TCIMACRO{\QDATOPD{\{}{\}}{\left\vert A\right\vert }{\left\vert X\right\vert
%}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{\left\vert A\right\vert }{\left\vert X\right\vert }%
%EndExpansion
$ & $\left[  \left\vert A\right\vert =\left\vert X\right\vert \right]
$\\\hline
$U\rightarrow U$ & $p_{0}\left(  \left\vert A\right\vert \right)
+p_{1}\left(  \left\vert A\right\vert \right)  +\cdots+p_{\left\vert
X\right\vert }\left(  \left\vert A\right\vert \right)  $ & $\left[  \left\vert
A\right\vert \leq\left\vert X\right\vert \right]  $ & $p_{\left\vert
X\right\vert }\left(  \left\vert A\right\vert \right)  $ & $\left[  \left\vert
A\right\vert =\left\vert X\right\vert \right]  $\\\hline
\end{tabular}
\ \ \ \ .
\]
So that's not a very interesting column.

\begin{center}
\fbox{\textbf{Class of 2019-11-15}}
\end{center}

\subsection{Integer partitions (an introduction)}

Recall the following notations we introduced (for $n\in\mathbb{Z}$ and
$k\in\mathbb{N}$):

\begin{itemize}
\item $p\left(  n\right)  =\left(  \text{\# of partitions of }n\right)  $.

\item $p_{k}\left(  n\right)  :=\left(  \text{\# of partitions of }n\text{
into }k\text{ parts}\right)  $.
\end{itemize}

One of the propositions from last time says that%
\[
p_{k}\left(  n\right)  =p_{k}\left(  n-k\right)  +p_{k-1}\left(  n-k\right)
\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{Z}\text{ and }k\geq1.
\]


Also, it is obvious that%
\[
p\left(  n\right)  =p_{0}\left(  n\right)  +p_{1}\left(  n\right)
+\cdots+p_{n}\left(  n\right)  .
\]


Let us count partitions with some more special properties.

\begin{definition}
Let $n\in\mathbb{Z}$.

\textbf{(a)} Let
\begin{align*}
p_{\operatorname*{odd}}\left(  n\right)   &  =\left(  \text{\# of partitions
of }n\text{ into odd parts}\right) \\
&  =\left(  \text{\# of partitions }\left(  a_{1},a_{2},\ldots,a_{k}\right)
\text{ of }n\text{ such that all }a_{i}\text{ are odd}\right)  .
\end{align*}


\textbf{(b)} Let%
\begin{align*}
p_{\operatorname*{dist}}\left(  n\right)   &  =\left(  \text{\# of partitions
of }n\text{ into distinct parts}\right) \\
&  =\left(  \text{\# of partitions }\left(  a_{1},a_{2},\ldots,a_{k}\right)
\text{ of }n\text{ such that }a_{1}>a_{2}>\cdots>a_{k}\right)  .
\end{align*}

\end{definition}

\begin{example}
\textbf{(a)} We have%
\[
p_{\operatorname*{odd}}\left(  7\right)  =\left\vert \left\{  \left(
7\right)  ,\left(  5,1,1\right)  ,\left(  3,3,1\right)  ,\left(
3,1,1,1,1\right)  ,\left(  1,1,1,1,1,1,1\right)  \right\}  \right\vert =5.
\]


\textbf{(b)} We have%
\[
p_{\operatorname*{dist}}\left(  7\right)  =\left\vert \left\{  \left(
7\right)  ,\left(  6,1\right)  ,\left(  5,2\right)  ,\left(  4,3\right)
,\left(  4,2,1\right)  \right\}  \right\vert =5.
\]

\end{example}

\begin{theorem}
(Euler) Let $n\in\mathbb{Z}$. Then, $p_{\operatorname*{odd}}\left(  n\right)
=p_{\operatorname*{dist}}\left(  n\right)  $.
\end{theorem}

\begin{proof}
Here is a rough outline. See \cite{Andrews317} for a more detailed version
(albeit with a slightly different version of the bijection).

We construct a map%
\[
A:\left\{  \text{partitions of }n\text{ into odd parts}\right\}
\rightarrow\left\{  \text{partitions of }n\text{ into distinct parts}\right\}
\]
which transforms a partition as follows: Repeatedly merge two equal parts
until no more equal parts can be found. \textquotedblleft Merging two equal
parts\textquotedblright\ means replacing two equal parts $a,a$ by the single
part $2a$, and (if necessarily) rearranging the resulting tuple back into
weakly decreasing order.

(\textit{Examples:} Let us compute $A\left(  5,5,3,1,1,1\right)  $:%
\[
\left(  \underline{5,5},3,1,1,1\right)  \rightarrow\left(
10,3,\underline{1,1},1\right)  \rightarrow\left(  10,3,2,1\right)
\]
(where we underline equal entries that are about to get merged). Thus,
$A\left(  5,5,3,1,1,1\right)  =\left(  10,3,2,1\right)  $.

Let us compute $A\left(  5,3,1,1,1,1\right)  $:%
\[
\left(  5,3,\underline{1,1},1,1\right)  \rightarrow\left(
5,3,2,\underline{1,1}\right)  \rightarrow\left(  5,3,\underline{2,2}\right)
\rightarrow\left(  5,4,3\right)  .
\]
Thus, $A\left(  5,3,1,1,1,1\right)  =\left(  5,4,3\right)  $.)

Why is this map $A$ well-defined? This is not obvious.

Our definition of $A$ was non-deterministic: It tells us to merge equal parts;
but it does not tell us which equal parts to choose first (and there can be
several choices). Thus, we have to prove that the result of our many merges
does not depend on the order in which we do the merges.

One way to prove this is using something called the \textbf{diamond lemma}.
Another way is by writing the parts of the partitions in binary (this is what
Andrews does in \cite{Andrews317}; he doesn't even talk about merging).

The inverse of $A$ transforms a partition by repeatedly splitting even parts
into two equal pieces.

(The map $A$ is called the Glaisher bijection; there are several other
bijections that work.)
\end{proof}

\begin{proposition}
Let $n\in\mathbb{Z}$ and $k>0$. Then,%
\[
p_{k}\left(  n\right)  =\left(  \text{\# of partitions of }n\text{ whose
largest part is }k\right)  .
\]

\end{proposition}

\begin{example}
We have $p_{3}\left(  5\right)  =\left(  \text{\# of partitions of }5\text{
whose largest part is }3\right)  $ (indeed, both numbers are $2$). Indeed, the
partitions of $5$ into $3$ parts are $\left(  3,1,1\right)  $ and $\left(
2,2,1\right)  $.
\end{example}

\begin{proof}
Picture proof: e.g., let $n=14$ and $k=4$. Start with the partition
$\lambda=\left(  5,4,4,1\right)  $ of $n$ into $k$ parts. Draw a table of $k$
left-aligned rows, where the length of each row equals the corresponding part
of $\lambda$:%
\[%
\begin{tabular}
[c]{l|l|llll}\cline{2-6}%
$5\rightarrow$ & \phantom{w} & \phantom{w} & \multicolumn{1}{|l}{\phantom{w}}
& \multicolumn{1}{|l}{\phantom{w}} & \multicolumn{1}{|l|}{\phantom{w}}%
\\\cline{2-5}\cline{2-6}%
$4\rightarrow$ &  &  & \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &
\multicolumn{1}{|l}{}\\\cline{2-5}%
$4\rightarrow$ &  &  & \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &
\multicolumn{1}{|l}{}\\\cline{2-2}\cline{2-5}%
$1\rightarrow$ &  &  &  &  & \\\cline{2-2}%
\end{tabular}
\ \ .
\]


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:%
\[%
\begin{tabular}
[c]{lllll}
& $5$ & $4$ & $4$ & $1$\\
& $\downarrow$ & $\downarrow$ & $\downarrow$ & $\downarrow$\\\cline{2-5}
& \multicolumn{1}{|l}{\phantom{w}} & \multicolumn{1}{|l}{\phantom{w}} &
\multicolumn{1}{|l}{\phantom{w}} & \multicolumn{1}{|l|}{\phantom{w}}%
\\\cline{2-5}
& \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &
\multicolumn{1}{|l}{}\\\cline{2-4}
& \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &
\multicolumn{1}{|l}{}\\\cline{2-4}
& \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &
\multicolumn{1}{|l}{}\\\cline{2-2}\cline{2-4}
& \multicolumn{1}{|l}{} & \multicolumn{1}{|l}{} &  & \\\cline{2-2}%
\end{tabular}
\ \ .
\]


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 $\left(  4,3,3,3,1\right)  $.

Thus, we obtain a map%
\[
\left\{  \text{partitions of }n\text{ into }k\text{ parts}\right\}
\rightarrow\left\{  \text{partitions of }n\text{ whose largest part is
}k\right\}  ,
\]
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 \textbf{conjugation of partitions}. The bijection
principle now yields the proposition.

(Note: The table that we constructed above is called the \textbf{Young
diagram} of $\lambda$, or the \textbf{Ferrers diagram} of $\lambda$.)
\end{proof}

\begin{definition}
For any $k\in\mathbb{Z}$, define $w_{k}\in\mathbb{N}$ by
\[
w_{k}=\dfrac{\left(  3k-1\right)  k}{2}.
\]
This is called a \textbf{pentagonal number}.
\end{definition}

\begin{theorem}
(Euler's recursion for the partition numbers)

For each $n>0$, we have%
\begin{align*}
p\left(  n\right)   &  =p\left(  n-1\right)  +p\left(  n-2\right)  -p\left(
n-5\right)  -p\left(  n-7\right)  +p\left(  n-12\right)  +p\left(
n-15\right)  \pm\cdots\\
&  =\sum_{\substack{k\in\mathbb{Z};\\k\neq0}}\left(  -1\right)  ^{k-1}p\left(
n-w_{k}\right)  .
\end{align*}

\end{theorem}

We might get to prove this later on, using the technique of \textbf{generating
functions}.

There is, of course, much more to say about partitions. See \cite{Wilf09} or
\cite{AndEri04} for two introductions.

\subsection{Odds and ends}

Here are some random counting exercises.

\begin{exercise}
Given $n$ persons ($n>0$) and $k$ tasks ($k>0$).

\textbf{(a)} What is the \# of ways to assign a task to each person such that
each task has at least $1$ person working on it?

\textbf{(b)} What if we additionally want to choose a leader for each task
(among the people assigned to this task)?

\textbf{(c)} What if, instead, we want to choose a vertical hierarchy (between
all people working on the task) for each task? (A \textquotedblleft vertical
hierachy\textquotedblright\ means a ranking of all people working on the task,
with no ties.)

\textbf{Example:} Assume $n=8$ and $k=3$. Let our $8$ people be
$1,2,3,4,5,6,7,8$, and let our $3$ tasks be $A,B,C$.

\textbf{(a)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1,2,5$\\\hline
$B$ & $3$\\\hline
$C$ & $4,6,7,8$\\\hline
\end{tabular}
\
\]


\textbf{(b)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1,2,5$ with leader $2$\\\hline
$B$ & $3$ with leader $3$\\\hline
$C$ & $4,6,7,8$ with leader $7$\\\hline
\end{tabular}
\]


\textbf{(c)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1>5>2$\\\hline
$B$ & $3$\\\hline
$C$ & $7>8>4>6$\\\hline
\end{tabular}
\
\]
(where the \textquotedblleft$>$\textquotedblright\ signs stand for
\textquotedblleft is ranked above\textquotedblright).
\end{exercise}

\begin{proof}
(Solution sketch.)

\textbf{(a)} $\operatorname*{sur}\left(  n,k\right)  $.

\textit{Proof.} Choosing such an arrangement is tantamount to choosing a
surjection $\left\{  \text{people}\right\}  \rightarrow\left\{  \text{tasks}%
\right\}  $.

\textbf{(b)} $n^{\underline{k}}\cdot k^{n-k}$.

\textit{Proof.} First, choose a leader for each task. There are
$n^{\underline{k}}$ options for this. Then, every of the remaining $n-k$
people joins one of the $k$ leaders. There are $k^{n-k}$ options for this.

\textbf{(c)} $n!\cdot\dbinom{n-1}{k-1}$.

\textit{Proof.} First, order all the $n$ people in some way. There are $n!$
options for this. Then, split this ordering into $k$ nonempty chunks. There
are $\dbinom{n-1}{k-1}$ options for this, since we need to put $k-1$
separators into the $n-1$ positions between two consecutive people in our ordering.
\end{proof}

\begin{exercise}
Let $n\in\mathbb{N}$. How many compositions of $n$ have the property that all
entries of the composition belong to $\left\{  1,2\right\}  $ ?

(For example, for $n=5$, these compositions are%
\begin{align*}
&  \left(  1,1,1,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,1,1,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,1,2,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
1,2,1,1\right)  ,\\
&  \left(  2,1,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,2,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  2,1,2\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
1,1,2\right)  .
\end{align*}

\end{exercise}

\begin{proof}
Answer: the Fibonacci number $f_{n+1}$.

\textit{Proof 1:} strong induction on $n$.

\textit{Proof 2:} bijection to lacunar subsets.

\textit{Proof 3:} bijection to domino tilings.
\end{proof}

\begin{center}
\fbox{\textbf{Class of 2019-11-18}}
\end{center}

\section{Permutations}

\subsection{Introduction}

We will now talk about permutations in more detail. For deeper treatments, see
[B\'{o}na: Combinatorics of Permutations] and [Sagan: The symmetric group] and
[Stanley: Enumerative Combinatorics, vol. 1. Ch. 1].

Recall: A \textbf{permutation} of a set $X$ is a bijection from $X$ to $X$.

\subsection{Definitions}

\begin{definition}
Let $n\in\mathbb{N}$. Let $S_{n}$ be the set of all permutations of $\left[
n\right]  $. This set $S_{n}$ is called the $n$\textbf{-th symmetric group}.
It is closed under composition (i.e., for any $\alpha\in S_{n}$ and $\beta\in
S_{n}$, we have $\alpha\circ\beta\in S_{n}$), and under inverses (i.e., for
any $\sigma\in S_{n}$, we have $\sigma^{-1}\in S_{n}$) and contains
$\operatorname*{id}\nolimits_{\left[  n\right]  }$.
\end{definition}

\begin{definition}
Let $n\in\mathbb{N}$ and $\sigma\in S_{n}$. We introduce two notations for
$\sigma$:

\textbf{(a)} The \textbf{one-line notation} of $\sigma$ is the $n$-tuple
$\left(  \sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  n\right)  \right)  $. (Conventionally, authors use square
brackets for it, but we use parentheses.)

\textbf{(b)} The \textbf{cycle digraph} of $\sigma$ is defined (informally) as follows:

For each $i\in\left[  n\right]  $, draw a point (\textquotedblleft
node\textquotedblright) labelled $i$.

For each $i\in\left[  n\right]  $, draw an arrow (\textquotedblleft
arc\textquotedblright) from the node labelled $i$ to the node labelled
$\sigma\left(  i\right)  $.

The result is called the \textbf{cycle digraph} of $\sigma$.
\end{definition}

\subsection{Transpositions and cycles}

\begin{definition}
\textbf{(a)} Let $i$ and $j$ be two distinct elements of a set $X$.

Then, the \textbf{transposition} $t_{i,j}$ is the permutation of $X$ that
sends $i$ to $j$, sends $j$ to $i$, and leaves all other elements in their places.

If $X=\left[  n\right]  $ for some $n\in\mathbb{N}$, and if $i<j$, then the
one-line notation of $t_{i,j}$ is%
\[
\left(  \underbrace{1,2,\ldots,i-1}_{\text{numbers from }1\text{ to }%
i-1},j,\underbrace{i+1,i+2,\ldots,j-1}_{\text{numbers from }i+1\text{ to }%
j-1},i,\underbrace{j+1,j+2,\ldots,n}_{\text{numbers from }j+1\text{ to }%
n}\right)  .
\]


\textbf{(b)} Let $n\in\mathbb{N}$ and $i\in\left[  n-1\right]  $. Then, the
\textbf{simple transposition }$s_{i}$ is defined by $s_{i}=t_{i,i+1}\in S_{n}%
$. So a simple transposition is a transposition that swaps two consecutive integers.
\end{definition}

\begin{convention}
If $\alpha$ and $\beta$ are two permutations of a set $X$, then we write
$\alpha\beta$ for $\alpha\circ\beta$.

Also, $\alpha^{i}:=\underbrace{\alpha\circ\alpha\circ\cdots\circ\alpha
}_{i\text{ times}}$. If $i=0$, this is understood to be $\operatorname*{id}%
\nolimits_{X}$.
\end{convention}

\begin{proposition}
Let $n\in\mathbb{N}$.

\textbf{(a)} We have $s_{i}^{2}=\operatorname*{id}$ for all $i\in\left[
n-1\right]  $. (Recall: $s_{i}^{2}=s_{i}\circ s_{i}$.)

\textbf{(b)} We have $s_{i}s_{j}=s_{j}s_{i}$ for all $i,j\in\left[
n-1\right]  $ with $\left\vert i-j\right\vert >1$.

\textbf{(c)} We have $s_{i}s_{i+1}s_{i}=s_{i+1}s_{i}s_{i+1}=t_{i,i+2}$ for all
$i\in\left[  n-2\right]  $. (This is known as \textquotedblleft the braid
relation for permutations\textquotedblright.)
\end{proposition}

\begin{proof}
Straightforward verification that both sides send each $k\in\left[  n\right]
$ to the same value.
\end{proof}

\begin{definition}
Let $n\in\mathbb{N}$. Let $w_{0}$ be the permutation in $S_{n}$ that sends
each $i\in\left[  n\right]  $ to $n+1-i$.

In other words, it \textquotedblleft reflects\textquotedblright\ all numbers
from $1$ to $n$ across the middle of $\left[  n\right]  $. It is the unique
strictly decreasing permutation of $\left[  n\right]  $.
\end{definition}

\begin{definition}
Let $X$ be a set. Let $i_{1},i_{2},\ldots,i_{k}$ be $k$ distinct elements of
$X$. Then,%
\[
\operatorname*{cyc}\nolimits_{i_{1},i_{2},\ldots,i_{k}}%
\]
means the permutation of $X$ that sends $i_{1}\mapsto i_{2}$, $i_{2}\mapsto
i_{3}$, $i_{3}\mapsto i_{4}$, $\ldots$, $i_{k-1}\mapsto i_{k}$, $i_{k}\mapsto
i_{1}$ and leaves all other elements of $X$ unchanged. This is called a
$k$\textbf{-cycle}.
\end{definition}

\begin{remark}
People often write $\left(  i_{1},i_{2},\ldots,i_{k}\right)  $ for
$\operatorname*{cyc}\nolimits_{i_{1},i_{2},\ldots,i_{k}}$.
\end{remark}

\begin{remark}
A permutation $\alpha$ is called an \textbf{involution} if $\alpha
^{2}=\operatorname*{id}$. Both $t_{i,j}$ and $w_{0}$ are involutions. But
$k$-cycles with $k>2$ are not involutions.
\end{remark}

\begin{proposition}
Let $n\in\mathbb{N}$.

\textbf{(a)} For any $k$ distinct elements $i_{1},i_{2},\ldots,i_{k}$ of
$\left[  n\right]  $, we have%
\[
\operatorname*{cyc}\nolimits_{i_{1},i_{2},\ldots,i_{k}}=\underbrace{t_{i_{1}%
,i_{2}}t_{i_{2},i_{3}}\cdots t_{i_{k-1},i_{k}}}_{k-1\text{ transpositions}}.
\]


\textbf{(b)} For any $i\in\left[  n\right]  $ and $k\in\mathbb{N}$ such that
$i+k-1\leq n$, we have%
\[
\operatorname*{cyc}\nolimits_{i,i+1,\ldots,i+k-1}=s_{i}s_{i+1}\cdots
s_{i+k-2}.
\]


\textbf{(c)} For any $i\in\left[  n\right]  $, we have $\operatorname*{cyc}%
\nolimits_{i}=\operatorname*{id}$.

\textbf{(d)} For any distinct $i,j\in\left[  n\right]  $, we have
$\operatorname*{cyc}\nolimits_{i,j}=t_{i,j}$.

\textbf{(e)} For any $k$ distinct elements $i_{1},i_{2},\ldots,i_{k}$ of
$\left[  n\right]  $, we have%
\[
\operatorname*{cyc}\nolimits_{i_{1},i_{2},\ldots,i_{k}}=\operatorname*{cyc}%
\nolimits_{i_{k},i_{1},i_{2},\ldots,i_{k-1}}.
\]


\textbf{(f)} For any $k$ distinct elements $i_{1},i_{2},\ldots,i_{k}$ of
$\left[  n\right]  $ and $\sigma\in S_{n}$, then%
\[
\sigma\operatorname*{cyc}\nolimits_{i_{1},i_{2},\ldots,i_{k}}\sigma
^{-1}=\operatorname*{cyc}\nolimits_{\sigma\left(  i_{1}\right)  ,\sigma\left(
i_{2}\right)  ,\ldots,\sigma\left(  i_{k}\right)  }.
\]


\textbf{(g)} If $1\leq i<j\leq n$, then%
\begin{align*}
t_{i,j}  &  =s_{i}s_{i+1}\cdots s_{j-1}\cdots s_{i+1}s_{i}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{this is a product starting at }s_{i}\text{, then walking up to }%
s_{j-1}\\
\text{and back down to }s_{i}%
\end{array}
\right) \\
&  =s_{j-1}s_{j-2}\cdots s_{i}\cdots s_{j-2}s_{j-1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{this is a product starting at }s_{j-1}\text{, then walking down to
}s_{i}\\
\text{and back up to }s_{j-1}%
\end{array}
\right)  .
\end{align*}


\textbf{(h)} We have
\begin{align*}
w_{0}  &  =\operatorname*{cyc}\nolimits_{1,2,\ldots,n}\operatorname*{cyc}%
\nolimits_{1,2,\ldots,n-1}\cdots\operatorname*{cyc}\nolimits_{1}\\
&  =\left(  s_{1}s_{2}\cdots s_{n-1}\right)  \left(  s_{1}s_{2}\cdots
s_{n-2}\right)  \cdots\left(  s_{1}s_{2}\right)  s_{1}\\
&  =\operatorname*{cyc}\nolimits_{1}\operatorname*{cyc}\nolimits_{2,1}%
\operatorname*{cyc}\nolimits_{3,2,1}\cdots\operatorname*{cyc}%
\nolimits_{n,n-1,\ldots,1}\\
&  =s_{1}\left(  s_{2}s_{1}\right)  \left(  s_{3}s_{2}s_{1}\right)
\cdots\left(  s_{n-1}s_{n-2}\cdots s_{1}\right)  .
\end{align*}

\end{proposition}

\begin{proof}
All of these are doable with some bookkeeping and induction. See [detnotes,
Chapter 5] for some of the proofs.
\end{proof}

\subsection{Inversions and lengths}

\begin{definition}
Let $n\in\mathbb{N}$ and $\sigma\in S_{n}$.

\textbf{(a)} An \textbf{inversion} of $\sigma$ is a pair $\left(  i,j\right)
$ of elements of $\left[  n\right]  $ such that $i<j$ and $\sigma\left(
i\right)  >\sigma\left(  j\right)  $.

\textbf{(b)} The \textbf{length} (or \textbf{Coxeter length}) of $\sigma$ is
the \# of inversions of $\sigma$. It is called $\ell\left(  \sigma\right)  $.
(In LaTeX:
%TCIMACRO{\TEXTsymbol{\backslash}}%
%BeginExpansion
$\backslash$%
%EndExpansion
ell )
\end{definition}

\begin{example}
Let $\pi=\left(  3,1,4,2\right)  \in S_{4}$ (in one-line notation).

The inversions of $\pi$ are
\begin{align*}
&  \left(  1,4\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }1<4\text{ and
}\underbrace{\pi\left(  1\right)  }_{=3}>\underbrace{\pi\left(  4\right)
}_{=2}\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\\
&  \left(  3,4\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }3<4\text{ and
}\underbrace{\pi\left(  3\right)  }_{=4}>\underbrace{\pi\left(  4\right)
}_{=2}\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\\
&  \left(  1,2\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }1<2\text{ and
}\underbrace{\pi\left(  1\right)  }_{=3}>\underbrace{\pi\left(  2\right)
}_{=1}\right)  .
\end{align*}
So the length of $\pi$ is $3$.
\end{example}

\begin{remark}
If $\sigma\in S_{n}$, then $0\leq\ell\left(  \sigma\right)  \leq\dbinom{n}{2}$.

The only $\sigma\in S_{n}$ with $\ell\left(  \sigma\right)  =0$ is
$\operatorname*{id}$.

The only $\sigma\in S_{n}$ with $\ell\left(  \sigma\right)  =\dbinom{n}{2}$ is
$w_{0}$.

Inbetween, there are many permutations with a given $\ell\left(
\sigma\right)  $.
\end{remark}

\begin{center}
\fbox{\textbf{2019-11-20 notes}}
\end{center}

\begin{remark}
If $n\in\mathbb{N}$, then the permutations of $\left[  n\right]  $ can be
represented as the vertices of a $\left(  n-1\right)  $-dimensional polyhedron
in $n$-dimensional space. Namely, each permutation $\sigma$ of $\left[
n\right]  $ gives rise to the point $\left(  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  n\right)  \right)
\in\mathbb{R}^{n}$, and the convex hull of all these points is the polyhedron.
This is called the
\textbf{\href{https://en.wikipedia.org/wiki/Permutohedron}{\textbf{permutahedron}%
}}.
\end{remark}

\begin{proposition}
For every $\sigma\in S_{n}$, we have $\ell\left(  \sigma^{-1}\right)
=\ell\left(  \sigma\right)  $.
\end{proposition}

\begin{proof}
Recall: An inversion of $\sigma$ is a pair $\left(  i,j\right)  \in\left[
n\right]  \times\left[  n\right]  $ such that $i<j$ and $\sigma\left(
i\right)  >\sigma\left(  j\right)  $. An inversion of $\sigma^{-1}$ is a pair
$\left(  u,v\right)  \in\left[  n\right]  \times\left[  n\right]  $ such that
$u<v$ and $\sigma^{-1}\left(  u\right)  >\sigma^{-1}\left(  v\right)  $.

The map%
\begin{align*}
\left\{  \text{inversions of }\sigma\right\}   &  \rightarrow\left\{
\text{inversions of }\sigma^{-1}\right\}  ,\\
\left(  i,j\right)   &  \mapsto\left(  \sigma\left(  j\right)  ,\sigma\left(
i\right)  \right)
\end{align*}
is well-defined and bijective (its inverse map sends each $\left(  u,v\right)
\in\left\{  \text{inversions of }\sigma^{-1}\right\}  $ to $\left(
\sigma^{-1}\left(  v\right)  ,\sigma^{-1}\left(  u\right)  \right)  $). So the
bijection principle yields $\ell\left(  \sigma\right)  =\ell\left(
\sigma^{-1}\right)  $.

(For details, see [detnotes, Exercise 5.2 \textbf{(f)}].)
\end{proof}

Recall from last time

\begin{itemize}
\item the transpositions $t_{i,j}$ (swapping $i$ with $j$ while leaving all
other numbers unchanged), and

\item the simple transpositions $s_{i}=t_{i,i+1}$.
\end{itemize}

\begin{proposition}
Let $n\in\mathbb{N}$, $\sigma\in S_{n}$ and $k\in\left[  n-1\right]  $.

\textbf{(a)} We have%
\[
\ell\left(  \sigma\circ s_{k}\right)  =%
\begin{cases}
\ell\left(  \sigma\right)  +1, & \text{if }\sigma\left(  k\right)
<\sigma\left(  k+1\right)  ;\\
\ell\left(  \sigma\right)  -1, & \text{if }\sigma\left(  k\right)
>\sigma\left(  k+1\right)  .
\end{cases}
\]


\textbf{(b)} We have%
\[
\ell\left(  s_{k}\circ\sigma\right)  =%
\begin{cases}
\ell\left(  \sigma\right)  +1, & \text{if }\sigma^{-1}\left(  k\right)
<\sigma^{-1}\left(  k+1\right)  ;\\
\ell\left(  \sigma\right)  -1, & \text{if }\sigma^{-1}\left(  k\right)
>\sigma^{-1}\left(  k+1\right)  .
\end{cases}
\]


[\textbf{Note:} $\sigma^{-1}\left(  i\right)  $ is the \textbf{position} in
which $i$ appears in the one-line notation of $\sigma$. For example, if
$\sigma=\left(  5,1,2,3,6,4\right)  $, then $\sigma^{-1}\left(  6\right)  =5$.]
\end{proposition}

\begin{proof}
\textbf{(b)} How do the inversions of $s_{k}\circ\sigma$ differ from the
inversions of $\sigma$ ?

I claim that they are the same, except that

\begin{itemize}
\item if $\sigma^{-1}\left(  k\right)  <\sigma^{-1}\left(  k+1\right)  $, then
we gain a new inversion $\left(  \sigma^{-1}\left(  k\right)  ,\sigma
^{-1}\left(  k+1\right)  \right)  $;

\item if $\sigma^{-1}\left(  k\right)  >\sigma^{-1}\left(  k+1\right)  $, then
we lose an existing inversion $\left(  \sigma^{-1}\left(  k+1\right)
,\sigma^{-1}\left(  k\right)  \right)  $.
\end{itemize}

For example, let
\[
n=7\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \sigma=\left(
6,2,4,1,7,3,5\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ k=4.
\]
Thus, $\sigma^{-1}\left(  k\right)  <\sigma^{-1}\left(  k+1\right)  $ and
$s_{k}\circ\sigma=\left(  6,2,5,1,7,3,4\right)  $. So we gain a new inversion
$\left(  3,7\right)  $ since $5>4$, but all other inversions remain the same.

For another example, let
\[
n=7\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \sigma=\left(
3,1,4,2,7,6,5\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ k=3.
\]
Thus, $\sigma^{-1}\left(  k\right)  >\sigma^{-1}\left(  k+1\right)  $ and
$s_{k}\circ\sigma=\left(  2,1,4,3,7,6,5\right)  $. So we lose the inversion
$\left(  1,4\right)  $ since $3>2$, but all other inversions remain the same.

Thus, when going from $\sigma$ to $s_{k}\circ\sigma$, the \# of inversions
increases by $1$ if $\sigma^{-1}\left(  k\right)  <\sigma^{-1}\left(
k+1\right)  $ and decreases by $1$ if $\sigma^{-1}\left(  k\right)
>\sigma^{-1}\left(  k+1\right)  $. This is precisely the claim of \textbf{(b)}.

\textbf{(a)} Apply part \textbf{(b)} to $\sigma^{-1}$ instead of $\sigma$. We
get%
\begin{align*}
\ell\left(  s_{k}\circ\sigma^{-1}\right)   &  =%
\begin{cases}
\ell\left(  \sigma^{-1}\right)  +1, & \text{if }\left(  \sigma^{-1}\right)
^{-1}\left(  k\right)  <\left(  \sigma^{-1}\right)  ^{-1}\left(  k+1\right)
;\\
\ell\left(  \sigma^{-1}\right)  -1, & \text{if }\left(  \sigma^{-1}\right)
^{-1}\left(  k\right)  >\left(  \sigma^{-1}\right)  ^{-1}\left(  k+1\right)
\end{cases}
\\
&  =%
\begin{cases}
\ell\left(  \sigma\right)  +1, & \text{if }\sigma\left(  k\right)
<\sigma\left(  k+1\right)  ;\\
\ell\left(  \sigma\right)  -1, & \text{if }\sigma\left(  k\right)
>\sigma\left(  k+1\right)
\end{cases}
\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\ell\left(  \sigma^{-1}\right)
=\ell\left(  \sigma\right)  \text{ (by previous Prop.) and }\left(
\sigma^{-1}\right)  ^{-1}=\sigma\right)  .
\end{align*}
On the other hand, the previous Prop. yields%
\begin{align*}
\ell\left(  s_{k}\circ\sigma^{-1}\right)   &  =\ell\left(  \underbrace{\left(
s_{k}\circ\sigma^{-1}\right)  ^{-1}}_{\substack{=\left(  \sigma^{-1}\right)
^{-1}\circ\left(  s_{k}\right)  ^{-1}\\\text{(since }\left(  \alpha\circ
\beta\right)  ^{-1}=\beta^{-1}\circ\alpha^{-1}\text{)}}}\right)  =\ell\left(
\underbrace{\left(  \sigma^{-1}\right)  ^{-1}}_{=\sigma}\circ
\underbrace{\left(  s_{k}\right)  ^{-1}}_{\substack{=s_{k}\\\text{(since
}s_{k}\circ s_{k}=\operatorname*{id}\text{)}}}\right) \\
&  =\ell\left(  \sigma\circ s_{k}\right)  .
\end{align*}
Comparing these equalities, we get%
\[
\ell\left(  \sigma\circ s_{k}\right)  =%
\begin{cases}
\ell\left(  \sigma\right)  +1, & \text{if }\sigma\left(  k\right)
<\sigma\left(  k+1\right)  ;\\
\ell\left(  \sigma\right)  -1, & \text{if }\sigma\left(  k\right)
>\sigma\left(  k+1\right)  .
\end{cases}
\]


(See [detnotes, Exercise 5.2 \textbf{(a)}] for a similar proof in more detail.)
\end{proof}

\begin{remark}
Let $n\in\mathbb{N}$ and $\sigma\in S_{n}$. Let $i,j\in\left[  n\right]  $ be
such that $i<j$ and $\sigma\left(  i\right)  >\sigma\left(  j\right)  $. Is%
\[
\ell\left(  \sigma\circ t_{i,j}\right)  <\ell\left(  \sigma\right)  \ \text{?}%
\]


It's not obvious, but the answer is \textquotedblleft yes\textquotedblright.
See [18f-hw4s].
\end{remark}

Recall: A \textbf{simple transposition} in $S_{n}$ means one of the
transpositions $s_{1},s_{2},\ldots,s_{n-1}$. We shall occasionally abbreviate
\textquotedblleft simple transposition\textquotedblright\ as \textquotedblleft%
\textbf{simple}\textquotedblright.

\begin{theorem}
Let $n\in\mathbb{N}$ and $\sigma\in S_{n}$.

\textbf{(a)} We can write $\sigma$ as a composition of $\ell\left(
\sigma\right)  $ simples.

\textbf{(b)} $\ell\left(  \sigma\right)  $ is the smallest $p\in\mathbb{N}$
such that we can write $\sigma$ as a composition of $p$ simples.

[\textbf{Keep in mind:} The composition of $0$ simples is $\operatorname*{id}$.]
\end{theorem}

\begin{example}
In $S_{4}$, we have%
\begin{align*}
\underbrace{\left(  4,1,3,2\right)  }_{\text{one-line not.}}  &
=\underbrace{s_{2}\circ s_{3}\circ s_{2}}_{=s_{3}\circ s_{2}\circ s_{3}}\circ
s_{1}=s_{3}\circ s_{2}\circ\underbrace{s_{3}\circ s_{1}}_{=s_{1}\circ s_{3}%
}=s_{3}\circ s_{2}\circ s_{1}\circ s_{3}\\
&  =s_{2}\circ s_{1}\circ s_{1}\circ s_{3}\circ s_{2}\circ s_{1}=\cdots.
\end{align*}

\end{example}

\begin{proof}
(Proof of Theorem.)

\textbf{(a)} Induction on $\ell\left(  \sigma\right)  $.

\textit{Induction base:} If $\ell\left(  \sigma\right)  =0$, then
$\sigma=\operatorname*{id}$, so we can write $\sigma$ as a composition of $0$ simples.

\textit{Induction step:} Fix $h\in\mathbb{N}$. Assume (as the IH) that Theorem
\textbf{(a)} holds for $\ell\left(  \sigma\right)  =h$.

Now, let $\sigma\in S_{n}$ be such that $\ell\left(  \sigma\right)  =h+1$.

Hence, $\ell\left(  \sigma\right)  =h+1>0$, so $\sigma\neq\operatorname*{id}$.

Therefore, there exists some $k\in\left[  n-1\right]  $ such that
$\sigma\left(  k\right)  >\sigma\left(  k+1\right)  $ (because otherwise, we
we would have $\sigma\left(  1\right)  \leq\sigma\left(  2\right)  \leq
\cdots\leq\sigma\left(  n\right)  $, and this would imply $\ell\left(
\sigma\right)  =0$, whence $\sigma=\operatorname*{id}$). Fix such a $k$.

Part \textbf{(a)} of the previous proposition yields%
\begin{align*}
\ell\left(  \sigma\circ s_{k}\right)   &  =%
\begin{cases}
\ell\left(  \sigma\right)  +1, & \text{if }\sigma\left(  k\right)
<\sigma\left(  k+1\right)  ;\\
\ell\left(  \sigma\right)  -1, & \text{if }\sigma\left(  k\right)
>\sigma\left(  k+1\right)
\end{cases}
=\underbrace{\ell\left(  \sigma\right)  }_{=h+1}-1\\
&  =\left(  h+1\right)  -1=h.
\end{align*}
Thus, the IH (applied to $\sigma\circ s_{k}$ instead of $\sigma$) shows that
we can write $\sigma\circ s_{k}$ as a composition of $\ell\left(  \sigma\circ
s_{k}\right)  =h$ simples:%
\[
\sigma\circ s_{k}=s_{i_{1}}\circ s_{i_{2}}\circ\cdots\circ s_{i_{h}%
}\ \ \ \ \ \ \ \ \ \ \text{for some }i_{1},i_{2},\ldots,i_{h}\in\left[
n-1\right]  .
\]
Composing both sides of this equality with $\left(  s_{k}\right)  ^{-1}$, we
obtain%
\begin{align*}
\sigma &  =\left(  s_{i_{1}}\circ s_{i_{2}}\circ\cdots\circ s_{i_{h}}\right)
\circ\underbrace{\left(  s_{k}\right)  ^{-1}}_{=s_{k}}\\
&  =\left(  s_{i_{1}}\circ s_{i_{2}}\circ\cdots\circ s_{i_{h}}\right)  \circ
s_{k}=s_{i_{1}}\circ s_{i_{2}}\circ\cdots\circ s_{i_{h}}\circ s_{k}.
\end{align*}
This shows that we can write $\sigma$ as a composition of $h+1=\ell\left(
\sigma\right)  $ simples. Thus, Theorem \textbf{(a)} holds for $\ell\left(
\sigma\right)  =h+1$. This completes the induction step, and so Theorem
\textbf{(a)} is proved by induction.

[The idea behind this proof is known as \textquotedblleft
bubblesort\textquotedblright.]

\textbf{(b)} Omitted.

(For details, see [detnotes, Exercise 5.2 \textbf{(g)}].)
\end{proof}

\begin{corollary}
Let $n\in\mathbb{N}$.

\textbf{(a)} We have $\ell\left(  \sigma\circ\tau\right)  \equiv\ell\left(
\sigma\right)  +\ell\left(  \tau\right)  \operatorname{mod}2$ for all
$\sigma\in S_{n}$ and $\tau\in S_{n}$. (In other words, if $\ell\left(
\sigma\circ\tau\right)  $ is even, then $\ell\left(  \sigma\right)
+\ell\left(  \tau\right)  $ is even, and the same for \textquotedblleft
odd\textquotedblright.)

\textbf{(b)} We have $\ell\left(  \sigma\circ\tau\right)  \leq\ell\left(
\sigma\right)  +\ell\left(  \tau\right)  $.

\textbf{(c)} If $\sigma=s_{k_{1}}\circ s_{k_{2}}\circ\cdots\circ s_{k_{q}}$,
then $q\geq\ell\left(  \sigma\right)  $ and $q\equiv\ell\left(  \sigma\right)
\operatorname{mod}2$.
\end{corollary}

\begin{example}
Let $n=4$ and $\sigma=\left(  3,2,1,4\right)  $ and $\tau=\left(
3,1,4,2\right)  $ in one-line notation. Then, $\ell\left(  \sigma\right)  =3$
and $\ell\left(  \tau\right)  =3$. Now, $\sigma\circ\tau=\left(
1,3,4,2\right)  $ has $\ell\left(  \sigma\circ\tau\right)  =2$.

Corollary \textbf{(a)} says $\ell\left(  \sigma\circ\tau\right)  \equiv
\ell\left(  \sigma\right)  +\ell\left(  \tau\right)  \operatorname{mod}2$. In
other words, $2\equiv3+3\operatorname{mod}2$.

Corollary \textbf{(b)} says $\ell\left(  \sigma\circ\tau\right)  \leq
\ell\left(  \sigma\right)  +\ell\left(  \tau\right)  $. In other words,
$2\leq3+3$.
\end{example}

\begin{proof}
(Proof of Corollary) See [detnotes, Exercises 5.2 and 5.3]. (Or do it
yourself, e.g., by induction on $\ell\left(  \sigma\right)  $.)
\end{proof}

\begin{proposition}
Let $n\in\mathbb{N}$.

\textbf{(a)} We have $\ell\left(  s_{k}\right)  =1$ for any $k\in\left[
n-1\right]  $.

\textbf{(b)} We have $\ell\left(  t_{i,j}\right)  =2\left\vert i-j\right\vert
-1$ for any distinct $i,j\in\left[  n\right]  $.

\textbf{(c)}\textit{ We have }$\ell\left(  \operatorname*{cyc}%
\nolimits_{i,i+1,\ldots,i+k-1}\right)  =k-1$ for all $i,k$.

\textbf{(d)} We have $\ell\left(  \operatorname*{cyc}\nolimits_{i_{1}%
,i_{2},\ldots,i_{k}}\right)  \geq k-1$ for all distinct $i_{1},i_{2}%
,\ldots,i_{k}\in\left[  n\right]  $.

\qquad\qquad\qquad\qquad\qquad\fbox{\textbf{2019-11-20 notes}}

\textbf{(e)} We have $\ell\left(  \operatorname*{id}\right)  =0$ and
$\ell\left(  w_{0}\right)  =\dbinom{n}{2}$. (Recall: $w_{0}$ is the
\textquotedblleft reflection across the middle of $\left[  n\right]
$\textquotedblright.)
\end{proposition}

\begin{proof}
\textbf{(a)} follows from \textbf{(b)}.

\textbf{(b)} is [detnotes, Exercise 5.10], but also easy to check.

\textbf{(c)} and \textbf{(d)} are parts of [detnotes, Exercise 5.16].

\textbf{(e)} is trivial.
\end{proof}

\begin{remark}
For a given $k$ and $n$, how many $\sigma\in S_{n}$ have length $k$ ?

\begin{itemize}
\item The \# of $\sigma\in S_{n}$ having $\ell\left(  \sigma\right)  =0$ is
$1$ (namely, just $\sigma=\operatorname*{id}$).

\item The \# of $\sigma\in S_{n}$ having $\ell\left(  \sigma\right)  =1$ is
$n-1$ (namely, just $\sigma=s_{k}$ with $k\in\left[  n-1\right]  $).

\item The \# of $\sigma\in S_{n}$ having $\ell\left(  \sigma\right)  =2$ is
$n\left(  n+1\right)  /2$. (Exercise.)
\end{itemize}

What about the general case?

There is no explicit formula, but there is a generating function:
\end{remark}

\begin{proposition}
Let $n\in\mathbb{N}$. Then,%
\begin{align*}
\sum_{w\in S_{n}}x^{\ell\left(  w\right)  }  &  =\prod_{i=1}^{n-1}\left(
1+x+x^{2}+\cdots+x^{i}\right) \\
&  =\left(  1+x\right)  \cdot\left(  1+x+x^{2}\right)  \cdot\left(
1+x+x^{2}+x^{3}\right)  \cdot\cdots\cdot\left(  1+x+x^{2}+\cdots
+x^{n-1}\right)  .
\end{align*}

\end{proposition}

\begin{example}
Applying this to $n=3$, we obtain%
\[
\sum_{w\in S_{3}}x^{\ell\left(  w\right)  }=\left(  1+x\right)  \cdot\left(
1+x+x^{2}\right)  .
\]
Let us check this:%
\begin{align*}
\sum_{w\in S_{3}}x^{\ell\left(  w\right)  }  &  =x^{\ell\left(  1,2,3\right)
}+x^{\ell\left(  1,3,2\right)  }+x^{\ell\left(  2,1,3\right)  }+x^{\ell\left(
2,3,1\right)  }+x^{\ell\left(  3,1,2\right)  }+x^{\ell\left(  3,2,1\right)
}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{where we are writing each permutation in
one-line notation}\right) \\
&  =x^{0}+x^{1}+x^{1}+x^{2}+x^{2}+x^{3}=x^{0}+2x^{1}+2x^{2}+x^{3}\\
&  =\left(  1+x\right)  \cdot\left(  1+x+x^{2}\right)  .
\end{align*}

\end{example}

\subsection{Descents}

\begin{definition}
Let $n\in\mathbb{N}$ and $\sigma\in S_{n}$.

A \textbf{descent} of $\sigma$ means a $k\in\left[  n-1\right]  $ such that
$\sigma\left(  k\right)  >\sigma\left(  k+1\right)  $.

The \textbf{descent set} of $\sigma$, denoted $\operatorname*{Des}\sigma$, is
the set of all descents of $\sigma$.
\end{definition}

\begin{exercise}
Fix $n\geq4$.

\textbf{(a)} How many $\sigma\in S_{n}$ have $0$ descents?

\textbf{(b)} How many $\sigma\in S_{n}$ have $1$ descent?

\textbf{(c)} How many $\sigma\in S_{n}$ have $n-1$ descents?

\textbf{(d)} How many $\sigma\in S_{n}$ satisfy $1\in\operatorname*{Des}%
\sigma$ (that is, $\sigma\left(  1\right)  >\sigma\left(  2\right)  $) ?

\textbf{(e)} How many $\sigma\in S_{n}$ satisfy $1,2\in\operatorname*{Des}%
\sigma$ (that is, $\sigma\left(  1\right)  >\sigma\left(  2\right)
>\sigma\left(  3\right)  $) ?

\textbf{(f)} How many $\sigma\in S_{n}$ satisfy $1,3\in\operatorname*{Des}%
\sigma$ (that is, $\sigma\left(  1\right)  >\sigma\left(  2\right)  $ and
$\sigma\left(  3\right)  >\sigma\left(  4\right)  $) ?
\end{exercise}

\begin{proof}
(Solution sketch.) \textbf{(a)} The answer is $1$ (namely, $\sigma
=\operatorname*{id}$).

\textbf{(d)} The answer is $\dfrac{n!}{2}$.

\textit{First proof:} The map%
\begin{align*}
\left\{  \sigma\in S_{n}\ \mid\ \sigma\left(  1\right)  >\sigma\left(
2\right)  \right\}   &  \rightarrow\left\{  \sigma\in S_{n}\ \mid
\ \sigma\left(  1\right)  <\sigma\left(  2\right)  \right\}  ,\\
\sigma &  \mapsto\sigma\circ s_{1}%
\end{align*}
is bijective. So each of the $2$ sets is half as large as $S_{n}$ (because
each $\sigma\in S_{n}$ satisfies either $\sigma\left(  1\right)
>\sigma\left(  2\right)  $ or $\sigma\left(  1\right)  <\sigma\left(
2\right)  $). But $\left\vert S_{n}\right\vert =n!$.

\textit{Second proof:} To construct a $\sigma\in S_{n}$ satisfying
$\sigma\left(  1\right)  >\sigma\left(  2\right)  $, we can can proceed as follows:

\begin{itemize}
\item Choose the \textbf{set} $\left\{  \sigma\left(  1\right)  ,\sigma\left(
2\right)  \right\}  $. There are $\dbinom{n}{2}$ options.

\item Thus, $\sigma\left(  1\right)  $ and $\sigma\left(  2\right)  $ are
already uniquely determined, because they have to satisfy $\sigma\left(
1\right)  >\sigma\left(  2\right)  $.

\item Choose $\sigma\left(  3\right)  ,\sigma\left(  4\right)  ,\ldots
,\sigma\left(  n\right)  $. There are $\left(  n-2\right)  !$ options.
\end{itemize}

$\Longrightarrow$ The total \# is $\dbinom{n}{2}\cdot\left(  n-2\right)
!=\dfrac{n!}{2!}=\dfrac{n!}{2}$.

\textbf{(e)} The answer is $\dfrac{n!}{3!}$.

For the detailed proof, see [18s-mt1s], \S 0.2.

\textbf{(f)} The answer is $\dfrac{n!}{2!\cdot2!}=\dfrac{n!}{4}$.

For the detailed proof, see [18s-mt1s], \S 0.2.

See [18f, some hw/mt] for the more general question how many permutations
$\sigma\in S_{n}$ have a given bunch of numbers in their descent set.

\textbf{(b)} First of all, fix $i\in\left[  n-1\right]  $. How many $\sigma\in
S_{n}$ have $\operatorname*{Des}\sigma=\left\{  i\right\}  $ ?

In other words, how many $\sigma\in S_{n}$ satisfy%
\[
\sigma\left(  1\right)  <\sigma\left(  2\right)  <\cdots<\sigma\left(
i\right)  >\sigma\left(  i+1\right)  <\sigma\left(  i+2\right)  <\cdots
<\sigma\left(  n\right)  .
\]


We have%
\begin{align*}
&  \left(  \text{\# of }\sigma\in S_{n}\text{ such that }\sigma\left(
1\right)  <\sigma\left(  2\right)  <\cdots<\sigma\left(  i\right)  \text{ and
}\sigma\left(  i+1\right)  <\sigma\left(  i+2\right)  <\cdots<\sigma\left(
n\right)  \right) \\
&  =\dbinom{n}{i}%
\end{align*}
(because in order to construct such a $\sigma$, it suffices to choose the
$i$-element subset $\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\ldots,\sigma\left(  i\right)  \right\}  $ of $\left[  n\right]  $). Thus,%
\begin{align*}
&  \left(  \text{\# of }\sigma\in S_{n}\text{ such that }\sigma\left(
1\right)  <\sigma\left(  2\right)  <\cdots<\sigma\left(  i\right)
>\sigma\left(  i+1\right)  <\sigma\left(  i+2\right)  <\cdots<\sigma\left(
n\right)  \right) \\
&  =\underbrace{\left(  \text{\# of }\sigma\in S_{n}\text{ such that }%
\sigma\left(  1\right)  <\sigma\left(  2\right)  <\cdots<\sigma\left(
i\right)  \text{ and }\sigma\left(  i+1\right)  <\sigma\left(  i+2\right)
<\cdots<\sigma\left(  n\right)  \right)  }_{=\dbinom{n}{i}}\\
&  -\underbrace{\left(  \text{\# of }\sigma\in S_{n}\text{ such that }%
\sigma\left(  1\right)  <\sigma\left(  2\right)  <\cdots<\sigma\left(
i\right)  <\sigma\left(  i+1\right)  <\sigma\left(  i+2\right)  <\cdots
<\sigma\left(  n\right)  \right)  }_{=1}\\
&  =\dbinom{n}{i}-1.
\end{align*}


Now, forget that we fixed $i$. Summing this over all $i\in\left[  n-1\right]
$, we get%
\begin{align*}
&  \left(  \text{\# of }\sigma\in S_{n}\text{ that have exactly }1\text{
descent}\right) \\
&  =\sum_{i=1}^{n-1}\left(  \dbinom{n}{i}-1\right)  =\underbrace{\sum
_{i=1}^{n-1}\dbinom{n}{i}}_{=2^{n}-2}-\left(  n-1\right)  =2^{n}-2-\left(
n-1\right)  =2^{n}-\left(  n+1\right)  .
\end{align*}


\textbf{(c)} Only $1$ permutation $\sigma\in S_{n}$ has $n-1$ descents, namely
$w_{0}$.
\end{proof}

\subsection{Signs}

\begin{definition}
Let $n\in\mathbb{N}$. The \textbf{sign} of a permutation $\sigma\in S_{n}$ is
$\left(  -1\right)  ^{\ell\left(  \sigma\right)  }$.

It is called $\left(  -1\right)  ^{\sigma}$ or $\operatorname*{sgn}\left(
\sigma\right)  $ or $\operatorname*{sign}\left(  \sigma\right)  $ or
$\varepsilon\left(  \sigma\right)  $.
\end{definition}

\begin{proposition}
Let $n\in\mathbb{N}$.

\textbf{(a)} We have $\left(  -1\right)  ^{\operatorname*{id}}=1$.

\textbf{(b)} We have $\left(  -1\right)  ^{t_{i,j}}=-1$.

\textbf{(c)} We have $\left(  -1\right)  ^{\operatorname*{cyc}\nolimits_{i_{1}%
,i_{2},\ldots,i_{k}}}=\left(  -1\right)  ^{k-1}$ for any distinct $i_{1}%
,i_{2},\ldots,i_{k}\in\left[  n\right]  $.

\textbf{(d)} We have $\left(  -1\right)  ^{\sigma\circ\tau}=\left(  -1\right)
^{\sigma}\cdot\left(  -1\right)  ^{\tau}$ for any $\sigma,\tau\in S_{n}$. (In
the lingo of abstract algebra, this is saying \textquotedblleft The sign is a
group homomorphism from $S_{n}$ to $\left\{  1,-1\right\}  $\textquotedblright.)

\textbf{(e)} We have $\left(  -1\right)  ^{\sigma_{1}\circ\sigma_{2}%
\circ\cdots\circ\sigma_{p}}=\left(  -1\right)  ^{\sigma_{1}}\left(  -1\right)
^{\sigma_{2}}\cdots\left(  -1\right)  ^{\sigma_{p}}$ for any $\sigma
_{1},\sigma_{2},\ldots,\sigma_{p}\in S_{n}$.

\textbf{(f)} We have $\left(  -1\right)  ^{\sigma^{-1}}=\left(  -1\right)
^{\sigma}$ for any $\sigma\in S_{n}$. (The LHS has to be read as $\left(
-1\right)  ^{\left(  \sigma^{-1}\right)  }$.)

\textbf{(g)} We have%
\[
\left(  -1\right)  ^{\sigma}=\prod_{1\leq i<j\leq n}\dfrac{\sigma\left(
i\right)  -\sigma\left(  j\right)  }{i-j}\ \ \ \ \ \ \ \ \ \ \text{for each
}\sigma\in S_{n}.
\]


\textbf{(h)} If $x_{1},x_{2},\ldots,x_{n}$ are any numbers, and $\sigma\in
S_{n}$, then%
\[
\prod_{1\leq i<j\leq n}\left(  x_{\sigma\left(  i\right)  }-x_{\sigma\left(
j\right)  }\right)  =\left(  -1\right)  ^{\sigma}\prod_{1\leq i<j\leq
n}\left(  x_{i}-x_{j}\right)  .
\]

\end{proposition}

\begin{proof}
See [detnotes, Chapter 5, section on signs]. Most of this follows easily from
what we have proved above.
\end{proof}

\begin{definition}
Let $n\in\mathbb{N}$. A permutation $\sigma\in S_{n}$ is said to be

\begin{itemize}
\item \textbf{even} if $\left(  -1\right)  ^{\sigma}=1$ (that is, if
$\ell\left(  \sigma\right)  $ is even);

\item \textbf{odd} if $\left(  -1\right)  ^{\sigma}=-1$ (that is, if
$\ell\left(  \sigma\right)  $ is odd).
\end{itemize}
\end{definition}

\begin{corollary}
Let $n\geq2$. Then,%
\[
\left(  \text{\# of even }\sigma\in S_{n}\right)  =\left(  \text{\# of odd
}\sigma\in S_{n}\right)  =n!/2.
\]

\end{corollary}

\begin{proof}
The map%
\begin{align*}
\left\{  \text{even }\sigma\in S_{n}\right\}   &  \rightarrow\left\{
\text{odd }\sigma\in S_{n}\right\}  ,\\
\sigma &  \mapsto\sigma\circ s_{1}%
\end{align*}
is a bijection.
\end{proof}

\begin{example}
The $15$-game%
\[%
\begin{array}
[c]{cccc}%
1 & 2 & 3 & 4\\
5 & 6 & 7 & 8\\
9 & 10 & 11 & 12\\
13 & 15 & 14 &
\end{array}
\longrightarrow%
\begin{array}
[c]{cccc}%
1 & 2 & 3 & 4\\
5 & 6 & 7 & 8\\
9 & 10 & 11 & 12\\
13 & 14 & 15 &
\end{array}
\]
(via swaps of the empty cell with the neighboring square (\textquotedblleft
slides\textquotedblright)) is unsolvable.

Why?

\textbf{Proof sketch.}

\textbf{(a)} Let us first consider the $3\times3$-analogue:%
\[%
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
4 & 5 & 6\\
8 & 7 &
\end{array}
\longrightarrow%
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
4 & 5 & 6\\
7 & 8 &
\end{array}
.
\]
This is also impossible.

\textbf{Proof:} For each position $P$, let $\sigma_{P}$ be the permutation of
$\left[  8\right]  $ whose one-line notation is what you get if you read $P$
row by row from left to right.%
\[
P=%
\begin{array}
[c]{ccc}%
a & b & c\\
d & e & \\
f & g & h
\end{array}
\mapsto\sigma_{P}=\left(  a,b,c,d,e,f,g,h\right)  \text{ (in one-line
notation).}%
\]
Now, a slide changes $\sigma_{P}$ \textbf{either} not at all \textbf{or} by
multiplying it with a $\underbrace{3\text{-cycle}}%
_{\substack{\operatorname*{cyc}\nolimits_{p,q,r}\\\text{for some }p,q,r}}$
(that is, $\sigma_{P}$ becomes $\sigma_{P}\circ\operatorname*{cyc}%
\nolimits_{p,q,r}$). Thus, the sign of $\sigma_{P}$ never changes (since
$3$-cycles have sign $1$). Thus, the $3\times3$-game is unsolvable (since the
initial position and the target position have different signs of $\sigma_{P}$).

\textbf{(b)} Now to the $4\times4$-version.

The sign of $\sigma_{P}$ is no longer invariant. Instead, every vertical slide
flips the sign of $\sigma_{P}$. Therefore,%
\[
\left(  -1\right)  ^{\sigma_{P}}\cdot\left(  -1\right)  ^{\text{which row has
an empty square}}%
\]
is invariant. This again proves that the game is unsolvable, because the
initial and target positions have different values of this invariant.
\end{example}

\begin{remark}
For any $n\in\mathbb{N}$, the set of all even permutations $\sigma\in S_{n}$
is called the \textbf{alternating group} $A_{n}$.
\end{remark}

\begin{center}
\fbox{\textbf{2019-12-04 notes}}
\end{center}

\section{Lattice paths (brief introduction)}

(See [18f], i.e., the notes from last year, for more details.)

\begin{definition}
The \textbf{integer lattice} (or, for short, \textbf{lattice}) is the set
$\mathbb{Z}^{2}=\mathbb{Z}\times\mathbb{Z}$.

Its elements are called \textbf{points}; indeed, any element $\left(
a,b\right)  \in\mathbb{Z}^{2}$ can be identified with the point with
coordinates $a$ and $b$ on the plane.

Points can be added and subtracted entrywise: e.g.,%
\[
\left(  a,b\right)  -\left(  c,d\right)  =\left(  a-c,b-d\right)  .
\]


If $\left(  a,b\right)  \in\mathbb{Z}^{2}$ and $\left(  c,d\right)
\in\mathbb{Z}^{2}$ are two points, then a \textbf{lattice path} (for short,
\textbf{LP}) from $\left(  a,b\right)  $ to $\left(  c,d\right)  $ means

\begin{itemize}
\item (informally) a path from $\left(  a,b\right)  $ to $\left(  c,d\right)
$ that uses only $2$ kinds of steps:

\begin{itemize}
\item \textquotedblleft up-steps\textquotedblright\ ($U$) going $\left(
p,q\right)  \mapsto\left(  p,q+1\right)  $;

\item \textquotedblleft right-steps\textquotedblright\ ($R$) going $\left(
p,q\right)  \mapsto\left(  p+1,q\right)  $.
\end{itemize}

\item (rigorously) a tuple $\left(  v_{0},v_{1},\ldots,v_{n}\right)  $ of
points $v_{i}\in\mathbb{Z}^{2}$ such that%
\begin{align*}
v_{0}  &  =\left(  a,b\right)  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ v_{n}=\left(  c,d\right)  \ \ \ \ \ \ \ \ \ \ \\
\text{and}\ \ \ \ \ \ \ \ \ \ v_{i}-v_{i-1}  &  \in\left\{
\underbrace{\left(  0,1\right)  }_{\text{up-step}},\ \ \underbrace{\left(
1,0\right)  }_{\text{right-step}}\right\}  \ \ \ \ \ \ \ \ \ \ \text{for each
}i\in\left[  n\right]  .
\end{align*}

\end{itemize}
\end{definition}

\begin{example}
(See blackboard) is a LP from $\left(  0,0\right)  $ to $\left(  5,3\right)  $.

Formally, it is the $9$-tuple%
\[
\left(  \left(  0,0\right)  ,\left(  1,0\right)  ,\left(  1,1\right)  ,\left(
2,1\right)  ,\left(  3,1\right)  ,\ldots\right)  .
\]
It can be specified by its \textquotedblleft step sequence\textquotedblright%
\ $RURRRUUR$ (if its starting point is known to be $\left(  0,0\right)  $).
\end{example}

\begin{proposition}
Let $\left(  a,b\right)  \in\mathbb{Z}^{2}$ and $\left(  c,d\right)
\in\mathbb{Z}^{2}$ be two points. Then,%
\[
\left(  \text{\# of LPs from }\left(  a,b\right)  \text{ to }\left(
c,d\right)  \right)  =%
\begin{cases}
\dbinom{c+d-a-b}{c-a}, & \text{if }c+d\geq a+b;\\
0, & \text{if }c+d<a+b
\end{cases}
.
\]

\end{proposition}

\begin{proof}
In each LP, the x-coordinates of the points weakly increase at each step, and
so do the y-coordinates. Thus, LPs from $\left(  a,b\right)  $ to $\left(
c,d\right)  $ can only exist when $c\geq a$ and $d\geq b$.

Furthermore, each step of a LP increases%
\[
\left(  \text{x-coordinate}\right)  +\left(  \text{y-coordinate}\right)
\]
by exactly $1$. Hence, each LP $\left(  v_{0},v_{1},\ldots,v_{n}\right)  $
from $\left(  a,b\right)  $ to $\left(  c,d\right)  $ must have $n=c+d-a-b$.
Thus, if $c+d<a+b$, then the \# of LPs is $0$. Otherwise, the bijection%
\begin{align*}
\left\{  \text{LPs from }\left(  a,b\right)  \text{ to }\left(  c,d\right)
\right\}   &  \rightarrow\left\{  \left(  c-a\right)  \text{-element subsets
of }\left[  c+d-a-b\right]  \right\}  ,\\
\left(  v_{0},v_{1},\ldots,v_{n}\right)   &  \mapsto\left\{  i\in\left[
n\right]  \ \mid\ v_{i}-v_{i-1}=\left(  1,0\right)  \right\}
\end{align*}
shows that the \# of LPs is $\dbinom{c+d-a-b}{c-a}$.
\end{proof}

\begin{definition}
Let $\mathbf{v}=\left(  v_{0},v_{1},\ldots,v_{n}\right)  $ be a LP from
$\left(  a,b\right)  $ to $\left(  c,d\right)  $. Let $p\in\mathbb{Z}^{2}$. We
say that $p\in\mathbf{v}$ (in words: $p$ \textbf{lies on }$\mathbf{v}$) if
$p\in\left\{  v_{0},v_{1},\ldots,v_{n}\right\}  $.
\end{definition}

\begin{exercise}
Find the \# of LPs $\mathbf{v}$ from $\left(  0,0\right)  $ to $\left(
6,6\right)  $ such that $\left(  2,2\right)  \in\mathbf{v}$.
\end{exercise}

\begin{proof}
(Solution sketch.) Each such $\mathbf{v}$ consists of a LP from $\left(
0,0\right)  $ to $\left(  2,2\right)  $ and a LP from $\left(  2,2\right)  $
to $\left(  6,6\right)  $. Thus, the product rule yields%
\begin{align*}
&  \left(  \text{\# of LPs }\mathbf{v}\text{ from }\left(  0,0\right)  \text{
to }\left(  6,6\right)  \text{ such that }\left(  2,2\right)  \in
\mathbf{v}\right) \\
&  =\underbrace{\left(  \text{\# of LPs from }\left(  0,0\right)  \text{ to
}\left(  2,2\right)  \right)  }_{=\dbinom{2+2-0-0}{2-0}}\cdot
\underbrace{\left(  \text{\# of LPs from }\left(  2,2\right)  \text{ to
}\left(  6,6\right)  \right)  }_{=\dbinom{6+6-2-2}{6-2}}.
\end{align*}

\end{proof}

\begin{definition}
A LP $\mathbf{v}$ is said to be \textbf{Catalan} if $x\geq y$ for each
$\left(  x,y\right)  \in\mathbf{v}$.

(Visually, this means that $\mathbf{v}$ never strays above the diagonal $x=y$.)
\end{definition}

(In [18f], I say \textquotedblleft legal\textquotedblright\ instead of
\textquotedblleft Catalan\textquotedblright.)

\begin{definition}
If $n,m\in\mathbb{Z}$, then we set%
\[
L_{n,m}=\left(  \text{\# of Catalan LPs from }\left(  0,0\right)  \text{ to
}\left(  n,m\right)  \right)  .
\]

\end{definition}

\begin{proposition}
\textbf{(a)} We have $L_{n,m}=L_{n-1,m}+L_{n,m-1}$ for any $n\in\mathbb{Z}$
and $m\in\mathbb{Z}$ satisfying $n\geq m$ and $\left(  n,m\right)  \neq\left(
0,0\right)  $.

\textbf{(b)} If $n\in\mathbb{N}$ and $m\in\mathbb{N}$ satisfy $n<m$, then
$L_{n,m}=0$.

\textbf{(c)} If $n\in\mathbb{N}$ and $m\in\mathbb{N}$ satisfy $n\geq m-1$,
then%
\[
L_{n,m}=\dbinom{n+m}{m}-\dbinom{n+m}{m-1}.
\]


\textbf{(d)} If $n\in\mathbb{N}$ and $m\in\mathbb{N}$ satisfy $n\geq m-1$,
then%
\[
L_{n,m}=\dfrac{n+1-m}{n+1}\dbinom{n+m}{m}.
\]


\textbf{(e)} For any $n\in\mathbb{N}$, we have%
\[
L_{n,n}=\dfrac{1}{n+1}\dbinom{2n}{n}.
\]

\end{proposition}

\begin{proof}
Main idea: Recall the notion of \textquotedblleft upsided
tuples\textquotedblright\ from MT3 exercise 4. There is a bijection%
\begin{align*}
\left\{  \text{Catalan LPs from }\left(  0,0\right)  \text{ to }\left(
n,m\right)  \right\}   &  \rightarrow\left\{  \text{upsided }\left(
n+m\right)  \text{-tuples }\left(  i_{1},i_{2},\ldots,i_{n+m}\right)  \text{
with }i_{1},i_{2},\ldots,i_{n+m}=n\right\}  ,\\
\left(  v_{0},v_{1},\ldots,v_{n}\right)   &  \mapsto\left(  i_{1},i_{2}%
,\ldots,i_{n+m}\right)  ,\ \ \ \ \ \ \ \ \ \ \text{where }i_{k}=\left[
v_{k}-v_{k-1}=\left(  1,0\right)  \right]  .
\end{align*}
Thus, the claims of \textbf{(b)} and \textbf{(c)} follow from MT3 exercise 4.
The claim of \textbf{(d)} follows by simple algebra from \textbf{(c)}. The
claim of \textbf{(e)} follows by applying \textbf{(d)} to $m=n$. The claim of
\textbf{(a)} follows by looking at the last step of a Catalan LP.
\end{proof}

\begin{definition}
For any $n\in\mathbb{N}$, the number $L_{n,n}=\dfrac{1}{n+1}\dbinom{2n}%
{n}=\dbinom{2n}{n}-\dbinom{2n}{n-1}$ is called the $n$\textbf{-th Catalan
number} and is denoted by $C_{n}$.
\end{definition}

See [Stanley, \textquotedblleft Catalan numbers\textquotedblright]. A few
other places where they appear are:

\begin{itemize}
\item Let us say that a permutation $\sigma\in S_{n}$ is \textbf{123-avoiding}
if there exist no $i<j<k$ in $\left[  n\right]  $ such that $\sigma\left(
i\right)  <\sigma\left(  j\right)  <\sigma\left(  k\right)  $. Then, the \# of
123-avoiding permutations $\sigma\in S_{n}$ is $C_{n}$.

\item Consider all possible ways to fully parenthesize a given expression
$a_{1}+a_{2}+\cdots+a_{n}$. For example, for $n=4$, these are%
\begin{align*}
&  \left(  a_{1}+a_{2}\right)  +\left(  a_{3}+a_{4}\right)
,\ \ \ \ \ \ \ \ \ \ \left(  a_{1}+\left(  a_{2}+a_{3}\right)  \right)
+a_{4},\\
&  a_{1}+\left(  \left(  a_{2}+a_{3}\right)  +a_{4}\right)
,\ \ \ \ \ \ \ \ \ \ a_{1}+\left(  a_{2}+\left(  a_{3}+a_{4}\right)  \right)
,\\
&  \left(  \left(  a_{1}+a_{2}\right)  +a_{3}\right)  +a_{4}.
\end{align*}
For any $n\in\mathbb{N}$, there are $C_{n-1}$ ways to do this.

\item Fix an $n\geq3$, and a convex $n$-gon $G_{n}$. How many ways are there
to triangulate $G_{n}$ (i.e., to subdivide $G_{n}$ into triangles whose
vertices are vertices of $G_{n}$) ?

The answer is $C_{n-2}$.
\end{itemize}

There are several variations on Catalan numbers and Catalan LPs, such as
$r$\textbf{-Catalan numbers}.

\section{Generating functions (introduction)}

We have already seen generating functions. Here are two more examples.

\textbf{Basic idea:} Any sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $
of numbers gives rise to a \textquotedblleft power series\textquotedblright%
\ $a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots$, called its \textquotedblleft%
\textbf{generating function}\textquotedblright. What exactly it is is a
question that would take us a while (see [Loehr, Ch. 7 (1st edition)] or
[Niven, \textquotedblleft Formal power series\textquotedblright] or [19s]),
but let us just calculate with these generating functions as if they were
polynomials in $x$. (Of course, they are not literally polynomials in $x$,
since they can have infinitely many nonzero coefficients.)

\textbf{Example 1.} Recall the Fibonacci sequence $\left(  f_{0},f_{1}%
,f_{2},\ldots\right)  $ with%
\[
f_{0}=0,\ \ \ \ \ \ \ \ \ \ f_{1}=1,\ \ \ \ \ \ \ \ \ \ f_{n}=f_{n-1}%
+f_{n-2}.
\]


Consider its gf (= generating function)%
\begin{align*}
F\left(  x\right)   &  =f_{0}+f_{1}x+f_{2}x^{2}+\cdots\\
&  =0+1x+1x^{2}+2x^{3}+3x^{4}+5x^{5}+8x^{6}+\cdots.
\end{align*}
Then,%
\begin{align*}
F\left(  x\right)   &  =f_{0}+f_{1}x+f_{2}x^{2}+f_{3}x^{3}+f_{4}x^{4}+\cdots\\
&  =\underbrace{0+1x}_{=x}+\underbrace{\left(  f_{1}+f_{0}\right)
x^{2}+\left(  f_{2}+f_{1}\right)  x^{3}+\left(  f_{3}+f_{2}\right)
x^{4}+\cdots}_{\substack{=\left(  f_{1}x^{2}+f_{2}x^{3}+f_{3}x^{4}%
+\cdots\right)  \\+\left(  f_{0}x^{2}+f_{1}x^{3}+f_{2}x^{4}+\cdots\right)
}}\\
&  =x+\underbrace{\left(  f_{1}x^{2}+f_{2}x^{3}+f_{3}x^{4}+\cdots\right)
}_{\substack{=f_{0}x+f_{1}x^{2}+f_{2}x^{3}+f_{3}x^{4}+\cdots\\\text{(since
}f_{0}=0\text{)}}}+\left(  f_{0}x^{2}+f_{1}x^{3}+f_{2}x^{4}+\cdots\right) \\
&  =x+\underbrace{\left(  f_{0}x+f_{1}x^{2}+f_{2}x^{3}+f_{3}x^{4}%
+\cdots\right)  }_{=xF\left(  x\right)  }+\underbrace{\left(  f_{0}x^{2}%
+f_{1}x^{3}+f_{2}x^{4}+\cdots\right)  }_{=x^{2}F\left(  x\right)  }\\
&  =x+xF\left(  x\right)  +x^{2}F\left(  x\right)  .
\end{align*}
Solving this equation for $F\left(  x\right)  $, we get%
\[
F\left(  x\right)  =\dfrac{x}{1-x-x^{2}}=\dfrac{x}{\left(  1-\phi x\right)
\left(  1-\psi x\right)  }%
\]
where $\phi=\dfrac{1+\sqrt{5}}{2}$ and $\psi=\dfrac{1-\sqrt{5}}{2}$ are the
\textquotedblleft golden ratios\textquotedblright. Applying partial fraction
decomposition to the RHS, we obtain%
\[
F\left(  x\right)  =\dfrac{x}{\left(  1-\phi x\right)  \left(  1-\psi
x\right)  }=\dfrac{1}{\sqrt{5}}\cdot\dfrac{1}{1-\phi x}-\dfrac{1}{\sqrt{5}%
}\cdot\dfrac{1}{1-\psi x}.
\]


Now, what are the coefficients of $\dfrac{1}{1-\alpha x}$ for $\alpha
\in\mathbb{C}$ ?

Well:%
\[
\dfrac{1}{1-x}=1+x+x^{2}+x^{3}+\cdots,
\]
because
\begin{align*}
&  \left(  1-x\right)  \left(  1+x+x^{2}+x^{3}+\cdots\right) \\
&  =\left(  1+x+x^{2}+x^{3}+\cdots\right)  -x\left(  1+x+x^{2}+x^{3}%
+\cdots\right) \\
&  =\left(  1+x+x^{2}+x^{3}+\cdots\right)  -\left(  x+x^{2}+x^{3}%
+\cdots\right)  =1.
\end{align*}
If we substitute $\alpha x$ for $x$ here, we obtain%
\begin{align*}
\dfrac{1}{1-\alpha x}  &  =1+\alpha x+\left(  \alpha x\right)  ^{2}+\left(
\alpha x\right)  ^{3}+\cdots\\
&  =1+\alpha x+\alpha^{2}x^{2}+\alpha^{3}x^{3}+\cdots.
\end{align*}
Thus, our formula for $F\left(  x\right)  $ becomes
\begin{align*}
F\left(  x\right)   &  =\dfrac{1}{\sqrt{5}}\cdot\dfrac{1}{1-\phi x}-\dfrac
{1}{\sqrt{5}}\cdot\dfrac{1}{1-\psi x}\\
&  =\dfrac{1}{\sqrt{5}}\cdot\left(  1+\phi x+\phi^{2}x^{2}+\phi^{3}%
x^{3}+\cdots\right)  -\dfrac{1}{\sqrt{5}}\cdot\left(  1+\psi x+\psi^{2}%
x^{2}+\psi^{3}x^{3}+\cdots\right) \\
&  =\dfrac{1-1}{\sqrt{5}}+\dfrac{\phi-\psi}{\sqrt{5}}x+\dfrac{\phi^{2}%
-\psi^{2}}{\sqrt{5}}x^{2}+\dfrac{\phi^{3}-\psi^{3}}{\sqrt{5}}x^{3}+\cdots.
\end{align*}
Now, comparing coefficients before $x^{n}$, we get
\[
f_{n}=\dfrac{\phi^{n}-\psi^{n}}{\sqrt{5}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\in\mathbb{N}.
\]
This is exactly Binet's formula. Unlike the first time we saw it, we now have
a motivated \textquotedblleft proof\textquotedblright\ of it.

However, of course, this is only a proof if we can explain

\begin{itemize}
\item what a power series is;

\item what $x$ is;

\item why we can divide by power series like $1-x-x^{2}$;

\item why we can substitute $\alpha x$ for $x$ into a power series;

\item why we can expand infinite sums;

\item $\ldots$
\end{itemize}

This is done nicely in [Loehr, Ch. 7 (1st edition)] and [19s] and in most
detailed textbooks on abstract algebra.

[18f] gives a quick overview. [Niven, \textquotedblleft Formal power
series\textquotedblright].

[Wilf, \textquotedblleft generatingfunctionology\textquotedblright].


\end{document}