\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}
\usepackage{pythonhighlight}
\usepackage[type={CC}, modifier={zero}, version={1.0},]{doclicense}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Saturday, December 25, 2021 16:51:19}
%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.meta}
\usetikzlibrary{chains}
\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{warning}[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}{\medskip \begin{small}}{\end{small} \medskip}
\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{warning}[1][Warning]{\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{\are}{\ar@{-}}
\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}}
\newcommand{\UNFINISHED}{\begin{center} \Huge{\textbf{Unfinished material begins here.}} \end{center} }
\iffalse
\NOEXPAND{\today}{\today}
\NOEXPAND{\sslash}{\sslash}
\NOEXPAND{\numboxed}[2]{\numboxed}
\NOEXPAND{\UNFINISHED}{\UNFINISHED}
\fi
\ihead{Math 235 notes}
\ohead{page \thepage}
\cfoot{\today}
\begin{document}

\title{Math 235: Mathematical Problem Solving}
\author{Darij Grinberg\thanks{Drexel University, Korman Center, 15 S 33rd Street,
Philadelphia PA, 19104, USA}}
\date{\today\ (unfinished!)}
\maketitle
\tableofcontents

\doclicenseThis


\section*{Preface}

This is the text accompanying my Math 235 (Mathematical Problem Solving) class
at Drexel University in Fall 2020. The website of this class can be found at%
\[
\text{\url{http://www.cip.ifi.lmu.de/~grinberg/t/20f}\ \ .}%
\]


\textbf{This document is a work in progress.} It might become a textbook one
day, but for now is a construction zone.

\textbf{Please report any errors you find to
\texttt{\href{mailto:darijgrinberg@gmail.com}{darijgrinberg@gmail.com}} .}

\subsection*{What is this?}

This course is an introduction to the art of mathematical problem solving.
This means solving the type of problems that usually are posed in competitions
(like the
\href{https://en.wikipedia.org/wiki/William_Lowell_Putnam_Mathematical_Competition}{Putnam
Competition} or the
\href{https://en.wikipedia.org/wiki/International_Mathematical_Olympiad}{International
Mathematical Olympiad}) or in journals (like the
\href{https://www.tandfonline.com/toc/uamm20/current}{American Mathematical
Monthly} or \href{https://cms.math.ca/publications/crux/}{Crux Mathematicorum}%
): self-contained mathematical questions that do not require any specialized
knowledge (beyond the basic undergraduate curriculum) to understand, but often
a significant amount of ingenuity, creativity and effort to solve, although
the resulting solutions again are readable without specialized knowledge.

There is no panacea for solving such problems; the hardest ones constitute
serious challenges for even the most well-trained solvers. Yet there is a
variety of ideas, techniques and tools that can help attacking these problems;
while they offer no guarantee of success, they are sufficiently useful that
they nowadays get systematically taught to olympiad participants in many
countries and universities. Most of these techniques are also helpful in
mathematical research -- even though the typical research question poses a
rather different kind of challenge than a competition problem.\footnote{For
starters, a researcher attacking a research question does not know whether it
has an answer and, if it has one, how difficult it will be to find; meanwhile,
questions posed in competitions have been \textquotedblleft
pre-solved\textquotedblright\ by their proposers and/or the selection
committees, and usually have a somewhat predictable level of difficulty. Also,
one of the frequent challenges in research is asking the right question; but
competitions preempt this challenge (although it tends to resurface in the
solving process, as one looks for useful auxiliary results).
\par
However, competition problems can (and often do) have a lot in common with
research questions; in particular, several have crystallized out of the
research of their proposers. For the solver, mathematical competitions can
provide inspiration and training for proper research; when designed well, they
are research \textquotedblleft writ small\textquotedblright.}

Some of these techniques are very basic. Mathematical induction, for example,
is fundamental to all of mathematics. The Pigeonhole Principle says (roughly
speaking) that if you put $6$ or more pigeons into $5$ pigeonholes, then at
least two pigeons will be roommates. The Extremal Principle says that (at
least) one of the pigeons has the longest beak. These principles are neither
surprising nor deep; but they can often be applied in unexpected and
surprising ways. We will study them mainly by exploring their applications, as
there is little to say about these principles themselves.

Another part of the problem solving toolkit is a selection of
\textquotedblleft little\textquotedblright\ theories (\textquotedblleft
little\textquotedblright\ in the sense of not going deep; typically, the main
results and their proofs fit on 20 pages at most). The most well-known such
theory is elementary number theory, due to a large extent to Euclid (or to
whoever discovered the results in his \textit{Elements}) and expanded somewhat
by Fermat, Euler and Gauss. The lore of polynomials (commonly over the
rational or complex numbers) can be regarded as another such theory, with
results like Viete's theorems. The art of elementary inequalities (like
Cauchy--Schwarz, H\"{o}lder, rearrangement), too, can be counted as a theory.

The tools and theories we will see are thus a cross-section of elementary
mathematics. This text will omit most of analysis (which will only appear in
some exercises; see \cite{GelAnd} for a lot more) and all of elementary
geometry (which is its own subject, worthy of its own books; see
\cite{Honsbe12} for a selection of neat results and \cite{Hadam09} for a
systematic introduction). We will also not use abstract algebra beyond a few
basic ideas that can be explained from scratch. As to linear algebra, we will
occasionally make use of it, but we will not introduce it, as there are enough
good texts for that.

This is not the first introductory text on mathematical problem solving, and
has no ambitions to be the last. The classics in this genre are Polya's
\cite{Polya81} and Engel's \cite{Engel}\footnote{The even earlier book
\cite{Polya73} by Polya is, in some ways, a harbinger of this kind of book,
although in itself it is too short (just a few dozen solved problems), too
philosophical (replete with didactical comments and Socratic dialogues) and
too basic (typical strategies suggested are \textquotedblleft do you know a
related problem?\textquotedblright\ and \textquotedblleft introduce suitable
notations\textquotedblright). Even in the much more content-rich and concrete
\cite{Polya81}, Polya spends quite a lot of space attempting to construct a
general theory of mathematical problem solving, with input from philosophy and
psychology (two chapters are called \textquotedblleft Rules of
Discovery?\textquotedblright\ and \textquotedblleft On Learning, Teaching, and
Learning Teaching\textquotedblright, although they are more hands-on than the
names may suggest).
\par
Engel's main innovation in \cite{Engel} was to scrap the philosophy and fill
as much of his book as possible with actual problems and solutions. The
problem solving strategies he presents are mathematical ones, and they are
taught by doing (worked examples, then problems). The occasional personal
story or heuristical remark gives some variety (but the mathematics itself is
already pretty varied, as one and the same strategy often has applications in
very different fields).
\par
In the notes you are now reading, I intend to stick to Engel's paradigm (but
aim at a higher level of detail).}; many other sources have been published
since, including \cite{GelAnd}, \cite{Zeitz17}, \cite{ZawHit09} and \cite[OTIS
Excerpts]{ChenEvan}\footnote{also, various books in foreign languages: e.g.,
\cite{ngrin} and \cite{Carl17} (in German) and \cite{Jarvin20} (in Finnish)
and \cite{DLPS16} (in Dutch)}. There is also a plenitude of problem books --
i.e., collections of (solved) problems either taken from a specific contest
(or journal) over the years (such as \cite{IMOcomp} or \cite{Strasz65}, or the
\textquotedblleft Hungarian Problem Books\textquotedblright\ published by the
MAA), or chosen from specific subjects (the classics in the latter genre are
\cite{DynUsp06}, \cite{ShChYa62}, \cite{YagYag64} and \cite{YagYag67}). The
present text intends to differ from these both in the choice of subjects and
in the choice of examples and problems (based on my personal taste); that
said, there is likely to be more overlap than difference, since both the most
important techniques and their most prominent examples are generally agreed upon.

\subsection*{Prerequisites}

I expect you, the reader, to be familiar with mathematical proofs. In
particular, you should be able to

\begin{itemize}
\item apply (and verify) arguments by mathematical induction, by
contradiction, by case distinction and by similar fundamental tactics,

\item write up your proofs at a reasonable level of mathematical rigor, and
read similarly rigorous proofs written by others (as frequently seen in
textbooks written for mathematics majors),

\item understand and use basic mathematical language such as the summation
sign\footnote{for example, $\sum_{k=a}^{b}\dfrac{1}{k}=\dfrac{1}{a}+\dfrac
{1}{a+1}+\cdots+\dfrac{1}{b}$} or set builder notation\footnote{for example,
$\left\{  i\in\mathbb{Z}\mid i\text{ is even}\right\}  $ for the set of all
even integers}.
\end{itemize}

\noindent If not, there is a whole industry of texts from which these skills
can be learned (such as \cite[Chapters 1--5]{LeLeMe16}, \cite{Day-proofs},
\cite{Hammac15}, \cite[Part I and Appendices A--B]{Newste20} and
\cite[Chapters 1--3]{Swanso20}, just to mention a few freely available
ones\footnote{I recommend the MIT text \cite{LeLeMe16} in particular for its
lively writing and its enjoyable exercises. It is long and goes far beyond the
basics; it has significant overlap with what I will be doing in this class.
\par
Newstead's \cite{Newste20} (work in progress) is also far more than an
introduction to proofs. It covers a lot of the \textquotedblleft no man's
land\textquotedblright\ between such an introduction and advanced courses.
\par
Swanson's \cite{Swanso20} is focussed on setting up the prerequisites for a
rigorous treatment of analysis.}).

\subsection*{Acknowledgments}

I thank Natalia Grinberg, Sam Hopkins, Pasha Pylyavskyy, Tom Roby and David
Speyer for helpful conversations on the problem solving literature.

\newpage

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

\subsection{\label{sect.intro.hw0}Homework set \#0: Diagnostic}

\textbf{This is a special problem set}: Its main purpose is to give you an
idea of what is to come in this course, and to give me an idea of your level
of familiarity with certain things (including proof writing). Do not expect to
solve all these problems.

This problem set \textbf{(and only this one!)} will be graded \textbf{on
completion} -- each problem will be graded out of 2; any serious work on a
problem (e.g., a partial solution, a particular case solved, or even an
attempt that shows you have thought about it) will get 2 points. (All future
problem sets will be graded \textbf{on correctness}, with a correct and
well-written solution worth 10 points.)

\bigskip

\textbf{Tips:}

\begin{itemize}
\item Ways to make partial progress can include

\begin{itemize}
\item trying out small values of $n$ (in problems that depend on an integer
$n$ -- even if it is not explicitly mentioned\footnote{E.g., a problem about a
polynomial always has an \textquotedblleft implicit $n$\textquotedblright,
namely the degree of the polynomial involved. Thus one can start by
considering polynomials of degrees $1,2,3$.}),

\item replacing some numbers by smaller numbers (to make the problem easier to
check on examples),

\item ruling some cases out, or

\item rewriting some of the expressions involved in the problem.
\end{itemize}

\item You don't need to be too detailed in your solutions (nor will I always
be in mine). If you solve (say) Exercise \ref{exe.laurent.t} by induction on
$n$, I trust you that you can do the base case without you going into the
details. Likewise, you don't need to show any intermediate steps when claiming
algebraic identities like $\left(  a^{2}+b^{2}+c^{2}\right)  -\left(
bc+ca+ab\right)  =\dfrac{1}{2}\left(  \left(  b-c\right)  ^{2}+\left(
c-a\right)  ^{2}+\left(  a-b\right)  ^{2}\right)  $; it is clear enough that
the reader can just expand both sides and compare. (Thus, your solution to
Exercise \ref{exe.factor.vdm-deg4} can consist of a single equation.) Details
are needed when a reader (who has been following the course, but doesn't
already know the solution of the specific problem) might realistically stumble
or get stuck.

%(On \textbf{this} homework set, you can be even more terse, since I'm grading
%it on completion.)


\item I \textbf{will} proofread your solutions, so this is a good chance to
get feedback on your writing before we get to homework worth more serious points.
\end{itemize}

\begin{exercise}
\label{exe.fac.reddit}Let $n$ be an even positive integer. Find a
$q\in\left\{  1,2,\ldots,2n\right\}  $ such that
\[
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{q!}\text{ is a perfect
square.}%
\]

\end{exercise}

\begin{exercise}
\label{exe.laurent.t}Define a sequence $\left(  t_{0},t_{1},t_{2}%
,\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{align*}
t_{0}  &  =1,\ \ \ \ \ \ \ \ \ \ t_{1}=1,\ \ \ \ \ \ \ \ \ \ t_{2}%
=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
t_{n}  &  =\dfrac{1+t_{n-1}t_{n-2}}{t_{n-3}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq3.
\end{align*}
(For example, $t_{3}=\dfrac{1+t_{2}t_{1}}{t_{0}}=\dfrac{1+1\cdot1}{1}=2$ and
$t_{4}=\dfrac{1+t_{3}t_{2}}{t_{1}}=\dfrac{1+2\cdot1}{1}=3$.)

\textbf{(a)} Prove that $t_{n+2}=4t_{n}-t_{n-2}$ for each $n\geq2$.

\textbf{(b)} Prove that $t_{n}$ is a positive integer for each integer
$n\geq0$.
\end{exercise}

The next exercise uses the \textit{floor function}, which is defined as follows:

\begin{definition}
\label{def.floor.floor}For every real $x$, we let $\left\lfloor x\right\rfloor
$ denote the largest integer that is $\leq x$. This integer $\left\lfloor
x\right\rfloor $ is called the \textit{floor} (or the \textit{integer part})
of $x$.
\end{definition}

For example, $\left\lfloor 3\right\rfloor =\left\lfloor \pi\right\rfloor =3$
and $\left\lfloor -\pi\right\rfloor =-4$. It is easy to see\footnote{and
well-known enough to be used without proof on any contest} that for every
$x\in\mathbb{R}$, we have%
\begin{equation}
\left\lfloor x\right\rfloor \leq x<\left\lfloor x\right\rfloor +1.
\label{sol.floor.hermite.lem1}%
\end{equation}
(Note that the chain of inequalities (\ref{sol.floor.hermite.lem1}) determines
$\left\lfloor x\right\rfloor $ uniquely, and thus can be used as an
alternative definition of $\left\lfloor x\right\rfloor $. This is how
$\left\lfloor x\right\rfloor $ is defined in \cite[Definition 1.1.1]{floor},
for example.) Older sources use the notation $\left[  x\right]  $ for
$\left\lfloor x\right\rfloor $; this notation, however, can mean many other things.

\begin{exercise}
\label{exe.floor.hermite}Let $x\in\mathbb{R}$ and let $n$ be a positive
integer. Prove that%
\[
\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor =\left\lfloor
nx\right\rfloor .
\]

\end{exercise}

\begin{exercise}
\label{exe.chip.abelkonkabc}Let $a,b,c,n$ be positive integers such that
$a\mid b^{n}$ and $b\mid c^{n}$ and $c\mid a^{n}$. Prove that $abc\mid\left(
a+b+c\right)  ^{n^{2}+n+1}$.
\end{exercise}

\begin{exercise}
\label{exe.lemmings}A mountain ridge has the form of a (finite) line segment,
bordered on each end by a cliff. Several (finitely many) lemmings are walking
along the ridge, with equal speeds (but not necessarily in the same
direction). Whenever two lemmings meet, they \textquotedblleft bounce
off\textquotedblright\ one another, keeping their respective speeds but
reversing their directions. Whenever a lemming arrives at an endpoint of the
ridge, it falls off the cliff. Prove that eventually, all lemmings will fall
off the cliff.

[\textbf{Example:} Here is a possible lemming configuration:%
\[
\underline{\ \ \ \ \ \ \ \ \ \ \overrightarrow{1}\ \ \ \ \overleftarrow{2}%
\ \ \ \ \ \ \overleftarrow{3}\ \ \ \ \ \ \ \ \ \ \ \ \ \overrightarrow{4}%
\ \ \ \ \ \ \ \ \ \ \overleftarrow{5}\ \ \ \ \ \ }%
\]
(with $1,2,3,4,5$ being the lemmings, and the arrows signifying their walking
directions). The first two lemmings to meet here will be $1$ and $2$, after
which they both change their directions:%
\[
\underline{\ \ \ \ \ \ \ \ \ \ \ \ \overleftarrow{1}\overrightarrow{2}%
\ \ \ \ \ \ \overleftarrow{3}%
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \overrightarrow{4}%
\ \ \ \ \ \ \overleftarrow{5}\ \ \ \ \ \ \ \ }%
\]
Now lemming $1$ is on its way to the cliff, which it will reach without
interference from other lemmings.]
\end{exercise}

\begin{exercise}
\label{exe.socks.intro}You have $20$ white socks and $20$ black socks hanging
on a clothesline, in some order.

\textbf{(a)} Prove that you can pick $10$ consecutive socks from the
clothesline such that $5$ of them are black and the other $5$ white. (You can
call such a pick \textit{color-balanced}.)

\textbf{(b)} Prove the same if the number $20$ is replaced by $13$ (so you
have $13$ white and $13$ black socks).

[\textbf{Example:} If the number $20$ is replaced by $7$, then the claim does
not hold. For example, the configuration $B^{3}W^{7}B^{4}$ (standing for
\textquotedblleft$3$ black socks, followed by $7$ white socks, followed by $4$
white socks\textquotedblright) has no color-balanced pick of $10$ consecutive socks.]
\end{exercise}

\begin{exercise}
\label{exe.factor.vdm-deg4}Factor the polynomial%
\[
bc\left(  b-c\right)  \left(  b+c\right)  +ca\left(  c-a\right)  \left(
c+a\right)  +ab\left(  a-b\right)  \left(  a+b\right)
\]
into a product of four linear (i.e., degree-$1$) polynomials.
\end{exercise}

\begin{exercise}
\label{exe.ineq.abs-qmo4a1}\textbf{(a)} Let $a,b,c$ be three nonnegative
reals. Prove that%
\[
\left\vert ca-ab\right\vert +\left\vert ab-bc\right\vert +\left\vert
bc-ca\right\vert \leq\left\vert b^{2}-c^{2}\right\vert +\left\vert c^{2}%
-a^{2}\right\vert +\left\vert a^{2}-b^{2}\right\vert .
\]


\textbf{(b)} Is this still true if the word \textquotedblleft
nonnegative\textquotedblright\ is omitted?
\end{exercise}

\begin{exercise}
\label{exe.nt.p1}Let $n\geq1$. Let $a_{1},a_{2},\ldots,a_{n}$ be any $n$
integers. Prove that there exist some $p,q\in\left\{  1,2,\ldots,n\right\}  $
with $p\leq q$ and $n\mid a_{p}+a_{p+1}+\cdots+a_{q}$.
\end{exercise}

\begin{exercise}
Briefly review the problems above: Which ones did you like? Which ones did you
not like? Why? How long did they take you? Which parts did you get stuck on?
Did you learn anything from solving (or trying to solve) them? If you knew the
solution already (nothing wrong with that!), where did you learn it? (No need
to rate every exercise; just say some words about some 4 of them.)
\end{exercise}

\newpage

\section{\label{chp.ind}Induction I}

Mathematical induction is essentially the main strategy for proving theorems
in mathematics: Any statement that involves a natural number (even implicitly,
such as by talking of a finite set) potentially lends itself to be proved by
induction. This does not mean induction is always the best way to go, or even
a viable one, but it is a method you should certainly not be
\textbf{surprised} to see working. Only recently, two long books
\cite{AndCri17} and \cite{Gunder10} (with 400 and 850 pages, respectively)
entirely devoted to applications of induction have appeared\footnote{This is
not to say that the method has not been appreciated before; it is just that
the idea of gathering mathematical results by their method of proof (as
opposed to their objects of concern) is fairly new.}. We will not go into this
depth or detail; but we will show examples for the most frequent ways in which
induction can be applied.

\subsection{Standard induction}

\begin{noncompile}
Here and in the following, the symbol $\mathbb{N}$ shall mean the set
$\left\{  0,1,2,\ldots\right\}  $. Its elements are called \textit{natural
numbers}.
\end{noncompile}

We assume you are familiar with standard mathematical induction. Just as a
reminder, it is a way to prove that a certain statement $\mathcal{A}\left(
n\right)  $ holds for every integer $n\geq g$, where $g$ is a fixed integer.
Stated as a theorem itself, here is what it says:

\begin{theorem}
\label{thm.ind-principle}Let $g\in\mathbb{Z}$. For each integer $n\geq g$, let
$\mathcal{A}\left(  n\right)  $ be a logical statement. Assume the following:

\begin{itemize}
\item \textit{Assumption 1:} The statement $\mathcal{A}\left(  g\right)  $ holds.

\item \textit{Assumption 2:} If $m$ is an integer such that $m\geq g$ and such
that $\mathcal{A}\left(  m\right)  $ holds, then $\mathcal{A}\left(
m+1\right)  $ also holds.
\end{itemize}

Then, $\mathcal{A}\left(  n\right)  $ holds for all integers $n\geq g$.
\end{theorem}

Theorem \ref{thm.ind-principle} is one of the facts known as the
\textit{principle of mathematical induction}. Some consider it to be an axiom;
others use essentially equivalent axioms that it can easily be derived
from.\footnote{You may have seen it stated for $g=0$ only (or for $g=1$ only).
But the general case of Theorem \ref{thm.ind-principle} easily follows from
these particular cases (see, e.g., \cite[proof of Theorem 2.53]{detnotes}).}
We will not dwell on its logical status, but rather explore its use.

Theorem \ref{thm.ind-principle} provides a way to prove any result that can be
stated in the form \textquotedblleft some statement $\mathcal{A}\left(
n\right)  $ holds for each integer $n\geq g$\textquotedblright\ (commonly, $g$
is taken to be $0$ or $1$, but any integer is fine). All one needs to do is to
prove Assumption 1 and Assumption 2. The proof of Assumption 1 is commonly
called the \textit{induction base} (or \textit{base case}), while the proof of
Assumption 2 is commonly called the \textit{induction step}. In the induction
step, the assumption that $\mathcal{A}\left(  m\right)  $ holds is called the
\textit{induction hypothesis} (or \textit{induction assumption}). The whole
proof is called an \textquotedblleft\textit{induction on} $n$%
\textquotedblright\ (or \textquotedblleft\textit{induction over }%
$n$\textquotedblright). Here is a simple example:

\begin{exercise}
\label{exe.ind.geoser-b}Let $b$ be a real number. Prove that
\begin{equation}
\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{n-1}\right)  =b^{n}-1
\label{eq.exe.ind.geoser-b.eq}%
\end{equation}
for each integer $n\geq0$.\ \ \ \ \footnotemark
\end{exercise}

\footnotetext{Note that if $n=0$, then the sum $b^{0}+b^{1}+\cdots+b^{n-1}$ is
an empty sum and thus equals $0$ by definition.}

\begin{proof}
[Solution to Exercise \ref{exe.ind.geoser-b}.]We will prove
(\ref{eq.exe.ind.geoser-b.eq}) by induction on $n$ (that is, we shall apply
Theorem \ref{thm.ind-principle} to $g=0$ and to $\mathcal{A}\left(  n\right)
$ being the statement (\ref{eq.exe.ind.geoser-b.eq})).

\textit{Induction base:} We have $\left(  b-1\right)  \underbrace{\left(
b^{0}+b^{1}+\cdots+b^{0-1}\right)  }_{=\left(  \text{empty sum}\right)
=0}=0=b^{0}-1$ (since $b^{0}=1$). In other words,
(\ref{eq.exe.ind.geoser-b.eq}) holds for $n=0$. This completes the induction base.

\textit{Induction step:} Let $m\geq0$ be an integer. Assume (as the induction
hypothesis) that (\ref{eq.exe.ind.geoser-b.eq}) holds for $n=m$. We must prove
that (\ref{eq.exe.ind.geoser-b.eq}) holds for $n=m+1$. In other words, we must
prove that $\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{\left(
m+1\right)  -1}\right)  =b^{m+1}-1$.

Our induction hypothesis says that (\ref{eq.exe.ind.geoser-b.eq}) holds for
$n=m$. In other words,%
\begin{equation}
\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)  =b^{m}-1.
\label{sol.ind.geoser-b.a.IH}%
\end{equation}
Now, $\left(  m+1\right)  -1=m$, so that%
\begin{align*}
\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{\left(  m+1\right)
-1}\right)   &  =\left(  b-1\right)  \underbrace{\left(  b^{0}+b^{1}%
+\cdots+b^{m}\right)  }_{=\left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)  +b^{m}}\\
&  =\left(  b-1\right)  \left(  \left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)
+b^{m}\right) \\
&  =\underbrace{\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)
}_{\substack{=b^{m}-1\\\text{(by (\ref{sol.ind.geoser-b.a.IH}))}%
}}+\underbrace{\left(  b-1\right)  b^{m}}_{=bb^{m}-b^{m}}\\
&  =b^{m}-1+bb^{m}-b^{m}=\underbrace{bb^{m}}_{=b^{m+1}}-1=b^{m+1}-1.
\end{align*}
But this is precisely what we need to prove. Thus, the induction step is
complete. Hence, (\ref{eq.exe.ind.geoser-b.eq}) is proved. Thus, Exercise
\ref{exe.ind.geoser-b} is solved.
\end{proof}

We note that if $b$ is a real number distinct from $1$, then the claim of
(\ref{eq.exe.ind.geoser-b.eq}) entails%
\begin{equation}
b^{0}+b^{1}+\cdots+b^{n-1}=\dfrac{b^{n}-1}{b-1}=\dfrac{1-b^{n}}{1-b}
\label{eq.exe.ind.geoser-b.eq2}%
\end{equation}
for each integer $n\geq0$. This is the classical formula for the sum of a
(finite) geometric progression. There are other proofs of this formula (in
particular, we shall prove something slightly more general in a later
chapter), but the induction proof that we gave above has the advantage of
being entirely straightforward.

A particularly simple particular case of Exercise \ref{exe.ind.geoser-b} is
the following: Each integer $n\geq0$ satisfies%
\begin{equation}
2^{0}+2^{1}+\cdots+2^{n-1}=2^{n}-1. \label{eq.exe.ind.geoser-b.b=2}%
\end{equation}
Indeed, this follows by applying Exercise \ref{exe.ind.geoser-b} to $b=2$
(since $2-1=1$).

\begin{noncompile}
The following is correct but not useful:

\begin{lemma}
\label{lem.ind.geoser-app}Let $b$ be a real number such that $b>1$. Let $r$ be
a real number. Then, there exists some integer $n\geq0$ such that $b^{n}>r$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ind.geoser-app}.]We have $b-1>0$ (since $b>1$).
Hence, $\dfrac{r}{b-1}$ is a well-defined real number. Thus, there exists an
integer $m$ such that $m>\dfrac{r}{b-1}$ (since the set of integers has no
upper bound). Consider this $m$. Now, Exercise \ref{exe.ind.geoser-b} (applied
to $n=m$) yields that $\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots
+b^{m-1}\right)  =b^{m}-1$. But all of the $m$ reals $b^{0},b^{1}%
,\ldots,b^{m-1}$ are $\geq1$ (since $b>1$). Hence,%
\[
\underbrace{b^{0}}_{\geq1}+\underbrace{b^{1}}_{\geq1}+\cdots
+\underbrace{b^{m-1}}_{\geq1}\geq\underbrace{1+1+\cdots+1}_{m\text{ times}%
}=m>\dfrac{r}{b-1}.
\]
We can multiply this inequality by $b-1$ (since $b-1>0$), and thus obtain
\[
\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)  >r.
\]
Hence,%
\[
r<\left(  b-1\right)  \left(  b^{0}+b^{1}+\cdots+b^{m-1}\right)
=b^{m}-1<b^{m},
\]
so that $b^{m}>r$. Thus, there exists some integer $n\geq0$ such that
$b^{n}>r$ (namely, $n=m$). This proves Lemma \ref{lem.ind.geoser-app}.
\end{proof}
\end{noncompile}

Here is another basic example for a proof by induction (which appears, e.g.,
in \cite[Proposition 2.164]{detnotes}, in \cite[Exercise 74]{Gunder10} and in
\cite[Problem 2.2]{AndCri17}):

\begin{exercise}
\label{exe.ind.alt-har-sum-2n}Prove that every integer $n\geq0$ satisfies%
\begin{equation}
\dfrac{1}{1}-\dfrac{1}{2}+\dfrac{1}{3}-\dfrac{1}{4}+\cdots+\dfrac{1}%
{2n-1}-\dfrac{1}{2n}=\dfrac{1}{n+1}+\dfrac{1}{n+2}+\cdots+\dfrac{1}{2n}.
\label{eq.exe.ind.alt-har-sum-2n.eq}%
\end{equation}

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ind.alt-har-sum-2n}.]Let us denote the left
hand side of (\ref{eq.exe.ind.alt-har-sum-2n.eq}) by $L\left(  n\right)  $,
and let us denote the right hand side by $R\left(  n\right)  $. That is, we
set%
\begin{align*}
L\left(  n\right)   &  =\dfrac{1}{1}-\dfrac{1}{2}+\dfrac{1}{3}-\dfrac{1}%
{4}+\cdots+\dfrac{1}{2n-1}-\dfrac{1}{2n}\ \ \ \ \ \ \ \ \ \ \text{and}\\
R\left(  n\right)   &  =\dfrac{1}{n+1}+\dfrac{1}{n+2}+\cdots+\dfrac{1}{2n}%
\end{align*}
for each $n\geq0$. Thus, we need to prove that $L\left(  n\right)  =R\left(
n\right)  $ for each $n\geq0$. We shall do this by induction on $n$ (that is,
we shall apply Theorem \ref{thm.ind-principle} to $g=0$ and $\mathcal{A}%
\left(  n\right)  =\left(  \text{\textquotedblleft}L\left(  n\right)
=R\left(  n\right)  \text{\textquotedblright}\right)  $).

\textit{Induction base:} The equality $L\left(  0\right)  =R\left(  0\right)
$ holds, since both $L\left(  0\right)  $ and $R\left(  0\right)  $ are empty
sums (and thus $0$). In other words, $L\left(  n\right)  =R\left(  n\right)  $
holds for $n=0$. This completes the induction base.

\textit{Induction step:} Let $m\geq0$ be an integer. Assume (as the induction
hypothesis) that $L\left(  m\right)  =R\left(  m\right)  $. We must prove that
$L\left(  m+1\right)  =R\left(  m+1\right)  $.

The definition of $L\left(  n\right)  $ shows that $L\left(  m+1\right)  $ is
the same sum as $L\left(  m\right)  $ except with the two extra addends
$\dfrac{1}{2\left(  m+1\right)  -1}$ and $-\dfrac{1}{2\left(  m+1\right)  }$
added to it. Thus,%
\begin{equation}
L\left(  m+1\right)  =L\left(  m\right)  +\dfrac{1}{2\left(  m+1\right)
-1}-\dfrac{1}{2\left(  m+1\right)  }. \label{sol.exe.ind.alt-har-sum-2n.4L}%
\end{equation}
The definition of $R\left(  n\right)  $ shows that $R\left(  m+1\right)  $ is
the same sum as $R\left(  m\right)  $ except without the addend $\dfrac
{1}{m+1}$ but with the two new addends $\dfrac{1}{2m+1}$ and $\dfrac{1}{2m+2}$
added to it. Thus,%
\begin{equation}
R\left(  m+1\right)  =R\left(  m\right)  -\dfrac{1}{m+1}+\dfrac{1}%
{2m+1}+\dfrac{1}{2m+2}. \label{sol.exe.ind.alt-har-sum-2n.4R}%
\end{equation}
Now it is clear what to do: We need to show that the left hand sides of the
two equalities (\ref{sol.exe.ind.alt-har-sum-2n.4L}) and
(\ref{sol.exe.ind.alt-har-sum-2n.4R}) are equal, but we know that the
$L\left(  m\right)  $ and $R\left(  m\right)  $ terms on their right hand
sides are equal (since $L\left(  m\right)  =R\left(  m\right)  $ by
assumption). So we need to show that the remaining terms on the right hand
sides are also equal -- i.e., that we have%
\[
\dfrac{1}{2\left(  m+1\right)  -1}-\dfrac{1}{2\left(  m+1\right)  }=-\dfrac
{1}{m+1}+\dfrac{1}{2m+1}+\dfrac{1}{2m+2}.
\]
But this can be checked by a straightforward computation (which is simplified
by the facts that $2\left(  m+1\right)  -1=2m+1$ and $2m+2=2\left(
m+1\right)  $). Thus, the right hand sides of
(\ref{sol.exe.ind.alt-har-sum-2n.4L}) and (\ref{sol.exe.ind.alt-har-sum-2n.4R}%
) are equal (since $L\left(  m\right)  =R\left(  m\right)  $), and therefore
so are the left hand sides. In other words, $L\left(  m+1\right)  =R\left(
m+1\right)  $. This completes the induction step. Exercise
\ref{exe.ind.alt-har-sum-2n} is thus solved.
\end{proof}

Equalities between finite sums (such as in Exercise
\ref{exe.ind.alt-har-sum-2n}) provide lots of exercise in using induction; for
example, you can use induction to prove the equalities%
\begin{align}
1+2+\cdots+n  &  =\dfrac{n\left(  n+1\right)  }{2};
\label{eq.ind.little-gauss}\\
1-2+3-4\pm\cdots+\left(  -1\right)  ^{n}\left(  n+1\right)   &  =%
\begin{cases}
n/2+1, & \text{if }n\text{ is even;}\\
-\left(  n+1\right)  /2, & \text{if }n\text{ is odd;}%
\end{cases}
\nonumber\\
1^{2}+2^{2}+\cdots+n^{2}  &  =\dfrac{n\left(  n+1\right)  \left(  2n+1\right)
}{6};\nonumber\\
1^{3}+2^{3}+\cdots+n^{3}  &  =\left(  \dfrac{n\left(  n+1\right)  }{2}\right)
^{2};\nonumber\\
1^{4}+2^{4}+\cdots+n^{4}  &  =\dfrac{n\left(  2n+1\right)  \left(  n+1\right)
\left(  3n+3n^{2}-1\right)  }{30}\nonumber
\end{align}
for each integer $n\geq0$ (see \cite[\S 2.4]{detnotes} and \cite[Exercise
2.9]{detnotes}, respectively, for detailed proofs of the first two equalities).

We shall now come to a more combinatorial application. Recall that a
\textit{bit} is defined to be an element of the $2$-element set $\left\{
0,1\right\}  $.

\begin{exercise}
\label{exe.graycode.exists}Fix a positive integer $n$. An $n$%
\textit{-bitstring} shall mean an $n$-tuple $\left(  a_{1},a_{2},\ldots
,a_{n}\right)  \in\left\{  0,1\right\}  ^{n}$ of bits. Prove that there exists
a list $\left(  b_{1},b_{2},\ldots,b_{2^{n}}\right)  $ containing all
$n$-bitstrings (each exactly once) such that for every $i\in\left\{
1,2,\ldots,2^{n}\right\}  $, the two $n$-bitstrings $b_{i}$ and $b_{i-1}$
differ in exactly one entry. Here, we understand $b_{0}$ to mean $b_{2^{n}}$.

[\textbf{Example:} For $n=3$, one such list is $\left(  b_{1},b_{2}%
,\ldots,b_{8}\right)  $, where%
\begin{align*}
b_{1}  &  =\left(  0,0,0\right)  ,\ \ \ \ \ \ \ \ \ \ b_{2}=\left(
0,0,1\right)  ,\ \ \ \ \ \ \ \ \ \ b_{3}=\left(  0,1,1\right)
,\ \ \ \ \ \ \ \ \ \ b_{4}=\left(  0,1,0\right)  ,\\
b_{5}  &  =\left(  1,1,0\right)  ,\ \ \ \ \ \ \ \ \ \ b_{6}=\left(
1,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ b_{7}=\left(  1,0,1\right)
,\ \ \ \ \ \ \ \ \ \ b_{8}=\left(  1,0,0\right)  .
\end{align*}
It is far from the only such list.]
\end{exercise}

Before we solve this exercise, a few comments on its significance are in
order. A list $\left(  b_{1},b_{2},\ldots,b_{2^{n}}\right)  $ satisfying the
requirement of Exercise \ref{exe.graycode.exists} is known as a
\textit{(circular) Gray code}. Quoting
\href{https://en.wikipedia.org/wiki/Gray_code}{the (extensive) Wikipedia
article on these}:

\begin{statement}
\textquotedblleft Gray codes are used in linear and rotary position encoders
(absolute encoders and quadrature encoders) in preference to weighted binary
encoding. This avoids the possibility that, when multiple bits change in the
binary representation of a position, a misread will result from some of the
bits changing before others.\textquotedblright
\end{statement}

That is, the property that $b_{i}$ and $b_{i-1}$ differ in exactly one entry
ensures that $b_{i-1}$ can be turned into $b_{i}$ by only changing a single
bit, which removes the need for changing several bits simultaneously to
prevent unintended intermediate states.

Another way to think of Exercise \ref{exe.graycode.exists} is as follows:
Imagine a combination lock with $n$ dials, where each dial has exactly $2$
disks labeled $0$ and $1$. Then, a Gray code provides a way to cycle through
all $2^{n}$ possible combinations in a way that getting from each combination
to the other (and from the last back to the first) only requires rotating a
single dial. Variants of Gray codes exist for dials with more than $2$ disks,
and for various other similar situations; a comprehensive discussion of
various such contraptions can be found in \cite[\S 7.2.1.1]{TAoCP4A}%
.\footnote{We note that Exercise \ref{exe.graycode.exists} is also a popular
contest problem. For instance, Problem A3 on the Putnam Mathematical
Competition 1968 is a thinly-veiled restatement of Exercise
\ref{exe.graycode.exists} (more precisely, of a weaker version of this
exercise, which requires $b_{i}$ and $b_{i-1}$ differ in exactly one entry
only for $i\in\left\{  1,2,\ldots,2^{n}-1\right\}  $ rather than for all
$i\in\left\{  1,2,\ldots,2^{n}\right\}  $).}

\begin{proof}
[Solution to Exercise \ref{exe.graycode.exists} (sketched).]We define an
$n$\textit{-Gray code} to be a list $\left(  b_{1},b_{2},\ldots,b_{2^{n}%
}\right)  $ containing all $n$-bitstrings (each exactly once) such that for
every $i\in\left\{  1,2,\ldots,2^{n}\right\}  $, the two $n$-bitstrings
$b_{i}$ and $b_{i-1}$ differ in exactly one entry, where $b_{0}$ means
$b_{2^{n}}$. Thus, the exercise wants us to prove that there exists an
$n$-Gray code.

We shall prove this by induction on $n$, so we forget that we fixed $n$. Note
that we have to start our induction at $n=1$ (that is, we must apply Theorem
\ref{thm.ind-principle} to $g=1$), since the exercise is stated for all
positive integers $n$ (rather than for all integers $n\geq0$, as the two
previous exercises were).

\textit{Induction base:} There exists a $1$-Gray code -- namely, the list
$\left(  \left(  0\right)  ,\left(  1\right)  \right)  $. Thus, Exercise
\ref{exe.graycode.exists} is proved\footnote{Here, we are being slightly
sloppy with our language: When we say \textquotedblleft Exercise
\ref{exe.graycode.exists}\textquotedblright, we mean \textquotedblleft the
claim of Exercise \ref{exe.graycode.exists}\textquotedblright. Thus,
\textquotedblleft Exercise \ref{exe.graycode.exists} is
proved\textquotedblright\ means \textquotedblleft the claim of Exercise
\ref{exe.graycode.exists} is proved\textquotedblright. We shall use this
sloppy language occasionally, as it saves us space.} for $n=1$. This completes
the induction base.

\textit{Induction step:} Let $m\geq1$ be an integer. Assume (as the induction
hypothesis) that there exists an $m$-Gray code. We must show that there exists
an $\left(  m+1\right)  $-Gray code.

We introduce a notation: For any $m$-bitstring $a=\left(  a_{1},a_{2}%
,\ldots,a_{m}\right)  $, we let $0a$ denote the $\left(  m+1\right)
$-bitstring $\left(  0,a_{1},a_{2},\ldots,a_{m}\right)  $, and we let $1a$
denote the $\left(  m+1\right)  $-bitstring $\left(  1,a_{1},a_{2}%
,\ldots,a_{m}\right)  $. Thus, $0a$ and $1a$ are the two possible $\left(
m+1\right)  $-bitstrings that can be obtained from $a$ by inserting a new bit
at the front. For example, if $a=\left(  1,1,0\right)  $ (so $m=3$), then
$0a=\left(  0,1,1,0\right)  $ and $1a=\left(  1,1,1,0\right)  $.

We have assumed that there exists an $m$-Gray code; let $\left(  b_{1}%
,b_{2},\ldots,b_{2^{m}-1},b_{2^{m}}\right)  $ be this $m$-Gray code. Then,
\[
\left(  0b_{1},0b_{2},\ldots,0b_{2^{m}-1},0b_{2^{m}},1b_{2^{m}},1b_{2^{m}%
-1},\ldots,1b_{2},1b_{1}\right)
\]
(note that the subscripts first go up from $1$ to $2^{m}$, then go back down
from $2^{m}$ to $1$) is an $\left(  m+1\right)  $-Gray code (check this!).
Thus, there exists an $\left(  m+1\right)  $-Gray code. This completes the
induction step. Thus, Exercise \ref{exe.graycode.exists} is solved by induction.
\end{proof}

The verb \textquotedblleft\textit{induct}\textquotedblright\ is often used to
mean \textquotedblleft perform an induction\textquotedblright. Thus, for
instance, in the above proof, we could have said \textquotedblleft We induct
on $n$\textquotedblright\ instead of \textquotedblleft We shall prove this by
induction on $n$\textquotedblright. A proof by induction is also known as an
\textit{inductive proof}.\footnote{This is not to be confused with the
epistemological concept of \textquotedblleft inductive
reasoning\textquotedblright, which is not a proof method.}

As mentioned above, when one inducts on $n$ to prove a statement, the $n$
needs not explicitly appear in the statement; it suffices that the statement
can be restated in a way that contains an $n$. As an example, let us show the
following (seemingly evident) fact:

\begin{proposition}
\label{prop.ind.fin-min}Let $S$ be a nonempty finite set of integers. Then,
$S$ has a maximum.
\end{proposition}

Recall that a \textquotedblleft\textit{maximum}\textquotedblright\ (also known
as a \textquotedblleft\textit{largest element}\textquotedblright) of a set $S$
of integers\footnote{You can replace \textquotedblleft
integers\textquotedblright\ by \textquotedblleft rational
numbers\textquotedblright\ or \textquotedblleft real numbers\textquotedblright%
\ here, and nothing will change.} is defined to be an element $s\in S$ such
that we have $s\geq t$ for all $t\in S$. It is easy to see that any set of
integers has at most one maximum (because if $s_{1}$ and $s_{2}$ are two
maxima of the same set, then $s_{1}\geq s_{2}$ and $s_{2}\geq s_{1}$, whence
$s_{1}=s_{2}$); but some sets of integers have none. (For example, the sets
$\varnothing$ and $\mathbb{Z}$ have none.) Proposition \ref{prop.ind.fin-min}
says that for a nonempty finite set, there always is a maximum (and thus,
according to what we just said, a unique maximum).

\begin{proof}
[Proof of Proposition \ref{prop.ind.fin-min} (sketched).](See \cite[first
proof of Theorem 2.35]{detnotes} for details\footnote{This said, \cite[first
proof of Theorem 2.35]{detnotes} is organized somewhat differently (in
particular, most of the argument is relegated into a lemma), and uses the
nonnegative integer $\left\vert S\right\vert -1$ instead of the positive
integer $\left\vert S\right\vert $ to do the induction.}.) Forget that we
fixed $S$. We thus must prove the following:

\begin{statement}
\textit{Claim 1:} Every nonempty finite set $S$ of integers has a maximum.
\end{statement}

We can rewrite this claim as follows:

\begin{statement}
\textit{Claim 2:} Let $n$ be a positive integer. Then, every $n$-element set
of integers has a maximum.
\end{statement}

Claim 2 is equivalent to Claim 1, because a set $S$ is a nonempty and finite
if and only if its size $\left\vert S\right\vert $ is a positive integer. But
Claim 2 has the advantage of depending on a positive integer $n$, which gives
us an opportunity to use induction. And that's what we will do now:

[\textit{Proof of Claim 2:} We induct on $n$:

\textit{Induction base:} Every $1$-element set of integers has a maximum
(namely, its unique element). In other words, Claim 2 holds for $n=1$. This
completes the induction base.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Claim 2 holds for $n=m$. We must prove that Claim 2
holds for $n=m+1$. In other words, we must prove that every $\left(
m+1\right)  $-element set of integers has a maximum.

So let $S$ be an $\left(  m+1\right)  $-element set of integers. Then,
$\left\vert S\right\vert =m+1\geq1>0$, so that $S$ is nonempty. Hence, there
exists some $s\in S$. Consider such an $s$. The set $S\setminus\left\{
s\right\}  $ then must be an $m$-element set (since $S$ is an $\left(
m+1\right)  $-element set), and thus has a maximum (because our induction
hypothesis says that every $m$-element set of integers has a maximum). Let $t$
be this maximum.

Now, we can see that $S$ has a maximum: Indeed, if $t\geq s$, then $t$ is a
maximum of $S$, whereas otherwise, $s$ is a maximum of $S$. (Check this!)

Forget that we fixed $S$. We thus have proved that every $\left(  m+1\right)
$-element set $S$ of integers has a maximum. In other words, Claim 2 holds for
$n=m+1$. This completes the induction step. Claim 2 is thus proved.]

Since Claim 2 is equivalent to Claim 1, we thus conclude that Claim 1 also
holds, i.e., Proposition \ref{prop.ind.fin-min} is proved.
\end{proof}

In advanced mathematics, most inductions are of the kind we just showed
(although usually more complicated) -- i.e., the $n$ that is being inducted
upon does not explicitly appear in the claim that is being proved, but rather
is a \textquotedblleft derived quantity\textquotedblright\ (like the size
$\left\vert S\right\vert $ of the set $S$ in the above proof). Commonly, this
is done quickly and tacitly -- that is, instead of restating the claim in
terms of $n$ as we did above, one simply says that one is doing an induction
on the derived quantity (i.e., in the above example, an induction on
$\left\vert S\right\vert $). See \cite[\S 2.5.3]{detnotes} for the exact
convention that is being used here; let me just show how the above proof could
be rewritten using this convention:

\begin{proof}
[Proof of Proposition \ref{prop.ind.fin-min} (short version).](See
\cite[second proof of Theorem 2.35]{detnotes} for details.) Forget that we
fixed $S$. Notice that $\left\vert S\right\vert $ is a positive integer
whenever $S$ is a nonempty finite set. Hence, we induct on $\left\vert
S\right\vert $:

\textit{Induction base:} If $S$ is a nonempty finite set of integers
satisfying $\left\vert S\right\vert =1$, then $S$ has a maximum (namely, its
unique element). In other words, Proposition \ref{prop.ind.fin-min} holds for
$\left\vert S\right\vert =1$. This completes the induction base.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Proposition \ref{prop.ind.fin-min} holds for
$\left\vert S\right\vert =m$. We must prove that Proposition
\ref{prop.ind.fin-min} holds for $\left\vert S\right\vert =m+1$. In other
words, we must prove that every nonempty finite set $S$ of integers satisfying
$\left\vert S\right\vert =m+1$ has a maximum.

So let $S$ be a nonempty finite set of integers satisfying $\left\vert
S\right\vert =m+1$. Then, $\left\vert S\right\vert =m+1\geq1>0$, so that $S$
is nonempty. Hence, there exists some $s\in S$. Consider such an $s$. The set
$S\setminus\left\{  s\right\}  $ then satisfies $\left\vert S\setminus\left\{
s\right\}  \right\vert =\left\vert S\right\vert -1=m$ (since $\left\vert
S\right\vert =m+1$), and thus is nonempty (since $m$ is a positive integer);
hence, this set $S\setminus\left\{  s\right\}  $ has a maximum (because our
induction hypothesis says that every nonempty finite set of integers that has
size $m$ has a maximum). Let $t$ be this maximum.

Now, we can see that $S$ has a maximum: Indeed, if $t\geq s$, then $t$ is a
maximum of $S$, whereas otherwise, $s$ is a maximum of $S$. (Check this!)

Forget that we fixed $S$. We thus have proved that every nonempty finite set
$S$ of integers satisfying $\left\vert S\right\vert =m+1$ has a maximum. In
other words, Proposition \ref{prop.ind.fin-min} holds for $\left\vert
S\right\vert =m+1$. This completes the induction step. Proposition
\ref{prop.ind.fin-min} is thus proved.
\end{proof}

We shall see more complicated examples of induction on a derived quantity soon.

\subsection{Fibonacci numbers I}

The Fibonacci sequence, with its recursive definition and multiple properties,
is a veritable induction playground. But it is also an object of serious
research; a whole book about it has been written \cite{Vorobi02}, and the
\textit{\href{https://www.mathstat.dal.ca/fibonacci/}{\textit{Fibonacci
Association}}} publishes the
\textit{\href{https://www.mathstat.dal.ca/fibonacci/}{\textit{Fibonacci
Quarterly}}} since 1963 and organizes the two-yearly \textit{Fibonacci
Conference}. Arguably these are only partly concerned with the Fibonacci
sequence, but its role in them is substantial if not leading.

Let us recall the definition of this venerable sequence and show a few of its
properties; we'll see more of it at times later on.

\begin{definition}
\label{def.fibonacci}The
\textit{\href{https://en.wikipedia.org/wiki/Fibonacci_number}{Fibonacci
sequence}} is the sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ of
integers which is defined recursively by
\[
f_{0}=0,\ \ \ \ \ \ \ \ \ \ f_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ f_{n}=f_{n-1}+f_{n-2}\text{ for all }n\geq2.
\]
The entries of this sequence are called the \textit{Fibonacci numbers}.
\end{definition}

The first Fibonacci numbers are%
\begin{align*}
f_{0}  &  =0,\ \ \ \ \ \ \ \ \ \ f_{1}=1,\ \ \ \ \ \ \ \ \ \ f_{2}%
=1,\ \ \ \ \ \ \ \ \ \ f_{3}=2,\ \ \ \ \ \ \ \ \ \ f_{4}%
=3,\ \ \ \ \ \ \ \ \ \ f_{5}=5,\\
f_{6}  &  =8,\ \ \ \ \ \ \ \ \ \ f_{7}=13,\ \ \ \ \ \ \ \ \ \ f_{8}%
=21,\ \ \ \ \ \ \ \ \ \ f_{9}=34,\ \ \ \ \ \ \ \ \ \ f_{10}=55,\\
f_{11}  &  =89,\ \ \ \ \ \ \ \ \ \ f_{12}=144,\ \ \ \ \ \ \ \ \ \ f_{13}=233.
\end{align*}


Some authors\footnote{such as Vorobiev in his book \cite{Vorobi02}} prefer to
start the sequence at $f_{1}$ rather than $f_{0}$; of course, the recursive
definition then needs to be modified to require $f_{2}=1$ instead of $f_{0}=0$.

The first property of Fibonacci numbers that we prove is the following:

\begin{exercise}
\label{exe.fibonacci.first-sum}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Prove that each integer $n\geq0$ satisfies%
\begin{equation}
f_{1}+f_{2}+\cdots+f_{n}=f_{n+2}-1. \label{eq.exe.fibonacci.first-sum.eq}%
\end{equation}

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.fibonacci.first-sum}.]We prove
(\ref{eq.exe.fibonacci.first-sum.eq}) by induction on $n$:

\textit{Induction base:} We have $f_{1}+f_{2}+\cdots+f_{0}=\left(  \text{empty
sum}\right)  =0=f_{2}-1$ (since $f_{2}=1$). In other words,
(\ref{eq.exe.fibonacci.first-sum.eq}) holds for $n=0$. This completes the
induction base.\footnote{We will no longer write this sentence at the end of
an induction base, since the \textquotedblleft\textit{Induction step:}%
\textquotedblright\ that follows it should make it clear enough that the
induction base ends here.}

\textit{Induction step:} Let $m\geq0$. Assume (as the induction hypothesis)
that (\ref{eq.exe.fibonacci.first-sum.eq}) holds for $n=m$. We must show that
(\ref{eq.exe.fibonacci.first-sum.eq}) holds for $n=m+1$.

Our assumption says that (\ref{eq.exe.fibonacci.first-sum.eq}) holds for
$n=m$; in other words, $f_{1}+f_{2}+\cdots+f_{m}=f_{m+2}-1$.

Now, our goal is to prove that (\ref{eq.exe.fibonacci.first-sum.eq}) holds for
$n=m+1$; in other words, our goal is to prove that $f_{1}+f_{2}+\cdots
+f_{m+1}=f_{m+3}-1$ (since this is what (\ref{eq.exe.fibonacci.first-sum.eq})
says for $n=m+1$). But this follows by comparing%
\[
f_{1}+f_{2}+\cdots+f_{m+1}=\underbrace{\left(  f_{1}+f_{2}+\cdots
+f_{m}\right)  }_{=f_{m+2}-1}+f_{m+1}=f_{m+2}-1+f_{m+1}%
\]
with%
\[
\underbrace{f_{m+3}}_{\substack{=f_{m+2}+f_{m+1}\\\text{(by the recursive
definition}\\\text{of the Fibonacci sequence)}}}-1=f_{m+2}+f_{m+1}%
-1=f_{m+2}-1+f_{m+1}.
\]
So we have shown that (\ref{eq.exe.fibonacci.first-sum.eq}) holds for $n=m+1$.
This completes the induction step, and thus proves
(\ref{eq.exe.fibonacci.first-sum.eq}). Hence, Exercise
\ref{exe.fibonacci.first-sum} is solved.
\end{proof}

Let us briefly discuss two notational aspects of induction. So far, we have
always been using the letter $m$ for the integer that is introduced in the
induction step, because it was called $m$ in the statement of Theorem
\ref{thm.ind-principle}. Clearly, we can use any other letter (for example,
$k$) instead, as long as that letter does not already have a different
meaning. It is also perfectly fine to use $k-1$ for it -- i.e., instead of
assuming that the claim holds for $n=m$ and proving that it holds for $n=m+1$,
we can just as well assume that the claim holds for $n=k-1$ and prove that it
holds for $n=k$. (Of course, if we do this, then we need to assume $k>g$
instead of $k\geq g$.) This just boils down to substituting $k-1$ for $m$ in
Theorem \ref{thm.ind-principle}. Here is how Theorem \ref{thm.ind-principle}
looks like after this substitution:

\begin{theorem}
\label{thm.ind-principle.k-1}Let $g\in\mathbb{Z}$. For each integer $n\geq g$,
let $\mathcal{A}\left(  n\right)  $ be a logical statement. Assume the following:

\begin{itemize}
\item \textit{Assumption 1:} The statement $\mathcal{A}\left(  g\right)  $ holds.

\item \textit{Assumption 2:} If $k$ is an integer such that $k>g$ and such
that $\mathcal{A}\left(  k-1\right)  $ holds, then $\mathcal{A}\left(
k\right)  $ also holds.
\end{itemize}

Then, $\mathcal{A}\left(  n\right)  $ holds for all integers $n\geq g$.
\end{theorem}

As an example for an induction proof written in this way, let us prove another
property of the Fibonacci sequence (the so-called \textit{Cassini identity}):

\begin{exercise}
\label{exe.fib.cassini}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Prove that%
\[
f_{n+1}f_{n-1}-f_{n}^{2}=\left(  -1\right)  ^{n}%
\]
for any positive integer $n$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.fib.cassini}.]We induct on $n$ (using Theorem
\ref{thm.ind-principle.k-1}):

\textit{Induction base:} We have $f_{0}=0$, $f_{1}=1$ and $f_{2}=1$. Thus,
$f_{2}f_{0}-f_{1}^{2}=1\cdot0-1^{2}=-1=\left(  -1\right)  ^{1}$. In other
words, Exercise \ref{exe.fib.cassini} holds for $n=1$.

\textit{Induction step:} Let $k$ be an integer such that $k>1$. Assume (as the
induction hypothesis) that Exercise \ref{exe.fib.cassini} holds for $n=k-1$.
We must show that Exercise \ref{exe.fib.cassini} holds for $n=k$. In other
words, we must show that $f_{k+1}f_{k-1}-f_{k}^{2}=\left(  -1\right)  ^{k}$.

Our induction hypothesis says that Exercise \ref{exe.fib.cassini} holds for
$n=k-1$. In other words, it says that $f_{k}f_{k-2}-f_{k-1}^{2}=\left(
-1\right)  ^{k-1}$. But the recursive definition of the Fibonacci sequence
yields $f_{k+1}=f_{k}+f_{k-1}$ (since $k>1$). Hence,%
\begin{align*}
\underbrace{f_{k+1}}_{=f_{k}+f_{k-1}}f_{k-1}  &  =\left(  f_{k}+f_{k-1}%
\right)  f_{k-1}=f_{k}f_{k-1}+\underbrace{f_{k-1}^{2}}_{\substack{=f_{k}%
f_{k-2}-\left(  -1\right)  ^{k-1}\\\text{(since }f_{k}f_{k-2}-f_{k-1}%
^{2}=\left(  -1\right)  ^{k-1}\text{)}}}\\
&  =f_{k}f_{k-1}+f_{k}f_{k-2}-\left(  -1\right)  ^{k-1}=f_{k}%
\underbrace{\left(  f_{k-1}+f_{k-2}\right)  }_{\substack{=f_{k}\\\text{(since
the recursive definition}\\\text{of the Fibonacci sequence}\\\text{yields
}f_{k}=f_{k-1}+f_{k-2}\text{)}}}-\underbrace{\left(  -1\right)  ^{k-1}%
}_{=-\left(  -1\right)  ^{k}}\\
&  =f_{k}f_{k}-\left(  -\left(  -1\right)  ^{k}\right)  =f_{k}^{2}+\left(
-1\right)  ^{k},
\end{align*}
so that $f_{k+1}f_{k-1}-f_{k}^{2}=\left(  -1\right)  ^{k}$. This is exactly
what we wanted to prove. This completes the induction step, and with it the
solution to Exercise \ref{exe.fib.cassini}.
\end{proof}

\begin{fineprint}
Some writers shorten their induction proofs even further by reusing the letter
$n$ itself (instead of $m$ or $k$ as we did above) in the induction step. That
is, instead of fixing a $k>g$ and assuming that the claim holds for $n=k-1$
and proving that it holds for $n=k$, they fix an $n>g$ and assume that the
claim holds \textquotedblleft for $n-1$ instead of $n$\textquotedblright%
\ (i.e., the claim holds if $n$ is replaced by $n-1$ in it) and prove that it
holds for $n$ as well. This saves a letter and a bit of writing, at the cost
of being potentially more confusing and slippery (as it requires you to check
that you have properly replaced $n$ by $n-1$ in the induction hypothesis);
thus I do not recommend it. But you should be aware that it is a commonly used
\textquotedblleft figure of speech\textquotedblright.\footnote{For example,
here is how the above solution to Exercise \ref{exe.fib.cassini} could be
rewritten using this convention:
\par
We induct on $n$ (using Theorem \ref{thm.ind-principle.k-1}):
\par
\textit{Induction base:} We have $f_{0}=0$, $f_{1}=1$ and $f_{2}=1$. Thus,
$f_{2}f_{0}-f_{1}^{2}=1\cdot0-1^{2}=-1=\left(  -1\right)  ^{1}$. In other
words, Exercise \ref{exe.fib.cassini} holds for $n=1$.
\par
\textit{Induction step:} Let $n$ be an integer such that $n>1$. Assume (as the
induction hypothesis) that Exercise \ref{exe.fib.cassini} holds for $n-1$
instead of $n$. We must show that Exercise \ref{exe.fib.cassini} holds for
$n$. In other words, we must show that $f_{n+1}f_{n-1}-f_{n}^{2}=\left(
-1\right)  ^{n}$.
\par
Our induction hypothesis says that Exercise \ref{exe.fib.cassini} holds for
$n-1$ instead of $n$. In other words, it says that $f_{n}f_{n-2}-f_{n-1}%
^{2}=\left(  -1\right)  ^{n-1}$. But the recursive definition of the Fibonacci
sequence yields $f_{n+1}=f_{n}+f_{n-1}$ (since $n>1$). Hence,%
\begin{align*}
\underbrace{f_{n+1}}_{=f_{n}+f_{n-1}}f_{n-1}  &  =\left(  f_{n}+f_{n-1}%
\right)  f_{n-1}=f_{n}f_{n-1}+\underbrace{f_{n-1}^{2}}_{\substack{=f_{n}%
f_{n-2}-\left(  -1\right)  ^{n-1}\\\text{(since }f_{n}f_{n-2}-f_{n-1}%
^{2}=\left(  -1\right)  ^{n-1}\text{)}}}=f_{n}f_{n-1}+f_{n}f_{n-2}-\left(
-1\right)  ^{n-1}\\
&  =f_{n}\underbrace{\left(  f_{n-1}+f_{n-2}\right)  }_{\substack{=f_{n}%
\\\text{(since the recursive definition}\\\text{of the Fibonacci
sequence}\\\text{yields }f_{n}=f_{n-1}+f_{n-2}\text{)}}}-\underbrace{\left(
-1\right)  ^{n-1}}_{=-\left(  -1\right)  ^{n}}=f_{n}f_{n}-\left(  -\left(
-1\right)  ^{n}\right)  =f_{n}^{2}+\left(  -1\right)  ^{n},
\end{align*}
so that $f_{n+1}f_{n-1}-f_{n}^{2}=\left(  -1\right)  ^{n}$. This is exactly
what we wanted to prove. This completes the induction step, and with it the
solution to Exercise \ref{exe.fib.cassini}.}
\end{fineprint}

The next exercise (a particular case of \cite[Theorem 2.26 \textbf{(a)}%
]{detnotes}) illustrates a point about choosing the right claim when doing induction.

\begin{exercise}
\label{exe.fibonacci.addition}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Prove that%
\begin{equation}
f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1} \label{eq.exe.fibonacci.addition.1}%
\end{equation}
for any nonnegative integers $n$ and $m$.
\end{exercise}

We have two nonnegative integer variables here ($n$ and $m$), so we can try to
do induction on either. As to the other, it appears reasonable to just fix it
beforehand. So we try the following:

\begin{proof}
[First attempt at solving Exercise \ref{exe.fibonacci.addition}.]Let us fix
$m$ and induct on $n$ (using Theorem \ref{thm.ind-principle}).

\textit{Induction base:} The equality (\ref{eq.exe.fibonacci.addition.1})
holds for $n=0$. Indeed, for $n=0$, this equality boils down to $f_{0+m+1}%
=f_{0}f_{m}+f_{1}f_{m+1}$, which follows easily from $f_{0}=0$ and $f_{1}=1$.

\textit{Induction step:} Let $k$ be a nonnegative integer.\footnote{This $k$
will play the role of the $m$ in Theorem \ref{thm.ind-principle}, since we
cannot use the letter $m$ for it here (because $m$ is already a fixed
number).} Assume (as the induction hypothesis) that
(\ref{eq.exe.fibonacci.addition.1}) holds for $n=k$. We must show that
(\ref{eq.exe.fibonacci.addition.1}) holds for $n=k+1$. In other words, we must
show that $f_{\left(  k+1\right)  +m+1}=f_{k+1}f_{m}+f_{\left(  k+1\right)
+1}f_{m+1}$. In other words, we must show that $f_{k+m+2}=f_{k+1}f_{m}%
+f_{k+2}f_{m+1}$.

Our induction hypothesis says that (\ref{eq.exe.fibonacci.addition.1}) holds
for $n=k$, that is, we have $f_{k+m+1}=f_{k}f_{m}+f_{k+1}f_{m+1}$.

The recursive definition of the Fibonacci sequence yields%
\[
f_{k+m+2}=f_{k+m+1}+f_{k+m}.
\]
Now, our induction hypothesis lets us decompose the $f_{k+m+1}$ on the right
hand side as $f_{k}f_{m}+f_{k+1}f_{m+1}$; but how do we decompose the
$f_{k+m}$? The induction hypothesis does not help us here, and we are stuck.
\end{proof}

This suggests that we need a better induction hypothesis. The easiest way to
get one is to \textbf{not} fix $m$ before starting the induction. The result
is that we have to carry a \textquotedblleft for all nonnegative integers
$m$\textquotedblright\ through our induction; but this extra weight turns out
to be useful:

\begin{proof}
[Second attempt at solving Exercise \ref{exe.fibonacci.addition}.]Let us
induct on $n$.

\textit{Induction base:} The equality (\ref{eq.exe.fibonacci.addition.1})
holds for $n=0$ and every nonnegative integer $m$. Indeed, for $n=0$, this
equality boils down to $f_{0+m+1}=f_{0}f_{m}+f_{1}f_{m+1}$, which follows
easily from $f_{0}=0$ and $f_{1}=1$.

\textit{Induction step:} Let $k$ be a nonnegative integer. Assume (as the
induction hypothesis) that (\ref{eq.exe.fibonacci.addition.1}) holds for $n=k$
and every nonnegative integer $m$. We must show that
(\ref{eq.exe.fibonacci.addition.1}) holds for $n=k+1$ and every nonnegative
integer $m$. In other words, we must show that $f_{\left(  k+1\right)
+m+1}=f_{k+1}f_{m}+f_{\left(  k+1\right)  +1}f_{m+1}$ for every nonnegative
integer $m$. In other words, we must show that $f_{k+m+2}=f_{k+1}f_{m}%
+f_{k+2}f_{m+1}$ for every nonnegative integer $m$.

Our induction hypothesis says that (\ref{eq.exe.fibonacci.addition.1}) holds
for $n=k$ and every nonnegative integer $m$. In other words, we have
\begin{equation}
f_{k+m+1}=f_{k}f_{m}+f_{k+1}f_{m+1} \label{sol.fibonacci.addition.IH2}%
\end{equation}
for every nonnegative integer $m$.

Now, let $m$ be a nonnegative integer. The recursive definition of the
Fibonacci sequence yields%
\begin{equation}
f_{k+m+2}=f_{k+m+1}+f_{k+m}. \label{sol.fibonacci.addition.3}%
\end{equation}


Once again, we can use our induction hypothesis
(\ref{sol.fibonacci.addition.IH2}) to rewrite the $f_{k+m+1}$ on the right
hand side as $f_{k}f_{m}+f_{k+1}f_{m+1}$. But this time, we can also apply
(\ref{sol.fibonacci.addition.IH2}) to $m-1$ instead of $m$ (since the $m$ in
(\ref{sol.fibonacci.addition.IH2}) was an arbitrary nonnegative integer, not
related to the $m$ we have currently fixed), and thus obtain $f_{k+\left(
m-1\right)  +1}=f_{k}f_{m-1}+f_{k+1}f_{\left(  m-1\right)  +1}$. To be fully
honest, we can only do this when $m-1$ is a nonnegative integer, which means
that we cannot do this when $m=0$; but the $m=0$ case is easy and left to the
reader. So we WLOG assume that $m\neq0$; therefore, $m\geq1$, and thus $m-1$
is a nonnegative integer. Hence, (\ref{sol.fibonacci.addition.IH2}) (applied
to $m-1$ instead of $m$) yields $f_{k+\left(  m-1\right)  +1}=f_{k}%
f_{m-1}+f_{k+1}f_{\left(  m-1\right)  +1}$. Since $\left(  m-1\right)  +1=m$,
this rewrites as%
\begin{equation}
f_{k+m}=f_{k}f_{m-1}+f_{k+1}f_{m}. \label{sol.fibonacci.addition.IH2b}%
\end{equation}
Now, (\ref{sol.fibonacci.addition.3}) becomes
\begin{align*}
f_{k+m+2}  &  =\underbrace{f_{k+m+1}}_{\substack{=f_{k}f_{m}+f_{k+1}%
f_{m+1}\\\text{(by (\ref{sol.fibonacci.addition.IH2}))}}}+\underbrace{f_{k+m}%
}_{\substack{=f_{k}f_{m-1}+f_{k+1}f_{m}\\\text{(by
(\ref{sol.fibonacci.addition.IH2b}))}}}\\
&  =f_{k}f_{m}+f_{k+1}f_{m+1}+f_{k}f_{m-1}+f_{k+1}f_{m}\\
&  =f_{k+1}f_{m}+f_{k}\underbrace{\left(  f_{m}+f_{m-1}\right)  }%
_{\substack{=f_{m+1}\\\text{(since the recursive definition}\\\text{of the
Fibonacci sequence}\\\text{yields }f_{m+1}=f_{m}+f_{m-1}\text{)}}%
}+f_{k+1}f_{m+1}\\
&  =f_{k+1}f_{m}+f_{k}f_{m+1}+f_{k+1}f_{m+1}\\
&  =f_{k+1}f_{m}+\underbrace{\left(  f_{k}+f_{k+1}\right)  }%
_{\substack{=f_{k+2}\\\text{(since the recursive definition}\\\text{of the
Fibonacci sequence}\\\text{yields }f_{k+2}=f_{k+1}+f_{k}=f_{k}+f_{k+1}%
\text{)}}}f_{m+1}=f_{k+1}f_{m}+f_{k+2}f_{m+1}.
\end{align*}
But this is exactly what we wanted to show. Thus, the induction step is
complete, and Exercise \ref{exe.fibonacci.addition} is solved.
\end{proof}

The solution we just gave is not the simplest possible; there is a different
one, which avoids having to special-case the $m=0$ case (as we did above). The
trick is to rewrite $f_{k+m+2}$ not as $f_{k+m+1}+f_{k+m}$, but rather as
follows:
\[
f_{k+m+2}=f_{k+\left(  m+1\right)  +1}=f_{k}f_{m+1}+f_{k+1}f_{m+2}%
\]
(by (\ref{sol.fibonacci.addition.IH2}), applied to $m+1$ instead of $m$). It
is a nice exercise for the reader to finish this argument (see \cite[proof of
Theorem 2.26 \textbf{(a)}]{detnotes} for the answer).

Another version of induction is tailored to proving theorems about integers
$n$ in a finite interval\footnote{Here, the word \textquotedblleft
interval\textquotedblright\ means a set of the form
\[
\left\{  g,g+1,\ldots,h\right\}  =\left\{  \text{all integers between }g\text{
and }h\text{ (inclusive)}\right\}
\]
for two fixed integers $g$ and $h$. Thus, unlike in analysis, our intervals
here consist entirely of integers.} rather than about all integers $n\geq g$.
Instead of relying on Theorem \ref{thm.ind-principle}, it relies on the
following theorem (\cite[Theorem 2.74]{detnotes}):

\begin{theorem}
\label{thm.ind.IPgh}Let $g\in\mathbb{Z}$ and $h\in\mathbb{Z}$. For each
$n\in\left\{  g,g+1,\ldots,h\right\}  $, let $\mathcal{A}\left(  n\right)  $
be a logical statement.

Assume the following:

\begin{statement}
\textit{Assumption 1:} If $g\leq h$, then the statement $\mathcal{A}\left(
g\right)  $ holds.\footnotemark
\end{statement}

\begin{statement}
\textit{Assumption 2:} If $m\in\left\{  g,g+1,\ldots,h-1\right\}  $ is such
that $\mathcal{A}\left(  m\right)  $ holds, then $\mathcal{A}\left(
m+1\right)  $ also holds.
\end{statement}

Then, $\mathcal{A}\left(  n\right)  $ holds for each $n\in\left\{
g,g+1,\ldots,h\right\}  $.
\end{theorem}

\footnotetext{The \textquotedblleft If $g\leq h$\textquotedblright\ in this
assumption is a bit silly: If we don't have $g\leq h$, then the claim we are
proving is vacuous to begin with (because the set $\left\{  g,g+1,\ldots
,h\right\}  $ is empty in this case). But sometimes it is good to have vacuous
cases covered, too.}Theorem \ref{thm.ind.IPgh} can easily be derived from
Theorem \ref{thm.ind-principle}, by applying the latter to the statement
\textquotedblleft if $n\leq h$, then $\mathcal{A}\left(  n\right)
$\textquotedblright\ instead of $\mathcal{A}\left(  n\right)  $. (See
\cite[proof of Theorem 2.74]{detnotes} for the details of this derivation.) It
is clear how to perform induction using Theorem \ref{thm.ind.IPgh}: It differs
from standard induction only in that we assume $g\leq m\leq h-1$ (instead of
only assuming $m\geq g$) in the induction step.

Here is an example of an induction proof using Theorem \ref{thm.ind.IPgh}:

\begin{proposition}
\label{prop.ind.dc}Let $g$ and $h$ be integers such that $g\leq h$. Let
$b_{g},b_{g+1},\ldots,b_{h}$ be any $h-g+1$ nonzero integers. Assume that
$b_{g}\geq0$. Assume further that%
\begin{equation}
\left\vert b_{i+1}-b_{i}\right\vert \leq1\ \ \ \ \ \ \ \ \ \ \text{for every
}i\in\left\{  g,g+1,\ldots,h-1\right\}  . \label{eq.prop.ind.dc.ass}%
\end{equation}
Then, $b_{n}>0$ for each $n\in\left\{  g,g+1,\ldots,h\right\}  $.
\end{proposition}

Proposition \ref{prop.ind.dc} is often called the \textquotedblleft%
\textit{discrete intermediate value theorem}\textquotedblright\ or the
\textquotedblleft\textit{discrete continuity principle}\textquotedblright. Its
intuitive meaning is that if a finite list of nonzero integers starts with a
nonnegative integer, and every further entry of this list differs from its
preceding entry by at most $1$ (you can think of this as a discrete version of
continuity), then all entries of this list must be positive.\footnote{An
example of such a list is $\left(  2,3,3,2,3,4,4,3,2,3,2,3,2,1\right)  $.}
Intuitively, this is obvious: It just says that it isn't possible to go from a
nonnegative integer to a negative integer by steps of $1$ without ever
stepping at $0$. The following proof is just a rigorous restatement of this
intuitive argument:

\begin{proof}
[Proof of Proposition \ref{prop.ind.dc} (sketched).](See \cite[proof of
Proposition 2.75]{detnotes} for details.) We induct on $n$ using Theorem
\ref{thm.ind.IPgh} (that is, we apply Theorem \ref{thm.ind.IPgh} to the
statement $\mathcal{A}\left(  n\right)  =\left(  \text{\textquotedblleft}%
b_{n}>0\text{\textquotedblright}\right)  $):

\textit{Induction base:} We must prove that if $g\leq h$, then the statement
$b_{g}>0$ holds. So let us assume that $g\leq h$. (Actually, we have already
assumed so in the statement of the proposition.) Recall that $b_{g}%
,b_{g+1},\ldots,b_{h}$ are nonzero; thus, in particular, $b_{g}\neq0$. But we
also have $b_{g}\geq0$. Combining these, we find $b_{g}>0$. This completes the
induction base.

\textit{Induction step:} Let $m\in\left\{  g,g+1,\ldots,h-1\right\}  $ be such
that $b_{m}>0$ holds. We must show that $b_{m+1}>0$ also holds.

Applying (\ref{eq.prop.ind.dc.ass}) to $i=m$, we find $\left\vert
b_{m+1}-b_{m}\right\vert \leq1$. But it is well-known (and easy to see) that
every integer $x$ satisfies $-x\leq\left\vert x\right\vert $. Applying this to
$x=b_{m+1}-b_{m}$, we obtain $-\left(  b_{m+1}-b_{m}\right)  \leq\left\vert
b_{m+1}-b_{m}\right\vert \leq1$. In other words, $1\geq-\left(  b_{m+1}%
-b_{m}\right)  =b_{m}-b_{m+1}$. In other words, $1+b_{m+1}\geq b_{m}$. Hence,
$1+b_{m+1}\geq b_{m}>0$, so that $1+b_{m+1}\geq1$ (since $1+b_{m+1}$ is an
integer). In other words, $b_{m+1}\geq0$. However, $b_{m+1}\neq0$ (since
$b_{g},b_{g+1},\ldots,b_{h}$ are nonzero). Combining this with $b_{m+1}\geq0$,
we obtain $b_{m+1}>0$. This completes the induction step. Hence, Proposition
\ref{prop.ind.dc} is proved.
\end{proof}

In the future, we will no longer say \textquotedblleft We induct on $n$ using
Theorem \ref{thm.ind.IPgh}\textquotedblright, but instead just say
\textquotedblleft We induct on $n$\textquotedblright. Indeed, it is clear that
we must be using Theorem \ref{thm.ind.IPgh} if we are inducting on a variable
that is bound to an interval (like the $n$ in Proposition \ref{prop.ind.dc}).

\subsection{Strong induction}

The induction principle (in the form of Theorem \ref{thm.ind-principle.k-1})
can be briefly summarized as follows: If we want to prove that a statement
$\mathcal{A}\left(  n\right)  $ holds for all integers $n\geq g$, then it
suffices to prove it under the assumption that $\mathcal{A}\left(  n-1\right)
$ holds (as long as one has proved that $\mathcal{A}\left(  g\right)  $
holds). In our above examples, this idea was enough to make the proof
straightforward or at least fairly easy. Sometimes, however, this assumption
is not enough. Here is one example, known as \textit{Binet's formula}:

\begin{theorem}
\label{thm.fib.binet}Let $\varphi=\dfrac{1+\sqrt{5}}{2}$ and $\psi
=\dfrac{1-\sqrt{5}}{2}$ be the two solutions of the quadratic equation
$X^{2}-X-1=0$. Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Then,%
\begin{equation}
f_{n}=\dfrac{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}}\psi^{n}
\label{eq.thm.fib.binet.eq}%
\end{equation}
for every nonnegative integer $n$.
\end{theorem}

Theorem \ref{thm.fib.binet} is an explicit formula for Fibonacci numbers, and
what a surprising one -- would you have expected the irrational numbers
$\varphi$ and $\psi$ to appear in a formula for an integer sequence? Note that
the number $\varphi=\dfrac{1+\sqrt{5}}{2}\approx1.\,618$ in Theorem
\ref{thm.fib.binet} is known as the \textit{golden ratio} (although it shares
that distinction with its reciprocal $\dfrac{1}{\varphi}\approx0.618$), and
the number $\psi$ is what is known as a \textit{conjugate} of $\varphi$
(although the notion is only properly understood in abstract
algebra\footnote{In a nutshell: If a (real or complex) number $\zeta$ is a
root of an irreducible polynomial $P$ with rational coefficients, then all
roots of $P$ are called the \textit{conjugates} of $\zeta$. For example, the
conjugates of the number $\sqrt{2}$ are $\sqrt{2}$ and $-\sqrt{2}$, since they
are the roots of the irreducible polynomial $x^{2}-2$ whose root $\sqrt{2}$
is. One of the ideas of Galois theory is that conjugates of a number
\textquotedblleft belong together with it\textquotedblright; while we will not
formalize this idea in this class, we will see its manifestations several
times.}). The golden ratio is famous for appearing in various places in
mathematics, and this is one of them.

How can we prove Theorem \ref{thm.fib.binet}? It appears reasonable to induct
on $n$ (using Theorem \ref{thm.ind-principle.k-1}); the base case ($n=0$) is
easy, and the induction step would have us assume that
(\ref{eq.thm.fib.binet.eq}) holds for $n=k-1$ and try to prove that
(\ref{eq.thm.fib.binet.eq}) holds for $n=k$. Unfortunately, here we hit a
wall: While the induction hypothesis lets us compute $f_{k-1}$, it would not
let us compute $f_{k-2}$, but we would need both $f_{k-1}$ and $f_{k-2}$ in
order to simplify $f_{k}=f_{k-1}+f_{k-2}$.

Thus we are in want of a stronger induction hypothesis: one that claims
(\ref{eq.thm.fib.binet.eq}) not only for $n=k-1$, but also for $n=k-2$. Better
yet, why not claim that (\ref{eq.thm.fib.binet.eq}) holds for all $n<k$ ?

This is what \textit{strong induction} does: It strengthens the induction
hypothesis from \textquotedblleft the claim holds for $n=k-1$%
\textquotedblright\ to \textquotedblleft the claim holds for all
$n<k$\textquotedblright. The underlying principle is the
following:\footnote{Theorem \ref{thm.strind-principle} is \cite[Theorem
2.60]{detnotes}, with $m$ renamed as $k$.}

\begin{theorem}
\label{thm.strind-principle}Let $g$ be an integer. For each integer $n\geq g$,
let $\mathcal{A}\left(  n\right)  $ be a logical statement.

Assume the following:

\begin{itemize}
\item \textit{Assumption 1:} If $k$ is an integer such that $k\geq g$ and such
that%
\begin{equation}
\left(  \mathcal{A}\left(  n\right)  \text{ holds for every integer }n\geq
g\text{ satisfying }n<k\right)  , \label{eq.thm.strind-principle.ass}%
\end{equation}
then $\mathcal{A}\left(  k\right)  $ holds.
\end{itemize}

Then, $\mathcal{A}\left(  n\right)  $ holds for each integer $n\geq g$.
\end{theorem}

This looks a bit tortuous, so let us unravel what it means to prove something
using Theorem \ref{thm.strind-principle}. This will be called a proof by
\textit{strong induction}.

Let $g$ be an integer (which is typically taken to be $0$ or $1$, as in
standard induction). Say that we want to prove that some statement
$\mathcal{A}\left(  n\right)  $ holds for every integer $n\geq g$. Doing this
via standard induction (i.e., using Theorem \ref{thm.ind-principle.k-1}) would
require us to prove (in the induction step) that $\mathcal{A}\left(  k\right)
$ follows from $\mathcal{A}\left(  k-1\right)  $ (whenever $k>g$ is an
integer). (It would also require an induction base, which we disregard for
now.) On the other hand, doing this via strong induction (i.e., using Theorem
\ref{thm.strind-principle}) would instead require us to prove that
$\mathcal{A}\left(  k\right)  $ follows from
(\ref{eq.thm.strind-principle.ass}) -- that is, from $\mathcal{A}\left(
g\right)  \wedge\mathcal{A}\left(  g+1\right)  \wedge\cdots\wedge
\mathcal{A}\left(  k-1\right)  $. Obviously, when $k>g$, then $\mathcal{A}%
\left(  g\right)  \wedge\mathcal{A}\left(  g+1\right)  \wedge\cdots
\wedge\mathcal{A}\left(  k-1\right)  $ is a stronger statement than
$\mathcal{A}\left(  k-1\right)  $; thus, when we are applying strong
induction, we have a stronger induction hypothesis than when applying standard induction.

There is one more difference between standard and strong induction: A strong
induction needs no induction base. Indeed, in Theorem
\ref{thm.ind-principle.k-1} there are two assumptions, but in Theorem
\ref{thm.strind-principle} there is only one. This might appear strange,
because how comes we can afford omitting the induction base? However, this is
not as fishy as it looks like; it turns out that Assumption 1 in Theorem
\ref{thm.strind-principle} already contains a \textquotedblleft base
case\textquotedblright\ in it. To be more precise, I claim that if Assumption
1 in Theorem \ref{thm.strind-principle} is satisfied, then $\mathcal{A}\left(
g\right)  $ must hold. Indeed, Assumption 1 in Theorem
\ref{thm.strind-principle} (applied to $k=g$) says that if%
\begin{equation}
\left(  \mathcal{A}\left(  n\right)  \text{ holds for every integer }n\geq
g\text{ satisfying }n<g\right)  , \label{eq.thm.strind-principle.ass.kg}%
\end{equation}
then $\mathcal{A}\left(  g\right)  $ holds. But
(\ref{eq.thm.strind-principle.ass.kg}) is a vacuous statement (since there is
no integer $n\geq g$ satisfying $n<g$), and thus is vacuously
true\footnote{For the meaning of the words \textquotedblleft vacuously
true\textquotedblright, see
\href{https://en.wikipedia.org/wiki/Vacuous_truth}{the Wikipedia page on
\textquotedblleft vacuous truth\textquotedblright} (or most introductions to
mathematical proof).}; therefore, the previous sentence entails that
$\mathcal{A}\left(  g\right)  $ holds. This argument might appear like a
sleight of hand, but it is logically sound.

All of this theoretical chatter is probably less useful than an actual example
of a proof by strong induction; so let us have one now:

\begin{proof}
[Proof of Theorem \ref{thm.fib.binet}.]Let us try to prove Theorem
\ref{thm.fib.binet} by strong induction on $n$. This means that we apply
Theorem \ref{thm.strind-principle} to $g=0$ and to the statement%
\[
\mathcal{A}\left(  n\right)  =\left(  \text{\textquotedblleft}f_{n}=\dfrac
{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}}\psi^{n}\text{\textquotedblright%
}\right)  .
\]


\textit{Induction step:}\footnote{In a strong induction, \textquotedblleft
induction step\textquotedblright\ means the part where we check that
Assumption 1 in Theorem \ref{thm.strind-principle} holds. As we just
discussed, a strong induction needs no induction base, so the induction step
is the only real part of it. Thus, many writers don't even bother to say
\textquotedblleft\textit{Induction step:}\textquotedblright.} Let $k$ be an
integer such that $k\geq0$. Assume that%
\begin{equation}
\left(  \mathcal{A}\left(  n\right)  \text{ holds for every integer }%
n\geq0\text{ satisfying }n<k\right)  . \label{pf.thm.fib.binet.IH}%
\end{equation}
We must show that $\mathcal{A}\left(  k\right)  $ holds. In other words, we
must prove that
\begin{equation}
f_{k}=\dfrac{1}{\sqrt{5}}\varphi^{k}-\dfrac{1}{\sqrt{5}}\psi^{k}.
\label{pf.thm.fib.binet.IG}%
\end{equation}


Of course, we would want to apply the recursive definition of the Fibonacci
sequence to obtain the equality $f_{k}=f_{k-1}+f_{k-2}$. This is slightly
complicated by the fact that this equality holds only for $k\geq2$ (since we
have not defined $f_{-1}$ and $f_{-2}$); thus we need to handle the case $k<2$
separately. Fortunately, this is straightforward (and fairly quick): If $k<2$,
then $k=0$ or $k=1$, and in each of these two cases we can verify
(\ref{pf.thm.fib.binet.IG}) by hand (noticing that the definitions of
$\varphi$ and $\psi$ easily imply $\varphi-\psi=\sqrt{5}$). Thus, we WLOG
assume that $k\geq2$. Hence, we do have $f_{k}=f_{k-1}+f_{k-2}$. Note also
that (because of $k\geq2$) we have $k-2\geq0$ and $k-1\geq0$.

Our assumption (\ref{pf.thm.fib.binet.IH}) plays the role of an induction
hypothesis. In particular, we can apply it to $n=k-1$ (since $k-1\geq0$ is an
integer satisfying $k-1<k$). We thus obtain that $\mathcal{A}\left(
k-1\right)  $ holds, i.e., that we have%
\begin{equation}
f_{k-1}=\dfrac{1}{\sqrt{5}}\varphi^{k-1}-\dfrac{1}{\sqrt{5}}\psi^{k-1}.
\label{pf.thm.binet.IH1}%
\end{equation}
Likewise, we can apply (\ref{pf.thm.fib.binet.IH}) to $n=k-2$ (since
$k-2\geq0$ is an integer satisfying $k-2<k$). We thus conclude that
$\mathcal{A}\left(  k-2\right)  $ holds, i.e., that we have%
\begin{equation}
f_{k-2}=\dfrac{1}{\sqrt{5}}\varphi^{k-2}-\dfrac{1}{\sqrt{5}}\psi^{k-2}.
\label{pf.thm.binet.IH2}%
\end{equation}
(Note that we have used $k-1\geq0$ and $k-2\geq0$ here; this is another reason
why we needed to handle the case $k<2$ separately.)

But $\varphi$ is a solution of the quadratic equation $X^{2}-X-1=0$; thus,
$\varphi^{2}-\varphi-1=0$, so that $\varphi+1=\varphi^{2}$. Likewise,
$\psi+1=\psi^{2}$. Now,%
\begin{align*}
f_{k}  &  =\underbrace{f_{k-1}}_{\substack{=\dfrac{1}{\sqrt{5}}\varphi
^{k-1}-\dfrac{1}{\sqrt{5}}\psi^{k-1}\\\text{(by (\ref{pf.thm.binet.IH1}))}%
}}+\underbrace{f_{k-2}}_{\substack{=\dfrac{1}{\sqrt{5}}\varphi^{k-2}-\dfrac
{1}{\sqrt{5}}\psi^{k-2}\\\text{(by (\ref{pf.thm.binet.IH2}))}}}\\
&  =\dfrac{1}{\sqrt{5}}\varphi^{k-1}-\dfrac{1}{\sqrt{5}}\psi^{k-1}+\dfrac
{1}{\sqrt{5}}\varphi^{k-2}-\dfrac{1}{\sqrt{5}}\psi^{k-2}\\
&  =\dfrac{1}{\sqrt{5}}\underbrace{\left(  \varphi^{k-1}+\varphi^{k-2}\right)
}_{=\varphi^{k-2}\left(  \varphi+1\right)  }-\dfrac{1}{\sqrt{5}}%
\underbrace{\left(  \psi^{k-1}+\psi^{k-2}\right)  }_{=\psi^{k-2}\left(
\psi+1\right)  }\\
&  =\dfrac{1}{\sqrt{5}}\varphi^{k-2}\underbrace{\left(  \varphi+1\right)
}_{=\varphi^{2}}-\dfrac{1}{\sqrt{5}}\psi^{k-2}\underbrace{\left(
\psi+1\right)  }_{=\psi^{2}}\\
&  =\dfrac{1}{\sqrt{5}}\underbrace{\varphi^{k-2}\varphi^{2}}_{=\varphi^{k}%
}-\dfrac{1}{\sqrt{5}}\underbrace{\psi^{k-2}\psi^{2}}_{=\psi^{k}}=\dfrac
{1}{\sqrt{5}}\varphi^{k}-\dfrac{1}{\sqrt{5}}\psi^{k}.
\end{align*}
In other words, (\ref{pf.thm.fib.binet.IG}) holds. In other words,
$\mathcal{A}\left(  k\right)  $ holds. Thus, the induction step is complete,
and we are done proving Theorem \ref{thm.fib.binet}.
\end{proof}

A few general remarks are in order. First of all, as we already saw in the
proof of Theorem \ref{thm.fib.binet}, the statement
(\ref{eq.thm.strind-principle.ass}) that is being assumed in the induction
step of a strong induction plays the role of an induction hypothesis; thus it
is commonly referred to as the induction hypothesis. Second, while
(technically speaking) our strong induction had no induction base, we
nevertheless had to treat some \textquotedblleft small-$k$\textquotedblright%
\ cases by hand (in our case, the case $k<2$, which split into $k=0$ and
$k=1$). Thus, we had a \textquotedblleft de-facto\textquotedblright\ induction
base in our induction step, even though we didn't \textbf{call} it an
induction base. This is fairly common for proofs by strong induction.

Strong induction is a standard method for proving properties of Fibonacci
numbers. Indeed, the latter are defined by a recursion ($f_{k}=f_{k-1}%
+f_{k-2}$) that refers back not just to the previous entry $f_{k-1}$ but to
the entry $f_{k-2}$ as well; thus, when proving a claim about $f_{k}$, it is
useful to have not just the corresponding claim about $f_{k-1}$, but also the
corresponding claim about $f_{k-2}$ at one's disposal. With its stronger
induction hypothesis, strong induction is uniquely suited to providing both
claims in its induction step.

Our proof of Theorem \ref{thm.fib.binet} was fairly straightforward, but it
does nothing to demystify it. In particular, if you didn't know this formula,
how could you come up with it in the first place? We will see an answer to
this question in Subsection \ref{subsect.linrec.ab-matrix} (specifically, in
the second proof of Theorem \ref{thm.rec.binet}).\footnote{A rather elementary
answer is found in \cite[Remark 4.3]{detnotes}, but note that linear algebra
(specifically, the notion of eigenvalues and diagonalization) provides some
more motivation.}

Let me note in passing that Theorem \ref{thm.fib.binet} is useful as a tool in
proving identities for Fibonacci numbers. In particular, Exercise
\ref{exe.fibonacci.addition} boils down to a straightforward computation once
both sides are rewritten using Theorem \ref{thm.fib.binet}.

Proofs by strong induction rely on Theorem \ref{thm.strind-principle}. This
theorem itself can be proved by standard induction (so it is not a new
fundamental principle, but merely a \textquotedblleft better
interface\textquotedblright\ to standard induction); see \cite[proof of
Theorem 2.60]{detnotes} for this proof. See also \cite[\S 2.8]{detnotes} for
more examples of proofs by strong induction.

The next result we are going to prove using strong induction is yet another
property of Fibonacci numbers, namely a combinatorial interpretation of them.
This relies on the following notion:

\begin{definition}
\label{def.fib.lac}A set $S$ of integers is said to be \textit{lacunar} if it
contains no two consecutive integers (i.e., there is no $s\in S$ such that
$s+1\in S$).
\end{definition}

For example, the sets $\left\{  1,4\right\}  $ and $\left\{  3,5\right\}  $
and $\left\{  3,7,9\right\}  $ are lacunar, while the sets $\left\{
1,2,5\right\}  $ and $\left\{  3,4\right\}  $ are not. (The empty set is
lacunar, and so is any $1$-element set of integers.)

We can now state the result we want to prove:

\begin{theorem}
\label{thm.fib.lac}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. For each nonnegative integer $n$, let $\left[  n\right]  $
denote the $n$-element set $\left\{  1,2,\ldots,n\right\}  $.

Let $n\geq0$ be an integer. Then, the number of all lacunar subsets of
$\left[  n\right]  $ is $f_{n+2}$.
\end{theorem}

\begin{example}
\label{exa.fib.lac1}Let us verify Theorem \ref{thm.fib.lac} for small values
of $n$:

\begin{itemize}
\item The only lacunar subset of $\left[  0\right]  $ is $\varnothing$ (since
the set $\left[  0\right]  $ itself is empty). Thus, the number of all lacunar
subsets of $\left[  0\right]  $ is $1$, which is precisely what Theorem
\ref{thm.fib.lac} says for $n=0$ (since $f_{0+2}=f_{2}=1$).

\item The only lacunar subsets of $\left[  1\right]  $ are $\varnothing$ and
$\left\{  1\right\}  $ (since $\left[  1\right]  =\left\{  1\right\}  $).
Thus, the number of all lacunar subsets of $\left[  1\right]  $ is $2$, which
is precisely what Theorem \ref{thm.fib.lac} says for $n=1$ (since
$f_{1+2}=f_{3}=2$).

\item The only lacunar subsets of $\left[  2\right]  $ are $\varnothing$,
$\left\{  1\right\}  $ and $\left\{  2\right\}  $ (since $\left[  2\right]
=\left\{  1,2\right\}  $). Thus, the number of all lacunar subsets of $\left[
2\right]  $ is $3$, which is precisely what Theorem \ref{thm.fib.lac} says for
$n=2$ (since $f_{2+2}=f_{4}=3$).

\item The only lacunar subsets of $\left[  3\right]  $ are $\varnothing$,
$\left\{  1\right\}  $, $\left\{  2\right\}  $, $\left\{  3\right\}  $ and
$\left\{  1,3\right\}  $ (since $\left[  3\right]  =\left\{  1,2,3\right\}
$). Thus, the number of all lacunar subsets of $\left[  3\right]  $ is $5$,
which is precisely what Theorem \ref{thm.fib.lac} says for $n=3$ (since
$f_{3+2}=f_{5}=5$).
\end{itemize}
\end{example}

\begin{proof}
[Proof of Theorem \ref{thm.fib.lac} (sketched).]Apply strong induction on $n$.
(That is, apply Theorem \ref{thm.strind-principle} with $g=0$.)

\textit{Induction step:}\footnote{As we said, no induction base is needed in a
strong induction.} Let $k\in\mathbb{N}$. Assume (as the induction hypothesis)
that Theorem \ref{thm.fib.lac} holds for each integer $n\geq0$ satisfying
$n<k$. (This is precisely the assumption (\ref{eq.thm.strind-principle.ass})
in Theorem \ref{thm.strind-principle}.) We must show that Theorem
\ref{thm.fib.lac} holds for $n=k$. In other words, we must prove that the
number of all lacunar subsets of $\left[  k\right]  $ is $f_{k+2}$.

Here is a sketch of how this is done (see \cite[first proof of Proposition
1.4.9]{19fco} for details): If $k<2$, then this has already been done in
Example \ref{exa.fib.lac1}; thus, we WLOG assume that $k\geq2$. (We will see
later why this assumption is needed.\footnote{Of course, if you were to solve
a problem, you wouldn't make this WLOG assumption here; you would make it at
the point you need it. I just found it better to make it here in order to
uncrowd the argument later on.}) We shall call a subset of $\left[  k\right]
$

\begin{itemize}
\item \textit{red} if it contains $k$;

\item \textit{green} if it does not contain $k$.
\end{itemize}

\noindent Thus, each subset of $\left[  k\right]  $ is either red or green
(but not both). Hence, in order to count the lacunar subsets of $\left[
k\right]  $, we can count the red ones and the green ones separately, and then
add the results.

Our induction hypothesis says that Theorem \ref{thm.fib.lac} holds for each
integer $n\geq0$ satisfying $n<k$. In other words, for each integer $n\geq0$
satisfying $n<k$, we have%
\begin{equation}
\left(  \text{the number of all lacunar subsets of }\left[  n\right]  \right)
=f_{n+2}. \label{pf.thm.fib.lac.IH}%
\end{equation}


Counting the green lacunar subsets of $\left[  k\right]  $ is easy: They are
plainly the lacunar subsets of $\left[  k-1\right]  $. Thus,
\begin{align}
&  \left(  \text{the number of all green lacunar subsets of }\left[  k\right]
\right) \nonumber\\
&  =\left(  \text{the number of all lacunar subsets of }\left[  k-1\right]
\right) \nonumber\\
&  =f_{\left(  k-1\right)  +2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.fib.lac.IH}), applied to }n=k-1\right) \nonumber\\
&  =f_{k+1}. \label{pf.thm.fib.lac.green}%
\end{align}
Here, in applying (\ref{pf.thm.fib.lac.IH}) to $n=k-1$, we have tacitly used
the facts that $k-1\geq0$ (since $k\geq2\geq1$) and that $k-1<k$ (obviously).

Now let us count the red lacunar subsets of $\left[  k\right]  $. These
subsets contain $k$, and thus do not contain $k-1$ (since they are lacunar,
but $k$ and $k-1$ are consecutive integers). Hence, if we remove $k$ from
them, then we end up with lacunar subsets of $\left[  k-2\right]  $. Thus, to
each red lacunar subset $S$ of $\left[  k\right]  $ corresponds a lacunar
subset $S\setminus\left\{  k\right\}  $ of $\left[  k-2\right]  $. This is a
1-to-1 correspondence\footnote{Here is an example of this correspondence: If
$k=5$, then the red lacunar subsets
\[
\left\{  5\right\}  ,\ \ \left\{  1,5\right\}  ,\ \ \left\{  2,5\right\}
,\ \ \left\{  3,5\right\}  ,\ \ \left\{  1,3,5\right\}
\ \ \ \ \ \ \ \ \ \ \text{of }\left[  5\right]
\]
correspond to the lacunar subsets
\[
\varnothing,\ \ \left\{  1\right\}  ,\ \ \left\{  2\right\}  ,\ \ \left\{
3\right\}  ,\ \ \left\{  1,3\right\}  \ \ \ \ \ \ \ \ \ \ \text{of }\left[
3\right]  ,
\]
respectively.}, because conversely, if $T$ is a lacunar subset of $\left[
k-2\right]  $, then $T\cup\left\{  k\right\}  $ is a red lacunar subset of
$\left[  k\right]  $ (check this!). This 1-to-1 correspondence entails that%
\begin{align}
&  \left(  \text{the number of all red lacunar subsets of }\left[  k\right]
\right) \nonumber\\
&  =\left(  \text{the number of all lacunar subsets of }\left[  k-2\right]
\right) \nonumber\\
&  =f_{\left(  k-2\right)  +2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.fib.lac.IH}), applied to }n=k-2\right) \nonumber\\
&  =f_{k} \label{pf.thm.fib.lac.red}%
\end{align}
(where we now have used $k-2\geq0$ and $k-2<k$).

Now, recall that each subset of $\left[  k\right]  $ is either red or green
(but not both). Hence,%
\begin{align}
&  \left(  \text{the number of all lacunar subsets of }\left[  k\right]
\right) \nonumber\\
&  =\left(  \text{the number of all red lacunar subsets of }\left[  k\right]
\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of all green lacunar subsets
of }\left[  k\right]  \right) \label{pf.thm.fib.lac.sum1}\\
&  =f_{k}+f_{k+1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.fib.lac.red}) and (\ref{pf.thm.fib.lac.green})}\right)
\nonumber\\
&  =f_{k+1}+f_{k}=f_{k+2}\nonumber
\end{align}
(since the recursive definition of the Fibonacci sequence yields
$f_{k+2}=f_{k+1}+f_{k}$). In other words, Theorem \ref{thm.fib.lac} holds for
$n=k$. This completes the induction step, and so Theorem \ref{thm.fib.lac} is proved.
\end{proof}

Let me stress a basic fact from set theory that we have tacitly used in the
above proof:

\begin{theorem}
\label{thm.enum.sumrule2}If $P$ and $Q$ are two disjoint finite sets, then the
set $P\cup Q$ is finite as well, and satisfies%
\begin{equation}
\left\vert P\cup Q\right\vert =\left\vert P\right\vert +\left\vert
Q\right\vert . \label{eq.thm.enum.sumrule2.eq}%
\end{equation}

\end{theorem}

Theorem \ref{thm.enum.sumrule2} is known as the \textit{sum rule for two
sets}; it is the reason why the equality (\ref{pf.thm.fib.lac.sum1}) holds.
Indeed, since each lacunar subset of $\left[  k\right]  $ is either red or
green, we have%
\begin{align*}
&  \left\{  \text{lacunar subsets of }\left[  k\right]  \right\} \\
&  =\left\{  \text{red lacunar subsets of }\left[  k\right]  \right\}
\cup\left\{  \text{green lacunar subsets of }\left[  k\right]  \right\}
\end{align*}
and thus%
\begin{align*}
&  \left\vert \left\{  \text{lacunar subsets of }\left[  k\right]  \right\}
\right\vert \\
&  =\left\vert \left\{  \text{red lacunar subsets of }\left[  k\right]
\right\}  \cup\left\{  \text{green lacunar subsets of }\left[  k\right]
\right\}  \right\vert \\
&  =\left\vert \left\{  \text{red lacunar subsets of }\left[  k\right]
\right\}  \right\vert +\left\vert \left\{  \text{green lacunar subsets of
}\left[  k\right]  \right\}  \right\vert
\end{align*}
(by (\ref{eq.thm.enum.sumrule2.eq}), applied to%
\begin{align*}
P  &  =\left\{  \text{red lacunar subsets of }\left[  k\right]  \right\}
\ \ \ \ \ \ \ \ \ \ \text{and}\\
Q  &  =\left\{  \text{green lacunar subsets of }\left[  k\right]  \right\}  ,
\end{align*}
because the sets $\left\{  \text{red lacunar subsets of }\left[  k\right]
\right\}  $ and $\left\{  \text{green lacunar subsets of }\left[  k\right]
\right\}  $ are disjoint); but this is precisely the equality
(\ref{pf.thm.fib.lac.sum1}).

\subsection{Recitation \#1: More induction problems}

Here are some exercises that use induction in non-obvious ways. The first one
is about an infinite series:

\begin{exercise}
\label{exe.series.iip1}Prove that%
\[
\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  }=1.
\]

\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.series.iip1}.]There is no \textquotedblleft%
$n$\textquotedblright\ here to induct over, so one might wonder whether
induction really can help. But let's not give up. Induction can be very useful
for computing \textbf{finite} sums; but an infinite sum is the limit of its
partial sums, which are finite. So let us consider some partial sums.

For each integer $n\geq0$, let $S\left(  n\right)  $ denote the sum
$\sum_{i=1}^{n}\dfrac{1}{i\left(  i+1\right)  }$. This is a partial sum of the
infinite sum $\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  }$; thus,
\begin{equation}
\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  }=\lim\limits_{n\rightarrow
\infty}S\left(  n\right)  . \label{sol.series.iip1.lim}%
\end{equation}
(This assumes that the limit $\lim\limits_{n\rightarrow\infty}S\left(
n\right)  $ exists in the first place; we don't know this yet, but it will
fall out of our argument in the end.)

To get a feeling for the $S\left(  n\right)  $, let us compute the first few
values:%
\[
S\left(  0\right)  =0,\ \ \ \ \ \ \ \ \ \ S\left(  1\right)  =\dfrac{1}%
{2},\ \ \ \ \ \ \ \ \ \ S\left(  2\right)  =\dfrac{2}{3}%
,\ \ \ \ \ \ \ \ \ \ S\left(  3\right)  =\dfrac{3}{4}.
\]
This suggests a conjecture: Namely, we suspect that%
\begin{equation}
S\left(  n\right)  =\dfrac{n}{n+1}\ \ \ \ \ \ \ \ \ \ \text{for every integer
}n\geq0. \label{sol.series.iip1.Sn=}%
\end{equation}


But this conjecture can easily be verified by induction:

[\textit{Proof of (\ref{sol.series.iip1.Sn=}):} Induct on $n$.

\textit{Base case:} The definition of $S\left(  0\right)  $ yields $S\left(
0\right)  =\sum_{i=1}^{0}\dfrac{1}{i\left(  i+1\right)  }=\left(  \text{empty
sum}\right)  =0=\dfrac{0}{1}$. In other words, (\ref{sol.series.iip1.Sn=})
holds for $n=0$.

\textit{Induction step:} Let $m\geq0$ be an integer. Assume (as the induction
hypothesis) that (\ref{sol.series.iip1.Sn=}) holds for $n=m$. We must prove
that (\ref{sol.series.iip1.Sn=}) holds for $n=m+1$. In other words, we must
prove that $S\left(  m+1\right)  =\dfrac{m+1}{m+2}$.

Our induction hypothesis says that (\ref{sol.series.iip1.Sn=}) holds for
$n=m$. In other words, it says that $S\left(  m\right)  =\dfrac{m}{m+1}$.

Both $S\left(  m\right)  $ and $S\left(  m+1\right)  $ are partial sums of
$\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  }$; they differ only in
that $S\left(  m+1\right)  $ has an extra addend $\dfrac{1}{\left(
m+1\right)  \left(  m+2\right)  }$ that $S\left(  m\right)  $ does not have.
Thus,%
\[
S\left(  m+1\right)  =\underbrace{S\left(  m\right)  }_{=\dfrac{m}{m+1}%
}+\dfrac{1}{\left(  m+1\right)  \left(  m+2\right)  }=\dfrac{m}{m+1}+\dfrac
{1}{\left(  m+1\right)  \left(  m+2\right)  }=\dfrac{m+1}{m+2}%
\]
(by straightforward computations). Thus, we have shown that $S\left(
m+1\right)  =\dfrac{m+1}{m+2}$. In other words, (\ref{sol.series.iip1.Sn=})
holds for $n=m+1$. This completes the induction step, and with it the proof of
(\ref{sol.series.iip1.Sn=}).]

Now, (\ref{sol.series.iip1.lim}) becomes%
\begin{align*}
\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  }  &  =\lim
\limits_{n\rightarrow\infty}\underbrace{S\left(  n\right)  }%
_{\substack{=\dfrac{n}{n+1}\\\text{(by (\ref{sol.series.iip1.Sn=}))}}%
}=\lim\limits_{n\rightarrow\infty}\underbrace{\dfrac{n}{n+1}}_{=\dfrac
{1}{1+\dfrac{1}{n}}}=\lim\limits_{n\rightarrow\infty}\dfrac{1}{1+\dfrac{1}{n}%
}=\dfrac{1}{1+\lim\limits_{n\rightarrow\infty}\dfrac{1}{n}}\\
&  =\dfrac{1}{1+0}=1.
\end{align*}
This solves the exercise.
\end{proof}

The \textquotedblleft induct, then take the limit\textquotedblright\ approach
from the previous exercise has other uses as well. The following exercise is a
more intricate example:

\begin{exercise}
\label{exe.fib.contfrac-phi}Let $\varphi=\dfrac{1+\sqrt{5}}{2}$ (so that
$\varphi\approx1.618\ldots$). Prove that%
\begin{equation}
\varphi=1+\dfrac{1}{1+\dfrac{1}{1+\dfrac{1}{1+\dfrac{1}{\ddots}}}}.
\label{eq.exe.fib.contfrac-phi.cf}%
\end{equation}


\textbf{Note:} The infinite nested fraction on the right hand side of
(\ref{eq.exe.fib.contfrac-phi.cf}) is called an \textit{(infinite) continued
fraction}. It is rigorously defined as the limit of the sequence of its finite
initial segments -- i.e., in our case, of the sequence%
\[
\left(  1,1+\dfrac{1}{1},1+\dfrac{1}{1+\dfrac{1}{1}},1+\dfrac{1}{1+\dfrac
{1}{1+\dfrac{1}{1}}},\ldots\right)  .
\]

\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.contfrac-phi}.]Let us first restate the
claim without scary-looking nested fractions. Define a sequence $\left(
x_{1},x_{2},x_{3},\ldots\right)  $ of rational numbers recursively by
\[
x_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and }x_{n}=1+\dfrac{1}{x_{n-1}%
}\ \ \ \ \ \ \ \ \ \ \text{for all }n\geq2.
\]
Thus,%
\[
x_{1}=1,\ \ \ \ \ \ \ \ \ \ x_{2}=1+\dfrac{1}{1},\ \ \ \ \ \ \ \ \ \ x_{3}%
=1+\dfrac{1}{1+\dfrac{1}{1}},\ \ \ \ \ \ \ \ \ \ x_{4}=1+\dfrac{1}{1+\dfrac
{1}{1+\dfrac{1}{1}}},\ \ \ \ \ \ \ \ \ \ \ldots\text{.}%
\]
Thus, $\left(  x_{1},x_{2},x_{3},\ldots\right)  $ is the sequence of finite
initial segments of the infinite continued fraction on the right hand side of
(\ref{eq.exe.fib.contfrac-phi.cf}). The latter fraction is thus defined as
$\lim\limits_{n\rightarrow\infty}x_{n}$. Hence, our claim rewrites as
$\varphi=\lim\limits_{n\rightarrow\infty}x_{n}$. So we need to prove that
$\varphi=\lim\limits_{n\rightarrow\infty}x_{n}$.

There are many ways to go about this; let us outline two:

\textit{First approach.} Computing the first few entries of the sequence
$\left(  x_{1},x_{2},x_{3},\ldots\right)  $ shows that%
\[
x_{1}=1,\ \ \ \ \ \ \ \ \ \ x_{2}=2,\ \ \ \ \ \ \ \ \ \ x_{3}=\dfrac{3}%
{2},\ \ \ \ \ \ \ \ \ \ x_{4}=\dfrac{5}{3},\ \ \ \ \ \ \ \ \ \ x_{5}=\dfrac
{8}{5},\ \ \ \ \ \ \ \ \ \ x_{6}=\dfrac{13}{8}.
\]
Both the numerators and the denominators in these fractions belong to the
Fibonacci sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ introduced in
Definition \ref{def.fibonacci}. A quick comparison suggests the conjecture
that%
\begin{equation}
x_{n}=\dfrac{f_{n+1}}{f_{n}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1.
\label{sol.fib.contfrac-phi.a1.1}%
\end{equation}
This is indeed true; indeed, (\ref{sol.fib.contfrac-phi.a1.1}) can easily be
shown by induction on $n$ (exercise!).

\begin{fineprint}
Better yet, even if you forgot about the Fibonacci sequence, you could easily
discover the formula (\ref{sol.fib.contfrac-phi.a1.1}) as follows: The values
of $x_{1},x_{2},\ldots,x_{6}$ we computed above do not look very random; they
are fractions\footnote{Here we rewrite $x_{1}=1$ as $\dfrac{1}{1}$, and
$x_{2}=2$ as $\dfrac{2}{1}$.}, with the numerator of each $x_{i}$ reappearing
as the denominator of $x_{i+1}$. (This is not surprising, given the recursive
definition of $\left(  x_{1},x_{2},x_{3},\ldots\right)  $.) This suggests that
the numbers $x_{n}$ have the form $x_{n}=\dfrac{a_{n+1}}{a_{n}}$ for some
sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)  $ of integers. And indeed,
we can try to define such a sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)
$ by setting $a_{i}=x_{1}x_{2}\cdots x_{i-1}$ for each $i\geq1$ (which, in
particular, entails that $a_{1}=x_{1}x_{2}\cdots x_{0}=\left(  \text{empty
product}\right)  =1$, because empty products are defined to be $1$). Now, the
recursive equation $x_{n}=1+\dfrac{1}{x_{n-1}}$ can be restated in terms of
the sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)  $ as follows:%
\begin{align*}
&  \ \left(  x_{n}=1+\dfrac{1}{x_{n-1}}\right) \\
&  \Longleftrightarrow\ \left(  \dfrac{a_{n+1}}{a_{n}}=1+\dfrac{1}{\left(
\dfrac{a_{n}}{a_{n-1}}\right)  }\right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{since }x_{n}=\dfrac{a_{n+1}}{a_{n}}\text{ and }x_{n-1}=\dfrac{a_{n}%
}{a_{n-1}}\right) \\
&  \Longleftrightarrow\ \left(  \dfrac{a_{n+1}}{a_{n}}=1+\dfrac{a_{n-1}}%
{a_{n}}\right) \\
&  \Longleftrightarrow\ \left(  a_{n+1}=a_{n}+a_{n-1}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we multiplied both sides by }%
a_{n}\right)  .
\end{align*}
Thus, the sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)  $ must satisfy
the recursive equation $a_{n+1}=a_{n}+a_{n-1}$ for each $n\geq2$. But this is
the same recursive equation that the Fibonacci sequence $\left(  f_{0}%
,f_{1},f_{2},\ldots\right)  $ satisfies! Moreover, the first two entries
$a_{1}$ and $a_{2}$ of the sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)
$ are the second and third entries $f_{1}$ and $f_{2}$ of the Fibonacci
sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ (since $a_{1}=1=f_{1}$
and $a_{2}=x_{1}=1=f_{2}$). Thus, the sequence $\left(  a_{1},a_{2}%
,a_{3},\ldots\right)  $ is precisely the \textquotedblleft
shifted\textquotedblright\ Fibonacci sequence $\left(  f_{1},f_{2}%
,f_{3},\ldots\right)  $ (\textquotedblleft shifted\textquotedblright\ in the
sense that the first entry $f_{0}=1$ is discarded). Now, $x_{n}=\dfrac
{a_{n+1}}{a_{n}}$ becomes $x_{n}=\dfrac{f_{n+1}}{f_{n}}$, so we have arrived
at (\ref{sol.fib.contfrac-phi.a1.1}) without relying on our integer sequence
identification skills.
\end{fineprint}

What can we do with (\ref{sol.fib.contfrac-phi.a1.1})? We still need to prove
that $\varphi=\lim\limits_{n\rightarrow\infty}x_{n}$. While
(\ref{sol.fib.contfrac-phi.a1.1}) gives a formula for $x_{n}$ in terms of
Fibonacci numbers, we still need to find $\lim\limits_{n\rightarrow\infty
}x_{n}$ somehow.

Binet's formula (Theorem \ref{thm.fib.binet}) comes to our help now. Set
$\psi=\dfrac{1-\sqrt{5}}{2}$. Note that our $\varphi$ and $\psi$ here are
precisely the $\varphi$ and $\psi$ from Theorem \ref{thm.fib.binet}. Thus, for
every nonnegative integer $n$, we have
\begin{align}
f_{n}  &  =\dfrac{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}}\psi
^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.fib.binet}}\right)
\nonumber\\
&  =\dfrac{1}{\sqrt{5}}\left(  \varphi^{n}-\psi^{n}\right)  =\dfrac{1}%
{\sqrt{5}}\varphi^{n}\left(  1-\dfrac{\psi^{n}}{\varphi^{n}}\right)
=\dfrac{1}{\sqrt{5}}\varphi^{n}\left(  1-\left(  \dfrac{\psi}{\varphi}\right)
^{n}\right) \nonumber\\
&  =\dfrac{1}{\sqrt{5}}\varphi^{n}\left(  1-\rho^{n}\right)  ,
\label{sol.fib.contfrac-phi.a1.binet3}%
\end{align}
where we have set $\rho:=\dfrac{\psi}{\varphi}$. Note that this $\rho$ is
explicitly given by $\rho=\dfrac{1-\sqrt{5}}{1+\sqrt{5}}=\dfrac{\sqrt{5}-3}%
{2}\approx-0.381\,97\ldots$.

Now, for each $n\geq1$, we have%
\begin{align*}
x_{n}  &  =\dfrac{f_{n+1}}{f_{n}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.fib.contfrac-phi.a1.1})}\right) \\
&  =\underbrace{f_{n+1}}_{\substack{=\dfrac{1}{\sqrt{5}}\varphi^{n+1}\left(
1-\rho^{n+1}\right)  \\\text{(by (\ref{sol.fib.contfrac-phi.a1.binet3}))}%
}}/\underbrace{f_{n}}_{\substack{=\dfrac{1}{\sqrt{5}}\varphi^{n}\left(
1-\rho^{n}\right)  \\\text{(by (\ref{sol.fib.contfrac-phi.a1.binet3}))}}}\\
&  =\left(  \dfrac{1}{\sqrt{5}}\varphi^{n+1}\left(  1-\rho^{n+1}\right)
\right)  /\left(  \dfrac{1}{\sqrt{5}}\varphi^{n}\left(  1-\rho^{n}\right)
\right)  =\varphi\cdot\dfrac{1-\rho^{n+1}}{1-\rho^{n}}.
\end{align*}
Hence,%
\begin{equation}
\lim\limits_{n\rightarrow\infty}x_{n}=\lim\limits_{n\rightarrow\infty}\left(
\varphi\cdot\dfrac{1-\rho^{n+1}}{1-\rho^{n}}\right)  =\varphi\cdot
\lim\limits_{n\rightarrow\infty}\dfrac{1-\rho^{n+1}}{1-\rho^{n}}.
\label{sol.fib.contfrac-phi.a1.5}%
\end{equation}
The limit on the right hand side is now easy to find: Since $\left\vert
\rho\right\vert <1$, we have $\rho^{n}\rightarrow0$ as $n\rightarrow\infty$,
and therefore also $\rho^{n+1}\rightarrow0$ as $n\rightarrow\infty$. Hence,
$\dfrac{1-\rho^{n+1}}{1-\rho^{n}}\rightarrow\dfrac{1-0}{1-0}=1$ as
$n\rightarrow\infty$. In other words, $\lim\limits_{n\rightarrow\infty}%
\dfrac{1-\rho^{n+1}}{1-\rho^{n}}=1$. Hence, (\ref{sol.fib.contfrac-phi.a1.5})
becomes%
\[
\lim\limits_{n\rightarrow\infty}x_{n}=\varphi\cdot\underbrace{\lim
\limits_{n\rightarrow\infty}\dfrac{1-\rho^{n+1}}{1-\rho^{n}}}_{=1}=\varphi.
\]
This proves $\varphi=\lim\limits_{n\rightarrow\infty}x_{n}$, and thus solves
the exercise.

\textit{Second approach.} The first approach showed above relied on an exact
computation of the first few entries of the sequence $\left(  x_{1}%
,x_{2},x_{3},\ldots\right)  $. In contrast, for our second approach (which is
mostly taken from \cite[\S 3.1.4]{GelAnd}), let us compute them approximately:%
\[
x_{1}=1,\ \ \ \ \ \ \ \ \ \ x_{2}=2,\ \ \ \ \ \ \ \ \ \ x_{3}%
=1.5,\ \ \ \ \ \ \ \ \ \ x_{4}\approx1.667,\ \ \ \ \ \ \ \ \ \ x_{5}%
=1.6,\ \ \ \ \ \ \ \ \ \ x_{6}\approx1.625.
\]
This creates the impression that the sequence $\left(  x_{1},x_{2}%
,x_{3},\ldots\right)  $ converges to $\varphi\approx1.618$ alternatingly from
the bottom and the top: the odd-numbered entries $x_{1},x_{3},x_{5},\ldots$
appear to be smaller than $\varphi$, while the even-numbered entries
$x_{2},x_{4},x_{6},\ldots$ appear to be larger than $\varphi$. Better yet, it
seems that%
\begin{equation}
x_{2}<x_{4}<x_{6}<\cdots<\varphi<\cdots<x_{5}<x_{3}<x_{1}.
\label{sol.fib.contfrac-phi.a2.chain}%
\end{equation}
While this alone would not suffice to solve the exercise, it seems like a good
step forward, so let us try to prove this. We need to show the following two statements:

\begin{itemize}
\item If $i\geq1$ satisfies $x_{i}>\varphi$, then $x_{i+1}<\varphi$ and
$x_{i+2}<x_{i}$.

\item If $i\geq1$ satisfies $x_{i}<\varphi$, then $x_{i+1}>\varphi$ and
$x_{i+2}>x_{i}$.
\end{itemize}

\noindent Both of these statements follow by some manipulation of
inequalities.\footnote{For example, let us prove the first statement. So let
$i\geq1$ be an integer satisfying $x_{i}>\varphi$. We must prove that
$x_{i+1}<\varphi$ and $x_{i+2}<x_{i}$. The recursive definition of $x_{i+1}$
yields $x_{i+1}=1+\dfrac{1}{x_{i}}<1+\dfrac{1}{\varphi}$ (since $x_{i}%
>\varphi$). But a straightforward computation shows that $1+\dfrac{1}{\varphi
}=\varphi$. Hence, $x_{i+1}<1+\dfrac{1}{\varphi}=\varphi$. Furthermore, the
recursive definition of $x_{i+2}$ yields%
\begin{align*}
x_{i+2}  &  =1+\dfrac{1}{x_{i+1}}=1+\dfrac{1}{1+\dfrac{1}{x_{i}}%
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }x_{i+1}=1+\dfrac{1}{x_{i}}\right) \\
&  =1+\dfrac{x_{i}}{1+x_{i}}<x_{i},
\end{align*}
where the last inequality is a consequence of the fact that $x_{i}>\varphi$
and the (straightforward) fact that $1+\dfrac{x}{1+x}<x$ for every real
$x>\varphi$. Thus, both $x_{i+1}<\varphi$ and $x_{i+2}<x_{i}$ are proved.
\par
The second statement is proved similarly, except that this time $1+\dfrac
{x_{i}}{1+x_{i}}>x_{i}$ follows from $x_{i}<\varphi$ and $x_{i}\geq0$. We
leave the details to the reader.} Thus, (\ref{sol.fib.contfrac-phi.a2.chain})
is proved.

Now, (\ref{sol.fib.contfrac-phi.a2.chain}) shows that the sequence $\left(
x_{1},x_{3},x_{5},\ldots\right)  $ is decreasing and bounded from below;
hence,
\href{https://en.wikipedia.org/wiki/Monotone_convergence_theorem#Convergence_of_a_monotone_sequence_of_real_numbers}{the
monotone convergence theorem} shows that this sequence $\left(  x_{1}%
,x_{3},x_{5},\ldots\right)  $ has a limit $a:=\lim\limits_{n\rightarrow\infty
}x_{2n+1}$. Likewise, the sequence $\left(  x_{2},x_{4},x_{6},\ldots\right)  $
has a limit $b:=\lim\limits_{n\rightarrow\infty}x_{2n}$ (since
(\ref{sol.fib.contfrac-phi.a2.chain}) shows that this sequence is increasing
and bounded from above). We shall now show that $a=b=\varphi$.

Indeed, we have%
\[
a=\lim\limits_{n\rightarrow\infty}\underbrace{x_{2n+1}}_{=1+\dfrac{1}{x_{2n}}%
}=\lim\limits_{n\rightarrow\infty}\left(  1+\dfrac{1}{x_{2n}}\right)
=1+\dfrac{1}{\lim\limits_{n\rightarrow\infty}x_{2n}}=1+\dfrac{1}%
{b}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\lim\limits_{n\rightarrow\infty
}x_{2n}=b\right)
\]
and%
\begin{align*}
b  &  =\lim\limits_{n\rightarrow\infty}x_{2n}=\lim\limits_{n\rightarrow\infty
}\underbrace{x_{2\left(  n+1\right)  }}_{\substack{=x_{2n+2}\\=1+\dfrac
{1}{x_{2n+1}}}}\ \ \ \ \ \ \ \ \ \ \left(  \text{since we can substitute
}n+1\text{ for }n\text{ in a limit}\right) \\
&  =\lim\limits_{n\rightarrow\infty}\left(  1+\dfrac{1}{x_{2n+1}}\right)
=1+\dfrac{1}{\lim\limits_{n\rightarrow\infty}x_{2n+1}}=1+\dfrac{1}%
{a}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\lim\limits_{n\rightarrow\infty
}x_{2n+1}=a\right)  .
\end{align*}
How can we solve these two equalities for $a$ and $b$ ? The simplest way is
perhaps the following: Multiplying the equation $a=1+\dfrac{1}{b}$ by $b$, we
find $ab=b+1$; on the other hand, multiplying the equation $b=1+\dfrac{1}{a}$
by $a$, we find $ab=a+1$. Comparing $ab=a+1$ with $ab=b+1$, we find $a+1=b+1$,
thus $a=b$. However, $b=\lim\limits_{n\rightarrow\infty}\underbrace{x_{2n}%
}_{\substack{<\varphi\\\text{(by (\ref{sol.fib.contfrac-phi.a2.chain}))}}%
}\leq\lim\limits_{n\rightarrow\infty}\varphi=\varphi$ and $a=\lim
\limits_{n\rightarrow\infty}\underbrace{x_{2n+1}}_{\substack{>\varphi
\\\text{(by (\ref{sol.fib.contfrac-phi.a2.chain}))}}}\geq\lim
\limits_{n\rightarrow\infty}\varphi=\varphi$, so that $\varphi\leq a$.
Combined with $a=b\leq\varphi$, this yields $a=\varphi$. Similarly,
$b=\varphi$.

Now, we know that both subsequences $\left(  x_{1},x_{3},x_{5},\ldots\right)
$ and $\left(  x_{2},x_{4},x_{6},\ldots\right)  $ of the sequence $\left(
x_{1},x_{2},x_{3},\ldots\right)  $ converge to $\varphi$ (since $\lim
\limits_{n\rightarrow\infty}x_{2n+1}=a=\varphi$ and $\lim\limits_{n\rightarrow
\infty}x_{2n}=b=\varphi$). By basic properties of limits, this implies that
the whole sequence $\left(  x_{1},x_{2},x_{3},\ldots\right)  $ converges to
$\varphi$. In other words, $\varphi=\lim\limits_{n\rightarrow\infty}x_{n}$.
Again, the exercise is solved.
\end{proof}

Here is another exercise that does not look like an induction problem, yet is one:

\begin{exercise}
\label{exe.ind.funny-ints}We say that a number is \textit{funny} if it can be
written in the form%
\[
\pm1^{2}\pm2^{2}\pm3^{2}\pm\cdots\pm m^{2}%
\]
for some nonnegative integer $m$ and some choice of $\pm$ signs. For example,
$4$ is funny because $4=-1^{2}-2^{2}+3^{2}$, whereas $5$ is funny because
$5=+1^{2}+2^{2}$. Also, $0$ is funny since $0=\left(  \text{empty sum}\right)
$ (this corresponds to choosing $m=0$).

Prove that every integer is funny.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.ind.funny-ints}.]I will not give a full
solution, but here is a sequence of hints that should suffice:

\begin{enumerate}
\item First, let's try to solve the \textquotedblleft little
brother\textquotedblright\ of the problem, which is obtained by replacing the
squares by $1$-st powers: We say that a number is \textit{giggly} if it can be
written in the form
\[
\pm1\pm2\pm3\pm\cdots\pm m
\]
for some nonnegative integer $m$ and some choice of $\pm$ signs. Prove that
every integer is giggly.

\item It suffices to prove that every positive integer is giggly (resp.
funny), since flipping all the $\pm$ signs will flip the sign of the number.

\item If some number $n$ is giggly, then so is $n+1$, because $n=\pm1\pm
2\pm3\pm\cdots\pm m$ entails $n+1=\pm1\pm2\pm3\pm\cdots\pm m-\left(
m+1\right)  +\left(  m+2\right)  $.

\item So much for the \textquotedblleft little brother\textquotedblright. What
about the original problem? We need an analogue of the formula $-\left(
m+1\right)  +\left(  m+2\right)  =1$ that we just used.

\item The most obvious thing to try is $-\left(  m+1\right)  ^{2}+\left(
m+2\right)  ^{2}$. Unfortunately, this is not $1$ but $2m+3$, but this is
already a good step forward, since it is linear (not quadratic) in $m$.

\item Now, let us subtract $-\left(  m+1\right)  ^{2}+\left(  m+2\right)
^{2}=2m+3$ from $-\left(  m+3\right)  ^{2}+\left(  m+4\right)  ^{2}=2\left(
m+2\right)  +3$, since this should get rid of the linear term and leave a
constant behind. We obtain%
\begin{align}
&  \left(  m+1\right)  ^{2}-\left(  m+2\right)  ^{2}-\left(  m+3\right)
^{2}+\left(  m+4\right)  ^{2}\nonumber\\
&  =-\underbrace{\left(  \left(  m+1\right)  ^{2}-\left(  m+2\right)
^{2}\right)  }_{=2m+3}+\underbrace{\left(  -\left(  m+3\right)  ^{2}+\left(
m+4\right)  ^{2}\right)  }_{=2\left(  m+2\right)  +3=2m+7}\nonumber\\
&  =-\left(  2m+3\right)  +\left(  2m+7\right)  =4.
\label{sol.ind.funny-ints.square-4}%
\end{align}


\item Thus, if some number $n$ is funny, then so is $n+4$.

\item Hence, by strong induction, it suffices to show that every $n\in\left\{
0,1,2,3\right\}  $ is funny.

\item Do it! \qedhere

\end{enumerate}
\end{proof}

This ends our first excursion into the uses of induction. We will see more
uses, and even more variants of induction, in the following chapters.

\newpage

\section{\label{chp.nt1}Number Theory I: Divisibility and congruence}

We shall now discuss some of the most classical results in mathematics: the
properties of divisibility and modular congruence of integers. Most of them
were known to Euclid, although the concept of congruence was first defined by
Gauss. These results are doubly important: first, these facts are basic and
commonly used in contest mathematics; second, they make good examples for
induction proofs. Proofs will be mostly skipped or sketched; detailed proofs
can be found in every text on elementary number theory (or in \cite[Chapter
2]{19s}, from which I am copypasting some of the statements). We are not
trying to be comprehensive or detailed; there are better sources for this
(e.g., \cite{Burton11}, \cite{NiZuMo91} or \cite{UspHea39}, or, for a shorter
introduction, \cite{Dudley12}).

\subsection{Quotients and remainders}

First, a few definitions. I begin by weighing in on one of the most
controversial issues of our time:

\begin{definition}
The symbol $\mathbb{N}$ will denote the set $\left\{  0,1,2,\ldots\right\}  $
of all nonnegative integers.
\end{definition}

\noindent(The faultline between the \textquotedblleft$\mathbb{N}=\left\{
0,1,2,\ldots\right\}  $ people\textquotedblright\ and the \textquotedblleft%
$\mathbb{N}=\left\{  1,2,3,\ldots\right\}  $ people\textquotedblright\ is
rather close to that between algebraists/combinatorialists and number
theorists; as you can see, I am one of the former.)

\begin{definition}
\label{def.ent.div.div}Let $a$ and $b$ be two integers. We say that $a\mid b$
(or \textquotedblleft$a$ \textit{divides} $b$\textquotedblright\ or
\textquotedblleft$b$ is \textit{divisible by }$a$\textquotedblright\ or
\textquotedblleft$b$ is a \textit{multiple} of $a$\textquotedblright\ or
\textquotedblleft$a$ is a \textit{divisor} of $b$\textquotedblright) if there
exists an integer $c$ such that $b=ac$.

We furthermore say that $a\nmid b$ if $a$ does not divide $b$.
\end{definition}

\noindent This definition, too, is a bit controversial: It implies that
$0\mid0$. Some authors don't like this (arguing that $a\mid b$ should mean
that $b/a$ is uniquely determined, which $0/0$ is not); while I understand
their thinking, I believe that forbidding $0$ from dividing itself would
create more headaches than it would prevent. The words \textquotedblleft
divides\textquotedblright\ and \textquotedblleft divisor\textquotedblright,
too, can mean different things depending on whom you ask; in particular, Knuth
(e.g. in \cite{GKP}) likes to define them differently from how I
do\footnote{He defines \textquotedblleft$a$ divides $b$\textquotedblright\ to
mean \textquotedblleft$b>0$, and there exists an integer $c$ such that
$b=ac$\textquotedblright. This is to be distinguished from \textquotedblleft%
$b$ is a multiple of $a$\textquotedblright, which he (like me) defines to mean
only \textquotedblleft there exists an integer $c$ such that $b=ac$%
\textquotedblright. Thus, quoting \cite[\S 4.1]{GKP}: \textquotedblleft Every
integer is a multiple of $-1$, but no integer is divisible by $-1$ (strictly
speaking)\textquotedblright. Again, I understand the reasons for this (e.g.,
this way, the divisors of $6$ are $1,2,3,6$ rather than the unnecessarily
duplicated $-6,-3,-2,-1,1,2,3,6$), but I am not convinced that it is worth the
headache.}.

Note that $1\mid b$ holds for any $b\in\mathbb{Z}$; but $0\mid b$ holds only
for $b=0$. Note also that $a\mid-a$ for each $a\in\mathbb{Z}$.

Here are some basic properties of divisibility (all of which are easy to
prove\footnote{For what it's worth: Proposition \ref{prop.ent.div.1} is a
combination of \cite[Proposition 2.2.3 and Exercise 2.2.2]{19s}. Proposition
\ref{prop.ent.div.2} is a combination of \cite[Proposition 2.2.4 and Exercise
2.2.6]{19s}. Proposition \ref{prop.ent.div.acbc} is \cite[Exercise 2.2.3]%
{19s}. Proposition \ref{prop.ent.div.nanb} is \cite[Exercise 2.2.4]{19s}.
Finally, Proposition \ref{prop.ent.plus} follows easily from \cite[Proposition
2.3.4 \textbf{(d)}]{19s} or can be straightforwardly proved using the
definition of divisibility.}):

\begin{proposition}
\label{prop.ent.div.1}Let $a$ and $b$ be two integers.

\textbf{(a)} We have $a\mid b$ if and only if $\left\vert a\right\vert
\mid\left\vert b\right\vert $. (Here, \textquotedblleft$\left\vert
a\right\vert \mid\left\vert b\right\vert $\textquotedblright\ means
\textquotedblleft$\left\vert a\right\vert $ divides $\left\vert b\right\vert
$\textquotedblright.)

\textbf{(b)} If $a\mid b$ and $b\neq0$, then $\left\vert a\right\vert
\leq\left\vert b\right\vert $.

\textbf{(c)} If $a\mid b$ and $b\mid a$, then $\left\vert a\right\vert
=\left\vert b\right\vert $.

\textbf{(d)} Assume that $a\neq0$. Then, $a\mid b$ if and only if $\dfrac
{b}{a}\in\mathbb{Z}$.
\end{proposition}

\begin{proposition}
\label{prop.ent.div.2}\textbf{(a)} We have $a\mid a$ for every $a\in
\mathbb{Z}$. (This is called the \textit{reflexivity of divisibility}.)

\textbf{(b)} If $a,b,c\in\mathbb{Z}$ satisfy $a\mid b$ and $b\mid c$, then
$a\mid c$. (This is called the \textit{transitivity of divisibility}.)

\textbf{(c)} If $a_{1},a_{2},b_{1},b_{2}\in\mathbb{Z}$ satisfy $a_{1}\mid
b_{1}$ and $a_{2}\mid b_{2}$, then $a_{1}a_{2}\mid b_{1}b_{2}$.

\textbf{(d)} If $a,b\in\mathbb{Z}$ satisfy $a\mid b$, then $a^{k}\mid b^{k}$
for any nonnegative integer $k$.
\end{proposition}

\begin{proposition}
\label{prop.ent.div.acbc}Let $a,b,c$ be three integers such that $c\neq0$.
Then, $a\mid b$ holds if and only if $ac\mid bc$.
\end{proposition}

\begin{proposition}
\label{prop.ent.div.nanb}Let $n\in\mathbb{Z}$. Let $a,b\in\mathbb{N}$ be such
that $a\leq b$. Then, $n^{a}\mid n^{b}$.
\end{proposition}

\begin{proposition}
\label{prop.ent.plus}Let $a,b,c\in\mathbb{Z}$ be such that $a\mid b$ and
$a\mid c$. Then, $a\mid b+c$ and $a\mid b-c$.
\end{proposition}

We shall use these facts many times (and often without saying). They provide
basic rules for manipulating divisibilities\footnote{A \textit{divisibility}
means a statement of the form \textquotedblleft$a\mid b$\textquotedblright.}.
For example, Proposition \ref{prop.ent.div.2} \textbf{(c)} allows multiplying
two divisibilities, while Proposition \ref{prop.ent.div.acbc} allows
multiplying both sides of a divisibility by a nonzero integer $c$ or,
conversely, cancelling the factor $c$ from both sides. Proposition
\ref{prop.ent.div.1} \textbf{(a)} ensures that both sides of a divisibility
can be replaced by their absolute values, which is why it often suffices to
consider nonnegative integers in divisibility arguments.

The next fact (\cite[Theorem 2.6.1]{19s}) is significantly more important:

\begin{theorem}
\label{thm.ent.quorem.full}Let $n$ be a positive integer. Let $u\in\mathbb{Z}%
$. Then, there exists a unique pair $\left(  q,r\right)  \in\mathbb{Z}%
\times\left\{  0,1,\ldots,n-1\right\}  $ such that $u=qn+r$.
\end{theorem}

Theorem \ref{thm.ent.quorem.full} essentially says that any integer $u$ can be
uniquely divided with remainder by any positive integer $n$. The entries $q$
and $r$ of the pair $\left(  q,r\right)  $ in Theorem
\ref{thm.ent.quorem.full} are called the \textit{quotient} and the
\textit{remainder} of this division.

We shall not prove Theorem \ref{thm.ent.quorem.full} in detail, but the reader
is advised to recall (or construct) at least one proof -- as it is a nice
exercise on induction. One detailed proof (using strong induction) is given in
\cite[\S 2.6]{19s}; another appears in \cite[proof of Theorem 2.153]%
{detnotes}. Let me say a few words about the second proof, as it illustrates a
little variation on standard induction: \textit{two-sided induction}. This
means using the following \textit{two-sided induction principle}
(\cite[Theorem 2.149]{detnotes}):

\begin{theorem}
\label{thm.ind-principle-2s}Let $g\in\mathbb{Z}$. For each integer $n$, let
$\mathcal{A}\left(  n\right)  $ be a logical statement. Assume the following:

\begin{itemize}
\item \textit{Assumption 1:} The statement $\mathcal{A}\left(  g\right)  $ holds.

\item \textit{Assumption 2:} If $m$ is an integer such that $m\geq g$ and such
that $\mathcal{A}\left(  m\right)  $ holds, then $\mathcal{A}\left(
m+1\right)  $ also holds.

\item \textit{Assumption 3:} If $m$ is an integer such that $m\leq g$ and such
that $\mathcal{A}\left(  m\right)  $ holds, then $\mathcal{A}\left(
m-1\right)  $ also holds.
\end{itemize}

Then, $\mathcal{A}\left(  n\right)  $ holds for all integers $n$.
\end{theorem}

\noindent While standard induction (Theorem \ref{thm.ind-principle}) and
strong induction (Theorem \ref{thm.strind-principle}) are tailored for proving
theorems about nonnegative (or positive) integers, two-sided induction
(Theorem \ref{thm.ind-principle-2s}) is best suited for proving theorems about
all integers. Thus, a two-sided induction has an induction base and
\textbf{two} induction steps, one of which goes \textquotedblleft
upwards\textquotedblright\ (from $\mathcal{A}\left(  m\right)  $ to
$\mathcal{A}\left(  m+1\right)  $) while the other goes \textquotedblleft
downwards\textquotedblright\ (from $\mathcal{A}\left(  m\right)  $ to
$\mathcal{A}\left(  m-1\right)  $). Now, Theorem \ref{thm.ent.quorem.full} can
be proved by two-sided induction on $u$ (for fixed $n$). More precisely, we
can use two-sided induction on $u$ to prove the existence of a pair $\left(
q,r\right)  \in\mathbb{Z}\times\left\{  0,1,\ldots,n-1\right\}  $ such that
$u=qn+r$; the uniqueness of this pair is easiest to prove directly. (See
\cite[proof of Theorem 2.153]{detnotes} for details.)

\subsection{Modular arithmetic I: Congruences}

Judged by their definition, \textit{congruences} -- or, more precisely,
\textit{modular congruences} -- are just reformulated divisibilities. But the
reformulation is worth it, as it exposes their most useful qualities. In this
section, we will define congruences and state their most basic properties;
later we shall return to take a deeper look at them.

First, the definition:

\begin{definition}
\label{def.ent.cong}Let $n,a,b\in\mathbb{Z}$. We say that $a$ \textit{is
congruent to }$b$ \textit{modulo }$n$ if and only if $n\mid a-b$. We shall use
the notation \textquotedblleft$a\equiv b\operatorname{mod}n$\textquotedblright%
\ for \textquotedblleft$a$ is congruent to $b$ modulo $n$\textquotedblright.

We furthermore shall use the notation \textquotedblleft$a\not \equiv
b\operatorname{mod}n$\textquotedblright\ for \textquotedblleft$a$ is not
congruent to $b$ modulo $n$\textquotedblright.
\end{definition}

\begin{example}
\label{exa.ent.cong.triv}\textbf{(a)} Is $3\equiv7\operatorname{mod}2$ ? Yes,
since $2\mid3-7=-4$.

\textbf{(b)} Is $3\equiv6\operatorname{mod}2$ ? No, since $2\nmid3-6=-3$. So
we have $3\not \equiv 6\operatorname{mod}2$.

Now, let $a$ and $b$ be two integers.

\textbf{(c)} We have $a\equiv b\operatorname{mod}0$ if and only if $a=b$.
(Indeed, $a\equiv b\operatorname{mod}0$ is defined to mean $0\mid a-b$, but
the latter divisibility happens only when $a-b=0$, which is tantamount to
saying $a=b$.)

\textbf{(d)} We have $a\equiv b\operatorname{mod}1$ always, since $1\mid a-b$
always holds (remember: $1$ divides everything).
\end{example}

Statements of the form \textquotedblleft$a\equiv b\operatorname{mod}%
n$\textquotedblright\ are called \textit{congruences} (just as statements of
the form \textquotedblleft$a=b$\textquotedblright\ are called equalities). The
number $n$ is called the \textit{modulus} of the congruence $a\equiv
b\operatorname{mod}n$. The following properties of congruences are proved in
\cite[\S 2.3]{19s} (but the proofs make good exercises!):

\begin{proposition}
\label{prop.ent.mod.0}Let $n\in\mathbb{Z}$ and $a\in\mathbb{Z}$. Then,
$a\equiv0\operatorname{mod}n$ if and only if $n\mid a$. (Thus, in particular,
$n\equiv0\operatorname{mod}n$ always holds.)
\end{proposition}

\begin{proposition}
\label{prop.ent.mod.a+nd}Let $a,b,n\in\mathbb{Z}$. Then, $a\equiv
b\operatorname{mod}n$ if and only if there exists some $d\in\mathbb{Z}$ such
that $b=a+nd$.
\end{proposition}

\begin{proposition}
\label{prop.ent.mod.diff}Let $a,b,c,n\in\mathbb{Z}$. Then, $a-b\equiv
c\operatorname{mod}n$ if and only if $a\equiv b+c\operatorname{mod}n$.
\end{proposition}

\begin{proposition}
\label{prop.ent.mod.basics}Let $n\in\mathbb{Z}$.

\textbf{(a)} We have $a\equiv a\operatorname{mod}n$ for every $a\in\mathbb{Z}%
$. (This is called the \textit{reflexivity of congruence}.)

\textbf{(b)} If $a,b,c\in\mathbb{Z}$ satisfy $a\equiv b\operatorname{mod}n$
and $b\equiv c\operatorname{mod}n$, then $a\equiv c\operatorname{mod}n$. (This
is called the \textit{transitivity of congruence}.)

\textbf{(c)} If $a,b\in\mathbb{Z}$ satisfy $a\equiv b\operatorname{mod}n$,
then $b\equiv a\operatorname{mod}n$. (This is called the \textit{symmetry of
congruence}.)

\textbf{(d)} If $a_{1},a_{2},b_{1},b_{2}\in\mathbb{Z}$ satisfy $a_{1}\equiv
b_{1}\operatorname{mod}n$ and $a_{2}\equiv b_{2}\operatorname{mod}n$, then%
\begin{align}
a_{1}+a_{2}  &  \equiv b_{1}+b_{2}\operatorname{mod}%
n;\label{eq.prop.ent.mod.basics.d.1}\\
a_{1}-a_{2}  &  \equiv b_{1}-b_{2}\operatorname{mod}%
n;\label{eq.prop.ent.mod.basics.d.2}\\
a_{1}a_{2}  &  \equiv b_{1}b_{2}\operatorname{mod}n.
\label{eq.prop.ent.mod.basics.d.3}%
\end{align}


\textbf{(e)} Let $m\in\mathbb{Z}$ be such that $m\mid n$. If $a,b\in
\mathbb{Z}$ satisfy $a\equiv b\operatorname{mod}n$, then $a\equiv
b\operatorname{mod}m$.
\end{proposition}

\begin{proposition}
\label{prop.ent.mod.k-power}Let $n,a,b\in\mathbb{Z}$ be such that $a\equiv
b\operatorname{mod}n$. Then, $a^{k}\equiv b^{k}\operatorname{mod}n$ for each
$k\in\mathbb{N}$.
\end{proposition}

\begin{proposition}
\label{prop.ent.mod.k-sum}Let $n$ be an integer. Let $S$ be a finite set. For
each $s\in S$, let $a_{s}$ and $b_{s}$ be two integers. Assume that%
\begin{equation}
a_{s}\equiv b_{s}\operatorname{mod}n\ \ \ \ \ \ \ \ \ \ \text{for each }s\in
S. \label{eq.exe.ent.mod.k-sum.ass}%
\end{equation}
Then,%
\begin{equation}
\sum_{s\in S}a_{s}\equiv\sum_{s\in S}b_{s}\operatorname{mod}n
\label{eq.exe.ent.mod.k-sum.a}%
\end{equation}
and%
\begin{equation}
\prod_{s\in S}a_{s}\equiv\prod_{s\in S}b_{s}\operatorname{mod}n.
\label{eq.exe.ent.mod.k-sum.b}%
\end{equation}

\end{proposition}

Proposition \ref{prop.ent.mod.basics} \textbf{(d)} shows that any two
congruences can be added, subtracted and multiplied like equalities (as long
as their moduli are equal; e.g., we cannot add the congruences $1\equiv
3\operatorname{mod}2$ and $1\equiv4\operatorname{mod}3$, because their moduli
$2$ and $3$ are distinct)\footnote{That said, congruences cannot be
\textbf{divided}. That is, if we have $a_{1}\equiv b_{1}\operatorname{mod}n$
and $a_{2}\equiv b_{2}\operatorname{mod}n$, then we \textbf{cannot} conclude
that $a_{1}/a_{2}\equiv b_{1}/b_{2}\operatorname{mod}n$, even if we assume
something like $a_{2}\not \equiv 0\operatorname{mod}n$ and $b_{2}%
\not \equiv 0\operatorname{mod}n$. (Most of the time, the congruence
$a_{1}/a_{2}\equiv b_{1}/b_{2}\operatorname{mod}n$ will be meaningless, since
$a_{1}/a_{2}$ and $b_{1}/b_{2}$ are usually not integers. But even if they are
integers, the congruence need not hold.)}. Proposition
\ref{prop.ent.mod.k-sum} extends this to any (finite) number of congruences
(instead of just two). Proposition \ref{prop.ent.mod.k-power} says that a
congruence can be taken to the $k$-th power for every $k\in\mathbb{N}$ (again
like an equality).\footnote{Note, however, that $a\equiv b\operatorname{mod}n$
does \textbf{not} imply $k^{a}\equiv k^{b}\operatorname{mod}n$.} There is yet
another way in which congruences behave like equalities: Namely, they can be
chained together like equalities. To state this precisely, we need a definition:

\begin{definition}
\label{def.mod.chain}Let $n\in\mathbb{Z}$. If $a_{1},a_{2},\ldots,a_{k}$ are
$k$ integers, then the statement \textquotedblleft$a_{1}\equiv a_{2}%
\equiv\cdots\equiv a_{k}\operatorname{mod}n$\textquotedblright\ shall mean
that
\[
a_{i}\equiv a_{i+1}\operatorname{mod}n\text{ holds for each }i\in\left\{
1,2,\ldots,k-1\right\}  .
\]
(In other words, it shall mean that $a_{1}\equiv a_{2}\operatorname{mod}n$ and
$a_{2}\equiv a_{3}\operatorname{mod}n$ and $a_{3}\equiv a_{4}%
\operatorname{mod}n$ and $\cdots$ and $a_{k-1}\equiv a_{k}\operatorname{mod}%
n$. This is vacuously true when $k\leq1$. If $k=2$, then it simply means that
$a_{1}\equiv a_{2}\operatorname{mod}n$.)

Such a statement will be called a \textit{chain of congruences modulo }$n$.
\end{definition}

\begin{proposition}
\label{prop.mod.chain}Let $n\in\mathbb{Z}$. Let $a_{1},a_{2},\ldots,a_{k}$ be
$k$ integers such that $a_{1}\equiv a_{2}\equiv\cdots\equiv a_{k}%
\operatorname{mod}n$. Let $u$ and $v$ be two elements of $\left\{
1,2,\ldots,k\right\}  $. Then, $a_{u}\equiv a_{v}\operatorname{mod}n$.
\end{proposition}

Proposition \ref{prop.mod.chain} follows easily from Proposition
\ref{prop.ent.mod.basics} by induction. (See \cite[proof of Proposition
2.16]{detnotes} for the details of this proof.)

Proposition \ref{prop.mod.chain} allows chaining congruences (with equal
moduli) together. Thus, for example, we can quickly see that $7^{15}%
\equiv7\operatorname{mod}8$ via the following computation: Since
$7\equiv-1\operatorname{mod}8$, we have%
\begin{align*}
7^{15}  &  \equiv\underbrace{\left(  -1\right)  ^{15}}_{=-1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.mod.k-power},
applied to }n=8\text{, }a=7\text{, }b=-1\text{ and }k=15\right) \\
&  \equiv-1\equiv7\operatorname{mod}8.
\end{align*}
Note that the second \textquotedblleft$\equiv$\textquotedblright\ sign in this
chain is actually an equality sign, because every equality $a=b$ is
automatically a congruence $a\equiv b\operatorname{mod}n$ (by Proposition
\ref{prop.ent.mod.basics} \textbf{(a)}).

Proposition \ref{prop.ent.div.2} \textbf{(b)} shows that divisibilities can
also be chained together:

\begin{definition}
If $a_{1},a_{2},\ldots,a_{k}$ are $k$ integers, then the statement
\textquotedblleft$a_{1}\mid a_{2}\mid\cdots\mid a_{k}$\textquotedblright%
\ shall mean that
\[
a_{i}\mid a_{i+1}\text{ holds for each }i\in\left\{  1,2,\ldots,k-1\right\}
.
\]
(In other words, it shall mean that $a_{1}\mid a_{2}$ and $a_{2}\mid a_{3}$
and $a_{3}\mid a_{4}$ and $\cdots$ and $a_{k-1}\mid a_{k}$. Again, this is
vacuously true when $k\leq1$.)

Such a statement will be called a \textit{chain of divisibilities}.
\end{definition}

Thus, the analogue of Proposition \ref{prop.mod.chain} for divisibilities is
the following:

\begin{proposition}
\label{prop.div.chain}Let $a_{1},a_{2},\ldots,a_{k}$ be $k$ integers such that
$a_{1}\mid a_{2}\mid\cdots\mid a_{k}$. Let $u$ and $v$ be two elements of
$\left\{  1,2,\ldots,k\right\}  $ such that $u\leq v$. Then, $a_{u}\mid a_{v}$.
\end{proposition}

For example, if four integers $a,b,c,d$ satisfy $a\mid b\mid c\mid d$ (by
which we mean $a\mid b$ and $b\mid c$ and $c\mid d$), then $a\mid d$. Note
that we required $u\leq v$ in Proposition \ref{prop.div.chain}, because chains
of divisibilities cannot be reversed (e.g., we cannot derive $d\mid a$ from
$a\mid b\mid c\mid d$). Proposition \ref{prop.div.chain} is easily proved by induction.

Here is a sample exercise to illustrate manipulation of congruences:

\begin{exercise}
\label{exe.ent.mod.substitutivity.7div}Let $n\in\mathbb{N}$. Show that
$7\mid3^{2n+1}+2^{n+2}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.mod.substitutivity.7div}.]We have
$3^{2}=9\equiv2\operatorname{mod}7$. Thus, Proposition
\ref{prop.ent.mod.k-power} (applied to $7$, $3^{2}$, $2$ and $n$ instead of
$n$, $a$, $b$ and $k$) yields $\left(  3^{2}\right)  ^{n}\equiv2^{n}%
\operatorname{mod}7$. Multiplying this congruence\footnote{i.e., applying
(\ref{eq.prop.ent.mod.basics.d.3})} by the obvious congruence $3\equiv
3\operatorname{mod}7$, we obtain $\left(  3^{2}\right)  ^{n}\cdot3\equiv
2^{n}\cdot3\operatorname{mod}7$. Thus, $3^{2n+1}=\left(  3^{2}\right)
^{n}\cdot3\equiv2^{n}\cdot3\operatorname{mod}7$. On the other hand,
$2^{n+2}=2^{n}\cdot2^{2}=2^{n}\cdot4$, so that $2^{n+2}\equiv2^{n}%
\cdot4\operatorname{mod}7$ (since any equality is a congruence).

Now, adding the two congruences\footnote{i.e., applying
(\ref{eq.prop.ent.mod.basics.d.1})} $3^{2n+1}\equiv2^{n}\cdot
3\operatorname{mod}7$ and $2^{n+2}\equiv2^{n}\cdot4\operatorname{mod}7$, we
obtain%
\[
3^{2n+1}+2^{n+2}\equiv2^{n}\cdot3+2^{n}\cdot4=2^{n}\cdot\underbrace{\left(
3+4\right)  }_{=7}=2^{n}\cdot7\equiv0\operatorname{mod}7
\]
(since $2^{n}\cdot7$ is clearly divisible by $7$). In other words,
$7\mid3^{2n+1}+2^{n+2}$. This solves Exercise
\ref{exe.ent.mod.substitutivity.7div}.
\end{proof}

Congruences can not only be added, subtracted, multiplied and chained
together, but they can also be substituted into one another, in the following
sense:\footnote{Here, a \textquotedblleft\textit{polynomial expression}%
\textquotedblright\ means an expression that contains only variables,
integers, the symbols \textquotedblleft$+$\textquotedblright,
\textquotedblleft$-$\textquotedblright\ and \textquotedblleft$\cdot
$\textquotedblright\ and powers with constant exponents (i.e., things like
\textquotedblleft$a^{3}$\textquotedblright\ or \textquotedblleft$a^{9}%
$\textquotedblright, but never \textquotedblleft$2^{a}$\textquotedblright\ or
\textquotedblleft$a^{b}$\textquotedblright) such that all exponents are
nonnegative integers (so \textquotedblleft$a^{-1}$\textquotedblright\ is not
allowed either).}

\begin{example}
\label{exa.ent.mod.subst.1}Let $n$ be an integer. Assume you have two integers
$a$ and $b$ that are congruent modulo $n$ (that is, they satisfy $a\equiv
b\operatorname{mod}n$). Then, if you have any polynomial expression $P$
involving $a$, then you can substitute $b$ for $a$ in this expression, and
obtain a new expression $Q$ that satisfies $P\equiv Q\operatorname{mod}n$. For
example,%
\begin{align*}
a+2  &  \equiv b+2\operatorname{mod}n;\\
a^{5}  &  \equiv b^{5}\operatorname{mod}n;\\
\left(  a+2\right)  \left(  a+9\right)  -a  &  \equiv\left(  b+2\right)
\left(  b+9\right)  -b\operatorname{mod}n;\\
a^{2}+c^{2}+ac  &  \equiv b^{2}+c^{2}+bc\operatorname{mod}%
n\ \ \ \ \ \ \ \ \ \ \text{for any integer }c\text{;}\\
\sum_{i=0}^{k}a^{i}  &  \equiv\sum_{i=0}^{k}b^{i}\operatorname{mod}%
n\ \ \ \ \ \ \ \ \ \ \text{for every }k\in\mathbb{N}.
\end{align*}
This is called the \textit{substitution principle for congruences}. I will not
formalize this principle (see \cite[\S 2.5]{19s} for a more detailed
treatment, which too stops short of properly formalizing it), but I will make
four comments:

First, you don't have to replace \textbf{every} $a$ by $b$ when substituting;
you can choose \textbf{some} $a$'s to replace by $b$'s while leaving the
remaining $a$'s unchanged. Thus, for example, $a\equiv b\operatorname{mod}n$
yields $a^{7}+a^{4}+a\equiv b^{7}+a^{4}+b\operatorname{mod}n$ and $a^{7}%
+a^{4}+a\equiv b^{7}+a^{4}+a\operatorname{mod}n$ and various other such congruences.

Second, it is worth stressing that the only powers that can appear in a
polynomial expression are powers with constant exponents. In particular, we
cannot have \textquotedblleft$2^{a}$\textquotedblright\ in a polynomial
expression. This is important because we could \textbf{not} substitute $b$ for
$a$ in $2^{a}$; it is not usually true that $a\equiv b\operatorname{mod}n$
implies $2^{a}\equiv2^{b}\operatorname{mod}n$.

Third, when using the substitution principle for congruences, I will use
underbraces to point out what is being replaced by what. Thus, for example,
when substituting $b$'s for the three $a$'s in $\left(  a+2\right)  \left(
a+9\right)  -a$, I will write
\[
\left(  \underbrace{a}_{\equiv b\operatorname{mod}n}+2\right)  \left(
\underbrace{a}_{\equiv b\operatorname{mod}n}+9\right)  -\underbrace{a}_{\equiv
b\operatorname{mod}n}\equiv\left(  b+2\right)  \left(  b+9\right)
-b\operatorname{mod}n.
\]
(This is the same convention that I am using when substituting equal things in
an equality.)

Fourth, instead of proving the substitution principle for congruences, let me
explain how any specific application of this principle (i.e., any substitution
in a congruence) can be justified by references to Proposition
\ref{prop.ent.mod.basics}, Proposition \ref{prop.ent.mod.k-power} and
Proposition \ref{prop.ent.mod.k-sum}. For example, let's say we want to
justify that $a\equiv b\operatorname{mod}n$ entails $\left(  a+2\right)
\left(  a+9\right)  -a\equiv\left(  b+2\right)  \left(  b+9\right)
-b\operatorname{mod}n$. To do so, we first add the two congruences $a\equiv
a\operatorname{mod}n$ and $2\equiv2\operatorname{mod}n$ to obtain $a+2\equiv
b+2\operatorname{mod}n$. Likewise, we can get $a+9\equiv b+9\operatorname{mod}%
n$. Multiplying the latter two congruences, we find $\left(  a+2\right)
\left(  a+9\right)  \equiv\left(  b+2\right)  \left(  b+9\right)
\operatorname{mod}n$. Subtracting the congruence $a\equiv b\operatorname{mod}%
n$ from the latter congruence, we obtain $\left(  a+2\right)  \left(
a+9\right)  -a\equiv\left(  b+2\right)  \left(  b+9\right)
-b\operatorname{mod}n$, as desired. Similar reasoning can be used to
rigorously prove any instance of the substitution principle for congruences.
Thus, we don't really need the substitution principle; we can always
circumvent it (by adding, subtracting and multiplying congruences, and by
taking congruences to powers). However, the substitution principle saves time
and mental effort.
\end{example}

The following exercise is a slightly more intricate example of the use of congruences:

\begin{exercise}
\label{exe.ent.mod.fn-div}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be
the Fibonacci sequence. Prove the following: If $a,b\in\mathbb{N}$ satisfy
$a\mid b$, then $f_{a}\mid f_{b}$.
\end{exercise}

For example, this exercise entails that $f_{7}\mid f_{21}$ (since $7\mid21$).

\begin{proof}
[Solution to Exercise \ref{exe.ent.mod.fn-div}.]Nothing forces us to use
congruence here (after all, this exercise only talks about divisibility), and
it is indeed quite easy to avoid it; but I believe the solution is easier to
find using congruences.

Fix $a\in\mathbb{N}$. We must prove that for each $b\in\mathbb{N}$, the
following statement holds:%
\begin{equation}
\text{if }a\mid b\text{, then }f_{a}\mid f_{b}.
\label{sol.ent.mod.fn-div.goal}%
\end{equation}


We shall prove (\ref{sol.ent.mod.fn-div.goal}) by strong induction on $b$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ent.mod.fn-div.goal}) holds for all $b<k$. We must
prove that (\ref{sol.ent.mod.fn-div.goal}) holds for $b=k$. In other words, we
must prove that%
\begin{equation}
\text{if }a\mid k\text{, then }f_{a}\mid f_{k}. \label{sol.ent.mod.fn-div.IG}%
\end{equation}


So let us assume that $a\mid k$. We must then prove that $f_{a}\mid f_{k}$.

If $k=0$, then this is clearly true (since we have $f_{k}=f_{0}=0$ in this
case, and since $f_{a}\mid0$ is true\footnote{because any integer divides $0$%
}). Thus, for the rest of this proof, we WLOG assume that $k\neq0$. Hence,
$k\geq1$ (since $k\in\mathbb{N}$).

It is fairly easy to see (from $a\mid k$ and $k\geq1$ and $a\in\mathbb{N}$)
that $a\geq1$ and $k-a\in\mathbb{N}$ and $k-a<k$ and $a\mid k-a$%
\ \ \ \ \footnote{\textit{Proof.} We have $a\mid k$ (by assumption); in other
words, there exists an integer $c$ such that $k=ac$. Consider this $c$. If we
had $a=0$, then we would have $k=\underbrace{a}_{=0}c=0$, which would
contradict $k\neq0$. Hence, we have $a\neq0$. Thus, $a\geq1$ (since
$a\in\mathbb{N}$). Also, if we had $c\leq0$, then we would have
$k=a\underbrace{c}_{\leq0}\leq0$ (since $a\geq0$), which would contradict
$k\geq1>0$. Thus, we cannot have $c\leq0$; hence, we have $c>0$. (This is all
pretty obvious if you think about it; I'm just arguing that the quotient of
two positive integers must be positive.)
\par
From $c>0$, we obtain $c\geq1$ (since $c$ is an integer), thus
$a\underbrace{c}_{\geq1}\geq a$ (since $a\geq0$). Hence, $k=ac\geq a$, so that
$k-a\in\mathbb{N}$. Moreover, $a\mid k-a$ (since $\underbrace{k}%
_{=ac}-a=ac-a=a\left(  c-1\right)  $ is obviously a multiple of $a$). Finally,
$k-a<k$ (since $a\geq1>0$).}.

Our induction hypothesis says that (\ref{sol.ent.mod.fn-div.goal}) holds for
all $b<k$. In other words, for each $b\in\mathbb{N}$ satisfying $b<k$, the
statement (\ref{sol.ent.mod.fn-div.goal}) holds. We can apply this to $b=k-a$
(since $k-a\in\mathbb{N}$ and $k-a<k$), and thus conclude that the statement
(\ref{sol.ent.mod.fn-div.goal}) holds for $b=k-a$. In other words, if $a\mid
k-a$, then $f_{a}\mid f_{k-a}$. Thus, $f_{a}\mid f_{k-a}$ (since we know that
$a\mid k-a$). In other words, $f_{k-a}\equiv0\operatorname{mod}f_{a}$. Note
also that $f_{a}\equiv0\operatorname{mod}f_{a}$ (since every integer $n$
satisfies $n\equiv0\operatorname{mod}n$).

But $a-1\in\mathbb{N}$ (since $a\geq1$). Hence, Exercise
\ref{exe.fibonacci.addition} (applied to $n=a-1$ and $m=k-a$) yields%
\[
f_{\left(  a-1\right)  +\left(  k-a\right)  +1}=f_{a-1}f_{k-a}+f_{\left(
a-1\right)  +1}f_{\left(  k-a\right)  +1}.
\]
In view of $\left(  a-1\right)  +\left(  k-a\right)  +1=k$ and $\left(
a-1\right)  +1=a$, this rewrites as%
\[
f_{k}=f_{a-1}f_{k-a}+f_{a}f_{\left(  k-a\right)  +1}.
\]


Hence,%
\begin{align}
f_{k}  &  =f_{a-1}\underbrace{f_{k-a}}_{\equiv0\operatorname{mod}f_{a}}%
+f_{a}f_{\left(  k-a\right)  +1}\nonumber\\
&  \equiv f_{a-1}\cdot0+\underbrace{f_{a}}_{\equiv0\operatorname{mod}f_{a}%
}f_{\left(  k-a\right)  +1}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have used the substitution principle}\\
\text{(from Example \ref{exa.ent.mod.subst.1}) to replace }f_{k-a}\text{ by }0
\end{array}
\right) \nonumber\\
&  \equiv f_{a-1}\cdot0+0\cdot f_{\left(  k-a\right)  +1}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have used the substitution principle}\\
\text{(from Example \ref{exa.ent.mod.subst.1}) to replace }f_{a}\text{ by }0
\end{array}
\right) \nonumber\\
&  =0\operatorname{mod}f_{a}, \label{sol.ent.mod.fn-div.s1}%
\end{align}
and thus $f_{a}\mid f_{k}$. This is precisely what we wanted to show. Thus, we
have proved that (\ref{sol.ent.mod.fn-div.goal}) holds for $b=k$. This
completes the induction step. Thus, Exercise \ref{exe.ent.mod.fn-div} is solved.

Two remarks are in order:

\begin{itemize}
\item We could have avoided using the substitution principle in the
computation that led to (\ref{sol.ent.mod.fn-div.s1}). In order to do so, we
should have argued as follows: Multiplying the congruence $f_{a-1}\equiv
f_{a-1}\operatorname{mod}f_{a}$ (which is obvious) with the congruence
$f_{k-a}\equiv0\operatorname{mod}f_{a}$, we get $f_{a-1}f_{k-a}\equiv
f_{a-1}\cdot0\operatorname{mod}f_{a}$. Adding the obvious congruence
$f_{a}f_{\left(  k-a\right)  +1}\equiv f_{a}f_{\left(  k-a\right)
+1}\operatorname{mod}f_{a}$ to this congruence, we obtain $f_{a-1}%
f_{k-a}+f_{a}f_{\left(  k-a\right)  +1}\equiv f_{a-1}\cdot0+f_{a}f_{\left(
k-a\right)  +1}\operatorname{mod}f_{a}$. This justifies the first
\textquotedblleft$\equiv$\textquotedblright\ sign in
(\ref{sol.ent.mod.fn-div.s1}). A similar argument justifies the second
\textquotedblleft$\equiv$\textquotedblright\ sign.

In the future, we will, however, be even terser and not only use the
substitution principle, but also do both substitutions at once:%
\[
f_{a-1}\underbrace{f_{k-a}}_{\equiv0\operatorname{mod}f_{a}}+\underbrace{f_{a}%
}_{\equiv0\operatorname{mod}f_{a}}f_{\left(  k-a\right)  +1}\equiv
f_{a-1}\cdot0+0\cdot f_{\left(  k-a\right)  +1}\operatorname{mod}f_{a}.
\]


\item Instead of using a strong induction on $b$, we could have used a
(standard) induction on $b/a$, after first ruling out the case $a=0$. This is
essentially how Exercise \ref{exe.ent.mod.fn-div} (actually a slight
generalization thereof) is solved in \cite[proof of Theorem 2.26 \textbf{(b)}%
]{detnotes}.
\end{itemize}
\end{proof}

\subsection{Congruences vs. remainders}

Let us now come back to division with remainder. As we mentioned above, the
entries of the pair $\left(  q,r\right)  $ in Theorem
\ref{thm.ent.quorem.full} have names; let us also give them
notations\footnote{Warning: The notations $u//n$ and $u\%n$ are not standard
across the literature; I have taken them from the Python programming language.
Various authors write $u\operatorname{mod}n$ for what I call $u\%n$, but the
notation $u\operatorname{mod}n$ typically means a different things (which we
will meet in a later chapter), so I prefer not to overload it thus.}:

\begin{definition}
\label{def.ent.quorem}Let $n$ be a positive integer. Let $u\in\mathbb{Z}$.
Theorem \ref{thm.ent.quorem.full} shows that there exists a unique pair
$\left(  q,r\right)  \in\mathbb{Z}\times\left\{  0,1,\ldots,n-1\right\}  $
such that $u=qn+r$. Consider this pair.

\textbf{(a)} We denote the integer $q$ by $u//n$, and refer to it as the
\textit{quotient of the division of }$u$ \textit{by }$n$ (or as the
\textit{quotient obtained when }$u$ \textit{is divided by }$n$).

\textbf{(b)} We denote the integer $r$ by $u\%n$, and refer to it as the
\textit{remainder of the division of }$u$ \textit{by }$n$ (or as the
\textit{remainder obtained when }$u$ \textit{is divided by }$n$).
\end{definition}

Here are some basic properties of these integers:

\begin{proposition}
\label{prop.ent.quorem.props}Let $n$ be a positive integer. Let $u\in
\mathbb{Z}$.

\textbf{(a)} Then, $u\%n\in\left\{  0,1,\ldots,n-1\right\}  $ and $u\%n\equiv
u\operatorname{mod}n$.

\textbf{(b)} We have $n\mid u$ if and only if $u\%n=0$.

\textbf{(c)} If $c\in\left\{  0,1,\ldots,n-1\right\}  $ is such that $c\equiv
u\operatorname{mod}n$, then $c=u\%n$.

\textbf{(d)} We have $u=\left(  u//n\right)  n+\left(  u\%n\right)  $.
\end{proposition}

\begin{proposition}
Let $n$ be a positive integer. Let $u,v\in\mathbb{Z}$.

\textbf{(a)} We have $u\%n+v\%n-\left(  u+v\right)  \%n\in\left\{
0,n\right\}  $.

\textbf{(b)} We have $\left(  u+v\right)  //n-u//n-v//n\in\left\{
0,1\right\}  $.
\end{proposition}

\begin{proposition}
\label{prop.ent.quo-rem.mod=rem}Let $n$ be a positive integer. Let $u$ and $v$
be integers. Then, $u\equiv v\operatorname{mod}n$ if and only if $u\%n=v\%n$.
\end{proposition}

\begin{proposition}
\label{prop.ent.quo-rem.quo=floor}Let $n$ be a positive integer. Let
$u\in\mathbb{Z}$. Then, $u//n=\left\lfloor \dfrac{u}{n}\right\rfloor $. (See
Section \ref{sect.intro.hw0} for the definition of the floor $\left\lfloor
\dfrac{u}{n}\right\rfloor $ of $\dfrac{u}{n}$.)
\end{proposition}

(The first three of these four propositions are proved in \cite[\S 2.6]{19s};
all four are easy to prove.)

Note that Proposition \ref{prop.ent.quo-rem.mod=rem} can be viewed as another
definition of congruence modulo $n$ (at least when $n$ is a positive integer).

Recall that an integer is said to be \textit{even} if it is divisible by $2$,
and \textit{odd} if it is not. The following exercise illustrates how
remainders interact with congruence:

\begin{exercise}
\label{exe.ent.odd-plus-odd}Prove that the sum of any two odd integers is even.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.odd-plus-odd}.]Let $a$ and $b$ be two odd
integers. We must prove that $a+b$ is even.

The integer $a$ is odd, i.e., not divisible by $2$ (by the definition of
\textquotedblleft odd\textquotedblright). In other words, we don't have $2\mid
a$.

Proposition \ref{prop.ent.quorem.props} \textbf{(b)} (applied to $n=2$ and
$u=a$) yields that we have $2\mid a$ if and only if $a\%2=0$. Thus, we don't
have $a\%2=0$ (since we don't have $2\mid a$). But Proposition
\ref{prop.ent.quorem.props} \textbf{(a)} (applied to $n=2$ and $u=a$) yields
that $a\%2\in\left\{  0,1\right\}  $ and $a\%2\equiv a\operatorname{mod}2$.
From $a\%2\in\left\{  0,1\right\}  $, we obtain $a\%2=1$ (since we don't have
$a\%2=0$). But from $a\%2\equiv a\operatorname{mod}2$, we obtain $a\equiv
a\%2\operatorname{mod}2$ (by Proposition \ref{prop.ent.mod.basics}
\textbf{(c)}). This rewrites as $a\equiv1\operatorname{mod}2$ (since
$a\%2=1$). Similarly, $b\equiv1\operatorname{mod}2$. Adding these two
congruences\footnote{i.e., applying (\ref{eq.prop.ent.mod.basics.d.1})}, we
obtain $a+b\equiv1+1\operatorname{mod}2$. But $1+1=2\equiv0\operatorname{mod}%
2$ (since $2\mid2-0$). Hence, $a+b\equiv1+1\equiv0\operatorname{mod}2$. In
other words, $2\mid\left(  a+b\right)  -0=a+b$. In other words, $a+b$ is
divisible by $2$. In other words, $a+b$ is even. This solves Exercise
\ref{exe.ent.odd-plus-odd}.
\end{proof}

The following simple exercises (see \cite[\S 2.7]{19s} for solutions) collect
various basic properties of even and odd integers:

\begin{exercise}
\label{exe.ent.even-odd.1}Let $u$ be an integer.

\textbf{(a)} Prove that $u$ is even if and only if $u\%2=0$.

\textbf{(b)} Prove that $u$ is odd if and only if $u\%2=1$.

\textbf{(c)} Prove that $u$ is even if and only if $u\equiv0\operatorname{mod}%
2$.

\textbf{(d)} Prove that $u$ is odd if and only if $u\equiv1\operatorname{mod}%
2$.

\textbf{(e)} Prove that $u$ is odd if and only if $u+1$ is even.

\textbf{(f)} Prove that exactly one of the two numbers $u$ and $u+1$ is even.

\textbf{(g)} Prove that $u\left(  u+1\right)  \equiv0\operatorname{mod}2$.

\textbf{(h)} Prove that $u^{2}\equiv-u\equiv u\operatorname{mod}2$.

\textbf{(i)} Let $v$ be a further integer. Prove that $u\equiv
v\operatorname{mod}2$ holds if and only if $u$ and $v$ are either both odd or
both even.
\end{exercise}

\begin{exercise}
\label{exe.ent.even-odd-sumsq}\textbf{(a)} Prove that each even integer $u$
satisfies $u^{2}\equiv0\operatorname{mod}4$.

\textbf{(b)} Prove that each odd integer $u$ satisfies $u^{2}\equiv
1\operatorname{mod}4$.

\textbf{(c)} Prove that no two integers $x$ and $y$ satisfy $x^{2}+y^{2}%
\equiv3\operatorname{mod}4$.

\textbf{(d)} Prove that if $x$ and $y$ are two integers satisfying
$x^{2}+y^{2}\equiv2\operatorname{mod}4$, then $x$ and $y$ are both odd.
\end{exercise}

As an application of these simple facts, let us prove something a little bit
less trivial:

\begin{exercise}
\label{exe.ent.odd-squares-mod8}Let $n$ be an odd integer. Prove that $8\mid
n^{2}-1$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.odd-squares-mod8}.]Exercise
\ref{exe.ent.even-odd.1} \textbf{(d)} (applied to $u=n$) shows that $n$ is odd
if and only if $n\equiv1\operatorname{mod}2$. Hence, $n\equiv
1\operatorname{mod}2$ (since $n$ is odd). In other words, $2\mid n-1$. In
other words, there exists an integer $c$ such that $n-1=2c$. Consider this
$c$. From $n-1=2c$, we obtain $n=2c+1$, hence $n^{2}=\left(  2c+1\right)
^{2}=4c^{2}+4c+1$ and therefore $n^{2}-1=4c^{2}+4c=4c\left(  c+1\right)  $.
But Exercise \ref{exe.ent.even-odd.1} \textbf{(g)} (applied to $u=c$) yields
$c\left(  c+1\right)  \equiv0\operatorname{mod}2$; in other words, $2\mid
c\left(  c+1\right)  $. Hence, there exists an integer $d$ such that $c\left(
c+1\right)  =2d$. Consider this $d$. Now,%
\[
n^{2}-1=4\underbrace{c\left(  c+1\right)  }_{=2d}=4\cdot2d=8d.
\]
Thus, $8\mid n^{2}-1$ (since $d$ is an integer). This solves Exercise
\ref{exe.ent.odd-squares-mod8}.
\end{proof}

Here is another, very similar exercise to illustrate how remainders can be
used to prove congruences almost mechanically:

\begin{exercise}
\label{exe.ent.squares-mod-3}Let $n$ be an integer such that $3\nmid n$. Prove
that $3\mid n^{2}-1$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.squares-mod-3}.]Proposition
\ref{prop.ent.quorem.props} \textbf{(a)} (applied to $3$ and $n$ instead of
$n$ and $u$) yields that $n\%3\in\left\{  0,1,2\right\}  $ and $n\%3\equiv
n\operatorname{mod}3$. Symmetry of congruence yields $n\equiv
n\%3\operatorname{mod}3$ (since $n\%3\equiv n\operatorname{mod}3$).

Proposition \ref{prop.ent.quorem.props} \textbf{(b)} (applied to $3$ and $n$
instead of $n$ and $u$) yields that we have $3\mid n$ if and only if $n\%3=0$.
Since we don't have $3\mid n$ (because we assumed $3\nmid n$), we thus
conclude that we don't have $n\%3=0$.

Thus we know that $n\%3\in\left\{  0,1,2\right\}  $, but we don't have
$n\%3=0$. Hence, $n\%3\in\left\{  0,1,2\right\}  \setminus\left\{  0\right\}
=\left\{  1,2\right\}  $. Hence, we are in one of the following two cases:

\textit{Case 1:} We have $n\%3=1$.

\textit{Case 2:} We have $n\%3=2$.

Let us first consider Case 1. In this case, we have $n\%3=1$. Recall that
$n\equiv n\%3=1\operatorname{mod}3$. We can square both sides of this
congruence (by applying Proposition \ref{prop.ent.mod.k-power} to $3$, $n$,
$1$ and $2$ instead of $n$, $a$, $b$ and $k$), and thus obtain $n^{2}%
\equiv1^{2}=1\operatorname{mod}3$. In other words, $3\mid n^{2}-1$. Hence,
Exercise \ref{exe.ent.squares-mod-3} is solved in Case 1.

Let us now consider Case 2. In this case, we have $n\%3=2$. Recall that
$n\equiv n\%3=2\operatorname{mod}3$. We can square both sides of this
congruence (by applying Proposition \ref{prop.ent.mod.k-power} to $3$, $n$,
$2$ and $2$ instead of $n$, $a$, $b$ and $k$), and thus obtain $n^{2}%
\equiv2^{2}=4\equiv1\operatorname{mod}3$ (where the last \textquotedblleft%
$\equiv$\textquotedblright\ sign is a consequence of $3\mid4-1$). In other
words, $3\mid n^{2}-1$. Hence, Exercise \ref{exe.ent.squares-mod-3} is solved
in Case 2.

We have now solved Exercise \ref{exe.ent.squares-mod-3} in both possible
cases, so we are done.
\end{proof}

The solution to Exercise \ref{exe.ent.squares-mod-3} we just gave is an
example of the \textquotedblleft try all possible remainders\textquotedblright%
\ technique for proving divisibilities and congruences. It should be clear
that we could also have used it to get a more-or-less mechanical solution to
Exercise \ref{exe.ent.odd-squares-mod8}: Since $n\%8\in\left\{  0,1,\ldots
,7\right\}  $, we would just have to check that $8\mid n^{2}-1$ holds for all
possible values $0,1,\ldots,7$ of $n\%8$. (Out of these $8$ values, only
$1,3,5,7$ are possible, because $n$ is assumed to be odd in Exercise
\ref{exe.ent.odd-squares-mod8}.) In a similar fashion, we can prove that every
integer $n$ satisfies the divisibilities%
\begin{align*}
6  &  \mid n^{3}-n;\ \ \ \ \ \ \ \ \ \ 12\mid n^{4}-n^{2}%
;\ \ \ \ \ \ \ \ \ \ 10\mid n^{5}-n;\ \ \ \ \ \ \ \ \ \ 24\mid n^{5}-n^{3};\\
6  &  \mid n\left(  n+1\right)  \left(  n+2\right)
;\ \ \ \ \ \ \ \ \ \ 24\mid n\left(  n+1\right)  \left(  n+2\right)  \left(
n+3\right)
\end{align*}
and many others.

As another example for the use of congruence arguments, let us find out when
Fibonacci numbers are even and when they are odd. A look at the first values
suggests that every third Fibonacci number (starting with $f_{0}$) is even,
while the remaining ones are odd. Equipped with the notion of a congruence
(and parts \textbf{(c)} and \textbf{(d)} of Exercise \ref{exe.ent.even-odd.1}%
), we can restate this as follows:

\begin{exercise}
\label{exe.fib.parity}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Then,%
\begin{equation}
f_{n}\equiv%
\begin{cases}
0, & \text{if }3\mid n;\\
1, & \text{if }3\nmid n
\end{cases}
\ \ \operatorname{mod}2 \label{eq.exe.fib.parity.eq}%
\end{equation}
for every nonnegative integer $n$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.fib.parity} (sketched).]We shall prove
(\ref{eq.exe.fib.parity.eq}) by strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{eq.exe.fib.parity.eq}) holds for all $n<m$. We must
prove that (\ref{eq.exe.fib.parity.eq}) for $n=m$. In other words, we must
prove that%
\begin{equation}
f_{m}\equiv%
\begin{cases}
0, & \text{if }3\mid m;\\
1, & \text{if }3\nmid m
\end{cases}
\ \ \operatorname{mod}2. \label{sol.fib.parity.goal}%
\end{equation}


If $m<2$, then we can see this directly from $f_{0}=0$ and $f_{1}=1$. Thus, we
WLOG assume that $m\geq2$. Hence, $m-2$ and $m-1$ are nonnegative integers.
Since these two nonnegative integers $m-2$ and $m-1$ are $<m$, we can thus
apply (\ref{eq.exe.fib.parity.eq}) to $n=m-2$ and to $n=m-1$ (by our induction
hypothesis). We thus obtain%
\[
f_{m-1}\equiv%
\begin{cases}
0, & \text{if }3\mid m-1;\\
1, & \text{if }3\nmid m-1
\end{cases}
\ \ \operatorname{mod}2
\]
and%
\[
f_{m-2}\equiv%
\begin{cases}
0, & \text{if }3\mid m-2;\\
1, & \text{if }3\nmid m-2
\end{cases}
\ \ \operatorname{mod}2.
\]
Adding these two congruences, we obtain%
\[
f_{m-1}+f_{m-2}\equiv%
\begin{cases}
0, & \text{if }3\mid m-1;\\
1, & \text{if }3\nmid m-1
\end{cases}
\ \ +\
\begin{cases}
0, & \text{if }3\mid m-2;\\
1, & \text{if }3\nmid m-2
\end{cases}
\ \ \operatorname{mod}2.
\]
This rewrites as%
\begin{equation}
f_{m}\equiv%
\begin{cases}
0, & \text{if }3\mid m-1;\\
1, & \text{if }3\nmid m-1
\end{cases}
\ \ +\
\begin{cases}
0, & \text{if }3\mid m-2;\\
1, & \text{if }3\nmid m-2
\end{cases}
\ \ \operatorname{mod}2 \label{sol.fib.parity.goal2}%
\end{equation}
(since the recursive definition of the Fibonacci sequence yields
$f_{m}=f_{m-1}+f_{m-2}$). Our goal is now to deduce (\ref{sol.fib.parity.goal}%
) from this congruence. In order to do so, it suffices to show that%
\begin{align}
&
\begin{cases}
0, & \text{if }3\mid m-1;\\
1, & \text{if }3\nmid m-1
\end{cases}
\ \ +\
\begin{cases}
0, & \text{if }3\mid m-2;\\
1, & \text{if }3\nmid m-2
\end{cases}
\nonumber\\
&  \equiv%
\begin{cases}
0, & \text{if }3\mid m;\\
1, & \text{if }3\nmid m
\end{cases}
\ \ \operatorname{mod}2 \label{sol.fib.parity.goal3}%
\end{align}
(because then, combining (\ref{sol.fib.parity.goal2}) with
(\ref{sol.fib.parity.goal3}) will immediately yield (\ref{sol.fib.parity.goal}%
) by the transitivity of congruence).

The proof of (\ref{sol.fib.parity.goal3}) is a straightforward case
distinction. Indeed, Proposition \ref{prop.ent.quorem.props} \textbf{(a)}
(applied to $n=3$ and $u=m$) yields that $m\%3\in\left\{  0,1,2\right\}  $ and
$m\%3\equiv m\operatorname{mod}3$. Symmetry of congruence yields $m\equiv
m\%3\operatorname{mod}3$ (since $m\%3\equiv m\operatorname{mod}3$). Since
$m\%3\in\left\{  0,1,2\right\}  $, we are in one of the following three cases:

\textit{Case 1:} We have $m\%3=0$.

\textit{Case 2:} We have $m\%3=1$.

\textit{Case 3:} We have $m\%3=2$.

Let me work through Case 1 in detail, leaving the other two cases to the
reader (the arguments are closely similar). In Case 1, we have $m\%3=0$. Thus,
$m\equiv m\%3=0\operatorname{mod}3$. According to Proposition
\ref{prop.ent.mod.0} (applied to $n=3$ and $a=m$), we have $m\equiv
0\operatorname{mod}3$ if and only if $3\mid m$. Thus, $3\mid m$ (since
$m\equiv0\operatorname{mod}3$). Furthermore, subtracting the congruence
$1\equiv1\operatorname{mod}3$ from the congruence $m\equiv0\operatorname{mod}%
3$, we obtain $m-1\equiv0-1=-1\operatorname{mod}3$. Thus, we do not have
$m-1\equiv0\operatorname{mod}3$ (because if we had $m-1\equiv
0\operatorname{mod}3$, then we would have $0\equiv m-1\equiv
-1\operatorname{mod}3$, or, equivalently, $3\mid0-\left(  -1\right)  =1$,
which is absurd). According to Proposition \ref{prop.ent.mod.0} (applied to
$n=3$ and $a=m-1$), we have $m-1\equiv0\operatorname{mod}3$ if and only if
$3\mid m-1$. Hence, we do not have $3\mid m-1$ (since we do not have
$m-1\equiv0\operatorname{mod}3$). In other words, we have $3\nmid m-1$. A
similar computation yields $3\nmid m-2$ (since $3\mid2$ is as absurd as
$3\mid1$). Now, we know that $3\mid m$ and $3\nmid m-1$ and $3\nmid m-2$. In
light of these facts, the congruence (\ref{sol.fib.parity.goal3}) (which we
need to prove) rewrites as $1+1\equiv0\operatorname{mod}2$. In other words, it
is equivalent to $2\mid\left(  1+1\right)  -0$, which is obvious. Thus, we
have proved (\ref{sol.fib.parity.goal3}) in Case 1.

The proof of (\ref{sol.fib.parity.goal3}) in Case 2 is similar, except that
this time we have $m\equiv1\operatorname{mod}3$ (instead of $m\equiv
0\operatorname{mod}3$) and thus $3\mid m-1$ and $3\nmid m$ and $3\nmid m-2$.

The proof of (\ref{sol.fib.parity.goal3}) in Case 3 is similar, too.
\end{proof}

\subsection{Greatest common divisors}

\subsubsection{The definitions}

One of the main workhorses of number theory is the notion of a common divisor,
defined exactly as one would expect:

\begin{definition}
\label{def.ent.Div}Let $b_{1},b_{2},\ldots,b_{k}$ be integers. Then, the
\textit{common divisors} of $b_{1},b_{2},\ldots,b_{k}$ are defined to be the
integers $a$ that satisfy%
\begin{equation}
\left(  a\mid b_{i}\text{ for all }i\in\left\{  1,2,\ldots,k\right\}  \right)
\label{eq.def.ent.Div.cond}%
\end{equation}
(in other words, that divide all of the integers $b_{1},b_{2},\ldots,b_{k}$).
\end{definition}

For example, the common divisors of $6$ and $8$ are $-2,-1,1,2$. We refer to
\cite[\S 2.9]{19s} for a thorough treatment of common divisors; here we shall
only sketch the main steps (particularly to the extent they illustrate
induction). The notion of a \textit{greatest common divisor} is
crucial:\footnote{It is easy to see that any nonzero integer $b$ has only
finitely many divisors; indeed, each divisor of $b$ is an integer between
$-\left\vert b\right\vert $ and $\left\vert b\right\vert $. Hence, if
$b_{1},b_{2},\ldots,b_{k}$ are finitely many integers that are not all $0$,
then there are only finitely many common divisors of $b_{1},b_{2},\ldots
,b_{k}$. Moreover, there is at least one common divisor of $b_{1},b_{2}%
,\ldots,b_{k}$ (since $1$ is always such a divisor). Hence, the set of all
common divisors of $b_{1},b_{2},\ldots,b_{k}$ is nonempty and finite (when
$b_{1},b_{2},\ldots,b_{k}$ are not all zero); therefore, this set has a
largest element. This is used implicitly in Definition \ref{def.ent.gcd.gcd}.}

\begin{definition}
\label{def.ent.gcd.gcd}Let $b_{1},b_{2},\ldots,b_{k}$ be finitely many
integers. The \textit{greatest common divisor} (or, for short, the
\textit{gcd}) of $b_{1},b_{2},\ldots,b_{k}$ is the nonnegative integer
$\gcd\left(  b_{1},b_{2},\ldots,b_{k}\right)  $ defined as follows:

\begin{itemize}
\item If $b_{1},b_{2},\ldots,b_{k}$ are not all $0$, then it is defined as the
name suggests: It is the largest of all common divisors of $b_{1},b_{2}%
,\ldots,b_{k}$.

\item If $b_{1},b_{2},\ldots,b_{k}$ are all $0$, then it is defined to be $0$.
\end{itemize}
\end{definition}

(Note that the second case should make some eyes roll; if $b_{1},b_{2}%
,\ldots,b_{k}$ are all $0$, then \textbf{every} integer is a common divisor of
$b_{1},b_{2},\ldots,b_{k}$; it is thus strange to designate $0$ the greatest
common divisor. But this makes the more sense the more you learn about
greatest common divisors. For now, treat it as an annoying special case.)

For example, $\gcd\left(  4,6\right)  =2$ and $\gcd\left(  3,5\right)  =1$ and
$\gcd\left(  6,10,15\right)  =1$. Definition \ref{def.ent.gcd.gcd} easily
entails the following (see \cite[Definition 2.9.6]{19s} for the details):

\begin{proposition}
\label{prop.ent.gcd.pos}Let $b_{1},b_{2},\ldots,b_{k}$ be finitely many integers.

\textbf{(a)} The number $\gcd\left(  b_{1},b_{2},\ldots,b_{k}\right)  $ is a
nonnegative integer.

\textbf{(b)} If $b_{1},b_{2},\ldots,b_{k}$ are not all $0$, then $\gcd\left(
b_{1},b_{2},\ldots,b_{k}\right)  $ is a positive integer.
\end{proposition}

\subsubsection{Basic properties}

The following properties of greatest common divisors (\cite[Proposition
2.9.7]{19s}) are easy to check using the definition:

\begin{proposition}
\label{prop.ent.gcd.props1}\textbf{(a)} We have $\gcd\left(  a,0\right)
=\gcd\left(  a\right)  =\left\vert a\right\vert $ for all $a\in\mathbb{Z}$.

\textbf{(b)} We have $\gcd\left(  a,b\right)  =\gcd\left(  b,a\right)  $ for
all $a,b\in\mathbb{Z}$.

\textbf{(c)} We have $\gcd\left(  a,ua+b\right)  =\gcd\left(  a,b\right)  $
for all $a,b,u\in\mathbb{Z}$.

\textbf{(d)} If $a,b,c\in\mathbb{Z}$ satisfy $b\equiv c\operatorname{mod}a$,
then $\gcd\left(  a,b\right)  =\gcd\left(  a,c\right)  $.

\textbf{(e)} If $a,b\in\mathbb{Z}$ are such that $a$ is positive, then
$\gcd\left(  a,b\right)  =\gcd\left(  a,b\%a\right)  $.

\textbf{(f)} We have $\gcd\left(  a,b\right)  \mid a$ and $\gcd\left(
a,b\right)  \mid b$ for all $a,b\in\mathbb{Z}$.

\textbf{(g)} We have $\gcd\left(  -a,b\right)  =\gcd\left(  a,b\right)  $ for
all $a,b\in\mathbb{Z}$.

\textbf{(h)} We have $\gcd\left(  a,-b\right)  =\gcd\left(  a,b\right)  $ for
all $a,b\in\mathbb{Z}$.

\textbf{(i)} If $a,b\in\mathbb{Z}$ satisfy $a\mid b$, then $\gcd\left(
a,b\right)  =\left\vert a\right\vert $.

\textbf{(j)} The greatest common divisor of the empty list of integers is
$\gcd\left(  {}\right)  =0$.
\end{proposition}

Note that we are focusing on gcds of two or fewer numbers for now; we will
eventually come back to the general case.

\subsubsection{Bezout's theorem}

The most important fact about greatest common divisors is the following fact
(\cite[Theorem 2.9.12]{19s}), known as \textit{Bezout's theorem} (or
\textit{Bezout's identity}, despite being an existence statement rather than a
literal identity):

\begin{theorem}
[Bezout's theorem]\label{thm.ent.gcd.bezout}Let $a$ and $b$ be two integers.
Then, there exist integers $x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that%
\[
\gcd\left(  a,b\right)  =xa+yb.
\]

\end{theorem}

I shall prove this theorem here not just because it is crucial for the
development of number theory, but also because its proof is an instructive
example of strong induction on a derived quantity (namely, $a+b$). First, an example:

\begin{example}
Set $a=6$ and $b=10$. Then, $\gcd\left(  a,b\right)  =\gcd\left(  6,10\right)
=2$. Theorem \ref{thm.ent.gcd.bezout} says that there exist integers
$x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that $\gcd\left(  a,b\right)
=xa+yb$, that is, $2=x\cdot6+y\cdot10$. And indeed, it is not hard to find
such $x$ and $y$: For example, we can take $x=2$ and $y=-1$. (Alternatively,
we can take $x=7$ and $y=-4$. There are infinitely many valid choices.)
\end{example}

\begin{proof}
[Proof of Theorem \ref{thm.ent.gcd.bezout} (sketched).]Forget that we fixed
$a$ and $b$.

If $a$ and $b$ are two integers, then $\mathbb{Z}a+\mathbb{Z}b$ shall denote
the set
\[
\left\{  xa+yb\ \mid\ x\in\mathbb{Z}\text{ and }y\in\mathbb{Z}\right\}  .
\]
This is a subset of $\mathbb{Z}$. Thus, Theorem \ref{thm.ent.gcd.bezout} is
saying that for any two integers $a$ and $b$, we have
\begin{equation}
\gcd\left(  a,b\right)  \in\mathbb{Z}a+\mathbb{Z}b.
\label{pf.thm.ent.gcd.bezout.goalZZ}%
\end{equation}


We aim to prove this by strong induction on $a+b$, but first we need to ensure
that $a+b$ belongs to $\mathbb{N}$ (or at least to $\mathbb{Z}_{\geq g}$ for
some $g\in\mathbb{Z}$); this does not come for free, since $a+b$ can be
arbitrarily small when $a$ and $b$ range over $\mathbb{Z}$. We will ensure
$a+b\in\mathbb{N}$ by restricting ourselves to the case $a,b\in\mathbb{N}$ and
then deducing the general case from this case.

So, at first, let us prove (\ref{pf.thm.ent.gcd.bezout.goalZZ}) for
$a,b\in\mathbb{N}$ only. We shall prove this by strong induction on $a+b$;
that is, we shall prove the following claim:

\begin{statement}
\textit{Claim 1:} Let $n\in\mathbb{N}$. Then, any $a,b\in\mathbb{N}$
satisfying $a+b=n$ satisfy $\gcd\left(  a,b\right)  \in\mathbb{Z}%
a+\mathbb{Z}b$.
\end{statement}

[\textit{Proof of Claim 1:} Apply strong induction on $n$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 1 is true for all $n<k$. We must prove that Claim 1
holds for $n=k$.

So let $a,b\in\mathbb{N}$ be such that $a+b=k$. We shall show that
$\gcd\left(  a,b\right)  \in\mathbb{Z}a+\mathbb{Z}b$.

Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} yields $\gcd\left(
a,b\right)  =\gcd\left(  b,a\right)  $. Proposition \ref{prop.ent.gcd.props1}
\textbf{(a)} yields $\gcd\left(  a,0\right)  =\gcd\left(  a\right)
=\left\vert a\right\vert =a$ (since $a\in\mathbb{N}$). The same argument
(applied to $b$ instead of $a$) yields $\gcd\left(  b,0\right)  =b$.

Note that $a$ and $b$ play symmetric roles in Claim 1 (since $\gcd\left(
a,b\right)  =\gcd\left(  b,a\right)  $ and $\mathbb{Z}a+\mathbb{Z}%
b=\mathbb{Z}b+\mathbb{Z}a$), and thus can be swapped at will. By swapping $a$
and $b$ if necessary, we can ensure that $a\leq b$. Hence, we WLOG assume that
$a\leq b$. Thus, $b-a\in\mathbb{N}$.

If $a=0$, then
\begin{align*}
\gcd\left(  a,b\right)   &  =\gcd\left(  b,a\right)  =\gcd\left(  b,0\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }a=0\right) \\
&  =b=0a+1b\in\mathbb{Z}a+\mathbb{Z}b.
\end{align*}
Thus, we are done if $a=0$. Hence, we WLOG assume that $a\neq0$. Therefore,
$a>0$ (since $a\in\mathbb{N}$). Thus, $a+b>b$, so that $b<a+b=k$.

But our induction hypothesis says that Claim 1 is true for all $n<k$. Hence,
we can apply Claim 1 to $b-a$ and $b$ instead of $b$ and $n$ (since
$b-a\in\mathbb{N}$ and $a+\left(  b-a\right)  =b$ and $b<k$). We thus obtain
$\gcd\left(  a,b-a\right)  \in\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)  $.
However,
\begin{align*}
\gcd\left(  a,b-a\right)   &  =\gcd\left(  a,\left(  -1\right)  a+b\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b-a=\left(  -1\right)  a+b\right) \\
&  =\gcd\left(  a,b\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition
\ref{prop.ent.gcd.props1} \textbf{(c)}, applied to }u=-1\right)  ,
\end{align*}
so that $\gcd\left(  a,b\right)  =\gcd\left(  a,b-a\right)  \in\mathbb{Z}%
a+\mathbb{Z}\left(  b-a\right)  $.

But it is easy to see that $\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)
\subseteq\mathbb{Z}a+\mathbb{Z}b$\ \ \ \ \footnote{\textit{Proof.} Let
$z\in\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)  $. Then, there exist
$x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that $z=xa+y\left(  b-a\right)  $
(by the definition of $\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)  $). Consider
these $x$ and $y$. Then,%
\[
z=xa+y\left(  b-a\right)  =xa+yb-ya=\left(  x-y\right)  a+yb.
\]
Hence, there exist $x^{\prime}\in\mathbb{Z}$ and $y^{\prime}\in\mathbb{Z}$
such that $z=x^{\prime}a+y^{\prime}b$ (namely, $x^{\prime}=x-y$ and
$y^{\prime}=y$). In other words, $z\in\mathbb{Z}a+\mathbb{Z}b$.
\par
Forget that we fixed $z$. We thus have shown that $z\in\mathbb{Z}%
a+\mathbb{Z}b$ for each $z\in\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)  $. In
other words, $\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)  \subseteq
\mathbb{Z}a+\mathbb{Z}b$.}. (Actually, it is easy to see that $\mathbb{Z}%
a+\mathbb{Z}\left(  b-a\right)  =\mathbb{Z}a+\mathbb{Z}b$, but we will not
need this.)

Hence, $\gcd\left(  a,b\right)  \in\mathbb{Z}a+\mathbb{Z}\left(  b-a\right)
\subseteq\mathbb{Z}a+\mathbb{Z}b$.

Now, forget that we fixed $a,b$. We thus have shown that any $a,b\in
\mathbb{N}$ satisfying $a+b=k$ satisfy $\gcd\left(  a,b\right)  \in
\mathbb{Z}a+\mathbb{Z}b$. In other words, Claim 1 holds for $n=k$. This
completes the induction step. Thus, Claim 1 is proved.]

We still need to prove (\ref{pf.thm.ent.gcd.bezout.goalZZ}) for arbitrary
integers $a$ and $b$. Claim 1 handles the case when $a,b\in\mathbb{N}$ (that
is, when $a,b$ are nonnegative). The general case can be reduced to this case
as follows:

\begin{itemize}
\item If $a$ is negative, then we replace $a$ by the positive integer
$-a\in\mathbb{N}$. This does not change our claim because $\gcd\left(
-a,b\right)  =\gcd\left(  a,b\right)  $ and $\mathbb{Z}\left(  -a\right)
+\mathbb{Z}b=\mathbb{Z}a+\mathbb{Z}b$ (check this!).

\item If $b$ is negative, then we replace $b$ by the positive integer
$-b\in\mathbb{N}$. This does not change our claim because $\gcd\left(
a,-b\right)  =\gcd\left(  a,b\right)  $ and $\mathbb{Z}a+\mathbb{Z}\left(
-b\right)  =\mathbb{Z}a+\mathbb{Z}b$ (check this!).
\end{itemize}

Thus, in proving (\ref{pf.thm.ent.gcd.bezout.goalZZ}) for arbitrary integers
$a$ and $b$, we can WLOG assume that $a$ and $b$ belong to $\mathbb{N}$. But
if they do, then Claim 1 (applied to $n=a+b$) yields that $\gcd\left(
a,b\right)  \in\mathbb{Z}a+\mathbb{Z}b$, and we are done. Theorem
\ref{thm.ent.gcd.bezout} is proved.
\end{proof}

Our above proof of Theorem \ref{thm.ent.gcd.bezout} essentially encodes (the
most basic form of) the
\textit{\href{https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm}{\textit{extended
Euclidean algorithm}}}, which computes $\gcd\left(  a,b\right)  $ (for
$a,b\in\mathbb{N}$) and represents $\gcd\left(  a,b\right)  $ in the form
$xa+yb$ (with $x,y\in\mathbb{Z}$) by repeatedly subtracting one of the numbers
$a$ and $b$ from the other until one of the numbers becomes $0$. While we have
not explicitly shown any algorithm in our proof, it can be recovered by
unraveling our (strong) induction; generally, inductive proofs encode
recursive algorithms. We shall not usually dwell on the algorithmic content of
our proofs.

\begin{noncompile}
Here are some leftovers from an old attempt at writing up the above proof,
which ended up going too far afield:

To be more precise, we will prove a somewhat stronger result in the case when
$a$ and $b$ are nonnegative. First, let us introduce some convenient notations
(inspired by linear algebra\footnote{Specifically, Definition \ref{def.ent.mS}
\textbf{(b)} is a calque of the definition of the sum of two subspaces of a
vector space.}):

\begin{definition}
\label{def.ent.mS}\textbf{(a)} If $S$ is a subset of $\mathbb{Z}$, and if $m$
is an integer, then $mS$ shall denote the subset
\[
\left\{  ms\ \mid\ s\in S\right\}  \text{ of }\mathbb{Z}.
\]


\textbf{(b)} If $S$ and $T$ are two subsets of $\mathbb{Z}$, then $S+T$ shall
denote the subset%
\[
\left\{  s+t\ \mid\ s\in S\text{ and }t\in T\right\}  \text{ of }\mathbb{Z}.
\]


\textbf{(c)} If $S$ and $T$ are two subsets of $\mathbb{Z}$, then $S-T$ shall
denote the subset%
\[
\left\{  s-t\ \mid\ s\in S\text{ and }t\in T\right\}  \text{ of }\mathbb{Z}.
\]


\textbf{(d)} If $S$ and $T$ are two subsets of $\mathbb{Z}$, and if $m$ and
$n$ are two integers, then the expressions $mS+nT$ and $mS-nT$ shall be
interpreted as $\left(  mS\right)  +\left(  nT\right)  $ and $\left(
mS\right)  -\left(  nT\right)  $, respectively. In other words, we shall
follow the \textquotedblleft PEMDAS\textquotedblright\ convention for operator
precedence, where $mS$ is treated as a product and $S+T$ and $S-T$ are treated
as addition and subtraction.
\end{definition}

\begin{example}
\label{exa.ent.mS}\textbf{(a)} Since $\mathbb{Z}$ itself is a subset of
$\mathbb{Z}$, we can apply Definition \ref{def.ent.mS} to $S=\mathbb{Z}$. For
example, $2\mathbb{Z}=\left\{  2s\ \mid\ s\in\mathbb{Z}\right\}  $ is the set
of all even integers. Likewise, $2\mathbb{N}=\left\{  2s\ \mid\ s\in
\mathbb{N}\right\}  $ is the set of all even nonnegative integers, whereas
$3\mathbb{Z}=\left\{  3s\ \mid\ s\in\mathbb{Z}\right\}  $ is the set of all
integers divisible by $3$. Finally, $0\mathbb{Z}=\left\{  0s\ \mid
\ s\in\mathbb{Z}\right\}  =\left\{  0\right\}  $, and more generally, we have
$0S=\left\{  0\right\}  $ for every nonempty subset $S$ of $\mathbb{Z}$.

\textbf{(b)} The set $2\mathbb{Z}+3\mathbb{Z}=\left\{  s+t\ \mid
\ s\in2\mathbb{Z}\text{ and }t\in3\mathbb{Z}\right\}  $ is the set of all
integers that can be written in the form $s+t$ for some $s\in2\mathbb{Z}$ and
some $t\in3\mathbb{Z}$. In other words, it is the set of all integers that can
be written as a sum of an even integer with an integer divisible by $3$. A
moment's thought reveals that these are \textbf{all} the integers: Indeed,
every integer $p$ satisfies%
\[
p=\underbrace{2\left(  -p\right)  }_{\in2\mathbb{Z}}+\underbrace{3p}%
_{\in3\mathbb{Z}}\in2\mathbb{Z}+3\mathbb{Z}.
\]
Thus, $2\mathbb{Z}+3\mathbb{Z}=\mathbb{Z}$.

\textbf{(c)} The set $2\mathbb{N}-3\mathbb{N}=\left\{  s-t\ \mid
\ s\in2\mathbb{N}\text{ and }t\in3\mathbb{N}\right\}  $ is the set of all
integers that can be written as $s-t$ for some $s\in2\mathbb{N}$ and some
$t\in3\mathbb{N}$. This, too, turns out to be the whole $\mathbb{Z}$; this
time, a slightly subtler is argument is necessary:

\begin{itemize}
\item If $p$ is a nonnegative integer, then $p=\underbrace{2\cdot2p}%
_{\in2\mathbb{N}}-\underbrace{3p}_{\in3\mathbb{N}}\in2\mathbb{N}-3\mathbb{N}$.

\item If $p$ is a negative integer, then $p=\underbrace{2\cdot\left(
-p\right)  }_{\in2\mathbb{N}}-\underbrace{3\cdot\left(  -p\right)  }%
_{\in3\mathbb{N}}\in2\mathbb{N}-3\mathbb{N}$.
\end{itemize}

\textbf{(d)} The set $2\mathbb{N}+3\mathbb{N}=\left\{  s+t\ \mid
\ s\in2\mathbb{N}\text{ and }t\in3\mathbb{N}\right\}  $ is the set of all
integers that can be written as $s+t$ for some $s\in2\mathbb{N}$ and some
$t\in3\mathbb{N}$. It is not hard to check (do it!) that this set is
$\mathbb{N}\setminus\left\{  1\right\}  =\left\{  0,2,3,4,\ldots\right\}  $.
\end{example}

The following is an easy exercise:

\begin{exercise}
\label{exe.ent.mS.1}\textbf{(a)} Prove that $m\left(  S+T\right)  =mS+mT$ for
any subsets $S$ and $T$ of $\mathbb{Z}$ and any $m\in\mathbb{Z}$.

\textbf{(b)} Prove that $S+T=T+S$ for any subsets $S$ and $T$ of $\mathbb{Z}$.

\textbf{(c)} Prove that $\left(  S+T\right)  +U=S+\left(  T+U\right)  $ for
any subsets $S$, $T$ and $U$ of $\mathbb{Z}$.

\textbf{(d)} Prove that $\left(  S-T\right)  +U=\left(  S+U\right)
-T=S+\left(  U-T\right)  $ for any subsets $S$, $T$ and $U$ of $\mathbb{Z}$.
(This allows us to write $S+U-T$ without parentheses.)
\end{exercise}

A \textbf{warning} is in order: For subsets $S$ and $T$ of $\mathbb{Z}$, it is
usually not true that $S+T-T=S$. Thus, \textquotedblleft
addition\textquotedblright\ and \textquotedblleft
subtraction\textquotedblright\ of subsets do not undo one another. However, it
is easy to check that $S\subseteq S+T-T$ for any $S,T\subseteq\mathbb{Z}$.

With all this said, we can now restate Theorem \ref{thm.ent.gcd.bezout} as follows:

\begin{theorem}
\label{thm.ent.gcd.bezout-form}Let $a$ and $b$ be two integers. Then,
\[
\gcd\left(  a,b\right)  \in a\mathbb{Z}+b\mathbb{Z}.
\]

\end{theorem}

Indeed, Theorem \ref{thm.ent.gcd.bezout} easily follows from Theorem
\ref{thm.ent.gcd.bezout-form} as follows: If Theorem
\ref{thm.ent.gcd.bezout-form} is known to hold, then we obtain
\begin{align*}
\gcd\left(  a,b\right)   &  =\gcd\left(  a,b\right)  \cdot1\in\gcd\left(
a,b\right)  \mathbb{Z}\\
&  =a\mathbb{Z}+b\mathbb{Z}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem
\ref{thm.ent.gcd.bezout-form}}\right) \\
&  =\left\{  s+t\ \mid\ s\in a\mathbb{Z}\text{ and }t\in b\mathbb{Z}\right\}
\\
&  =\left\{  ax+by\ \mid\ x\in\mathbb{Z}\text{ and }y\in\mathbb{Z}\right\}
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }a\mathbb{Z}\text{ and
}b\mathbb{Z}\right) \\
&  =\left\{  xa+yb\ \mid\ x\in\mathbb{Z}\text{ and }y\in\mathbb{Z}\right\}  ,
\end{align*}
so that there exist some $x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that
$\gcd\left(  a,b\right)  =xa+yb$ (which is what Theorem
\ref{thm.ent.gcd.bezout} claims). Thus, in order to prove Theorem
\ref{thm.ent.gcd.bezout}, it suffices to prove Theorem
\ref{thm.ent.gcd.bezout-form}. (The converse implication is also easily
verified, so Theorem \ref{thm.ent.gcd.bezout-form} is not significantly
stronger than Theorem \ref{thm.ent.gcd.bezout}.)
\end{noncompile}

\subsubsection{The universal property}

Theorem \ref{thm.ent.gcd.bezout} is the workhorse of classical Euclidean
number theory (i.e., the number theory done in Euclid's \textit{Elements}); it
quickly proves many important results. For example, watch how the following
fact (\cite[Theorem 2.9.15 \textbf{(a)}]{19s}) -- sometimes known as the
\textit{universal property of the greatest common divisor} -- easily follows
from it:

\begin{theorem}
\label{thm.ent.gcd.uniprop}Let $a,b\in\mathbb{Z}$ and $m\in\mathbb{Z}$. Then,
we have the following logical equivalence:%
\begin{equation}
\left(  m\mid a\ \text{and }m\mid b\right)  \ \Longleftrightarrow\ \left(
m\mid\gcd\left(  a,b\right)  \right)  . \label{eq.thm.ent.gcd.uniprop.equiv}%
\end{equation}

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.gcd.uniprop}.]In order to prove
(\ref{eq.thm.ent.gcd.uniprop.equiv}), we need to prove the \textquotedblleft%
$\Longrightarrow$\textquotedblright\ and \textquotedblleft$\Longleftarrow
$\textquotedblright\ directions of the equivalence
(\ref{eq.thm.ent.gcd.uniprop.equiv}).

\textit{Proof of the \textquotedblleft}$\Longrightarrow$%
\textit{\textquotedblright\ direction:}\footnote{Commonly, mathematicians just
write \textquotedblleft$\Longrightarrow:$\textquotedblright\ instead of
\textquotedblleft\textit{Proof of the \textquotedblleft}$\Longrightarrow
$\textit{\textquotedblright\ direction:}\textquotedblright.} We must show that
the statement $\left(  m\mid a\ \text{and }m\mid b\right)  $ implies the
statement $\left(  m\mid\gcd\left(  a,b\right)  \right)  $. So let us assume
that $m\mid a\ $and $m\mid b$. Theorem \ref{thm.ent.gcd.bezout} shows that
there exist integers $x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that%
\begin{equation}
\gcd\left(  a,b\right)  =xa+yb. \label{pf.lem.ent.gcd.uniprop.1}%
\end{equation}
Consider these $x$ and $y$. Now, (using the transitivity of divisibility) we
have $m\mid a\mid xa$, so that $xa\equiv0\operatorname{mod}m$. Also, $m\mid
b\mid yb$, thus $yb\equiv0\operatorname{mod}m$. Adding the congruences
$xa\equiv0\operatorname{mod}m$ and $yb\equiv0\operatorname{mod}m$ together, we
find $xa+yb\equiv0+0=0\operatorname{mod}m$; in other words, $m\mid xa+yb$. In
view of (\ref{pf.lem.ent.gcd.uniprop.1}), this rewrites as $m\mid\gcd\left(
a,b\right)  $. This proves the \textquotedblleft$\Longrightarrow
$\textquotedblright\ direction of the equivalence
(\ref{eq.thm.ent.gcd.uniprop.equiv}).

\textit{Proof of the \textquotedblleft}$\Longleftarrow$%
\textit{\textquotedblright\ direction:}\footnote{Commonly, mathematicians just
write \textquotedblleft$\Longleftarrow:$\textquotedblright\ instead of
\textquotedblleft\textit{Proof of the \textquotedblleft}$\Longleftarrow
$\textit{\textquotedblright\ direction:}\textquotedblright.} We must show that
the statement $\left(  m\mid\gcd\left(  a,b\right)  \right)  $ implies the
statement $\left(  m\mid a\ \text{and }m\mid b\right)  $. So let us assume
that $m\mid\gcd\left(  a,b\right)  $. Then,
\[
m\mid\gcd\left(  a,b\right)  \mid a\ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(f)}}\right)
\]
and%
\[
m\mid\gcd\left(  a,b\right)  \mid b\ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(f)}}\right)  .
\]
Thus, we have $m\mid a\ $and $m\mid b$. This proves the \textquotedblleft%
$\Longleftarrow$\textquotedblright\ direction of the equivalence
(\ref{eq.thm.ent.gcd.uniprop.equiv}).

Now, both directions of the equivalence (\ref{eq.thm.ent.gcd.uniprop.equiv})
are proved, so the equivalence holds. This proves Theorem
\ref{thm.ent.gcd.uniprop}.
\end{proof}

Theorem \ref{thm.ent.gcd.uniprop} can be restated as \textquotedblleft an
integer $m$ divides two integers $a$ and $b$ if and only if it divides their
gcd\textquotedblright. This gives a useful way to show that something divides
a gcd. A sample application of Theorem \ref{thm.ent.gcd.uniprop} (as well as a
useful fact in itself) is the following theorem (\cite[Theorem 2.9.20]{19s}):

\begin{theorem}
\label{thm.ent.gcd.sa,sb}Let $s,a,b\in\mathbb{Z}$. Then,
\[
\gcd\left(  sa,sb\right)  =\left\vert s\right\vert \gcd\left(  a,b\right)  .
\]

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.gcd.sa,sb} (sketched).]What follows is perhaps
not the simplest way to prove Theorem \ref{thm.ent.gcd.sa,sb}, but it serves
as a wonderful illustration of Theorem \ref{thm.ent.gcd.uniprop}, as it will
use the latter theorem three times.

If we want to prove that two nonnegative integers $x$ and $y$ are equal, it
suffices to show that they mutually divide each other (i.e., that they satisfy
$x\mid y$ and $y\mid x$). In fact, once this is shown, Proposition
\ref{prop.ent.div.1} \textbf{(c)} (applied to $x$ and $y$ instead of $a$ and
$b$) will yield $\left\vert x\right\vert =\left\vert y\right\vert $, and this
will rewrite as $x=y$ (since $x$ and $y$ are nonnegative). This might appear
like a roundabout approach to proving equalities, but it turns out to be
pretty useful when $x$ and $y$ are characterized through their divisibility
properties (and this is the case for gcds, among other things).

We shall apply this approach to $x:=\gcd\left(  sa,sb\right)  $ and
$y:=\left\vert s\right\vert \gcd\left(  a,b\right)  $. Our goal is to show
that $x=y$; thus, we shall achieve it by showing that $x\mid y$ and $y\mid x$.
(Indeed, Proposition \ref{prop.ent.gcd.pos} \textbf{(a)} shows that $x$ and
$y$ are nonnegative.)

If $s=0$, then both $x$ and $y$ are $0$ (since $\gcd\left(  0,0\right)  =0$),
and thus we are done. Hence, we WLOG assume that $s\neq0$. Therefore,
$\left\vert s\right\vert \neq0$. This will come handy as we will divide by
$\left\vert s\right\vert $ soon.

Let us first prove $y\mid x$. Indeed, Proposition \ref{prop.ent.gcd.props1}
\textbf{(f)} yields $\gcd\left(  a,b\right)  \mid a$. We can multiply both
sides of this divisibility by $s$ (by applying Proposition
\ref{prop.ent.div.acbc} to $\gcd\left(  a,b\right)  $, $a$ and $s$ instead of
$a$, $b$ and $c$), and thus obtain $\gcd\left(  a,b\right)  \cdot s\mid as$.
Note that the two integers $\gcd\left(  a,b\right)  \cdot s$ and $y$ are equal
up to sign, since%
\[
y=\underbrace{\left\vert s\right\vert }_{=\pm s}\gcd\left(  a,b\right)  =\pm
s\gcd\left(  a,b\right)  =\pm\gcd\left(  a,b\right)  \cdot s.
\]
Thus, they mutually divide each other; in particular, we have $y\mid
\gcd\left(  a,b\right)  \cdot s\mid as=sa$. Similarly, $y\mid sb$. Thus, the
integer $y$ divides both $sa$ and $sb$. Hence, Theorem
\ref{thm.ent.gcd.uniprop} (applied to $sa$, $sb$ and $y$ instead of $a$, $b$
and $m$) shows that it divides $\gcd\left(  sa,sb\right)  $. In other words,
$y\mid\gcd\left(  sa,sb\right)  $. In other words, $y\mid x$ (since
$x=\gcd\left(  sa,sb\right)  $).

Let us next prove $x\mid y$. The integer $\left\vert s\right\vert $ divides
both $sa$ and $sb$ (since $\left\vert s\right\vert \mid s\mid sa$ and
$\left\vert s\right\vert \mid s\mid sb$). Thus, Theorem
\ref{thm.ent.gcd.uniprop} (applied to $sa$, $sb$ and $\left\vert s\right\vert
$ instead of $a$, $b$ and $m$) shows that it divides $\gcd\left(
sa,sb\right)  $. In other words, it divides $x$ (since $x=\gcd\left(
sa,sb\right)  $). Hence, $\dfrac{x}{\left\vert s\right\vert }$ is an integer
(since $\left\vert s\right\vert \neq0$). We shall now show that this integer
$\dfrac{x}{\left\vert s\right\vert }$ divides $\gcd\left(  a,b\right)  $.
According to Theorem \ref{thm.ent.gcd.uniprop}, this will follow if we can
show that it divides both $a$ and $b$. So let us prove that it divides $a$ and
$b$. Indeed, $\left\vert s\right\vert $ equals either $s$ or $-s$ (depending
on the sign of $s$); thus, $\dfrac{x}{\left\vert s\right\vert }\cdot s$ equals
either $x$ or $-x$. In either case, we have $\dfrac{x}{\left\vert s\right\vert
}\cdot s\mid x$. Now,
\[
\dfrac{x}{\left\vert s\right\vert }\cdot s\mid x=\gcd\left(  sa,sb\right)
\mid sa=as.
\]
We can \textquotedblleft cancel\textquotedblright\ the factor $s$ from this
divisibility (by applying Proposition \ref{prop.ent.div.acbc} to $\dfrac
{x}{\left\vert s\right\vert }$, $a$ and $s$ instead of $a$, $b$ and $c$), and
thus obtain $\dfrac{x}{\left\vert s\right\vert }\mid a$. Similarly, $\dfrac
{x}{\left\vert s\right\vert }\mid b$. Combining $\dfrac{x}{\left\vert
s\right\vert }\mid a$ with $\dfrac{x}{\left\vert s\right\vert }\mid b$, we
obtain $\dfrac{x}{\left\vert s\right\vert }\mid\gcd\left(  a,b\right)  $ (by
Theorem \ref{thm.ent.gcd.uniprop}, applied to $m=\dfrac{x}{\left\vert
s\right\vert }$). This, in turn, is equivalent to $\dfrac{x}{\left\vert
s\right\vert }\cdot s\mid\gcd\left(  a,b\right)  \cdot s$ (by Proposition
\ref{prop.ent.div.acbc}, applied to $\dfrac{x}{\left\vert s\right\vert }$,
$\gcd\left(  a,b\right)  $ and $s$ instead of $a$, $b$ and $c$). In view of
$\gcd\left(  a,b\right)  \cdot s=s\gcd\left(  a,b\right)  =y$, this rewrites
as $\dfrac{x}{\left\vert s\right\vert }\cdot s\mid y$. But as we recall,
$\dfrac{x}{\left\vert s\right\vert }\cdot s$ equals either $x$ or $-x$; in
either case, we have $x\mid\dfrac{x}{\left\vert s\right\vert }\cdot s\mid y$.
Hence, $x\mid y$ is proved.

We have now proved both $x\mid y$ and $y\mid x$. As we have seen above, this
entails $x=y$ (since $x$ and $y$ are nonnegative). This proves Theorem
\ref{thm.ent.gcd.sa,sb}.
\end{proof}

\subsubsection{Using gcds}

The next theorem (\cite[Theorem 2.9.17]{19s}) is crucial in a way that might
not immediately meet one's eye:

\begin{theorem}
\label{thm.ent.gcd.combine}Let $a,b,c\in\mathbb{Z}$ satisfy $a\mid c$ and
$b\mid c$. Then, $ab\mid\gcd\left(  a,b\right)  \cdot c$.
\end{theorem}

Before we prove this theorem, let us chat about it a bit. Here is an example first:

\begin{example}
\label{exa.ent.gcd.combine}Let $a=6$ and $b=10$ and $c=30$. Then,
$a=6\mid30=c$ and $b=10\mid30=c$. Thus, Theorem \ref{thm.ent.gcd.combine}
yields $ab\mid\gcd\left(  a,b\right)  \cdot c$. In view of $a=6$, $b=10$,
$c=13$ and $\gcd\left(  a,b\right)  =\gcd\left(  6,10\right)  =2$, we can
rewrite this as $6\cdot10\mid2\cdot30$, which is not only true but actually an
equality (we have $6\cdot10=2\cdot30$). Note that we do \textbf{not} have
$ab\mid c$.
\end{example}

What makes Theorem \ref{thm.ent.gcd.combine} useful is that it lets us
\textquotedblleft swim upstream\textquotedblright\ in divisibility arguments,
in the sense of deriving \textquotedblleft stronger\textquotedblright%
\ divisibilities from \textquotedblleft weaker\textquotedblright\ ones. (Here,
we not-so-rigorously designate a divisibility $x\mid y$ as \textquotedblleft
weak\textquotedblright\ if the ratio $y/x$ is large and \textquotedblleft
strong\textquotedblright\ if it is small. Thus, for example, the divisibility
$4\mid24$ is much weaker than either of the two divisibilities $4\mid12$ and
$12\mid24$, so that we are \textquotedblleft swimming
downstream\textquotedblright\ when we derive $4\mid24$ from $4\mid12\mid24$.
We are also \textquotedblleft swimming downstream\textquotedblright\ when we
apply Proposition \ref{prop.ent.div.2} \textbf{(c)}; indeed, $a_{1}a_{2}\mid
b_{1}b_{2}$ is \textquotedblleft weaker\textquotedblright\ than $a_{1}\mid
b_{1}$ and $a_{2}\mid b_{2}$ (or \textquotedblleft equally
strong\textquotedblright\ at best). In contrast, as we saw in Example
\ref{exa.ent.gcd.combine}, the divisibility $ab\mid\gcd\left(  a,b\right)
\cdot c$ that we gain from Theorem \ref{thm.ent.gcd.combine} can be much
\textquotedblleft stronger\textquotedblright\ than the two divisibilities
$a\mid c$ and $b\mid c$ we have invested; thus, Theorem
\ref{thm.ent.gcd.combine} is taking us \textquotedblleft
upstream\textquotedblright. All this should not be taken literally, but it
gives a useful intuition.)

Again, as the following proof shows, the active ingredient in Theorem
\ref{thm.ent.gcd.combine} is Bezout's theorem:

\begin{proof}
[First proof of Theorem \ref{thm.ent.gcd.combine}.]Theorem
\ref{thm.ent.gcd.bezout} yields that there exist integers $x\in\mathbb{Z}$ and
$y\in\mathbb{Z}$ such that $\gcd\left(  a,b\right)  =xa+yb$. Consider these
$x$ and $y$.

There exists an integer $u$ such that $c=au$ (since $a\mid c$). Consider this
$u$.

There exists an integer $v$ such that $c=bv$ (since $b\mid c$). Consider this
$v$.

Now,%
\[
\underbrace{\gcd\left(  a,b\right)  }_{=xa+yb}\cdot c=\left(  xa+yb\right)
c=xa\underbrace{c}_{=bv}+yb\underbrace{c}_{=au}=xabv+ybau=ab\left(
xv+yu\right)  .
\]
Thus, there exists an integer $d$ such that $\gcd\left(  a,b\right)  \cdot
c=abd$ (namely, $d=xv+yu$). In other words, $ab\mid\gcd\left(  a,b\right)
\cdot c$. This proves Theorem \ref{thm.ent.gcd.combine}.
\end{proof}

\begin{proof}
[Second proof of Theorem \ref{thm.ent.gcd.combine}.]We have $a\mid a$ and
$b\mid c$, thus $ab\mid ac$ (by Proposition \ref{prop.ent.div.2} \textbf{(c)},
applied to $a_{1}=a$, $a_{2}=b$, $b_{1}=a$ and $b_{2}=c$). Also, we have
$a\mid c$ and $b\mid b$, thus $ab\mid cb$ (by Proposition \ref{prop.ent.div.2}
\textbf{(c)}, applied to $a_{1}=a$, $a_{2}=c$, $b_{1}=b$ and $b_{2}=b$).
However, we have the logical equivalence%
\[
\left(  ab\mid ac\ \text{and }ab\mid cb\right)  \ \Longleftrightarrow\ \left(
ab\mid\gcd\left(  ac,cb\right)  \right)
\]
(by Theorem \ref{thm.ent.gcd.uniprop}, applied to $ac$, $cb$ and $ab$ instead
of $a$, $b$ and $m$). Therefore, we have $ab\mid\gcd\left(  ac,cb\right)  $
(since we have $ab\mid ac$ and $ab\mid cb$). This rewrites as $ab\mid
\gcd\left(  ca,cb\right)  $ (since $ac=ca$).

But Theorem \ref{thm.ent.gcd.sa,sb} (applied to $s=c$) yields
\[
\gcd\left(  ca,cb\right)  =\underbrace{\left\vert c\right\vert }_{=\pm c}%
\gcd\left(  a,b\right)  =\pm c\gcd\left(  a,b\right)  \mid c\gcd\left(
a,b\right)  =\gcd\left(  a,b\right)  \cdot c.
\]
Hence,%
\[
ab\mid\gcd\left(  ca,cb\right)  \mid\gcd\left(  a,b\right)  \cdot c.
\]
This proves Theorem \ref{thm.ent.gcd.combine} again.
\end{proof}

Here is yet another fact (\cite[Theorem 2.9.19]{19s}) that follows from
Bezout's theorem:

\begin{theorem}
\label{thm.ent.gcd.cancel}Let $a,b,c\in\mathbb{Z}$ satisfy $a\mid bc$. Then,
$a\mid\gcd\left(  a,b\right)  \cdot c$.
\end{theorem}

Theorem \ref{thm.ent.gcd.cancel}, too, is a tool for \textquotedblleft
swimming upstream\textquotedblright\ (as the resulting divisibility $a\mid
\gcd\left(  a,b\right)  \cdot c$ is usually \textquotedblleft
stronger\textquotedblright\ than $a\mid bc$).

\begin{proof}
[First proof of Theorem \ref{thm.ent.gcd.cancel}.]Theorem
\ref{thm.ent.gcd.bezout} yields that there exist integers $x\in\mathbb{Z}$ and
$y\in\mathbb{Z}$ such that $\gcd\left(  a,b\right)  =xa+yb$. Consider these
$x$ and $y$.

We have $axc\equiv0\operatorname{mod}a$ (since $a\mid axc$) and $ybc\equiv
0\operatorname{mod}a$ (since $a\mid bc\mid ybc$). Adding these two congruences
together, we obtain $axc+ybc\equiv0+0=0\operatorname{mod}a$. In view of
$axc+ybc=\underbrace{\left(  xa+yb\right)  }_{=\gcd\left(  a,b\right)  }%
c=\gcd\left(  a,b\right)  \cdot c$, this rewrites as $\gcd\left(  a,b\right)
\cdot c\equiv0\operatorname{mod}a$. In other words, $a\mid\gcd\left(
a,b\right)  \cdot c$. This proves Theorem \ref{thm.ent.gcd.cancel}.
\end{proof}

\begin{proof}
[Second proof of Theorem \ref{thm.ent.gcd.cancel}.]We have the logical
equivalence%
\[
\left(  a\mid ac\ \text{and }a\mid bc\right)  \ \Longleftrightarrow\ \left(
a\mid\gcd\left(  ac,bc\right)  \right)
\]
(by Theorem \ref{thm.ent.gcd.uniprop}, applied to $ac$, $bc$ and $a$ instead
of $a$, $b$ and $m$). Therefore, we have $a\mid\gcd\left(  ac,bc\right)  $
(since we have $a\mid ac$ and $a\mid bc$). This rewrites as $a\mid\gcd\left(
ca,cb\right)  $ (since $ac=ca$ and $bc=cb$). But just as in the Second proof
of Theorem \ref{thm.ent.gcd.combine}, we can show that $\gcd\left(
ca,cb\right)  \mid\gcd\left(  a,b\right)  \cdot c$. Hence, $a\mid\gcd\left(
ca,cb\right)  \mid\gcd\left(  a,b\right)  \cdot c$. This proves Theorem
\ref{thm.ent.gcd.cancel} again.
\end{proof}

Here is yet another property of gcds:

\begin{proposition}
\label{prop.ent.gcd.div}Let $a_{1},a_{2},b_{1},b_{2}\in\mathbb{Z}$ satisfy
$a_{1}\mid b_{1}$ and $a_{2}\mid b_{2}$. Then,%
\[
\gcd\left(  a_{1},a_{2}\right)  \mid\gcd\left(  b_{1},b_{2}\right)  .
\]

\end{proposition}

\begin{proof}
[Hint to proof of Proposition \ref{prop.ent.gcd.div}.]Show that $\gcd\left(
a_{1},a_{2}\right)  $ divides both $b_{1}$ and $b_{2}$; then argue by Theorem
\ref{thm.ent.gcd.uniprop}. (See \cite[Exercise 2.9.4]{19s} for details.)
\end{proof}

\subsubsection{Gcds of multiple numbers}

A few words are worth saying about gcds of more than two numbers. In many
ways, they behave similarly to those of two numbers. For example, Theorem
\ref{thm.ent.gcd.bezout} can be generalized to multiple numbers:

\begin{theorem}
\label{thm.ent.gcd.bezout-mul}Let $b_{1},b_{2},\ldots,b_{k}$ be integers.
Then, there exist integers $x_{1},x_{2},\ldots,x_{k}$ such that%
\[
\gcd\left(  b_{1},b_{2},\ldots,b_{k}\right)  =x_{1}b_{1}+x_{2}b_{2}%
+\cdots+x_{k}b_{k}.
\]

\end{theorem}

Theorem \ref{thm.ent.gcd.bezout-mul} can be proved similarly to Theorem
\ref{thm.ent.gcd.bezout}: If $b_{1},b_{2},\ldots,b_{k}\in\mathbb{N}$, then the
claim follows by strong induction on $b_{1}+b_{2}+\cdots+b_{k}$ (where the
induction step proceeds by subtracting the smallest nonzero number among
$b_{1},b_{2},\ldots,b_{k}$ from the largest\footnote{If there is only one
nonzero number among $b_{1},b_{2},\ldots,b_{k}$, then the claim is easily
verified by hand.}); the general case can be reduced to this case by observing
that replacing any $b_{i}$ by $-b_{i}$ changes nothing. Another proof of
Theorem \ref{thm.ent.gcd.bezout-mul} can be found in \cite[proof of Theorem
2.9.22]{19s}.

A generalization of Theorem \ref{thm.ent.gcd.uniprop} to multiple numbers also exists:

\begin{theorem}
\label{thm.ent.gcd.uniprop-mul}Let $k\in\mathbb{N}$, let $b_{1},b_{2}%
,\ldots,b_{k}\in\mathbb{Z}$ and $m\in\mathbb{Z}$. Then, we have the following
logical equivalence:%
\[
\left(  m\mid b_{i}\text{ for all }i\in\left\{  1,2,\ldots,k\right\}  \right)
\ \Longleftrightarrow\ \left(  m\mid\gcd\left(  b_{1},b_{2},\ldots
,b_{k}\right)  \right)  .
\]

\end{theorem}

Theorem \ref{thm.ent.gcd.uniprop-mul} can easily be derived from Theorem
\ref{thm.ent.gcd.bezout-mul} just as Theorem \ref{thm.ent.gcd.uniprop} was
derived from Theorem \ref{thm.ent.gcd.bezout}. An alternative proof of Theorem
\ref{thm.ent.gcd.uniprop-mul} is found in \cite[proof of Theorem 2.9.21
\textbf{(a)}]{19s}.

It is an instructive exercise to derive from Theorem
\ref{thm.ent.gcd.uniprop-mul} the following consequence:

\begin{theorem}
\label{thm.ent.gcd.split}Let $b_{1},b_{2},\ldots,b_{k}$ be integers, and let
$c_{1},c_{2},\ldots,c_{\ell}$ be integers. Then,%
\[
\gcd\left(  b_{1},b_{2},\ldots,b_{k},c_{1},c_{2},\ldots,c_{\ell}\right)
=\gcd\left(  \gcd\left(  b_{1},b_{2},\ldots,b_{k}\right)  ,\gcd\left(
c_{1},c_{2},\ldots,c_{\ell}\right)  \right)  .
\]

\end{theorem}

See \cite[proof of Theorem 2.9.26]{19s} for a detailed proof of Theorem
\ref{thm.ent.gcd.split}.

It is also not hard to extend Theorem \ref{thm.ent.gcd.sa,sb} to multiple
numbers (\cite[Exercise 2.9.7]{19s}):

\begin{theorem}
Let $s\in\mathbb{Z}$, and let $b_{1},b_{2},\ldots,b_{k}$ be integers. Then,
$\gcd\left(  sb_{1},sb_{2},\ldots,sb_{k}\right)  =\left\vert s\right\vert
\gcd\left(  b_{1},b_{2},\ldots,b_{k}\right)  $.
\end{theorem}

\subsubsection{An exercise}

Here is a sample exercise on greatest common divisors, before we go on to
properly exploit them:

\begin{exercise}
\label{exe.ent.gcd.an-1}Let $u$ be an integer.

\textbf{(a)} Prove that $u^{b}-1\equiv u^{a}-1\operatorname{mod}u^{b-a}-1$ for
any $a\in\mathbb{N}$ and $b\in\mathbb{N}$ satisfying $b\geq a$.

\textbf{(b)} Prove that $\gcd\left(  u^{a}-1,u^{b}-1\right)  =\left\vert
u^{\gcd\left(  a,b\right)  }-1\right\vert $ for all $a\in\mathbb{N}$ and
$b\in\mathbb{N}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.gcd.an-1} (sketched).]This is an outline;
see \cite[solution to Exercise 2.9.3]{19s} for a detailed version.

\textbf{(a)} Let $a\in\mathbb{N}$ and $b\in\mathbb{N}$ be such that $b\geq a$.
We have $b-a\in\mathbb{N}$ (since $b\geq a$). Hence, $u^{b-a}$ is an integer.
We have%
\[
\left(  u^{b}-1\right)  -\left(  u^{a}-1\right)  =u^{b}-u^{a}=\left(
u^{b-a}-1\right)  u^{a}.
\]
Thus, $u^{b-a}-1\mid\left(  u^{b}-1\right)  -\left(  u^{a}-1\right)  $ (since
$u^{a}$ is an integer). In other words, $u^{b}-1\equiv u^{a}%
-1\operatorname{mod}u^{b-a}-1$. This solves Exercise \ref{exe.ent.gcd.an-1}
\textbf{(a)}.

\textbf{(b)} The following argument will imitate our proof of Theorem
\ref{thm.ent.gcd.bezout} above (specifically the proof of Claim 1 in it).

We use strong induction on $a+b$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)} is true for
$a+b<k$. We must prove that Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)} is
true for $a+b=k$.

So let $a,b\in\mathbb{N}$ be such that $a+b=k$. We must show that $\gcd\left(
u^{a}-1,u^{b}-1\right)  =\left\vert u^{\gcd\left(  a,b\right)  }-1\right\vert
$.

Note that $a$ and $b$ play symmetric roles in this claim\footnote{because
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} yields $\gcd\left(
a,b\right)  =\gcd\left(  b,a\right)  $ and $\gcd\left(  u^{a}-1,u^{b}%
-1\right)  =\gcd\left(  u^{b}-1,u^{a}-1\right)  $}, and thus can be swapped at
will. By swapping $a$ and $b$ if necessary, we can ensure that $a\leq b$.
Hence, we WLOG assume that $a\leq b$. Thus, $b-a\in\mathbb{N}$.

It is easy to see that our claim $\gcd\left(  u^{a}-1,u^{b}-1\right)
=\left\vert u^{\gcd\left(  a,b\right)  }-1\right\vert $ holds if
$a=0$\ \ \ \ \footnote{\textit{Proof.} Assume that $a=0$. Then, $\gcd\left(
a,b\right)  =b$ (this has already been proved during our above proof of
Theorem \ref{thm.ent.gcd.bezout}) and thus $b=\gcd\left(  a,b\right)  $.
Furthermore, from $a=0$, we obtain $u^{a}-1=u^{0}-1=0$ (since $u^{0}=1$) and
therefore%
\begin{align*}
\gcd\left(  u^{a}-1,u^{b}-1\right)   &  =\gcd\left(  0,u^{b}-1\right) \\
&  =\gcd\left(  u^{b}-1,0\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =\left\vert u^{b}-1\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(a)}}\right) \\
&  =\left\vert u^{\gcd\left(  a,b\right)  }-1\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b=\gcd\left(  a,b\right)  \right)  ,
\end{align*}
qed.}. Thus, we are done if $a=0$. Hence, we WLOG assume that $a\neq0$.
Therefore, $a>0$ (since $a\in\mathbb{N}$). Thus, $a+b>b$, so that $b<a+b=k$.

But our induction hypothesis says that Exercise \ref{exe.ent.gcd.an-1}
\textbf{(b)} is true for $a+b<k$. Hence, we can apply Exercise
\ref{exe.ent.gcd.an-1} \textbf{(b)} to $b-a$ instead of $b$ (since
$b-a\in\mathbb{N}$ and $a+\left(  b-a\right)  =b<k$). We thus obtain
\begin{equation}
\gcd\left(  u^{a}-1,u^{b-a}-1\right)  =\left\vert u^{\gcd\left(  a,b-a\right)
}-1\right\vert . \label{sol.ent.gcd.an-1.b.4}%
\end{equation}
But we have $\gcd\left(  a,b-a\right)  =\gcd\left(  a,b\right)  $ (this has
already been proved during our proof of Theorem \ref{thm.ent.gcd.bezout}).
Furthermore, Exercise \ref{exe.ent.gcd.an-1} \textbf{(a)} (applied to $b-a$
instead of $a$) yields $u^{b}-1\equiv u^{b-a}-1\operatorname{mod}u^{b-\left(
b-a\right)  }-1$ (since $b-a\in\mathbb{N}$ and $b\geq b-a$). Since $b-\left(
b-a\right)  =a$, this rewrites as $u^{b}-1\equiv u^{b-a}-1\operatorname{mod}%
u^{a}-1$. Hence, Proposition \ref{prop.ent.gcd.props1} \textbf{(d)} (applied
to $u^{a}-1$, $u^{b}-1$ and $u^{b-a}-1$ instead of $a$, $b$ and $c$) yields%
\begin{align*}
\gcd\left(  u^{a}-1,u^{b}-1\right)   &  =\gcd\left(  u^{a}-1,u^{b-a}-1\right)
=\left\vert u^{\gcd\left(  a,b-a\right)  }-1\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.ent.gcd.an-1.b.4})}\right) \\
&  =\left\vert u^{\gcd\left(  a,b\right)  }-1\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\gcd\left(  a,b-a\right)
=\gcd\left(  a,b\right)  \right)  .
\end{align*}


Now, forget that we fixed $a,b$. We thus have shown that any $a,b\in
\mathbb{N}$ satisfying $a+b=k$ satisfy $\gcd\left(  u^{a}-1,u^{b}-1\right)
=\left\vert u^{\gcd\left(  a,b\right)  }-1\right\vert $. In other words,
Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)} is true for $a+b=k$. This
completes the induction step. Thus, Exercise \ref{exe.ent.gcd.an-1}
\textbf{(b)} is solved.

[See also \url{https://math.stackexchange.com/questions/7473/} for various
solutions of Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)}.]
\end{proof}

\subsection{Coprimality}

\subsubsection{Definition and basic properties}

Perhaps ironically, gcds are at their most useful when they equal $1$. This
situation has a name:

\begin{definition}
\label{def.ent.coprime.coprime}Let $a$ and $b$ be two integers. We say that
$a$ is \textit{coprime} to $b$ if and only if $\gcd\left(  a,b\right)  =1$.
\end{definition}

Instead of \textquotedblleft coprime\textquotedblright, some authors say
\textquotedblleft relatively prime\textquotedblright\footnote{The book
\cite{NiZuMo91} even abbreviates \textquotedblleft coprime\textquotedblright%
\ as \textquotedblleft prime\textquotedblright, which I find somewhat
misleading (as the concept is only mildly related to the notion of a
\textquotedblleft prime\textquotedblright\ that we will discuss later on).}.

\begin{example}
\label{exa.ent.coprime.1}\textbf{(a)} The number $2$ is coprime to $3$, since
$\gcd\left(  2,3\right)  =1$. More generally, if $a$ is any integer, then $a$
is coprime to $a+1$. (Check this! Or see \cite[Example 2.10.2 \textbf{(c)}%
]{19s} for the proof.)

\textbf{(b)} The number $6$ is not coprime to $15$, since $\gcd\left(
6,15\right)  =3\neq1$.

\textbf{(c)} Let $a$ be an integer. Then, it is easy to see (see \cite[Example
2.10.2 \textbf{(d)}]{19s} for the proof) that%
\[
\gcd\left(  a,a+2\right)  =\gcd\left(  a,2\right)  =%
\begin{cases}
2, & \text{if }a\text{ is even};\\
1, & \text{if }a\text{ is odd.}%
\end{cases}
\]
Hence, $a$ is coprime to $a+2$ if and only if $a$ is odd.
\end{example}

Following the book \cite{GKP}, we introduce a slightly quaint notation:

\begin{definition}
\label{def.ent.coprime.perp}Let $a$ and $b$ be two integers. We write
\textquotedblleft$a\perp b$\textquotedblright\ to signify that $a$ is coprime
to $b$.
\end{definition}

The relation \textquotedblleft$\perp$\textquotedblright\ is symmetric:

\begin{proposition}
\label{prop.ent.coprime.perp-symm}Let $a$ and $b$ be two integers. Then,
$a\perp b$ if and only if $b\perp a$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.coprime.perp-symm}.]Follows from
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}. (See \cite[proof of
Proposition 2.10.4]{19s} for details.)
\end{proof}

Note that coprimality is not transitive: i.e., if we have $a\perp b$ and
$b\perp c$, then we don't usually have $a\perp c$. (A simple counterexample is
$a=2$, $b=1$ and $c=2$.)

\begin{definition}
Let $a$ and $b$ be two integers. Proposition \ref{prop.ent.coprime.perp-symm}
shows that $a$ is coprime to $b$ if and only if $b$ is coprime to $a$. Hence,
we shall sometimes use a more symmetric terminology for this situation: We
shall say that \textquotedblleft$a$ and $b$ \textit{are coprime}%
\textquotedblright\ to mean that $a$ is coprime to $b$ (or, equivalently, that
$b$ is coprime to $a$).
\end{definition}

\subsubsection{More properties and examples}

The following is easy (\cite[Exercise 2.10.1]{19s}) and will be used without saying:

\begin{exercise}
\label{exe.ent.coprime.01}Let $a\in\mathbb{Z}$. Prove the following:

\textbf{(a)} We have $1\perp a$.

\textbf{(b)} We have $0\perp a$ if and only if $\left\vert a\right\vert =1$.
\end{exercise}

We can get more examples of coprime integers from the Fibonacci sequence:

\begin{exercise}
\label{exe.sol.fib.gcd-nbrs}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be
the Fibonacci sequence. Prove that $f_{n}\perp f_{n+1}$ for each
$n\in\mathbb{N}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.sol.fib.gcd-nbrs}.]We use induction on $n$:

\textit{Induction base:} We have $\gcd\left(  0,1\right)  =1$. In other words,
$0\perp1$ (by the definition of \textquotedblleft coprime\textquotedblright).
In other words, $f_{0}\perp f_{1}$ (since $f_{0}=0$ and $f_{1}=1$). In other
words, Exercise \ref{exe.sol.fib.gcd-nbrs} holds for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.sol.fib.gcd-nbrs} holds for $n=m$. We must
prove that Exercise \ref{exe.sol.fib.gcd-nbrs} holds for $n=m+1$. In other
words, we must prove that $f_{m+1}\perp f_{m+2}$.

Our induction hypothesis says that Exercise \ref{exe.sol.fib.gcd-nbrs} holds
for $n=m$. In other words, we have $f_{m}\perp f_{m+1}$. According to
Proposition \ref{prop.ent.coprime.perp-symm} (applied to $a=f_{m}$ and
$b=f_{m+1}$), this entails $f_{m+1}\perp f_{m}$. In other words, $\gcd\left(
f_{m+1},f_{m}\right)  =1$ (by the definition of \textquotedblleft
coprime\textquotedblright). But the recursive definition of the Fibonacci
sequence yields $f_{m+2}=f_{m+1}+f_{m}=1f_{m+1}+f_{m}$. Hence,%
\begin{align*}
\gcd\left(  f_{m+1},f_{m+2}\right)   &  =\gcd\left(  f_{m+1},1f_{m+1}%
+f_{m}\right)  =\gcd\left(  f_{m+1},f_{m}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.gcd.props1}
\textbf{(c)}, applied to }a=f_{m+1}\text{, }b=f_{m}\text{ and }u=1\right) \\
&  =1.
\end{align*}
In other words, $f_{m+1}\perp f_{m+2}$ (by the definition of \textquotedblleft
coprime\textquotedblright). This is exactly what we needed to prove. Thus, the
induction step is complete, and Exercise \ref{exe.sol.fib.gcd-nbrs} is solved.
\end{proof}

\subsubsection{Using coprimality}

We can now state two important theorems about coprime numbers (and, as a
reward for our previous troubles, their proofs will follow immediately from
the properties of gcds). Both of them are tools for \textquotedblleft swimming
upstream\textquotedblright\ (in the sense explained in the previous section).
The first one states that we can \textquotedblleft cancel\textquotedblright\ a
factor $b$ from a divisibility $a\mid bc$ as long as this factor is coprime to
$a$:

\begin{theorem}
\label{thm.ent.coprime.cancel}Let $a,b,c\in\mathbb{Z}$ satisfy $a\mid bc$ and
$a\perp b$. Then, $a\mid c$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.coprime.cancel}.]We have $a\perp b$; in other
words, $a$ is coprime to $b$ (by Definition \ref{def.ent.coprime.perp}). In
other words, $\gcd\left(  a,b\right)  =1$ (by the definition of
\textquotedblleft coprime\textquotedblright). Now, Theorem
\ref{thm.ent.gcd.cancel} yields $a\mid\underbrace{\gcd\left(  a,b\right)
}_{=1}\cdot c=c$. This proves Theorem \ref{thm.ent.coprime.cancel}.
\end{proof}

I like to think of Theorem \ref{thm.ent.coprime.combine} as a way of removing
\textquotedblleft unsolicited guests\textquotedblright\ from divisibilities.
Indeed, it says that we can remove the factor $b$ from $a\mid bc$ if we know
that $b$ is \textquotedblleft unrelated\textquotedblright\ (i.e., coprime) to
$a$. This is used all over number theory.

The next theorem lets us \textquotedblleft combine\textquotedblright\ two
divisibilities $a\mid c$ and $b\mid c$ to $ab\mid c$ as long as $a$ and $b$
are coprime:

\begin{theorem}
\label{thm.ent.coprime.combine}Let $a,b,c\in\mathbb{Z}$ satisfy $a\mid c$ and
$b\mid c$ and $a\perp b$. Then, $ab\mid c$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.coprime.combine}.]We have $\gcd\left(
a,b\right)  =1$ (as in the proof of Theorem \ref{thm.ent.coprime.cancel}).
Now, Theorem \ref{thm.ent.gcd.combine} yields $ab\mid\underbrace{\gcd\left(
a,b\right)  }_{=1}\cdot c=c$. This proves Theorem
\ref{thm.ent.coprime.combine}.
\end{proof}

Theorem \ref{thm.ent.coprime.combine} is highly useful, and will become more
so once we have learnt about prime factorization. For now, here is a quick
sample application:

\begin{exercise}
\label{exe.ent.squares-mod-24}Let $n$ be an integer such that $2\nmid n$ and
$3\nmid n$. Prove that $24\mid n^{2}-1$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.squares-mod-24}.]The integer $n$ is odd
(since $2\nmid n$); thus, Exercise \ref{exe.ent.odd-squares-mod8} yields
$8\mid n^{2}-1$. Also, $3\nmid n$; thus Exercise \ref{exe.ent.squares-mod-3}
yields $3\mid n^{2}-1$. But it is easy to see that $\gcd\left(  8,3\right)
=1$, so that $8\perp3$ (by the definition of \textquotedblleft
coprime\textquotedblright). Thus, Theorem \ref{thm.ent.coprime.combine}
(applied to $a=8$, $b=3$ and $c=n^{2}-1$) yields $8\cdot3\mid n^{2}-1$. In
other words, $24\mid n^{2}-1$ (since $8\cdot3=24$). This solves Exercise
\ref{exe.ent.squares-mod-24}.
\end{proof}

Coprimality is \textquotedblleft inherited\textquotedblright\ by divisors, in
the sense that coprime integers have coprime divisors. To be more precise:

\begin{proposition}
\label{prop.ent.coprime.div}Let $a_{1},a_{2},b_{1},b_{2}\in\mathbb{Z}$ satisfy
$a_{1}\mid b_{1}$ and $a_{2}\mid b_{2}$ and $b_{1}\perp b_{2}$. Then,
$a_{1}\perp a_{2}$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.coprime.div}.]We have $b_{1}\perp b_{2}$;
in other words, $\gcd\left(  b_{1},b_{2}\right)  =1$ (by the definition of
\textquotedblleft coprime\textquotedblright). But Proposition
\ref{prop.ent.gcd.div} yields $\gcd\left(  a_{1},a_{2}\right)  \mid\gcd\left(
b_{1},b_{2}\right)  =1$. Since $\gcd\left(  a_{1},a_{2}\right)  $ is a
nonnegative integer (by Proposition \ref{prop.ent.gcd.pos} \textbf{(a)}), this
entails that $\gcd\left(  a_{1},a_{2}\right)  =1$ (since the only nonnegative
integer that divides $1$ is $1$). In other words, $a_{1}\perp a_{2}$ (by the
definition of \textquotedblleft coprime\textquotedblright). This proves
Proposition \ref{prop.ent.coprime.div}.
\end{proof}

The next theorem (still part of the fallout of Bezout's theorem) is important,
but we will not truly appreciate it until later:

\begin{theorem}
\label{thm.ent.coprime.modinv}Let $a,n\in\mathbb{Z}$.

\textbf{(a)} There exists an $a^{\prime}\in\mathbb{Z}$ such that $aa^{\prime
}\equiv\gcd\left(  a,n\right)  \operatorname{mod}n$.

\textbf{(b)} If $a\perp n$, then there exists an $a^{\prime}\in\mathbb{Z}$
such that $aa^{\prime}\equiv1\operatorname{mod}n$.

\textbf{(c)} If there exists an $a^{\prime}\in\mathbb{Z}$ such that
$aa^{\prime}\equiv1\operatorname{mod}n$, then $a\perp n$.
\end{theorem}

If $a,n\in\mathbb{Z}$, then an integer $a^{\prime}\in\mathbb{Z}$ satisfying
$aa^{\prime}\equiv1\operatorname{mod}n$ is called a \textit{modular inverse}
of $a$ modulo $n$. The word \textquotedblleft modular
inverse\textquotedblright\ is chosen in analogy to the usual concept of an
\textquotedblleft inverse\textquotedblright\ in $\mathbb{Z}$ (which stands for
an integer $a^{\prime}\in\mathbb{Z}$ satisfying $aa^{\prime}=1$; this exists
if and only if $a$ equals $1$ or $-1$). Theorem \ref{thm.ent.coprime.modinv}
\textbf{(b)} shows that such a modular inverse always exists when $a\perp n$;
Theorem \ref{thm.ent.coprime.modinv} \textbf{(c)} is the converse of this
statement (i.e., it says that if a modular inverse of $a$ modulo $n$ exists,
then $a\perp n$).

\begin{proof}
[Proof of Theorem \ref{thm.ent.coprime.modinv} (sketched).](See \cite[proof of
Theorem 2.10.8]{19s} for details.)

\textbf{(a)} Theorem \ref{thm.ent.gcd.bezout} (applied to $b=n$) yields that
there exist integers $x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that
$\gcd\left(  a,n\right)  =xa+yn$. Consider these $x$ and $y$. We
have\footnote{Here, we are again using the substitution principle for
congruences (from Example \ref{exa.ent.mod.subst.1}). Convince yourself that
you know how to do without this principle.} $\gcd\left(  a,n\right)
=xa+\underbrace{yn}_{\equiv0\operatorname{mod}n}\equiv xa=ax\operatorname{mod}%
n$, so that $ax\equiv\gcd\left(  a,n\right)  \operatorname{mod}n$. Thus, there
exists an $a^{\prime}\in\mathbb{Z}$ such that $aa^{\prime}\equiv\gcd\left(
a,n\right)  \operatorname{mod}n$ (namely, $a^{\prime}=x$). This proves Theorem
\ref{thm.ent.coprime.modinv} \textbf{(a)}.

\textbf{(b)} Assume that $a\perp n$. In other words, $\gcd\left(  a,n\right)
=1$ (by the definition of \textquotedblleft coprime\textquotedblright). Hence,
the claim of Theorem \ref{thm.ent.coprime.modinv} \textbf{(a)} rewrites
immediately as the claim of Theorem \ref{thm.ent.coprime.modinv} \textbf{(b)}.

\textbf{(c)} Assume that there exists an $a^{\prime}\in\mathbb{Z}$ such that
$aa^{\prime}\equiv1\operatorname{mod}n$. Consider this $a^{\prime}$.

Let $g=\gcd\left(  a,n\right)  $. Then, $g$ is a nonnegative
integer\footnote{by Proposition \ref{prop.ent.gcd.pos} \textbf{(a)}}, and
Proposition \ref{prop.ent.gcd.props1} \textbf{(f)} (applied to $b=n$) yields
$g\mid a$ and $g\mid n$.

Now, $g\mid a\mid aa^{\prime}$, so that $aa^{\prime}\equiv0\operatorname{mod}%
g$. But also $g\mid n$. Hence, from $aa^{\prime}\equiv1\operatorname{mod}n$,
we obtain $aa^{\prime}\equiv1\operatorname{mod}g$ (by Proposition
\ref{prop.ent.mod.basics} \textbf{(e)}, applied to $g$, $aa^{\prime}$ and $1$
instead of $m$, $a$ and $b$). Hence, $1\equiv aa^{\prime}\equiv
0\operatorname{mod}g$. Equivalently, $g\mid1-0=1$. Hence, $g=1$ (since the
only nonnegative integer that divides $1$ is $1$). Thus, $\gcd\left(
a,n\right)  =g=1$. In other words, $a\perp n$. This proves Theorem
\ref{thm.ent.coprime.modinv} \textbf{(c)}.
\end{proof}

\subsubsection{Multiplying coprimalities}

The next theorem provides a way to \textquotedblleft
multiply\textquotedblright\ coprimalities. Note how modular inverses are used
in its proof:

\begin{theorem}
\label{thm.ent.coprime.ab-to-c}Let $a,b,c\in\mathbb{Z}$ such that $a\perp c$
and $b\perp c$. Then, $ab\perp c$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.coprime.ab-to-c}.]Theorem
\ref{thm.ent.coprime.modinv} \textbf{(b)} (applied to $n=c$) yields that there
exists an $a^{\prime}\in\mathbb{Z}$ such that $aa^{\prime}\equiv
1\operatorname{mod}c$. Likewise, Theorem \ref{thm.ent.coprime.modinv}
\textbf{(b)} (applied to $b$ and $c$ instead of $a$ and $n$) yields that there
exists a $b^{\prime}\in\mathbb{Z}$ such that $bb^{\prime}\equiv
1\operatorname{mod}c$. Consider these $a^{\prime}$ and $b^{\prime}$.

Multiplying the two congruences $aa^{\prime}\equiv1\operatorname{mod}c$ and
$bb^{\prime}\equiv1\operatorname{mod}c$, we obtain $\left(  aa^{\prime
}\right)  \left(  bb^{\prime}\right)  \equiv1\cdot1=1\operatorname{mod}c$.

Now, define the integers $r=ab$ and $s=a^{\prime}b^{\prime}$. Then,
$\underbrace{r}_{=ab}\underbrace{s}_{=a^{\prime}b^{\prime}}=\left(  ab\right)
\left(  a^{\prime}b^{\prime}\right)  =\left(  aa^{\prime}\right)  \left(
bb^{\prime}\right)  \equiv1\operatorname{mod}c$. Hence, there exists an
$r^{\prime}\in\mathbb{Z}$ such that $rr^{\prime}\equiv1\operatorname{mod}c$
(namely, $r^{\prime}=s$). Thus, Theorem \ref{thm.ent.coprime.modinv}
\textbf{(c)} (applied to $r$ and $c$ instead of $a$ and $n$) yields that
$r\perp c$. In view of $r=ab$, this rewrites as $ab\perp c$. This proves
Theorem \ref{thm.ent.coprime.ab-to-c}.
\end{proof}

Theorem \ref{thm.ent.coprime.ab-to-c} can be generalized (in a straightforward
way) to products of several numbers:

\begin{exercise}
\label{exe.ent.coprime.ab-to-ck}Let $c\in\mathbb{Z}$. Let $a_{1},a_{2}%
,\ldots,a_{k}$ be integers such that each $i\in\left\{  1,2,\ldots,k\right\}
$ satisfies $a_{i}\perp c$. Prove that $a_{1}a_{2}\cdots a_{k}\perp c$.
\end{exercise}

\begin{proof}
[Hint to Exercise \ref{exe.ent.coprime.ab-to-ck}.]Induct on $k$. (See
\cite[solution to Exercise 2.10.2]{19s} for the details.)
\end{proof}

A quick consequence of this exercise is that powers of coprime integers are
still coprime:

\begin{exercise}
\label{exe.ent.coprime.powers}Let $a,b\in\mathbb{Z}$ be such that $a\perp b$.
Let $n,m\in\mathbb{N}$. Prove that $a^{n}\perp b^{m}$.
\end{exercise}

Thus, for example, $2^{14}\perp3^{6}$, because $2\perp3$.

\begin{proof}
[Hint to Exercise \ref{exe.ent.coprime.powers}.]We have $a\perp b$. Thus,
Exercise \ref{exe.ent.coprime.ab-to-ck} (applied to $k=n$ and $a_{i}=a$)
yields $a^{n}\perp b$. According to Proposition
\ref{prop.ent.coprime.perp-symm}, this entails $b\perp a^{n}$. Hence, another
application of Exercise \ref{exe.ent.coprime.ab-to-ck} yields $b^{m}\perp
a^{n}$. Thus, by Proposition \ref{prop.ent.coprime.perp-symm}, we get
$a^{n}\perp b^{m}$. (See \cite[solution to Exercise 2.10.4]{19s} for the details.)
\end{proof}

We can generalize Theorem \ref{thm.ent.coprime.combine} to show that the
product of several mutually coprime divisors of an integer $c$ must again be a
divisor of $c$:

\begin{exercise}
\label{exe.ent.coprime.combinek}Let $c\in\mathbb{Z}$. Let $b_{1},b_{2}%
,\ldots,b_{k}$ be integers that are mutually coprime (i.e., they satisfy
$b_{i}\perp b_{j}$ for all $i\neq j$). Assume that $b_{i}\mid c$ for each
$i\in\left\{  1,2,\ldots,k\right\}  $. Prove that $b_{1}b_{2}\cdots b_{k}\mid
c$.
\end{exercise}

\begin{proof}
[Hint to Exercise \ref{exe.ent.coprime.combinek}.]Induct on $k$ using Exercise
\ref{exe.ent.coprime.ab-to-ck}. (See \cite[solution to Exercise 2.10.3]{19s}
for the details.)
\end{proof}

The above results have one important application to congruences. Recall that
if $a,b,c$ are integers satisfying $ab=ac$, then we can \textquotedblleft
cancel\textquotedblright\ $a$ from the equality $ab=ac$ to obtain $b=c$ as
long as $a$ is nonzero. Something similar is true for congruences modulo $n$,
but the condition \textquotedblleft$a$ is nonzero\textquotedblright\ has to be
replaced by \textquotedblleft$a$ is coprime to $n$\textquotedblright:

\begin{lemma}
\label{lem.ent.coprime.cancel}Let $a,b,c,n$ be integers such that $a\perp n$
and $ab\equiv ac\operatorname{mod}n$. Then, $b\equiv c\operatorname{mod}n$.
\end{lemma}

Lemma \ref{lem.ent.coprime.cancel} says that we can cancel an integer $a$ from
a congruence $ab\equiv ac\operatorname{mod}n$ as long as $a$ is coprime to
$n$. Let us give two proofs of this lemma, to illustrate the uses of some of
the previous results:

\begin{proof}
[First proof of Lemma \ref{lem.ent.coprime.cancel}.]We have $ab\equiv
ac\operatorname{mod}n$. In other words, $n\mid ab-ac=a\left(  b-c\right)  $.
But Proposition \ref{prop.ent.coprime.perp-symm} (applied to $n$ instead of
$b$) shows that $a\perp n$ if and only if $n\perp a$. Thus, we have $n\perp a$
(since $a\perp n$).

Thus, we know that $n\mid a\left(  b-c\right)  $ and $n\perp a$. Hence,
Theorem \ref{thm.ent.coprime.cancel} (applied to $n$, $a$ and $b-c$ instead of
$a$, $b$ and $c$) yields $n\mid b-c$. In other words, $b\equiv
c\operatorname{mod}n$. This proves Lemma \ref{lem.ent.coprime.cancel}.
\end{proof}

\begin{proof}
[Second proof of Lemma \ref{lem.ent.coprime.cancel}.]Theorem
\ref{thm.ent.coprime.modinv} \textbf{(b)} yields that there exists an
$a^{\prime}\in\mathbb{Z}$ such that $aa^{\prime}\equiv1\operatorname{mod}n$
(since $a\perp n$). Consider this $a^{\prime}$. Now, multiplying both sides of
the congruence $ab\equiv ac\operatorname{mod}n$ by $a^{\prime}$, we obtain%
\[
a^{\prime}ab\equiv a^{\prime}ac\operatorname{mod}n.
\]
But we have $\underbrace{a^{\prime}a}_{=aa^{\prime}\equiv1\operatorname{mod}%
n}c\equiv1c=c\operatorname{mod}n$ and similarly $a^{\prime}ab\equiv
b\operatorname{mod}n$. Hence,%
\[
b\equiv a^{\prime}ab\equiv a^{\prime}ac\equiv c\operatorname{mod}n.
\]
This proves Lemma \ref{lem.ent.coprime.cancel}.
\end{proof}

\subsubsection{Reduced fractions}

We notice that any two integers can be \textquotedblleft made
coprime\textquotedblright\ by factoring out their gcd, unless they are both
$0$:

\begin{proposition}
\label{prop.ent.coprime.div-away}Let $a$ and $b$ be two integers such that
$\left(  a,b\right)  \neq\left(  0,0\right)  $. Let $g=\gcd\left(  a,b\right)
$. Then, $g>0$ and $\dfrac{a}{g}\perp\dfrac{b}{g}$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.coprime.div-away}.]The integers $a$ and
$b$ are not both $0$ (since $\left(  a,b\right)  \neq\left(  0,0\right)  $).
Hence, $\gcd\left(  a,b\right)  $ is a positive integer (by Proposition
\ref{prop.ent.gcd.pos} \textbf{(b)}). Thus, $\gcd\left(  a,b\right)  >0$. In
other words, $g>0$ (since $g=\gcd\left(  a,b\right)  $).

Moreover, $g=\gcd\left(  a,b\right)  $, so that Proposition
\ref{prop.ent.gcd.props1} \textbf{(f)} yields $g\mid a$ and $g\mid b$. Hence,
$\dfrac{a}{g}$ and $\dfrac{b}{g}$ are integers. Thus, Theorem
\ref{thm.ent.gcd.sa,sb} (applied to $g$, $\dfrac{a}{g}$ and $\dfrac{b}{g}$)
yields
\[
\gcd\left(  g\cdot\dfrac{a}{g},g\cdot\dfrac{b}{g}\right)
=\underbrace{\left\vert g\right\vert }_{\substack{=g\\\text{(since
}g>0\text{)}}}\gcd\left(  \dfrac{a}{g},\dfrac{b}{g}\right)  =g\gcd\left(
\dfrac{a}{g},\dfrac{b}{g}\right)  .
\]
Therefore,%
\[
\gcd\left(  \dfrac{a}{g},\dfrac{b}{g}\right)  =\dfrac{1}{g}\gcd\left(
\underbrace{g\cdot\dfrac{a}{g}}_{=a},\underbrace{g\cdot\dfrac{b}{g}}%
_{=b}\right)  =\dfrac{1}{g}\gcd\left(  a,b\right)  =1
\]
(since $g=\gcd\left(  a,b\right)  $). In other words, $\dfrac{a}{g}\perp
\dfrac{b}{g}$ (by the definition of \textquotedblleft
coprime\textquotedblright). This proves Proposition
\ref{prop.ent.coprime.div-away}.
\end{proof}

An easy consequence of Proposition \ref{prop.ent.coprime.div-away} is the
following fundamental fact (\cite[Exercise 2.10.14]{19s}):

\begin{corollary}
\label{cor.ent.coprime.frac-red}Let $r\in\mathbb{Q}$. Then, there exist two
\textbf{coprime} integers $a$ and $b$ satisfying $r=a/b$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.coprime.frac-red}.]Write $r$ as $r=x/y$ for
some integers $x$ and $y$ (with $y\neq0$). Apply Proposition
\ref{prop.ent.coprime.div-away} to $a=x$ and $b=y$. (Details are found in
\cite[solution to Exercise 2.10.14]{19s}.)
\end{proof}

Corollary \ref{cor.ent.coprime.frac-red} is commonly stated in the form
\textquotedblleft any rational number can be represented as a reduced
fraction\textquotedblright. Here, \textquotedblleft%
\href{https://en.wikipedia.org/wiki/Irreducible_fraction}{reduced
fraction}\textquotedblright\ means a fraction in which the numerator and the
denominator are coprime integers. (Such fractions are also known as
\textquotedblleft irreducible fractions\textquotedblright\ or
\textquotedblleft fractions in lowest terms\textquotedblright.)

\subsubsection{The rational root test}

\begin{exercise}
\label{exe.ent.coprime.in-pairs-but-not-all}Find three integers $x$, $y$ and
$z$ such that $\gcd\left(  x,y,z\right)  =1$, yet no two of $x$, $y$ and $z$
are coprime.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.coprime.in-pairs-but-not-all}
(sketched).]Computer experiments quickly reveal that $x=6$, $y=10$ and $z=15$
is an answer. Indeed, $\gcd\left(  6,10,15\right)  =1$, yet no two of $6$,
$10$ and $15$ are coprime (since $\gcd\left(  6,10\right)  =2\neq1$ and
$\gcd\left(  6,15\right)  =3\neq1$ and $\gcd\left(  10,15\right)  =5\neq1$).

This can be found without a computer. The trick is to find three integers $a$,
$b$ and $c$ that are mutually coprime (i.e., any two of $a$, $b$ and $c$ are
coprime) and greater than $1$, and then set $x=bc$, $y=ca$ and $z=ab$. Then,
these integers $x$, $y$ and $z$ satisfy
\begin{align*}
\gcd\left(  x,y\right)   &  =\gcd\left(  bc,ca\right)  =\gcd\left(
ca,bc\right)  =\gcd\left(  ca,cb\right) \\
&  =\left\vert c\right\vert \underbrace{\gcd\left(  a,b\right)  }%
_{\substack{=1\\\text{(since any two of }a\text{, }b\text{ and }c\\\text{are
coprime)}}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem
\ref{thm.ent.gcd.sa,sb}}\right) \\
&  =\left\vert c\right\vert =c\ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
c>1\geq0\right) \\
&  >1
\end{align*}
and similarly $\gcd\left(  y,z\right)  >1$ and $\gcd\left(  z,x\right)  >1$
(which shows that no two of $x$, $y$ and $z$ are coprime), but also%
\begin{align*}
\gcd\left(  x,y,z\right)   &  =\gcd\left(  \underbrace{\gcd\left(  x,y\right)
}_{=c},\underbrace{\gcd\left(  z\right)  }_{\substack{=z\\\text{(by
Proposition \ref{prop.ent.gcd.props1} \textbf{(a)})}}}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.ent.gcd.split}}\right)
\\
&  =\gcd\left(  c,\underbrace{z}_{=ab}\right)  =\gcd\left(  c,ab\right)  =1
\end{align*}
(since Theorem \ref{thm.ent.coprime.ab-to-c} yields $ab\perp c$). Thus, in
order to solve the exercise, it remains to find three integers $a$, $b$ and
$c$ that are mutually coprime and greater than $1$. But this is easy -- for
example, one can take $a=5$ and $b=3$ and $c=2$. Taking these yields $x=6$,
$y=10$ and $z=15$, which is our above example.
\end{proof}

Another application of coprime integers is the following fact (known as the
\textit{rational root test}):

\begin{theorem}
\label{thm.ent.rat-root-test}Let $P\left(  x\right)  =a_{n}x^{n}%
+a_{n-1}x^{n-1}+\cdots+a_{0}x^{0}$ be a polynomial in a single variable $x$
with integer coefficients (i.e., all of $a_{0},a_{1},\ldots,a_{n}$ are
integers). Let $r$ be a rational root of $P\left(  x\right)  $ (that is, a
rational number satisfying $P\left(  r\right)  =0$). Write $r$ in the form
$r=p/q$ for some integers $p$ and $q$ satisfying $p\perp q$. Then, $p\mid
a_{0}$ and $q\mid a_{n}$.
\end{theorem}

\begin{remark}
Theorem \ref{thm.ent.rat-root-test} provides an algorithm for finding all
rational roots of a polynomial with integer coefficients. Indeed, let
$P\left(  x\right)  =a_{n}x^{n}+a_{n-1}x^{n-1}+\cdots+a_{0}x^{0}$ be such a
polynomial. We can WLOG assume that $a_{n}\neq0$ (otherwise, we throw away the
$a_{n}x^{n}$ term and replace $n$ by $n-1$) and that $a_{0}\neq0$ (otherwise,
we record $0$ as a root of our polynomial and divide $P\left(  x\right)  $ by
$x$). Any rational root $r$ of $P\left(  x\right)  $ can be written in the
form $r=p/q$ for some integers $p$ and $q$ satisfying $p\perp q$ (by Corollary
\ref{cor.ent.coprime.frac-red}). Writing it in this form, we then conclude
from Theorem \ref{thm.ent.rat-root-test} that $p\mid a_{0}$ and $q\mid a_{n}$.
But $p\mid a_{0}$ yields only finitely many options for $p$ (since $a_{0}$ is
nonzero and thus has only finitely many divisors), and $q\mid a_{n}$ yields
only finitely many options for $q$ (since $a_{n}$ is nonzero and thus has only
finitely many divisors). Thus, we have only finitely many options for $r$
(since $r=p/q$). By listing all these options and checking which of them
actually satisfy $P\left(  r\right)  =0$, we can identify all rational roots
of $P\left(  x\right)  $. (Note that divisors of a positive integer can be
negative; however, we can WLOG assume that $q>0$ because otherwise we can
replace $p$ and $q$ by $-p$ and $-q$.)
\end{remark}

\begin{proof}
[Proof of Theorem \ref{thm.ent.rat-root-test}.]We have $P\left(  r\right)  =0$
(since $r$ is a root of $P\left(  x\right)  $), thus%
\begin{align*}
0  &  =P\left(  r\right)  =P\left(  p/q\right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{since }r=p/q\right) \\
&  =a_{n}\left(  p/q\right)  ^{n}+a_{n-1}\left(  p/q\right)  ^{n-1}%
+\cdots+a_{0}\left(  p/q\right)  ^{0}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }P\left(  x\right)  =a_{n}%
x^{n}+a_{n-1}x^{n-1}+\cdots+a_{0}x^{0}\right) \\
&  =a_{n}\cdot\dfrac{p^{n}}{q^{n}}+a_{n-1}\cdot\dfrac{p^{n-1}}{q^{n-1}}%
+\cdots+a_{0}\cdot\dfrac{p^{0}}{q^{0}}\\
&  =\dfrac{1}{q^{n}}\left(  a_{n}p^{n}+a_{n-1}p^{n-1}q+\cdots+a_{1}%
pq^{n-1}+a_{0}q^{n}\right)  .
\end{align*}
Multiplying both sides of this equality by $q^{n}$, we find%
\begin{equation}
0=a_{n}p^{n}+a_{n-1}p^{n-1}q+\cdots+a_{1}pq^{n-1}+a_{0}q^{n}.
\label{pf.thm.ent.rat-root-test.1}%
\end{equation}


Solving the equation (\ref{pf.thm.ent.rat-root-test.1}) for $a_{0}q^{n}$, we
find%
\begin{align*}
a_{0}q^{n}  &  =-\left(  a_{n}p^{n}+a_{n-1}p^{n-1}q+\cdots+a_{1}%
pq^{n-1}\right) \\
&  =-p\left(  a_{n}p^{n-1}+a_{n-1}p^{n-2}q+\cdots+a_{1}q^{n-1}\right)  .
\end{align*}
Thus, $-p\mid a_{0}q^{n}$ (since $a_{n}p^{n-1}+a_{n-1}p^{n-2}q+\cdots
+a_{1}q^{n-1}$ is an integer). Hence, $p\mid-p\mid a_{0}q^{n}=q^{n}a_{0}$.

But $p\perp q$. Hence, Exercise \ref{exe.ent.coprime.powers} (applied to $p$,
$q$, $1$ and $n$ instead of $a$, $b$, $n$ and $m$) yields $p^{1}\perp q^{n}$.
In other words, $p\perp q^{n}$. Hence, Theorem \ref{thm.ent.coprime.cancel}
(applied to $p$, $q^{n}$ and $a_{0}$ instead of $a$, $b$ and $c$) yields
$p\mid a_{0}$ (since $p\mid q^{n}a_{0}$).

The proof of $q\mid a_{n}$ is similar: Solving the equation
(\ref{pf.thm.ent.rat-root-test.1}) for $a_{n}p^{n}$, we find%
\begin{align*}
a_{n}p^{n}  &  =-\left(  a_{n-1}p^{n-1}q+\cdots+a_{1}pq^{n-1}+a_{0}%
q^{n}\right) \\
&  =-q\left(  a_{n-1}p^{n-1}+\cdots+a_{1}pq^{n-2}+a_{0}q^{n-1}\right)  .
\end{align*}
Thus, $-q\mid a_{n}p^{n}$ (since $a_{n-1}p^{n-1}+\cdots+a_{1}pq^{n-2}%
+a_{0}q^{n-1}$ is an integer). Hence, $q\mid-q\mid a_{n}p^{n}=p^{n}a_{n}$.

But $p\perp q$. Hence, Exercise \ref{exe.ent.coprime.powers} (applied to $p$,
$q$, $n$ and $1$ instead of $a$, $b$, $n$ and $m$) yields $p^{n}\perp q^{1}$.
In other words, $p^{n}\perp q$. By Proposition
\ref{prop.ent.coprime.perp-symm}, this yields $q\perp p^{n}$. Hence, Theorem
\ref{thm.ent.coprime.cancel} (applied to $q$, $p^{n}$ and $a_{n}$ instead of
$a$, $b$ and $c$) yields $q\mid a_{n}$ (since $q\mid p^{n}a_{n}$).

Thus, Theorem \ref{thm.ent.rat-root-test} is proved.
\end{proof}

\begin{corollary}
\label{cor.ent.int-root-test}Let $P\left(  x\right)  =a_{n}x^{n}%
+a_{n-1}x^{n-1}+\cdots+a_{0}x^{0}$ be a polynomial in a single variable $x$
with integer coefficients (i.e., all of $a_{0},a_{1},\ldots,a_{n}$ are
integers). Let $r$ be an integer root of $P\left(  x\right)  $ (that is, an
integer satisfying $P\left(  r\right)  =0$). Then, $r\mid a_{0}$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.int-root-test}.]We have $r=r/1$ and $r\perp
1$. Hence, Theorem \ref{thm.ent.rat-root-test} (applied to $p=r$ and $q=1$)
yields $r\mid a_{0}$ and $1\mid a_{n}$. Corollary \ref{cor.ent.int-root-test}
is thus proved.
\end{proof}

\begin{corollary}
\label{cor.ent.int-root-test-monic}Let $P\left(  x\right)  =a_{n}x^{n}%
+a_{n-1}x^{n-1}+\cdots+a_{0}x^{0}$ be a polynomial in a single variable $x$
with integer coefficients (i.e., all of $a_{0},a_{1},\ldots,a_{n}$ are
integers) and with $a_{n}=\pm1$. Let $r$ be a rational root of $P\left(
x\right)  $ (that is, a rational number satisfying $P\left(  r\right)  =0$).
Then, $r$ is an integer and satisfies $r\mid a_{0}$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.int-root-test}.]Corollary
\ref{cor.ent.coprime.frac-red} yields that there exist two \textbf{coprime}
integers $a$ and $b$ satisfying $r=a/b$. Consider these $a$ and $b$, and
denote them by $p$ and $q$. Thus, $p$ and $q$ are two coprime integers
satisfying $r=p/q$. Hence, $p\perp q$ (since $p$ and $q$ are coprime). Thus,
Theorem \ref{thm.ent.rat-root-test} yields $p\mid a_{0}$ and $q\mid a_{n}$.
However, from $a_{n}=\pm1$, we obtain $a_{n}\mid1$, so that $q\mid a_{n}\mid1$
and therefore $q=\pm1$ (since the only divisors of $1$ are $1$ and $-1$).
Thus, $r=p/\underbrace{q}_{=\pm1}=p/\left(  \pm1\right)  =\pm p\in\mathbb{Z}$
(since $p\in\mathbb{Z}$). In other words, $r$ is an integer. Moreover, from
$r=\pm p$, we obtain $r\mid p\mid a_{0}$. Thus, the proof of Corollary
\ref{cor.ent.int-root-test-monic} is complete.
\end{proof}

We state another property of gcds and coprimality, which will come useful in
an exercise later on:

\begin{proposition}
\label{prop.ent.coprime.gcd=gcd}Let $a,b,c\in\mathbb{Z}$ satisfy $a\perp c$.
Then, $\gcd\left(  a,bc\right)  =\gcd\left(  a,b\right)  $.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.coprime.gcd=gcd}.]Proposition
\ref{prop.ent.gcd.props1} \textbf{(f)} (applied to $bc$ instead of $b$) yields
$\gcd\left(  a,bc\right)  \mid a$ and $\gcd\left(  a,bc\right)  \mid bc$.
Proposition \ref{prop.ent.coprime.div} (applied to $a_{1}=\gcd\left(
a,bc\right)  $, $a_{2}=c$, $b_{1}=a$ and $b_{2}=c$) yields $\gcd\left(
a,bc\right)  \perp c$ (since $\gcd\left(  a,bc\right)  \mid a$ and $c\mid c$
and $a\perp c$).

We have $\gcd\left(  a,bc\right)  \mid bc=cb$ and $\gcd\left(  a,bc\right)
\perp c$. Hence, Theorem \ref{thm.ent.coprime.cancel} (applied to $\gcd\left(
a,bc\right)  $, $c$ and $b$ instead of $a$, $b$ and $c$) yields $\gcd\left(
a,bc\right)  \mid b$.

But Theorem \ref{thm.ent.gcd.uniprop} (applied to $m=\gcd\left(  a,bc\right)
$) shows that we have the following logical equivalence:%
\[
\left(  \gcd\left(  a,bc\right)  \mid a\ \text{and }\gcd\left(  a,bc\right)
\mid b\right)  \ \Longleftrightarrow\ \left(  \gcd\left(  a,bc\right)
\mid\gcd\left(  a,b\right)  \right)  .
\]
Hence, we have $\gcd\left(  a,bc\right)  \mid\gcd\left(  a,b\right)  $ (since
we have $\gcd\left(  a,bc\right)  \mid a\ $and $\gcd\left(  a,bc\right)  \mid
b$).

On the other hand, $a\mid a$ and $b\mid bc$. Hence, Proposition
\ref{prop.ent.gcd.div} (applied to $a_{1}=a$, $a_{2}=b$, $b_{1}=a$ and
$b_{2}=bc$) yields%
\[
\gcd\left(  a,b\right)  \mid\gcd\left(  a,bc\right)  .
\]
Recall also that $\gcd\left(  a,bc\right)  \mid\gcd\left(  a,b\right)  $.
Thus, Proposition \ref{prop.ent.div.1} \textbf{(c)} (applied to $\gcd\left(
a,bc\right)  $ and $\gcd\left(  a,b\right)  $ instead of $a$ and $b$) yields
$\left\vert \gcd\left(  a,bc\right)  \right\vert =\left\vert \gcd\left(
a,b\right)  \right\vert $. But a gcd is always a nonnegative integer (by
Proposition \ref{prop.ent.gcd.pos} \textbf{(a)}); thus, both $\gcd\left(
a,bc\right)  $ and $\gcd\left(  a,b\right)  $ are nonnegative integers, and
therefore satisfy $\left\vert \gcd\left(  a,bc\right)  \right\vert
=\gcd\left(  a,bc\right)  $ and $\left\vert \gcd\left(  a,b\right)
\right\vert =\gcd\left(  a,b\right)  $. Hence, $\gcd\left(  a,bc\right)
=\left\vert \gcd\left(  a,bc\right)  \right\vert =\left\vert \gcd\left(
a,b\right)  \right\vert =\gcd\left(  a,b\right)  $. This proves Proposition
\ref{prop.ent.coprime.gcd=gcd}.
\end{proof}

\subsection{\label{sect.ent.lcm}Lowest common multiples}

The notion of a \textit{lowest common multiple} is, so to speak, an
\textquotedblleft upside-down\textquotedblright\ counterpart to the notion of
a greatest common divisor. We shall restrict ourselves to defining this notion
and stating its most important properties.

First, we define the notion of a common multiple:

\begin{definition}
\label{def.ent.Mul}Let $b_{1},b_{2},\ldots,b_{k}$ be integers. Then, the
\textit{common multiples} of $b_{1},b_{2},\ldots,b_{k}$ are defined to be the
integers $a$ that satisfy%
\[
\left(  b_{i}\mid a\text{ for all }i\in\left\{  1,2,\ldots,k\right\}  \right)
.
\]
(In other words, a \textit{common multiple} of $b_{1},b_{2},\ldots,b_{k}$ is
an integer that is a multiple of each of $b_{1},b_{2},\ldots,b_{k}$.)
\end{definition}

For example, the common multiples of the two integers $6,9$ are \newline%
$\ldots,-54,-36,-18,0,18,36,54,\ldots$, that is, all multiples of $18$.
Clearly, if $b_{1},b_{2},\ldots,b_{k}$ are $k$ integers, then the product
$b_{1}b_{2}\cdots b_{k}$ is a common multiple of $b_{1},b_{2},\ldots,b_{k}$
(and so is any multiple of this product, including the number $0$).

Now, we can define the \textit{lowest common multiple} of $k$ integers
$b_{1},b_{2},\ldots,b_{k}$. This concept is a bit of a misnomer, since the
word \textquotedblleft lowest\textquotedblright\ is not to be taken literally;
to be more precise, it should be called \textquotedblleft lowest positive
common multiple\textquotedblright\ (and even this would be wrong when one of
$b_{1},b_{2},\ldots,b_{k}$ is $0$). So here is the rigorous definition of the
lowest common multiple:

\begin{definition}
\label{def.ent.lcm.lcm}Let $b_{1},b_{2},\ldots,b_{k}$ be finitely many
integers. The \textit{lowest common multiple} (also known as the \textit{least
common multiple}, or, for short, the \textit{lcm}) of $b_{1},b_{2}%
,\ldots,b_{k}$ is the nonnegative integer $\operatorname{lcm}\left(
b_{1},b_{2},\ldots,b_{k}\right)  $ defined as follows:

\begin{itemize}
\item If $b_{1},b_{2},\ldots,b_{k}$ are all nonzero, then it is defined as the
smallest \textbf{positive} common multiple of $b_{1},b_{2},\ldots,b_{k}$. (It
is easy to see that this is well-defined\footnotemark.)

\item If $b_{1},b_{2},\ldots,b_{k}$ are not all nonzero (i.e., at least one of
$b_{1},b_{2},\ldots,b_{k}$ is zero), then it is defined to be $0$.
\end{itemize}
\end{definition}

\footnotetext{\textit{Proof.} Assume that $b_{1},b_{2},\ldots,b_{k}$ are
nonzero. Then, the product $b_{1}b_{2}\cdots b_{k}$ is nonzero, so that its
absolute value $\left\vert b_{1}b_{2}\cdots b_{k}\right\vert $ is a positive
integer. Moreover, $\left\vert b_{1}b_{2}\cdots b_{k}\right\vert $ is a common
multiple of $b_{1},b_{2},\ldots,b_{k}$ (indeed, each $i\in\left\{
1,2,\ldots,k\right\}  $ satisfies $b_{i}\mid b_{1}b_{2}\cdots b_{k}%
\mid\left\vert b_{1}b_{2}\cdots b_{k}\right\vert $ ). Hence, there exists at
least one positive common multiple of $b_{1},b_{2},\ldots,b_{k}$ (namely,
$\left\vert b_{1}b_{2}\cdots b_{k}\right\vert $). Hence, the set of all
positive common multiples of $b_{1},b_{2},\ldots,b_{k}$ is nonempty. Since
this set is a set of nonnegative integers, we thus conclude (using Theorem
\ref{thm.ext.exist.NN-min}) that it has a minimum. In other words, the
smallest \textbf{positive} common multiple of $b_{1},b_{2},\ldots,b_{k}$ is
well-defined.} For example, $\operatorname{lcm}\left(  6,9\right)  =18$ and
$\operatorname{lcm}\left(  3,5\right)  =15$ and $\operatorname{lcm}\left(
6,10,15\right)  =30$ and $\operatorname{lcm}\left(  2,4,0\right)  =0$.
Definition \ref{def.ent.lcm.lcm} immediately yields the following:

\begin{proposition}
\label{prop.ent.lcm.pos}Let $b_{1},b_{2},\ldots,b_{k}$ be finitely many integers.

\textbf{(a)} The number $\operatorname{lcm}\left(  b_{1},b_{2},\ldots
,b_{k}\right)  $ is a nonnegative integer.

\textbf{(b)} If $b_{1},b_{2},\ldots,b_{k}$ are all nonzero, then
$\operatorname{lcm}\left(  b_{1},b_{2},\ldots,b_{k}\right)  $ is a positive integer.
\end{proposition}

The following theorem (\cite[Theorem 2.11.6]{19s}) gives an alternative
characterization for lcms of two integers:

\begin{theorem}
\label{thm.ent.lcm.gcd*lcm}Let $a,b\in\mathbb{Z}$. Then, $\gcd\left(
a,b\right)  \cdot\operatorname{lcm}\left(  a,b\right)  =\left\vert
ab\right\vert $.
\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.ent.lcm.gcd*lcm}.](See \cite[Theorem
2.11.6]{19s} for the details.) We WLOG assume that $a\neq0$ and $b\neq0$
(since otherwise, our claim immediately boils down to $0=0$). Then, set
$c=\dfrac{ab}{\gcd\left(  a,b\right)  }$. It is now easy to see that $c$ is a
nonzero integer (since $\gcd\left(  a,b\right)  \mid a\mid ab$ and $ab\neq0$)
and is a common multiple of $a$ and $b$ (since $\gcd\left(  a,b\right)  \mid
b$ and $\gcd\left(  a,b\right)  \mid a$). Thus, $\left\vert c\right\vert $ is
a positive common multiple of $a$ and $b$ (indeed, $c\neq0$, so that
$\left\vert c\right\vert $ is positive).

On the other hand, the definition of $c$ yields $\gcd\left(  a,b\right)  \cdot
c=ab$. Now, if $x$ is any positive common multiple of $a$ and $b$, then
Theorem \ref{thm.ent.gcd.combine} (applied to $x$ instead of $c$) yields
$ab\mid\gcd\left(  a,b\right)  \cdot x$, so that $\gcd\left(  a,b\right)
\cdot c=ab\mid\gcd\left(  a,b\right)  \cdot x$ and therefore $c\mid x$ (here,
we have cancelled the nonzero factor $\gcd\left(  a,b\right)  $ from our
divisibility), which entails $x\geq\left\vert c\right\vert $. In other words,
any positive common multiple of $a$ and $b$ is $\geq\left\vert c\right\vert $.
Thus, $\left\vert c\right\vert $ is the \textbf{smallest} positive common
multiple of $a$ and $b$ (since we already know that $\left\vert c\right\vert $
is a positive common multiple of $a$ and $b$). In other words, $\left\vert
c\right\vert =\operatorname{lcm}\left(  a,b\right)  $. Hence,
\[
\operatorname{lcm}\left(  a,b\right)  =\left\vert c\right\vert =\left\vert
\dfrac{ab}{\gcd\left(  a,b\right)  }\right\vert =\dfrac{\left\vert
ab\right\vert }{\gcd\left(  a,b\right)  }%
\]
(since $\gcd\left(  a,b\right)  $ is positive), and this yields the claim of
Theorem \ref{thm.ent.lcm.gcd*lcm}.
\end{proof}

The lowest common multiple $\operatorname{lcm}\left(  a,b\right)  $ of two
integers $a$ and $b$ has a universal property analogous to that of the
greatest common divisor (Theorem \ref{thm.ent.gcd.uniprop}):

\begin{theorem}
\label{thm.ent.lcm.uniprop}Let $a,b\in\mathbb{Z}$ and $m\in\mathbb{Z}$. Then,
we have the following logical equivalence:%
\begin{equation}
\left(  a\mid m\ \text{and }b\mid m\right)  \ \Longleftrightarrow\ \left(
\operatorname{lcm}\left(  a,b\right)  \mid m\right)  .
\label{eq.thm.ent.lcm.uniprop.equiv}%
\end{equation}

\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.ent.lcm.uniprop}.](See \cite[Theorem
2.11.7 \textbf{(a)}]{19s} for the details.) We WLOG assume that $a\neq0$ and
$b\neq0$ (since otherwise, both sides of (\ref{eq.thm.ent.lcm.uniprop.equiv})
are equivalent to the statement \textquotedblleft$m=0$\textquotedblright\ and
therefore are equivalent to each other). Let $n=\operatorname{lcm}\left(
a,b\right)  $. Thus, $n$ is a positive integer. Now, our goal is to prove the
equivalence (\ref{eq.thm.ent.lcm.uniprop.equiv}). The \textquotedblleft%
$\Longleftarrow$\textquotedblright\ direction of this equivalence is easy (in
fact, if $\operatorname{lcm}\left(  a,b\right)  \mid m$, then $a\mid
\operatorname{lcm}\left(  a,b\right)  \mid m$ and $b\mid\operatorname{lcm}%
\left(  a,b\right)  \mid m$), so we only need to prove the \textquotedblleft%
$\Longrightarrow$\textquotedblright\ direction. To achieve this, we assume
that $a\mid m$ and $b\mid m$. Thus, $m$ is a common multiple of $a$ and $b$.
Therefore, the remainder $m\%n$ must also be a common multiple of $a$ and $b$
(why?). However, this remainder $m\%n$ belongs to $\left\{  0,1,\ldots
,n-1\right\}  $, and thus is either $0$ or a positive integer smaller than
$n$. However, as a common multiple of $a$ and $b$, it cannot be a positive
integer smaller than $n$ (because $n=\operatorname{lcm}\left(  a,b\right)  $
is the \textbf{smallest} positive common multiple of $a$ and $b$). Hence, it
must be $0$. In other words, $m\%n=0$. Equivalently, $n\mid m$, so that
$\operatorname{lcm}\left(  a,b\right)  =n\mid m$. This proves the
\textquotedblleft$\Longrightarrow$\textquotedblright\ direction of the
equivalence (\ref{eq.thm.ent.lcm.uniprop.equiv}); thus, our proof of Theorem
\ref{thm.ent.lcm.uniprop} is complete.
\end{proof}

Theorem \ref{thm.ent.lcm.uniprop} can be generalized to $k$ integers:

\begin{theorem}
\label{thm.ent.lcm.uniprop-mul}Let $k\in\mathbb{N}$, let $b_{1},b_{2}%
,\ldots,b_{k}\in\mathbb{Z}$ and $m\in\mathbb{Z}$. Then, we have the following
logical equivalence:%
\[
\left(  b_{i}\mid m\text{ for all }i\in\left\{  1,2,\ldots,k\right\}  \right)
\ \Longleftrightarrow\ \left(  \operatorname{lcm}\left(  b_{1},b_{2}%
,\ldots,b_{k}\right)  \mid m\right)  .
\]

\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.ent.lcm.uniprop-mul}.]This is a
straightforward adaptation of our proof of Theorem \ref{thm.ent.lcm.uniprop}.
\end{proof}

\begin{noncompile}
The following has been removed since I cannot currently make it fit well in
this chapter.

subsection: Base-$b$ and Zeckendorf representations

One application of division with remainder is so fundamental to the way we do
mathematics that we often forget that it is more than a tautology: the fact
that every nonnegative integer can be represented in base $b$ for any integer
$b>1$. In particular, for $b=10$, this is the decimal (base-$10$)
representation known from grade school. I will now define it rigorously and
prove its existence and uniqueness; then I will move on to a similar (but less
known) representation using the Fibonacci sequence.

\begin{definition}
\textbf{(a)} A \textit{tuple} means a finite list (i.e., an $n$-tuple for some
$n\in\mathbb{N}$).

\textbf{(b)} Let $b$ be a positive integer. A \textit{base-}$b$%
\textit{-string} means a tuple whose entries belong to $\left\{
0,1,\ldots,b-1\right\}  $. We shall write base-$b$-strings without parentheses
and without commas -- i.e., we will write a base-$b$-string $\left(
a_{1},a_{2},\ldots,a_{m}\right)  $ as $a_{1}a_{2}\cdots a_{m}$ (hoping that
the reader will not mistake this notation for a product).

\textbf{(c)} Let $b$ be a positive integer. A base-$b$-string is said to be
\textit{reduced} if it does not begin with a $0$ (that is, if it is either
empty or its first entry is distinct from $0$).

\textbf{(d)} Let $b$ be a positive integer, and let $a_{k}a_{k-1}\cdots a_{0}$
be a base-$b$-string (possibly empty, in which case we set $k=-1$). Then, we
define a nonnegative integer $\left[  a_{k}a_{k-1}\cdots a_{0}\right]  _{b}$
by%
\[
\left[  a_{k}a_{k-1}\cdots a_{0}\right]  _{b}=\sum_{i=0}^{k}a_{i}b^{i}.
\]
(For the empty base-$b$-string, this becomes $\left[  {}\right]  _{b}=\left(
\text{empty sum}\right)  =0$.)

This integer $\left[  a_{k}a_{k-1}\cdots a_{0}\right]  _{b}$ is said to be
\textit{represented by the base-}$b$\textit{-string }$a_{k}a_{k-1}\cdots
a_{0}$ \textit{in base }$b$.
\end{definition}

Now we can state the main theorem about base-$b$ representations of
nonnegative integers:

\begin{theorem}
\label{thm.ent.base-b.main}Let $b>1$ be an integer. Let $n\in\mathbb{N}$.
Then, there is a unique reduced base-$b$-string $a_{k}a_{k-1}\cdots a_{0}$
such that $\left[  a_{k}a_{k-1}\cdots a_{0}\right]  _{b}=n$.
\end{theorem}

\begin{example}
\textbf{(a)} The base-$2$-string $1101$ represents the number $7$ in base $2$,
since%
\[
\left[  1101\right]  _{2}=1\cdot2^{0}+0\cdot2^{1}+1\cdot2^{1}+1\cdot2^{2}=7.
\]


\textbf{(b)} The base-$3$-string $1220$ represents the number $51$ in base
$3$, since%
\[
\left[  1220\right]  _{3}=0\cdot3^{0}+2\cdot3^{1}+2\cdot3^{2}+1\cdot3^{3}=51.
\]


\textbf{(c)} The base-$10$-string $39042$ represents the number $39042$ in
base $10$, which is not surprising since the base-$10$-string representing a
number is precisely how we represent a number since grade school.
\end{example}

\begin{proof}
[Proof of Theorem \ref{thm.ent.base-b.main}.]We proceed by strong induction on
$n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Theorem \ref{thm.ent.base-b.main} holds for all $n<m$. We
must prove that Theorem \ref{thm.ent.base-b.main} holds for $n=m$.

..........
\end{proof}
\end{noncompile}

We end our first dive into number theory here, but we shall come back to it a
few more times during this course. One last comment at this point: It is
commonly believed that number theory quickly starts requiring advanced
mathematics (analysis, geometry, abstract algebra) as one goes beyond the
basics. This is not true; there are several books full of beautiful results
treated with elementary means (\cite{Stein09}, \cite{UspHea39},
\cite{NiZuMo91}; see also \cite{AnDoMu17} for a text specifically targeted at
olympiad problems). There also are miraculous applications accessible at the
most basic level, such as the RSA cryptosystem; as these are nowadays treated
in most courses on abstract algebra or cryptography, I shall not discuss them here.

\subsection{\label{sect.hw1}Homework set \#1: Induction and number theory}

This is a \textbf{regular} problem set. Each problem will be graded out of 10
points based on correctness and readability. You don't need to motivate your
proofs, but they should be readable to a reasonably competent reader (say, to
your fellow students).

The topic of this homework set is induction and elementary number theory; this
means that several (but not all!) of its problems are about these topics.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.lac.size}Let $k$ be a positive integer. A set $S$ of integers is
said to be $k$\textit{-lacunar} if every two distinct elements $u,v\in S$
satisfy $\left\vert u-v\right\vert \geq k$. (Thus, a $2$-lacunar set is the
same as a lacunar set as defined in Definition \ref{def.fib.lac}.)

Let $n\in\mathbb{N}$. Let $S$ be a $k$-lacunar subset of $\left\{
1,2,\ldots,n\right\}  $. Prove that%
\[
\left\vert S\right\vert \leq\dfrac{n+k-1}{k}.
\]


(Thus, in particular, if $S$ is a lacunar subset of $\left\{  1,2,\ldots
,n\right\}  $, then $\left\vert S\right\vert \leq\dfrac{n+1}{2}$.)
\end{exercise}

\begin{exercise}
\label{exe.fib.gcd-nbr}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Prove that any $n,m\in\mathbb{N}$ satisfy%
\[
\gcd\left(  f_{n},f_{m}\right)  =f_{\gcd\left(  n,m\right)  }.
\]

\end{exercise}

\begin{exercise}
\label{exe.ent.fermat-num.1}Let $\left(  F_{0},F_{1},F_{2},\ldots\right)  $ be
the \textit{Fermat sequence} -- that is, the sequence of integers defined by%
\[
F_{n}=2^{2^{n}}+1\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]
(Keep in mind that nested powers are to be read top-to-bottom: That is, the
expression \textquotedblleft$a^{b^{c}}$\textquotedblright\ means $a^{\left(
b^{c}\right)  }$ rather than $\left(  a^{b}\right)  ^{c}$.)

\textbf{(a)} Prove that
\[
F_{n}=F_{0}F_{1}\cdots F_{n-1}+2\ \ \ \ \ \ \ \ \ \ \text{for every integer
}n\geq0.
\]


\textbf{(b)} Prove that $\gcd\left(  F_{n},F_{m}\right)  =1$ for any two
distinct nonnegative integers $n$ and $m$.
\end{exercise}

\begin{exercise}
\label{exe.fac.reddit-odd1}Prove that there exist \textbf{infinitely many}
\textbf{odd} positive integers $n$ for which
\[
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{\left(  n+1\right)
!}\text{ is a perfect square.}%
\]

\end{exercise}

\begin{exercise}
\label{exe.floor.hermite-m}Let $x\in\mathbb{R}$. Let $n$ and $m$ be positive
integers. Prove that%
\[
\sum_{k=0}^{mn-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor =m\left(
\left\lfloor nx\right\rfloor +\dfrac{n\left(  m-1\right)  }{2}\right)  .
\]

\end{exercise}

\begin{exercise}
\label{exe.fib.mod5}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Prove that each nonnegative integer $n$ satisfies
\[
f_{n}\equiv f_{n\%5}\cdot3^{n//5}\operatorname{mod}5.
\]
(See Definition \ref{def.ent.quorem} for the notations used here.)
\end{exercise}

\begin{exercise}
\label{exe.ent.gcd.diff-pos}Let $a$ and $b$ be two \textbf{positive} integers.
Prove that there exist \textbf{positive} integers $x$ and $y$ such that%
\[
\gcd\left(  a,b\right)  =xa-yb.
\]

\end{exercise}

\begin{exercise}
\label{exe.ent.bases.balter}Prove that any positive integer $a$ can be
uniquely expressed in the form%
\[
a=3^{m}+b_{m-1}3^{m-1}+b_{m-2}3^{m-2}+\cdots+b_{0}3^{0}%
\]
where $m$ is a nonnegative integer, and where $b_{0},b_{1},\ldots,b_{m-1}%
\in\left\{  0,1,-1\right\}  $. (This is called the \textit{balanced ternary
representation}.)
\end{exercise}

\begin{exercise}
\label{exe.ind.engel-8-26}Let $p,q,m,n\in\mathbb{N}$ with $p\leq m$ and $q\leq
n$. Consider an $m\times n$-table $T$ of integers, with all entries distinct.
In each column of $T$, we mark the $p$ largest entries with a \textit{cyan}
marker. In each row of $T$, we mark the $q$ largest entries with a
\textit{red} marker. Prove that at least $pq$ entries of $T$ are marked twice
(i.e., with both colors).

[\textbf{Example:} Let $p=2$ and $q=2$ and $m=3$ and $n=3$ and
\[
T=\left(
\begin{array}
[c]{ccc}%
1 & 2 & 9\\
4 & 3 & 8\\
5 & 6 & 7
\end{array}
\right)  .
\]
Then,
\begin{align*}
&  \text{the cyan entries are }4,5,3,6,8,9,\text{ while}\\
&  \text{the red entries are }2,9,4,8,6,7.
\end{align*}
Thus, the entries $4,6,8,9$ are marked twice. This is exactly the $pq$ entries
claimed in the exercise. You can easily find situations in which there are
more than $pq$ doubly-marked entries.]
\end{exercise}

\begin{exercise}
\label{exe.ind.01-100}A \textit{bitstring} shall mean a finite sequence
consisting of $0$'s and $1$'s. (This is what we called an \textquotedblleft%
$n$-bitstring\textquotedblright\ in Exercise \ref{exe.graycode.exists}, except
that the length is no longer fixed.) We shall write our bitstrings without
commas and parentheses -- i.e., we shall simply write $a_{1}a_{2}\cdots a_{n}$
for the bitstring $\left(  a_{1},a_{2},\ldots,a_{n}\right)  $.

Bitstrings can be transformed by \textit{moves}. In each \textit{move}, you
pick two consecutive entries $01$ in the bitstring (appearing in this order),
and replace them by three consecutive entries $100$ (in this order). In other
words, in each, move you replace a bitstring of the form $\ldots01\ldots$ by
$\ldots100\ldots$, where the two \textquotedblleft$\ldots$\textquotedblright%
\ parts stay unchanged. For example, here is a move:%
\[
011\underline{01}101\rightarrow011\underline{100}101
\]
(where we are using an underscore to mark the place where the move is
happening). Here is a sequence of moves:%
\[
01\underline{01}\rightarrow\underline{01}100\rightarrow10\underline{01}%
00\rightarrow1\underline{01}0000\rightarrow11000000
\]
(where we are putting an underscore under the position of the next move). Note
that the last bitstring in this sequence has no two consecutive entries $01$
any more, and thus no more moves can be applied to it.

\textbf{(a)} Prove that there are no infinite sequences of moves. That is, if
you start with a bitstring $a$, then any sequence of moves that can be applied
successively must have an end.

\textbf{(b)} A bitstring shall be called \textit{immovable} if no move can be
applied to it. Part \textbf{(a)} shows that, starting with any bitstring $a$,
we can always reach an immovable bitstring by performing moves until no more
moves are possible. Prove that this immovable bitstring is uniquely determined
by $a$ -- that is, no matter how you perform the moves, the immovable
bitstring that results at the end will be the same. Moreover, the number of
moves needed to reach the immovable bitstring will be the same.
\end{exercise}

\subsection{Recitation \#2: Coprimality and more number theory}

We shall now discuss a sample of exercises related to divisibility and coprimality.

The following exercise is essentially Problem 1 from the 1st International
Mathematical Olympiad 1959:

\begin{exercise}
\label{exe.ent.IMO1959P1}Let $n\in\mathbb{Z}$. Prove that $21n+4\perp14n+3$.
\end{exercise}

We shall give two solutions for this exercise:

\begin{proof}
[First solution to Exercise \ref{exe.ent.IMO1959P1}.]We shall apply
Proposition \ref{prop.ent.gcd.props1} similarly to how it is employed in the
Euclidean algorithm -- using Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} to interchange the two arguments in $\gcd\left(  a,b\right)  $,
and using Proposition \ref{prop.ent.gcd.props1} \textbf{(c)} to subtract a
multiple of the first argument from the second in $\gcd\left(  a,b\right)  $.
We perform these operations in such a way that the two arguments gradually get simpler.

Here is how this looks like:%
\begin{align*}
&  \gcd\left(  21n+4,14n+3\right) \\
&  =\gcd\left(  14n+3,\underbrace{21n+4}_{=1\cdot\left(  14n+3\right)
+\left(  7n+1\right)  }\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =\gcd\left(  14n+3,1\cdot\left(  14n+3\right)  +\left(  7n+1\right)
\right) \\
&  =\gcd\left(  14n+3,7n+1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.gcd.props1}
\textbf{(c)}, applied to }a=14n+3\text{, }b=7n+1\text{ and }u=1\right) \\
&  =\gcd\left(  7n+1,\underbrace{14n+3}_{=2\cdot\left(  7n+1\right)
+1}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition
\ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =\gcd\left(  7n+1,2\cdot\left(  7n+1\right)  +1\right) \\
&  =\gcd\left(  7n+1,1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.gcd.props1}
\textbf{(c)}, applied to }a=7n+1\text{, }b=1\text{ and }u=2\right) \\
&  =\gcd\left(  1,7n+1\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =1
\end{align*}
(since Exercise \ref{exe.ent.coprime.01} \textbf{(a)} yields $1\perp7n+1$ and
thus $\gcd\left(  1,7n+1\right)  =1$). In other words, $21n+4\perp14n+3$. This
solves Exercise \ref{exe.ent.IMO1959P1}.
\end{proof}

A second solution to Exercise \ref{exe.ent.IMO1959P1} can be given using the
following converse of Bezout's theorem:

\begin{proposition}
\label{prop.ent.bezout-conv}Let $a$, $b$, $x$ and $y$ be four integers. Then:

\textbf{(a)} We have $\gcd\left(  a,b\right)  \mid xa+yb$.

\textbf{(b)} If $xa+yb=1$, then $a\perp b$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.bezout-conv}.]\textbf{(a)} Let
$g=\gcd\left(  a,b\right)  $. Thus, $g=\gcd\left(  a,b\right)  \mid a$ (by
Proposition \ref{prop.ent.gcd.props1} \textbf{(f)}), so that $a\equiv
0\operatorname{mod}g$. Similarly, $b\equiv0\operatorname{mod}g$. Now,
$x\underbrace{a}_{\equiv0\operatorname{mod}g}+y\underbrace{b}_{\equiv
0\operatorname{mod}g}\equiv x\cdot0+y\cdot0=0\operatorname{mod}g$. In other
words, $g\mid xa+yb$. In other words, $\gcd\left(  a,b\right)  \mid xa+yb$
(since $g=\gcd\left(  a,b\right)  $). This proves Proposition
\ref{prop.ent.bezout-conv} \textbf{(a)}.

\textbf{(b)} We know (from Proposition \ref{prop.ent.gcd.pos} \textbf{(a)})
that $\gcd\left(  a,b\right)  $ is a nonnegative integer. But Proposition
\ref{prop.ent.bezout-conv} \textbf{(a)} yields $\gcd\left(  a,b\right)  \mid
xa+yb=1$. Thus, $\gcd\left(  a,b\right)  $ is a divisor of $1$, and therefore
a nonnegative divisor of $1$ (since $\gcd\left(  a,b\right)  $ is
nonnegative). But the only nonnegative divisor of $1$ is $1$ itself. Hence, we
conclude that $\gcd\left(  a,b\right)  =1$. In other words, $a\perp b$. This
proves Proposition \ref{prop.ent.bezout-conv} \textbf{(b)}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ent.IMO1959P1}.]We have $\left(
-2\right)  \cdot\left(  21n+4\right)  +3\cdot\left(  14n+3\right)  =1$. Hence,
Proposition \ref{prop.ent.bezout-conv} \textbf{(b)} (applied to $a=21n+4$,
$x=-2$, $b=14n+3$ and $y=3$) yields $21n+4\perp14n+3$. This solves Exercise
\ref{exe.ent.IMO1959P1} again.
\end{proof}

This second solution to Exercise \ref{exe.ent.IMO1959P1} is slick, but how
could we have found it? The answer turns out to be \textquotedblleft pretty
easily, once we made up our mind to apply Proposition
\ref{prop.ent.bezout-conv} \textbf{(b)}\textquotedblright. Indeed, in order to
prove $21n+4\perp14n+3$ using Proposition \ref{prop.ent.bezout-conv}
\textbf{(b)}, it is necessary to find two integers $x$ and $y$ that satisfy
$x\cdot\left(  21n+4\right)  +y\cdot\left(  14n+3\right)  =1$. In theory,
these $x$ and $y$ could depend on $n$, but the first thing you should try are
constants. So you are looking for two (constant) integers $x$ and $y$ that
satisfy $x\cdot\left(  21n+4\right)  +y\cdot\left(  14n+3\right)  =1$ for each
$n\in\mathbb{Z}$. But this boils down to a system of infinitely many linear
equations in $x$ and $y$ (one for each $n$); any two of them determine $x$ and
$y$ uniquely. Solving the system thus yields $x=-2$ and $y=3$, which is
exactly the two numbers used in the solution above.

Here is another little exercise:

\begin{exercise}
\label{exe.ent.phi.ghosts}You have a corridor with $1000$ lamps, which are
initially all off. Each lamp has a light switch controlling its state.

Every night, a ghost glides through the corridor (always in the same
direction) and flips some of the switches:

On the $1$st night, the ghost flips every switch.

On the $2$nd night, the ghost flips switches $2,4,6,8,10,\ldots$.

On the $3$rd night, the ghost flips switches $3,6,9,12,15,\ldots$.

etc.

(That is: For each $k\in\left\{  1,2,\ldots,1000\right\}  $, the ghost spends
the $k$-th night flipping switches $k,2k,3k,\ldots$.)

Which lamps will be on after $1000$ nights?
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.phi.ghosts}.]Let us first make the
problem more manageable by focussing on a single lamp. So let us fix some
$m\in\left\{  1,2,\ldots,1000\right\}  $ and find out whether lamp $m$ is on
after $1000$ nights.

Indeed, switch $m$ gets flipped on the $k$-th night if and only if $m$ is a
multiple of $k$. In other words, switch $m$ gets flipped on the $k$-th night
if and only if $k$ is a divisor of $m$. Thus, the number of times that switch
$m$ gets flipped (during the entire $1000$ nights) is precisely the number of
positive divisors of $m$. Of course, lamp $m$ will be on after $1000$ nights
if and only if this number of times is odd. Thus, asking which lamps will be
on after $1000$ nights is equivalent to asking which of the numbers
$1,2,\ldots,1000$ have an odd number of positive divisors.

Experiments reveal that among the first $10$ positive integers, only three
have an odd number of positive divisors: namely, $1$, $4$ and $9$. (For
example, $9$ has the $3$ positive divisors $1$, $3$ and $9$.) This suggests
the following:
\end{proof}

\begin{exercise}
\label{exe.ent.num-of-divs-even}Let $n$ be a positive integer. Prove that the
number of positive divisors of $n$ is even if and only if $n$ is not a perfect square.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.num-of-divs-even} (sketched).]A detailed
proof can be found in \cite[Proposition 2.14.7]{19s}, so we shall keep to the
main idea. We will use the word \textquotedblleft\textit{posdiv}%
\textquotedblright\ as shorthand for \textquotedblleft positive
divisor\textquotedblright. If $d$ is a posdiv of $n$, then $\dfrac{n}{d}$ is
an integer and again a posdiv of $n$. We shall refer to $\dfrac{n}{d}$ as the
\textit{complement} of $d$. Note that being the complement is a symmetric
relation: If $d$ is a posdiv of $n$, and if $e$ is the complement of $d$, then
$d$ is in turn the complement of $e$.

We can thus pair up each posdiv of $n$ with its complement. This results in a
\textquotedblleft pairing\textquotedblright\ that covers all posdivs of $n$,
except that it might fail to be a proper pairing: Namely, if a posdiv of $n$
is its own complement, then this posdiv will be paired with itself.

\begin{example}
Let us see how this \textquotedblleft pairing\textquotedblright\ looks like:

\begin{itemize}
\item If $n=12$, then the posdivs of $n$ are $1,2,3,4,6,12$. Their complements
are $12,6,4,3,2,1$, respectively. Thus, our \textquotedblleft
pairing\textquotedblright\ pairs $1$ with $12$, pairs $2$ with $6$, and pairs
$3$ with $4$.

\item If $n=16$, then the posdivs of $n$ are $1,2,4,8,16$. Their complements
are $16,8,4,2,1$, respectively. Thus, our \textquotedblleft
pairing\textquotedblright\ pairs $1$ with $16$, pairs $2$ with $8$, and pairs
$4$ with itself.
\end{itemize}
\end{example}

When does $n$ have a posdiv that gets paired with itself? In other words, when
is there a posdiv $d$ of $n$ that is its own complement? Clearly, this means
that $d=\dfrac{n}{d}$, or, equivalently, $n=d^{2}$. If $n$ is a perfect
square, then there is exactly one posdiv $d$ that satisfies $n=d^{2}$ (namely,
$\sqrt{n}$); otherwise, there is no such $d$. Thus:

\begin{itemize}
\item If $n$ is a perfect square, then exactly one posdiv of $n$ gets paired
with itself.

\item If $n$ is not a perfect square, then no posdiv of $n$ gets paired with itself.
\end{itemize}

Hence:

\begin{itemize}
\item If $n$ is a perfect square, then our \textquotedblleft
pairing\textquotedblright\ of the posdivs of $n$ leaves exactly one posdiv of
$n$ paired with itself, while all others have proper partners. Therefore, in
this case, the number of posdivs of $n$ is odd.

\item If $n$ is not a perfect square, then our \textquotedblleft
pairing\textquotedblright\ of the posdivs of $n$ is a proper pairing (i.e., no
posdiv gets paired with itself). Therefore, in this case, the number of
posdivs of $n$ is even.
\end{itemize}

Combining these facts, we conclude that the number of posdivs of $n$ is even
if and only if $n$ is not a perfect square. This solves Exercise
\ref{exe.ent.num-of-divs-even}.
\end{proof}

Exercise \ref{exe.ent.num-of-divs-even} quickly yields an answer to Exercise
\ref{exe.ent.phi.ghosts}: Namely, the lamps that will be on after $1000$
nights are precisely the $m$-th lamps where $m\in\left\{  1,2,\ldots
,1000\right\}  $ is a perfect square -- i.e., the $1^{2}$-th, $2^{2}$-th,
$3^{2}$-th etc. lamps.

Exercise \ref{exe.ent.num-of-divs-even} is due to John Wallis (1685,
\cite[Additional Treatises, Chapter III, \S 16]{Wallis85}).

Next, we shall discuss some variations on Bezout's theorem. As a warmup
exercise, here is an easy one:

\begin{exercise}
\label{exe.ent.gcd.xa+yb-positive-wup}Let $a$ and $b$ be two coprime integers.
Let $n$ be an integer.

Prove that there exist integers $x$ and $y$ such that $n=xa+yb$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.gcd.xa+yb-positive-wup}.]The numbers $a$
and $b$ are coprime; in other words, $\gcd\left(  a,b\right)  =1$.

But Theorem \ref{thm.ent.gcd.bezout} yields that there exist integers
$x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that $\gcd\left(  a,b\right)
=xa+yb$. Consider these $x$ and $y$, and denote them by $x^{\prime}$ and
$y^{\prime}$. (We do not want to call them $x$ and $y$, since they are not the
$x$ and $y$ we are looking for.) Thus, $x^{\prime}$ and $y^{\prime}$ are
integers satisfying $\gcd\left(  a,b\right)  =x^{\prime}a+y^{\prime}b$. Hence,
$x^{\prime}a+y^{\prime}b=\gcd\left(  a,b\right)  =1$. Multiplying both sides
of this equality by $n$, we find $n\left(  x^{\prime}a+y^{\prime}b\right)
=n\cdot1=n$. Hence, $n=n\left(  x^{\prime}a+y^{\prime}b\right)  =nx^{\prime
}a+ny^{\prime}b$. Thus, there exist integers $x$ and $y$ such that $n=xa+yb$
(namely, $x=nx^{\prime}$ and $y=ny^{\prime}$). This solves Exercise
\ref{exe.ent.gcd.xa+yb-positive-wup}.
\end{proof}

Now, what happens if we require $x$ and $y$ to be \textbf{nonnegative} in
Exercise \ref{exe.ent.gcd.xa+yb-positive-wup}? Then, Exercise
\ref{exe.ent.gcd.xa+yb-positive-wup} is no longer valid. For example, if $a=3$
and $b=5$, then there are no nonnegative integers $x$ and $y$ such that
$4=xa+yb$. This is, in a way, due to $4$ being \textquotedblleft too
small\textquotedblright; one is thus tempted to ask whether requiring $n$ to
be large enough (for $a$ and $b$ positive) will force those nonnegative $x$
and $y$ to exist. If so, then how large is large enough?

The answer is given by a famous result of J. J. Sylvester (who found it in
1882 when studying invariant theory). We state it as an exercise:

\begin{exercise}
\label{exe.ent.gcd.xa+yb-positive}Let $a$ and $b$ be two coprime positive
integers. Let $n$ be an integer such that $n>ab-a-b$.

Prove that there exist \textbf{nonnegative} integers $x$ and $y$ such that
$n=xa+yb$.
\end{exercise}

The \textquotedblleft$n>ab-a-b$\textquotedblright\ bound in Exercise
\ref{exe.ent.gcd.xa+yb-positive} is sharp: The claim of the exercise would no
longer hold if we allowed $n=ab-a-b$. (See Exercise
\ref{exe.ent.xa+yb.pos-no-1} \textbf{(b)} for why.)

Exercise \ref{exe.ent.gcd.xa+yb-positive} is often stated in terms of coins:
If $a$ and $b$ are two coprime positive integers, and if you have unlimited
supplies of $a$-cent coins and of $b$-cent coins, but no other coins, then
Exercise \ref{exe.ent.gcd.xa+yb-positive} says that you can pay any amount
that is larger than $ab-a-b$ cents\footnote{obviously an integer amount of
cents} without asking for change. See Wikipedia on
\href{https://en.wikipedia.org/wiki/Coin_problem}{the Sylvester Coin Problem},
which also studies the generalization to more than two sorts of coins. (This
generalization is significantly harder.)\footnote{See also
\url{https://artofproblemsolving.com/community/c6h373} for further discussions
on what amounts can be paid using two kinds of coins.}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.gcd.xa+yb-positive}.]Exercise
\ref{exe.ent.gcd.xa+yb-positive-wup} yields that there exist integers $x$ and
$y$ such that $n=xa+yb$. Consider these $x$ and $y$, and denote them by
$x^{\prime}$ and $y^{\prime}$. (We do not want to call them $x$ and $y$, since
they are not the $x$ and $y$ we are looking for.) Thus, $x^{\prime}$ and
$y^{\prime}$ are integers satisfying $n=x^{\prime}a+y^{\prime}b$.

If $x^{\prime}$ and $y^{\prime}$ are nonnegative, then we are already done
(since we can just take $x=x^{\prime}$ and $y=y^{\prime}$). But $x^{\prime}$
and $y^{\prime}$ might not be nonnegative yet. The trick is now to modify
$x^{\prime}$ and $y^{\prime}$ in such a way that they become nonnegative but
the sum $x^{\prime}a+y^{\prime}b$ is unchanged. (If you want, you can view
this as an instance of the \textquotedblleft find a not-quite-answer and tweak
it until it becomes a full answer\textquotedblright\ technique; the
time-honored
\textit{\href{https://en.wikipedia.org/wiki/Regula_falsi}{\textit{regula
falsi}}} is another instance of this technique.)

How can we modify $x^{\prime}$ and $y^{\prime}$ in a way that $x^{\prime
}a+y^{\prime}b$ is unchanged? A simple way to do so is to add $b$ to
$x^{\prime}$ and subtract $a$ from $y^{\prime}$ (because this causes
$x^{\prime}a+y^{\prime}b$ to become $\left(  x^{\prime}+b\right)  a+\left(
y^{\prime}-a\right)  b$, which is still the same as $x^{\prime}a+y^{\prime}%
b$). More generally, we can pick any $d\in\mathbb{Z}$ and add $db$ to
$x^{\prime}$ and subtract $da$ from $y^{\prime}$. Obviously, if we pick $d$
large enough, then $x^{\prime}+db$ will become nonnegative, whereas a small
enough $d$ will make $y^{\prime}-da$ nonnegative. The question is: Is there a
(nonempty) \textquotedblleft goldilocks zone\textquotedblright\ in which $d$
is sufficiently large for $x^{\prime}+db$ to be nonnegative and yet
sufficiently small for $y^{\prime}-da$ to be nonnegative?

We can try to describe this \textquotedblleft goldilocks
zone\textquotedblright\ explicitly. The number $x^{\prime}+db$ is nonnegative
if and only if $d\geq\dfrac{-x^{\prime}}{b}$ (check this!); on the other hand,
the number $y^{\prime}-da$ is nonnegative if and only if $d\leq\dfrac
{y^{\prime}}{a}$. Hence, the \textquotedblleft goldilocks
zone\textquotedblright\ for $d$ is the interval $\left[  \dfrac{-x^{\prime}%
}{b},\dfrac{y^{\prime}}{a}\right]  $. Let us check whether this interval is
nonempty. We have%
\begin{align*}
\dfrac{y^{\prime}}{a}-\dfrac{-x^{\prime}}{b}  &  =\dfrac{x^{\prime}%
a+y^{\prime}b}{ab}>\dfrac{ab-a-b}{ab}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}x^{\prime}a+y^{\prime}b=n>ab-a-b\right) \\
&  =1-\dfrac{1}{a}-\dfrac{1}{b},
\end{align*}
which is $\geq0$ in all interesting cases (the only exception being when $a$
or $b$ is $1$, but this case is easy to handle separately). Thus, in all
interesting cases, we have $\dfrac{y^{\prime}}{a}\geq\dfrac{-x^{\prime}}{b}$.

Unfortunately, this is not the whole story. We are not looking for a
\textbf{real} number $d$ in the interval $\left[  \dfrac{-x^{\prime}}%
{b},\dfrac{y^{\prime}}{a}\right]  $, but for an \textbf{integer} $d$ in this
interval. Having $\dfrac{y^{\prime}}{a}\geq\dfrac{-x^{\prime}}{b}$ guarantees
the former but not the latter. How can we guarantee the latter? What must the
difference $\beta-\alpha$ of two real numbers $\alpha$ and $\beta$ satisfy to
ensure that the interval $\left[  \alpha,\beta\right]  $ contains an integer?

It is not hard to see that the answer to this question is \textquotedblleft
they must satisfy $\beta-\alpha\geq1$\textquotedblright. Unfortunately, this
is not true for our \textquotedblleft goldilocks zone\textquotedblright; the
difference $\dfrac{y^{\prime}}{a}-\dfrac{-x^{\prime}}{b}$ is always $<1$. So
we are stuck.

Being stuck, let us revisit what we did, in the hopes of finding something
improvable. Did we perhaps throw away some information too early, or make too
weak an estimate? One thing that stands out is that we never really used the
fact that $x^{\prime}$ and $y^{\prime}$ are integers.

This turns out to be the key. We said that the number $x^{\prime}+db$ is
nonnegative if and only if $d\geq\dfrac{-x^{\prime}}{b}$. But we can say
something slightly stronger: The number $x^{\prime}+db$ is nonnegative if and
only if $d>\dfrac{-x^{\prime}-1}{b}$. Indeed, we have the following chain of
equivalences:%
\begin{align*}
\left(  x^{\prime}+db\text{ is nonnegative}\right)  \  &  \Longleftrightarrow
\ \left(  x^{\prime}+db\geq0\right) \\
&  \Longleftrightarrow\ \left(  x^{\prime}+db>-1\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }x^{\prime}+db\text{ is an
integer}\right) \\
&  \Longleftrightarrow\ \left(  db>-x^{\prime}-1\right)  \ \Longleftrightarrow
\ \left(  d>\dfrac{-x^{\prime}-1}{b}\right)  .
\end{align*}
Notice how rewriting \textquotedblleft$x^{\prime}+db\geq0$\textquotedblright%
\ as \textquotedblleft$x^{\prime}+db>-1$\textquotedblright\ has improved our
inequality! Likewise, we can see that $y^{\prime}-da$ is nonnegative if and
only if $d<\dfrac{y^{\prime}+1}{a}$. Thus, our \textquotedblleft goldilocks
zone\textquotedblright\ $\left[  \dfrac{-x^{\prime}}{b},\dfrac{y^{\prime}}%
{a}\right]  $ has grown to a wider interval $\left(  \dfrac{-x^{\prime}-1}%
{b},\dfrac{y^{\prime}+1}{a}\right)  $ (an open interval, not a pair of
numbers). And as it turns out, this latter interval has size $>1$, since%
\begin{align*}
\dfrac{y^{\prime}+1}{a}-\dfrac{-x^{\prime}-1}{b}  &  =\dfrac{x^{\prime
}a+y^{\prime}b+a+b}{ab}=\dfrac{n+a+b}{ab}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }x^{\prime}a+y^{\prime}b=n\right) \\
&  >1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n+a+b>ab\text{ (because
}n>ab-a-b\text{)}\right)  .
\end{align*}
But an open interval of size $>1$ must always contain an
integer\footnote{\textit{Proof.} Let $\left(  \alpha,\beta\right)  $ be an
open interval of size $>1$. Thus, $\alpha$ and $\beta$ are real numbers such
that $\beta-\alpha>1$. We must prove that the interval $\left(  \alpha
,\beta\right)  $ contains an integer.
\par
Indeed, it is easy to see that $\left\lfloor \alpha\right\rfloor +1$ is an
integer contained in this interval $\left(  \alpha,\beta\right)  $. Check
this!}. Hence, the open interval $\left(  \dfrac{-x^{\prime}-1}{b}%
,\dfrac{y^{\prime}+1}{a}\right)  $ contains an integer $d$. Picking such a
$d$, we then conclude that both $x^{\prime}+db$ and $y^{\prime}-da$ are
nonnegative, and thus there exist \textbf{nonnegative} integers $x$ and $y$
such that $n=xa+yb$ (namely, $x=x^{\prime}+db$ and $y=y^{\prime}-da$). Thus,
we have found a solution to Exercise \ref{exe.ent.gcd.xa+yb-positive}.
\end{proof}

It is instructive to see how short this solution becomes if we forget about
the pains we took finding it, and only write down the parts that ended up
necessary for the proof:

\begin{proof}
[Solution to Exercise \ref{exe.ent.gcd.xa+yb-positive} (final copy).]Exercise
\ref{exe.ent.gcd.xa+yb-positive-wup} yields that there exist integers $x$ and
$y$ such that $n=xa+yb$. Consider these $x$ and $y$, and denote them by
$x^{\prime}$ and $y^{\prime}$. Thus, $x^{\prime}$ and $y^{\prime}$ are
integers satisfying $n=x^{\prime}a+y^{\prime}b$.

Define an integer $d$ by $d=\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor
+1$. Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Both integers $x^{\prime}+db$ and $y^{\prime}-da$ are nonnegative.
\end{statement}

[\textit{Proof of Claim 1:} The chain of inequalities
(\ref{sol.floor.hermite.lem1}) (applied to $x=\dfrac{-x^{\prime}-1}{b}$) shows
that%
\begin{equation}
\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor \leq\dfrac{-x^{\prime}%
-1}{b}<\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor +1.
\label{sol.ent.gcd.xa+yb-positive-wup.floors1}%
\end{equation}
Hence,%
\[
\dfrac{-x^{\prime}-1}{b}<\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor
+1=d\ \ \ \ \ \ \ \ \ \ \left(  \text{since }d=\left\lfloor \dfrac{-x^{\prime
}-1}{b}\right\rfloor +1\right)  .
\]
We can multiply this inequality by $b$ (since $b$ is positive), and thus
obtain $-x^{\prime}-1<db$. Hence, $db>-x^{\prime}-1$, so that $x^{\prime
}+db>-1$. Since $x^{\prime}+db$ is an integer, this entails that $x^{\prime
}+db\geq0$. In other words, $x^{\prime}+db$ is nonnegative.

It remains to show that $y^{\prime}-da$ is nonnegative. But $n+a+b>ab$
(because $n>ab-a-b$). We can divide this inequality by $ab$ (since $ab>0$),
and thus obtain $\dfrac{n+a+b}{ab}>1$. Now,%
\begin{align*}
\dfrac{y^{\prime}+1}{a}-\dfrac{-x^{\prime}-1}{b}  &  =\dfrac{x^{\prime
}a+y^{\prime}b+a+b}{ab}=\dfrac{n+a+b}{ab}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }x^{\prime}a+y^{\prime}b=n\right) \\
&  >1,
\end{align*}
so that%
\[
\dfrac{y^{\prime}+1}{a}>\underbrace{\dfrac{-x^{\prime}-1}{b}}_{\substack{\geq
\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor \\\text{(by the first
inequality in (\ref{sol.ent.gcd.xa+yb-positive-wup.floors1}))}}}+1\geq
\left\lfloor \dfrac{-x^{\prime}-1}{b}\right\rfloor +1=d.
\]
We can multiply this inequality by $a$ (since $a$ is positive), and find
$y^{\prime}+1>da$. In other words, $y^{\prime}-da>-1$. Since $y^{\prime}-da$
is an integer, this entails $y^{\prime}-da\geq0$. In other words, $y^{\prime
}-da$ is nonnegative. This completes our proof of Claim 1.]

Thus, the integers $x^{\prime}+db$ and $y^{\prime}-da$ are nonnegative. They
furthermore satisfy
\[
\left(  x^{\prime}+db\right)  a+\left(  y^{\prime}-da\right)  b=x^{\prime
}a+dba+y^{\prime}b-dab=x^{\prime}a+y^{\prime}b=n,
\]
so that $n=\left(  x^{\prime}+db\right)  a+\left(  y^{\prime}-da\right)  b$.
Thus, there exist \textbf{nonnegative} integers $x$ and $y$ such that
$n=xa+yb$ (namely, $x=x^{\prime}+db$ and $y=y^{\prime}-da$). This solves
Exercise \ref{exe.ent.gcd.xa+yb-positive}.
\end{proof}

\newpage

\section{\label{chp.seqsum}Sequences and sums}

In this chapter, we shall explore sequences and finite sums and products. This
is a vast subject and one that is popular on mathematical competitions; my
choice of material is \textquotedblleft informed\textquotedblright\ more by my
own tastes than by relevance for current olympiads. In particular, I will
mostly avoid any analysis (limits and infinite sums); good sources for this
are \cite[\S 3.1]{GelAnd} and much of \cite{PolSze78}. Serious
number-theoretical questions will have to wait for future chapters. In this
chapter, I will begin with some rules and tricks for dealing with finite sums
and products; then I will introduce the binomial coefficients and their most
fundamental properties (nothing too combinatorial yet). After that, I will
turn to some more specific kinds of sequences: ones that are integer (i.e.,
their entries are integers) although their definitions involve fractions; ones
that are defined by recursions yet can be explicitly computed; periodic ones;
and ones satisfying linear recurrences.

More diverse selections of problems on sequences can be found in \cite[Chapter
9]{Engel} and \cite[\S 3.1]{GelAnd}. It is worth keeping in mind that there is
an \textit{\href{https://oeis.org/}{\textit{Online Encyclopedia of Integer
Sequences}}} that knows hundreds of thousands of integer sequences and can be
used to answer questions such as \textquotedblleft what meaningful sequences
begin with $1,0,1,2,9,44,265$, and what facts are known about
them?\textquotedblright\ (check it out if you are curious). It is a useful
tool for mathematical researchers, not just for puzzle solvers, as integer
sequences appear frequently in mathematics, and knowing that two questions
lead to one and the same integer sequence often foreshadows some deeper
connection between the questions. There is also a
\textit{\href{https://cs.uwaterloo.ca/journals/JIS/}{\textit{Journal of
Integer Sequences}}}.

\subsection{\label{sect.seqsum.sums}Finite sums}

We begin with finite sums and products. While we have already used these
concepts and the corresponding notations (the $\sum$ and $\prod$ symbols), let
us nevertheless quickly recall some of their basic properties. We refer to
\cite[\S 1.4]{detnotes} for a much more thorough (although probably not very
exciting) survey of the properties of finite sums and products with detailed
proofs, and to \cite[Chapter 2]{GKP} for a hands-on introduction to the art of
manipulating them. Also, \cite{AndTet18} is an entire book devoted to (mostly
finite) sums and products.

This section will be a long yet (most likely) fast read, as much of it just
will be spent stating rules and definitions that you have likely already
encountered in your mathematical life history. Furthermore, almost all of
these rules are just formalizing common sense about sums and products, so you
won't be surprised by them even if you see them for the first time. The rules
will be illustrated by exercises, and some of the latter might actually be
surprising. Thus, skim this section, but do not skip the exercises!

\subsubsection{The $\sum$ sign}

The most well-known type of finite sums are those of the form $\sum_{i=u}%
^{v}a_{i}$ (for example, $\sum_{i=2}^{10}i^{2}$). But let us first define
finite sums of a more general shape (from which we shall later obtain the
$\sum_{i=u}^{v}a_{i}$ kind as a special case):\footnote{Throughout Section
\ref{sect.seqsum.sums}, \textquotedblleft number\textquotedblright\ means an
integer or a rational number or a real number or a complex number. More
generally, the concept of a finite sum can be applied to any sort of object
that has an addition operation with reasonable properties (such as
commutativity and associativity); e.g., in linear algebra, one defines finite
sums of vectors in a vector space, and in abstract algebra, one generalizes
this further to finite sums of elements of an abelian group (or even monoid).}

\begin{definition}
\label{def.seqsum.sums.finset}If $S$ is a finite set, and if $a_{s}$ is a
number for each $s\in S$, then $\sum_{s\in S}a_{s}$ denotes the sum of all of
these numbers $a_{s}$. Formally, this sum is defined by recursion on
$\left\vert S\right\vert $, as follows:

\begin{itemize}
\item If $\left\vert S\right\vert =0$, then $\sum_{s\in S}a_{s}$ is defined to
be $0$. (In this case, $\sum_{s\in S}a_{s}$ is called an \textit{empty sum}.)

\item Let $n\in\mathbb{N}$. Assume that we have defined $\sum_{s\in S}a_{s}$
for every finite set $S$ with $\left\vert S\right\vert =n$ (and every choice
of numbers $a_{s}$). Now, if $S$ is a finite set with $\left\vert S\right\vert
=n+1$ (and if a number $a_{s}$ is chosen for each $s\in S$), then $\sum_{s\in
S}a_{s}$ is defined by picking any $t\in S$ and setting%
\begin{equation}
\sum_{s\in S}a_{s}=a_{t}+\sum_{s\in S\setminus\left\{  t\right\}  }a_{s}.
\label{eq.def.seqsum.sums.finset.sumrec}%
\end{equation}

\end{itemize}
\end{definition}

It is not immediately clear why this definition is legitimate; in fact, the
right hand side of (\ref{eq.def.seqsum.sums.finset.sumrec}) is defined using a
choice of $t$, but theoretically one can imagine that different choices of $t$
would lead to different results. Nevertheless, one can prove (see, e.g.,
\cite[Theorem 2.118]{detnotes} for this proof) that this definition is indeed
legitimate (i.e., the right hand side of
(\ref{eq.def.seqsum.sums.finset.sumrec}) does not depend on $t$). This is
essentially saying that if we sum the numbers $a_{s}$ for all $s\in S$ by
starting with $0$ and adding these numbers one by one, then the result does
not depend on the order in which the numbers are being added. (Note that this
is not true of multiplying matrices, or of putting on clothes, or of chemical
reactions. So it's not an obvious claim!)

Expressions of the form $\sum_{s\in S}a_{s}$ for finite sets $S$ are called
\textit{finite sums}. Here are some examples:

\begin{example}
\textbf{(a)} If $S=\left\{  2,6,9\right\}  $ and $a_{s}=3^{s}$ for each $s\in
S$, then $\sum_{s\in S}a_{s}=a_{2}+a_{6}+a_{9}=3^{2}+3^{6}+3^{9}$.

\textbf{(b)} If $S=\left\{  1,2,\ldots,n\right\}  $ (for some $n\in\mathbb{N}%
$) and $a_{s}=s^{2}$ for every $s\in S$, then $\sum_{s\in S}a_{s}=\sum_{s\in
S}s^{2}=1^{2}+2^{2}+\cdots+n^{2}$.

\textbf{(c)} If $S=\varnothing$, then $\sum_{s\in S}a_{s}=0$ (since
$\left\vert S\right\vert =0$).
\end{example}

The sum $\sum_{s\in S}a_{s}$ is usually pronounced \textquotedblleft sum of
the $a_{s}$ over all $s\in S$\textquotedblright\ or \textquotedblleft sum of
the $a_{s}$ with $s$ ranging over $S$\textquotedblright\ or \textquotedblleft
sum of the $a_{s}$ with $s$ running through all elements of $S$%
\textquotedblright. The letter \textquotedblleft$s$\textquotedblright\ in the
sum is called the \textquotedblleft summation index\textquotedblright, and its
exact choice is immaterial (for example, you can rewrite $\sum_{s\in S}a_{s}$
as $\sum_{t\in S}a_{t}$ or as $\sum_{\Phi\in S}a_{\Phi}$ or as $\sum
_{\spadesuit\in S}a_{\spadesuit}$), as long as it does not already have a
different meaning outside of the sum. The sign $\sum$ itself is called
\textquotedblleft the summation sign\textquotedblright\ or \textquotedblleft
the $\sum$ sign\textquotedblright. The numbers $a_{s}$ are called the
\textit{addends} (or \textit{summands} or \textit{terms}) of the sum
$\sum_{s\in S}a_{s}$. More precisely, for any given $t\in S$, we can refer to
the number $a_{t}$ as the \textquotedblleft addend corresponding to the index
$t$\textquotedblright\ (or as the \textquotedblleft addend for $s=t$%
\textquotedblright, or as the \textquotedblleft addend for $t$%
\textquotedblright) of the sum $\sum_{s\in S}a_{s}$.

The summation index in a finite sum 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}%
\]
(here, we are using the notation $\sum_{\left(  x,y\right)  \in S}a_{\left(
x,y\right)  }$ with $S=\left\{  1,2,3\right\}  ^{2}$ and $a_{\left(
x,y\right)  }=\dfrac{x}{y}$).

\begin{warning}
There is no agreement on the operator precedence of the $\sum$ sign versus the
$+$ sign. By this I mean the following question: Does $\sum_{s\in S}a_{s}+b$
(where $b$ is some other number) mean $\sum_{s\in S}\left(  a_{s}+b\right)  $
or $\left(  \sum_{s\in S}a_{s}\right)  +b$ ? I will use the second
interpretation (i.e., I will read it as $\left(  \sum_{s\in S}a_{s}\right)
+b$), but I have seen both used in the literature (although I believe that the
second is more popular).

However, the $\cdot$ sign definitely has higher precedence than the $\sum$
sign. That is, an expression of the form $\sum_{s\in S}ba_{s}c$ is always
understood to mean $\sum_{s\in S}\left(  ba_{s}c\right)  $.
\end{warning}

As I mentioned above, the most common finite sums are of a special kind:

\begin{definition}
\label{def.seqsum.sums.interval}Let $u$ and $v$ be integers. We agree to
understand the set $\left\{  u,u+1,\ldots,v\right\}  $ to be empty if $u>v$.

Let $a_{s}$ be a number for each $s\in\left\{  u,u+1,\ldots,v\right\}  $.
Then, the finite sum $\sum_{s\in\left\{  u,u+1,\ldots,v\right\}  }a_{s}$ will
also be denoted by $\sum_{s=u}^{v}a_{s}$ or by $a_{u}+a_{u+1}+\cdots+a_{v}$.
\end{definition}

Thus, finite sums of the form $\sum_{s=u}^{v}a_{s}$ satisfy
\begin{align}
\sum_{s=u}^{v}a_{s}  &  =0\ \ \ \ \ \ \ \ \ \ \text{for }v<u\text{,
and}\label{eq.def.seqsum.finsum.interval.emptysum}\\
\sum_{s=u}^{v}a_{s}  &  =a_{u}+\sum_{s=u+1}^{v}a_{s}=\sum_{s=u}^{v-1}%
a_{s}+a_{v}\ \ \ \ \ \ \ \ \ \ \text{for }v\geq u.
\label{eq.def.seqsum.finsum.interval.recs}%
\end{align}


The equality (\ref{eq.def.seqsum.finsum.interval.emptysum}) says that a sum
that \textquotedblleft ends before it begins\textquotedblright\ is $0$. For
example, $\sum_{i=5}^{2}i=0$. This is not completely
uncontroversial\footnote{I have seen authors who would \textquotedblleft sum
backwards\textquotedblright\ when $v<u$, thus interpreting $\sum_{i=5}^{2}i$
as $-4-3$. This has some advantages (because why let a notation go to waste?),
but it would mean that $\sum_{s=u}^{v}a_{s}$ cannot be rewritten as
$\sum_{s\in\left\{  u,u+1,\ldots,v\right\}  }a_{s}$ without checking the order
relation between $u$ and $v$, and I don't want this extra headache.}, but it
shall be so in this course.

In a sum of the form $\sum_{s=u}^{v}a_{s}$, the integer $u$ is called the
\textit{lower limit} (or \textit{lower bound}) of the sum, whereas the integer
$v$ is called the \textit{upper limit} (or \textit{upper bound}) of the
sum.\footnote{This has nothing to do with the notions of \textquotedblleft
bounds\textquotedblright\ and \textquotedblleft limits\textquotedblright\ in
analysis.} The sum is said to \textit{start} (or \textit{begin}) at $u$ and
\textit{end} at $v$.

Another way to use $\sum$ signs is in describing sums that sum over all
elements of a given set that satisfy a given statement. This is done as follows:\Needspace{3cm}

\begin{definition}
\label{def.seqsum.sums.filtered}Let $S$ be a finite set, and let
$\mathcal{A}\left(  s\right)  $ be a logical statement defined for every $s\in
S$. (For example, if $S$ is a set of integers, then $\mathcal{A}\left(
s\right)  $ can be the statement \textquotedblleft$s$ is
even\textquotedblright.) For each $s\in S$ satisfying $\mathcal{A}\left(
s\right)  $, let $a_{s}$ be a number. Then, the sum $\sum_{\substack{s\in
S;\\\mathcal{A}\left(  s\right)  }}a_{s}$ is defined by%
\[
\sum_{\substack{s\in S;\\\mathcal{A}\left(  s\right)  }}a_{s}=\sum
_{s\in\left\{  t\in S\ \mid\ \mathcal{A}\left(  t\right)  \right\}  }a_{s}.
\]
In other words, $\sum_{\substack{s\in S;\\\mathcal{A}\left(  s\right)  }%
}a_{s}$ is the sum of the $a_{s}$ for all $s\in S$ which satisfy
$\mathcal{A}\left(  s\right)  $.
\end{definition}

\begin{example}
If $S=\left\{  1,2,3,4,5\right\}  $, then $\sum_{\substack{s\in S;\\s\text{ is
even}}}a_{s}=a_{2}+a_{4}$ and $\sum_{\substack{s\in S;\\s\text{ is odd}}%
}a_{s}=a_{1}+a_{3}+a_{5}$.
\end{example}

\subsubsection{The simplest rules: factoring out and splitting addends}

Having defined the notations, let us recall some rules for manipulating finite
sums. We shall give no proofs (see \cite[\S 1.4]{detnotes} for them, or treat
them as induction exercises), but we shall illustrate them with examples
whenever reasonable.

We begin with four very simple rules. The first one (\cite[(6)]{detnotes})
says that if all addends in a sum are equal to some number $a$, then the sum
equals the number of addends times $a$:

\begin{theorem}
\label{thm.seqsum.sums.sum-of-a}Let $S$ be a finite set. Let $a$ be a number.
Then,%
\begin{equation}
\sum_{s\in S}a=\left\vert S\right\vert \cdot a. \label{eq.sum.equal}%
\end{equation}

\end{theorem}

This is trivial to prove by induction and needs no further explanation.
Applying (\ref{eq.sum.equal}) to $a=0$ yields $\sum_{s\in S}0=\left\vert
S\right\vert \cdot0=0$.

The next rule (\cite[(9)]{detnotes}) is just a distributive law for finite
sums; it says that a factor common to all addends of a sum can be factored out:

\begin{theorem}
\label{thm.seqsum.sums.factor-out}Let $S$ be a finite set. For every $s\in S$,
let $a_{s}$ be a number. Also, let $\lambda$ be a number. Then,%
\begin{equation}
\sum_{s\in S}\lambda a_{s}=\lambda\sum_{s\in S}a_{s}. \label{eq.sum.linear2}%
\end{equation}

\end{theorem}

\begin{example}
Let $u$ and $v$ be two integers. Let $a_{s}$ be a number for each
$s\in\left\{  u,u+1,\ldots,v\right\}  $. Also, let $\lambda$ be a number.
Then, Theorem \ref{thm.seqsum.sums.factor-out} (applied to $S=\left\{
u,u+1,\ldots,v\right\}  $) yields%
\begin{equation}
\sum_{s=u}^{v}\lambda a_{s}=\lambda\sum_{s=u}^{v}a_{s}.
\label{eq.sum.linear2.var1}%
\end{equation}
Equivalently,%
\begin{equation}
\lambda a_{u}+\lambda a_{u+1}+\cdots+\lambda a_{v}=\lambda\left(
a_{u}+a_{u+1}+\cdots+a_{v}\right)  . \label{eq.sum.linear2.var2}%
\end{equation}
For example, if $n\in\mathbb{N}$, then the sum of the first $n$ even positive
integers is%
\begin{align*}
2+4+\cdots+2n  &  =2\cdot1+2\cdot2+\cdots+2\cdot n\\
&  =2\left(  1+2+\cdots+n\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by (\ref{eq.sum.linear2.var2}), applied to }\lambda=2\\
\text{and }u=1\text{ and }v=n\text{ and }a_{s}=s
\end{array}
\right) \\
&  =2\cdot\dfrac{n\left(  n+1\right)  }{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.ind.little-gauss})}\right) \\
&  =n\left(  n+1\right)  .
\end{align*}

\end{example}

The next rule (\cite[(7)]{detnotes}) says that if each addend in a sum is
itself a sum of two numbers, then we can split the sum up:

\begin{theorem}
\label{thm.seqsum.sums.split-addend}Let $S$ be a finite set. For every $s\in
S$, let $a_{s}$ and $b_{s}$ be numbers. Then,%
\begin{equation}
\sum_{s\in S}\left(  a_{s}+b_{s}\right)  =\sum_{s\in S}a_{s}+\sum_{s\in
S}b_{s}. \label{eq.sum.linear1}%
\end{equation}

\end{theorem}

\begin{example}
Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the Fibonacci sequence. Let
$n\in\mathbb{N}$. Then,%
\begin{align*}
\sum_{s=1}^{n}\left(  f_{s}+1\right)   &  =\underbrace{\sum_{s=1}^{n}f_{s}%
}_{\substack{=f_{1}+f_{2}+\cdots+f_{n}\\=f_{n+2}-1\\\text{(by Exercise
\ref{exe.fibonacci.first-sum})}}}+\underbrace{\sum_{s=1}^{n}1}%
_{\substack{=n\cdot1\\\text{(as a consequence of (\ref{eq.sum.equal}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.sum.linear1}), applied to
}S=\left\{  1,2,\ldots,n\right\}  \text{ and }a_{s}=f_{s}\text{ and }%
b_{s}=1\right) \\
&  =f_{n+2}-1+n\cdot1=f_{n+2}-1+n.
\end{align*}

\end{example}

The equality (\ref{eq.sum.linear1}) is often used forwards (i.e., in order to
split a sum of the form $\sum_{s\in S}\left(  a_{s}+b_{s}\right)  $ into
$\sum_{s\in S}a_{s}+\sum_{s\in S}b_{s}$) and backwards (i.e., in order to
combine two sums $\sum_{s\in S}a_{s}+\sum_{s\in S}b_{s}$ into $\sum_{s\in
S}\left(  a_{s}+b_{s}\right)  $). When applying it backwards, don't forget to
check that the two sums being combined are ranging over the same set!

An easy consequence of Theorem \ref{thm.seqsum.sums.split-addend} is the following:

\begin{exercise}
\label{exe.seqsum.sums.split-addend-minus}Let $S$ be a finite set. For every
$s\in S$, let $a_{s}$ and $b_{s}$ be numbers. Then,%
\[
\sum_{s\in S}\left(  a_{s}-b_{s}\right)  =\sum_{s\in S}a_{s}-\sum_{s\in
S}b_{s}.
\]

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.split-addend-minus}.]Theorem
\ref{thm.seqsum.sums.split-addend} (applied to $a_{s}-b_{s}$ instead of
$a_{s}$) yields%
\[
\sum_{s\in S}\left(  \left(  a_{s}-b_{s}\right)  +b_{s}\right)  =\sum_{s\in
S}\left(  a_{s}-b_{s}\right)  +\sum_{s\in S}b_{s}.
\]
Solving this equation for $\sum_{s\in S}\left(  a_{s}-b_{s}\right)  $, we find%
\[
\sum_{s\in S}\left(  a_{s}-b_{s}\right)  =\sum_{s\in S}\underbrace{\left(
\left(  a_{s}-b_{s}\right)  +b_{s}\right)  }_{=a_{s}}-\sum_{s\in S}b_{s}%
=\sum_{s\in S}a_{s}-\sum_{s\in S}b_{s}.
\]
This solves Exercise \ref{exe.seqsum.sums.split-addend-minus}.
\end{proof}

\subsubsection{Substitution of the summation index}

The next rule (\cite[(12)]{detnotes}) is intuitively simple, yet highly useful:

\begin{theorem}
\label{thm.seqsum.subs1}Let $S$ and $T$ be two finite sets. Let
$f:S\rightarrow T$ be a \textbf{bijective} map\footnotemark. Let $a_{t}$ be a
number for each $t\in T$. Then,%
\begin{equation}
\sum_{t\in T}a_{t}=\sum_{s\in S}a_{f\left(  s\right)  }. \label{eq.sum.subs1}%
\end{equation}

\end{theorem}

\footnotetext{Recall: A map is said to be \textit{bijective} if it is
injective (i.e., one-to-one) and surjective (i.e., onto). Bijective maps are
also known as \textit{bijections} or \textit{one-to-one correspondences}. See,
e.g.,
\href{https://en.wikipedia.org/wiki/Bijection,_injection_and_surjection}{the
detailed Wikipedia page} for more about these kinds of maps.}Roughly speaking,
(\ref{eq.sum.subs1}) holds because the sum $\sum_{s\in S}a_{f\left(  s\right)
}$ contains the same addends as the sum $\sum_{t\in T}a_{t}$. We say that the
sum $\sum_{s\in S}a_{f\left(  s\right)  }$ is obtained from the sum
$\sum_{t\in T}a_{t}$ by \textit{substituting }$f\left(  s\right)  $
\textit{for }$t$. (Conversely, $\sum_{t\in T}a_{t}$ is obtained from
$\sum_{s\in S}a_{f\left(  s\right)  }$ by \textit{substituting }$t$
\textit{for }$f\left(  s\right)  $.)

\begin{example}
For any $n\in\mathbb{N}$, we have%
\[
\sum_{t\in\left\{  1,2,\ldots,n\right\}  }t^{3}=\sum_{s\in\left\{
-n,-n+1,\ldots,-1\right\}  }\left(  -s\right)  ^{3}.
\]
Indeed, this follows from (\ref{eq.sum.subs1}), applied to $S=\left\{
-n,-n+1,\ldots,-1\right\}  $, $T=\left\{  1,2,\ldots,n\right\}  $, $f\left(
s\right)  =-s$, and $a_{t}=t^{3}$.
\end{example}

When substituting the index in a sum, it is perfectly okay to re-use the same
letter for the new index. Thus, (\ref{eq.sum.subs1}) can be rewritten as%
\[
\sum_{s\in T}a_{s}=\sum_{s\in S}a_{f\left(  s\right)  }.
\]


Theorem \ref{thm.seqsum.subs1} has several well-known and oft-used
consequences. The first one says that we can shift the index of a sum by any
integer $k$:

\begin{corollary}
\label{cor.seqsum.subs2}Let $u$, $v$ and $k$ be integers. Let $a_{t}$ be a
number for each $t\in\left\{  u+k,u+k+1,\ldots,v+k\right\}  $. Then,%
\[
\sum_{t=u+k}^{v+k}a_{t}=\sum_{s=u}^{v}a_{s+k}.
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.seqsum.subs2}.]Let $f$ denote the map
\begin{align*}
\left\{  u,u+1,\ldots,v\right\}   &  \rightarrow\left\{  u+k,u+k+1,\ldots
,v+k\right\}  ,\\
s  &  \mapsto s+k.
\end{align*}
This map $f$ is easily seen to be well-defined and bijective\footnote{Indeed,
it has an inverse map, which sends each $t\in\left\{  u+k,u+k+1,\ldots
,v+k\right\}  $ to $t-k$.}. Thus, Theorem \ref{thm.seqsum.subs1} (applied to
$S=\left\{  u,u+1,\ldots,v\right\}  $ and $T=\left\{  u+k,u+k+1,\ldots
,v+k\right\}  $) yields%
\[
\sum_{t\in\left\{  u+k,u+k+1,\ldots,v+k\right\}  }a_{t}=\sum_{s\in\left\{
u,u+1,\ldots,v\right\}  }\underbrace{a_{f\left(  s\right)  }}%
_{\substack{=a_{s+k}\\\text{(since }f\left(  s\right)  =s+k\text{)}}%
}=\sum_{s\in\left\{  u,u+1,\ldots,v\right\}  }a_{s+k}.
\]
In other words,%
\[
\sum_{t=u+k}^{v+k}a_{t}=\sum_{s=u}^{v}a_{s+k}.
\]
This proves Corollary \ref{cor.seqsum.subs2}.
\end{proof}

The next corollary says that sums can be turned around: i.e., we have%
\begin{equation}
a_{u}+a_{u+1}+\cdots+a_{v}=a_{v}+a_{v-1}+\cdots+a_{u}.
\label{eq.cor.seqsum.subs3.var1}%
\end{equation}
Restated using $\sum$ signs, and generalized by shifting the index, this takes
the following form:

\begin{corollary}
\label{cor.seqsum.subs3}Let $u$, $v$ and $k$ be integers. Let $a_{t}$ be a
number for each $t\in\left\{  k-v,k-v+1,\ldots,k-u\right\}  $. Then,%
\begin{equation}
\sum_{t=k-v}^{k-u}a_{t}=\sum_{s=u}^{v}a_{k-s}. \label{eq.cor.seqsum.subs3.eq}%
\end{equation}

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.seqsum.subs3}.]Let $f$ denote the map
\begin{align*}
\left\{  u,u+1,\ldots,v\right\}   &  \rightarrow\left\{  k-v,k-v+1,\ldots
,k-u\right\}  ,\\
s  &  \mapsto k-s.
\end{align*}
This map $f$ is easily seen to be well-defined and bijective\footnote{Indeed,
it has an inverse map, which sends each $t\in\left\{  k-v,k-v+1,\ldots
,k-u\right\}  $ to $k-t$.}. Thus, Theorem \ref{thm.seqsum.subs1} (applied to
$S=\left\{  u,u+1,\ldots,v\right\}  $ and $T=\left\{  k-v,k-v+1,\ldots
,k-u\right\}  $) yields%
\[
\sum_{t\in\left\{  k-v,k-v+1,\ldots,k-u\right\}  }a_{t}=\sum_{s\in\left\{
u,u+1,\ldots,v\right\}  }\underbrace{a_{f\left(  s\right)  }}%
_{\substack{=a_{k-s}\\\text{(since }f\left(  s\right)  =k-s\text{)}}%
}=\sum_{s\in\left\{  u,u+1,\ldots,v\right\}  }a_{k-s}.
\]
In other words,%
\[
\sum_{t=k-v}^{k-u}a_{t}=\sum_{s=u}^{v}a_{k-s}.
\]
This proves Corollary \ref{cor.seqsum.subs3}.
\end{proof}

Here is an example for the use of substitution in sums. Recall the formula
(\ref{eq.ind.little-gauss}), which is easily proved by induction. We shall now
prove it in a more elegant way:

\begin{exercise}
\label{exe.seqsum.sums.gauss}Let $n\in\mathbb{N}$. Prove the equality
(\ref{eq.ind.little-gauss}) without using induction.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.gauss}.]First of all, we notice
that%
\begin{equation}
\sum_{i=0}^{n}i=0+\sum_{i=1}^{n}i=\sum_{i=1}^{n}i=1+2+\cdots+n.
\label{sol.seqsum.sums.gauss.1to0}%
\end{equation}
Thus, we shall focus on computing $\sum_{i=0}^{n}i$.

We can substitute $n-i$ for $i$ in the sum $\sum_{i=0}^{n}i$ (since the map
$\left\{  0,1,\ldots,n\right\}  \rightarrow\left\{  0,1,\ldots,n\right\}
,\ i\mapsto n-i$ is a bijection). Thus, we obtain%
\[
\sum_{i=0}^{n}i=\sum_{i=0}^{n}\left(  n-i\right)  .
\]
(If you are too lazy to think about bijections, you can also derive this
immediately by applying Corollary \ref{cor.seqsum.subs3} to $u=0$, $v=n$,
$k=n$ and $a_{t}=t$. This is the main purpose of Corollary
\ref{cor.seqsum.subs3}: avoid the use of bijections.)

Now comes Gauss's \textquotedblleft doubling trick\textquotedblright: Recall
that $2q=q+q$ for every $q\in\mathbb{Q}$. Hence,%
\begin{align}
2\sum_{i=0}^{n}i  &  =\sum_{i=0}^{n}i+\underbrace{\sum_{i=0}^{n}i}%
_{=\sum_{i=0}^{n}\left(  n-i\right)  }=\sum_{i=0}^{n}i+\sum_{i=0}^{n}\left(
n-i\right) \nonumber\\
&  =\sum_{i=0}^{n}\underbrace{\left(  i+\left(  n-i\right)  \right)  }%
_{=n}\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have used
(\ref{eq.sum.linear1}) backwards}\right) \nonumber\\
&  =\sum_{i=0}^{n}n=\left(  n+1\right)  n\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.sum.equal})}\right) \nonumber\\
&  =n\left(  n+1\right)  , \label{sol.seqsum.sums.gauss.comp}%
\end{align}
and therefore%
\begin{equation}
\sum_{i=0}^{n}i=\dfrac{n\left(  n+1\right)  }{2}. \label{eq.sum.littlegauss1}%
\end{equation}
In view of (\ref{sol.seqsum.sums.gauss.1to0}), this rewrites as $1+2+\cdots
+n=\dfrac{n\left(  n+1\right)  }{2}$, which is precisely the equality
(\ref{eq.ind.little-gauss}). Hence, Exercise \ref{exe.seqsum.sums.gauss} is solved.

Let us remark how the computation (\ref{sol.seqsum.sums.gauss.comp}) could be
rewritten without the use of $\sum$ signs:%
\begin{align*}
&  2\cdot\left(  0+1+\cdots+n\right)  \\
&  =\left(  0+1+\cdots+n\right)  +\left(  0+1+\cdots+n\right)  \\
&  =\left(  0+1+\cdots+n\right)  +\left(  n+\left(  n-1\right)  +\cdots
+0\right)  \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have turned
the second sum around using (\ref{eq.cor.seqsum.subs3.var1})}\right)  \\
&  =\underbrace{\left(  0+n\right)  }_{=n}+\underbrace{\left(  1+\left(
n-1\right)  \right)  }_{=n}+\cdots+\underbrace{\left(  n+0\right)  }_{=n}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have used
(\ref{eq.sum.linear1}) backwards}\right)  \\
&  =\underbrace{n+n+\cdots+n}_{n+1\text{ times}}=\left(  n+1\right)
n=n\left(  n+1\right)  .
\end{align*}
\footnote{We can also visualize this computation as a \textquotedblleft
picture proof\textquotedblright. For example, here is the picture for the case
$n=5$:%
\[%
%TCIMACRO{\TeXButton{tikz picture proof of gauss sum}{\begin{tikzpicture}%
%[scale=1]
%\filldraw[fill=red!25, draw=black] (0, 0) rectangle (1, 5);
%\node at (0.5, 2.5) {$5$};
%\filldraw[fill=blue!25, draw=black] (1, 0) rectangle (2, 1);
%\node at (1.5, 0.5) {$1$};
%\filldraw[fill=red!25, draw=black] (1, 1) rectangle (2, 5);
%\node at (1.5, 3) {$4$};
%\filldraw[fill=blue!25, draw=black] (2, 0) rectangle (3, 2);
%\node at (2.5, 1) {$2$};
%\filldraw[fill=red!25, draw=black] (2, 2) rectangle (3, 5);
%\node at (2.5, 3.5) {$3$};
%\filldraw[fill=blue!25, draw=black] (3, 0) rectangle (4, 3);
%\node at (3.5, 1.5) {$3$};
%\filldraw[fill=red!25, draw=black] (3, 3) rectangle (4, 5);
%\node at (3.5, 4) {$2$};
%\filldraw[fill=blue!25, draw=black] (4, 0) rectangle (5, 4);
%\node at (4.5, 2) {$4$};
%\filldraw[fill=red!25, draw=black] (4, 4) rectangle (5, 5);
%\node at (4.5, 4.5) {$1$};
%\filldraw[fill=blue!25, draw=black] (5, 0) rectangle (6, 5);
%\node at (5.5, 2.5) {$5$};
%\node[black] at (3, -0.5) {$n+1=6$};
%\node[black] at (-0.8, 2.5) {$n=5$};
%\draw[->, black] (0, -0.5) -- (2, -0.5);
%\draw[->, black] (6, -0.5) -- (4, -0.5);
%\draw[->, black] (-0.8, 0) -- (-0.8, 2.2);
%\draw[->, black] (-0.8, 5) -- (-0.8, 2.8);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1]
\filldraw[fill=red!25, draw=black] (0, 0) rectangle (1, 5);
\node at (0.5, 2.5) {$5$};
\filldraw[fill=blue!25, draw=black] (1, 0) rectangle (2, 1);
\node at (1.5, 0.5) {$1$};
\filldraw[fill=red!25, draw=black] (1, 1) rectangle (2, 5);
\node at (1.5, 3) {$4$};
\filldraw[fill=blue!25, draw=black] (2, 0) rectangle (3, 2);
\node at (2.5, 1) {$2$};
\filldraw[fill=red!25, draw=black] (2, 2) rectangle (3, 5);
\node at (2.5, 3.5) {$3$};
\filldraw[fill=blue!25, draw=black] (3, 0) rectangle (4, 3);
\node at (3.5, 1.5) {$3$};
\filldraw[fill=red!25, draw=black] (3, 3) rectangle (4, 5);
\node at (3.5, 4) {$2$};
\filldraw[fill=blue!25, draw=black] (4, 0) rectangle (5, 4);
\node at (4.5, 2) {$4$};
\filldraw[fill=red!25, draw=black] (4, 4) rectangle (5, 5);
\node at (4.5, 4.5) {$1$};
\filldraw[fill=blue!25, draw=black] (5, 0) rectangle (6, 5);
\node at (5.5, 2.5) {$5$};
\node[black] at (3, -0.5) {$n+1=6$};
\node[black] at (-0.8, 2.5) {$n=5$};
\draw[->, black] (0, -0.5) -- (2, -0.5);
\draw[->, black] (6, -0.5) -- (4, -0.5);
\draw[->, black] (-0.8, 0) -- (-0.8, 2.2);
\draw[->, black] (-0.8, 5) -- (-0.8, 2.8);
\end{tikzpicture}%
%EndExpansion
\ \ \ .
\]
The addends of the sum $0+1+\cdots+n$ are drawn as purple rectangles, whereas
the addends of the sum $n+\left(  n-1\right)  +\cdots+0$ are drawn as red
rectangles. (Rectangles of area $0$, corresponding to $0$ addends, are
degenerate and thus invisible.) The rectangles are matched in such a way that
the $i$-th column (counted from left, started with $0$) has a purple rectangle
of area $i$ and a red rectangle of area $n-i$. This matching corresponds
precisely to the way we matched our addends: $\underbrace{\left(  0+n\right)
}_{=n}+\underbrace{\left(  1+\left(  n-1\right)  \right)  }_{=n}%
+\cdots+\underbrace{\left(  n+0\right)  }_{=n}$.} This arguably looks simpler
than (\ref{sol.seqsum.sums.gauss.comp}), but it is clear that with more
complicated sums it will become progressively harder to avoid the use of
$\sum$ signs.
\end{proof}

Gauss's \textquotedblleft doubling trick\textquotedblright\ used in the above
solution is not a one-trick pony. Here is a more advanced use:

\begin{exercise}
\label{exe.ent.coprime.1+2+...+n}Let $n\in\mathbb{N}$. Let $d$ be an odd
positive integer. Prove that%
\[
1+2+\cdots+n\mid1^{d}+2^{d}+\cdots+n^{d}.
\]

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.coprime.1+2+...+n} (sketched).]This is
solved in detail in \cite[Exercise 2.10.8]{19s}; thus, we only give the
skeleton of the argument. In view of (\ref{eq.ind.little-gauss}), the claim
that we must prove rewrites as%
\[
\dfrac{n\left(  n+1\right)  }{2}\mid1^{d}+2^{d}+\cdots+n^{d}.
\]
This is equivalent to%
\begin{equation}
n\left(  n+1\right)  \mid2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)
\label{sol.ent.coprime.1+2+...+n.g}%
\end{equation}
(by Proposition \ref{prop.ent.div.acbc}). Hence, it suffices to prove
(\ref{sol.ent.coprime.1+2+...+n.g}).

In order to prove (\ref{sol.ent.coprime.1+2+...+n.g}), it suffices to show
that%
\begin{align}
n  &  \mid2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)
\ \ \ \ \ \ \ \ \ \ \text{and}\label{sol.ent.coprime.1+2+...+n.g1}\\
n+1  &  \mid2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)  .
\label{sol.ent.coprime.1+2+...+n.g2}%
\end{align}
Indeed, Example \ref{exa.ent.coprime.1} \textbf{(a)} (applied to $a=n$) yields
that $n$ is coprime to $n+1$; in other words, $n\perp n+1$. Hence, if we can
prove (\ref{sol.ent.coprime.1+2+...+n.g1}) and
(\ref{sol.ent.coprime.1+2+...+n.g2}), then we will get
(\ref{sol.ent.coprime.1+2+...+n.g}) by applying Theorem
\ref{thm.ent.coprime.combine}.

We shall prove (\ref{sol.ent.coprime.1+2+...+n.g2}) first:

[\textit{Proof of (\ref{sol.ent.coprime.1+2+...+n.g2}):} We have%
\begin{align*}
2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)   &  =\left(  1^{d}+2^{d}%
+\cdots+n^{d}\right)  +\left(  1^{d}+2^{d}+\cdots+n^{d}\right) \\
&  =\left(  1^{d}+2^{d}+\cdots+n^{d}\right)  +\left(  n^{d}+\left(
n-1\right)  ^{d}+\cdots+1^{d}\right) \\
&  =\sum_{k=1}^{n}k^{d}+\sum_{k=1}^{n}\underbrace{\left(  n+1-k\right)  ^{d}%
}_{\substack{\equiv\left(  -k\right)  ^{d}\operatorname{mod}n+1\\\text{(by
taking the congruence }n+1-k\equiv-k\operatorname{mod}n+1\\\text{to the
}d\text{-th power)}}}\\
&  \equiv\sum_{k=1}^{n}k^{d}+\sum_{k=1}^{n}\left(  -k\right)  ^{d}=\sum
_{k=1}^{n}\underbrace{\left(  k^{d}+\left(  -k\right)  ^{d}\right)
}_{\substack{=0\\\text{(since }d\text{ is odd, so that }\left(  -k\right)
^{d}=-k^{d}\text{)}}}\\
&  =\sum_{k=1}^{n}0=0\operatorname{mod}n+1.
\end{align*}
In other words, $n+1\mid2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)  $. Thus,
(\ref{sol.ent.coprime.1+2+...+n.g2}) is proven.]

[\textit{Proof of} \textit{(\ref{sol.ent.coprime.1+2+...+n.g1}):} If $n=0$,
then (\ref{sol.ent.coprime.1+2+...+n.g1}) boils down to $0\mid2\cdot0$, which
is obvious. Thus, for the rest of this proof, we WLOG assume that $n\neq0$.
Hence, $n-1\in\mathbb{N}$. Therefore, we can apply
(\ref{sol.ent.coprime.1+2+...+n.g2}) to $n-1$ instead of $n$ (since we have
already proven (\ref{sol.ent.coprime.1+2+...+n.g2}) for each $n\in\mathbb{N}%
$). We thus obtain%
\[
n\mid2\left(  1^{d}+2^{d}+\cdots+\left(  n-1\right)  ^{d}\right)  .
\]
In other words, $2\left(  1^{d}+2^{d}+\cdots+\left(  n-1\right)  ^{d}\right)
\equiv0\operatorname{mod}n$. Also, $d>0$ (since $d$ is odd), so that $n\mid
n^{d}$ and thus $n^{d}\equiv0\operatorname{mod}n$. Now,%
\begin{align*}
2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)   &  =2\left(  1^{d}+2^{d}%
+\cdots+\left(  n-1\right)  ^{d}+\underbrace{n^{d}}_{\equiv0\operatorname{mod}%
n}\right) \\
&  \equiv2\left(  1^{d}+2^{d}+\cdots+\left(  n-1\right)  ^{d}\right)
\equiv0\operatorname{mod}n.
\end{align*}
That is, $n\mid2\left(  1^{d}+2^{d}+\cdots+n^{d}\right)  $. This proves
(\ref{sol.ent.coprime.1+2+...+n.g1}).]

We have now proven both (\ref{sol.ent.coprime.1+2+...+n.g1}) and
(\ref{sol.ent.coprime.1+2+...+n.g2}). As we have explained, this yields
(\ref{sol.ent.coprime.1+2+...+n.g}), which in turn solves Exercise
\ref{exe.ent.coprime.1+2+...+n}.
\end{proof}

\subsubsection{The telescope principle}

The next summation rule is the so-called \textit{telescope principle}
(\cite[(16)]{detnotes}), which has a number of simple yet elegant applications:

\begin{theorem}
\label{thm.seqsum.telesc}Let $u$ and $v$ be two integers such that $u-1\leq
v$. Let $a_{s}$ be a number for each $s\in\left\{  u-1,u,\ldots,v\right\}  $.
Then,%
\begin{equation}
\sum_{s=u}^{v}\left(  a_{s}-a_{s-1}\right)  =a_{v}-a_{u-1}.
\label{eq.sum.telescope}%
\end{equation}

\end{theorem}

Intuitively, the claim of Theorem \ref{thm.seqsum.telesc} is obvious: The left
hand side of (\ref{eq.sum.telescope}) is%
\begin{align*}
\sum_{s=u}^{v}\underbrace{\left(  a_{s}-a_{s-1}\right)  }_{=-a_{s-1}+a_{s}}
&  =\sum_{s=u}^{v}\left(  -a_{s-1}+a_{s}\right) \\
&  =\left(  -a_{u-1}+a_{u}\right)  +\left(  -a_{u}+a_{u+1}\right)  +\left(
-a_{u+1}+a_{u+2}\right)  +\cdots+\left(  -a_{v-1}+a_{v}\right)  .
\end{align*}
If we expand the right hand side of this equality, then it \textquotedblleft
contracts like a telescope\textquotedblright\ (thus the name of Theorem
\ref{thm.seqsum.telesc}): All addends except for the $-a_{u-1}$ and the
$a_{v}$ cancel each other, and you are left with $-a_{u-1}+a_{v}=a_{v}%
-a_{u-1}$, which is exactly the right hand side of (\ref{eq.sum.telescope}).
(Be careful with this argument, though: It does not work for $v=u-1$. But this
case is trivial anyway.) This intuitive argument can be formalized.
Alternatively, Theorem \ref{thm.seqsum.telesc} can be proved by induction on
$v$ (the proof is utterly straightforward), or derived from Exercise
\ref{exe.seqsum.sums.split-addend-minus}.

Note that Theorem \ref{thm.seqsum.telesc} can be regarded as a discrete
version of the Second Part of the Fundamental Theorem of Calculus. In fact,
the latter fact says that $\int_{u}^{v}F^{\prime}\left(  x\right)  dx=F\left(
v\right)  -F\left(  u\right)  $ for any differentiable function $F$ on a
(real) interval $\left[  u,v\right]  $. But the $\sum$ sign is a discrete
analogue of the $\int$ sign, whereas the consecutive differences
$a_{s}-a_{s-1}$ are discrete analogues of the values of the derivative
$F^{\prime}$.

For all its simplicity, Theorem \ref{thm.seqsum.telesc} is a surprisingly
helpful tool for simplifying sums. The next four exercises are examples of this:

\begin{exercise}
\label{exe.seqsum.sums.telesc1}Let $n\in\mathbb{N}$. Simplify the sum
$\sum_{i=1}^{n}i\cdot i!$ (that is, rewrite it without using the $\sum$ sign).
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.telesc1}.]The trick is to realize
that each $i\in\mathbb{N}$ satisfies%
\begin{equation}
i\cdot i!=\left(  i+1\right)  !-i!\label{sol.seqsum.sums.telesc1.1}%
\end{equation}
(because $\left(  i+1\right)  !=\left(  i+1\right)  \cdot i!=i\cdot i!+i!$).
Thus,
\begin{align}
\sum_{i=1}^{n}\underbrace{i\cdot i!}_{\substack{=\left(  i+1\right)
!-i!\\\text{(by (\ref{sol.seqsum.sums.telesc1.1}))}}} &  =\sum_{i=1}%
^{n}\left(  \left(  i+1\right)  !-i!\right)  =\sum_{s=2}^{n+1}\left(  \left(
\underbrace{\left(  s-1\right)  +1}_{=s}\right)  !-\left(  s-1\right)
!\right)  \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have
substituted }s\text{ for }i+1\text{ in the sum}\right)  \nonumber\\
&  =\sum_{s=2}^{n+1}\left(  s!-\left(  s-1\right)  !\right)  =\left(
n+1\right)  !-\underbrace{\left(  2-1\right)  !}_{=1!=1}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Theorem \ref{thm.seqsum.telesc}, applied}\\
\text{to }u=2\text{, }v=n+1\text{ and }a_{s}=s!
\end{array}
\right)  \nonumber\\
&  =\left(  n+1\right)  !-1.\label{sol.seqsum.sums.telesc1.2}%
\end{align}
This solves Exercise \ref{exe.seqsum.sums.telesc1}.
\end{proof}

Before we move on to the next example, let us observe what we have gained from
the telescope principle. This equality (\ref{sol.seqsum.sums.telesc1.2}), once
it has been found, can easily be proved by induction on $n$ (see
\cite[solution to Exercise 2 \textbf{(b)}]{19s-hw0s} for such a proof); but
the telescope principle has helped us find this equality in the first place
(once we had the fancy to rewrite $i\cdot i!$ as $\left(  i+1\right)  !-i!$).
Thus, the telescope principle turns the (often difficult) question of
simplifying a sum into an (often simpler) question of rewriting its addends as
differences.\footnote{This is similar to computing an integral by finding an
antiderivative of the function under the integral sign.} Of course, it is not
magic: Any proof using the telescope principle can easily be rewritten as an
induction proof, because the telescope principle itself is easily proved by
induction. The main advantage of the principle is its convenience.

In future proofs, we shall be less detailed than in our above solution to
Exercise \ref{exe.seqsum.sums.telesc1}, and simply say \textquotedblleft by
the telescope principle\textquotedblright\ instead of specifying what we are
applying Theorem \ref{thm.seqsum.telesc} to.

The next exercise is about generalizing the formula (\ref{sol.series.iip1.Sn=}):

\begin{exercise}
\label{exe.seqsum.sums.telesc2}Let $p$ be a positive integer, and let
$n\in\mathbb{N}$. Simplify the sum
\[
\sum_{i=1}^{n}\dfrac{1}{i\left(  i+1\right)  \left(  i+2\right)  \cdots\left(
i+p\right)  }.
\]

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.telesc2}.]We define%
\[
a_{i}:=\dfrac{1}{\left(  i+1\right)  \left(  i+2\right)  \cdots\left(
i+p\right)  }%
\]
for each $i\in\mathbb{N}$. Then, it is easy to see that%
\begin{equation}
\dfrac{1}{i\left(  i+1\right)  \left(  i+2\right)  \cdots\left(  i+p\right)
}=\dfrac{a_{i-1}}{p}-\dfrac{a_{i}}{p} \label{sol.seqsum.sums.telesc2.1}%
\end{equation}
for any positive integer $i$.

\begin{fineprint}
Indeed, if $i$ is a positive integer, then%
\begin{align}
&  \underbrace{a_{i-1}}_{\substack{=\dfrac{1}{i\left(  i+1\right)
\cdots\left(  i+p-1\right)  }\\\text{(by the definition of }a_{i-1}\text{)}%
}}-\underbrace{a_{i}}_{\substack{=\dfrac{1}{\left(  i+1\right)  \left(
i+2\right)  \cdots\left(  i+p\right)  }\\\text{(by the definition of }%
a_{i}\text{)}}}\nonumber\\
&  =\underbrace{\dfrac{1}{i\left(  i+1\right)  \cdots\left(  i+p-1\right)  }%
}_{=\dfrac{i+p}{i\left(  i+1\right)  \cdots\left(  i+p-1\right)  \cdot\left(
i+p\right)  }}-\underbrace{\dfrac{1}{\left(  i+1\right)  \left(  i+2\right)
\cdots\left(  i+p\right)  }}_{=\dfrac{i}{i\cdot\left(  i+1\right)  \left(
i+2\right)  \cdots\left(  i+p\right)  }}\nonumber\\
&  =\dfrac{i+p}{i\left(  i+1\right)  \cdots\left(  i+p-1\right)  \cdot\left(
i+p\right)  }-\dfrac{i}{i\cdot\left(  i+1\right)  \left(  i+2\right)
\cdots\left(  i+p\right)  }\nonumber\\
&  =\dfrac{i+p}{i\left(  i+1\right)  \left(  i+2\right)  \cdots\left(
i+p\right)  }-\dfrac{i}{i\left(  i+1\right)  \left(  i+2\right)  \cdots\left(
i+p\right)  }\nonumber\\
&  =\dfrac{\left(  i+p\right)  -i}{i\left(  i+1\right)  \left(  i+2\right)
\cdots\left(  i+p\right)  }=\dfrac{p}{i\left(  i+1\right)  \left(  i+2\right)
\cdots\left(  i+p\right)  } \label{sol.seqsum.sums.telesc2.1.pf.1}%
\end{align}
and thus%
\begin{align*}
\dfrac{a_{i-1}}{p}-\dfrac{a_{i}}{p}  &  =\dfrac{1}{p}\left(  a_{i-1}%
-a_{i}\right)  =\dfrac{1}{p}\cdot\dfrac{p}{i\left(  i+1\right)  \left(
i+2\right)  \cdots\left(  i+p\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.seqsum.sums.telesc2.1.pf.1})}\right) \\
&  =\dfrac{1}{i\left(  i+1\right)  \left(  i+2\right)  \cdots\left(
i+p\right)  };
\end{align*}
this proves (\ref{sol.seqsum.sums.telesc2.1}).
\end{fineprint}

Now,
\begin{align}
&  \sum_{i=1}^{n}\underbrace{\dfrac{1}{i\left(  i+1\right)  \left(
i+2\right)  \cdots\left(  i+p\right)  }}_{\substack{=\dfrac{a_{i-1}}{p}%
-\dfrac{a_{i}}{p}\\\text{(by (\ref{sol.seqsum.sums.telesc2.1}))}}}\nonumber\\
&  =\sum_{i=1}^{n}\underbrace{\left(  \dfrac{a_{i-1}}{p}-\dfrac{a_{i}}%
{p}\right)  }_{=\dfrac{-a_{i}}{p}-\dfrac{-a_{i-1}}{p}}=\sum_{i=1}^{n}\left(
\dfrac{-a_{i}}{p}-\dfrac{-a_{i-1}}{p}\right) \nonumber\\
&  =\dfrac{-a_{n}}{p}-\dfrac{-a_{1-1}}{p}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
the telescope principle}\right) \nonumber\\
&  =\dfrac{1}{p}\left(  \underbrace{a_{1-1}}_{=a_{0}}-a_{n}\right)  =\dfrac
{1}{p}\left(  \underbrace{a_{0}}_{\substack{=\dfrac{1}{1\cdot2\cdot\cdots\cdot
p}\\\text{(by the definition of }a_{0}\text{)}}}-\underbrace{a_{n}%
}_{\substack{=\dfrac{1}{\left(  n+1\right)  \left(  n+2\right)  \cdots\left(
n+p\right)  }\\\text{(by the definition of }a_{n}\text{)}}}\right) \nonumber\\
&  =\dfrac{1}{p}\left(  \dfrac{1}{1\cdot2\cdot\cdots\cdot p}-\dfrac{1}{\left(
n+1\right)  \left(  n+2\right)  \cdots\left(  n+p\right)  }\right)  .
\label{sol.seqsum.sums.telesc2.end}%
\end{align}
This solves the exercise.
\end{proof}

Note that Exercise \ref{exe.seqsum.sums.telesc2} has no good answer for $p=0$.
Indeed, the sum $\sum_{i=1}^{n}\dfrac{1}{i}$ cannot be simplified. (It is
known as the $n$\textit{-th harmonic number}.)

Note also that, as an easy consequence of (\ref{sol.seqsum.sums.telesc2.end}),
we have%
\begin{equation}
\sum_{i=1}^{\infty}\dfrac{1}{i\left(  i+1\right)  \left(  i+2\right)
\cdots\left(  i+p\right)  }=\dfrac{1}{p}\cdot\dfrac{1}{1\cdot2\cdot\cdots\cdot
p} \label{sol.seqsum.sums.telesc2.infty}%
\end{equation}
for any positive integer $p$. This also \textquotedblleft
holds\textquotedblright\ for $p=0$, in the sense that the infinite series
$\sum_{i=1}^{\infty}\dfrac{1}{i}$ (known as the \textit{harmonic series})
diverges (which is precisely what one would expect from seeing the $\dfrac
{1}{p}=\dfrac{1}{0}$ term on the right hand side of
(\ref{sol.seqsum.sums.telesc2.infty})). This is a well-known fact, with
several proofs
\href{https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#Divergence}{on
the Wikipedia}.

To facilitate its future application, let us restate Theorem
\ref{thm.seqsum.telesc} in a form that will allow us to apply it without
substituting indices:

\begin{corollary}
\label{cor.seqsum.telesc-pos}Let $u$ and $v$ be two integers such that
$u-1\leq v$. Let $a_{i}$ be a number for each $i\in\left\{  u,u+1,\ldots
,v+1\right\}  $. Then,%
\[
\sum_{i=u}^{v}\left(  a_{i+1}-a_{i}\right)  =a_{v+1}-a_{u}.
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.seqsum.telesc-pos}.]We have $\left(  u+1\right)
-1=u\leq v+1$ (since $u-1\leq v$). Also,%
\begin{align*}
\sum_{i=u}^{v}\left(  a_{i+1}-a_{i}\right)   &  =\sum_{s=u+1}^{v+1}\left(
\underbrace{a_{\left(  s-1\right)  +1}}_{=a_{s}}-a_{s-1}\right)  \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have substituted }s-1\text{ for }i\text{ in the sum}\\
\text{(i.e., formally speaking, applied Corollary \ref{cor.seqsum.subs2})}%
\end{array}
\right)  \\
&  =\sum_{s=u+1}^{v+1}\left(  a_{s}-a_{s-1}\right)  =a_{v+1}%
-\underbrace{a_{\left(  u+1\right)  -1}}_{=a_{u}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Theorem \ref{thm.seqsum.telesc},}\\
\text{applied to }u+1\text{ and }v+1\text{ instead of }u\text{ and }v
\end{array}
\right)  \\
&  =a_{v+1}-a_{u}.
\end{align*}
This proves Corollary \ref{cor.seqsum.telesc-pos}.
\end{proof}

Corollary \ref{cor.seqsum.telesc-pos} is just Theorem \ref{thm.seqsum.telesc}
restated with a shifted index; thus, we shall still refer to it as the
\textquotedblleft telescope principle\textquotedblright.

\begin{exercise}
\label{exe.seqsum.sums.telesc3}Let $n\in\mathbb{N}$. Simplify the sum
$\sum_{i=1}^{n}\dfrac{1}{\sqrt{i}+\sqrt{i+1}}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.telesc3}.]If $x$ and $y$ are two
distinct positive reals, then%
\[
\left(  \sqrt{x}-\sqrt{y}\right)  \left(  \sqrt{x}+\sqrt{y}\right)  =\left(
\sqrt{x}\right)  ^{2}-\left(  \sqrt{y}\right)  ^{2}=x-y
\]
and thus%
\begin{equation}
\dfrac{1}{\sqrt{x}+\sqrt{y}}=\dfrac{\sqrt{x}-\sqrt{y}}{x-y}.
\label{sol.seqsum.sums.telesc3.1}%
\end{equation}
This formula might be well-known from high school (where it is used to
rationalize denominators).

Now, for each positive real $i$, we have%
\begin{align*}
\dfrac{1}{\sqrt{i}+\sqrt{i+1}}  &  =\dfrac{\sqrt{i}-\sqrt{i+1}}{i-\left(
i+1\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.seqsum.sums.telesc3.1})}\right) \\
&  =\dfrac{\sqrt{i}-\sqrt{i+1}}{-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}i-\left(  i+1\right)  =-1\right) \\
&  =\sqrt{i+1}-\sqrt{i}.
\end{align*}
Hence,%
\[
\sum_{i=1}^{n}\underbrace{\dfrac{1}{\sqrt{i}+\sqrt{i+1}}}_{=\sqrt{i+1}%
-\sqrt{i}}=\sum_{i=1}^{n}\left(  \sqrt{i+1}-\sqrt{i}\right)  =\sqrt{n+1}%
-\sqrt{1}%
\]
(by the telescope principle\footnote{specifically, by Corollary
\ref{cor.seqsum.telesc-pos}, applied to $u=1$, $v=n$ and $a_{i}=\sqrt{i}$}).
This simplifies further to $\sqrt{n+1}-1$.
\end{proof}

Finally, here is what might be the simplest application of the telescope
principle; we state it mainly because of its usefulness:

\begin{exercise}
\label{exe.seqsum.sums.telesc4}Let $a$ and $b$ be any numbers. Let
$m\in\mathbb{N}$. Then,%
\begin{equation}
\left(  a-b\right)  \sum_{i=0}^{m-1}a^{i}b^{m-1-i}=a^{m}-b^{m}.
\label{eq.sum.geometric-sum}%
\end{equation}

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.telesc4}.]From
(\ref{eq.sum.linear2}), we obtain%
\begin{align*}
\left(  a-b\right)  \sum_{i=0}^{m-1}a^{i}b^{m-1-i}  &  =\sum_{i=0}%
^{m-1}\underbrace{\left(  a-b\right)  a^{i}b^{m-1-i}}_{=aa^{i}b^{m-1-i}%
-ba^{i}b^{m-1-i}}=\sum_{i=0}^{m-1}\left(  \underbrace{aa^{i}b^{m-1-i}%
}_{=a^{i+1}b^{m-\left(  i+1\right)  }}-\underbrace{ba^{i}b^{m-1-i}}%
_{=a^{i}b^{m-i}}\right) \\
&  =\sum_{i=0}^{m-1}\left(  a^{i+1}b^{m-\left(  i+1\right)  }-a^{i}%
b^{m-i}\right) \\
&  =\underbrace{a^{\left(  m-1\right)  +1}}_{=a^{m}}\underbrace{b^{m-\left(
\left(  m-1\right)  +1\right)  }}_{=b^{0}=1}-\underbrace{a^{0}}_{=1}%
\underbrace{b^{m-0}}_{=b^{m}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the telescope principle (Corollary \ref{cor.seqsum.telesc-pos},}\\
\text{applied to }u=0\text{, }v=m-1\text{ and }a_{i}=a^{i}b^{m-i}\text{)}%
\end{array}
\right) \\
&  =a^{m}-b^{m}.
\end{align*}

\end{proof}

We notice that Exercise \ref{exe.seqsum.sums.telesc4} generalizes Exercise
\ref{exe.ind.geoser-b} and also yields a rather explicit new proof of
Proposition \ref{prop.ent.mod.k-power} (check it!).

\subsubsection{Splitting a sum into two}

Another general rule for sums is the following (\cite[(3)]{detnotes}):

\begin{theorem}
\label{thm.seqsum.sums.split-2}Let $S$ be a finite set. Let $X$ and $Y$ be two
subsets of $S$ such that $X\cap Y=\varnothing$ and $X\cup Y=S$. (Equivalently,
$X$ and $Y$ are two subsets of $S$ such that each element of $S$ lies in
\textbf{exactly} one of $X$ and $Y$.) Let $a_{s}$ be a number for each $s\in
S$. Then,%
\begin{equation}
\sum_{s\in S}a_{s}=\sum_{s\in X}a_{s}+\sum_{s\in Y}a_{s}. \label{eq.sum.split}%
\end{equation}

\end{theorem}

Here, as we explained, $\sum_{s\in X}a_{s}+\sum_{s\in Y}a_{s}$ stands for
$\left(  \sum_{s\in X}a_{s}\right)  +\left(  \sum_{s\in Y}a_{s}\right)  $.

Behind Theorem \ref{thm.seqsum.sums.split-2} stands the intuitively obvious
fact that a sum $\sum_{s\in S}a_{s}$ can be computed by first sorting its
addends into two \textquotedblleft heaps\textquotedblright\ $\sum_{s\in
X}a_{s}$ and $\sum_{s\in Y}a_{s}$, then summing each heap separately, and
finally adding the two heap sums together. For example, this says that%
\[
a_{1}+a_{2}+a_{3}+a_{4}+a_{5}=\left(  a_{1}+a_{4}\right)  +\left(  a_{2}%
+a_{3}+a_{5}\right)  .
\]
(This is the particular case of (\ref{eq.sum.split}) for $S=\left\{
1,2,3,4,5\right\}  $, $X=\left\{  1,4\right\}  $ and $Y=\left\{
2,3,5\right\}  $.)

Most commonly, Theorem \ref{thm.seqsum.sums.split-2} is used to split a sum of
the form $\sum_{s=u}^{w}a_{s}$ into two parts:

\begin{corollary}
\label{cor.seqsum.sums.split-2int}Let $u$, $v$ and $w$ be three integers such
that $u-1\leq v\leq w$. Let $a_{s}$ be a number for each $s\in\left\{
u,u+1,\ldots,w\right\}  $. Then,%
\begin{equation}
\sum_{s=u}^{w}a_{s}=\sum_{s=u}^{v}a_{s}+\sum_{s=v+1}^{w}a_{s}.
\label{eq.sum.split.uvw}%
\end{equation}

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.seqsum.sums.split-2int}.]Recall the assumption
$u-1\leq v\leq w$. Thus, the sets $\left\{  u,u+1,\ldots,v\right\}  $ and
$\left\{  v+1,v+2,\ldots,w\right\}  $ are subsets of the set $\left\{
u,u+1,\ldots,w\right\}  $ and satisfy%
\begin{align*}
\left\{  u,u+1,\ldots,v\right\}  \cap\left\{  v+1,v+2,\ldots,w\right\}   &
=\varnothing\ \ \ \ \ \ \ \ \ \ \text{and}\\
\left\{  u,u+1,\ldots,v\right\}  \cup\left\{  v+1,v+2,\ldots,w\right\}   &
=\left\{  u,u+1,\ldots,w\right\}  .
\end{align*}
Thus, Theorem \ref{thm.seqsum.sums.split-2} (applied to $S=\left\{
u,u+1,\ldots,w\right\}  $ and $X=\left\{  u,u+1,\ldots,v\right\}  $ and
$Y=\left\{  v+1,v+2,\ldots,w\right\}  $) yields%
\[
\sum_{s\in\left\{  u,u+1,\ldots,w\right\}  }a_{s}=\sum_{s\in\left\{
u,u+1,\ldots,v\right\}  }a_{s}+\sum_{s\in\left\{  v+1,v+2,\ldots,w\right\}
}a_{s}.
\]
But this rewrites as
\[
\sum_{s=u}^{w}a_{s}=\sum_{s=u}^{v}a_{s}+\sum_{s=v+1}^{w}a_{s}.
\]
Hence, Corollary \ref{cor.seqsum.sums.split-2int} is proved.
\end{proof}

Here are two examples of sums getting split:

\begin{exercise}
\label{exe.seqsum.sums.split-2int.1}Let $n\in\mathbb{N}$.

\textbf{(a)} Compute $\sum_{s=-n}^{n}\left\vert s\right\vert $.

\textbf{(b)} Compute $\sum_{s=0}^{2n-1}\left(  s\%2\right)  $.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.split-2int.1} (sketched).]%
\textbf{(a)} Corollary \ref{cor.seqsum.sums.split-2int} (applied to $u=-n$,
$v=0$, $w=n$ and $a_{s}=\left\vert s\right\vert $) yields%
\begin{align*}
\sum_{s=-n}^{n}\left\vert s\right\vert  &  =\sum_{s=-n}^{0}%
\underbrace{\left\vert s\right\vert }_{\substack{=-s\\\text{(since }%
s\leq0\text{)}}}+\sum_{s=1}^{n}\underbrace{\left\vert s\right\vert
}_{\substack{=s\\\text{(since }s\geq1\geq0\text{)}}}=\underbrace{\sum
_{s=-n}^{0}\left(  -s\right)  }_{=\sum_{s=-n}^{-1}\left(  -s\right)  +\left(
-0\right)  }+\sum_{s=1}^{n}s\\
&  =\underbrace{\sum_{s=-n}^{-1}\left(  -s\right)  }_{\substack{=\sum
_{t=1}^{n}t\\\text{(here, we have substituted }t\text{ for }-s\\\text{in the
sum, since the}\\\text{map }\left\{  1,2,\ldots,n\right\}  \rightarrow\left\{
-n,-n+1,\ldots,-1\right\}  ,\ s\mapsto-s\\\text{is a bijection)}%
}}+\underbrace{\left(  -0\right)  }_{=0}+\sum_{s=1}^{n}s=\sum_{t=1}^{n}%
t+\sum_{s=1}^{n}s\\
&  =\sum_{s=1}^{n}s+\sum_{s=1}^{n}s\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the summation index }t\\
\text{as }s\text{ in the first sum}%
\end{array}
\right) \\
&  =2\cdot\sum_{s=1}^{n}s=2\cdot\left(  1+2+\cdots+n\right)  =n\left(
n+1\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.sum.littlegauss1}%
)}\right)  .
\end{align*}


\textbf{(b)} Set $S=\left\{  0,1,\ldots,2n-1\right\}  $. Let $X$ be the set of
all even elements of $S$, and let $Y$ be the set of all odd elements of $S$.
Then, each element of $S$ lies in \textbf{exactly} one of $X$ and $Y$ (since
each element of $S$ is either even or odd, but not both). In other words,
$X\cap Y=\varnothing$ and $X\cup Y=S$. Therefore, we can apply Theorem
\ref{thm.seqsum.sums.split-2} to $a_{s}=s\%2$. We obtain%
\begin{equation}
\sum_{s\in S}\left(  s\%2\right)  =\sum_{s\in X}\left(  s\%2\right)
+\sum_{s\in Y}\left(  s\%2\right)  . \label{sol.seqsum.sums.split-2int.1.b.1}%
\end{equation}
Let us now simplify the right hand side. If $s\in X$, then $s$ is even (by the
definition of $X$) and thus satisfies $s\%2=0$ (by Exercise
\ref{exe.ent.even-odd.1} \textbf{(a)}). Hence, $\sum_{s\in X}%
\underbrace{\left(  s\%2\right)  }_{=0}=\sum_{s\in X}0=0$. On the other hand,
if $s\in Y$, then $s$ is odd (by the definition of $Y$) and thus satisfies
$s\%2=1$ (by Exercise \ref{exe.ent.even-odd.1} \textbf{(b)}). Hence,
$\sum_{s\in Y}\underbrace{\left(  s\%2\right)  }_{=1}=\sum_{s\in
Y}1=\left\vert Y\right\vert \cdot1$ (by (\ref{eq.sum.equal})). Now, what is
$\left\vert Y\right\vert $ ? We defined $Y$ as the set of all odd elements of
$S=\left\{  0,1,\ldots,2n-1\right\}  $; hence, the elements of $Y$ are
$1,3,5,\ldots,2n-1$. These are precisely $n$ elements\footnote{Strictly
speaking, this needs to be proved. It can be easily proved by induction on
$n$, or using Theorem \ref{thm.ent.quorem.full}.}. Thus, $\left\vert
Y\right\vert =n$. Hence, $\sum_{s\in Y}\left(  s\%2\right)  =\left\vert
Y\right\vert \cdot1=\left\vert Y\right\vert =n$. Now,
(\ref{sol.seqsum.sums.split-2int.1.b.1}) becomes%
\begin{equation}
\sum_{s\in S}\left(  s\%2\right)  =\underbrace{\sum_{s\in X}\left(
s\%2\right)  }_{=0}+\underbrace{\sum_{s\in Y}\left(  s\%2\right)  }%
_{=n}=0+n=n. \label{sol.seqsum.sums.split-2int.1.b.3}%
\end{equation}
Since $S=\left\{  0,1,\ldots,2n-1\right\}  $, we can rewrite the $\sum_{s\in
S}$ sign on the left hand side as $\sum_{s=0}^{2n-1}$. Thus,
(\ref{sol.seqsum.sums.split-2int.1.b.3}) rewrites as $\sum_{s=0}^{2n-1}\left(
s\%2\right)  =n$.
\end{proof}

The following is just a restatement of Theorem \ref{thm.seqsum.sums.split-2}
using the notation from Definition \ref{def.seqsum.sums.filtered}:

\begin{theorem}
\label{thm.seqsum.sums.split-A-notA}Let $S$ be a finite set. For each $s\in
S$, let $a_{s}$ be a number, and let $\mathcal{A}\left(  s\right)  $ be a
logical statement. Then,%
\[
\sum_{s\in S}a_{s}=\sum_{\substack{s\in S;\\\mathcal{A}\left(  s\right)
\text{ is true}}}a_{s}+\sum_{\substack{s\in S;\\\mathcal{A}\left(  s\right)
\text{ is false}}}a_{s}=\sum_{\substack{s\in S;\\\mathcal{A}\left(  s\right)
}}a_{s}+\sum_{\substack{s\in S;\\\text{not }\mathcal{A}\left(  s\right)
}}a_{s}.
\]
(The right hand side is just a shorter way to rewrite the middle hand side;
there is nothing profound happening here.)
\end{theorem}

\subsubsection{Splitting a sum into several}

Theorem \ref{thm.seqsum.sums.split-2} has a rather natural generalization
(\cite[(26)]{detnotes}), in which a sum is split into $n$ instead of $2$
smaller sums:

\begin{theorem}
\label{thm.seqsum.sums.split-m}Let $S$ be a finite set. Let $S_{1}%
,S_{2},\ldots,S_{n}$ be finitely many subsets of $S$. Assume that these
subsets $S_{1},S_{2},\ldots,S_{n}$ are pairwise disjoint (i.e., we have
$S_{i}\cap S_{j}=\varnothing$ for any two distinct elements $i$ and $j$ of
$\left\{  1,2,\ldots,n\right\}  $) and their union is $S$. (Thus, every
element of $S$ lies in precisely one of the subsets $S_{1},S_{2},\ldots,S_{n}%
$.) Let $a_{s}$ be a number for each $s\in S$. Then,%
\begin{align}
\sum_{s\in S}a_{s}  &  =\sum_{w=1}^{n}\sum_{s\in S_{w}}a_{s}%
\label{eq.sum.split-n}\\
&  =\sum_{s\in S_{1}}a_{s}+\sum_{s\in S_{2}}a_{s}+\cdots+\sum_{s\in S_{n}%
}a_{s}. \label{eq.sum.split-n-rewr}%
\end{align}

\end{theorem}

Note that the sum on the right hand side of (\ref{eq.sum.split-n}) is a
\textit{double sum} -- i.e., a sum of sums.

Theorem \ref{thm.seqsum.sums.split-2} is the particular case of Theorem
\ref{thm.seqsum.sums.split-m} obtained if we set $n=2$, $S_{1}=X$ and
$S_{2}=Y$.

As an example for the use of Theorem \ref{thm.seqsum.sums.split-m}, here is a
pretty obvious exercise:

\begin{exercise}
\label{exe.seqsum.sums.split-m.3}Let $I$ be a finite set of integers. For each
pair $\left(  i,j\right)  \in I\times I$, let $a_{\left(  i,j\right)  }$ be a
number. Prove that%
\[
\sum_{\left(  i,j\right)  \in I\times I}a_{\left(  i,j\right)  }=\sum_{i\in
I}a_{\left(  i,i\right)  }+\sum_{\substack{\left(  i,j\right)  \in I\times
I;\\i<j}}\left(  a_{\left(  i,j\right)  }+a_{\left(  j,i\right)  }\right)  .
\]

\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.split-m.3}.]Let $S$ be the set
$I\times I$. Define three subsets $S_{1}$, $S_{2}$ and $S_{3}$ of $S$ by%
\begin{align*}
S_{1}  &  =\left\{  \left(  i,j\right)  \in I\times I\ \mid\ i<j\right\}  ,\\
S_{2}  &  =\left\{  \left(  i,j\right)  \in I\times I\ \mid\ i=j\right\}  ,\\
S_{3}  &  =\left\{  \left(  i,j\right)  \in I\times I\ \mid\ i>j\right\}  .
\end{align*}
Then, every element of $S$ lies in precisely one of the subsets $S_{1}%
,S_{2},S_{3}$. In other words, the three subsets $S_{1},S_{2},S_{3}$ are
pairwise disjoint and their union is $S$. Hence, (\ref{eq.sum.split-n-rewr})
(applied to $n=3$) yields%
\[
\sum_{s\in S}a_{s}=\sum_{s\in S_{1}}a_{s}+\sum_{s\in S_{2}}a_{s}+\sum_{s\in
S_{3}}a_{s}.
\]
Renaming the index $s$ as $\left(  i,j\right)  $ in each sum of this equality,
we obtain%
\begin{equation}
\sum_{\left(  i,j\right)  \in S}a_{\left(  i,j\right)  }=\sum_{\left(
i,j\right)  \in S_{1}}a_{\left(  i,j\right)  }+\sum_{\left(  i,j\right)  \in
S_{2}}a_{\left(  i,j\right)  }+\sum_{\left(  i,j\right)  \in S_{3}}a_{\left(
i,j\right)  }. \label{sol.seqsum.sums.split-m.3.2}%
\end{equation}


We shall now take a closer look at the sums on the right hand side.

The set $S_{2}=\left\{  \left(  i,j\right)  \in I\times I\ \mid\ i=j\right\}
$ consists of the pairs $\left(  i,i\right)  $ for all $i\in I$. More
precisely, there is a bijection%
\begin{align*}
I  &  \rightarrow S_{2},\\
i  &  \mapsto\left(  i,i\right)  .
\end{align*}
Thus, we can substitute $\left(  i,i\right)  $ for $\left(  i,j\right)  $ in
the sum $\sum_{\left(  i,j\right)  \in S_{2}}a_{\left(  i,j\right)  }$. This
sum therefore rewrites as follows:%
\begin{equation}
\sum_{\left(  i,j\right)  \in S_{2}}a_{\left(  i,j\right)  }=\sum_{i\in
I}a_{\left(  i,i\right)  }. \label{sol.seqsum.sums.split-m.3.S2}%
\end{equation}


Furthermore, there is a bijection between the two sets $S_{1}=\left\{  \left(
i,j\right)  \in I\times I\ \mid\ i<j\right\}  $ and $S_{3}=\left\{  \left(
i,j\right)  \in I\times I\ \mid\ i>j\right\}  $. Namely, the map%
\begin{align*}
S_{1}  &  \rightarrow S_{3},\\
\left(  i,j\right)   &  \mapsto\left(  j,i\right)
\end{align*}
is a bijection (because if $\left(  i,j\right)  \in I\times I$ satisfies
$i<j$, then $j>i$, and vice versa). Therefore, we can substitute $\left(
j,i\right)  $ for $\left(  i,j\right)  $ in the sum $\sum_{\left(  i,j\right)
\in S_{3}}a_{\left(  i,j\right)  }$. This sum therefore rewrites as follows:%
\begin{equation}
\sum_{\left(  i,j\right)  \in S_{3}}a_{\left(  i,j\right)  }=\sum_{\left(
i,j\right)  \in S_{1}}a_{\left(  j,i\right)  }.
\label{sol.seqsum.sums.split-m.3.S3}%
\end{equation}


Finally, $I\times I=S$, so that%
\begin{align*}
\sum_{\left(  i,j\right)  \in I\times I}a_{\left(  i,j\right)  }  &
=\sum_{\left(  i,j\right)  \in S}a_{\left(  i,j\right)  }=\sum_{\left(
i,j\right)  \in S_{1}}a_{\left(  i,j\right)  }+\underbrace{\sum_{\left(
i,j\right)  \in S_{2}}a_{\left(  i,j\right)  }}_{\substack{=\sum_{i\in
I}a_{\left(  i,i\right)  }\\\text{(by (\ref{sol.seqsum.sums.split-m.3.S2}))}%
}}+\underbrace{\sum_{\left(  i,j\right)  \in S_{3}}a_{\left(  i,j\right)  }%
}_{\substack{=\sum_{\left(  i,j\right)  \in S_{1}}a_{\left(  j,i\right)
}\\\text{(by (\ref{sol.seqsum.sums.split-m.3.S3}))}}%
}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.seqsum.sums.split-m.3.2}%
)}\right) \\
&  =\sum_{\left(  i,j\right)  \in S_{1}}a_{\left(  i,j\right)  }+\sum_{i\in
I}a_{\left(  i,i\right)  }+\sum_{\left(  i,j\right)  \in S_{1}}a_{\left(
j,i\right)  }=\sum_{i\in I}a_{\left(  i,i\right)  }+\underbrace{\sum_{\left(
i,j\right)  \in S_{1}}a_{\left(  i,j\right)  }+\sum_{\left(  i,j\right)  \in
S_{1}}a_{\left(  j,i\right)  }}_{\substack{=\sum_{\left(  i,j\right)  \in
S_{1}}\left(  a_{\left(  i,j\right)  }+a_{\left(  j,i\right)  }\right)
\\\text{(by (\ref{eq.sum.linear1}))}}}\\
&  =\sum_{i\in I}a_{\left(  i,i\right)  }+\underbrace{\sum_{\left(
i,j\right)  \in S_{1}}\left(  a_{\left(  i,j\right)  }+a_{\left(  j,i\right)
}\right)  }_{\substack{=\sum_{\substack{\left(  i,j\right)  \in I\times
I;\\i<j}}\left(  a_{\left(  i,j\right)  }+a_{\left(  j,i\right)  }\right)
\\\text{(since }S_{1}=\left\{  \left(  i,j\right)  \in I\times I\ \mid
\ i<j\right\}  \text{)}}}=\sum_{i\in I}a_{\left(  i,i\right)  }+\sum
_{\substack{\left(  i,j\right)  \in I\times I;\\i<j}}\left(  a_{\left(
i,j\right)  }+a_{\left(  j,i\right)  }\right)  .
\end{align*}
This solves Exercise \ref{exe.seqsum.sums.split-m.3}.
\end{proof}

The following theorem (\cite[(22)]{detnotes}) provides a more elaborate way of
splitting a sum:

\begin{theorem}
\label{thm.seqsum.sums.split-val}Let $S$ be a finite set. Let $W$ be a finite
set. Let $f:S\rightarrow W$ be a map. Let $a_{s}$ be a number for each $s\in
S$. Then,%
\begin{equation}
\sum_{s\in S}a_{s}=\sum_{w\in W}\sum_{\substack{s\in S;\\f\left(  s\right)
=w}}a_{s}. \label{eq.sum.sheph}%
\end{equation}

\end{theorem}

The idea behind the formula (\ref{eq.sum.sheph}) is the following: The left
hand side is the sum of all $a_{s}$ for $s\in S$. The right hand side is what
you get if you first subdivide the collection of numbers $a_{s}$ into heaps
according to the value of $f\left(  s\right)  $ (with one heap for each $w\in
W$), then sum each heap, and then sum the resulting heap sums. That the two
sides are equal is thus quite obvious, although the rigorous proof would
require some bookkeeping\footnote{See \cite[Theorem 2.127]{detnotes} for a
proof by induction on $\left\vert S\right\vert $.}.

When we apply Theorem \ref{thm.seqsum.sums.split-val} to rewrite a sum
$\sum_{s\in S}a_{s}$ as $\sum_{w\in W}\sum_{\substack{s\in S;\\f\left(
s\right)  =w}}a_{s}$, we say that we are \textit{splitting} the sum
$\sum_{s\in S}a_{s}$ \textit{according to the value of }$f\left(  s\right)  $.

Let us illustrate the use of Theorem \ref{thm.seqsum.sums.split-val} by an
exercise that generalizes Exercise \ref{exe.seqsum.sums.split-2int.1}
\textbf{(b)}:

\begin{exercise}
\label{exe.seqsum.sums.split-m.rem}Let $n$ be a positive integer. Let
$m\in\mathbb{N}$. Prove that%
\[
\sum_{k=0}^{mn-1}\left(  k\%n\right)  =\dfrac{mn\left(  n-1\right)  }{2}.
\]

\end{exercise}

(It is easy to see that Exercise \ref{exe.seqsum.sums.split-2int.1}
\textbf{(b)} follows from Exercise \ref{exe.seqsum.sums.split-m.rem}, applied
to $2$ and $n$ instead of $n$ and $m$.)

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.split-m.rem} (sketched).]We let $S$
be the set $\left\{  0,1,\ldots,mn-1\right\}  $. Let $W$ be the set $\left\{
0,1,\ldots,n-1\right\}  $. Define a map%
\begin{align*}
f:S  &  \rightarrow W,\\
k  &  \mapsto k\%n.
\end{align*}
(This is well-defined, since each $k\in S$ satisfies $k\%n\in\left\{
0,1,\ldots,n-1\right\}  =W$.) Thus, (\ref{eq.sum.sheph}) (applied to
$a_{s}=k\%n$) yields%
\begin{align}
\sum_{s\in S}\left(  s\%n\right)   &  =\sum_{w\in W}\underbrace{\sum
_{\substack{s\in S;\\f\left(  s\right)  =w}}\left(  s\%n\right)
}_{\substack{=\sum_{\substack{s\in S;\\s\%n=w}}\left(  s\%n\right)
\\\text{(since }f\left(  s\right)  =s\%n\text{ for each }s\in S\text{)}}%
}=\sum_{w\in W}\sum_{\substack{s\in S;\\s\%n=w}}\underbrace{\left(
s\%n\right)  }_{=w}\nonumber\\
&  =\sum_{w\in W}\sum_{\substack{s\in S;\\s\%n=w}}w.
\label{sol.seqsum.sums.split-m.rem.1}%
\end{align}


Now, let us simplify the sum $\sum_{\substack{s\in S;\\s\%n=w}}w$ for each
$w\in W$. Indeed, fix $w\in W$. The summation sign $\sum_{\substack{s\in
S;\\s\%n=w}}$ is just shorthand for $\sum_{s\in\left\{  k\in S\ \mid
\ k\%n=w\right\}  }$ (by Definition \ref{def.seqsum.sums.filtered}). Thus, we
have%
\begin{equation}
\sum_{\substack{s\in S;\\s\%n=w}}w=\sum_{s\in\left\{  k\in S\ \mid
\ k\%n=w\right\}  }w=\left\vert \left\{  k\in S\ \mid\ k\%n=w\right\}
\right\vert \cdot w \label{sol.seqsum.sums.split-m.rem.2}%
\end{equation}
(by (\ref{eq.sum.equal})). Now, we need to compute $\left\vert \left\{  k\in
S\ \mid\ k\%n=w\right\}  \right\vert $, that is, find the number of all $k\in
S$ satisfying $k\%n=w$.

Recall that $S=\left\{  0,1,\ldots,mn-1\right\}  $ and $w\in W=\left\{
0,1,\ldots,n-1\right\}  $. Thus, the elements $k\in S$ satisfying $k\%n=w$ are
the $m$ elements%
\[
w,\ \ n+w,\ \ 2n+w,\ \ 3n+w,\ \ \ldots,\ \ \left(  m-1\right)  n+w.
\]
Hence, there are exactly $m$ such elements. In other words,
\[
\left\vert \left\{  k\in S\ \mid\ k\%n=w\right\}  \right\vert =m.
\]
In light of this, (\ref{sol.seqsum.sums.split-m.rem.2}) becomes%
\begin{equation}
\sum_{\substack{s\in S;\\s\%n=w}}w=\underbrace{\left\vert \left\{  k\in
S\ \mid\ k\%n=w\right\}  \right\vert }_{=m}\cdot w=mw.
\label{sol.seqsum.sums.split-m.rem.3}%
\end{equation}


Forget that we fixed $w$. We thus have proved
(\ref{sol.seqsum.sums.split-m.rem.3}) for each $w\in W$. Now,
(\ref{sol.seqsum.sums.split-m.rem.1}) becomes%
\begin{align*}
\sum_{s\in S}\left(  s\%n\right)   &  =\sum_{w\in W}\underbrace{\sum
_{\substack{s\in S;\\s\%n=w}}w}_{\substack{=mw\\\text{(by
(\ref{sol.seqsum.sums.split-m.rem.3}))}}}=\sum_{w\in W}mw=\sum_{w=0}%
^{n-1}mw\ \ \ \ \ \ \ \ \ \ \left(  \text{since }W=\left\{  0,1,\ldots
,n-1\right\}  \right) \\
&  =m\underbrace{\sum_{w=0}^{n-1}w}_{\substack{=0+1+2+\cdots+\left(
n-1\right)  \\=1+2+\cdots+\left(  n-1\right)  \\=\dfrac{\left(  n-1\right)
\left(  \left(  n-1\right)  +1\right)  }{2}\\\text{(by
(\ref{eq.sum.littlegauss1}), applied}\\\text{to }n-1\text{ instead of
}n\text{)}}}=m\dfrac{\left(  n-1\right)  \left(  \left(  n-1\right)
+1\right)  }{2}=m\dfrac{\left(  n-1\right)  n}{2}\\
&  =\dfrac{mn\left(  n-1\right)  }{2}.
\end{align*}
This solves Exercise \ref{exe.seqsum.sums.split-m.rem}.
\end{proof}

\subsubsection{Fubini's principle and interchange of summation signs}

Probably the most complicated rule for summation signs (although this is not
saying a lot) is \textit{Fubini's theorem for finite sums}. We first state it
in a particular case (\cite[(28)]{detnotes}):

\begin{theorem}
\label{thm.seqsum.sums.fubini-mn}Let $n\in\mathbb{N}$ and $m\in\mathbb{N}$.
Let $a_{\left(  x,y\right)  }$ be a number for each $\left(  x,y\right)
\in\left\{  1,2,\ldots,n\right\}  \times\left\{  1,2,\ldots,m\right\}  $.
Then,
\begin{equation}
\sum_{x=1}^{n}\sum_{y=1}^{m}a_{\left(  x,y\right)  }=\sum_{\left(  x,y\right)
\in\left\{  1,2,\ldots,n\right\}  \times\left\{  1,2,\ldots,m\right\}
}a_{\left(  x,y\right)  }=\sum_{y=1}^{m}\sum_{x=1}^{n}a_{\left(  x,y\right)
}. \label{eq.sum.fubini.nm}%
\end{equation}

\end{theorem}

Intuitively, Theorem \ref{thm.seqsum.sums.fubini} says that if you have a
rectangular table filled with numbers, then you can sum the entries of the
table by going along rows (and then summing the row tallies), or by going
along columns (and then summing the column tallies), or plainly by summing all
the entries in some unspecified way. Indeed, if our table is the rectangular
table%
\[%
\begin{tabular}
[c]{|cccc|}\hline
$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)  }$\\\hline
\end{tabular}
\ \ \ \ ,
\]
then the sum obtained by going along rows is%
\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) \\
&  =\sum_{x=1}^{n}\sum_{y=1}^{m}a_{\left(  x,y\right)  },
\end{align*}
whereas the sum obtained by going along columns is%
\begin{align*}
&  \ \ \ \ \ \ \ \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) \\
&  =\sum_{y=1}^{m}\sum_{x=1}^{n}a_{\left(  x,y\right)  },
\end{align*}
and the sum obtained in an unspecified way is simply
\[
\sum_{\left(  x,y\right)  \in\left\{  1,2,\ldots,n\right\}  \times\left\{
1,2,\ldots,m\right\}  }a_{\left(  x,y\right)  }.
\]
Thus, (\ref{eq.sum.fubini.nm}) states precisely that these three sums are equal.

We can generalize Theorem \ref{thm.seqsum.sums.fubini-mn} by replacing the
sets $\left\{  1,2,\ldots,n\right\}  $ and $\left\{  1,2,\ldots,m\right\}  $
by any two finite sets $X$ and $Y$:

\begin{theorem}
\label{thm.seqsum.sums.fubini}Let $X$ and $Y$ be two finite sets. Let
$a_{\left(  x,y\right)  }$ be a number for each $\left(  x,y\right)  \in
X\times Y$. Then,%
\begin{equation}
\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)  }. \label{eq.sum.fubini}%
\end{equation}

\end{theorem}

Theorem \ref{thm.seqsum.sums.fubini} is \cite[(27)]{detnotes} (and a proof can
be found there). Of course, Theorem \ref{thm.seqsum.sums.fubini} can in turn
be recovered from Theorem \ref{thm.seqsum.sums.fubini-mn}, because any two
finite sets $X$ and $Y$ can be relabeled as $\left\{  1,2,\ldots,n\right\}  $
and $\left\{  1,2,\ldots,m\right\}  $ for appropriate $n$ and $m$.

Theorem \ref{thm.seqsum.sums.fubini} is called \textit{Fubini's theorem for
finite sums}, due to its similarity to the (much deeper and subtler) Fubini's
theorems in analysis (which allow interchanging infinite sums or integrals).
Unlike the latter, it comes with no restrictions (like absolute convergence or measurability).

Theorem \ref{thm.seqsum.sums.fubini} can be used in multiple ways. When we use
it to rewrite a sum $\sum_{\left(  x,y\right)  \in X\times Y}a_{\left(
x,y\right)  }$ as $\sum_{x\in X}\sum_{y\in Y}a_{\left(  x,y\right)  }$, we say
that we are \textit{decomposing} the summation sign $\sum_{\left(  x,y\right)
\in X\times Y}$. When we use it to rewrite a double sum $\sum_{x\in X}%
\sum_{y\in Y}a_{\left(  x,y\right)  }$ as $\sum_{y\in Y}\sum_{x\in
X}a_{\left(  x,y\right)  }$, we say that we are \textit{interchanging} the
summation signs $\sum_{x\in X}$ and $\sum_{y\in Y}$. Note that two summation
signs can only be interchanged in this way if the sets $X$ and $Y$ that they
range over are independent of $x$ and $y$; for example, we can interchange the
two summation signs in the double sum $\sum_{x=1}^{n}\sum_{y=1}^{m}$, but we
cannot interchange the two summation signs in the double sum $\sum_{x=1}%
^{n}\sum_{y=1}^{x}$. (But we shall see below how we can nevertheless transform
the latter double sum.)

Here is a simple (yet quite useful) application of Theorem
\ref{thm.seqsum.sums.fubini-mn}:

\begin{exercise}
\label{exe.seqsum.sums.fubini.sum-xiyj}Let $n\in\mathbb{N}$ and $m\in
\mathbb{N}$. Let $u_{1},u_{2},\ldots,u_{n}$ and $v_{1},v_{2},\ldots,v_{m}$ be
numbers. Prove that%
\[
\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{j=1}^{m}v_{j}\right)
=\sum_{\left(  i,j\right)  \in\left\{  1,2,\ldots,n\right\}  \times\left\{
1,2,\ldots,m\right\}  }u_{i}v_{j}.
\]

\end{exercise}

Obviously, Exercise \ref{exe.seqsum.sums.fubini.sum-xiyj} is nothing else than
a souped-up distributivity law, saying that a product of two finite sums can
be expanded into a sum of all possible products of an addend in the former
with an addend in the latter. Facts like this can be used without proof (and
even without saying) on any exam, but let us give a formal proof to illustrate
the use of Theorem \ref{thm.seqsum.sums.fubini-mn}:

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.fubini.sum-xiyj}.]Applying
(\ref{eq.sum.linear2}) to $\lambda=\sum_{i=1}^{n}u_{i}$ and $S=\left\{
1,2,\ldots,m\right\}  $ and $a_{s}=v_{s}$, we find%
\[
\sum_{s=1}^{m}\left(  \sum_{i=1}^{n}u_{i}\right)  v_{s}=\left(  \sum_{i=1}%
^{n}u_{i}\right)  \left(  \sum_{s=1}^{m}v_{s}\right)  .
\]
Renaming the summation index $s$ as $j$ in this equality, we obtain%
\[
\sum_{j=1}^{m}\left(  \sum_{i=1}^{n}u_{i}\right)  v_{j}=\left(  \sum_{i=1}%
^{n}u_{i}\right)  \left(  \sum_{j=1}^{m}v_{j}\right)  .
\]
Hence,%
\begin{align}
\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{j=1}^{m}v_{j}\right)   &
=\sum_{j=1}^{m}\underbrace{\left(  \sum_{i=1}^{n}u_{i}\right)  v_{j}%
}_{\substack{=v_{j}\left(  \sum_{i=1}^{n}u_{i}\right)  \\=\sum_{i=1}^{n}%
v_{j}u_{i}\\\text{(again by (\ref{eq.sum.linear2}))}}}=\sum_{j=1}^{m}%
\sum_{i=1}^{n}\underbrace{v_{j}u_{i}}_{=u_{i}v_{j}}\nonumber\\
&  =\sum_{j=1}^{m}\sum_{i=1}^{n}u_{i}v_{j}.
\label{sol.seqsum.sums.fubini.sum-xiyj.1}%
\end{align}
But Theorem \ref{thm.seqsum.sums.fubini-mn} (applied to $a_{\left(
x,y\right)  }=u_{x}v_{y}$) yields%
\[
\sum_{x=1}^{n}\sum_{y=1}^{m}u_{x}v_{y}=\sum_{\left(  x,y\right)  \in\left\{
1,2,\ldots,n\right\}  \times\left\{  1,2,\ldots,m\right\}  }u_{x}v_{y}%
=\sum_{y=1}^{m}\sum_{x=1}^{n}u_{x}v_{y}.
\]
Renaming the indices $x$ and $y$ as $i$ and $j$ in this chain of equalities,
we obtain%
\[
\sum_{i=1}^{n}\sum_{j=1}^{m}u_{i}v_{j}=\sum_{\left(  i,j\right)  \in\left\{
1,2,\ldots,n\right\}  \times\left\{  1,2,\ldots,m\right\}  }u_{i}v_{j}%
=\sum_{j=1}^{m}\sum_{i=1}^{n}u_{i}v_{j}.
\]
Hence,%
\[
\sum_{\left(  i,j\right)  \in\left\{  1,2,\ldots,n\right\}  \times\left\{
1,2,\ldots,m\right\}  }u_{i}v_{j}=\sum_{j=1}^{m}\sum_{i=1}^{n}u_{i}%
v_{j}=\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{j=1}^{m}v_{j}\right)
\]
(by (\ref{sol.seqsum.sums.fubini.sum-xiyj.1})). This solves Exercise
\ref{exe.seqsum.sums.fubini.sum-xiyj}.
\end{proof}

A consequence of Exercise \ref{exe.seqsum.sums.fubini.sum-xiyj} is the
\textquotedblleft multinomial formula\textquotedblright\ for the square of a
finite sum:

\begin{exercise}
\label{exe.seqsum.sums.fubini.sum-uisq}Let $n\in\mathbb{N}$. Let $u_{1}%
,u_{2},\ldots,u_{n}$ be numbers. Prove that%
\begin{equation}
\left(  \sum_{i=1}^{n}u_{i}\right)  ^{2}=\sum_{i=1}^{n}u_{i}^{2}+2\sum_{1\leq
i<j\leq n}u_{i}u_{j}. \label{eq.exe.seqsum.sums.fubini.sum-uisq.eq}%
\end{equation}
Here, the summation sign \textquotedblleft$\sum_{1\leq i<j\leq n}%
$\textquotedblright\ is shorthand for $\sum_{\substack{\left(  i,j\right)
\in\left\{  1,2,\ldots,n\right\}  ^{2};\\i<j}}$. (For example, $\sum_{1\leq
i<j\leq3}u_{i}u_{j}=u_{1}u_{2}+u_{1}u_{3}+u_{2}u_{3}$.)
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.fubini.sum-uisq}.]Exercise
\ref{exe.seqsum.sums.fubini.sum-xiyj} (applied to $m=n$ and $v_{j}=u_{j}$)
yields%
\begin{align*}
\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{j=1}^{n}u_{j}\right)   &
=\sum_{\left(  i,j\right)  \in\left\{  1,2,\ldots,n\right\}  \times\left\{
1,2,\ldots,n\right\}  }u_{i}u_{j}\\
&  =\sum_{i\in\left\{  1,2,\ldots,n\right\}  }\underbrace{u_{i}u_{i}}%
_{=u_{i}^{2}}+\sum_{\substack{\left(  i,j\right)  \in\left\{  1,2,\ldots
,n\right\}  \times\left\{  1,2,\ldots,n\right\}  ;\\i<j}}\underbrace{\left(
u_{i}u_{j}+u_{j}u_{i}\right)  }_{=2u_{i}u_{j}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Exercise \ref{exe.seqsum.sums.split-m.3}, applied to }I=\left\{
1,2,\ldots,n\right\} \\
\text{and }a_{\left(  i,j\right)  }=u_{i}u_{j}%
\end{array}
\right) \\
&  =\sum_{i\in\left\{  1,2,\ldots,n\right\}  }u_{i}^{2}+\sum
_{\substack{\left(  i,j\right)  \in\left\{  1,2,\ldots,n\right\}
\times\left\{  1,2,\ldots,n\right\}  ;\\i<j}}2u_{i}u_{j}\\
&  =\sum_{i=1}^{n}u_{i}^{2}+\underbrace{\sum_{1\leq i<j\leq n}2u_{i}u_{j}%
}_{=2\sum_{1\leq i<j\leq n}u_{i}u_{j}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have rewritten the summation}\\
\text{signs }\sum_{i\in\left\{  1,2,\ldots,n\right\}  }\text{ and }%
\sum_{\substack{\left(  i,j\right)  \in\left\{  1,2,\ldots,n\right\}
\times\left\{  1,2,\ldots,n\right\}  ;\\i<j}}\\
\text{as }\sum_{i=1}^{n}\text{ and }\sum_{1\leq i<j\leq n}%
\end{array}
\right) \\
&  =\sum_{i=1}^{n}u_{i}^{2}+2\sum_{1\leq i<j\leq n}u_{i}u_{j}.
\end{align*}
In view of%
\begin{align*}
\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{j=1}^{n}u_{j}\right)   &
=\left(  \sum_{i=1}^{n}u_{i}\right)  \left(  \sum_{i=1}^{n}u_{i}\right)
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the}\\
\text{index }j\text{ in the second sum as }i
\end{array}
\right) \\
&  =\left(  \sum_{i=1}^{n}u_{i}\right)  ^{2},
\end{align*}
this rewrites as%
\[
\left(  \sum_{i=1}^{n}u_{i}\right)  ^{2}=\sum_{i=1}^{n}u_{i}^{2}+2\sum_{1\leq
i<j\leq n}u_{i}u_{j}.
\]
This solves Exercise \ref{exe.seqsum.sums.fubini.sum-uisq}.
\end{proof}

Fubini's theorem can be generalized a little bit more (\cite[(34)]{detnotes}):

\begin{theorem}
\label{thm.seqsum.sums.fubini-pred}Let $X$ and $Y$ be two finite sets. For
every pair $\left(  x,y\right)  \in X\times Y$, let $\mathcal{A}\left(
x,y\right)  $ be a logical statement. For each $\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,%
\begin{equation}
\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)  }. \label{eq.sum.fubini.predicate}%
\end{equation}

\end{theorem}

Theorem \ref{thm.seqsum.sums.fubini-pred} differs from Theorem
\ref{thm.seqsum.sums.fubini} in that the sums are restricted to only those
$y\in Y$ or only those $\left(  x,y\right)  \in X\times Y$ or only those $x\in
X$ that satisfy $\mathcal{A}\left(  x,y\right)  $. In other words, if we
regard the three sides of (\ref{eq.sum.fubini}) as three ways to sum the
entries of a rectangular table, then the three sides of
(\ref{eq.sum.fubini.predicate}) are likewise understood as three ways to sum
the entries of a gappy table (i.e., a rectangular table in which not every
cell has an entry). This added generality is convenient, but it is not
profound; indeed, Theorem \ref{thm.seqsum.sums.fubini-pred} can easily be
derived from Theorem \ref{thm.seqsum.sums.fubini} by defining $a_{\left(
x,y\right)  }$ to be $0$ for any $\left(  x,y\right)  \in X\times Y$ that does
\textbf{not} satisfy $\mathcal{A}\left(  x,y\right)  $.

\begin{example}
For any $n\in\mathbb{N}$ and $m\in\mathbb{N}$, we have%
\[
\sum_{x\in\left\{  1,2,\ldots,n\right\}  }\ \ \sum_{\substack{y\in\left\{
1,2,\ldots,m\right\}  ;\\x+y\text{ is even}}}xy=\sum_{\substack{\left(
x,y\right)  \in\left\{  1,2,\ldots,n\right\}  \times\left\{  1,2,\ldots
,m\right\}  ;\\x+y\text{ is even}}}xy=\sum_{y\in\left\{  1,2,\ldots,m\right\}
}\ \ \sum_{\substack{x\in\left\{  1,2,\ldots,n\right\}  ;\\x+y\text{ is even}%
}}xy.
\]
(This follows from (\ref{eq.sum.fubini.predicate}), applied to $X=\left\{
1,2,\ldots,n\right\}  $, $Y=\left\{  1,2,\ldots,m\right\}  $ and
$\mathcal{A}\left(  x,y\right)  =\left(  \text{\textquotedblleft}x+y\text{ is
even\textquotedblright}\right)  $.)
\end{example}

Finally, the last two variants of Fubini's theorem we will give are analogues
of Theorem \ref{thm.seqsum.sums.fubini-mn} for triangular (instead of
rectangular) tables. Let us state them and then give an application:

\begin{theorem}
\label{thm.seqsum.sums.fubini-tri1}Let $n\in\mathbb{N}$. Let $a_{\left(
x,y\right)  }$ be a number for each pair $\left(  x,y\right)  \in\left\{
1,2,3,\ldots\right\}  ^{2}$ satisfying $x+y\leq n$. Then,%
\begin{equation}
\sum_{x=1}^{n}\sum_{y=1}^{n-x}a_{\left(  x,y\right)  }=\sum_{\substack{\left(
x,y\right)  \in\left\{  1,2,3,\ldots\right\}  ^{2};\\x+y\leq n}}a_{\left(
x,y\right)  }=\sum_{y=1}^{n}\sum_{x=1}^{n-y}a_{\left(  x,y\right)  }.
\label{eq.sum.fubini.triangle}%
\end{equation}

\end{theorem}

\begin{example}
If $n=4$, then the formula (\ref{eq.sum.fubini.triangle}) (rewritten without
the use of $\sum$ signs) looks as follows:%
\begin{align*}
&  \left(  a_{\left(  1,1\right)  }+a_{\left(  1,2\right)  }+a_{\left(
1,3\right)  }\right)  +\left(  a_{\left(  2,1\right)  }+a_{\left(  2,2\right)
}\right)  +a_{\left(  3,1\right)  }+\left(  \text{empty sum}\right) \\
&  =\left(  \text{the sum of all entries of the table }%
\begin{tabular}
[c]{|ccc}\hline
$a_{\left(  1,1\right)  }$ & $a_{\left(  1,2\right)  }$ &
\multicolumn{1}{c|}{$a_{\left(  1,3\right)  }$}\\\cline{3-3}%
$a_{\left(  2,1\right)  }$ & $a_{\left(  2,2\right)  }$ &
\multicolumn{1}{|c}{}\\\cline{2-2}%
$a_{\left(  3,1\right)  }$ & \multicolumn{1}{|c}{} & \\\cline{1-1}%
\end{tabular}
\ \right) \\
&  =\left(  a_{\left(  1,1\right)  }+a_{\left(  2,1\right)  }+a_{\left(
3,1\right)  }\right)  +\left(  a_{\left(  1,2\right)  }+a_{\left(  2,2\right)
}\right)  +a_{\left(  1,3\right)  }+\left(  \text{empty sum}\right)  .
\end{align*}

\end{example}

\begin{theorem}
\label{thm.seqsum.sums.fubini-tri2}Let $n\in\mathbb{N}$. Let $a_{\left(
x,y\right)  }$ be a number for each $\left(  x,y\right)  \in\left\{
1,2,\ldots,n\right\}  ^{2}$ satisfying $x\leq y$. Then,%
\begin{equation}
\sum_{x=1}^{n}\sum_{y=x}^{n}a_{\left(  x,y\right)  }=\sum_{\substack{\left(
x,y\right)  \in\left\{  1,2,\ldots,n\right\}  ^{2};\\x\leq y}}a_{\left(
x,y\right)  }=\sum_{y=1}^{n}\sum_{x=1}^{y}a_{\left(  x,y\right)  }.
\label{eq.sum.fubini.triangle2}%
\end{equation}

\end{theorem}

\begin{example}
If $n=3$, then the formula (\ref{eq.sum.fubini.triangle2}) (rewritten without
the use of $\sum$ signs) looks as follows:%
\begin{align*}
&  \left(  a_{\left(  1,1\right)  }+a_{\left(  1,2\right)  }+a_{\left(
1,3\right)  }\right)  +\left(  a_{\left(  2,2\right)  }+a_{\left(  2,3\right)
}\right)  +a_{\left(  3,3\right)  }\\
&  =\left(  \text{the sum of all entries of the table }%
\begin{tabular}
[c]{ccc|}\hline
\multicolumn{1}{|c}{$a_{\left(  1,1\right)  }$} & $a_{\left(  1,2\right)  }$ &
$a_{\left(  1,3\right)  }$\\\cline{1-1}
& \multicolumn{1}{|c}{$a_{\left(  2,2\right)  }$} & $a_{\left(  2,3\right)  }%
$\\\cline{2-2}
&  & \multicolumn{1}{|c|}{$a_{\left(  3,3\right)  }$}\\\cline{3-3}%
\end{tabular}
\ \right) \\
&  =a_{\left(  1,1\right)  }+\left(  a_{\left(  1,2\right)  }+a_{\left(
2,2\right)  }\right)  +\left(  a_{\left(  1,3\right)  }+a_{\left(  2,3\right)
}+a_{\left(  3,3\right)  }\right)  .
\end{align*}

\end{example}

Theorem \ref{thm.seqsum.sums.fubini-tri1} and Theorem
\ref{thm.seqsum.sums.fubini-tri2} are \cite[(31) and (33), respectively]%
{detnotes}. They are commonly used to interchange summation signs: i.e., to
rewrite a sum of the form $\sum_{x=1}^{n}\sum_{y=1}^{n-x}a_{\left(
x,y\right)  }$ as $\sum_{y=1}^{n}\sum_{x=1}^{n-y}a_{\left(  x,y\right)  }$ or
vice versa, or to rewrite a sum of the form $\sum_{x=1}^{n}\sum_{y=x}%
^{n}a_{\left(  x,y\right)  }$ as $\sum_{y=1}^{n}\sum_{x=1}^{y}a_{\left(
x,y\right)  }$. This kind of interchange is somewhat trickier than the
straightforward interchange facilitated by Theorem
\ref{thm.seqsum.sums.fubini-mn}; indeed, unlike the latter, it requires a
change of the limits of summation. However, it is not hard to remember how the
limits have to change: After all, the resulting double sum needs to include
the same $a_{\left(  x,y\right)  }$ as the original one. Thus, for example, we
rewrite $\sum_{x=1}^{n}\sum_{y=1}^{n-x}a_{\left(  x,y\right)  }$ as
$\sum_{y=1}^{n}\sum_{x=1}^{n-y}a_{\left(  x,y\right)  }$ because both of these
double sums are really summing over all pairs $\left(  x,y\right)  $ of
positive integers that satisfy $x+y\leq n$.

An example of this interchange is given by the following exercise:

\begin{exercise}
\label{exe.seqsum.sums.nxn}Let $x$ be a number distinct from $1$. Simplify the
sum $\sum_{i=1}^{n}ix^{i}=1x^{1}+2x^{2}+\cdots+nx^{n}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.sums.nxn}.]For each $m\in\mathbb{N}$, we
have%
\[
\left(  x-1\right)  \left(  x^{0}+x^{1}+\cdots+x^{m}\right)  =x^{m+1}-1
\]
(by Exercise \ref{exe.ind.geoser-b}, applied to $x$ and $m+1$ instead of $b$
and $n$) and therefore%
\begin{equation}
x^{0}+x^{1}+\cdots+x^{m}=\dfrac{x^{m+1}-1}{x-1}
\label{sol.seqsum.sums.nxn.geoser}%
\end{equation}
(here, we have divided by $x-1$, which is allowed since $x\neq1$).

Now, we proceed -- informally -- as follows:%
\begin{align*}
\sum_{i=1}^{n}ix^{i}  &  \ =1x^{1}+2x^{2}+3x^{3}+4x^{4}+\cdots+nx^{n}\\
&
\begin{array}
[c]{cccccccccc}%
= & x^{1} & + & x^{2} & + & x^{3} & + & \cdots & + & x^{n}\\
&  & + & x^{2} & + & x^{3} & + & \cdots & + & x^{n}\\
&  &  &  & + & x^{3} & + & \cdots & + & x^{n}\\
&  &  &  &  &  & \vdots & \vdots & \vdots & \vdots\\
&  &  &  &  &  &  &  & + & x^{n}%
\end{array}
\\
&  \ =\sum_{j=1}^{n}\underbrace{\left(  x^{j}+x^{j+1}+\cdots+x^{n}\right)
}_{=x^{j}\left(  x^{0}+x^{1}+\cdots+x^{n-j}\right)  }=\sum_{j=1}^{n}%
x^{j}\underbrace{\left(  x^{0}+x^{1}+\cdots+x^{n-j}\right)  }%
_{\substack{=\dfrac{x^{n-j+1}-1}{x-1}\\\text{(by
(\ref{sol.seqsum.sums.nxn.geoser}), applied to }m=n-j\text{)}}}\\
&  \ =\sum_{j=1}^{n}x^{j}\dfrac{x^{n-j+1}-1}{x-1}=\dfrac{1}{x-1}\sum_{j=1}%
^{n}\underbrace{x^{j}\left(  x^{n-j+1}-1\right)  }_{=x^{n+1}-x^{j}}=\dfrac
{1}{x-1}\underbrace{\sum_{j=1}^{n}\left(  x^{n+1}-x^{j}\right)  }_{=\sum
_{j=1}^{n}x^{n+1}-\sum_{j=1}^{n}x^{j}}\\
&  \ =\dfrac{1}{x-1}\left(  \underbrace{\sum_{j=1}^{n}x^{n+1}}_{=nx^{n+1}%
}-\underbrace{\sum_{j=1}^{n}x^{j}}_{\substack{=x^{1}+x^{2}+\cdots
+x^{n}\\=x\left(  x^{0}+x^{1}+\cdots+x^{n-1}\right)  }}\right) \\
&  \ =\dfrac{1}{x-1}\left(  nx^{n+1}-x\underbrace{\left(  x^{0}+x^{1}%
+\cdots+x^{n-1}\right)  }_{\substack{=\dfrac{x^{n}-1}{x-1}\\\text{(by
(\ref{sol.seqsum.sums.nxn.geoser}), applied to }m=n-1\text{)}}}\right) \\
&  \ =\dfrac{1}{x-1}\left(  nx^{n+1}-x\cdot\dfrac{x^{n}-1}{x-1}\right)  .
\end{align*}


Let us formalize this computation -- specifically, its second and third
equality sign (since the rest is already fully rigorous). It becomes%
\begin{align*}
\sum_{i=1}^{n}\underbrace{ix^{i}}_{\substack{=\sum_{j=1}^{i}x^{i}\\\text{(by
(\ref{eq.sum.equal})}\\\text{applied backwards)}}}  &  =\sum_{i=1}^{n}%
\sum_{j=1}^{i}x^{i}=\sum_{j=1}^{n}\underbrace{\sum_{i=j}^{n}x^{i}}%
_{=x^{j}+x^{j+1}+\cdots+x^{n}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have interchanged the two summation signs}\\
\text{using (\ref{eq.sum.fubini.triangle2})}%
\end{array}
\right) \\
&  =\sum_{j=1}^{n}\left(  x^{j}+x^{j+1}+\cdots+x^{n}\right)  .
\end{align*}

\end{proof}

\subsection{\label{sect.seqsum.prod}Finite products}

Finite products are defined just like finite sums, but using multiplication
instead of addition (and using $1$ instead of $0$). In other words, they are
\textit{multiplicative analogues} (i.e., analogues in which addition is
replaced by multiplication) of finite sums. Let me just state the analogues of
Definition \ref{def.seqsum.sums.finset}, Definition
\ref{def.seqsum.sums.interval} and Definition \ref{def.seqsum.sums.filtered}
for products:

\begin{definition}
\label{def.seqsum.prods.finset}If $S$ is a finite set, and if $a_{s}$ is a
number for each $s\in S$, then $\prod_{s\in S}a_{s}$ denotes the product of
all of these numbers $a_{s}$. Formally, this product is defined by recursion
on $\left\vert S\right\vert $, as follows:

\begin{itemize}
\item If $\left\vert S\right\vert =0$, then $\prod_{s\in S}a_{s}$ is defined
to be $1$. (In this case, $\prod_{s\in S}a_{s}$ is called an \textit{empty
product}.)

\item Let $n\in\mathbb{N}$. Assume that we have defined $\prod_{s\in S}a_{s}$
for every finite set $S$ with $\left\vert S\right\vert =n$ (and every choice
of numbers $a_{s}$). Now, if $S$ is a finite set with $\left\vert S\right\vert
=n+1$ (and if a number $a_{s}$ is chosen for each $s\in S$), then $\prod_{s\in
S}a_{s}$ is defined by picking any $t\in S$ and setting%
\begin{equation}
\prod_{s\in S}a_{s}=a_{t}\cdot\prod_{s\in S\setminus\left\{  t\right\}  }%
a_{s}. \label{eq.def.seqsum.prods.finset.prodrec}%
\end{equation}

\end{itemize}
\end{definition}

\begin{definition}
\label{def.seqsum.prods.interval}Let $u$ and $v$ be integers. Let $a_{s}$ be a
number for each $s\in\left\{  u,u+1,\ldots,v\right\}  $. Then, the finite
product $\prod_{s\in\left\{  u,u+1,\ldots,v\right\}  }a_{s}$ will also be
denoted by $\prod_{s=u}^{v}a_{s}$ or by $a_{u}a_{u+1}\cdots a_{v}$ (or
$a_{u}\cdot a_{u+1}\cdot\cdots\cdot a_{v}$).
\end{definition}

\begin{definition}
\label{def.seqsum.prods.filtered}Let $S$ be a finite set, and let
$\mathcal{A}\left(  s\right)  $ be a logical statement defined for every $s\in
S$. For each $s\in S$ satisfying $\mathcal{A}\left(  s\right)  $, let $a_{s}$
be a number. Then, the product $\prod_{\substack{s\in S;\\\mathcal{A}\left(
s\right)  }}a_{s}$ is defined by%
\[
\prod_{\substack{s\in S;\\\mathcal{A}\left(  s\right)  }}a_{s}=\prod
_{s\in\left\{  t\in S\ \mid\ \mathcal{A}\left(  t\right)  \right\}  }a_{s}.
\]
In other words, $\prod_{\substack{s\in S;\\\mathcal{A}\left(  s\right)
}}a_{s}$ is the product of the $a_{s}$ for all $s\in S$ which satisfy
$\mathcal{A}\left(  s\right)  $.
\end{definition}

Note that $a^{k}=\underbrace{aa\cdots a}_{k\text{ times}}=\prod_{i=1}^{k}a$
for every number $a$ and every $k\in\mathbb{N}$. Thus, in particular,
$a^{0}=\left(  \text{empty product}\right)  =1$. This includes $0^{0}=1$.

All the notations we have introduced for finite sums exist just as well for
finite products, mutatis
mutandis\footnote{\href{https://en.wiktionary.org/wiki/mutatis_mutandis}{\textquotedblleft
Mutatis mutandis\textquotedblright} means \textquotedblleft once the things
that need to be changed have been changed\textquotedblright\ (i.e.,
\textquotedblleft once the necessary changes are made\textquotedblright).}.
For example, expressions of the form $\prod_{s\in S}a_{s}$ are called
\textit{finite products}, and the terms $a_{s}$ in such expressions are called
their \textit{factors} (or \textit{terms}). There is no agreement on the
operator precedence of the $\prod$ sign versus the $\cdot$ sign (i.e.,
expressions like $\prod_{s\in S}a_{s}b$ are ambiguous and need to be avoided),
but the $\prod$ sign definitely has higher precedence than the $+$ and $-$
signs (so an expression like $\prod_{s\in S}a_{s}+b$ always means $\left(
\prod_{s\in S}a_{s}\right)  +b$).

In all reasonable regards, finite products (of numbers) behave just like
finite sums, as long as the obvious changes are made (addition replaced by
multiplication, subtraction by division, $0$ by $1$, products by powers,
etc.). Let me state (without comment) the multiplicative analogues of Theorem
\ref{thm.seqsum.sums.sum-of-a}, Theorem \ref{thm.seqsum.sums.factor-out},
Theorem \ref{thm.seqsum.sums.split-addend}, Theorem
\ref{exe.seqsum.sums.split-addend-minus}, Theorem \ref{thm.seqsum.subs1},
Theorem \ref{thm.seqsum.telesc}, Theorem \ref{thm.seqsum.sums.split-2},
Corollary \ref{cor.seqsum.sums.split-2int}, Theorem
\ref{thm.seqsum.sums.split-m}, Theorem \ref{thm.seqsum.sums.split-val} and
Theorem \ref{thm.seqsum.sums.fubini}, respectively:\footnote{The proofs for
all these analogues are analogous to the proofs of the original theorems for
sums.}

\begin{theorem}
\label{thm.seqsum.prods.sum-of-a}Let $S$ be a finite set. Let $a$ be a number.
Then,%
\begin{equation}
\prod_{s\in S}a=a^{\left\vert S\right\vert }. \label{eq.prod.equal}%
\end{equation}

\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.factor-out}Let $S$ be a finite set. For every $s\in
S$, let $a_{s}$ be a number. Also, let $\lambda\in\mathbb{N}$. Then,%
\begin{equation}
\prod_{s\in S}a_{s}^{\lambda}=\left(  \prod_{s\in S}a_{s}\right)  ^{\lambda}.
\label{eq.prod.linear2}%
\end{equation}
This also holds for $\lambda\in\mathbb{Z}$ if all the numbers $a_{s}$ are
nonzero; and this also holds for $\lambda\in\mathbb{R}$ if all the numbers
$a_{s}$ are positive reals.
\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.split-addend}Let $S$ be a finite set. For every $s\in
S$, let $a_{s}$ and $b_{s}$ be numbers. Then,%
\begin{equation}
\prod_{s\in S}\left(  a_{s}b_{s}\right)  =\left(  \prod_{s\in S}a_{s}\right)
\left(  \prod_{s\in S}b_{s}\right)  . \label{eq.prod.linear1}%
\end{equation}

\end{theorem}

\begin{exercise}
\label{exe.seqsum.prods.split-addend-minus}Let $S$ be a finite set. For every
$s\in S$, let $a_{s}$ and $b_{s}$ be numbers such that $b_{s}\neq0$. Then,%
\[
\prod_{s\in S}\dfrac{a_{s}}{b_{s}}=\left(  \prod_{s\in S}a_{s}\right)
/\left(  \prod_{s\in S}b_{s}\right)  .
\]

\end{exercise}

\begin{theorem}
\label{thm.seqsum.prods.subs1}Let $S$ and $T$ be two finite sets. Let
$f:S\rightarrow T$ be a \textbf{bijective} map. Let $a_{t}$ be a number for
each $t\in T$. Then,%
\begin{equation}
\prod_{t\in T}a_{t}=\prod_{s\in S}a_{f\left(  s\right)  }.
\label{eq.prod.subs1}%
\end{equation}

\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.telesc}Let $u$ and $v$ be two integers such that
$u-1\leq v$. Let $a_{s}$ be a number for each $s\in\left\{  u-1,u,\ldots
,v\right\}  $. Assume that $a_{u-1},a_{u},\ldots,a_{v-1}$ are nonzero. Then,%
\begin{equation}
\prod_{s=u}^{v}\dfrac{a_{s}}{a_{s-1}}=\dfrac{a_{v}}{a_{u-1}}.
\label{eq.prod.telescope}%
\end{equation}

\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.split-2}Let $S$ be a finite set. Let $X$ and $Y$ be
two subsets of $S$ such that $X\cap Y=\varnothing$ and $X\cup Y=S$.
(Equivalently, $X$ and $Y$ are two subsets of $S$ such that each element of
$S$ lies in \textbf{exactly} one of $X$ and $Y$.) Let $a_{s}$ be a number for
each $s\in S$. Then,%
\begin{equation}
\prod_{s\in S}a_{s}=\left(  \prod_{s\in X}a_{s}\right)  \left(  \prod_{s\in
Y}a_{s}\right)  . \label{eq.prod.split}%
\end{equation}

\end{theorem}

\begin{corollary}
\label{cor.seqsum.prods.split-2int}Let $u$, $v$ and $w$ be three integers such
that $u-1\leq v\leq w$. Let $a_{s}$ be a number for each $s\in\left\{
u,u+1,\ldots,w\right\}  $. Then,%
\begin{equation}
\prod_{s=u}^{w}a_{s}=\left(  \prod_{s=u}^{v}a_{s}\right)  \left(
\prod_{s=v+1}^{w}a_{s}\right)  . \label{eq.prod.split.uvw}%
\end{equation}

\end{corollary}

\begin{theorem}
\label{thm.seqsum.prods.split-m}Let $S$ be a finite set. Let $S_{1}%
,S_{2},\ldots,S_{n}$ be finitely many subsets of $S$. Assume that these
subsets $S_{1},S_{2},\ldots,S_{n}$ are pairwise disjoint (i.e., we have
$S_{i}\cap S_{j}=\varnothing$ for any two distinct elements $i$ and $j$ of
$\left\{  1,2,\ldots,n\right\}  $) and their union is $S$. (Thus, every
element of $S$ lies in precisely one of the subsets $S_{1},S_{2},\ldots,S_{n}%
$.) Let $a_{s}$ be a number for each $s\in S$. Then,%
\begin{align}
\prod_{s\in S}a_{s}  &  =\prod_{w=1}^{n}\prod_{s\in S_{w}}a_{s}%
\label{eq.prod.split-n}\\
&  =\left(  \prod_{s\in S_{1}}a_{s}\right)  \left(  \prod_{s\in S_{2}}%
a_{s}\right)  \cdots\left(  \prod_{s\in S_{n}}a_{s}\right)  .
\label{eq.prod.split-n-rewr}%
\end{align}

\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.split-val}Let $S$ be a finite set. Let $W$ be a finite
set. Let $f:S\rightarrow W$ be a map. Let $a_{s}$ be a number for each $s\in
S$. Then,%
\begin{equation}
\prod_{s\in S}a_{s}=\prod_{w\in W}\prod_{\substack{s\in S;\\f\left(  s\right)
=w}}a_{s}. \label{eq.prod.sheph}%
\end{equation}

\end{theorem}

\begin{theorem}
\label{thm.seqsum.prods.fubini}Let $X$ and $Y$ be two finite sets. Let
$a_{\left(  x,y\right)  }$ be a number for each $\left(  x,y\right)  \in
X\times Y$. Then,%
\begin{equation}
\prod_{x\in X}\prod_{y\in Y}a_{\left(  x,y\right)  }=\prod_{\left(
x,y\right)  \in X\times Y}a_{\left(  x,y\right)  }=\prod_{y\in Y}\prod_{x\in
X}a_{\left(  x,y\right)  }. \label{eq.prod.fubini}%
\end{equation}

\end{theorem}

Using common sense, the reader can easily figure out how all these theorems
are named (for example, Theorem \ref{thm.seqsum.prods.telesc} is known as the
\textit{telescope principle for products}, or the \textit{multiplicative
telescope principle}), and also state multiplicative analogues for the
remaining rules for finite sums (e.g., for Theorem
\ref{thm.seqsum.sums.fubini-pred} and for Theorem
\ref{thm.seqsum.sums.fubini-tri1}).

The most famous finite products are the factorials%
\[
n!=1\cdot2\cdot\cdots\cdot n=\prod_{i=1}^{n}i\ \ \ \ \ \ \ \ \ \ \text{for all
}n\in\mathbb{N}.
\]
(This includes $0!=\left(  \text{empty product}\right)  =1$.)

While there are numerous good exercises on finite products (see
\cite{AndTet18} for a large collection), we shall here only show two. The
first is a token application of the telescope principle for products:

\begin{exercise}
\label{exe.seqsum.prods.telesc-1}Let $n$ be a positive integer. Simplify
$\prod_{s=2}^{n}\left(  1-\dfrac{1}{s}\right)  $.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.prods.telesc-1}.]For each integer
$s\geq2$, we have
\[
1-\dfrac{1}{s}=\dfrac{s-1}{s}=\dfrac{1/s}{1/\left(  s-1\right)  }.
\]
Hence,%
\begin{align*}
\prod_{s=2}^{n}\underbrace{\left(  1-\dfrac{1}{s}\right)  }_{=\dfrac
{1/s}{1/\left(  s-1\right)  }}  &  =\prod_{s=2}^{n}\dfrac{1/s}{1/\left(
s-1\right)  }=\dfrac{1/n}{1/\left(  2-1\right)  }\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.prod.telescope}), applied to
}u=2\text{, }v=n\text{ and }a_{s}=1/s\right) \\
&  =\dfrac{1}{n}.
\end{align*}

\end{proof}

The next exercise is a simple formula that is useful in combinatorics (more on
its use perhaps later on):

\begin{exercise}
\label{exe.odd-factorial}Let $n\in\mathbb{N}$. Prove that%
\[
1\cdot3\cdot5\cdot\cdots\cdot\left(  2n-1\right)  =\dfrac{\left(  2n\right)
!}{2^{n}n!}.
\]
(The left hand side of this equality is understood to be the product of all
odd integers from $1$ to $2n-1$.)
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.odd-factorial} (sketched).]See \cite[Exercise
3.2 \textbf{(a)}]{detnotes} or \cite[Exercise 1 \textbf{(a)}]{17f-hw2s} for a
detailed solution. The main idea:%
\begin{align*}
\left(  2n\right)  !  &  =\prod_{i\in\left\{  1,2,\ldots,2n\right\}
}i=\underbrace{\left(  \prod_{\substack{i\in\left\{  1,2,\ldots,2n\right\}
;\\i\text{ is even}}}i\right)  }_{\substack{=2\cdot4\cdot6\cdot\cdots
\cdot\left(  2n\right)  \\=2^{n}\cdot\left(  1\cdot2\cdot3\cdot\cdots\cdot
n\right)  \\\text{(by (\ref{eq.prod.linear1}) and (\ref{eq.prod.equal}))}%
}}\cdot\underbrace{\left(  \prod_{\substack{i\in\left\{  1,2,\ldots
,2n\right\}  ;\\i\text{ is odd}}}i\right)  }_{=1\cdot3\cdot5\cdot\cdots
\cdot\left(  2n-1\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem
\ref{thm.seqsum.prods.split-2}}\right) \\
&  =2^{n}\cdot\underbrace{\left(  1\cdot2\cdot3\cdot\cdots\cdot n\right)
}_{=n!}\cdot\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(  2n-1\right)  \right)
=2^{n}n!\cdot\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(  2n-1\right)
\right)  .
\end{align*}

\end{proof}

Finally, let us state the natural generalization of Exercise
\ref{exe.seqsum.sums.fubini.sum-xiyj} to products with several factors (each
of which is a finite sum):

\begin{theorem}
\label{thm.seqsum.prods.prodrule}For every $n\in\mathbb{N}$, let $\left[
n\right]  $ denote the set $\left\{  1,2,\ldots,n\right\}  $.

Let $n\in\mathbb{N}$. For every $i\in\left[  n\right]  $, let $p_{i,1}%
,p_{i,2},\ldots,p_{i,m_{i}}$ be finitely many numbers. Then,%
\begin{equation}
\prod_{i=1}^{n}\sum_{k=1}^{m_{i}}p_{i,k}=\sum_{\left(  k_{1},k_{2}%
,\ldots,k_{n}\right)  \in\left[  m_{1}\right]  \times\left[  m_{2}\right]
\times\cdots\times\left[  m_{n}\right]  }\ \ \prod_{i=1}^{n}p_{i,k_{i}}.
\label{eq.thm.seqsum.prods.prodrule.eq}%
\end{equation}


(\textbf{Pedantic remark:} If $n=0$, then the Cartesian product $\left[
m_{1}\right]  \times\left[  m_{2}\right]  \times\cdots\times\left[
m_{n}\right]  $ has no factors; it is what is called an \textit{empty
Cartesian product}. It is understood to be a $1$-element set, and its single
element is the $0$-tuple $\left(  {}\right)  $ (also known as the empty list).
Thus the equality (\ref{eq.thm.seqsum.prods.prodrule.eq}) indeed holds for
$n=0$, as it just says $1=1$ in this case.)
\end{theorem}

The left hand side of (\ref{eq.thm.seqsum.prods.prodrule.eq}) can be rewritten
as%
\[
\left(  p_{1,1}+p_{1,2}+\cdots+p_{1,m_{1}}\right)  \left(  p_{2,1}%
+p_{2,2}+\cdots+p_{2,m_{2}}\right)  \cdots\left(  p_{n,1}+p_{n,2}%
+\cdots+p_{n,m_{n}}\right)  ,
\]
and the right hand side is precisely what one obtains when expanding this
product into a sum of $m_{1}m_{2}\cdots m_{n}$ monomials (i.e., products of
single $p_{i,k}$'s). Thus, there is nothing surprising about Theorem
\ref{thm.seqsum.prods.prodrule}. A formal proof of Theorem
\ref{thm.seqsum.prods.prodrule} can be found in \cite[Lemma 6.20]{detnotes}.

\subsection{\label{sect.seqsum.binom}Binomial coefficients}

Our next topic are the \textit{binomial coefficients}. In this section, we
shall only briefly survey these coefficients from an algebraic perspective,
but we will return to them later on as we get to enumerative combinatorics.
Most of the claims in this section are easily proved by computation or
induction (and also found in many easily accessible sources), so we will
almost entirely omit their proofs. Much deeper treatments of binomial
coefficients are found in the book \cite{GKP} (whose entire Chapter 5 is
devoted to binomial coefficients), in the book \cite{Comtet74} (one of the
classics on enumerative combinatorics and binomial identities), in the recent
book \cite{Spivey19}, and in \cite[Chapter 3]{detnotes}. (Of these, I can
recommend \cite{GKP} as a first introduction.)\footnote{See also
\href{https://en.wikipedia.org/wiki/Pascal's_triangle}{the Wikipedia page for
Pascal's triangle} for an overview of many properties.} Another (somewhat
silly but mathematically content-rich) introduction to binomial coefficients
is a recent booklet by McCleary \cite{Mcclea17}.

We begin by defining binomial coefficients. \Needspace{15pc}

\begin{definition}
\label{def.binom.def}Let $n$ and $k$ be any two numbers. We define a number
$\dbinom{n}{k}$ as follows:

\begin{itemize}
\item If $k\in\mathbb{N}$, then we set%
\begin{equation}
\dbinom{n}{k}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  }{k!}. \label{eq.def.binom.def.a}%
\end{equation}


\item If $k\notin\mathbb{N}$, then we set%
\begin{equation}
\dbinom{n}{k}=0. \label{eq.def.binom.def.b}%
\end{equation}

\end{itemize}

We call $\dbinom{n}{k}$ a \textit{binomial coefficient}, and we refer to it as
\textquotedblleft$n$ \textit{choose} $k$\textquotedblright. (We will soon see
what motivated this terminology.)
\end{definition}

I believe this definition is the best at balancing generality and simplicity.
There are two simpler definitions (one that defines $\dbinom{n}{k}$ as
$\dfrac{n!}{k!\left(  n-k\right)  !}$, and another that defines $\dbinom{n}%
{k}$ as the number of $k$-element subsets of an $n$-element set) that work
only in certain cases (e.g., when $n$ is a nonnegative integer)\footnote{We
shall soon see that these definitions are equivalent to ours (in said
cases).}, and thus are less suited as definitions; meanwhile, the only
definitions more general than Definition \ref{def.binom.def} that I have seen
require significant new concepts.

\begin{warning}
Definition \ref{def.binom.def} is pretty widespread: For example, it is
followed in \cite{GKP}, \cite{Comtet74} and \cite{detnotes}. But it is not an
unquestioned standard across the literature. All definitions I am aware of are
equivalent in the \textquotedblleft core region\textquotedblright\ of the
binomial coefficients -- that is, in the case when $n\in\mathbb{N}$ and
$k\in\left\{  0,1,\ldots,n\right\}  $. However, some definitions yield values
differing from ours when $n<0$. Many authors prefer to define $\dbinom{n}{k}$
only for $n\in\mathbb{N}$, or only for $k\in\mathbb{N}$, or even only in the
most restrictive case (when $n\in\mathbb{N}$ and $k\in\left\{  0,1,\ldots
,n\right\}  $). Loehr, in \cite{Loehr-BC}, seems to avoid defining $\dbinom
{n}{k}$ for negative $n$ at all, despite this case being rather useful.

Some authors use notations like $C_{k}^{n}$ or $^{n}C_{k}$ or $_{n}C_{k}$ for
$\dbinom{n}{k}$.

Do not confuse the binomial coefficient $\dbinom{n}{k}$ with the column vector
$\left(
\begin{array}
[c]{c}%
n\\
k
\end{array}
\right)  $. (Note the differences in horizontal spacing.)
\end{warning}

\begin{example}
\label{exa.binom.small}Let us see some consequences of Definition
\ref{def.binom.def}.

\textbf{(a)} For any number $n$, we have%
\begin{align}
\dbinom{n}{0}  &  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-0+1\right)  }{0!}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.def.binom.def.a}), applied to }k=0\right) \nonumber\\
&  =\dfrac{1}{1}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since }n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-0+1\right)  =\left(  \text{empty product}\right)  =1\\
\text{and }0!=1
\end{array}
\right) \nonumber\\
&  =1. \label{eq.exa.binom.small.nC0}%
\end{align}


\textbf{(b)} For any number $n$, we have%
\begin{align}
\dbinom{n}{1}  &  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-1+1\right)  }{1!}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.def.binom.def.a}), applied to }k=1\right) \nonumber\\
&  =\dfrac{n}{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\left(  n-1\right)
\left(  n-2\right)  \cdots\left(  n-1+1\right)  =n\text{ and }1!=1\right)
\nonumber\\
&  =n. \label{eq.exa.binom.small.nC1}%
\end{align}


\textbf{(c)} For any number $n$, we have%
\begin{align}
\dbinom{n}{2}  &  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-2+1\right)  }{2!}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.def.binom.def.a}), applied to }k=2\right) \nonumber\\
&  =\dfrac{n\left(  n-1\right)  }{2}. \label{eq.exa.binom.small.nC2}%
\end{align}


\textbf{(d)} For any number $n$, we have
\[
\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}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{likewise}\right)  .
\]


\textbf{(e)} The equality (\ref{eq.def.binom.def.a}) (applied to $n=-1$ and
$k=5$) yields%
\begin{align*}
\dbinom{-1}{5}  &  =\dfrac{\left(  -1\right)  \left(  -1-1\right)  \left(
-1-2\right)  \cdots\left(  -1-5+1\right)  }{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.
\end{align*}


\textbf{(f)} More generally, for any $k\in\mathbb{N}$, we have%
\begin{align}
\dbinom{-1}{k}  &  =\dfrac{\left(  -1\right)  \left(  -1-1\right)  \left(
-1-2\right)  \cdots\left(  -1-k+1\right)  }{k!}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{eq.def.binom.def.a})}\right) \nonumber\\
&  =\dfrac{\left(  -1\right)  \left(  -2\right)  \cdots\left(  -k\right)
}{k!}=\dfrac{\left(  -1\right)  \left(  -2\right)  \cdots\left(  -k\right)
}{1\cdot2\cdot\cdots\cdot k}\nonumber\\
&  =\left(  -1\right)  ^{k}. \label{eq.exa.binom.small.-1Ck}%
\end{align}


\textbf{(g)} The equality (\ref{eq.exa.binom.small.nC2}) (applied to
$n=\sqrt{2}$) yields
\[
\dbinom{\sqrt{2}}{2}=\dfrac{\sqrt{2}\left(  \sqrt{2}-1\right)  }{2}.
\]


\textbf{(h)} The equality (\ref{eq.def.binom.def.b}) (applied to $n=2$ and
$k=\sqrt{2}$) yields%
\[
\dbinom{2}{\sqrt{2}}=0,\ \ \ \ \ \ \ \ \ \ \text{since }\sqrt{2}%
\notin\mathbb{N}.
\]

\end{example}

Instead of further examples, let us see a table of the most important binomial
coefficients $\dbinom{n}{k}$ -- namely those with $n\in\mathbb{N}$ and
$k\in\left\{  0,1,\ldots,n\right\}  $. This table is called \textit{Pascal's
triangle}; here are its first $9$ rows (i.e., the part that covers
$n\in\left\{  0,1,\ldots,8\right\}  $):%
\[
\hspace{-0.3cm}%
\begin{tabular}
[c]{ll|ccccccccccccccccc}%
\vphantom{$\overset{k=0}{\swarrow}$} &  & $\phantom{20}$ & $\phantom{20}$ &
$\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ &  &  &  &
$\overset{k=0}{\swarrow}$ & $\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ &
$\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$\\
\vphantom{$\overset{k=0}{\swarrow}$}$n=0$ & $\rightarrow$ &  &  &  &  &  &  &
&  & $1$ &  & $\overset{k=1}{\swarrow}$ &  &  &  &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=1$ & $\rightarrow$ &  &  &  &  &  &  &
& $1$ &  & $1$ &  & $\overset{k=2}{\swarrow}$ &  &  &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=2$ & $\rightarrow$ &  &  &  &  &  &  &
$1$ &  & $2$ &  & $1$ &  & $\overset{k=3}{\swarrow}$ &  &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=3$ & $\rightarrow$ &  &  &  &  &  & $1$
&  & $3$ &  & $3$ &  & $1$ &  & $\overset{k=4}{\swarrow}$ &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=4$ & $\rightarrow$ &  &  &  &  & $1$ &
& $4$ &  & $6$ &  & $4$ &  & $1$ &  & $\overset{k=5}{\swarrow}$ &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=5$ & $\rightarrow$ &  &  &  & $1$ &  &
$5$ &  & $10$ &  & $10$ &  & $5$ &  & $1$ &  & $\overset{k=6}{\swarrow}$ & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=6$ & $\rightarrow$ &  &  & $1$ &  & $6$
&  & $15$ &  & $20$ &  & $15$ &  & $6$ &  & $1$ &  & $\overset{k=7}{\swarrow}%
$\\
\vphantom{$\overset{k=0}{\swarrow}$}$n=7$ & $\rightarrow$ &  & $1$ &  & $7$ &
& $21$ &  & $35$ &  & $35$ &  & $21$ &  & $7$ &  & $1$ & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=8$ & $\rightarrow$ & $1$ &  & $8$ &  &
$28$ &  & $56$ &  & $70$ &  & $56$ &  & $28$ &  & $8$ &  & $1$%
\end{tabular}
\ \ \ \ \ \
\]


Why did we restrict ourselves only to $k\in\left\{  0,1,\ldots,n\right\}  $
when making this table? What about the binomial coefficients $\dbinom{n}{k}$
\textquotedblleft left of Pascal's triangle\textquotedblright\ -- i.e., those
with $k<0$ ? They are not shown because they are all $0$ (by
(\ref{eq.def.binom.def.b})). The binomial coefficients $\dbinom{n}{k}$
\textquotedblleft right of Pascal's triangle\textquotedblright\ -- i.e., those
with $k>n$ -- are also $0$, as the following proposition shows:

\begin{proposition}
\label{prop.binom.0}Let $n\in\mathbb{N}$ and $k\in\mathbb{R}$ be such that
$k>n$. Then, $\dbinom{n}{k}=0$.
\end{proposition}

\begin{proof}
[Hints to the proof of Proposition \ref{prop.binom.0}.](See \cite[Proposition
1.3.6]{19fco}.) For $k\notin\mathbb{N}$, this follows from
(\ref{eq.def.binom.def.b}). Thus, assume $k\in\mathbb{N}$. Now, recall the old
joke problem \textquotedblleft Simplify $\left(  x-a\right)  \left(
x-b\right)  \cdots\left(  x-z\right)  $\textquotedblright.
\end{proof}

\begin{warning}
Proposition \ref{prop.binom.0} does not usually hold for $n\notin\mathbb{N}$.
\end{warning}

A more interesting question is what we can say about the binomial coefficients
$\dbinom{n}{k}$ \textquotedblleft above Pascal's triangle\textquotedblright%
\ -- i.e., those with $n<0$. It turns out that they are just \textquotedblleft
mirror images\textquotedblright\ of the ones below (up to sign); namely, we
have the following:

\begin{proposition}
[Upper negation formula]\label{prop.binom.upneg}Let $n\in\mathbb{R}$ and
$k\in\mathbb{Z}$. Then,%
\begin{equation}
\dbinom{-n}{k}=\left(  -1\right)  ^{k}\dbinom{n+k-1}{k}.
\label{eq.prop.binom.upneg.claim}%
\end{equation}

\end{proposition}

\begin{proof}
[Hints to the proof of Proposition \ref{prop.binom.upneg}.]This is a simple
computation using Definition \ref{def.binom.def}. (See \cite[Proposition
1.3.7]{19fco} for details.)
\end{proof}

Proposition \ref{prop.binom.0} and Proposition \ref{prop.binom.upneg} are the
reasons why almost all tables of binomial coefficients you will find in the
literature show only (parts of) Pascal's triangle. (Of course, there are also
the binomial coefficients $\dbinom{n}{k}$ with non-integer $n$, but it is not
really clear how to tabulate them.)

Binomial coefficients tend to appear in almost all parts of mathematics (as
coefficients or as standalone values). Being able to identify them when one
encounters them is thus a useful skill. Myself, I know few numbers by heart,
but the binomial coefficients in the first six rows of Pascal's triangle are
among them (I never deliberately memorized them; I just see them too often to
forget). If you need any further rows of Pascal's triangle and have no
computer handy, the easiest way to construct them is using a surprising
pattern in Pascal's triangle: Every entry (except for the $1$ at the peak) is
the sum of the two adjacent entries above it\footnote{If there is only one
adjacent entry above it (as it happens for the $1$'s along the left and right
sides of Pascal's triangle), then we treat the missing other entry as a $0$
(after all, there should be a $0$ at its position; we just didn't put it in
the table).} (for example, $56=21+35$). This pattern holds not only for the
entries of Pascal's triangle, but more generally for all binomial coefficients:

\begin{theorem}
[Recurrence of the binomial coefficients]\label{thm.binom.rec}Let
$n\in\mathbb{R}$ and $k\in\mathbb{R}$. Then,%
\[
\dbinom{n}{k}=\dbinom{n-1}{k-1}+\dbinom{n-1}{k}.
\]

\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.rec}.]Since there were two cases
in Definition \ref{def.binom.def}, we must distinguish between three cases
here: $k\in\left\{  1,2,3,\ldots\right\}  $, $k=0$ and $k\notin\mathbb{N}$.
The first case is the interesting one (the latter two are trivial). In this
first case, rewrite $\dbinom{n-1}{k-1}$ and $\dbinom{n-1}{k}$ as fractions and
add them by finding a common denominator.
\end{proof}

Theorem \ref{thm.binom.rec} is known as \textit{Pascal's rule}. It provides
perhaps the quickest way to compute Pascal's triangle up to a given row;
however, Definition \ref{def.binom.def} might still be a better way to compute
a specific entry (as long as one remembers not to multiply the products out,
since there will be a lot of cancellation visible in the fraction). There is
an even more explicit formula:

\begin{theorem}
[Factorial formula for the binomial coefficients]\label{thm.binom.fac}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}
[Hints to the proof of Theorem \ref{thm.binom.fac}.]Notice that
\[
n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)
=n!/\left(  n-k\right)  !.
\]
(See \cite[Theorem 1.3.9]{19fco} for details.)
\end{proof}

\begin{warning}
Theorem \ref{thm.binom.fac} cannot be used to compute $\dbinom{-3}{5}$ or
$\dbinom{1/3}{4}$ or $\dbinom{\pi}{\sqrt{2}}$; it only applies under the given
assumptions ($n\in\mathbb{N}$ and $k\in\mathbb{N}$ and $k\leq n$). (This is
the reason why, unlike various authors, we do \textbf{not define} $\dbinom
{n}{k}$ through Theorem \ref{thm.binom.fac}.)
\end{warning}

Another immediately visible pattern exhibited by Pascal's triangle is its
symmetry across a vertical axis:

\begin{theorem}
[Symmetry of the binomial coefficients]\label{thm.binom.sym}Let $n\in
\mathbb{N}$ and $k\in\mathbb{R}$. Then,%
\[
\dbinom{n}{k}=\dbinom{n}{n-k}.
\]

\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.sym}.]If $k\in\mathbb{N}$ and
$k\leq n$, then rewrite both sides using Theorem \ref{thm.binom.fac}.
Otherwise, argue that both sides are $0$. (See \cite[Theorem 1.3.11]{19fco}
for details.)
\end{proof}

\begin{warning}
Theorem \ref{thm.binom.sym} would be false without the requirement
$n\in\mathbb{N}$. For example, $n=-1$ and $k=0$ provides a counterexample.
\end{warning}

An easy consequence of Theorem \ref{thm.binom.sym} is that%
\begin{equation}
\dbinom{n}{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\label{eq.thm.binom.sym.nn}%
\end{equation}
Indeed, Theorem \ref{thm.binom.sym} (applied to $k=n$) yields%
\[
\dbinom{n}{n}=\dbinom{n}{n-n}=\dbinom{n}{0}=1\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{eq.exa.binom.small.nC0})}\right)
\]
for each $n\in\mathbb{N}$.

The following fact is one of the most important properties of binomial
coefficients; it explains why they are often regarded as combinatorial in nature:

\begin{theorem}
[Combinatorial interpretation of the binomial coefficients]%
\label{thm.binom.comb}Let $n\in\mathbb{N}$ and $k\in\mathbb{R}$. Let $S$ be an
$n$-element set. Then,%
\[
\dbinom{n}{k}=\left(  \text{the number of }k\text{-element subsets of
}S\right)  .
\]

\end{theorem}

\begin{example}
\textbf{(a)} 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\}  $. The number of these subsets is
$6=\dbinom{4}{2}$, which is exactly what Theorem \ref{thm.binom.comb} predicts.

\textbf{(b)} Now, let $k=5$ instead (while $n$ is still $4$, and $S$ is still
$\left\{  1,2,3,4\right\}  $). Then, there are no $5$-element subsets of $S$,
since $S$ only has $4$ elements. Thus, the number of these $5$-element subsets
is $0=\dbinom{4}{5}$, which is exactly what Theorem \ref{thm.binom.comb} predicts.
\end{example}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.comb}.]There is a fairly
straightforward proof of Theorem \ref{thm.binom.comb} by induction on $n$. In
the induction step, pick an element $s\in S$ and classify the $k$-element
subsets of $S$ as \textquotedblleft red\textquotedblright\ or
\textquotedblleft green\textquotedblright\ according to whether they contain
$s$ or not (similarly to our above proof of Theorem \ref{thm.fib.lac}). This
proof can be found in \cite[proof of Theorem 1.3.12]{19fco} or \cite[solution
to Exercise 3.4]{detnotes}.

\begin{noncompile}
An alternative proof proceeds as follows: If $k\notin\mathbb{N}$, then Theorem
\ref{thm.binom.comb} boils down to $0=0$, which is obvious. Thus, we WLOG
assume that $k\in\mathbb{N}$. Now, let us say that a $k$-tuple $\left(
s_{1},s_{2},\ldots,s_{k}\right)  $ is \textit{injective} if its $k$ entries
$s_{1},s_{2},\ldots,s_{k}$ are (pairwise) distinct. How many injective
$k$-tuples in $S^{k}$ are there? (Double counting.)
\end{noncompile}

An alternative proof can be given using enumerative combinatorics (see
\cite[\S 15.5]{LeLeMe16} or \cite[\S 2.7]{19fco}).
\end{proof}

\begin{warning}
Theorem \ref{thm.binom.comb} says nothing about $\dbinom{n}{k}$ when
$n\notin\mathbb{N}$.
\end{warning}

\begin{noncompile}
The following fact is not to be neglected, despite following immediately from
Definition \ref{def.binom.def}:

\begin{theorem}
[Polynomial of the binomial coefficients]\label{thm.binom.pol}Fix
$k\in\mathbb{R}$. Then, the function%
\begin{align*}
\mathbb{C}  &  \rightarrow\mathbb{C},\\
n  &  \mapsto\dbinom{n}{k}%
\end{align*}
is a polynomial function of degree $\leq k$. More precisely, if $k\in
\mathbb{N}$, then this function is a polynomial function of degree $k$.
\end{theorem}

Here, the zero function is understood to be a polynomial function of degree
$-\infty$.
\end{noncompile}

The following important fact is \textbf{not} obvious from Definition
\ref{def.binom.def}:

\begin{theorem}
[Integrality of the binomial coefficients]\label{thm.binom.ZZ}Let
$n\in\mathbb{Z}$ and $k\in\mathbb{Z}$. Then, $\dbinom{n}{k}\in\mathbb{Z}$.
\end{theorem}

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.ZZ}.]In the case $n\in
\mathbb{N}$, this can either be shown by induction on $n$ (using Theorem
\ref{thm.binom.rec}), or obtained immediately from Theorem
\ref{thm.binom.comb}. The general case $n\in\mathbb{Z}$ can be reduced to the
case $n\in\mathbb{N}$ via Proposition \ref{prop.binom.upneg} and
(\ref{eq.def.binom.def.b}). (See \cite[proof of Theorem 1.3.16]{19fco} for details.)
\end{proof}

The most famous property of binomial coefficients is the \textit{binomial
theorem}:

\begin{theorem}
[the binomial formula]\label{thm.binom.binom}Let $x$ and $y$ be any numbers.
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 the \textquotedblleft binomial
coefficients\textquotedblright.

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.binom}.]Either induct on $n$
(see \cite[proof of Theorem 1.3.24]{19fco} for details), or argue
combinatorially using Theorem \ref{thm.seqsum.prods.prodrule} (best done after
familiarizing yourself with basic bijections).
\end{proof}

Let us state two famous consequences of Theorem \ref{thm.binom.binom}. The
first one says that the sum of all entries in the $n$-th row of Pascal's
triangle (where rows are counted from $0$) is $2^{n}$:

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

\begin{proof}
[Hints to the proof of Corollary \ref{cor.binom.2pown}.]Apply Theorem
\ref{thm.binom.binom} to $x=1$ and $y=1$. (See \cite[Corollary 1.3.27]{19fco}
for details.)
\end{proof}

The second consequence (\cite[Proposition 1.3.28]{19fco}, \cite[\S 3.4,
Identity 12]{Spivey19}) is a bit subtler:

\begin{proposition}
\label{prop.binom.sum-alt-row}Let $n\in\mathbb{N}$. Then,%
\begin{equation}
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}=\left[  n=0\right]  .
\label{eq.prop.binom.sum-alt-row.1}%
\end{equation}

\end{proposition}

Here, we are using the so-called
\href{https://en.wikipedia.org/wiki/Iverson_bracket}{\textit{Iverson bracket
notation}} (which despite its trivial definition is surprisingly useful):

\begin{definition}
\label{def.iverson}If $\mathcal{A}$ is any logical statement, then we define
an integer $\left[  \mathcal{A}\right]  \in\left\{  0,1\right\}  $ by%
\[
\left[  \mathcal{A}\right]  =%
\begin{cases}
1, & \text{if }\mathcal{A}\text{ is true};\\
0, & \text{if }\mathcal{A}\text{ is false}.
\end{cases}
\]
For example, $\left[  2+2=4\right]  =1$ but $\left[  2+2=5\right]  =0$.

If $\mathcal{A}$ is any logical statement, then $\left[  \mathcal{A}\right]  $
is known as the \textit{truth value} of $\mathcal{A}$.
\end{definition}

\begin{proof}
[Hints to the proof of Proposition \ref{prop.binom.sum-alt-row}.]Apply Theorem
\ref{thm.binom.binom} to $x=-1$ and $y=1$, and recall what power of $0$ is
nonzero. (See \cite[Proposition 1.3.28]{19fco} for details.)
\end{proof}

We finish our first incursion into binomial coefficients with a formula that
expresses Fibonacci numbers as sums thereof:

\begin{proposition}
\label{prop.binom.fib}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. 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}

Note that roughly half the addends on the right hand side of Proposition
\ref{prop.binom.fib} are $0$ (indeed, Proposition \ref{prop.binom.0} shows
that $\dbinom{n-k}{k}=0$ for any $k\in\left\{  0,1,\ldots,n\right\}  $
satisfying $k>n/2$) and thus can be discarded; nevertheless it is easier to
have the sum end at $k=n$ rather than figure out where exactly its nonzero
addends stop.

\begin{proof}
[Hints to the proof of Proposition \ref{prop.binom.fib}.]This is probably the
hardest statement in this section, which is not saying much. There is a proof
by strong induction on $n$ (using Theorem \ref{thm.binom.rec}); it is not very
enlightening and somewhat laborious due to the fiddling involved in making all
the sums have the same upper limit. (See \cite[\S 15]{Vorobi02} or
\cite[Problem 2.4]{AndCri17} for a sketch of this proof, but notice that both
of these sources are sloppy with the summation limits.) We will state a more
general result (Proposition \ref{prop.rec.binom-fib}) later on, at which point
we will give this proof in full detail; Proposition \ref{prop.binom.fib} is
merely a particular case of this latter result.

Alternatively, there is a combinatorial proof, which proceeds as follows: WLOG
assume that $n\geq1$ (else, just check it by hand). Let $\left[  n-1\right]  $
denote the set $\left\{  1,2,\ldots,n-1\right\}  $. Then, Theorem
\ref{thm.fib.lac} yields that the number of all lacunar subsets of $\left[
n-1\right]  $ is $f_{n+1}$. However, for each $k\in\left\{  0,1,\ldots
,n\right\}  $, the number of all lacunar $k$-element subsets of $\left[
n-1\right]  $ is $\dbinom{n-k}{k}$, as can easily be proved by induction on
$n$ (or even by a nicer, combinatorial argument: see \cite[Proposition
1.4.10]{19fco}). Hence, the total number of all lacunar subsets of $\left[
n-1\right]  $ is $\sum_{k=0}^{n}\dbinom{n-k}{k}$. Comparing these two results
yields the claim of Proposition \ref{prop.binom.fib}. (See \cite[\S 1.4.5,
proof of Proposition 1.3.32]{19fco} for this proof.)
\end{proof}

\subsection{Recitation \#3: Sums, products, binomial coefficients}

Next comes an exercise in finite sums that is rather similar to Exercise
\ref{exe.fibonacci.first-sum}:

\begin{exercise}
\label{exe.fibonacci.first-odd-sum.telesc}Let $\left(  f_{0},f_{1}%
,f_{2},\ldots\right)  $ be the Fibonacci sequence. Prove that each integer
$n\geq0$ satisfies%
\[
f_{1}+f_{3}+f_{5}+\cdots+f_{2n-1}=f_{2n}.
\]

\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.fibonacci.first-odd-sum.telesc}.]This is easy
to prove by induction on $n$, but let us try to prove it by the telescope principle.

Let $n\geq0$ be an integer. For each integer $i\geq1$, we have $f_{i+1}%
=f_{i}+f_{i-1}$ (by the recursive definition of the Fibonacci numbers) and
therefore%
\begin{equation}
f_{i}=f_{i+1}-f_{i-1}. \label{sol.fibonacci.first-odd-sum.telesc.1}%
\end{equation}
Thus, for each positive integer $s$, we have%
\begin{align}
f_{2s-1}  &  =f_{\left(  2s-1\right)  +1}-f_{\left(  2s-1\right)
-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.fibonacci.first-odd-sum.telesc.1}), applied to }i=2s-1\right)
\nonumber\\
&  =f_{2s}-f_{2\left(  s-1\right)  }
\label{sol.fibonacci.first-odd-sum.telesc.2}%
\end{align}
(since $\left(  2s-1\right)  +1=2s$ and $\left(  2s-1\right)  -1=2\left(
s-1\right)  $). Now,%
\begin{align*}
f_{1}+f_{3}+f_{5}+\cdots+f_{2n-1}  &  =\sum_{s=1}^{n}\underbrace{f_{2s-1}%
}_{\substack{=f_{2s}-f_{2\left(  s-1\right)  }\\\text{(by
(\ref{sol.fibonacci.first-odd-sum.telesc.2}))}}}=\sum_{s=1}^{n}\left(
f_{2s}-f_{2\left(  s-1\right)  }\right) \\
&  =f_{2n}-f_{2\left(  1-1\right)  }\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.sum.telescope}), applied to
}u=1\text{, }v=n\text{ and }a_{s}=f_{2s}\right) \\
&  =f_{2n}-0\ \ \ \ \ \ \ \ \ \ \left(  \text{since }f_{2\left(  1-1\right)
}=f_{0}=0\right) \\
&  =f_{2n}.
\end{align*}
This solves Exercise \ref{exe.fibonacci.first-odd-sum.telesc}.

Exercise \ref{exe.fibonacci.first-odd-sum.telesc} has other solutions. For
example, we may solve it (for $n\geq1$) by noticing that%
\begin{align*}
&  \underbrace{f_{1}}_{=1}+\underbrace{f_{3}}_{\substack{=f_{2}+f_{1}%
\\=f_{1}+f_{2}}}+\underbrace{f_{5}}_{\substack{=f_{4}+f_{3}\\=f_{3}+f_{4}%
}}+\cdots+\underbrace{f_{2n-1}}_{\substack{=f_{2n-2}+f_{2n-3}\\=f_{2n-3}%
+f_{2n-2}}}\\
&  =1+\underbrace{\left(  f_{1}+f_{2}\right)  +\left(  f_{3}+f_{4}\right)
+\cdots+\left(  f_{2n-3}+f_{2n-2}\right)  }_{\substack{=f_{1}+f_{2}%
+\cdots+f_{2n-2}\\=f_{\left(  2n-2\right)  +2}-1\\\text{(by Exercise
\ref{exe.fibonacci.first-sum}, applied to }2n-2\text{ instead of }n\text{)}%
}}\\
&  =1+f_{\left(  2n-2\right)  +2}-1=f_{\left(  2n-2\right)  +2}=f_{2n}.
\end{align*}
(The case $n=0$ is easily checked manually.)
\end{proof}

The next exercise appears, e.g., in \cite[Introduction]{AndTet18}:

\begin{exercise}
\label{exe.seqsum.sums.1+a2k}\textquotedblright Simplify\textquotedblright%
\ $\prod_{k=0}^{n-1}\left(  1+a^{2^{k}}\right)  $ for $a\neq1$ and
$n\in\mathbb{N}$. (The answer should not contain any $\prod$ signs.)
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.seqsum.sums.1+a2k}.]Let $a$ be a number such
that $a\neq1$. Let $n\in\mathbb{N}$. For each $k\in\mathbb{N}$, we have%
\begin{align}
1-\underbrace{a^{2^{k+1}}}_{\substack{=a^{2^{k}\cdot2}\\\text{(since }%
2^{k+1}=2^{k}\cdot2\text{)}}}  &  =1-\underbrace{a^{2^{k}\cdot2}}_{=\left(
a^{2^{k}}\right)  ^{2}}=1-\left(  a^{2^{k}}\right)  ^{2}\nonumber\\
&  =\left(  1-a^{2^{k}}\right)  \left(  1+a^{2^{k}}\right)
\label{sol.seqsum.sums.1+a2k.1}%
\end{align}
(by the classical formula $1-b^{2}=\left(  1-b\right)  \left(  1+b\right)  $,
applied to $b=a^{2^{k}}$) and therefore%
\begin{equation}
1+a^{2^{k}}=\dfrac{1-a^{2^{k+1}}}{1-a^{2^{k}}}.
\label{sol.seqsum.sums.1+a2k.2}%
\end{equation}


Now,%
\begin{align*}
\prod_{k=0}^{n-1}\underbrace{\left(  1+a^{2^{k}}\right)  }_{\substack{=\dfrac
{1-a^{2^{k+1}}}{1-a^{2^{k}}}\\\text{(by (\ref{sol.seqsum.sums.1+a2k.2}))}}}
&  =\prod_{k=0}^{n-1}\dfrac{1-a^{2^{k+1}}}{1-a^{2^{k}}}=\prod_{s=1}^{n}%
\dfrac{1-a^{2^{s}}}{1-a^{2^{s-1}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }s-1\text{ for
}k\text{ in the product}\right) \\
&  =\dfrac{1-a^{2^{n}}}{1-a^{2^{1-1}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.prod.telescope}), applied to
}u=1\text{, }v=n\text{ and }a_{s}=a^{2^{s}}\right) \\
&  =\dfrac{1-a^{2^{n}}}{1-a}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}a^{2^{1-1}}=a^{2^{0}}=a^{1}=a\right)  .
\end{align*}
So we found our answer:%
\begin{equation}
\prod_{k=0}^{n-1}\left(  1+a^{2^{k}}\right)  =\dfrac{1-a^{2^{n}}}{1-a}.
\label{sol.seqsum.sums.1+a2k.ans}%
\end{equation}


But wait -- did you spot the subtle error?

The error is the following: We divided the equality
(\ref{sol.seqsum.sums.1+a2k.1}) by $1-a^{2^{k}}$ to get
(\ref{sol.seqsum.sums.1+a2k.2}), but $1-a^{2^{k}}$ can be zero. Namely, if
$a=-1$, then $1-a^{2^{k}}$ will be zero for every $k>0$; thus, in all these
cases, we have divided by zero. Nevertheless, our final result
(\ref{sol.seqsum.sums.1+a2k.ans}) holds even in these cases -- it is only the
proof that went wrong.

Fortunately, now that we know the equality (\ref{sol.seqsum.sums.1+a2k.ans}),
it is utterly straightforward to prove it by induction on $n$ (using
(\ref{sol.seqsum.sums.1+a2k.1}) in the induction step).\footnote{Here is this
proof in detail:
\par
\textit{Proof of (\ref{sol.seqsum.sums.1+a2k.ans}):} Forget that we fixed $n$.
We shall prove (\ref{sol.seqsum.sums.1+a2k.ans}) by induction on $n$.
\par
\textit{Induction base:} We have
\[
\prod_{k=0}^{1-1}\left(  1+a^{2^{k}}\right)  =\prod_{k=0}^{0}\left(
1+a^{2^{k}}\right)  =\left(  \text{empty product}\right)  =1=\dfrac
{1-a^{2^{0}}}{1-a}%
\]
(since $\dfrac{1-a^{2^{0}}}{1-a}=\dfrac{1-a^{1}}{1-a}=\dfrac{1-a}{1-a}=1$). In
other words, (\ref{sol.seqsum.sums.1+a2k.ans}) holds for $n=0$.
\par
\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.seqsum.sums.1+a2k.ans}) holds for $n=m$. We must
prove that (\ref{sol.seqsum.sums.1+a2k.ans}) holds for $n=m+1$.
\par
Our induction hypothesis says that (\ref{sol.seqsum.sums.1+a2k.ans}) holds for
$n=m$; in other words, it says that $\prod_{k=0}^{m-1}\left(  1+a^{2^{k}%
}\right)  =\dfrac{1-a^{2^{m}}}{1-a}$.
\par
Now, (\ref{sol.seqsum.sums.1+a2k.1}) (applied to $k=m$) yields%
\begin{equation}
1-a^{2^{m+1}}=\left(  1-a^{2^{m}}\right)  \left(  1+a^{2^{m}}\right)  .
\label{sol.seqsum.sums.1+a2k.1.fn1.1}%
\end{equation}
But%
\begin{align*}
\prod_{k=0}^{m}\left(  1+a^{2^{k}}\right)   &  =\underbrace{\left(
\prod_{k=0}^{m-1}\left(  1+a^{2^{k}}\right)  \right)  }_{=\dfrac{1-a^{2^{m}}%
}{1-a}}\cdot\left(  1+a^{2^{m}}\right)  =\dfrac{1-a^{2^{m}}}{1-a}\cdot\left(
1+a^{2^{m}}\right) \\
&  =\dfrac{1}{1-a}\cdot\underbrace{\left(  1-a^{2^{m}}\right)  \left(
1+a^{2^{m}}\right)  }_{\substack{=1-a^{2^{m+1}}\\\text{(by
(\ref{sol.seqsum.sums.1+a2k.1.fn1.1}))}}}=\dfrac{1}{1-a}\cdot\left(
1-a^{2^{m+1}}\right)  =\dfrac{1-a^{2^{m+1}}}{1-a}.
\end{align*}
In other words, (\ref{sol.seqsum.sums.1+a2k.ans}) holds for $n=m+1$. This
completes the induction step. Thus, (\ref{sol.seqsum.sums.1+a2k.ans}) is
proved.} Thus, while the argument by which we originally arrived at
(\ref{sol.seqsum.sums.1+a2k.ans}) was flawed, we nevertheless were able to put
it to good use, since it helped us find the formula
(\ref{sol.seqsum.sums.1+a2k.ans}), which we were then able to prove by a
different (perfectly sound) argument.

This was a typical example of a phenomenon that is often observed in
mathematics (particularly in modern research): Results are often discovered by
means of reasoning that is not quite rigorous (to the point that it often
sounds like quackery or cannot be communicated at all); then, one is forced to
come up with different arguments to find valid proofs for the results. In our
case, we did not have to look far (in essence, the induction proof was just a
restatement of the not-quite-correct telescope argument avoiding unnecessary
divisions, which helped it avoid division by zero); but this sort of
\textquotedblleft parallel construction\textquotedblright\ of proofs can be
quite a long and difficult process.
\end{proof}

The next exercises are about binomial coefficients:

\begin{exercise}
\label{exe.binom.sum-n-choose-k-half}Show that $\sum_{k=0}^{\left(
n-1\right)  /2}\dbinom{n}{k}=2^{n-1}$ for any odd $n\in\mathbb{N}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.sum-n-choose-k-half}.]Intuitively, the
idea is clear from a look at Pascal's triangle: Pascal's triangle is symmetric
across the vertical axis (by Theorem \ref{thm.binom.sym}). Thus, if
$n\in\mathbb{N}$ is odd, then the $n$-th row of Pascal's triangle (i.e., the
row that begins with $1$ and $n$) splits neatly into two equal halves (one
half being to the left of the vertical axis, and the other half being to the
right of it), and therefore the sum of the left half of this row is exactly
$\dfrac{1}{2}$ of the sum of all entries in this row; but the latter sum is
$2^{n}$ according to Corollary \ref{cor.binom.2pown}. Thus, the former sum is
$2^{n-1}$.

Here is a formal way to restate this argument: Let $n\in\mathbb{N}$ be odd.
Thus, $n=2u+1$ for some $u\in\mathbb{N}$. Consider this $u$. From $n=2u+1$, we
obtain $2u=n-1$ and $u=\left(  n-1\right)  /2$ and $u+1=n-u$ and $2u+1=n$.
Now, Corollary \ref{cor.binom.2pown} yields $\sum\limits_{k=0}^{n}\dbinom
{n}{k}=2^{n}=2^{2u+1}$ (since $n=2u+1$), so that%
\begin{align}
2^{2u+1}  &  =\sum\limits_{k=0}^{n}\dbinom{n}{k}=\sum\limits_{k=0}%
^{2u+1}\dbinom{n}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n=2u+1\right)
\nonumber\\
&  =\sum_{k=0}^{u}\dbinom{n}{k}+\sum_{k=u+1}^{2u+1}\dbinom{n}{k}
\label{sol.binom.sum-n-choose-k-half.1}%
\end{align}
(here, we have split the sum at $k=u$; that is, we have applied
(\ref{eq.sum.split.uvw}) to $0$, $u$ and $2u+1$ instead of $u$, $v$ and $w$).
But%
\begin{align*}
\sum_{k=u+1}^{2u+1}\dbinom{n}{k}  &  =\sum_{k=n-u}^{n}\dbinom{n}%
{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }u+1=n-u\text{ and }2u+1=n\right)
\\
&  =\sum_{k=0}^{u}\underbrace{\dbinom{n}{n-k}}_{\substack{=\dbinom{n}%
{k}\\\text{(by Theorem \ref{thm.binom.sym})}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have substituted }n-k\text{ for }k\text{ in the sum,}\\
\text{since the map }\left\{  0,1,\ldots,u\right\}  \rightarrow\left\{
n-u,n-u+1,\ldots,n\right\} \\
\text{that sends each }k\text{ to }n-k\text{ is a bijection}%
\end{array}
\right) \\
&  =\sum_{k=0}^{u}\dbinom{n}{k}.
\end{align*}
Hence, (\ref{sol.binom.sum-n-choose-k-half.1}) becomes%
\[
2^{2u+1}=\sum_{k=0}^{u}\dbinom{n}{k}+\underbrace{\sum_{k=u+1}^{2u+1}\dbinom
{n}{k}}_{=\sum_{k=0}^{u}\dbinom{n}{k}}=\sum_{k=0}^{u}\dbinom{n}{k}+\sum
_{k=0}^{u}\dbinom{n}{k}=2\cdot\sum_{k=0}^{u}\dbinom{n}{k}.
\]
Dividing both sides of this equality by $2$, we find%
\[
2^{2u}=\sum_{k=0}^{u}\dbinom{n}{k}=\sum_{k=0}^{\left(  n-1\right)  /2}%
\dbinom{n}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }u=\left(  n-1\right)
/2\right)  .
\]
Hence,%
\[
\sum_{k=0}^{\left(  n-1\right)  /2}\dbinom{n}{k}=2^{2u}=2^{n-1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }2u=n-1\right)  .
\]
This solves Exercise \ref{exe.binom.sum-n-choose-k-half}.
\end{proof}

\begin{exercise}
\label{exe.fib.negatives.18f-mt1s-4}Recall once again the
\href{https://en.wikipedia.org/wiki/Fibonacci_number}{Fibonacci sequence}
$\left(  f_{0},f_{1},f_{2},\ldots\right)  $, which is defined recursively by
$f_{0}=0$, $f_{1}=1$, and
\begin{equation}
f_{n}=f_{n-1}+f_{n-2}\qquad\text{for all }n\geq2.
\label{eq.exe.fib.negatives.18f-mt1s-4.rec}%
\end{equation}


Now, let us define $f_{n}$ for \textbf{negative} integers $n$ as well, by
\textquotedblleft applying (\ref{eq.exe.fib.negatives.18f-mt1s-4.rec})
backwards\textquotedblright: This means that we set $f_{n-2}=f_{n}-f_{n-1}$
for all integers $n\leq1$. This allows us to recursively compute
$f_{-1},f_{-2},f_{-3},\ldots$ (in this order). For example,
\begin{align*}
f_{-1}  &  =f_{1}-f_{0}=1-0=1;\\
f_{-2}  &  =f_{0}-f_{-1}=0-1=-1;\\
f_{-3}  &  =f_{-1}-f_{-2}=1-\left(  -1\right)  =2,
\end{align*}
etc.

\textbf{(a)} Prove that $f_{-n}=\left(  -1\right)  ^{n-1}f_{n}$ for each
$n\in\mathbb{Z}$.

\textbf{(b)} Prove that $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}$ for all
$n\in\mathbb{Z}$ and $m\in\mathbb{Z}$.

\textbf{(c)} Prove that $7f_{n}=f_{n-4}+f_{n+4}$ for all $n\in\mathbb{Z}$.

\textbf{(d)} Prove that if $a,b\in\mathbb{Z}$ satisfy $a\mid b$, then
$f_{a}\mid f_{b}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.negatives.18f-mt1s-4}.]Parts
\textbf{(a)}, \textbf{(b)} and \textbf{(c)} of Exercise
\ref{exe.fib.negatives.18f-mt1s-4} appear (with detailed solutions) in
\cite[Exercise 4]{18f-mt1s}; thus, we shall only sketch the arguments here.

Because of our definition of the $f_{n}$, the equation%
\begin{equation}
f_{n}=f_{n-1}+f_{n-2} \label{sol.fib.negatives.18f-mt1s-4.rec}%
\end{equation}
holds for all $n\in\mathbb{Z}$.

\textbf{(a)} First, prove (by strong induction on $n$) that
\begin{equation}
f_{-n}=\left(  -1\right)  ^{n-1}f_{n}\ \ \ \ \ \ \ \ \ \ \text{for each }%
n\in\mathbb{N}. \label{sol.fib.negatives.18f-mt1s-4.a.N}%
\end{equation}
Then, conclude that the equality $f_{-n}=\left(  -1\right)  ^{n-1}f_{n}$ holds
for each $n\in\mathbb{Z}$ as well, because:

\begin{itemize}
\item If $n$ is nonnegative, then it follows from
(\ref{sol.fib.negatives.18f-mt1s-4.a.N}).

\item If $n$ is negative, then (\ref{sol.fib.negatives.18f-mt1s-4.a.N})
(applied to $-n$ instead of $n$) yields $f_{n}=\left(  -1\right)
^{-n-1}f_{-n}$; but this quickly yields $f_{-n}=\left(  -1\right)  ^{n-1}%
f_{n}$.
\end{itemize}

Thus, Exercise \ref{exe.fib.negatives.18f-mt1s-4} \textbf{(a)} is solved.

An alternative solution for Exercise \ref{exe.fib.negatives.18f-mt1s-4}
\textbf{(a)} can be given by strong induction on $\left\vert n\right\vert $.
(Note that strong induction on $n$ will not work, since $n$ ranges over
$\mathbb{Z}$.) We leave the details to the reader.

\textbf{(b)} First, we claim that%
\begin{equation}
f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}\ \ \ \ \ \ \ \ \ \ \text{for all }%
n\in\mathbb{N}\text{ and }m\in\mathbb{Z}.
\label{sol.fib.negatives.18f-mt1s-4.b.NZ}%
\end{equation}


Indeed, (\ref{sol.fib.negatives.18f-mt1s-4.b.NZ}) can be proved in the same
way as we proved (\ref{eq.exe.fibonacci.addition.1}) for all nonnegative
integers $n$ and $m$ (see our \textquotedblleft Second attempt at solving
Exercise \ref{exe.fibonacci.addition}\textquotedblright\ above) -- i.e., by
induction on $n$. (The proof even becomes a bit simpler, since we no longer
have to treat the case $m=0$ separately: It is no longer problematic that
$m-1$ may be negative.)

\begin{noncompile}
Next, we claim that%
\begin{equation}
f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}\ \ \ \ \ \ \ \ \ \ \text{for all }%
n\in\mathbb{Z}\text{ and }m\in\mathbb{N}.
\label{sol.fib.negatives.18f-mt1s-4.b.ZN}%
\end{equation}
Indeed, this follows by applying (\ref{sol.fib.negatives.18f-mt1s-4.b.NZ}) to
$m$ and $n$ instead of $n$ and $m$ (since $n$ and $m$ play symmetric roles in
the equality $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}$).

Now, recall that we need to prove that $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}$
for all $n\in\mathbb{Z}$ and $m\in\mathbb{Z}$. So let us fix $n\in\mathbb{Z}$
and $m\in\mathbb{Z}$. We must prove that $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}%
$. If $n\in\mathbb{N}$, then this follows from
(\ref{sol.fib.negatives.18f-mt1s-4.b.NZ}); on the other hand, if
$m\in\mathbb{N}$, then this follows from
(\ref{sol.fib.negatives.18f-mt1s-4.b.ZN}). Thus, we can WLOG assume that
neither $n\in\mathbb{N}$ nor $m\in\mathbb{N}$ holds. In other words, we can
WLOG assume that both $n$ and $m$ are negative. Assume this.
\end{noncompile}

Now, recall that we need to prove that $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}$
for all $n\in\mathbb{Z}$ and $m\in\mathbb{Z}$. So let us fix $n\in\mathbb{Z}$
and $m\in\mathbb{Z}$. We must prove that $f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}%
$. If $n\in\mathbb{N}$, then this follows from
(\ref{sol.fib.negatives.18f-mt1s-4.b.NZ}). Hence, we WLOG assume that
$n\notin\mathbb{N}$. Hence, $n$ is negative, so that $n\leq-1$ and therefore
$-1-\underbrace{n}_{\leq-1}\geq-1-\left(  -1\right)  =0$. In other words,
$-1-n\in\mathbb{N}$. Thus, (\ref{sol.fib.negatives.18f-mt1s-4.b.NZ}) (applied
to $-1-n$ and $-1-m$ instead of $n$ and $m$) yields%
\begin{align*}
&  f_{\left(  -1-n\right)  +\left(  -1-m\right)  +1}\\
&  =\underbrace{f_{-1-n}}_{\substack{=f_{-\left(  n+1\right)  }\\=\left(
-1\right)  ^{\left(  n+1\right)  -1}f_{n+1}\\\text{(by Exercise
\ref{exe.fib.negatives.18f-mt1s-4} \textbf{(a)},}\\\text{applied to
}n+1\\\text{instead of }n\text{)}}}\ \ \underbrace{f_{-1-m}}%
_{\substack{=f_{-\left(  m+1\right)  }\\=\left(  -1\right)  ^{\left(
m+1\right)  -1}f_{m+1}\\\text{(by Exercise \ref{exe.fib.negatives.18f-mt1s-4}
\textbf{(a)},}\\\text{applied to }m+1\\\text{instead of }n\text{)}%
}}+\underbrace{f_{\left(  -1-n\right)  +1}}_{\substack{=f_{-n}\\=\left(
-1\right)  ^{n-1}f_{n}\\\text{(by Exercise \ref{exe.fib.negatives.18f-mt1s-4}
\textbf{(a)})}}}\ \ \underbrace{f_{\left(  -1-m\right)  +1}}%
_{\substack{=f_{-m}\\=\left(  -1\right)  ^{m-1}f_{m}\\\text{(by Exercise
\ref{exe.fib.negatives.18f-mt1s-4} \textbf{(a)},}\\\text{applied to
}m\\\text{instead of }n\text{)}}}\\
&  =\underbrace{\left(  -1\right)  ^{\left(  n+1\right)  -1}}_{=\left(
-1\right)  ^{n}}f_{n+1}\cdot\underbrace{\left(  -1\right)  ^{\left(
m+1\right)  -1}}_{=\left(  -1\right)  ^{m}}f_{m+1}+\underbrace{\left(
-1\right)  ^{n-1}}_{=-\left(  -1\right)  ^{n}}f_{n}\cdot\underbrace{\left(
-1\right)  ^{m-1}}_{=-\left(  -1\right)  ^{m}}f_{m}\\
&  =\left(  -1\right)  ^{n}f_{n+1}\cdot\left(  -1\right)  ^{m}f_{m+1}+\left(
-\left(  -1\right)  ^{n}\right)  f_{n}\cdot\left(  -\left(  -1\right)
^{m}\right)  f_{m}\\
&  =\underbrace{\left(  -1\right)  ^{n}\left(  -1\right)  ^{m}}_{=\left(
-1\right)  ^{n+m}}\underbrace{\left(  f_{n+1}f_{m+1}+f_{n}f_{m}\right)
}_{=f_{n}f_{m}+f_{n+1}f_{m+1}}=\left(  -1\right)  ^{n+m}\left(  f_{n}%
f_{m}+f_{n+1}f_{m+1}\right)  .
\end{align*}
Comparing this with%
\begin{align*}
&  f_{\left(  -1-n\right)  +\left(  -1-m\right)  +1}\\
&  =f_{-\left(  n+m+1\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\left(  -1-n\right)  +\left(  -1-m\right)  +1=-\left(  n+m+1\right)  \right)
\\
&  =\underbrace{\left(  -1\right)  ^{\left(  n+m+1\right)  -1}}_{=\left(
-1\right)  ^{n+m}}f_{n+m+1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Exercise
\ref{exe.fib.negatives.18f-mt1s-4} \textbf{(a)}, applied to }n+m+1\text{
instead of }n\right) \\
&  =\left(  -1\right)  ^{n+m}f_{n+m+1},
\end{align*}
we obtain%
\[
\left(  -1\right)  ^{n+m}f_{n+m+1}=\left(  -1\right)  ^{n+m}\left(  f_{n}%
f_{m}+f_{n+1}f_{m+1}\right)  .
\]
Dividing both sides of this equality by $\left(  -1\right)  ^{n+m}$, we obtain
$f_{n+m+1}=f_{n}f_{m}+f_{n+1}f_{m+1}$. This solves Exercise
\ref{exe.fib.negatives.18f-mt1s-4} \textbf{(b)}.

An alternative solution to Exercise \ref{exe.fib.negatives.18f-mt1s-4}
\textbf{(b)} can be found in \cite[Exercise 4]{18f-mt1s}; it relies on
two-sided induction (Theorem \ref{thm.ind-principle-2s}).

\textbf{(c)} This is just an exercise in applying the recursive equation of
the Fibonacci sequence over and over:\footnote{The symbol \textquotedblleft%
$\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}$%
\textquotedblright\ designates an equality that follows from
(\ref{sol.fib.negatives.18f-mt1s-4.rec}). For example, $f_{5}%
\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{4}+f_{3}$.}%
\begin{align*}
f_{n-4}+\underbrace{f_{n+4}}%
_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{n+3}%
+f_{n+2}}  &  =f_{n-4}+\underbrace{f_{n+3}}%
_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{n+2}+f_{n+1}%
}+\underbrace{f_{n+2}}_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec}%
)}}{=}f_{n+1}+f_{n}}\\
&  =f_{n-4}+f_{n+2}+f_{n+1}+f_{n+1}+f_{n}=f_{n-4}+\underbrace{f_{n+2}%
}_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{n+1}+f_{n}%
}+2f_{n+1}+f_{n}\\
&  =f_{n-4}+f_{n+1}+f_{n}+2f_{n+1}+f_{n}=f_{n-4}+2f_{n}+3\underbrace{f_{n+1}%
}_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{n}+f_{n-1}%
}\\
&  =f_{n-4}+2f_{n}+3\left(  f_{n}+f_{n-1}\right)  =f_{n-4}+5f_{n}%
+3\underbrace{f_{n-1}}_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec}%
)}}{=}f_{n-2}+f_{n-3}}\\
&  =f_{n-4}+5f_{n}+3\left(  f_{n-2}+f_{n-3}\right)  =\underbrace{f_{n-4}%
+f_{n-3}}_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}%
f_{n-2}}+5f_{n}+3f_{n-2}+2f_{n-3}\\
&  =f_{n-2}+5f_{n}+3f_{n-2}+2f_{n-3}=5f_{n}+2f_{n-2}+2\underbrace{\left(
f_{n-2}+f_{n-3}\right)  }%
_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec})}}{=}f_{n-1}}\\
&  =5f_{n}+2f_{n-2}+2f_{n-1}=5f_{n}+2\underbrace{\left(  f_{n-1}%
+f_{n-2}\right)  }_{\overset{\text{(\ref{sol.fib.negatives.18f-mt1s-4.rec}%
)}}{=}f_{n}}\\
&  =5f_{n}+2f_{n}=7f_{n}.
\end{align*}
Alternatively, Exercise \ref{exe.fib.negatives.18f-mt1s-4} \textbf{(c)} can be
obtained by applying Exercise \ref{exe.fib.negatives.18f-mt1s-4} \textbf{(b)}
to $m=-5$ and again to $m=3$, and then adding the resulting equalities
together. (See \cite[Exercise 4]{18f-mt1s} for the details.)

\textbf{(d)} Let $a,b\in\mathbb{Z}$ satisfy $a\mid b$. We must prove that
$f_{a}\mid f_{b}$.

The numbers $\left\vert a\right\vert $ and $\left\vert b\right\vert $ belong
to $\mathbb{N}$ (since $a$ and $b$ belong to $\mathbb{Z}$). Furthermore,
Proposition \ref{prop.ent.div.1} \textbf{(a)} yields $\left\vert a\right\vert
\mid\left\vert b\right\vert $ (since $a\mid b$). Hence, Exercise
\ref{exe.ent.mod.fn-div} (applied to $\left\vert a\right\vert $ and
$\left\vert b\right\vert $ instead of $a$ and $b$) yields $f_{\left\vert
a\right\vert }\mid f_{\left\vert b\right\vert }$.

It remains to derive $f_{a}\mid f_{b}$ from this. But this is easy: Exercise
\ref{exe.ent.mod.fn-div} \textbf{(a)} (applied to $n=a$) yields $f_{-a}%
=\left(  -1\right)  ^{a-1}f_{a}=\pm f_{a}$. Thus, $f_{\left\vert a\right\vert
}=\pm f_{a}$\ \ \ \ \footnote{\textit{Proof.} We are in one of the following
two cases:
\par
\textit{Case 1:} We have $a\geq0$.
\par
\textit{Case 2:} We have $a<0$.
\par
Let us first consider Case 1. In this case, we have $a\geq0$. Thus,
$\left\vert a\right\vert =a$, so that $f_{\left\vert a\right\vert }=f_{a}=\pm
f_{a}$. Hence, $f_{\left\vert a\right\vert }=\pm f_{a}$ is proved in Case 1.
\par
Let us now consider Case 2. In this case, we have $a<0$. Thus, $\left\vert
a\right\vert =-a$, so that $f_{\left\vert a\right\vert }=f_{-a}=\pm f_{a}$.
Hence, $f_{\left\vert a\right\vert }=\pm f_{a}$ is proved in Case 2.
\par
We have now proved that $f_{\left\vert a\right\vert }=\pm f_{a}$ in each of
the two Cases 1 and 2. Hence, $f_{\left\vert a\right\vert }=\pm f_{a}$ always
holds, qed.}. Likewise, $f_{\left\vert b\right\vert }=\pm f_{b}$; thus,
$f_{b}=\pm f_{\left\vert b\right\vert }$. Hence, $f_{\left\vert b\right\vert
}\mid f_{b}$. Also, from $f_{\left\vert a\right\vert }=\pm f_{a}$, we obtain
$f_{a}\mid f_{\left\vert a\right\vert }$. Thus, $f_{a}\mid f_{\left\vert
a\right\vert }\mid f_{\left\vert b\right\vert }\mid f_{b}$. This solves
Exercise \ref{exe.fib.negatives.18f-mt1s-4} \textbf{(d)}.
\end{proof}

\subsection{\label{sect.hw2}Homework set \#2: More number theory and sums}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the end of Chapter \ref{chp.nt1} and the above parts
of Chapter \ref{chp.seqsum}. Some of the problems may also be unrelated.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.seqsum.cycle-mod-4}Let $n\in\mathbb{N}$. Let $a_{1},a_{2}%
,\ldots,a_{n}$ be $n$ \textbf{odd} integers. Prove that%
\[
a_{1}a_{2}+a_{2}a_{3}+\cdots+a_{n-1}a_{n}+a_{n}a_{1}\equiv n\operatorname{mod}%
4.
\]

\end{exercise}

\begin{exercise}
\label{exe.ent.xa+yb.pos-no-1}Let $a$ and $b$ be two coprime positive integers.

\textbf{(a)} Prove that there do \textbf{not} exist any positive integers $x$
and $y$ satisfying $ab=xa+yb$.

\textbf{(b)} Prove that there do \textbf{not} exist any $x,y\in\mathbb{N}$
satisfying $ab-a-b=xa+yb$.
\end{exercise}

\begin{exercise}
\label{exe.ent.amn-1-div}Let $n$ and $m$ be two coprime positive integers. Let
$u\in\mathbb{Z}$. Prove that%
\[
\left(  u^{n}-1\right)  \left(  u^{m}-1\right)  \mid\left(  u-1\right)
\left(  u^{nm}-1\right)  .
\]

\end{exercise}

\begin{exercise}
\label{exe.binom.gcd-integrality}Let $n,m\in\mathbb{N}$ satisfy $n>0$. Prove
the following:

\textbf{(a)} We have $\dfrac{m}{n}\dbinom{n}{m}=\dbinom{n-1}{m-1}$.

\textbf{(b)} We have $\dfrac{\gcd\left(  n,m\right)  }{n}\dbinom{n}{m}%
\in\mathbb{Z}$.
\end{exercise}

\begin{exercise}
\label{exe.binom.noncoprime-ML770}Let $n$, $i$ and $j$ be positive integers
such that $i<n$ and $j<n$. Prove that $\gcd\left(  \dbinom{n}{i},\dbinom{n}%
{j}\right)  >1$.
\end{exercise}

\begin{exercise}
\label{exe.ent.coprime.sum-of-coprime}Let $n$ be a positive integer. We let
$\phi\left(  n\right)  $ denote the number of all $i\in\left\{  1,2,\ldots
,n\right\}  $ satisfying $i\perp n$. (For example, $\phi\left(  12\right)
=4$, because there are exactly $4$ numbers $i\in\left\{  1,2,\ldots
,12\right\}  $ satisfying $i\perp12$: namely, $1$, $5$, $7$ and $11$.)

\textbf{(a)} Prove that $\phi\left(  n\right)  $ is even if $n>2$.

\textbf{(b)} Prove that the sum of all $i\in\left\{  1,2,\ldots,n\right\}  $
satisfying $i\perp n$ equals $\dfrac{1}{2}n\phi\left(  n\right)  $ if $n>1$.

[\textbf{Remark:} The function $\phi:\left\{  1,2,3,\ldots\right\}
\rightarrow\mathbb{N}$ that sends each positive integer $n$ to $\phi\left(
n\right)  $ is known as the \textit{Euler totient function} (or the
\textit{phi-function}). Here is a table of its first few values:%
\[%
\begin{tabular}
[c]{|c||c|c|c|c|c|c|c|c|c|c|c|c|c|}\hline
$n$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$ & $10$ & $11$ & $12$
& $13$\\\hline
$\phi\left(  n\right)  $ & $1$ & $1$ & $2$ & $2$ & $4$ & $2$ & $6$ & $4$ & $6$
& $4$ & $10$ & $4$ & $12$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
Can you spot any patterns?]
\end{exercise}

\begin{exercise}
\label{exe.seqsum.fib.infsum1}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Find $\sum_{k=2}^{\infty}\dfrac{f_{k}}%
{f_{k-1}f_{k+1}}$.
\end{exercise}

\begin{exercise}
\label{exe.binom.hock-neg-hock}\textbf{(a)} Prove that%
\[
\sum_{i=0}^{n}\dbinom{i}{k}=\dbinom{n+1}{k+1}\ \ \ \ \ \ \ \ \ \ \text{for
each }n\in\mathbb{N}\text{ and }k\in\mathbb{N}\text{.}%
\]


\textbf{(b)} Prove that\footnotemark%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{n}{k}=\left(  -1\right)
^{m}\dbinom{n-1}{m}\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{C}\text{
and }m\in\mathbb{N}\text{.}%
\]

\end{exercise}

\footnotetext{Readers unfamiliar with complex numbers can imagine that the
symbol $\mathbb{C}$ is replaced by $\mathbb{R}$ here. The solution doesn't
really depend on what kind of number $n$ is.}

\begin{exercise}
\label{exe.fib.sum-5}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Prove that%
\[
2^{n-1}\cdot f_{n}=\sum_{k=0}^{n}\dbinom{n}{2k+1}5^{k}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}\text{.}%
\]

\end{exercise}

\begin{exercise}
\label{exe.fib.fibonom-coeff}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. For this exercise, we also set $f_{-1}=1$.

For any $n\in\mathbb{N}$ and $k\in\mathbb{Z}$, define the rational number
$\dbinom{n}{k}_{F}$ (a slight variation on the corresponding binomial
coefficient) by
\[
\dbinom{n}{k}_{F}=%
\begin{cases}
\dfrac{f_{n}f_{n-1}\cdots f_{n-k+1}}{f_{k}f_{k-1}\cdots f_{1}}, & \text{ if
}n\geq k\geq0;\\
0, & \text{ otherwise}.
\end{cases}
\]


\textbf{(a)} Prove that $\dbinom{n}{k}_{F}=\dbinom{n}{n-k}_{F}$ for any
$n\in\mathbb{N}$ and $k\in\mathbb{N}$.

\textbf{(b)} Let $n$ be a positive integer, and let $k\in\mathbb{N}$ be such
that $n\geq k$. Prove that
\[
\dbinom{n}{k}_{F}=f_{k+1}\dbinom{n-1}{k}_{F}+f_{n-k-1}\dbinom{n-1}{k-1}_{F}.
\]


\textbf{(c)} Prove that $\dbinom{n}{k}_{F}\in\mathbb{N}$ for any
$n\in\mathbb{N}$ and $k\in\mathbb{N}$.
\end{exercise}

\subsection{Guessing sequences}

Our next topic are sequences. We begin with a sequence of puzzle-style
exercises in which a sequence is defined recursively and an explicit formula
is asked for. Of course, not every recursively defined sequence has an
explicit formula, so these sorts of exercises often are somewhat artificial.
Yet the methods of solving them can be instructive, and problems of this kind
appear not just on mathematical competitions but also in real research. Thus,
we shall discuss a few such exercises with solutions.

The first sequence we consider is a common generalization of arithmetic
progressions (i.e., sequences $\left(  x_{0},x_{1},x_{2},\ldots\right)  $
satisfying $x_{n}=x_{n-1}+d$ for all $n\geq1$, where $d$ is a given number)
and geometric progressions (i.e., sequences $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ satisfying $x_{n}=qx_{n-1}$ for all $n\geq1$, where $q$ is a
given number):\footnote{As before, the word \textquotedblleft
number\textquotedblright\ means an integer, rational, real or complex number.}

\begin{exercise}
\label{exe.seqs.arigeo}Let $q$ and $d$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be a sequence of numbers that satisfies the
recursive equation%
\begin{equation}
x_{n}=qx_{n-1}+d\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1.
\label{eq.exe.seqs.arigeo.rec}%
\end{equation}
Find an explicit formula for $x_{n}$ in terms of $x_{0}$, $q$ and $d$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.arigeo}.]We compute the first few
entries of our sequence:%
\begin{align*}
x_{0}  &  =x_{0};\\
x_{1}  &  =qx_{0}+d;\\
x_{2}  &  =q\underbrace{x_{1}}_{=qx_{0}+d}+d=q\left(  qx_{0}+d\right)
+d=q^{2}x_{0}+qd+d;\\
x_{3}  &  =q^{3}x_{0}+q^{2}d+qd+d;\\
x_{4}  &  =q^{4}x_{0}+q^{3}d+q^{2}d+qd+d.
\end{align*}
Thus, we are led to guessing the equation%
\begin{equation}
x_{n}=q^{n}x_{0}+\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)  d
\label{sol.seqs.arigeo.claim}%
\end{equation}
for each $n\in\mathbb{N}$. Once this equation is found, proving it by
induction on $n$ is completely straightforward (hence left to the reader).

We can make (\ref{sol.seqs.arigeo.claim}) more explicit by getting rid of the
\textquotedblleft$\cdots$\textquotedblright, but the answer will depend on the
value of $q$: If $q=1$, then (\ref{sol.seqs.arigeo.claim}) simplifies to
$x_{n}=x_{0}+nd$. On the other hand, if $q\neq1$, then
(\ref{eq.exe.ind.geoser-b.eq}) (applied to $b=q$) yields $\left(  q-1\right)
\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)  =q^{n}-1$, so that we have
$q^{0}+q^{1}+\cdots+q^{n-1}=\dfrac{q^{n}-1}{q-1}$, and therefore the equality
(\ref{sol.seqs.arigeo.claim}) rewrites as
\begin{equation}
x_{n}=q^{n}x_{0}+\dfrac{q^{n}-1}{q-1}d. \label{sol.seqs.arigeo.claim2}%
\end{equation}


\begin{noncompile}
Here is an alternative way to prove (\ref{sol.seqs.arigeo.claim2}): We set
$u=\dfrac{d}{q-1}$, and we define a new sequence $\left(  y_{0},y_{1}%
,y_{2},\ldots\right)  $ by setting%
\begin{equation}
y_{i}=x_{i}+u\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\mathbb{N}.
\label{sol.seqs.arigeo.y=}%
\end{equation}
Thus, $\left(  y_{0},y_{1},y_{2},\ldots\right)  =\left(  x_{0}+u,x_{1}%
+u,x_{2}+u,\ldots\right)  $. Now, the equality (\ref{eq.exe.seqs.arigeo.rec})
is easily seen to be equivalent to%
\begin{equation}
y_{n}=qy_{n-1}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1
\label{sol.seqs.arigeo.yrec}%
\end{equation}
\footnote{Indeed, for each $n\geq1$, we have
\begin{align*}
\underbrace{y_{n}}_{=x_{n}+u}-q\underbrace{y_{n-1}}_{=x_{n-1}+u}  &  =\left(
x_{n}+u\right)  -q\left(  x_{n-1}+u\right) \\
&  =x_{n}-qx_{n-1}-\underbrace{\left(  q-1\right)  u}%
_{\substack{=d\\\text{(since }u=\dfrac{d}{q-1}\text{)}}}=x_{n}-qx_{n-1}%
-d=x_{n}-\left(  qx_{n-1}+d\right)  ,
\end{align*}
and therefore the equality $x_{n}=qx_{n-1}+d$ is equivalent to $y_{n}%
=qy_{n-1}$.}. But the equation (\ref{sol.seqs.arigeo.yrec}) is the recursive
equation of a geometric progression; thus, it leads to $y_{n}=q^{n}y_{0}$ for
each $n\in\mathbb{N}$, and therefore%
\begin{align*}
x_{n}  &  =\underbrace{y_{n}}_{=q^{n}y_{0}}-u\ \ \ \ \ \ \ \ \ \ \left(
\text{since (\ref{sol.seqs.arigeo.y=}) yields }y_{n}=x_{n}+u\right) \\
&  =q^{n}\underbrace{y_{0}}_{\substack{=x_{0}+u\\\text{(by
(\ref{sol.seqs.arigeo.y=}))}}}-u=q^{n}\left(  x_{0}+u\right)  -u=q^{n}%
x_{0}+\left(  q^{n}-1\right)  \underbrace{u}_{=\dfrac{d}{q-1}}\\
&  =q^{n}x_{0}+\left(  q^{n}-1\right)  \dfrac{d}{q-1}=q^{n}x_{0}+\dfrac
{q^{n}-1}{q-1}d.
\end{align*}
This alternative approach is slick, but how could we have found it? Let us
disassemble it, since the idea is useful in other situations as well. We have
defined an auxiliary sequence $\left(  y_{0},y_{1},y_{2},\ldots\right)
=\left(  x_{0}+u,x_{1}+u,x_{2}+u,\ldots\right)  $, and showed that it
satisfies a simpler recursion (\ref{sol.seqs.arigeo.yrec}) than our original
sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $. How did we think of
defining $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ this exact way? In
particular, how did we guess the right value of $u$ ? The answer is: We
guessed that there should be \textbf{some} value of $u$ for which the sequence
$\left(  y_{0},y_{1},y_{2},\ldots\right)  =\left(  x_{0}+u,x_{1}%
+u,x_{2}+u,\ldots\right)  $ would satisfy the simpler recursion
(\ref{sol.seqs.arigeo.yrec}) (for example, this could have been guessed by
observing the limit behavior of the sequence $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ for some values of $d$ and $q$), and then we found this
value of $u$ by solving (\ref{sol.seqs.arigeo.yrec}).
\end{noncompile}
\end{proof}

Here is a different sequence puzzle, which has appeared in the finals of the
Norwegian mathematical olympiad 1994-95 (problem 1a) and the British
mathematical olympiad 1996:

\begin{exercise}
\label{exe.seqs.nor1994-qedmo3}Let $\left(  a_{1},a_{2},a_{3},\ldots\right)  $
be a sequence of numbers defined recursively by $a_{1}=1$ and
\begin{equation}
a_{1}+a_{2}+\cdots+a_{n}=n^{2}\cdot a_{n}\ \ \ \ \ \ \ \ \ \ \text{for all
}n\geq2. \label{eq.exe.seqs.nor1994-qedmo3.rec}%
\end{equation}
Find an explicit formula for $a_{n}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.nor1994-qedmo3}.]Define a new sequence
$\left(  b_{0},b_{1},b_{2},\ldots\right)  $ by setting
\begin{equation}
b_{n}=a_{1}+a_{2}+\cdots+a_{n}\ \ \ \ \ \ \ \ \ \ \text{for each }%
n\in\mathbb{N}. \label{sol.seqs.nor1994-qedmo3.bn=}%
\end{equation}
Then, for each positive integer $n$, we have%
\begin{align}
\underbrace{b_{n}}_{=a_{1}+a_{2}+\cdots+a_{n}}-\underbrace{b_{n-1}}%
_{=a_{1}+a_{2}+\cdots+a_{n-1}}  &  =\left(  a_{1}+a_{2}+\cdots+a_{n}\right)
+\left(  a_{1}+a_{2}+\cdots+a_{n-1}\right) \nonumber\\
&  =a_{n}. \label{sol.seqs.nor1994-qedmo3.b-b}%
\end{align}
Note also that $b_{1}=a_{1}=1$.

Now, for each integer $n\geq2$, we have
\begin{align*}
b_{n}  &  =a_{1}+a_{2}+\cdots+a_{n}=n^{2}\cdot\underbrace{a_{n}}%
_{\substack{=b_{n}-b_{n-1}\\\text{(by (\ref{sol.seqs.nor1994-qedmo3.b-b}))}%
}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.exe.seqs.nor1994-qedmo3.rec}%
)}\right) \\
&  =n^{2}\cdot\left(  b_{n}-b_{n-1}\right)  =n^{2}b_{n}-n^{2}b_{n-1},
\end{align*}
hence%
\[
n^{2}b_{n-1}=n^{2}b_{n}-b_{n}=\left(  n^{2}-1\right)  b_{n}=\left(
n-1\right)  \left(  n+1\right)  b_{n}.
\]
Solving this for $b_{n}$, we find%
\begin{equation}
b_{n}=\dfrac{n^{2}b_{n-1}}{\left(  n-1\right)  \left(  n+1\right)  }=\dfrac
{n}{n-1}\cdot\dfrac{n}{n+1}\cdot b_{n-1}. \label{sol.seqs.nor1994-qedmo3.3}%
\end{equation}


This is a recursive equation for the sequence $\left(  b_{0},b_{1}%
,b_{2},\ldots\right)  $ that is much easier to work with than the original
recursion (\ref{eq.exe.seqs.nor1994-qedmo3.rec}) for the sequence $\left(
a_{1},a_{2},a_{3},\ldots\right)  $; in particular, it relies only on one
preceding value $b_{n-1}$ rather than the $n-1$ values $a_{1},a_{2}%
,\ldots,a_{n-1}$. This is why we introduced the sequence $\left(  b_{0}%
,b_{1},b_{2},\ldots\right)  $. The moral of the story (so far -- we haven't
solved the exercise yet!) is that if the sums $a_{1}+a_{2}+\cdots+a_{n}$
appear in a recursive equation, it is worth introducing a new sequence
$\left(  b_{0},b_{1},b_{2},\ldots\right)  $ defined by
(\ref{sol.seqs.nor1994-qedmo3.bn=}); then, these sums can be rewritten as
$b_{n}$, whereas single entries $a_{n}$ of the original sequence $\left(
a_{1},a_{2},a_{3},\ldots\right)  $ can be rewritten as $b_{n}-b_{n-1}$ (by
(\ref{sol.seqs.nor1994-qedmo3.b-b})). This way, we trade finite sums for
differences of two numbers; the latter are usually easier to deal with than
the former.\footnote{Note also that not only sums of the form $a_{1}%
+a_{2}+\cdots+a_{n}$, but more generally any sums of the form $a_{i+1}%
+a_{i+2}+\cdots+a_{j}$ can be rewritten in a simpler form using the
$b_{1},b_{2},b_{3},\ldots$. Indeed, we have $a_{i+1}+a_{i+2}+\cdots
+a_{j}=b_{j}-b_{i}$ for all positive integers $i$ and $j$ satisfying $i\leq
j$.}

Using (\ref{sol.seqs.nor1994-qedmo3.3}), we can now easily compute the entries
of the sequence $\left(  b_{0},b_{1},b_{2},\ldots\right)  $, starting with
$b_{1}$:%
\begin{align*}
b_{1}  &  =1;\\
b_{2}  &  =\dfrac{2}{1}\cdot\dfrac{2}{3}\cdot\underbrace{b_{1}}_{=1}=\dfrac
{2}{1}\cdot\dfrac{2}{3};\\
b_{3}  &  =\dfrac{3}{2}\cdot\dfrac{3}{4}\cdot\underbrace{b_{2}}_{=\dfrac{2}%
{1}\cdot\dfrac{2}{3}}=\dfrac{3}{2}\cdot\dfrac{3}{4}\cdot\dfrac{2}{1}%
\cdot\dfrac{2}{3};\\
b_{4}  &  =\dfrac{4}{3}\cdot\dfrac{4}{5}\cdot\underbrace{b_{3}}_{=\dfrac{3}%
{2}\cdot\dfrac{3}{4}\cdot\dfrac{2}{1}\cdot\dfrac{2}{3}}=\dfrac{4}{3}%
\cdot\dfrac{4}{5}\cdot\dfrac{3}{2}\cdot\dfrac{3}{4}\cdot\dfrac{2}{1}%
\cdot\dfrac{2}{3};\\
&  \ldots.
\end{align*}
The general rule is that%
\begin{equation}
b_{m}=\prod_{n=2}^{m}\left(  \dfrac{n}{n-1}\cdot\dfrac{n}{n+1}\right)
\ \ \ \ \ \ \ \ \ \ \text{for each integer }m\geq1.
\label{sol.seqs.nor1994-qedmo3.5}%
\end{equation}
(Of course, this formula is easily proved by induction on $m$, using
(\ref{sol.seqs.nor1994-qedmo3.5}).)

Now, for each integer $m\geq1$, we have%
\begin{align}
b_{m}  &  =\prod_{n=2}^{m}\underbrace{\left(  \dfrac{n}{n-1}\cdot\dfrac
{n}{n+1}\right)  }_{=\dfrac{n}{n+1}/\dfrac{n-1}{n}}=\prod_{n=2}^{m}\left(
\dfrac{n}{n+1}/\dfrac{n-1}{n}\right)  =\prod_{s=2}^{m}\left(  \dfrac{s}%
{s+1}/\dfrac{s-1}{s}\right) \nonumber\\
&  =\dfrac{m}{m+1}/\dfrac{1}{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.prod.telescope}), applied to }u=2\text{, }v=m\text{ and }a_{s}%
=\dfrac{s}{s+1}\right) \nonumber\\
&  =\dfrac{2m}{m+1}. \label{sol.seqs.nor1994-qedmo3.7}%
\end{align}
It is easy to see that this equality holds for $m=0$ as well (indeed, both
$b_{m}$ and $\dfrac{2m}{m+1}$ are $0$ when $m=0$). Hence,
(\ref{sol.seqs.nor1994-qedmo3.7}) holds for each $m\in\mathbb{N}$.

Now, for each positive integer $n$, we have%
\begin{align*}
a_{n}  &  =\underbrace{b_{n}}_{\substack{=\dfrac{2n}{n+1}\\\text{(by
(\ref{sol.seqs.nor1994-qedmo3.7}))}}}-\underbrace{b_{n-1}}_{\substack{=\dfrac
{2\left(  n-1\right)  }{n}\\\text{(by (\ref{sol.seqs.nor1994-qedmo3.7}))}%
}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.seqs.nor1994-qedmo3.b-b}%
)}\right) \\
&  =\dfrac{2n}{n+1}-\dfrac{2\left(  n-1\right)  }{n}=\dfrac{2}{n\left(
n+1\right)  }.
\end{align*}
Thus, the exercise is solved.\footnote{Try checking that our explicit answer
$a_{n}=\dfrac{2}{n\left(  n+1\right)  }$ does indeed satisfy the recursion
(\ref{eq.exe.seqs.nor1994-qedmo3.rec})! (The formula you should obtain is
precisely (\ref{sol.series.iip1.Sn=}).)}
\end{proof}

The next sequence-guessing exercise is \cite[\S 2.4, Exercise 2]{Galvin20}:

\begin{exercise}
\label{exe.seqs.5/2-and-sq}Define a sequence $\left(  a_{1},a_{2},a_{3}%
,\ldots\right)  $ of rational numbers recursively by
\[
a_{1}=\dfrac{5}{2}\ \ \ \ \ \ \ \ \ \ \text{and }\ \ \ \ \ \ \ \ \ \ a_{n}%
=a_{n-1}^{2}-2\text{ for every }n\geq2.
\]
Find an explicit formula for $a_{n}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.5/2-and-sq}.]Computing the first few
entries of our sequence yields%
\begin{align*}
a_{1}  &  =\dfrac{5}{2}=2.5;\\
a_{2}  &  =\dfrac{17}{4}=4.25;\\
a_{3}  &  =\dfrac{257}{16}\approx16.063;\\
a_{4}  &  =\dfrac{66\ 049}{256}\approx256.0;\\
&  \ldots.
\end{align*}
The first thing that will catch your eye is the omnipresence of powers of $2$
here -- both in the denominators (where they are not surprising due to the
repeated squaring in the construction of the sequence) and as approximate
values. The latter is a dead giveaway: It appears that $a_{n}$ is very close
to a power of $2$, and the difference between $a_{n}$ and said power of $2$
converges to $0$ (rather fast) as $n\rightarrow\infty$. It is easily observed
that the relevant power of $2$ is $2^{2^{n-1}}$. Thus, we suspect that
$a_{n}\approx2^{2^{n-1}}$.

To get an exact formula for $a_{n}$, we take a look at the differences
$a_{n}-2^{2^{n-1}}$ (as it is always a good idea to subtract the part we know
to get a closer look at the part we don't):%
\begin{align*}
a_{1}-2^{2^{0}}  &  =\dfrac{5}{2}-2=\dfrac{1}{2};\\
a_{2}-2^{2^{1}}  &  =\dfrac{17}{4}-4=\dfrac{1}{4};\\
a_{3}-2^{2^{2}}  &  =\dfrac{257}{16}-16=\dfrac{1}{16};\\
&  \ldots.
\end{align*}
These suggest that $a_{n}-2^{2^{n-1}}=\dfrac{1}{2^{2^{n-1}}}$, and thus%
\begin{equation}
a_{n}=2^{2^{n-1}}+\dfrac{1}{2^{2^{n-1}}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq1. \label{sol.seqs.5/2-and-sq.claim}%
\end{equation}
Once this formula has been guessed, its proof is a straightforward induction
on $n$ (which we leave to the reader, who can find it in \cite[\S 2.4,
Exercise 2]{Galvin20}).

Could we have found this formula without staring at numbers? Yes, although
that would have required a more sophisticated trick: A contest mathematics
connoisseur will recognize the \textquotedblleft scent of $x+\dfrac{1}{x}%
$\textquotedblright\ in the recursive formula $a_{n}=a_{n-1}^{2}-2$. What does
this mean? The crucial observation is that if a number $y$ has the form
$x+\dfrac{1}{x}$ for some number $x\neq0$, then
\begin{equation}
y^{2}-2=x^{2}+\dfrac{1}{x^{2}} \label{sol.seqs.5/2-and-sq.zhuk}%
\end{equation}
(check this!). Knowing this, when you see an expression of the form $y^{2}-2$
anywhere, you may want to try rewriting the $y$ as $x+\dfrac{1}{x}$, so that
$y^{2}-2$ becomes $x^{2}+\dfrac{1}{x^{2}}$. In the case of the present
problem, we thus suspect that there is a \textquotedblleft
secret\textquotedblright\ sequence $\left(  x_{1},x_{2},x_{3},\ldots\right)  $
of numbers with the property that
\begin{equation}
a_{n}=x_{n}+\dfrac{1}{x_{n}}\ \ \ \ \ \ \ \ \ \ \text{for every }n\geq1.
\label{sol.seqs.5/2-and-sq.a-through-x}%
\end{equation}
If this sequence exists, then the recursion $a_{n}=a_{n-1}^{2}-2$ can be
rewritten as $x_{n}+\dfrac{1}{x_{n}}=x_{n-1}^{2}+\dfrac{1}{x_{n-1}^{2}}$.

Constructing such a \textquotedblleft secret\textquotedblright\ sequence
$\left(  x_{1},x_{2},x_{3},\ldots\right)  $ is easy: We find $x_{1}$ by
solving the equation $\dfrac{5}{2}=a_{1}=x_{1}+\dfrac{1}{x_{1}}$ for $x_{1}$
(this boils down to a quadratic equation, whose solutions are $\dfrac{1}{2}$
and $2$); then we set $x_{n}=x_{n-1}^{2}$ for each $n\geq2$ (this is the
easiest way to satisfy the recursion $x_{n}+\dfrac{1}{x_{n}}=x_{n-1}%
^{2}+\dfrac{1}{x_{n-1}^{2}}$; of course, we could have also set $x_{n}%
=\dfrac{1}{x_{n-1}^{2}}$, but why complicate things?). This leads to%
\begin{align*}
x_{1}  &  =2\ \ \ \ \ \ \ \ \ \ \left(  \text{we could have just as well
chosen }\dfrac{1}{2}\right)  ;\\
x_{2}  &  =2^{2};\\
x_{3}  &  =\left(  2^{2}\right)  ^{2}=2^{4};\\
x_{4}  &  =\left(  2^{4}\right)  ^{2}=2^{8};\\
&  \ldots;
\end{align*}
the general formula is easily seen to be $x_{n}=2^{2^{n-1}}$. Hence,
(\ref{sol.seqs.5/2-and-sq.a-through-x}) rewrites as $a_{n}=2^{2^{n-1}}%
+\dfrac{1}{2^{2^{n-1}}}$. Thus, we have discovered
(\ref{sol.seqs.5/2-and-sq.claim}) again.

The rational expression $x+\dfrac{1}{x}$ is a sufficiently common occurrence
in mathematics that its properties are worth remembering (cf. the Wikipedia
page on \href{https://en.wikipedia.org/wiki/Joukowsky_transform}{the Joukowsky
transform}). The equality (\ref{sol.seqs.5/2-and-sq.zhuk}) is a close relative
of the formula
\[
\cos\left(  2\varphi\right)  =2\cos^{2}\varphi-1
\]
from trigonometry; indeed, using complex numbers, the latter formula can
easily be derived from (\ref{sol.seqs.5/2-and-sq.zhuk}) (by applying
(\ref{sol.seqs.5/2-and-sq.zhuk}) to $x=e^{i\varphi}$ and $y=2\cos\varphi$).
\end{proof}

The following sequence-guessing exercise was problem A3 on the Putnam contest
2004 (see \cite[\S 3.1.1, Example]{GelAnd}):

\begin{exercise}
\label{exe.seqs.putnam2004A3}Define a sequence $\left(  a_{0},a_{1}%
,a_{2},\ldots\right)  $ of rational numbers recursively by
\[
a_{0}=a_{1}=a_{2}=1
\]
and%
\begin{equation}
a_{n}a_{n+3}-a_{n+1}a_{n+2}=n!\ \ \ \ \ \ \ \ \ \ \text{for every }%
n\in\mathbb{N}. \label{eq.exe.seqs.putnam2004A3.rec}%
\end{equation}
Prove that $a_{n}$ is an integer for all $n\in\mathbb{N}$.
\end{exercise}

(The original statement on the Putnam contest wrote $\det\left(
\begin{array}
[c]{cc}%
a_{n} & a_{n+1}\\
a_{n+2} & a_{n+3}%
\end{array}
\right)  $ instead of $a_{n}a_{n+3}-a_{n+1}a_{n+2}$, but this clearly makes no difference.)

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.putnam2004A3}.]Let us compute the first
few entries of our sequence. We are given that $a_{0}=a_{1}=a_{2}=1$. Now, in
order to find $a_{3}$, we apply (\ref{eq.exe.seqs.putnam2004A3.rec}) to $n=0$,
obtaining $a_{0}a_{3}-a_{1}a_{2}=0!=1$. Solving this for $a_{3}$ (using
$a_{0}=a_{1}=a_{2}=1$) yields $a_{3}=2$. Next, in order to find $a_{4}$, we
apply (\ref{eq.exe.seqs.putnam2004A3.rec}) to $n=1$, obtaining $a_{1}%
a_{4}-a_{2}a_{3}=1!=1$. Solving this for $a_{4}$ (using $a_{1}=a_{2}=1$ and
$a_{3}=2$) yields $a_{4}=3$. Going further in the same vein, we find $a_{5}=8$
and $a_{6}=15$ and $a_{7}=48$ and $a_{8}=105$.

Do we see any pattern? Perhaps not yet. But with these entries being integers,
we can try to analyze them in a way only integers can be analyzed: by
factoring them into primes.\footnote{We won't properly discuss prime
factorization until Section \ref{sect.ent.primefac}, but for now let us take
it for granted.} The prime factorizations of the entries $a_{3},a_{4}%
,\ldots,a_{8}$ are
\[
a_{3}=2,\ \ \ \ \ \ \ \ \ \ a_{4}=3,\ \ \ \ \ \ \ \ \ \ a_{5}=2^{3}%
,\ \ \ \ \ \ \ \ \ \ a_{6}=3\cdot5,\ \ \ \ \ \ \ \ \ \ a_{7}=2^{4}%
\cdot3,\ \ \ \ \ \ \ \ \ \ a_{8}=3\cdot5\cdot7.
\]
Now a pattern in the $a_{4},a_{6},a_{8}$ meets the eye: It appears that
\begin{equation}
a_{2m}=\underbrace{1\cdot3\cdot5\cdot\cdots\cdot\left(  2m-1\right)
}_{\substack{\text{the product of the first }m\\\text{odd positive integers}%
}}\ \ \ \ \ \ \ \ \ \ \text{for each }m\in\mathbb{N}.
\label{sol.seqs.putnam2004A3.2m-rule}%
\end{equation}


The odd-indexed values $a_{2m+1}$ are disguising somewhat better. Unlike the
integers $a_{2m}$, which are all odd, these are even (at least as far as we
have computed them). Moreover, they seem to be multiples of larger and larger
powers of $2$. More precisely, $a_{2m+1}$ appears to be a multiple of $2^{m}$;
thus, we can try to look at $\dfrac{a_{2m+1}}{2^{m}}$ in order to pin down the
other factor. We see that%
\[
\dfrac{a_{3}}{2^{1}}=1,\ \ \ \ \ \ \ \ \ \ \dfrac{a_{5}}{2^{2}}%
=2,\ \ \ \ \ \ \ \ \ \ \dfrac{a_{7}}{2^{3}}=6,\ \ \ \ \ \ \ \ \ \ \dfrac
{a_{9}}{2^{4}}=24.
\]
These look familiar -- aren't these the factorials? Thus, we are led to
conjecturing that%
\begin{equation}
a_{2m+1}=2^{m}\cdot m!=\underbrace{2\cdot4\cdot6\cdot\cdots\cdot\left(
2m\right)  }_{\substack{\text{the product of the first }m\\\text{even positive
integers}}}\ \ \ \ \ \ \ \ \ \ \text{for each }m\in\mathbb{N}
\label{sol.seqs.putnam2004A3.2m+1-rule}%
\end{equation}
(where the last equality sign is an easy consequence of the definition of $m!$
and (\ref{eq.prod.linear1})). Another way to guess this formula
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) would have been to observe
experimentally that $a_{3}\mid a_{5}\mid a_{7}\mid a_{9}$ and thus it is
reasonable to look at the consecutive quotients $\dfrac{a_{5}}{a_{3}}%
,\dfrac{a_{7}}{a_{5}},\dfrac{a_{9}}{a_{7}}$. (The same reasoning could have
been used to come up with (\ref{sol.seqs.putnam2004A3.2m-rule}), if we hadn't
thought of using prime factorization.)

At this point, the two formulas we have guessed -- that is,
(\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) -- cover all entries of our sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $; thus, we can try proving them by
induction. Note that proving any one of these two formulas alone would be
difficult: For example, if we tried to prove
(\ref{sol.seqs.putnam2004A3.2m-rule}) by induction on $m$, then we could not
get much mileage out of our recursion (\ref{eq.exe.seqs.putnam2004A3.rec}),
since it would require us to know $a_{2m-1}$ and $a_{2m-3}$, which would not
be covered by (\ref{sol.seqs.putnam2004A3.2m-rule}). Likewise, if we tried to
prove (\ref{sol.seqs.putnam2004A3.2m+1-rule}) by induction on $m$, then we
would need to know $a_{2m}$ and $a_{2m-2}$, which
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) could not help us compute. However,
(\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) complement each other so neatly that
proving them \textbf{together} is a straightforward induction exercise. Let us
do this in detail just to drive this point home:

\begin{statement}
\textit{Claim 1:} For each $m\in\mathbb{N}$, the equalities
(\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) hold.
\end{statement}

\begin{fineprint}
[\textit{Proof of Claim 1:} We proceed by strong induction on $m$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that the equalities (\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) hold for all $m<k$. We must prove that
the equalities (\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) hold for $m=k$. In other words, we
must prove that
\begin{equation}
a_{2k}=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-1\right)
\label{sol.seqs.putnam2004A3.C1.pf.IG2k}%
\end{equation}
and%
\begin{equation}
a_{2k+1}=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k\right)  .
\label{sol.seqs.putnam2004A3.C1.pf.IG2k1}%
\end{equation}


If $k\leq1$, then this is straightforward. Thus, we WLOG assume that $k>1$.
Hence, $2k>2$, so that $2k\geq3$. Now, our induction hypothesis yields that
the equalities (\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) hold for $m=k-2$. In other words, we
have
\[
a_{2k-4}=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-5\right)
\]
and%
\begin{equation}
a_{2k-3}=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-4\right)  .
\label{sol.seqs.putnam2004A3.C1.pf.IH3}%
\end{equation}
Also, our induction hypothesis yields that the equalities
(\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) hold for $m=k-1$. In other words, we
have
\begin{equation}
a_{2k-2}=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-3\right)
\label{sol.seqs.putnam2004A3.C1.pf.IH2}%
\end{equation}
and%
\begin{equation}
a_{2k-1}=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-2\right)  .
\label{sol.seqs.putnam2004A3.C1.pf.IH1}%
\end{equation}


Now, (\ref{eq.exe.seqs.putnam2004A3.rec}) (applied to $n=2k-3$) yields%
\[
a_{2k-3}a_{2k}-a_{2k-2}a_{2k-1}=\left(  2k-3\right)  !,
\]
so that%
\begin{align*}
a_{2k-3}a_{2k}  &  =\left(  2k-3\right)  !+\underbrace{a_{2k-2}}%
_{\substack{=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-3\right)  \\\text{(by
(\ref{sol.seqs.putnam2004A3.C1.pf.IH2}))}}}\underbrace{a_{2k-1}}%
_{\substack{=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-2\right)  \\\text{(by
(\ref{sol.seqs.putnam2004A3.C1.pf.IH1}))}}}\\
&  =\left(  2k-3\right)  !+\underbrace{\left(  1\cdot3\cdot5\cdot\cdots
\cdot\left(  2k-3\right)  \right)  }_{=\prod_{\substack{i\in\left\{
1,2,\ldots,2k-2\right\}  ;\\i\text{ is odd}}}i}\cdot\underbrace{\left(
2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-2\right)  \right)  }_{=\prod
_{\substack{i\in\left\{  1,2,\ldots,2k-2\right\}  ;\\i\text{ is even}}}i}\\
&  =\left(  2k-3\right)  !+\underbrace{\left(  \prod_{\substack{i\in\left\{
1,2,\ldots,2k-2\right\}  ;\\i\text{ is odd}}}i\right)  \cdot\left(
\prod_{\substack{i\in\left\{  1,2,\ldots,2k-2\right\}  ;\\i\text{ is even}%
}}i\right)  }_{\substack{=\prod_{i\in\left\{  1,2,\ldots,2k-2\right\}
}i\\\text{(by (\ref{eq.prod.split}))}}}=\left(  2k-3\right)
!+\underbrace{\prod_{i\in\left\{  1,2,\ldots,2k-2\right\}  }i}%
_{\substack{=1\cdot2\cdot\cdots\cdot\left(  2k-2\right)  \\=\left(
2k-2\right)  !\\=\left(  2k-2\right)  \cdot\left(  2k-3\right)  !}}\\
&  =\left(  2k-3\right)  !+\left(  2k-2\right)  \cdot\left(  2k-3\right)  !\\
&  =\underbrace{\left(  1+\left(  2k-2\right)  \right)  }_{=2k-1}\cdot\left(
2k-3\right)  !=\left(  2k-1\right)  \cdot\left(  2k-3\right)  !.
\end{align*}
Comparing this with%
\begin{align*}
&  \underbrace{a_{2k-3}}_{\substack{=2\cdot4\cdot6\cdot\cdots\cdot\left(
2k-4\right)  \\\text{(by (\ref{sol.seqs.putnam2004A3.C1.pf.IH3}))}}%
}\cdot\underbrace{\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-1\right)
\right)  }_{=\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-3\right)
\right)  \cdot\left(  2k-1\right)  }\\
&  =\underbrace{\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-4\right)
\right)  }_{=\prod_{\substack{i\in\left\{  1,2,\ldots,2k-3\right\}  ;\\i\text{
is even}}}i}\cdot\underbrace{\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(
2k-3\right)  \right)  }_{=\prod_{\substack{i\in\left\{  1,2,\ldots
,2k-3\right\}  ;\\i\text{ is odd}}}i}\cdot\left(  2k-1\right) \\
&  =\underbrace{\left(  \prod_{\substack{i\in\left\{  1,2,\ldots,2k-3\right\}
;\\i\text{ is even}}}i\right)  \cdot\left(  \prod_{\substack{i\in\left\{
1,2,\ldots,2k-3\right\}  ;\\i\text{ is odd}}}i\right)  }_{\substack{=\prod
_{i\in\left\{  1,2,\ldots,2k-3\right\}  }i\\\text{(by (\ref{eq.prod.split}))}%
}}\cdot\left(  2k-1\right)  =\underbrace{\left(  \prod_{i\in\left\{
1,2,\ldots,2k-3\right\}  }i\right)  }_{\substack{=1\cdot2\cdot\cdots
\cdot\left(  2k-3\right)  \\=\left(  2k-3\right)  !}}\cdot\left(  2k-1\right)
\\
&  =\left(  2k-3\right)  !\cdot\left(  2k-1\right)  =\left(  2k-1\right)
\cdot\left(  2k-3\right)  !,
\end{align*}
we obtain%
\[
a_{2k-3}a_{2k}=a_{2k-3}\cdot\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(
2k-1\right)  \right)  .
\]
We can cancel the factor $a_{2k-3}$ from this equality (since $a_{2k-3}%
=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-4\right)  \neq0$), and thus find
$a_{2k}=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-1\right)  $. This proves
(\ref{sol.seqs.putnam2004A3.C1.pf.IG2k}).

Furthermore, (\ref{eq.exe.seqs.putnam2004A3.rec}) (applied to $n=2k-2$) yields%
\[
a_{2k-2}a_{2k+1}-a_{2k-1}a_{2k}=\left(  2k-2\right)  !,
\]
so that%
\begin{align*}
a_{2k-2}a_{2k+1}  &  =\left(  2k-2\right)  !+\underbrace{a_{2k-1}%
}_{\substack{=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-2\right)  \\\text{(by
(\ref{sol.seqs.putnam2004A3.C1.pf.IH1}))}}}\underbrace{a_{2k}}%
_{\substack{=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-1\right)  \\\text{(by
(\ref{sol.seqs.putnam2004A3.C1.pf.IG2k}))}}}\\
&  =\left(  2k-2\right)  !+\underbrace{\left(  2\cdot4\cdot6\cdot\cdots
\cdot\left(  2k-2\right)  \right)  }_{=\prod_{\substack{i\in\left\{
1,2,\ldots,2k-1\right\}  ;\\i\text{ is even}}}i}\cdot\underbrace{\left(
1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-1\right)  \right)  }_{=\prod
_{\substack{i\in\left\{  1,2,\ldots,2k-1\right\}  ;\\i\text{ is odd}}}i}\\
&  =\left(  2k-2\right)  !+\underbrace{\left(  \prod_{\substack{i\in\left\{
1,2,\ldots,2k-1\right\}  ;\\i\text{ is even}}}i\right)  \cdot\left(
\prod_{\substack{i\in\left\{  1,2,\ldots,2k-1\right\}  ;\\i\text{ is odd}%
}}i\right)  }_{\substack{=\prod_{i\in\left\{  1,2,\ldots,2k-1\right\}
}i\\\text{(by (\ref{eq.prod.split}))}}}=\left(  2k-2\right)
!+\underbrace{\prod_{i\in\left\{  1,2,\ldots,2k-1\right\}  }i}%
_{\substack{=1\cdot2\cdot\cdots\cdot\left(  2k-1\right)  \\=\left(
2k-1\right)  !\\=\left(  2k-1\right)  \cdot\left(  2k-2\right)  !}}\\
&  =\left(  2k-2\right)  !+\left(  2k-1\right)  \cdot\left(  2k-2\right)  !\\
&  =\underbrace{\left(  1+\left(  2k-1\right)  \right)  }_{=2k}\cdot\left(
2k-2\right)  !=2k\cdot\left(  2k-2\right)  !.
\end{align*}
Comparing this with%
\begin{align*}
&  \underbrace{a_{2k-2}}_{\substack{=1\cdot3\cdot5\cdot\cdots\cdot\left(
2k-3\right)  \\\text{(by (\ref{sol.seqs.putnam2004A3.C1.pf.IH2}))}}%
}\cdot\underbrace{\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(  2k\right)
\right)  }_{=\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(  2k-2\right)
\right)  \cdot\left(  2k\right)  }\\
&  =\underbrace{\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-3\right)
\right)  }_{=\prod_{\substack{i\in\left\{  1,2,\ldots,2k-2\right\}  ;\\i\text{
is odd}}}i}\cdot\underbrace{\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(
2k-2\right)  \right)  }_{=\prod_{\substack{i\in\left\{  1,2,\ldots
,2k-2\right\}  ;\\i\text{ is even}}}i}\cdot\left(  2k\right) \\
&  =\underbrace{\left(  \prod_{\substack{i\in\left\{  1,2,\ldots,2k-2\right\}
;\\i\text{ is odd}}}i\right)  \cdot\left(  \prod_{\substack{i\in\left\{
1,2,\ldots,2k-2\right\}  ;\\i\text{ is even}}}i\right)  }_{\substack{=\prod
_{i\in\left\{  1,2,\ldots,2k-2\right\}  }i\\\text{(by (\ref{eq.prod.split}))}%
}}\cdot\left(  2k\right)  =\underbrace{\left(  \prod_{i\in\left\{
1,2,\ldots,2k-2\right\}  }i\right)  }_{\substack{=1\cdot2\cdot\cdots
\cdot\left(  2k-2\right)  \\=\left(  2k-2\right)  !}}\cdot\left(  2k\right) \\
&  =\left(  2k-2\right)  !\cdot\left(  2k\right)  =2k\cdot\left(  2k-2\right)
!,
\end{align*}
we obtain%
\[
a_{2k-2}a_{2k+1}=a_{2k-2}\cdot\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(
2k\right)  \right)  .
\]
We can cancel the factor $a_{2k-2}$ from this equality (since $a_{2k-2}%
=1\cdot3\cdot5\cdot\cdots\cdot\left(  2k-3\right)  \neq0$), and thus find
$a_{2k+1}=2\cdot4\cdot6\cdot\cdots\cdot\left(  2k\right)  $. This proves
(\ref{sol.seqs.putnam2004A3.C1.pf.IG2k1}).

Thus, both (\ref{sol.seqs.putnam2004A3.C1.pf.IG2k}) and
(\ref{sol.seqs.putnam2004A3.C1.pf.IG2k1}) are proved. This completes the
induction step. Thus, Claim 1 is proved.]
\end{fineprint}

Obviously, Claim 1 entails that $a_{2m}$ and $a_{2m+1}$ are integers for each
$m\in\mathbb{N}$. Hence, $a_{n}$ is an integer for each $n\in\mathbb{N}$
(since each $n\in\mathbb{N}$ has the form $2m$ or $2m+1$ for some
$m\in\mathbb{N}$). This solves Exercise \ref{exe.seqs.putnam2004A3}.

[\textit{Remark:} Using Exercise \ref{exe.odd-factorial}, we could have
rewritten (\ref{sol.seqs.putnam2004A3.2m-rule}) as $a_{2m}=\dfrac{\left(
2m\right)  !}{2^{m}m!}$. This would have made
(\ref{sol.seqs.putnam2004A3.2m-rule}) shorter and a bit easier to work with,
but it would have obscured the fact that $a_{2m}$ is an integer.

We could have also combined the two formulas
(\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) into a single formula%
\[
a_{n}=\left(  n-1\right)  \cdot\left(  n-3\right)  \cdot\left(  n-5\right)
\cdot\cdots,
\]
where the product on the right hand side is understood to end at $1$ if $n$ is
even and at $2$ if $n$ is odd.]
\end{proof}

\subsection{\label{sect.per}Periodicity}

\subsubsection{\label{subsect.per.seq}Periodic sequences}

Next, we shall discuss a property that some sequences have:
\textit{periodicity}. Here is a way to define it:

\begin{definition}
\label{def.seqs.period}Let $u=\left(  u_{0},u_{1},u_{2},\ldots\right)  $ be an
infinite sequence (of any kinds of objects -- e.g., of numbers).

\textbf{(a)} A positive integer $d$ is said to be a \textit{period} of $u$ if
every $i\in\mathbb{N}$ satisfies $u_{i}=u_{i+d}$.

\textbf{(b)} The sequence $u$ is said to be \textit{periodic} if it has a
period (i.e., if a period of $u$ exists).

\textbf{(c)} Let $d$ be a positive integer. The sequence $u$ is said to be
$d$\textit{-periodic} if $d$ is a period of $u$.
\end{definition}

\begin{example}
\label{exa.seqs.period.1}Let $u=\left(  u_{0},u_{1},u_{2},\ldots\right)  $ be
an infinite sequence. Then, $1$ is a period of $u$ if every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+1}$ (by Definition \ref{def.seqs.period} \textbf{(a)}).
In other words, $1$ is a period of $u$ if $u_{0}=u_{1}=u_{2}=\cdots$. In other
words, $1$ is a period of $u$ if all entries of $u$ are equal. Sequences whose
all entries are equal are said to be \textit{constant}; thus, the $1$-periodic
sequences are precisely the constant sequences.
\end{example}

\begin{example}
\label{exa.seqs.period.-1}Let $u$ be the sequence $\left(  \left(  -1\right)
^{0},\left(  -1\right)  ^{1},\left(  -1\right)  ^{2},\left(  -1\right)
^{3},\ldots\right)  =\left(  1,-1,1,-1,1,-1,\ldots\right)  $.

Then, $2$ is a period of $u$, since every $i\in\mathbb{N}$ satisfies $\left(
-1\right)  ^{i}=\left(  -1\right)  ^{i+2}$. Thus, the sequence $u$ is
$2$-periodic and periodic.

On the other hand, $1$ is not a period of $u$, because not every
$i\in\mathbb{N}$ satisfies $\left(  -1\right)  ^{i}=\left(  -1\right)  ^{i+1}%
$. (Actually, no $i\in\mathbb{N}$ satisfies this.)
\end{example}

\begin{example}
\label{exa.seqs.period.0}Let $u$ be the sequence $\left(  0^{0},0^{1}%
,0^{2},0^{3},\ldots\right)  =\left(  1,0,0,0,\ldots\right)  $.

Then, $u$ has no period. In fact, if $d$ was a period of $u$, then every
$i\in\mathbb{N}$ would satisfy $0^{i}=0^{i+d}$; but this cannot hold for $i=0$
(because in this case, $0^{i}=0^{0}=1$ but $0^{i+d}=0^{\left(  \text{something
positive}\right)  }=0$). Thus, $u$ is not periodic.

On the other hand, if we remove the first entry of $u$, then $u$ becomes the
sequence $\left(  0,0,0,0,\ldots\right)  $, which is periodic (and even
$1$-periodic). The sequence $u$ is therefore \textquotedblleft periodic except
for a few early entries\textquotedblright. Such sequences are called
\textit{eventually periodic}, but we will not have much use for this word.
\end{example}

\begin{example}
\label{exa.seqs.period.cpx-i}Complex numbers give a simple example of a
$4$-periodic sequence: If $i$ denotes the complex number $\sqrt{-1}$, then the
sequence $\left(  i^{0},i^{1},i^{2},i^{3},\ldots\right)  =\left(
1,i,-1,-i,1,i,-1,-i,1,i,-1,-i,\ldots\right)  $ is $4$-periodic, since
$i^{4}=1$.
\end{example}

\begin{example}
\label{exa.seqs.period.rem}Let $n$ be a positive integer. The sequence
\begin{align*}
&  \left(  0\%n,1\%n,2\%n,3\%n,\ldots\right) \\
&  =\left(  0,1,2,\ldots,n-1,0,1,2,\ldots,n-1,0,1,2,\ldots,n-1,\ldots\right)
\end{align*}
is $n$-periodic. Indeed, every $i\in\mathbb{N}$ satisfies $i\%n=\left(
i+n\right)  \%n$.
\end{example}

\begin{example}
\label{exa.seqs.period.6}Let us define a sequence $\left(  g_{0},g_{1}%
,g_{2},\ldots\right)  $ of integers recursively by
\[
g_{0}=0,\ \ \ \ \ \ \ \ \ \ g_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and }%
g_{n}=g_{n-1}-g_{n-2}\text{ for all }n\geq2.
\]
Note that this differs from the definition of the Fibonacci sequence only in a
single sign. Here is a table of the first few entries of this new sequence:%
\[%
\begin{tabular}
[c]{|c||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$ & $10$ & $11$
& $12$\\\hline
$g_{n}$ & $0$ & $1$ & $1$ & $0$ & $-1$ & $-1$ & $0$ & $1$ & $1$ & $0$ & $-1$ &
$-1$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]
What a difference a sign can make! We observe from the table that the sequence
$\left(  g_{0},g_{1},g_{2},\ldots\right)  $ is $6$-periodic (i.e., its entries
repeat every $6$ terms: that is, $g_{i}=g_{i+6}$ for each $i\in\mathbb{N}$),
and can be rewritten explicitly as
\[
g_{n}=\left[  3\nmid n\right]  \left(  -1\right)  ^{n//3}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}%
\]
using the Iverson bracket notation (Definition \ref{def.iverson}). All of this
can be proved by a straightforward strong induction on $n$.
\end{example}

The following theorem gives basic properties of periods of sequences:

\begin{theorem}
\label{thm.seqs.period.main}Let $u=\left(  u_{0},u_{1},u_{2},\ldots\right)  $
be an infinite sequence (of any kinds of objects -- e.g., of numbers). Then:

\textbf{(a)} If $a$ and $b$ are two periods of $u$, then $a+b$ is a period of
$u$.

\textbf{(b)} If $a$ and $b$ are two periods of $u$ such that $a>b$, then $a-b$
is a period of $u$.

\textbf{(c)} If $a$ is a period of $u$, then $na$ is a period of $u$ for every
positive integer $n$.

\textbf{(d)} If $a$ and $b$ are two periods of $u$, then $\gcd\left(
a,b\right)  $ is a period of $u$.

\textbf{(e)} If $a$ is a period of $u$, and if $p$ and $q$ are two nonnegative
integers satisfying $p\equiv q\operatorname{mod}a$, then $u_{p}=u_{q}$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.seqs.period.main}.]\textbf{(a)} Let $a$ and $b$ be
two periods of $u$. We must prove that $a+b$ is a period of $u$.

Recall that $a$ is a period of $u$ if and only if every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+a}$ (by Definition \ref{def.seqs.period} \textbf{(a)}).
Hence, every $i\in\mathbb{N}$ satisfies
\begin{equation}
u_{i}=u_{i+a} \label{pf.thm.seqs.period.main.a.xia}%
\end{equation}
(since $a$ is a period of $u$). The same argument (applied to $b$ instead of
$a$) shows that every $i\in\mathbb{N}$ satisfies%
\begin{equation}
u_{i}=u_{i+b}. \label{pf.thm.seqs.period.main.a.xib}%
\end{equation}
Now, every $i\in\mathbb{N}$ satisfies
\begin{align*}
u_{i}  &  =u_{i+a}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.seqs.period.main.a.xia})}\right) \\
&  =u_{\left(  i+a\right)  +b}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.seqs.period.main.a.xib}), applied to }i+a\text{ instead of
}i\right) \\
&  =u_{i+\left(  a+b\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
i+a\right)  +b=i+\left(  a+b\right)  \right)  .
\end{align*}


But $a+b$ is a period of $u$ if and only if every $i\in\mathbb{N}$ satisfies
$u_{i}=u_{i+\left(  a+b\right)  }$ (by Definition \ref{def.seqs.period}
\textbf{(a)}). Hence, $a+b$ is a period of $u$ (since every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+\left(  a+b\right)  }$). This proves Theorem
\ref{thm.seqs.period.main} \textbf{(a)}.

\textbf{(b)} Let $a$ and $b$ be two periods of $u$ such that $a>b$. We must
prove that $a-b$ is a period of $u$.

Every $i\in\mathbb{N}$ satisfies
\begin{equation}
u_{i}=u_{i+a} \label{pf.thm.seqs.period.main.b.xia}%
\end{equation}
and%
\begin{equation}
u_{i}=u_{i+b}. \label{pf.thm.seqs.period.main.b.xib}%
\end{equation}
(Indeed, these two equalities are precisely the two equalities
(\ref{pf.thm.seqs.period.main.a.xia}) and (\ref{pf.thm.seqs.period.main.a.xib}%
) that were already proved in the proof of Theorem \ref{thm.seqs.period.main}
\textbf{(a)} above.)

Now, let $i\in\mathbb{N}$. Then, $i+\underbrace{a}_{>b}-b>i+b-b=i\geq0$ (since
$i\in\mathbb{N}$), so that $i+a-b\in\mathbb{N}$. Hence, applying
(\ref{pf.thm.seqs.period.main.b.xib}) to $i+a-b$ instead of $i$, we obtain
$u_{i+a-b}=u_{\left(  i+a-b\right)  +b}=u_{i+a}$. Comparing this with
(\ref{pf.thm.seqs.period.main.b.xia}), we obtain $u_{i}=u_{i+a-b}=u_{i+\left(
a-b\right)  }$.

Forget that we fixed $i$. We thus have shown that every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+\left(  a-b\right)  }$.

Now, notice that $a-b>0$ (since $a>b$). Hence, $a-b$ is a positive integer.
Thus, $a-b$ is a period of $u$ if and only if every $i\in\mathbb{N}$ satisfies
$u_{i}=u_{i+\left(  a-b\right)  }$ (by Definition \ref{def.seqs.period}
\textbf{(a)}). Hence, $a-b$ is a period of $u$ (since every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+\left(  a-b\right)  }$). This proves Theorem
\ref{thm.seqs.period.main} \textbf{(b)}.

\textbf{(c)} This is a straightforward induction on $n$, using Theorem
\ref{thm.seqs.period.main} \textbf{(a)} in the induction step.\footnote{Here
are the details:
\par
Let $a$ be a period of $u$. We must show that%
\begin{equation}
na\text{ is a period of }u \label{pf.thm.seqs.period.main.c.fn1.1}%
\end{equation}
for every positive integer $n$.
\par
We shall prove (\ref{pf.thm.seqs.period.main.c.fn1.1}) by induction on $n$:
\par
\textit{Induction base:} We know that $a$ is a period of $u$. In other words,
$1a$ is a period of $u$ (since $1a=a$). In other words,
(\ref{pf.thm.seqs.period.main.c.fn1.1}) holds for $n=1$.
\par
\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{pf.thm.seqs.period.main.c.fn1.1}) holds for
$n=m$. We must prove that (\ref{pf.thm.seqs.period.main.c.fn1.1}) holds for
$n=m+1$.
\par
We have assumed that (\ref{pf.thm.seqs.period.main.c.fn1.1}) holds for $n=m$.
In other words, $ma$ is a period of $u$. Hence, Theorem
\ref{thm.seqs.period.main} \textbf{(a)} (applied to $b=ma$) yields that $a+ma$
is a period of $u$. In other words, $\left(  m+1\right)  a$ is a period of $u$
(since $a+ma=\left(  m+1\right)  a$). In other words,
(\ref{pf.thm.seqs.period.main.c.fn1.1}) holds for $n=m+1$. This completes the
induction step. Thus, (\ref{pf.thm.seqs.period.main.c.fn1.1}) is proved. In
other words, Theorem \ref{thm.seqs.period.main} \textbf{(c)} is proved.}

\textbf{(d)} Let $a$ and $b$ be two periods of $u$. Then, $a$ and $b$ are two
positive integers (since a period must be a positive integer by definition).
Hence, Exercise \ref{exe.ent.gcd.diff-pos} shows that there exist
\textbf{positive} integers $x$ and $y$ such that $\gcd\left(  a,b\right)
=xa-yb$. Consider these $x$ and $y$. Theorem \ref{thm.seqs.period.main}
\textbf{(c)} (applied to $n=x$) yields that $xa$ is a period of $u$. Also,
Theorem \ref{thm.seqs.period.main} \textbf{(c)} (applied to $y$ and $b$
instead of $n$ and $a$) yields that $yb$ is a period of $u$.

Note that $\gcd\left(  a,b\right)  $ is itself a positive integer (by
Proposition \ref{prop.ent.gcd.pos} \textbf{(b)}). Hence, $\gcd\left(
a,b\right)  >0$, so that $xa-yb=\gcd\left(  a,b\right)  >0$ and thus $xa>yb$.
Therefore, Theorem \ref{thm.seqs.period.main} \textbf{(b)} (applied to $xa$
and $yb$ instead of $a$ and $b$) shows that $xa-yb$ is a period of $u$. In
other words, $\gcd\left(  a,b\right)  $ is a period of $u$ (since $\gcd\left(
a,b\right)  =xa-yb$). This proves Theorem \ref{thm.seqs.period.main}
\textbf{(d)}.

\textbf{(e)} Let $a$ be a period of $u$, and let $p$ and $q$ are two
nonnegative integers satisfying $p\equiv q\operatorname{mod}a$. We must prove
that $u_{p}=u_{q}$.

From $p\equiv q\operatorname{mod}a$, we obtain $q\equiv p\operatorname{mod}a$
(by Proposition \ref{prop.ent.mod.basics} \textbf{(c)}). Hence, $p$ and $q$
play symmetric roles in our situation (and, of course, also in the claim
$u_{p}=u_{q}$ that we need to prove). Thus, we can WLOG assume that $p\geq q$
(since otherwise, we can simply swap $p$ with $q$). Assume this.

We must prove that $u_{p}=u_{q}$. If $p=q$, then this is obvious. Hence, for
the rest of this proof, we WLOG assume that $p\neq q$. Hence, $p>q$ (since
$p\neq q$ and $p\geq q$).

We have $p\equiv q\operatorname{mod}a$. In other words, $a\mid p-q$. In other
words, there exists an integer $c$ such that $p-q=ac$. Consider this $c$. We
have $ac=p-q>0$. Since $a$ is positive (because $a$ is a period of $u$), we
can divide this inequality by $a$, and thus obtain $c>0$. Hence, $c$ is a
positive integer. Thus, Theorem \ref{thm.seqs.period.main} \textbf{(c)}
(applied to $n=c$) shows that $ca$ is a period of $u$.

However, $ca$ is a period of $u$ if and only if every $i\in\mathbb{N}$
satisfies $u_{i}=u_{i+ca}$ (by Definition \ref{def.seqs.period} \textbf{(a)}).
Thus, every $i\in\mathbb{N}$ satisfies $u_{i}=u_{i+ca}$ (since $ca$ is a
period of $u$). Applying this to $i=q$, we find $u_{q}=u_{q+ca}=u_{p}$ (since
$q+ca=p$ (because $ca=ac=p-q$)). In other words, $u_{p}=u_{q}$. Hence, Theorem
\ref{thm.seqs.period.main} \textbf{(e)} is proved.
\end{proof}

As a consequence of Theorem \ref{thm.seqs.period.main}, the periods of any
given periodic sequence have a rather simple structure:

\begin{corollary}
\label{cor.seqs.per.min}Let $u$ be a periodic infinite sequence. Let $m$ be
the \textbf{smallest} period of $u$ (that is, the smallest element of the set
$\left\{  \text{periods of }u\right\}  $). Then,%
\[
\left\{  \text{periods of }u\right\}  =\left\{  \text{positive multiples of
}m\right\}  .
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.seqs.per.min}.]Write the sequence $u$ as
$u=\left(  u_{0},u_{1},u_{2},\ldots\right)  $.

The number $m$ is a period of $u$, and thus is a positive integer. Hence,
$m>0$, so that $m\neq0$ and $\left\vert m\right\vert =m$.

We shall prove the following two claims separately:

\begin{statement}
\textit{Claim 1:} We have $\left\{  \text{periods of }u\right\}
\subseteq\left\{  \text{positive multiples of }m\right\}  $.
\end{statement}

\begin{statement}
\textit{Claim 2:} We have $\left\{  \text{positive multiples of }m\right\}
\subseteq\left\{  \text{periods of }u\right\}  $.
\end{statement}

[\textit{Proof of Claim 1:} Let $a\in\left\{  \text{periods of }u\right\}  $.
We will show that $a\in\left\{  \text{positive multiples of }m\right\}  $.

We have $a\in\left\{  \text{periods of }u\right\}  $. In other words, $a$ is a
period of $u$. Also, $m$ is a period of $u$. Hence, Theorem
\ref{thm.seqs.period.main} \textbf{(d)} (applied to $b=m$) shows that
$\gcd\left(  a,m\right)  $ is a period of $u$. Furthermore, Proposition
\ref{prop.ent.gcd.props1} \textbf{(f)} (applied to $b=m$) yields $\gcd\left(
a,m\right)  \mid a$ and $\gcd\left(  a,m\right)  \mid m$. From the latter
divisibility, we easily obtain $\gcd\left(  a,m\right)  \leq m$%
\ \ \ \ \footnote{\textit{Proof.} We know that $\gcd\left(  a,m\right)  $ is
nonnegative (by Proposition \ref{prop.ent.gcd.pos} \textbf{(a)}), so that
$\left\vert \gcd\left(  a,m\right)  \right\vert =\gcd\left(  a,m\right)  $.
\par
But Proposition \ref{prop.ent.div.1} \textbf{(b)} (applied to $\gcd\left(
a,m\right)  $ and $m$ instead of $a$ and $b$) yields $\left\vert \gcd\left(
a,m\right)  \right\vert \leq\left\vert m\right\vert $ (since $\gcd\left(
a,m\right)  \mid m$ and $m\neq0$). In view of $\left\vert \gcd\left(
a,m\right)  \right\vert =\gcd\left(  a,m\right)  $ and $\left\vert
m\right\vert =m$, this rewrites as $\gcd\left(  a,m\right)  \leq m$.}.

But $m$ is the \textbf{smallest} period of $u$. Hence, every period $b$ of $u$
satisfies $b\geq m$. Applying this to $b=\gcd\left(  a,m\right)  $, we obtain
$\gcd\left(  a,m\right)  \geq m$ (since $\gcd\left(  a,m\right)  $ is a period
of $u$). Combining this with $\gcd\left(  a,m\right)  \leq m$, we find
$\gcd\left(  a,m\right)  =m$. Hence, $m=\gcd\left(  a,m\right)  \mid a$. In
other words, $a$ is a multiple of $m$. Since $a$ is positive (because $a$ is a
period of $u$), we thus conclude that $a$ is a positive multiple of $m$. In
other words, $a\in\left\{  \text{positive multiples of }m\right\}  $.

Forget that we fixed $a$. We thus have shown that $a\in\left\{  \text{positive
multiples of }m\right\}  $ for each $a\in\left\{  \text{periods of }u\right\}
$. In other words, $\left\{  \text{periods of }u\right\}  \subseteq\left\{
\text{positive multiples of }m\right\}  $. This proves Claim 1.]

[\textit{Proof of Claim 2:} Let $a\in\left\{  \text{positive multiples of
}m\right\}  $. We will show that $a\in\left\{  \text{periods of }u\right\}  $.

We have $a\in\left\{  \text{positive multiples of }m\right\}  $. In other
words, $a$ is a positive multiple of $m$. Hence, $a$ is a multiple of $m$; in
other words, there exists an integer $c$ such that $a=mc$. Consider this $c$.

We have $mc=a>0$ (since $a$ is positive). We can divide this inequality by $m$
(since $m>0$), and thus find $c>0$. Hence, $c$ is a positive integer. Thus,
Theorem \ref{thm.seqs.period.main} \textbf{(c)} (applied to $m$ and $c$
instead of $a$ and $n$) yields that $cm$ is a period of $u$. In other words,
$cm\in\left\{  \text{periods of }u\right\}  $. In view of $cm=mc=a$, this
rewrites as $a\in\left\{  \text{periods of }u\right\}  $.

Forget that we fixed $a$. We thus have shown that $a\in\left\{  \text{periods
of }u\right\}  $ for each $a\in\left\{  \text{positive multiples of
}m\right\}  $. In other words, $\left\{  \text{positive multiples of
}m\right\}  \subseteq\left\{  \text{periods of }u\right\}  $. This proves
Claim 2.]

Combining Claim 1 with Claim 2, we obtain $\left\{  \text{periods of
}u\right\}  =\left\{  \text{positive multiples of }m\right\}  $. This proves
Corollary \ref{cor.seqs.per.min}.
\end{proof}

Note that Theorem \ref{thm.seqs.period.main} and Corollary
\ref{cor.seqs.per.min} rely substantially on the assumption that the sequence
$\left(  u_{0},u_{1},u_{2},\ldots\right)  $ be infinite. A theory of periodic
finite sequences exists, but is less well-behaved. For example, the $6$-tuple
$\left(  0,1,0,0,1,0\right)  $ is $3$-periodic (in the obvious meaning of this
word) and $5$-periodic, but not $\gcd\left(  3,5\right)  $-periodic (since its
entries are not all equal); thus, the most natural analogue of Theorem
\ref{thm.seqs.period.main} \textbf{(d)} for finite sequences does not hold.
The same applies to Theorem \ref{thm.seqs.period.main} \textbf{(b)}; indeed,
the $5$-tuple $\left(  0,0,1,0,0\right)  $ is $4$-periodic and $3$-periodic
but not $\left(  4-3\right)  $-periodic.

\subsubsection{\label{subsect.per.func}Periodic functions on $\mathbb{R}$ and
on $\mathbb{R}_{+}$}

Infinite sequences can be viewed as functions from $\mathbb{N}$: Namely, an
infinite sequence $\left(  u_{0},u_{1},u_{2},\ldots\right)  $ of real numbers
can be identified with the function $\mathbb{N}\rightarrow\mathbb{R}$ that
sends each $i\in\mathbb{N}$ to $u_{i}$. (Likewise for sequences of other
objects.) Thus, we can view infinite sequences as analogues of functions from
$\mathbb{R}$ or from $\mathbb{R}_{+}=\left\{  \text{positive reals}\right\}  $
or from other sets. Under this analogy, the $i$-th entry $u_{i}$ of a sequence
$u=\left(  u_{0},u_{1},u_{2},\ldots\right)  $ corresponds to the value
$u\left(  i\right)  $ of a function $u$. The analogue of Definition
\ref{def.seqs.period} takes the following form:

\begin{definition}
\label{def.funcs.period}Let $\mathbb{A}$ be either the set $\mathbb{R}$ or the
set $\mathbb{R}_{+}:=\left\{  \text{positive reals}\right\}  $. Let $S$ be any
set. Let $u:\mathbb{A}\rightarrow S$ be a function.

\textbf{(a)} A positive real $d$ is said to be a \textit{period} of $u$ if
every $x\in\mathbb{A}$ satisfies $u\left(  x\right)  =u\left(  x+d\right)  $.

\textbf{(b)} The function $u$ is said to be \textit{periodic} if it has a
period (i.e., if a period of $u$ exists).

\textbf{(c)} Let $d$ be a positive real. The function $u$ is said to be
$d$\textit{-periodic} if $d$ is a period of $u$.
\end{definition}

\begin{example}
\label{exa.funcs.period.sin-cos}The most famous examples of periodic functions
are the trigonometric functions $\sin:\mathbb{R}\rightarrow\mathbb{R}$ and
$\cos:\mathbb{R}\rightarrow\mathbb{R}$. Both of these functions are $2\pi
$-periodic (i.e., have period $2\pi$), since every $x\in\mathbb{R}$ satisfies
$\sin x=\sin\left(  x+2\pi\right)  $ and $\cos x=\cos\left(  x+2\pi\right)  $.
\end{example}

\begin{example}
\label{exa.funcs.period.fracp}For each $x\in\mathbb{R}$, the real
$x-\left\lfloor x\right\rfloor $ is known as the \textit{fractional part} of
$x$; it satisfies $0\leq x-\left\lfloor x\right\rfloor <1$. (Some authors
denote it by $\left\{  x\right\}  $, though this notation clashes with the set
builder notation.) Now, the function%
\begin{align*}
\mathbb{R}  &  \rightarrow\mathbb{R},\\
x  &  \mapsto x-\left\lfloor x\right\rfloor
\end{align*}
is $1$-periodic. (Check this!)
\end{example}

\begin{example}
\label{exa.funcs.period.del0}The \textit{delta function }$\delta_{0}$ is the
function $\mathbb{R}\rightarrow\mathbb{R}$ that sends each $x\in\mathbb{R}$ to
$\left[  x=0\right]  $ (where we are using Definition \ref{def.iverson}).
Thus, it sends $0$ to $1$, but sends all nonzero reals to $0$. It is easy to
see that this function $\delta_{0}$ is not periodic.
\end{example}

The following is an analogue of Theorem \ref{thm.seqs.period.main} for
functions (to the extent such an analogue is possible):

\begin{theorem}
\label{thm.funcs.period.main}Let $\mathbb{A}$ be either the set $\mathbb{R}$
or the set $\mathbb{R}_{+}:=\left\{  \text{positive reals}\right\}  $. Let $S$
be any set. Let $u:\mathbb{A}\rightarrow S$ be a function.

\textbf{(a)} If $a$ and $b$ are two periods of $u$, then $a+b$ is a period of
$u$.

\textbf{(b)} If $a$ and $b$ are two periods of $u$ such that $a>b$, then $a-b$
is a period of $u$.

\textbf{(c)} If $a$ is a period of $u$, then $na$ is a period of $u$ for every
positive integer $n$.

\textbf{(d)} If $a$ and $b$ are two positive integers that are periods of $u$,
then $\gcd\left(  a,b\right)  $ is a period of $u$.

\textbf{(e)} If $a$ is a period of $u$, and if $p$ and $q$ are two elements of
$\mathbb{A}$ such that $p-q$ is an integer multiple of $a$, then $u\left(
p\right)  =u\left(  q\right)  $.
\end{theorem}

Here, an \textquotedblleft integer multiple of $a$\textquotedblright\ means a
number of the form $ac$ for some $c\in\mathbb{Z}$.

\begin{proof}
[Proof of Theorem \ref{thm.funcs.period.main}.]Each part of Theorem
\ref{thm.funcs.period.main} is an analogue of the corresponding part of
Theorem \ref{thm.seqs.period.main} (because the statement \textquotedblleft%
$p-q$ is an integer multiple of $a$\textquotedblright\ is an analogue of
\textquotedblleft$p\equiv q\operatorname{mod}a$\textquotedblright). Its proof
is analogous to the proof of Theorem \ref{thm.seqs.period.main} as well (check this!).
\end{proof}

A useful property of $a$-periodic functions is that they are uniquely
determined by their values on any given half-open interval of length $a$. More precisely:

\begin{proposition}
\label{prop.funcs.period.u=v}Let $\mathbb{A}$ be either the set $\mathbb{R}$
or the set $\mathbb{R}_{+}:=\left\{  \text{positive reals}\right\}  $. Let $S$
be any set. Let $a$ be a positive real. Let $u:\mathbb{A}\rightarrow S$ and
$v:\mathbb{A}\rightarrow S$ be two $a$-periodic functions. Let $b\in
\mathbb{A}$. Assume that%
\begin{equation}
u\left(  x\right)  =v\left(  x\right)  \ \ \ \ \ \ \ \ \ \ \text{for each
}x\in\left[  b,b+a\right)  . \label{pf.prop.funcs.period.u=v.cond}%
\end{equation}
Then, $u=v$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.funcs.period.u=v}.]Let $y\in\mathbb{A}$. We
shall show that $u\left(  y\right)  =v\left(  y\right)  $.

We shall find an $x\in\left[  b,b+a\right)  $ such that $y-x$ is an integer
multiple of $a$. Namely, we set%
\[
x:=y-a\left\lfloor \dfrac{y-b}{a}\right\rfloor .
\]
Then, it is straightforward to see that $x\in\left[  b,b+a\right)
$\ \ \ \ \footnote{\textit{Proof.} The chain of inequalities
(\ref{sol.floor.hermite.lem1}) (applied to $\dfrac{y-b}{a}$ instead of $x$)
yields $\left\lfloor \dfrac{y-b}{a}\right\rfloor \leq\dfrac{y-b}%
{a}<\left\lfloor \dfrac{y-b}{a}\right\rfloor +1$. We can multiply this chain
of inequalities by $a$ (since $a$ is positive), and thus obtain $a\left\lfloor
\dfrac{y-b}{a}\right\rfloor \leq y-b<a\left(  \left\lfloor \dfrac{y-b}%
{a}\right\rfloor +1\right)  $. Now, combining%
\[
x=y-\underbrace{a\left\lfloor \dfrac{y-b}{a}\right\rfloor }_{\leq y-b}\geq
y-\left(  y-b\right)  =b
\]
with%
\begin{align*}
x  &  =\underbrace{y}_{=y-b+b}-a\left\lfloor \dfrac{y-b}{a}\right\rfloor
=\underbrace{y-b}_{<a\left(  \left\lfloor \dfrac{y-b}{a}\right\rfloor
+1\right)  }+b-a\left\lfloor \dfrac{y-b}{a}\right\rfloor \\
&  <a\left(  \left\lfloor \dfrac{y-b}{a}\right\rfloor +1\right)
+b-a\left\lfloor \dfrac{y-b}{a}\right\rfloor =b+a,
\end{align*}
we obtain $b\leq x<b+a$. In other words, $x\in\left[  b,b+a\right)  $.}. Thus,
(\ref{pf.prop.funcs.period.u=v.cond}) shows that $u\left(  x\right)  =v\left(
x\right)  $.

Furthermore, from $x=y-a\left\lfloor \dfrac{y-b}{a}\right\rfloor $, we obtain
$y-x=a\left\lfloor \dfrac{y-b}{a}\right\rfloor $. Thus, $y-x$ is an integer
multiple of $a$ (since $\left\lfloor \dfrac{y-b}{a}\right\rfloor $ is an
integer). But the function $u$ is $a$-periodic; in other words, $a$ is a
period of $u$. Hence, Theorem \ref{thm.funcs.period.main} \textbf{(e)}
(applied to $p=y$ and $q=x$) yields that $u\left(  y\right)  =u\left(
x\right)  $ (since $y-x$ is an integer multiple of $a$). In other words,
$u\left(  x\right)  =u\left(  y\right)  $. The same argument (applied to $v$
instead of $u$) yields $v\left(  x\right)  =v\left(  y\right)  $. Now,
$u\left(  y\right)  =u\left(  x\right)  =v\left(  x\right)  =v\left(
y\right)  $.

Forget that we fixed $y$. We thus have shown that $u\left(  y\right)
=v\left(  y\right)  $ for each $y\in\mathbb{A}$. In other words, $u=v$. This
proves Proposition \ref{prop.funcs.period.u=v}.
\end{proof}

An analogue of Proposition \ref{prop.funcs.period.u=v} exists for periodic sequences.

\begin{proposition}
\label{prop.seqs.period.u=v}Let $a$ be a positive integer. Let $u=\left(
u_{0},u_{1},u_{2},\ldots\right)  $ and $v=\left(  v_{0},v_{1},v_{2}%
,\ldots\right)  $ be two $a$-periodic infinite sequences. Let $b\in\mathbb{N}%
$. Assume that%
\[
u_{i}=v_{i}\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left\{  b,b+1,\ldots
,b+a-1\right\}  .
\]
Then, $u=v$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.seqs.period.u=v}.]Analogous to the proof of
Proposition \ref{prop.funcs.period.u=v}.
\end{proof}

We can use Proposition \ref{prop.funcs.period.u=v} to give a simple new
solution to Exercise \ref{exe.floor.hermite}:

\begin{proof}
[Second solution to Exercise \ref{exe.floor.hermite} (sketched).]Forget that
we fixed $x$. Set $a=\dfrac{1}{n}$ and $b=0$. Note that $a$ is a positive
real. Define a function $u:\mathbb{R}\rightarrow\mathbb{R}$ by setting%
\[
u\left(  x\right)  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor
-\left\lfloor nx\right\rfloor \ \ \ \ \ \ \ \ \ \ \text{for each }%
x\in\mathbb{R}.
\]
We define another function $v:\mathbb{R}\rightarrow\mathbb{R}$ by setting%
\[
v\left(  x\right)  =0\ \ \ \ \ \ \ \ \ \ \text{for each }x\in\mathbb{R}.
\]
We shall now show the following three claims:

\begin{statement}
\textit{Claim 1:} The function $u$ is $a$-periodic.
\end{statement}

\begin{statement}
\textit{Claim 2:} The function $v$ is $a$-periodic.
\end{statement}

\begin{statement}
\textit{Claim 3:} We have $u\left(  x\right)  =v\left(  x\right)  $ for each
$x\in\left[  b,b+a\right)  $.
\end{statement}

Once these three claims are proved, we will be able to apply Proposition
\ref{prop.funcs.period.u=v} and conclude that $u=v$; this will easily yield
the claim of Exercise \ref{exe.floor.hermite}. Let us thus prove the three claims:

[\textit{Proof of Claim 1:} We shall show that every $x\in\mathbb{R}$
satisfies $u\left(  x\right)  =u\left(  x+a\right)  $.

Indeed, let $x\in\mathbb{R}$. We observe that%
\begin{equation}
\left\lfloor y+k\right\rfloor =\left\lfloor y\right\rfloor
+k\ \ \ \ \ \ \ \ \ \ \text{for each }y\in\mathbb{R}\text{ and }k\in
\mathbb{Z}. \label{sol.floor.hermite.2nd.C1.pf.1}%
\end{equation}
(This is a well-known property of floors; it is easy to prove.\footnote{It
also appears (with $y$ renamed as $x$) as Proposition
\ref{prop.sol.floor.floorplusint} in our first solution to Exercise
\ref{exe.floor.hermite}.}) Now, recall that $a=\dfrac{1}{n}$. Hence, $n\left(
x+a\right)  =n\left(  x+\dfrac{1}{n}\right)  =nx+1$. Thus,%
\begin{equation}
\left\lfloor n\left(  x+a\right)  \right\rfloor =\left\lfloor
nx+1\right\rfloor =\left\lfloor nx\right\rfloor +1
\label{sol.floor.hermite.2nd.C1.pf.3}%
\end{equation}
(by (\ref{sol.floor.hermite.2nd.C1.pf.1}), applied to $y=nx$ and $k=1$).
Furthermore, each $k\in\left\{  0,1,\ldots,n-1\right\}  $ satisfies%
\begin{equation}
x+\underbrace{a}_{=\dfrac{1}{n}}+\dfrac{k}{n}=x+\dfrac{1}{n}+\dfrac{k}%
{n}=x+\dfrac{k+1}{n}. \label{sol.floor.hermite.2nd.C1.pf.2}%
\end{equation}
Hence,
\begin{align}
\sum_{k=0}^{n-1}\underbrace{\left\lfloor x+a+\dfrac{k}{n}\right\rfloor
}_{\substack{=\left\lfloor x+\dfrac{k+1}{n}\right\rfloor \\\text{(by
(\ref{sol.floor.hermite.2nd.C1.pf.2}))}}}  &  =\sum_{k=0}^{n-1}\left\lfloor
x+\dfrac{k+1}{n}\right\rfloor =\sum_{k=1}^{n}\left\lfloor x+\dfrac{k}%
{n}\right\rfloor \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k\text{ for
}k+1\text{ in the sum}\right) \nonumber\\
&  =\underbrace{\sum_{k=0}^{n}\left\lfloor x+\dfrac{k}{n}\right\rfloor
}_{=\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\left\lfloor
x+\dfrac{n}{n}\right\rfloor }-\left\lfloor \underbrace{x+\dfrac{0}{n}}%
_{=x}\right\rfloor \nonumber\\
&  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\left\lfloor
x+\underbrace{\dfrac{n}{n}}_{=1}\right\rfloor -\left\lfloor x\right\rfloor
\nonumber\\
&  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor
+\underbrace{\left\lfloor x+1\right\rfloor }_{\substack{=\left\lfloor
x\right\rfloor +1\\\text{(by (\ref{sol.floor.hermite.2nd.C1.pf.1}), applied to
}y=x\text{ and }k=1\text{)}}}-\left\lfloor x\right\rfloor \nonumber\\
&  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\left\lfloor
x\right\rfloor +1-\left\lfloor x\right\rfloor \nonumber\\
&  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +1.
\label{sol.floor.hermite.2nd.C1.pf.4}%
\end{align}


Now, the definition of $u$ yields%
\begin{align*}
u\left(  x+a\right)   &  =\underbrace{\sum_{k=0}^{n-1}\left\lfloor
x+a+\dfrac{k}{n}\right\rfloor }_{\substack{=\sum_{k=0}^{n-1}\left\lfloor
x+\dfrac{k}{n}\right\rfloor +1\\\text{(by (\ref{sol.floor.hermite.2nd.C1.pf.4}%
))}}}-\underbrace{\left\lfloor n\left(  x+a\right)  \right\rfloor
}_{\substack{=\left\lfloor nx\right\rfloor +1\\\text{(by
(\ref{sol.floor.hermite.2nd.C1.pf.3}))}}}\\
&  =\left(  \sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor
+1\right)  -\left(  \left\lfloor nx\right\rfloor +1\right)  =\sum_{k=0}%
^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor -\left\lfloor nx\right\rfloor
=u\left(  x\right)
\end{align*}
(by the definition of $u$). In other words, $u\left(  x\right)  =u\left(
x+a\right)  $.

Now, forget that we fixed $x$. We thus have shown that every $x\in\mathbb{R}$
satisfies $u\left(  x\right)  =u\left(  x+a\right)  $.

However, $a$ is a period of $u$ if and only if every $x\in\mathbb{R}$
satisfies $u\left(  x\right)  =u\left(  x+a\right)  $ (by Definition
\ref{def.funcs.period} \textbf{(a)}). Thus, $a$ is a period of $u$ (since
every $x\in\mathbb{R}$ satisfies $u\left(  x\right)  =u\left(  x+a\right)  $).
In other words, the function $u$ is $a$-periodic (by Definition
\ref{def.funcs.period} \textbf{(c)}). This proves Claim 1.]

[\textit{Proof of Claim 2:} Each $x\in\mathbb{R}$ satisfies $v\left(
x\right)  =0$ (by the definition of $v$) and $v\left(  x+a\right)  =0$ (for
the same reason) and thus $v\left(  x\right)  =0=v\left(  x+a\right)  $.

However, $a$ is a period of $v$ if and only if every $x\in\mathbb{R}$
satisfies $v\left(  x\right)  =v\left(  x+a\right)  $ (by Definition
\ref{def.funcs.period} \textbf{(a)}). Thus, $a$ is a period of $v$ (since
every $x\in\mathbb{R}$ satisfies $v\left(  x\right)  =v\left(  x+a\right)  $).
In other words, the function $v$ is $a$-periodic (by Definition
\ref{def.funcs.period} \textbf{(c)}). This proves Claim 2.]

[\textit{Proof of Claim 3:} Let $x\in\left[  b,b+a\right)  $. We must show
that $u\left(  x\right)  =v\left(  x\right)  $.

We observe the following: If $y$ is a real such that $0\leq y<1$, then%
\begin{equation}
\left\lfloor y\right\rfloor =0. \label{sol.floor.hermite.2nd.C3.pf.y}%
\end{equation}
(This follows almost immediately from the definition of $\left\lfloor
y\right\rfloor $; indeed, $0\leq y<1$ entails that the largest integer that is
$\leq y$ is $0$.)

We have $x\in\left[  b,b+a\right)  =\left[  0,0+a\right)  $ (since $b=0$). In
other words, $0\leq x<0+a$. Hence, $x<0+a=a=\dfrac{1}{n}$, so that $nx<1$.
Also, $0\leq nx$ (since $0\leq x$). Thus, $0\leq nx<1$. Hence,
(\ref{sol.floor.hermite.2nd.C3.pf.y}) (applied to $y=nx$) yields
\begin{equation}
\left\lfloor nx\right\rfloor =0. \label{sol.floor.hermite.2nd.C3.pf.nx}%
\end{equation}


Next, let $k\in\left\{  0,1,\ldots,n-1\right\}  $. Then, $0\leq k\leq n-1$. We
have $\underbrace{x}_{<\dfrac{1}{n}}+\underbrace{\dfrac{k}{n}}_{\substack{\leq
\dfrac{n-1}{n}\\\text{(since }k\leq n-1\text{)}}}<\dfrac{1}{n}+\dfrac{n-1}%
{n}=1$ and $\underbrace{x}_{\geq0}+\underbrace{\dfrac{k}{n}}_{\substack{\geq
0\\\text{(since }k\geq0\text{)}}}\geq0$. Thus, $0\leq x+\dfrac{k}{n}<1$.
Hence, (\ref{sol.floor.hermite.2nd.C3.pf.y}) (applied to $y=x+\dfrac{k}{n}$)
yields%
\begin{equation}
\left\lfloor x+\dfrac{k}{n}\right\rfloor =0.
\label{sol.floor.hermite.2nd.C3.pf.xkn}%
\end{equation}


Forget that we fixed $k$. We thus have proved
(\ref{sol.floor.hermite.2nd.C3.pf.xkn}) for each $k\in\left\{  0,1,\ldots
,n-1\right\}  $.

Now, the definition of $u$ yields%
\[
u\left(  x\right)  =\sum_{k=0}^{n-1}\underbrace{\left\lfloor x+\dfrac{k}%
{n}\right\rfloor }_{\substack{=0\\\text{(by
(\ref{sol.floor.hermite.2nd.C3.pf.xkn}))}}}-\underbrace{\left\lfloor
nx\right\rfloor }_{\substack{=0\\\text{(by
(\ref{sol.floor.hermite.2nd.C3.pf.nx}))}}}=\underbrace{\sum_{k=0}^{n-1}0}%
_{=0}-0=0.
\]
Comparing this with%
\[
v\left(  x\right)  =0\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
}v\right)  ,
\]
we find $u\left(  x\right)  =v\left(  x\right)  $. This proves Claim 3.]

Now, we can apply Proposition \ref{prop.funcs.period.u=v} to $\mathbb{A}%
=\mathbb{R}$ and $S=\mathbb{R}$ (because of Claim 1, Claim 2 and Claim 3).
Hence, we obtain $u=v$. Now, for each $x\in\mathbb{R}$, we have%
\begin{align*}
\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor -\left\lfloor
nx\right\rfloor  &  =\underbrace{u}_{=v}\left(  x\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }u\right) \\
&  =v\left(  x\right)  =0\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition
of }v\right)  ,
\end{align*}
so that $\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor
=\left\lfloor nx\right\rfloor $. This solves Exercise \ref{exe.floor.hermite} again.
\end{proof}

\subsection{\label{sect.hw3}Homework set \#3: Sequences and more sums}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the above parts of Chapter \ref{chp.seqsum}. Some of
the problems may be unrelated. Note that the problems are ordered by
(approximate) topic, not by difficulty!

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.seqs.1pxn-1x-2}Let $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ be a
sequence of integers defined recursively by%
\begin{align*}
a_{0}  &  =0,\ \ \ \ \ \ \ \ \ \ a_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =1+a_{n-1}a_{n-2}\ \ \ \ \ \ \ \ \ \ \text{for each integer }n\geq2.
\end{align*}
Prove the following:

\textbf{(a)} For any $k\in\mathbb{N}$ and $n\in\mathbb{N}$, we have
$a_{k+n}\equiv a_{k}\operatorname{mod}a_{n}$.

\textbf{(b)} If $u,v\in\mathbb{N}$ satisfy $u\mid v$, then $a_{u}\mid a_{v}$.

\textbf{(c)} For any $n,m\in\mathbb{N}$, we have $\gcd\left(  a_{n}%
,a_{m}\right)  =a_{\gcd\left(  n,m\right)  }$.
\end{exercise}

\begin{exercise}
\label{exe.ent.sum-div-nums}For any positive integer $n$, we let $d\left(
n\right)  $ denote the number of all positive divisors of $n$. (For example,
$d\left(  6\right)  =4$.)

Let $n$ be a positive integer. Prove that%
\[
d\left(  1\right)  +d\left(  2\right)  +\cdots+d\left(  n\right)
=\left\lfloor \dfrac{n}{1}\right\rfloor +\left\lfloor \dfrac{n}{2}%
\right\rfloor +\cdots+\left\lfloor \dfrac{n}{n}\right\rfloor .
\]

\end{exercise}

\begin{exercise}
\label{exe.binom.sum-k-nck}Let $n\in\mathbb{N}$.

\textbf{(a)} Simplify $\sum_{k=0}^{n}k\dbinom{n}{k}$. (\textquotedblleft
Simplify\textquotedblright\ means \textquotedblleft get rid of the $\sum$
sign\textquotedblright.)

\textbf{(b)} Simplify $\sum_{k=0}^{n}\dbinom{2n}{k}$.
\end{exercise}

\begin{exercise}
\label{exe.sums.polariz1}Let $n\in\mathbb{N}$. Let $x_{1},x_{2},\ldots,x_{n}$
be any numbers, and let $y$ be a further number. Let $\left[  n\right]  $
denote the set $\left\{  1,2,\ldots,n\right\}  $.

\textbf{(a)} Prove that every $m\in\left\{  0,1,\ldots,n-1\right\}  $
satisfies%
\[
\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{m}=0.
\]


\textbf{(b)} Prove that%
\[
\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{n}=n!x_{1}x_{2}\cdots
x_{n}.
\]


[\textbf{Remark:} For $n=2$, the statement of Exercise \ref{exe.sums.polariz1}
\textbf{(b)} says that%
\[
\left(  y+x_{1}+x_{2}\right)  ^{2}-\left(  y+x_{1}\right)  ^{2}-\left(
y+x_{2}\right)  ^{2}+y^{2}=2!x_{1}x_{2}.
\]
Note that (\ref{sol.ind.funny-ints.square-4}) is the particular case of this
equality for $y=m+1$, $x_{1}=1$ and $x_{2}=2$.]
\end{exercise}

\begin{exercise}
\label{exe.sums.AMM12022a}Let $n\in\mathbb{N}$ and $x\in\mathbb{R}%
\setminus\left\{  1,-1\right\}  $. For each $i\in\mathbb{N}$, set
$y_{i}=1-x^{i}$. Prove that%
\[
\sum_{k=0}^{n-1}\dfrac{y_{n}y_{n-1}\cdots y_{n-k}}{y_{k+1}}=n.
\]

\end{exercise}

\begin{exercise}
\label{exe.seqs.0-1-2-6}Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of integers recursively by%
\begin{align*}
a_{0}  &  =0,\ \ \ \ \ \ \ \ \ \ a_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =n\left(  a_{n-1}+\left(  n-1\right)  a_{n-2}\right)
\ \ \ \ \ \ \ \ \ \ \text{for each integer }n\geq2.
\end{align*}
Compute $a_{n}$ explicitly (in terms of sequences we already know).
\end{exercise}

\begin{exercise}
\label{exe.ent.gcd.qedmo5a1-uv}Let $a$, $b$, $u$ and $v$ be four reals.

We define two sequences $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ and
$\left(  b_{0},b_{1},b_{2},\ldots\right)  $ of reals recursively by setting%
\[
a_{0}=a\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ b_{0}=b
\]
and%
\[
a_{n}=ua_{n-1}+vb_{n-1}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ b_{n}%
=ub_{n-1}+va_{n-1}%
\]
for each $n\geq1$.

Find explicit formulas for $a_{n}$ and $b_{n}$.
\end{exercise}

Recall that a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of reals is
said to be \textit{weakly increasing} if it satisfies $a_{0}\leq a_{1}\leq
a_{2}\leq\cdots$ (that is, $a_{i}\leq a_{i+1}$ for each $i\in\mathbb{N}$).
(Some authors call such sequences \textit{nondecreasing}, but I find this
terminology slightly counterintuitive; in particular, \textquotedblleft
nondecreasing\textquotedblright\ is not the same as \textquotedblleft not
decreasing\textquotedblright.)

\begin{exercise}
\label{exe.seqs.1223334444}Let $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ be
the unique weakly increasing sequence of positive integers that contains each
positive integer $i$ exactly $i$ times. Thus,%
\[
\left(  a_{0},a_{1},a_{2},\ldots\right)  =\left(
1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,\ldots\right)  .
\]
Prove that%
\[
a_{n}=\left\lfloor \dfrac{1}{2}\sqrt{8n+1}+\dfrac{1}{2}\right\rfloor
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]

\end{exercise}

\begin{exercise}
\label{exe.seqs.periods-ab}Let $a$ and $b$ be two positive reals. Let
$f:\mathbb{R}\rightarrow\mathbb{R}$ be an $a$-periodic function. Let
$g:\mathbb{R}\rightarrow\mathbb{R}$ be a $b$-periodic function. Consider the
function $f+g:\mathbb{R}\rightarrow\mathbb{R}$ (which sends each
$x\in\mathbb{R}$ to $\left(  f+g\right)  \left(  x\right)  $).

\textbf{(a)} If $a/b\in\mathbb{Q}$, then prove that $f+g$ is again a periodic function.

\textbf{(b)} Show that $f+g$ need not be periodic if $a/b\notin\mathbb{Q}$.
(Feel free to interpret this either as \textquotedblleft Find an example where
$f+g$ is not periodic for \textbf{some} pair of $a$ and $b$ satisfying
$a/b\notin\mathbb{Q}$\textquotedblright\ or as \textquotedblleft Find an
example where $f+g$ is not periodic for \textbf{every} pair of $a$ and $b$
satisfying $a/b\notin\mathbb{Q}$\textquotedblright.)
\end{exercise}

The following is a \textbf{bonus problem}: You can get points on it even if
you solved 5 others. Be warned that it is \textbf{rather hard}.

\begin{exercise}
\label{exe.binom.gcd-sod}Let $n\in\mathbb{Z}$ and $k\in\mathbb{Z}$. Prove that%
\[
\gcd\left(  \dbinom{n-1}{k-1},\dbinom{n}{k+1},\dbinom{n+1}{k}\right)
=\gcd\left(  \dbinom{n-1}{k},\dbinom{n}{k-1},\dbinom{n+1}{k+1}\right)  .
\]

\end{exercise}

\subsection{Linear recurrences}

A wider and more interesting class of integers are the \textit{linearly
recurrent sequences} (or, more precisely, \textit{sequences satisfying linear
recurrences with constant coefficients}). This class contains the arithmetic
progressions, the geometric progressions, the Fibonacci sequence and some
others. These sequences have an interesting yet manageable theory; in
particular, they can all be described by \textquotedblleft
explicit\textquotedblright\ formulas (similar to Binet's formula for Fibonacci
numbers -- i.e., Theorem \ref{thm.fib.binet}) as long as one is ready to
accept the appearance of irrational numbers in these formulas. We shall not
prove these formulas in full generality here, but we shall fully analyze the
most commonly used particular case -- that of the \textit{two-term
recurrences} (also known as \textit{recurrences of second degree}) -- and say
a few things about the general case. We note that the explicit formula is not
the be-all and end-all of linearly recurrent sequences; more can be said and
proved, often independently of the explicit formula. (For example, we didn't
use Binet's formula all that often in our study of Fibonacci numbers!)

Some resources on linearly recurrent sequences are \cite{Markus83},
\cite{BeDeQu11}, \cite{Melian01} and \cite{Ivanov08}.

\subsubsection{Two-term recurrences: definition and examples}

We begin by studying sequences $\left(  x_{0},x_{1},x_{2},\ldots\right)  $
that satisfy two-term recurrences -- i.e., recurrent equations of the form
$x_{n}=ax_{n-1}+bx_{n-2}$ for all $n\geq2$, where $a$ and $b$ are two fixed
numbers.\footnote{The name \textquotedblleft two-term
recurrences\textquotedblright\ refers to the two terms $ax_{n-1}$ and
$bx_{n-2}$ on the right hand side. Some people prefer to also count the
$x_{n}$ term on the left hand side, which makes these equations
\textquotedblleft three-term recurrences\textquotedblright\ instead.} We begin
by giving them a short name:\footnote{As before, \textquotedblleft
numbers\textquotedblright\ can mean integer, rational, real or complex
numbers.}

\begin{definition}
\label{def.abrec}Let $a$ and $b$ be two numbers. A sequence $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ of numbers will be called $\left(
a,b\right)  $\textit{-recurrent}\footnotemark\ if every $n\geq2$ satisfies%
\begin{equation}
x_{n}=ax_{n-1}+bx_{n-2}. \label{eq.def.abrec.eq}%
\end{equation}

\end{definition}

\footnotetext{The name \textquotedblleft$\left(  a,b\right)  $%
-recurrent\textquotedblright\ is not standard; I have picked it merely for the
sake of brevity. A more standard way to say \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright\ would be \textquotedblleft linearly
recurrent with characteristic polynomial $x^{2}-ax-b$\textquotedblright; this
is related to the polynomial point of view that we might discuss later on.}It
is clear that an $\left(  a,b\right)  $-recurrent sequence $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ is uniquely determined by the four numbers
$a$, $b$, $x_{0}$ and $x_{1}$, since the equality (\ref{eq.def.abrec.eq}) can
be used to compute all entries of the sequence using these four numbers. Thus,
if two $\left(  a,b\right)  $-recurrent sequences $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ (for a
given pair $\left(  a,b\right)  $) agree in their first two entries (that is,
satisfy $x_{0}=y_{0}$ and $x_{1}=y_{1}$), then they are identical (that is,
$x_{n}=y_{n}$ for each $n\in\mathbb{N}$).

Here are some examples\footnote{mostly taken from \cite[Chapter 4]{detnotes}}
of $\left(  a,b\right)  $-recurrent sequences for various pairs $\left(
a,b\right)  $:

\begin{example}
\label{exa.abrec.fib}The Fibonacci sequence $\left(  f_{0},f_{1},f_{2}%
,\ldots\right)  =\left(  0,1,1,2,3,5,\ldots\right)  $ from Definition
\ref{def.fibonacci} is $\left(  1,1\right)  $-recurrent, since every $n\geq2$
satisfies $f_{n}=f_{n-1}+f_{n-2}=1f_{n-1}+1f_{n-2}$.
\end{example}

\begin{example}
\label{exa.abrec.luc}The
\textit{\href{https://en.wikipedia.org/wiki/Lucas_number}{\textit{Lucas
sequence}}} $\left(  \ell_{0},\ell_{1},\ell_{2},\ldots\right)  $ is another
famous $\left(  1,1\right)  $-recurrent sequence of integers. It is defined
recursively by $\ell_{0}=2$, $\ell_{1}=1$, and $\ell_{n}=\ell_{n-1}+\ell
_{n-2}$ for all $n\geq2$. Its first terms are $2,1,3,4,7,11,18$.
\end{example}

\begin{example}
\label{exa.abrec.ari}A sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is
$\left(  2,-1\right)  $-recurrent if and only if every $n\geq2$ satisfies
$x_{n}=2x_{n-1}-x_{n-2}$. In other words, a sequence $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ is $\left(  2,-1\right)  $-recurrent if and only
if every $n\geq2$ satisfies $x_{n}-x_{n-1}=x_{n-1}-x_{n-2}$. In other words, a
sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(  2,-1\right)
$-recurrent if and only if $x_{1}-x_{0}=x_{2}-x_{1}=x_{3}-x_{2}=\cdots$. In
other words, the $\left(  2,-1\right)  $-recurrent sequences are precisely the
arithmetic progressions.
\end{example}

\begin{example}
\label{exa.abrec.geo}Geometric progressions are also $\left(  a,b\right)
$-recurrent for appropriate $a$ and $b$. Namely, any geometric progression
$\left(  u,uq,uq^{2},uq^{3},\ldots\right)  $ is $\left(  q,0\right)
$-recurrent, since every $n\geq2$ satisfies $uq^{n}=q\cdot uq^{n-1}+0\cdot
uq^{n-2}$. However, not every $\left(  q,0\right)  $-recurrent sequence
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is a geometric progression (since
the condition $x_{n}=qx_{n-1}+0x_{n-2}$ for all $n\geq2$ says nothing about
$x_{0}$, and thus $x_{0}$ can be arbitrary).
\end{example}

\begin{example}
\label{exa.abrec.01}A sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is
$\left(  0,1\right)  $-recurrent if and only if every $n\geq2$ satisfies
$x_{n}=x_{n-2}$. In other words, a sequence $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ is $\left(  0,1\right)  $-recurrent if and only if it has
the form $\left(  u,v,u,v,u,v,\ldots\right)  $ for two numbers $u$ and $v$.
\end{example}

\begin{example}
\label{exa.abrec.10}A sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is
$\left(  1,0\right)  $-recurrent if and only if every $n\geq2$ satisfies
$x_{n}=x_{n-1}$. In other words, a sequence $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ is $\left(  1,0\right)  $-recurrent if and only if it has
the form $\left(  u,v,v,v,v,\ldots\right)  $ for two numbers $u$ and $v$.
Notice that $u$ is not required to be equal to $v$, because we never claimed
that $x_{n}=x_{n-1}$ holds for $n=1$.
\end{example}

\begin{example}
\label{exa.abrec.1-1}A sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is
$\left(  1,-1\right)  $-recurrent if and only if every $n\geq2$ satisfies
$x_{n}=x_{n-1}-x_{n-2}$. In Example \ref{exa.seqs.period.6}, we have already
seen an example of such a sequence, and observed that it is $6$-periodic. But
this holds more generally: Any $\left(  1,-1\right)  $-recurrent sequence
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $6$-periodic (i.e., it
satisfies $x_{n+6}=x_{n}$ for every $n\in\mathbb{N}$). This is because every
$n\in\mathbb{N}$ satisfies%
\begin{align*}
x_{n+6}  &  =\underbrace{x_{n+5}}_{=x_{n+4}-x_{n+3}}-x_{n+4}=\left(
x_{n+4}-x_{n+3}\right)  -x_{n+4}=-\underbrace{x_{n+3}}_{=x_{n+2}-x_{n+1}}\\
&  =-\left(  \underbrace{x_{n+2}}_{=x_{n+1}-x_{n}}-x_{n+1}\right)  =-\left(
x_{n+1}-x_{n}-x_{n+1}\right)  =x_{n}.
\end{align*}
We can describe the $\left(  1,-1\right)  $-recurrent sequences explicitly: A
sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(  1,-1\right)
$-recurrent if and only if it has the form $\left(  u,v,v-u,-u,-v,u-v,\ldots
\right)  $ (where the \textquotedblleft$\ldots$\textquotedblright\ stands for
\textquotedblleft repeat the preceding $6$ values over and
over\textquotedblright\ here) for two numbers $u$ and $v$.
\end{example}

\begin{example}
\label{exa.abrec.laurent-t}The sequence $\left(  t_{0},t_{1},t_{2}%
,\ldots\right)  $ from Exercise \ref{exe.laurent.t} itself is not $\left(
a,b\right)  $-recurrent for any pair $\left(  a,b\right)  $; however, its two
subsequences $\left(  t_{0},t_{2},t_{4},t_{6},\ldots\right)  $ and $\left(
t_{1},t_{3},t_{5},t_{7},\ldots\right)  $ are $\left(  4,-1\right)
$-recurrent, since Exercise \ref{exe.laurent.t} \textbf{(a)} shows that
$t_{2n}=4t_{2\left(  n-1\right)  }-t_{2\left(  n-2\right)  }$ and
$t_{2n+1}=4t_{2\left(  n-1\right)  +1}-t_{2\left(  n-2\right)  +1}$ for every
$n\geq2$.
\end{example}

Another family of examples of $\left(  a,b\right)  $-recurrent sequences comes
from trigonometry:

\begin{proposition}
\label{prop.rec.sin-cos}Let $\alpha$ be any angle. Then, the sequences%
\begin{align}
&  \left(  \sin\left(  0\alpha\right)  ,\sin\left(  1\alpha\right)
,\sin\left(  2\alpha\right)  ,\ldots\right)  \ \ \ \ \ \ \ \ \ \ \text{and}%
\label{eq.prop.rec.sin-cos.1}\\
&  \left(  \cos\left(  0\alpha\right)  ,\cos\left(  1\alpha\right)
,\cos\left(  2\alpha\right)  ,\ldots\right)  \label{eq.prop.rec.sin-cos.2}%
\end{align}
are $\left(  2\cos\alpha,-1\right)  $-recurrent. More generally, if $\alpha$
and $\beta$ are two angles, then the sequence%
\begin{equation}
\left(  \sin\left(  \beta+0\alpha\right)  ,\sin\left(  \beta+1\alpha\right)
,\sin\left(  \beta+2\alpha\right)  ,\ldots\right)
\label{eq.prop.rec.sin-cos.gen}%
\end{equation}
is $\left(  2\cos\alpha,-1\right)  $-recurrent.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.rec.sin-cos} (sketched).]Let $\alpha$ and
$\beta$ be two angles. It suffices to show that the sequence $\left(
\sin\left(  \beta+0\alpha\right)  ,\sin\left(  \beta+1\alpha\right)
,\sin\left(  \beta+2\alpha\right)  ,\ldots\right)  $ is $\left(  2\cos
\alpha,-1\right)  $-recurrent (because the two sequences
(\ref{eq.prop.rec.sin-cos.1}) and (\ref{eq.prop.rec.sin-cos.2}) are particular
cases of this sequence for $\beta=0$ and $\beta=\dfrac{\pi}{2}$,
respectively). In other words, it suffices to show that%
\[
\sin\left(  \beta+n\alpha\right)  =2\cos\alpha\sin\left(  \beta+\left(
n-1\right)  \alpha\right)  +\left(  -1\right)  \sin\left(  \beta+\left(
n-2\right)  \alpha\right)
\]
for every $n\geq2$. So let us fix $n\geq2$.

One of the well-known trigonometric identities states that
\[
\sin x+\sin y=2\sin\dfrac{x+y}{2}\cos\dfrac{x-y}{2}%
\]
for any two angles $x$ and $y$. Applying this to $x=\beta+n\alpha$ and
$y=\beta+\left(  n-2\right)  \alpha$, we obtain%
\begin{align*}
&  \sin\left(  \beta+n\alpha\right)  +\sin\left(  \beta+\left(  n-2\right)
\alpha\right) \\
&  =2\sin\underbrace{\dfrac{\left(  \beta+n\alpha\right)  +\left(
\beta+\left(  n-2\right)  \alpha\right)  }{2}}_{=\beta+\left(  n-1\right)
\alpha}\cos\underbrace{\dfrac{\left(  \beta+n\alpha\right)  -\left(
\beta+\left(  n-2\right)  \alpha\right)  }{2}}_{=\alpha}\\
&  =2\sin\left(  \beta+\left(  n-1\right)  \alpha\right)  \cos\alpha
=2\cos\alpha\sin\left(  \beta+\left(  n-1\right)  \alpha\right)  .
\end{align*}
Hence,
\begin{align*}
\sin\left(  \beta+n\alpha\right)   &  =2\cos\alpha\sin\left(  \beta+\left(
n-1\right)  \alpha\right)  -\sin\left(  \beta+\left(  n-2\right)
\alpha\right) \\
&  =2\cos\alpha\sin\left(  \beta+\left(  n-1\right)  \alpha\right)  +\left(
-1\right)  \sin\left(  \beta+\left(  n-2\right)  \alpha\right)  .
\end{align*}
This proves Proposition \ref{prop.rec.sin-cos}.
\end{proof}

Note that all three sequences in Proposition \ref{prop.rec.sin-cos} are
periodic when $\alpha$ is a rational multiple of $2\pi$ (that is, when
$\alpha=2\pi r$ for some $r\in\mathbb{Q}$). This provides an ample source of
periodic recurrent sequences (of any possible period).

\subsubsection{Two-term recurrences: Binet-like formulas}

The following question now suggests itself:\footnote{When we say
\textquotedblleft an $\left(  a,b\right)  $-recurrent
sequence\textquotedblright, we of course mean an $\left(  a,b\right)
$-recurrent sequence of numbers.}

\begin{exercise}
\label{exe.rec.binet}Let $a$ and $b$ be two numbers. Let $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)  $-recurrent sequence.
Is there an explicit formula for $x_{n}$ in terms of $a$, $b$, $x_{0}$ and
$x_{1}$, similar to Binet's formula (Theorem \ref{thm.fib.binet}) for
Fibonacci numbers?
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.binet}.]Let us first solve Exercise
\ref{exe.rec.binet} in a \textquotedblleft barbaric\textquotedblright\ way --
by experimenting and guessing. We will later see a more cultured way (or two)
of solving it.

We begin by taking a look at Binet's formula, in order to get an idea of what
we should expect.

First, we observe that Binet's formula involves the two irrational numbers
$\varphi$ and $\psi$, even though the Fibonacci numbers are integers. Thus, we
should expect irrational numbers (specifically, square roots) to appear in our
formula, even if $a$, $b$, $x_{0}$ and $x_{1}$ are integers.

Binet's formula said $f_{n}=\dfrac{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}%
}\psi^{n}$. While it would be strange to expect the same specific numbers
$\dfrac{1}{\sqrt{5}}$, $\varphi$ and $\psi$ to appear in the general case, we
can hope that the overall form of the formula will be the same:%
\begin{equation}
x_{n}=\gamma\lambda^{n}+\delta\mu^{n} \label{eq.exe.rec.binet.ans}%
\end{equation}
for four constants $\gamma,\delta,\lambda,\mu$. (Binet's formula is an example
of this form, with $\gamma=\dfrac{1}{\sqrt{5}}$, $\delta=-\dfrac{1}{\sqrt{5}}%
$, $\lambda=\varphi$ and $\mu=\psi$).

So we \textbf{guess} that there is an explicit formula of the form
(\ref{eq.exe.rec.binet.ans}) for four constants $\gamma,\delta,\lambda,\mu$.
(\textquotedblleft Constants\textquotedblright\ means \textquotedblleft
numbers not depending on $n$\textquotedblright.) We can now try to find these
four constants. (Of course, nothing guarantees us that they actually exist --
indeed, they don't always do, as we will eventually see. But it can't hurt to try!)

Our sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent; i.e., it satisfies the equation
(\ref{eq.def.abrec.eq}) for each $n\geq2$. Let us rewrite this equation with
the help of (\ref{eq.exe.rec.binet.ans}). Indeed, fix an integer $n\geq2$.
Then, (\ref{eq.exe.rec.binet.ans}) shows that $x_{n}=\gamma\lambda^{n}%
+\delta\mu^{n}$ and $x_{n-1}=\gamma\lambda^{n-1}+\delta\mu^{n-1}$ and
$x_{n-2}=\gamma\lambda^{n-2}+\delta\mu^{n-2}$. Thus, (\ref{eq.def.abrec.eq})
rewrites as%
\begin{equation}
\gamma\lambda^{n}+\delta\mu^{n}=a\left(  \gamma\lambda^{n-1}+\delta\mu
^{n-1}\right)  +b\left(  \gamma\lambda^{n-2}+\delta\mu^{n-2}\right)  .
\label{eq.exe.rec.binet.ans1}%
\end{equation}
Therefore,%
\begin{align}
0  &  =\gamma\lambda^{n}+\delta\mu^{n}-\left(  a\left(  \gamma\lambda
^{n-1}+\delta\mu^{n-1}\right)  +b\left(  \gamma\lambda^{n-2}+\delta\mu
^{n-2}\right)  \right) \nonumber\\
&  =\underbrace{\left(  \gamma\lambda^{n}-a\gamma\lambda^{n-1}-b\gamma
\lambda^{n-2}\right)  }_{=\gamma\left(  \lambda^{2}-a\lambda-b\right)
\lambda^{n-2}}+\underbrace{\left(  \delta\mu^{n}-a\delta\mu^{n-1}-b\delta
\mu^{n-2}\right)  }_{=\delta\left(  \mu^{2}-a\mu-b\right)  \mu^{n-2}%
}\nonumber\\
&  =\gamma\left(  \lambda^{2}-a\lambda-b\right)  \lambda^{n-2}+\delta\left(
\mu^{2}-a\mu-b\right)  \mu^{n-2}. \label{eq.exe.rec.binet.ans2}%
\end{align}


Now, forget that we fixed $n$. We thus have shown that the equality
(\ref{eq.exe.rec.binet.ans2}) must hold for every integer $n\geq2$. Since the
only \textquotedblleft moving parts\textquotedblright\ in this equality are
the $\lambda^{n-2}$ and the $\mu^{n-2}$ terms (in the sense that all the other
terms are independent of $n$), we sense an easy way to ensure that it holds:
Namely, it will hold whenever $\lambda^{2}-a\lambda-b=0$ and $\mu^{2}%
-a\mu-b=0$. Technically, this is not the only way to make
(\ref{eq.exe.rec.binet.ans2}) hold; for example, the same would hold if
$\gamma=0$ and $\delta=0$. However, it is clear that $\gamma=0$ and $\delta=0$
can only work if the sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $
consists of zeros, while we are trying to study the general case. In the
\textquotedblleft typical\textquotedblright\ case, neither $\gamma$ nor
$\delta$ will be $0$, since otherwise the sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ would have to be a geometric progression (by
(\ref{eq.exe.rec.binet.ans})).

So we need to pick $\lambda$ and $\mu$ in such a way that $\lambda
^{2}-a\lambda-b=0$ and $\mu^{2}-a\mu-b=0$. In other words, $\lambda$ and $\mu$
must be roots of the quadratic equation $X^{2}-aX-b=0$. As you know from high
school(?), this quadratic equation has two complex roots (counted with
multiplicity\footnote{This means that sometimes, the equation has only one
root, but we should count it as two equal roots. (This happens precisely when
$a^{2}+4b=0$.)}). It seems a good idea to let $\lambda$ and $\mu$ be the two
roots of this equation.\footnote{Technically, we could of course let $\lambda$
and $\mu$ be one and the same root. But this feels like wasting a variable
(and is indeed so); in fact, setting $\lambda=\mu$ in
(\ref{eq.exe.rec.binet.ans}) would force $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ to be a geometric progression, which is not representative
of the \textquotedblleft typical\textquotedblright\ case. So it stands to
reason that we don't take $\lambda$ and $\mu$ to be one and the same root
(unless there is only one root).} Explicitly, this means that%
\begin{equation}
\lambda=\dfrac{a+\sqrt{a^{2}+4b}}{2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \mu=\dfrac{a-\sqrt{a^{2}+4b}}{2}.
\label{eq.exe.rec.binet.lm}%
\end{equation}
(We could of course swap the roles of $\lambda$ and $\mu$, but this would not
change anything.) Note that $\lambda$ and $\mu$ can fail to be real numbers,
even if $a$ and $b$ are reals. (For example, this will happen if $a=b=-1$.)

By defining $\lambda$ and $\mu$ through (\ref{eq.exe.rec.binet.lm}), we have
ensured that (\ref{eq.exe.rec.binet.ans2}) holds for each integer $n\geq2$.
Thus, (\ref{eq.exe.rec.binet.ans1}) holds for each integer $n\geq2$ as well
(since (\ref{eq.exe.rec.binet.ans2}) is equivalent to
(\ref{eq.exe.rec.binet.ans1})). In other words, the sequence $\left(
\gamma\lambda^{0}+\delta\mu^{0},\gamma\lambda^{1}+\delta\mu^{1},\gamma
\lambda^{2}+\delta\mu^{2},\ldots\right)  $ is $\left(  a,b\right)
$-recurrent. Hence, if the formula (\ref{eq.exe.rec.binet.ans}) holds for
$n=0$ and for $n=1$, then it also holds for all $n\in\mathbb{N}$ (because two
$\left(  a,b\right)  $-recurrent sequences that agree in their first two
entries must be identical). It thus remains to pick $\gamma$ and $\delta$ in
such a way that the formula (\ref{eq.exe.rec.binet.ans}) holds for $n=0$ and
for $n=1$. In other words, we must pick $\gamma$ and $\delta$ in such a way
that%
\begin{equation}
\left\{
\begin{array}
[c]{c}%
x_{0}=\gamma\lambda^{0}+\delta\mu^{0};\\
x_{1}=\gamma\lambda^{1}+\delta\mu^{1}.
\end{array}
\right.  \label{eq.exe.rec.binet.gd-sys}%
\end{equation}
This is a system of two linear equations in the two unknowns $\gamma$ and
$\delta$ (since $x_{0},x_{1},\lambda,\mu$ are known). Using Gaussian
elimination or Cramer's rule (or any other method for solving systems of
linear equations), we see that its solution is%
\begin{equation}
\gamma=\dfrac{x_{1}-\mu x_{0}}{\lambda-\mu}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \delta=\dfrac{\lambda x_{0}-x_{1}}{\lambda-\mu}
\label{eq.exe.rec.binet.gd}%
\end{equation}
when $\lambda\neq\mu$. Note that $\lambda\neq\mu$ holds if and only if
$a^{2}+4b\neq0$ (this follows easily from (\ref{eq.exe.rec.binet.lm})). If
$a^{2}+4b=0$, then the system (\ref{eq.exe.rec.binet.gd-sys}) has no solutions
or infinitely many solutions; let us ignore this case for now.

Thus, whenever $a^{2}+4b\neq0$, we have found four constants $\gamma
,\delta,\lambda,\mu$ that ensure that (\ref{eq.exe.rec.binet.ans}) does indeed
hold for each $n\in\mathbb{N}$: Namely, $\lambda$ and $\mu$ are given by
(\ref{eq.exe.rec.binet.lm}), whereas $\gamma$ and $\delta$ are given by
(\ref{eq.exe.rec.binet.gd}). It is easy to see that these four constants
$\gamma,\delta,\lambda,\mu$ indeed work (i.e., that the formula
(\ref{eq.exe.rec.binet.ans}) indeed holds for all $n\in\mathbb{N}$ when these
four constants are being used)\footnote{Indeed, we already explained that, due
to our choice of $\lambda$ and $\mu$, if the formula
(\ref{eq.exe.rec.binet.ans}) holds for $n=0$ and for $n=1$, then it also holds
for all $n\in\mathbb{N}$. But our choice of $\gamma$ and $\delta$ ensures that
the formula (\ref{eq.exe.rec.binet.ans}) does indeed hold for $n=0$ and $n=1$.
Thus, this formula holds for all $n\in\mathbb{N}$, as desired.}.

We have thus obtained a partial answer to Exercise \ref{exe.rec.binet}: We
have found a formula that works whenever $a^{2}+4b\neq0$. We will soon turn to
the other case; but let us say a few general words first. Our approach to
finding a formula for $x_{n}$ had the following structure: We \textbf{guessed}
that there should be a formula of the form (\ref{eq.exe.rec.binet.ans}) for
four constants $\gamma,\delta,\lambda,\mu$. We could not guess the exact
values of $\gamma,\delta,\lambda,\mu$, however, so we treated them as unknowns
and solved for them. That is, we guessed only the part of the answer that was
easily guessable (viz., the structure of the formula), and then used that
guess to figure out the rest through analytic reasoning. This kind of
\textquotedblleft incomplete guess\textquotedblright\ is called an
\textit{ansatz} (German word, plural \textit{ans\"{a}tze}) and is particularly
popular in mathematical physics, but contest problems also tend to provide
opportunities for ans\"{a}tze to those who know to look out for them. Of
course, as with any kind of guess, an answer found using an ansatz needs to be
checked (i.e., proved); in our case, this was essentially trivial, because the
reasoning we made to find $\gamma,\delta,\lambda,\mu$ was reversible. In other
situations, this can be nontrivial or even difficult -- but knowing the answer
is still a good step forward.

Let us now complete the solution of Exercise \ref{exe.rec.binet} by studying
the case $a^{2}+4b=0$. Consider this case. In general, the system
(\ref{eq.exe.rec.binet.gd-sys}) may fail to have a solution, so our ansatz
(\ref{eq.exe.rec.binet.ans}) will not work here. Instead, we can use the
condition $a^{2}+4b=0$ to rewrite $b$ as $\dfrac{-a^{2}}{4}$ (thus eliminating
one parameter from our problem), and compute the first few entries of our
sequence to look for a pattern:%
\begin{align*}
x_{0}  &  =x_{0};\\
x_{1}  &  =x_{1};\\
x_{2}  &  =ax_{1}+\underbrace{b}_{=\dfrac{-a^{2}}{4}}x_{0}=ax_{1}%
+\dfrac{-a^{2}}{4}x_{0}=a\left(  x_{1}-\dfrac{a}{4}x_{0}\right)  ;\\
x_{3}  &  =a\underbrace{x_{2}}_{=a\left(  x_{1}-\dfrac{a}{4}x_{0}\right)
}+\underbrace{b}_{=\dfrac{-a^{2}}{4}}x_{1}=aa\left(  x_{1}-\dfrac{a}{4}%
x_{0}\right)  +\dfrac{-a^{2}}{4}x_{1}=a^{2}\left(  \dfrac{3}{4}x_{1}-\dfrac
{a}{4}x_{0}\right)  ;\\
x_{4}  &  =a\underbrace{x_{3}}_{=a^{2}\left(  \dfrac{3}{4}x_{1}-\dfrac{a}%
{4}x_{0}\right)  }+\underbrace{b}_{=\dfrac{-a^{2}}{4}}\ \ \underbrace{x_{2}%
}_{=a\left(  x_{1}-\dfrac{a}{4}x_{0}\right)  }\\
&  =aa^{2}\left(  \dfrac{3}{4}x_{1}-\dfrac{a}{4}x_{0}\right)  +\dfrac{-a^{2}%
}{4}a\left(  x_{1}-\dfrac{a}{4}x_{0}\right)  =a^{3}\left(  \dfrac{1}{2}%
x_{1}-\dfrac{3a}{16}x_{0}\right)  ;\\
x_{5}  &  =a^{4}\left(  \dfrac{5}{16}x_{1}-\dfrac{a}{8}x_{0}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{we are now omitting the intermediate
steps}\right)  ;\\
x_{6}  &  =a^{5}\left(  \dfrac{3}{16}x_{1}-\dfrac{5a}{64}x_{0}\right)  .
\end{align*}
The answer may not immediately stare at us from the equations, but again we
can make an \textbf{ansatz}: Namely, we expect to have%
\begin{equation}
x_{n}=a^{n-1}\left(  u_{n}x_{1}-v_{n}ax_{0}\right)
\ \ \ \ \ \ \ \ \ \ \text{for each }n>0, \label{eq.exe.rec.binet.xn-auv}%
\end{equation}
\footnote{We are saying \textquotedblleft for each $n>0$\textquotedblright%
\ instead of \textquotedblleft for each $n\in\mathbb{N}$\textquotedblright%
\ here, since $a^{n-1}$ is undefined when $n=0$ and $a=0$. (In truth, we are
being over-careful here; the $a=0$ case is easy enough that we can just leave
it aside.)} where $u_{n}$ and $v_{n}$ are two rational numbers (dependent on
$n$, but independent on $a$, $x_{0}$ and $x_{1}$). Our goal is now to find
these $u_{n}$ and $v_{n}$. Let us list the first few of them:%
\begin{align*}
\left(  u_{1},u_{2},u_{3},u_{4},u_{5},u_{6}\right)   &  =\left(  1,1,\dfrac
{3}{4},\dfrac{1}{2},\dfrac{5}{16},\dfrac{3}{16}\right)  ;\\
\left(  v_{1},v_{2},v_{3},v_{4},v_{5},v_{6}\right)   &  =\left(  0,\dfrac
{1}{4},\dfrac{1}{4},\dfrac{3}{16},\dfrac{1}{8},\dfrac{5}{64}\right)  .
\end{align*}
This suggests that both the $u_{i}$ and the $v_{i}$ are fractions whose
denominators are powers of $2$. The exact denominators appear to oscillate,
but it is noticeable that the denominator of $u_{i}$ is never larger than
$2^{i-1}$, while that of $v_{i}$ is never larger than $2^{i}$. Thus, we may
want to look at $2^{i-1}u_{i}$ and $2^{i}v_{i}$, which will be integers:%
\begin{align*}
\left(  2^{0}u_{1},2^{1}u_{2},2^{2}u_{3},2^{3}u_{4},2^{4}u_{5},2^{5}%
u_{6}\right)   &  =\left(  1,2,3,4,5,6\right)  ;\\
\left(  2^{1}v_{1},2^{2}v_{2},2^{3}v_{3},2^{4}v_{4},2^{5}v_{5},2^{6}%
v_{6}\right)   &  =\left(  0,1,2,3,4,5\right)  .
\end{align*}
Voil\`{a}: now the pattern is impossible to miss.\footnote{If you found the
idea of considering $2^{i-1}u_{i}$ and $2^{i}v_{i}$ somewhat far-fetched:
there are other ways to guess the same result. For example, after computing
$u_{7}$ and $u_{9}$, it becomes easy to notice that the numerator of $u_{i}$
is $i$ whenever $i$ is odd. With this in mind, you will then be motivated to
look at the sequence $\left(  \dfrac{u_{1}}{1},\dfrac{u_{2}}{2},\dfrac{u_{3}%
}{3},\dfrac{u_{4}}{4},\ldots\right)  $, which will quickly reveal itself to be
the rather famous $\left(  1,2,4,8,16,\ldots\right)  $.} We guess that
$2^{i-1}u_{i}=i$ and $2^{i}v_{i}=i-1$. If this is true, then
(\ref{eq.exe.rec.binet.xn-auv}) becomes%
\begin{equation}
x_{n}=a^{n-1}\left(  \dfrac{n}{2^{n-1}}x_{1}-\dfrac{n-1}{2^{n}}ax_{0}\right)
\ \ \ \ \ \ \ \ \ \ \text{for each }n>0. \label{eq.exe.rec.binet.res1}%
\end{equation}
In other words,%
\begin{equation}
x_{n}=\dfrac{1}{2^{n}}\left(  2na^{n-1}x_{1}-\left(  n-1\right)  a^{n}%
x_{0}\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }n>0.
\label{eq.exe.rec.binet.res2}%
\end{equation}


\begin{noncompile}
We next proceed as in the $a^{2}+4b\neq0$ case: We fix an integer $n\geq3$
(not $n\geq2$, since (\ref{eq.exe.rec.binet.xn-auv}) is only stated for
$n>0$), and we see what becomes of (\ref{eq.def.abrec.eq}) when we use
(\ref{eq.exe.rec.binet.xn-auv}) to rewrite $x_{n}$, $x_{n-1}$ and $x_{n-2}$ in
it. The result is
\begin{align*}
a^{n-1}\left(  u_{n}x_{1}-v_{n}ax_{0}\right)   &  =aa^{n-2}\left(
u_{n-1}x_{1}-v_{n-1}ax_{0}\right)  +\underbrace{b}_{=\dfrac{-a^{2}}{4}}%
a^{n-3}\left(  u_{n-2}x_{1}-v_{n-2}ax_{0}\right) \\
&  =a^{n-1}\left(  u_{n-1}x_{1}-v_{n-1}ax_{0}\right)  -\dfrac{1}{4}%
a^{n-1}\left(  u_{n-2}x_{1}-v_{n-2}ax_{0}\right)  .
\end{align*}
Cancelling $a^{n-1}$ from this equality (which is okay unless $a=0$, but we
ignore this possibility for now as we are not yet proving anything), we obtain%
\[
u_{n}x_{1}-v_{n}ax_{0}=\left(  u_{n-1}x_{1}-v_{n-1}ax_{0}\right)  -\dfrac
{1}{4}\left(  u_{n-2}x_{1}-v_{n-2}ax_{0}\right)  .
\]
Upon collecting $x_{1}$ and $x_{0}$ terms, this rewrites as%
\[
u_{n}x_{1}-v_{n}ax_{0}=\left(  u_{n-1}-\dfrac{1}{4}u_{n-2}\right)
x_{1}-\left(  v_{n-1}-\dfrac{1}{4}v_{n-2}\right)  ax_{0}.
\]
We don't want $u_{n}$ and $v_{n}$ to depend on $a$, $x_{0}$ and $x_{1}$; thus,
the only way to satisfy this equality would be to have%
\begin{align*}
u_{n}  &  =u_{n-1}-\dfrac{1}{4}u_{n-2};\\
v_{n}  &  =v_{n-1}-\dfrac{1}{4}v_{n-2}.
\end{align*}
In other words, the sequences $\left(  u_{1},u_{2},u_{3},\ldots\right)  $ and
$\left(  v_{1},v_{2},v_{3},\ldots\right)  $ should be $\left(  1,-\dfrac{1}%
{4}\right)  $-recurrent.

Great -- we have reduced our problem to finding an explicit formula for the
entries of an $\left(  1,-\dfrac{1}{4}\right)  $-recurrent sequence
\end{noncompile}

This is, so far, a guess. But clearly, if a formula like
(\ref{eq.exe.rec.binet.res2}) is true, then it can be proved by a
straightforward strong induction on $n$. And this is indeed the case;
(\ref{eq.exe.rec.binet.res2}) is true, and its induction proof can be found in
\cite[solution to Exercise 4.1]{detnotes}. Note that
(\ref{eq.exe.rec.binet.res2}) holds for $n=0$ as well, if we agree to
understand $na^{n-1}$ as $0$ for $n=0$ (even if $a^{n-1}$ may fail to be defined).

Thus, we have found explicit formulas for $x_{n}$ in both cases $a^{2}%
+4b\neq0$ and $a^{2}+4b=0$. Exercise \ref{exe.rec.binet} is solved.
\end{proof}

Combining our results obtained in the discussion of Exercise
\ref{exe.rec.binet} above, we obtain the following result (a \textquotedblleft
generalized Binet formula\textquotedblright):

\begin{theorem}
\label{thm.rec.binet}Let $a$ and $b$ be two numbers. Let $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)  $-recurrent sequence. Then:

\textbf{(a)} If $a^{2}+4b\neq0$, then every $n\in\mathbb{N}$ satisfies%
\begin{equation}
x_{n}=\gamma\lambda^{n}+\delta\mu^{n}, \label{eq.thm.rec.binet.a.eq}%
\end{equation}
where we set%
\begin{equation}
\lambda=\dfrac{a+\sqrt{a^{2}+4b}}{2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \mu=\dfrac{a-\sqrt{a^{2}+4b}}{2}
\label{eq.thm.rec.binet.a.lm}%
\end{equation}
and%
\begin{equation}
\gamma=\dfrac{x_{1}-\mu x_{0}}{\lambda-\mu}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \delta=\dfrac{\lambda x_{0}-x_{1}}{\lambda-\mu}.
\label{eq.thm.rec.binet.a.gd}%
\end{equation}


\textbf{(b)} If $a^{2}+4b=0$, then every $n\in\mathbb{N}$ satisfies%
\[
x_{n}=\dfrac{1}{2^{n}}\left(  2na^{n-1}x_{1}-\left(  n-1\right)  a^{n}%
x_{0}\right)
\]
(where we agree to understand $na^{n-1}$ as $0$ for $n=0$).
\end{theorem}

It is easy to see that Theorem \ref{thm.fib.binet} is a particular case of
Theorem \ref{thm.rec.binet} \textbf{(a)} (obtained by setting $a=1$ and $b=1$
and $x_{i}=f_{i}$). Likewise, we can compute explicit formulas for other
examples of $\left(  a,b\right)  $-recurrent sequences:

\begin{example}
Consider the Lucas sequence $\left(  \ell_{0},\ell_{1},\ell_{2},\ldots\right)
$ from Example \ref{exa.abrec.luc}. This sequence is $\left(  1,1\right)
$-recurrent; thus, Theorem \ref{thm.rec.binet} \textbf{(a)} (applied to $a=1$
and $b=1$ and $x_{i}=\ell_{i}$) yields that every $n\in\mathbb{N}$ satisfies
$\ell_{n}=\gamma\lambda^{n}+\delta\mu^{n}$, where (as you can see by
straightforward computations) we have $\lambda=\dfrac{1+\sqrt{5}}{2}$ and
$\mu=\dfrac{1-\sqrt{5}}{2}$ and $\gamma=1$ and $\delta=1$. That is, every
$n\in\mathbb{N}$ satisfies $\ell_{n}=\varphi^{n}+\psi^{n}$, where $\varphi$
and $\psi$ are as in Theorem \ref{thm.fib.binet}.
\end{example}

\begin{example}
As we know from Example \ref{exa.abrec.ari}, a $\left(  2,-1\right)
$-recurrent sequence is the same as an arithmetic progression. We can obtain
an explicit formula for any entry $x_{n}$ of such a sequence $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ using Theorem \ref{thm.rec.binet}
\textbf{(b)} (indeed, this is a case where Theorem \ref{thm.rec.binet}
\textbf{(b)} applies, since $2^{2}+4\left(  -1\right)  =0$); but this formula
readily simplifies to the well-known $x_{n}=x_{0}+n\left(  x_{1}-x_{0}\right)
$.
\end{example}

\begin{example}
Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  =\left(  u,v,u,v,u,v,\ldots
\right)  $ for two numbers $u$ and $v$. As we saw in Example
\ref{exa.abrec.01}, this is a $\left(  0,1\right)  $-recurrent sequence. Thus,
Theorem \ref{thm.rec.binet} \textbf{(a)} (applied to $a=0$ and $b=1$) yields
that every $n\in\mathbb{N}$ satisfies $x_{n}=\gamma\lambda^{n}+\delta\mu^{n}$,
where (again by computation) $\lambda=1$ and $\mu=-1$ and $\gamma=\dfrac
{u+v}{2}$ and $\delta=\dfrac{u-v}{2}$. That is, every $n\in\mathbb{N}$
satisfies%
\[
x_{n}=\dfrac{u+v}{2}\cdot1^{n}+\dfrac{u-v}{2}\cdot\left(  -1\right)
^{n}=\dfrac{u+v}{2}+\left(  -1\right)  ^{n}\cdot\dfrac{u-v}{2}.
\]
This is easy to check by hand.
\end{example}

\begin{example}
Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  =\left(  u,v,v,v,v,\ldots
\right)  $ for two numbers $u$ and $v$. As we saw in Example
\ref{exa.abrec.10}, this is a $\left(  1,0\right)  $-recurrent sequence. Thus,
Theorem \ref{thm.rec.binet} \textbf{(a)} (applied to $a=1$ and $b=0$) yields
that every $n\in\mathbb{N}$ satisfies $x_{n}=\gamma\lambda^{n}+\delta\mu^{n}$,
where (again by computation) $\lambda=1$ and $\mu=0$ and $\gamma=v$ and
$\delta=u-v$. That is, every $n\in\mathbb{N}$ satisfies%
\[
x_{n}=v1^{n}+\left(  u-v\right)  0^{n}=v+\left(  u-v\right)  0^{n}.
\]
This is, of course, again true due to the way $0^{n}$ behaves when $n=0$ and
when $n>0$.
\end{example}

\begin{example}
\label{exa.rec.binet.hexagon}Now, consider the $\left(  1,-1\right)
$-recurrent sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ from Example
\ref{exa.abrec.1-1}. Here, Theorem \ref{thm.rec.binet} \textbf{(a)} (applied
to $a=1$ and $b=-1$) yields that every $n\in\mathbb{N}$ satisfies
$x_{n}=\gamma\lambda^{n}+\delta\mu^{n}$, where (again by computation)
\[
\lambda=\dfrac{1+\sqrt{-3}}{2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \mu=\dfrac{1-\sqrt{-3}}{2}%
\]
and%
\[
\gamma=\dfrac{x_{1}-\mu x_{0}}{\lambda-\mu}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \delta=\dfrac{\lambda x_{0}-x_{1}}{\lambda-\mu}.
\]
The numbers $\lambda$ and $\mu$ here are complex -- but they are more than
that. If we plot them on the Argand diagram (see \cite[\S 4.1.8]{19s} for
details on this), we realize that -- together with $1$, $-1$, $-\lambda$ and
$-\mu$ -- they form the vertices of a regular hexagon inscribed in the unit
circle:%
\[%
%TCIMACRO{\TeXButton{tikz hexagon}{\begin{tikzpicture}[scale=2.5]
%\draw[step=1cm,gray,very thin] (-1.2, -1.2) grid (1.2, 1.2);
%\draw[->] (-1.3,0) -- (1.3,0);
%\draw[->] (0,-1.3) -- (0,1.3);
%\node(l) at (0.5, {sin(60)}) {};
%\node(m) at (0.5, {-sin(60)}) {};
%\node(e) at (1, 0) {};
%\node(ll) at (-0.5, {-sin(60)}) {};
%\node(mm) at (-0.5, {sin(60)}) {};
%\node(ee) at (-1, 0 cm) {};
%\node(o) at (0, 0) {};
%\fill(l) circle (1pt) node[above right] {$\lambda$};
%\fill(ll) circle (1pt) node[below left] {$-\lambda$};
%\fill(m) circle (1pt) node[below right] {$\mu$};
%\fill(mm) circle (1pt) node[above left] {$-\mu$};
%\fill(e) circle (1pt) node[above right] {$1$};
%\fill(ee) circle (1pt) node[above left] {$-1$};
%\fill(o) circle (1pt) node[above left] {$0$};
%\draw(0,0) circle [radius=1cm];
%\draw[very thick, blue] (e) -- (l) -- (mm) -- (ee) -- (ll) -- (m) -- (e);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\draw[step=1cm,gray,very thin] (-1.2, -1.2) grid (1.2, 1.2);
\draw[->] (-1.3,0) -- (1.3,0);
\draw[->] (0,-1.3) -- (0,1.3);
\node(l) at (0.5, {sin(60)}) {};
\node(m) at (0.5, {-sin(60)}) {};
\node(e) at (1, 0) {};
\node(ll) at (-0.5, {-sin(60)}) {};
\node(mm) at (-0.5, {sin(60)}) {};
\node(ee) at (-1, 0 cm) {};
\node(o) at (0, 0) {};
\fill(l) circle (1pt) node[above right] {$\lambda$};
\fill(ll) circle (1pt) node[below left] {$-\lambda$};
\fill(m) circle (1pt) node[below right] {$\mu$};
\fill(mm) circle (1pt) node[above left] {$-\mu$};
\fill(e) circle (1pt) node[above right] {$1$};
\fill(ee) circle (1pt) node[above left] {$-1$};
\fill(o) circle (1pt) node[above left] {$0$};
\draw(0,0) circle [radius=1cm];
\draw[very thick, blue] (e) -- (l) -- (mm) -- (ee) -- (ll) -- (m) -- (e);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Thus, due to the way multiplication of complex numbers corresponds to
composition of rotations, the numbers $\lambda$ and $\mu$ (as well as the
other vertices $1$, $-1$, $-\lambda$ and $-\mu$) are $6$-th roots of unity --
i.e., they satisfy $\lambda^{6}=1$ and $\mu^{6}=1$. Hence, every
$n\in\mathbb{N}$ satisfies $\lambda^{n+6}=\lambda^{n}$ and $\mu^{n+6}=\mu^{n}$
and therefore $\gamma\lambda^{n+6}+\delta\mu^{n+6}=\gamma\lambda^{n}+\delta
\mu^{n}$. Since $x_{n+6}=\gamma\lambda^{n+6}+\delta\mu^{n+6}$ and
$x_{n}=\gamma\lambda^{n}+\delta\mu^{n}$, we can rewrite this as $x_{n+6}%
=x_{n}$. This shows once again (but geometrically this time) that the sequence
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $6$-periodic.
\end{example}

\begin{example}
Let $\alpha$ and $\beta$ be two angles. Proposition \ref{prop.rec.sin-cos}
shows that the sequence
\[
\left(  \sin\left(  \beta+0\alpha\right)  ,\sin\left(  \beta+1\alpha\right)
,\sin\left(  \beta+2\alpha\right)  ,\ldots\right)
\]
is $\left(  2\cos\alpha,-1\right)  $-recurrent. Obviously, we already have an
explicit formula for its entries, but let us contrast it with what Theorem
\ref{thm.rec.binet} \textbf{(a)} would yield. Namely, Theorem
\ref{thm.rec.binet} \textbf{(a)} (applied to $a=2\cos\alpha$ and $b=-1$ and
$x_{n}=\sin\left(  \beta+n\alpha\right)  $) yields that $\sin\left(
\beta+n\alpha\right)  =\gamma\lambda^{n}+\delta\mu^{n}$, where
\[
\lambda=\dfrac{2\cos\alpha+\sqrt{\left(  2\cos\alpha\right)  ^{2}-4}}%
{2}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \mu=\dfrac{2\cos
\alpha-\sqrt{\left(  2\cos\alpha\right)  ^{2}-4}}{2}%
\]
and%
\[
\gamma=\dfrac{\sin\left(  \beta+\alpha\right)  -\mu\sin\beta}{\lambda-\mu
}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \delta=\dfrac{\lambda
\sin\left(  \beta+\alpha\right)  -\sin\beta}{\lambda-\mu}.
\]
(To be fully precise, Theorem \ref{thm.rec.binet} \textbf{(a)} only applies
when $\left(  2\cos\alpha\right)  ^{2}-4\neq0$, that is, when $\alpha$ is not
a multiple of $\pi$; but the other case is easy.) We note that the square root
$\sqrt{\left(  2\cos\alpha\right)  ^{2}-4}$ is an imaginary number (since
$\left\vert 2\cos\alpha\right\vert \leq2$ and thus $\left(  2\cos
\alpha\right)  ^{2}-4\leq0$) and can be rewritten as $2i\left\vert \sin
\alpha\right\vert $, where $i=\sqrt{-1}$ (this follows easily from $\left(
\sin\alpha\right)  ^{2}+\left(  \cos\alpha\right)  ^{2}=1$). We assume that
$\alpha\in\left(  0,\pi\right)  $, so that we can rewrite $\left\vert
\sin\alpha\right\vert $ as $\sin\alpha$ (the other case is no harder). Then,
our above formulas for $\lambda$ and $\mu$ become%
\[
\lambda=\cos\alpha+i\sin\alpha\ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \mu=\cos\alpha-i\sin\alpha.
\]
Anyone familiar with
\href{https://en.wikipedia.org/wiki/Euler's_formula}{Euler's formula} will
rewrite this as%
\[
\lambda=e^{i\alpha}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \mu
=e^{-i\alpha}.
\]
The formula $\sin\left(  \beta+n\alpha\right)  =\gamma\lambda^{n}+\delta
\mu^{n}$ can now be straightforwardly (if laboriously) derived from
\href{https://en.wikipedia.org/wiki/De_Moivre%27s_formula}{de Moivre's
formula}.
\end{example}

\subsubsection{Two-term recurrences: various properties}

Various properties of the Fibonacci sequence can be generalized to arbitrary
$\left(  a,b\right)  $-recurrent sequences. For example, here is how the
Cassini identity (Exercise \ref{exe.fib.cassini}) can be generalized:

\begin{exercise}
\label{exe.rec.cassini}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)  $-recurrent
sequence. Prove that%
\begin{equation}
x_{n+1}x_{n-1}-x_{n}^{2}=\left(  -b\right)  ^{n-1}\left(  x_{2}x_{0}-x_{1}%
^{2}\right)  \label{eq.exe.rec.cassini.eq}%
\end{equation}
for any positive integer $n$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.rec.cassini}.]Let us prove
(\ref{eq.exe.rec.cassini.eq}) by induction on $n$:

\textit{Induction base:} We have%
\[
\underbrace{x_{1+1}}_{=x_{2}}\underbrace{x_{1-1}}_{=x_{0}}-\underbrace{x_{1}%
^{2}}_{=x_{1}^{2}}=x_{2}x_{0}-x_{1}^{2}=\left(  -b\right)  ^{1-1}\left(
x_{2}x_{0}-x_{1}^{2}\right)
\]
(since $\underbrace{\left(  -b\right)  ^{1-1}}_{=\left(  -b\right)  ^{0}%
=1}\left(  x_{2}x_{0}-x_{1}^{2}\right)  =x_{2}x_{0}-x_{1}^{2}$). In other
words, (\ref{eq.exe.rec.cassini.eq}) holds for $n=0$.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{eq.exe.rec.cassini.eq}) holds for $n=m$. We
must prove that (\ref{eq.exe.rec.cassini.eq}) holds for $n=m+1$.

The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this equality to $n=m+2$,
we obtain
\[
x_{m+2}=ax_{\left(  m+2\right)  -1}+bx_{\left(  m+2\right)  -2}=ax_{m+1}%
+bx_{m}.
\]
Also, applying the same equality $x_{n}=ax_{n-1}+bx_{n-2}$ to $n=m+1$, we
obtain%
\begin{equation}
x_{m+1}=ax_{\left(  m+1\right)  -1}+bx_{\left(  m+1\right)  -2}=ax_{m}%
+bx_{m-1}. \label{sol.rec.cassini.xmp1}%
\end{equation}


We have assumed that (\ref{eq.exe.rec.cassini.eq}) holds for $n=m$. In other
words, we have%
\begin{equation}
x_{m+1}x_{m-1}-x_{m}^{2}=\left(  -b\right)  ^{m-1}\left(  x_{2}x_{0}-x_{1}%
^{2}\right)  . \label{sol.rec.cassini.3}%
\end{equation}


Now,%
\begin{align*}
&  x_{\left(  m+1\right)  +1}x_{\left(  m+1\right)  -1}-x_{m+1}^{2}\\
&  =\underbrace{x_{m+2}}_{=ax_{m+1}+bx_{m}}x_{m}-x_{m+1}^{2}=\left(
ax_{m+1}+bx_{m}\right)  x_{m}-x_{m+1}^{2}\\
&  =ax_{m+1}x_{m}+bx_{m}^{2}-x_{m+1}^{2}=bx_{m}^{2}-x_{m+1}\underbrace{\left(
x_{m+1}-ax_{m}\right)  }_{\substack{=bx_{m-1}\\\text{(by
(\ref{sol.rec.cassini.xmp1}))}}}\\
&  =bx_{m}^{2}-x_{m+1}\cdot bx_{m-1}=b\left(  x_{m}^{2}-x_{m+1}x_{m-1}\right)
=\left(  -b\right)  \underbrace{\left(  x_{m+1}x_{m-1}-x_{m}^{2}\right)
}_{\substack{=\left(  -b\right)  ^{m-1}\left(  x_{2}x_{0}-x_{1}^{2}\right)
\\\text{(by (\ref{sol.rec.cassini.3}))}}}\\
&  =\underbrace{\left(  -b\right)  \left(  -b\right)  ^{m-1}}_{=\left(
-b\right)  ^{m}=\left(  -b\right)  ^{\left(  m+1\right)  -1}}\left(
x_{2}x_{0}-x_{1}^{2}\right)  =\left(  -b\right)  ^{\left(  m+1\right)
-1}\left(  x_{2}x_{0}-x_{1}^{2}\right)  .
\end{align*}
In other words, (\ref{eq.exe.rec.cassini.eq}) holds for $n=m+1$. This
completes the induction step. Thus, Exercise \ref{exe.rec.cassini} is solved
by induction.
\end{proof}

Alternatively, Exercise \ref{exe.rec.cassini} can be solved in a
straightforward way using Theorem \ref{thm.rec.binet}, provided that one is
willing to get one's hands dirty with the necessary computations.

Next, let us generalize the addition formula for Fibonacci numbers (Exercise
\ref{exe.fibonacci.addition}) to $\left(  a,b\right)  $-recurrent sequences:

\begin{exercise}
\label{exe.rec.addition01}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ be two $\left(  a,b\right)  $-recurrent sequences such that
$x_{0}=0$ and $x_{1}=1$. Prove that%
\[
y_{n+m+1}=bx_{n}y_{m}+x_{n+1}y_{m+1}%
\]
for any nonnegative integers $n$ and $m$.
\end{exercise}

Note that Exercise \ref{exe.fibonacci.addition} is the particular case of
Exercise \ref{exe.rec.addition01} for $a=1$ and $b=1$ and $x_{i}=f_{i}$ and
$y_{i}=f_{i}$. Indeed, the Fibonacci sequence satisfies $f_{0}=0$ and
$f_{1}=1$, so Exercise \ref{exe.rec.addition01} can be applied to it.

Once you start generalizing, it is hard to stop. Thus, rather than solving
Exercise \ref{exe.rec.addition01} directly, let us generalize it even further
(dropping the requirements $x_{0}=0$ and $x_{1}=1$) and solve the
generalization instead:

\begin{exercise}
\label{exe.rec.addition}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ be two $\left(  a,b\right)  $-recurrent sequences. Prove
that%
\begin{equation}
bx_{0}y_{n+m}+x_{1}y_{n+m+1}=bx_{n}y_{m}+x_{n+1}y_{m+1}
\label{eq.exe.rec.addition.eq}%
\end{equation}
for any nonnegative integers $n$ and $m$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.rec.addition}.]Rather than try to adapt our
above solution to Exercise \ref{exe.fibonacci.addition} to our now-increased
generality, we start from scratch and prove Exercise \ref{exe.rec.addition} by
induction. (In this we follow \cite[Theorem 2.26]{detnotes}, which is a
particular case of Exercise \ref{exe.rec.addition}.)

Our goal is to prove that (\ref{eq.exe.rec.addition.eq}) holds for all
nonnegative integers $n$ and $m$.

We proceed by induction on $n$ (without fixing $m$):

\textit{Induction base:} For any nonnegative integer $m$, we have%
\[
bx_{0}\underbrace{y_{0+m}}_{=y_{m}}+\underbrace{x_{1}}_{=x_{0+1}%
}\underbrace{y_{0+m+1}}_{=y_{m+1}}=bx_{0}y_{m}+x_{0+1}y_{m+1}.
\]
In other words, (\ref{eq.exe.rec.addition.eq}) holds for $n=0$ (and every
nonnegative integer $m$).

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{eq.exe.rec.addition.eq}) holds for $n=k$. We must now
prove that (\ref{eq.exe.rec.addition.eq}) holds for $n=k+1$.

We have assumed that (\ref{eq.exe.rec.addition.eq}) holds for $n=k$. In other
words, we have%
\begin{equation}
bx_{0}y_{k+m}+x_{1}y_{k+m+1}=bx_{k}y_{m}+x_{k+1}y_{m+1}
\label{sol.rec.addition.IH}%
\end{equation}
for every nonnegative integer $m$.

Let $m$ be a nonnegative integer.

The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this equality to $n=k+2$,
we obtain
\begin{equation}
x_{k+2}=ax_{\left(  k+2\right)  -1}+bx_{\left(  k+2\right)  -2}=ax_{k+1}%
+bx_{k}. \label{sol.rec.addition.IS.1}%
\end{equation}


The sequence $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$y_{n}=ay_{n-1}+by_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this equality to $n=m+2$,
we obtain
\begin{equation}
y_{m+2}=ay_{\left(  m+2\right)  -1}+by_{\left(  m+2\right)  -2}=ay_{m+1}%
+by_{m}. \label{sol.rec.addition.IS.2}%
\end{equation}


Now,%
\begin{align*}
bx_{k+1}y_{m}+\underbrace{x_{\left(  k+1\right)  +1}}_{\substack{=x_{k+2}%
\\=ax_{k+1}+bx_{k}\\\text{(by (\ref{sol.rec.addition.IS.1}))}}}y_{m+1}  &
=bx_{k+1}y_{m}+\left(  ax_{k+1}+bx_{k}\right)  y_{m+1}\\
&  =bx_{k+1}y_{m}+ax_{k+1}y_{m+1}+bx_{k}y_{m+1}\\
&  =bx_{k}y_{m+1}+x_{k+1}\underbrace{\left(  ay_{m+1}+by_{m}\right)
}_{\substack{=y_{m+2}\\\text{(by (\ref{sol.rec.addition.IS.2}))}}}\\
&  =bx_{k}y_{m+1}+x_{k+1}\underbrace{y_{m+2}}_{=y_{\left(  m+1\right)  +1}%
}=bx_{k}y_{m+1}+x_{k+1}y_{\left(  m+1\right)  +1}.
\end{align*}
On the other hand, applying (\ref{sol.rec.addition.IH}) to $m+1$ instead of
$m$, we obtain%
\[
bx_{0}y_{k+\left(  m+1\right)  }+x_{1}y_{k+\left(  m+1\right)  +1}%
=bx_{k}y_{m+1}+x_{k+1}y_{\left(  m+1\right)  +1}.
\]
Comparing these two equalities yields%
\[
bx_{k+1}y_{m}+x_{\left(  k+1\right)  +1}y_{m+1}=bx_{0}y_{k+\left(  m+1\right)
}+x_{1}y_{k+\left(  m+1\right)  +1}=bx_{0}y_{\left(  k+1\right)  +m}%
+x_{1}y_{\left(  k+1\right)  +m+1}%
\]
(since $k+\left(  m+1\right)  =\left(  k+1\right)  +m$). In other words,%
\[
bx_{0}y_{\left(  k+1\right)  +m}+x_{1}y_{\left(  k+1\right)  +m+1}%
=bx_{k+1}y_{m}+x_{\left(  k+1\right)  +1}y_{m+1}.
\]


Forget that we fixed $m$. We thus have proved that%
\[
bx_{0}y_{\left(  k+1\right)  +m}+x_{1}y_{\left(  k+1\right)  +m+1}%
=bx_{k+1}y_{m}+x_{\left(  k+1\right)  +1}y_{m+1}%
\]
for every nonnegative integer $m$. In other words,
(\ref{eq.exe.rec.addition.eq}) holds for $n=k+1$. This completes the induction
step. Thus, (\ref{eq.exe.rec.addition.eq}) is proved, so that Exercise
\ref{exe.rec.addition} is solved.
\end{proof}

Again, an alternative solution could have been given using Theorem
\ref{thm.rec.binet}.

As we said, Exercise \ref{exe.rec.addition} is a generalization of Exercise
\ref{exe.rec.addition01}; thus, having solved the former, we can now quickly
obtain the latter.

\begin{proof}
[Solution to Exercise \ref{exe.rec.addition01}.]Let $n$ and $m$ be two
nonnegative integers. Then, Exercise \ref{exe.rec.addition} yields%
\[
bx_{0}y_{n+m}+x_{1}y_{n+m+1}=bx_{n}y_{m}+x_{n+1}y_{m+1}.
\]
Comparing this with%
\[
b\underbrace{x_{0}}_{=0}y_{n+m}+\underbrace{x_{1}}_{=1}y_{n+m+1}%
=\underbrace{b\cdot0y_{n+m}}_{=0}+y_{n+m+1}=y_{n+m+1},
\]
we obtain $y_{n+m+1}=bx_{n}y_{m}+x_{n+1}y_{m+1}$. This solves Exercise
\ref{exe.rec.addition01}.
\end{proof}

Here is a generalization of Proposition \ref{prop.binom.fib} to $\left(
a,b\right)  $-recurrent sequences:

\begin{proposition}
\label{prop.rec.binom-fib}Let $a$ and $b$ be two numbers such that $a\neq0$.
Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)
$-recurrent sequence with $x_{0}=0$ and $x_{1}=1$. Let $n\in\left\{
-1,0,1,\ldots\right\}  $. Then,%
\begin{equation}
x_{n+1}=\sum_{k=0}^{n}\dbinom{n-k}{k}a^{n-2k}b^{k}.
\label{eq.prop.rec.binom-fib.eq}%
\end{equation}

\end{proposition}

Note that the \textquotedblleft$a\neq0$\textquotedblright\ condition in
Proposition \ref{prop.rec.binom-fib} is needed only to ensure that the
$a^{n-2k}$ term does not become undefined when $n-2k$ is negative. In truth,
the addends on the right hand side of (\ref{eq.prop.rec.binom-fib.eq}) in
which $n-2k$ is negative are irrelevant, since the binomial coefficients
$\dbinom{n-k}{k}$ in them vanish anyway; thus, we could just as well change
the upper limit of the sum from $n$ to $\left\lfloor n/2\right\rfloor $ and
stop worrying about what happens if $a=0$. However, letting the sum range from
$0$ to $n$ makes for a slightly simpler formula and a simpler proof.

\begin{proof}
[Proof of Proposition \ref{prop.rec.binom-fib}.]We proceed by strong induction
on $n$:

\textit{Induction step:} Let $m\in\left\{  -1,0,1,\ldots\right\}  $. Assume
(as the induction hypothesis) that Proposition \ref{prop.rec.binom-fib} holds
for $n<m$. We must prove that Proposition \ref{prop.rec.binom-fib} holds for
$n=m$. In other words, we must prove that
\begin{equation}
x_{m+1}=\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}.
\label{eq.prop.rec.binom-fib.IG}%
\end{equation}


If $m<1$, then this is easy to do directly\footnote{\textit{Proof.} Assume
that $m<1$. We must prove that (\ref{eq.prop.rec.binom-fib.IG}) holds.
\par
We have $m<1$. Thus, either $m=-1$ or $m=0$ (since $m\in\left\{
-1,0,1,\ldots\right\}  $). In other words, we are in one of the following two
cases:
\par
\textit{Case 1:} We have $m=-1$.
\par
\textit{Case 2:} We have $m=0$.
\par
Let us first consider Case 1. In this case, we have $m=-1$. Hence, $m+1=0$, so
that%
\[
x_{m+1}=x_{0}=0.
\]
Comparing this with
\begin{align*}
\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}  &  =\sum_{k=0}^{-1}\dbinom{m-k}%
{k}a^{m-2k}b^{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }m=-1\right) \\
&  =\left(  \text{empty sum}\right)  =0,
\end{align*}
we obtain $x_{m+1}=\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}$. Hence, we have
shown that (\ref{eq.prop.rec.binom-fib.IG}) holds in Case 1.
\par
Let us now consider Case 2. In this case, we have $m=0$. Hence, $m+1=1$, so
that%
\[
x_{m+1}=x_{1}=1.
\]
Comparing this with%
\begin{align*}
\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}  &  =\sum_{k=0}^{0}\dbinom{0-k}%
{k}a^{0-2k}b^{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }m=0\right) \\
&  =\underbrace{\dbinom{0-0}{0}}_{=1}\underbrace{a^{0-2\cdot0}}_{=a^{0}%
=1}\underbrace{b^{0}}_{=1}=1,
\end{align*}
we obtain $x_{m+1}=\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}$. Hence, we have
shown that (\ref{eq.prop.rec.binom-fib.IG}) holds in Case 2.
\par
We have now shown that (\ref{eq.prop.rec.binom-fib.IG}) holds in each of the
two Cases 1 and 2. Thus, (\ref{eq.prop.rec.binom-fib.IG}) always holds (under
our assumption that $m<1$). Qed.}. Thus, for the rest of this proof, we WLOG
assume that $m\geq1$. Hence, the numbers $m-1$ and $m-2$ both belong to
$\left\{  -1,0,1,\ldots\right\}  $. Also, $m-1\geq0$ (since $m\geq1$).
Furthermore, $m\geq1>0$; therefore, Proposition \ref{prop.binom.0} (applied to
$n=0$ and $k=m$) yields $\dbinom{0}{m}=0$. (We'll need this later.)

We have assumed that Proposition \ref{prop.rec.binom-fib} holds for $n<m$.
Hence, Proposition \ref{prop.rec.binom-fib} holds for $n=m-1$ (since
$m-1\in\left\{  -1,0,1,\ldots\right\}  $ and $m-1<m$). In other words, we have%
\[
x_{\left(  m-1\right)  +1}=\sum_{k=0}^{m-1}\dbinom{m-1-k}{k}a^{m-1-2k}b^{k}.
\]
In view of $\left(  m-1\right)  +1=m$, this rewrites as%
\begin{equation}
x_{m}=\sum_{k=0}^{m-1}\dbinom{m-1-k}{k}a^{m-1-2k}b^{k}.
\label{eq.prop.rec.binom-fib.IH1}%
\end{equation}


We have assumed that Proposition \ref{prop.rec.binom-fib} holds for $n<m$.
Hence, Proposition \ref{prop.rec.binom-fib} holds for $n=m-2$ (since
$m-2\in\left\{  -1,0,1,\ldots\right\}  $ and $m-2<m$). In other words, we have%
\[
x_{\left(  m-2\right)  +1}=\sum_{k=0}^{m-2}\dbinom{m-2-k}{k}a^{m-2-2k}b^{k}.
\]
In view of $\left(  m-2\right)  +1=m-1$, this rewrites as
\begin{equation}
x_{m-1}=\sum_{k=0}^{m-2}\dbinom{m-2-k}{k}a^{m-2-2k}b^{k}.
\label{eq.prop.rec.binom-fib.IH2}%
\end{equation}


The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this equality to $n=m+1$,
we obtain $x_{m+1}=ax_{\left(  m+1\right)  -1}+bx_{\left(  m+1\right)
-2}=ax_{m}+bx_{m-1}$.

Now, multiplying both sides of the equality (\ref{eq.prop.rec.binom-fib.IH1})
by $a$, we find%
\begin{align}
ax_{m}  &  =a\sum_{k=0}^{m-1}\dbinom{m-1-k}{k}a^{m-1-2k}b^{k}=\sum_{k=0}%
^{m-1}\underbrace{\dbinom{m-1-k}{k}}_{\substack{=\dbinom{m-k-1}{k}%
\\\text{(since }m-1-k=m-k-1\text{)}}}\underbrace{aa^{m-1-2k}}_{=a^{\left(
m-1-2k\right)  +1}=a^{m-2k}}b^{k}\nonumber\\
&  =\sum_{k=0}^{m-1}\dbinom{m-k-1}{k}a^{m-2k}b^{k}.
\label{eq.prop.rec.binom-fib.IH1a}%
\end{align}


Furthermore, multiplying both sides of the equality
(\ref{eq.prop.rec.binom-fib.IH2}) by $b$, we find%
\begin{align*}
bx_{m-1}  &  =b\sum_{k=0}^{m-2}\dbinom{m-2-k}{k}a^{m-2-2k}b^{k}=\sum
_{k=0}^{m-2}\dbinom{m-2-k}{k}a^{m-2-2k}bb^{k}\\
&  =\sum_{k=1}^{m-1}\underbrace{\dbinom{m-2-\left(  k-1\right)  }{k-1}%
}_{\substack{=\dbinom{m-k-1}{k-1}\\\text{(since }m-2-\left(  k-1\right)
=m-k-1\text{)}}}\underbrace{a^{m-2-2\left(  k-1\right)  }}%
_{\substack{=a^{m-2k}\\\text{(since }m-2-2\left(  k-1\right)  =m-2k\text{)}%
}}\underbrace{bb^{k-1}}_{=b^{k}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k-1\text{ for
}k\text{ in the sum}\right) \\
&  =\sum_{k=1}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k}.
\end{align*}
Comparing this with%
\begin{align*}
&  \sum_{k=0}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k}\\
&  =\underbrace{\dbinom{m-0-1}{0-1}}_{\substack{=0\\\text{(by
(\ref{eq.def.binom.def.b}), since }0-1\notin\mathbb{N}\text{)}}}a^{m-2\cdot
0}b^{0}+\sum_{k=1}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }m-1\geq0\right) \\
&  =\underbrace{0a^{m-2\cdot0}b^{0}}_{=0}+\sum_{k=1}^{m-1}\dbinom{m-k-1}%
{k-1}a^{m-2k}b^{k}=\sum_{k=1}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k},
\end{align*}
we obtain%
\begin{equation}
bx_{m-1}=\sum_{k=0}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k}.
\label{eq.prop.rec.binom-fib.IH2b}%
\end{equation}


Now,
\begin{align}
x_{m+1}  &  =ax_{m}+bx_{m-1}=bx_{m-1}+ax_{m}\nonumber\\
&  =\sum_{k=0}^{m-1}\dbinom{m-k-1}{k-1}a^{m-2k}b^{k}+\sum_{k=0}^{m-1}%
\dbinom{m-k-1}{k}a^{m-2k}b^{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by adding the equalities
(\ref{eq.prop.rec.binom-fib.IH2b}) and (\ref{eq.prop.rec.binom-fib.IH1a}%
)}\right) \nonumber\\
&  =\sum_{k=0}^{m-1}\left(  \dbinom{m-k-1}{k-1}a^{m-2k}b^{k}+\dbinom{m-k-1}%
{k}a^{m-2k}b^{k}\right) \nonumber\\
&  =\sum_{k=0}^{m-1}\left(  \dbinom{m-k-1}{k-1}+\dbinom{m-k-1}{k}\right)
a^{m-2k}b^{k}. \label{eq.prop.rec.binom-fib.IH3}%
\end{align}
Comparing this with%
\begin{align*}
\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}  &  =\sum_{k=0}^{m-1}%
\underbrace{\dbinom{m-k}{k}}_{\substack{=\dbinom{m-k-1}{k-1}+\dbinom{m-k-1}%
{k}\\\text{(by Theorem \ref{thm.binom.rec}, applied to }n=m-k\text{)}%
}}a^{m-2k}b^{k}+\underbrace{\dbinom{m-m}{m}}_{=\dbinom{0}{m}=0}a^{m-2m}b^{m}\\
&  =\sum_{k=0}^{m-1}\left(  \dbinom{m-k-1}{k-1}+\dbinom{m-k-1}{k}\right)
a^{m-2k}b^{k}+\underbrace{0a^{m-2m}b^{m}}_{=0}\\
&  =\sum_{k=0}^{m-1}\left(  \dbinom{m-k-1}{k-1}+\dbinom{m-k-1}{k}\right)
a^{m-2k}b^{k},
\end{align*}
we obtain%
\[
x_{m+1}=\sum_{k=0}^{m}\dbinom{m-k}{k}a^{m-2k}b^{k}.
\]
In other words, Proposition \ref{prop.rec.binom-fib} holds for $n=m$. This
completes the induction step. Thus, Proposition \ref{prop.rec.binom-fib} is proved.
\end{proof}

Proposition \ref{prop.rec.binom-fib} is, in a way, an explicit formula for any
entry of an $\left(  a,b\right)  $-recurrent sequence that begins with $0$ and
$1$. Unlike the formulas in Theorem \ref{thm.rec.binet}, it involves no
irrational numbers; however, it involves a finite sum and binomial
coefficients. Its other disadvantage is that it only applies to a very
specific $\left(  a,b\right)  $-recurrent sequence (namely, the one starting
with $0$ and $1$) rather than to any arbitrary $\left(  a,b\right)
$-recurrent sequence. This disadvantage, however, can easily be amended: In
fact, every $\left(  a,b\right)  $-recurrent sequence can be expressed through
the very specific one that starts with $0$ and $1$. Namely, we have the following:

\begin{proposition}
\label{prop.rec.fib-moment1}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)  $-recurrent
sequence with $x_{0}=0$ and $x_{1}=1$. Let $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ be an arbitrary $\left(  a,b\right)  $-recurrent sequence.
Then, $y_{n+1}=by_{0}x_{n}+y_{1}x_{n+1}$ for each $n\in\mathbb{N}$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.rec.fib-moment1}.]Exercise
\ref{exe.rec.addition} (applied to $m=0$) yields%
\[
bx_{0}y_{n+0}+x_{1}y_{n+0+1}=bx_{n}y_{0}+x_{n+1}\underbrace{y_{0+1}}_{=y_{1}%
}=bx_{n}y_{0}+x_{n+1}y_{1}=by_{0}x_{n}+y_{1}x_{n+1}.
\]
In view of%
\[
b\underbrace{x_{0}}_{=0}y_{n+0}+\underbrace{x_{1}}_{=1}\underbrace{y_{n+0+1}%
}_{=y_{n+1}}=\underbrace{b0y_{n+0}}_{=0}+y_{n+1}=y_{n+1},
\]
this rewrites as $y_{n+1}=by_{0}x_{n}+y_{1}x_{n+1}$. This proves Proposition
\ref{prop.rec.fib-moment1}.
\end{proof}

Proposition \ref{prop.binom.fib} is a particular case of Proposition
\ref{prop.rec.binom-fib}:

\begin{proof}
[Proof of Proposition \ref{prop.binom.fib}.]We have $n\in\mathbb{N}%
\subseteq\left\{  -1,0,1,\ldots\right\}  $ and $1\neq0$. The Fibonacci
sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ is $\left(  1,1\right)
$-recurrent (as we have already seen) and satisfies $f_{0}=0$ and $f_{1}=1$.
Hence, Proposition \ref{prop.rec.binom-fib} (applied to $a=1$, $b=1$ and
$x_{i}=f_{i}$) yields%
\begin{align*}
f_{n+1}  &  =\sum_{k=0}^{n}\dbinom{n-k}{k}\underbrace{1^{n-2k}}_{=1}%
\underbrace{1^{k}}_{=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{align*}
This proves Proposition \ref{prop.binom.fib}.
\end{proof}

Another particular case of Proposition \ref{prop.rec.binom-fib} is
\cite[Exercise 4.4]{detnotes}.

Yet another particular case of Proposition \ref{prop.rec.binom-fib} is the
following corollary, whose connection to $\left(  a,b\right)  $-recurrent
sequences is not immediately visible:

\begin{corollary}
\label{cor.rec.binom-fib.ariprog}Let $n\in\left\{  -1,0,1,\ldots\right\}  $.
Then,%
\[
n+1=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n-k}{k}2^{n-2k}.
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.rec.binom-fib.ariprog}.]We have $2\neq0$. The
sequence $\left(  0,1,2,3,\ldots\right)  $ is $\left(  2,-1\right)
$-recurrent\footnote{Indeed, this follows from the fact that this sequence is
an arithmetic progression, but (as we saw in Example \ref{exa.abrec.ari})
every arithmetic progression is $\left(  2,-1\right)  $-recurrent.
Alternatively, you can check it directly: Each integer $n\geq2$ satisfies
$n=2\left(  n-1\right)  +\left(  -1\right)  \left(  n-2\right)  $; but this is
saying precisely that the sequence $\left(  0,1,2,3,\ldots\right)  $ is
$\left(  2,-1\right)  $-recurrent (by the definition of \textquotedblleft%
$\left(  2,-1\right)  $-recurrent\textquotedblright).} and starts with the
entries $0=0$ and $1=1$. Hence, Proposition \ref{prop.rec.binom-fib} (applied
to $a=2$, $b=-1$ and $x_{i}=i$) yields%
\[
n+1=\sum_{k=0}^{n}\underbrace{\dbinom{n-k}{k}2^{n-2k}\left(  -1\right)  ^{k}%
}_{=\left(  -1\right)  ^{k}\dbinom{n-k}{k}2^{n-2k}}=\sum_{k=0}^{n}\left(
-1\right)  ^{k}\dbinom{n-k}{k}2^{n-2k}.
\]
This proves Corollary \ref{cor.rec.binom-fib.ariprog}.
\end{proof}

\subsubsection{\label{subsect.linrec.ab-matrix}Two-term recurrences: the
matrix approach}

For now, we have been approaching $\left(  a,b\right)  $-recurrent sequences
in an \textquotedblleft entry-by-entry\textquotedblright\ way. However, there
are some more conceptual approaches. The simplest one is the \textit{matrix
approach}. In essence, it says that instead of considering single entries
$x_{i}$ of an $\left(  a,b\right)  $-recurrent sequence $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $, it is better to consider pairs $\left(
x_{i},x_{i+1}\right)  $ of two consecutive entries. Better yet, we can encode
these pairs $\left(  x_{i},x_{i+1}\right)  $ as column vectors $\left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  $. Here is what we gain when doing this:

\begin{proposition}
\label{prop.rec.matrix-1}Let $a$ and $b$ be any two numbers. Let $A$ be the
$2\times2$-matrix $\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  $.

Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  a,b\right)
$-recurrent sequence of numbers. For each $i\in\mathbb{N}$, define a column
vector $v_{i}$ by $v_{i}=\left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  $. Then:

\textbf{(a)} We have $Av_{i}=v_{i+1}$ for each $i\in\mathbb{N}$.

\textbf{(b)} We have $A^{n}v_{i}=v_{i+n}$ for each $i\in\mathbb{N}$ and
$n\in\mathbb{N}$.
\end{proposition}

Proposition \ref{prop.rec.matrix-1} shows what is so nice about the vectors
$v_{i}$ as opposed to the single entries $x_{i}$: We cannot compute an entry
$x_{i+1}$ from knowing $x_{i}$ alone (we need $x_{i-1}$ as well), but we can
compute a vector $v_{i+1}$ from knowing $v_{i}$ alone (by Proposition
\ref{prop.rec.matrix-1} \textbf{(a)}). Furthermore, Proposition
\ref{prop.rec.matrix-1} \textbf{(b)} (applied to $i=0$) says that $A^{n}%
v_{0}=v_{n}$ for each $n\in\mathbb{N}$; this lets us quickly compute $v_{n}$
(and thus $x_{n}$) if we can quickly compute $A^{n}$. Fortunately, powers of
matrices can be computed quickly
(\href{https://en.wikipedia.org/wiki/Exponentiation_by_squaring}{exponentiation
by squaring} does the trick). This yields one of the quickest ways to exactly
compute any entry of an $\left(  a,b\right)  $-recurrent
sequence.\footnote{This phenomenon, where it is easier to work with a
\textquotedblleft bundle\textquotedblright\ of several entries of a sequence
(or values of a function) instead of a single entry (or value), is omnipresent
in mathematics and computer science.}

The proof of Proposition \ref{prop.rec.matrix-1} is rather easy:

\begin{proof}
[Proof of Proposition \ref{prop.rec.matrix-1}.]\textbf{(a)} Let $i\in
\mathbb{N}$. The definition of $v_{i}$ yields $v_{i}=\left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  $. The definition of $v_{i+1}$ yields $v_{i+1}=\left(
\begin{array}
[c]{c}%
x_{i+1}\\
x_{i+2}%
\end{array}
\right)  $.

The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this equality to $n=i+2$,
we obtain $x_{i+2}=ax_{i+1}+bx_{i}=bx_{i}+ax_{i+1}$. Now, recall that
$A=\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  $ (by the definition of $A$). Multiplying this equality by
$v_{i}=\left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  $, we find
\[
Av_{i}=\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  \left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  =\left(
\begin{array}
[c]{c}%
0x_{i}+1x_{i+1}\\
bx_{i}+ax_{i+1}%
\end{array}
\right)  =\left(
\begin{array}
[c]{c}%
x_{i+1}\\
bx_{i}+ax_{i+1}%
\end{array}
\right)
\]
(since $0x_{i}+1x_{i+1}=x_{i+1}$). Comparing this with%
\[
v_{i+1}=\left(
\begin{array}
[c]{c}%
x_{i+1}\\
x_{i+2}%
\end{array}
\right)  =\left(
\begin{array}
[c]{c}%
x_{i+1}\\
bx_{i}+ax_{i+1}%
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }x_{i+2}=bx_{i}%
+ax_{i+1}\right)  ,
\]
we obtain $Av_{i}=v_{i+1}$. This proves Proposition \ref{prop.rec.matrix-1}
\textbf{(a)}.

\textbf{(b)} Fix $i\in\mathbb{N}$. We must show that
\begin{equation}
A^{n}v_{i}=v_{i+n} \label{pf.prop.rec.matrix-1.b.goal}%
\end{equation}
for each $n\in\mathbb{N}$. We show this by induction on $n$:

\textit{Induction base:} We use the notation $I_{2}$ for the $2\times2$
identity matrix. Then, $A^{0}=I_{2}$. Thus, $\underbrace{A^{0}}_{=I_{2}}%
v_{i}=I_{2}v_{i}=v_{i}=v_{i+0}$ (since $i=i+0$). In other words, our claim
(\ref{pf.prop.rec.matrix-1.b.goal}) holds for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{pf.prop.rec.matrix-1.b.goal}) holds for $n=m$. We must
prove that (\ref{pf.prop.rec.matrix-1.b.goal}) holds for $n=m+1$. In other
words, we must prove that $A^{m+1}v_{i}=v_{i+m+1}$.

We have assumed that (\ref{pf.prop.rec.matrix-1.b.goal}) holds for $n=m$. In
other words, $A^{m}v_{i}=v_{i+m}$. Now,%
\[
\underbrace{A^{m+1}}_{=AA^{m}}v_{i}=A\underbrace{A^{m}v_{i}}_{=v_{i+m}%
}=Av_{i+m}=v_{i+m+1}%
\]
(by Proposition \ref{prop.rec.matrix-1} \textbf{(a)}, applied to $i+m$ instead
of $i$). In other words, (\ref{pf.prop.rec.matrix-1.b.goal}) holds for
$n=m+1$. This completes the induction step. Thus,
(\ref{pf.prop.rec.matrix-1.b.goal}) is proved. In other words, Proposition
\ref{prop.rec.matrix-1} \textbf{(b)} is proved.
\end{proof}

As an illustration of how useful Proposition \ref{prop.rec.matrix-1} is, let
us use it to solve Exercise \ref{exe.rec.cassini} again:

\begin{proof}
[Second solution to Exercise \ref{exe.rec.cassini} (sketched).]If $u$ and $v$
are two column vectors of size $2$, then $\left(  u\mid v\right)  $ shall
denote the $2\times2$-matrix whose columns are $u$ and $v$ (from left to
right). It is well-known (see, e.g., \cite[Chapter Three, Section IV, Lemma
3.7]{Heffer20}) that any $2\times2$-matrix $B$ and any two column vectors $u$
and $v$ of size $2$ satisfy%
\begin{equation}
B\left(  u\mid v\right)  =\left(  Bu\mid Bv\right)  .
\label{sol.rec.cassini.Buv}%
\end{equation}


For each $i\in\mathbb{N}$, let $V_{i}$ be the $2\times2$-matrix $\left(
v_{i}\mid v_{i+1}\right)  $. Thus, explicitly,
\begin{equation}
V_{i}=\left(
\begin{array}
[c]{cc}%
x_{i} & x_{i+1}\\
x_{i+1} & x_{i+2}%
\end{array}
\right)  \label{sol.rec.cassini.Vi=}%
\end{equation}
(since the definitions of $v_{i}$ and $v_{i+1}$ yield $v_{i}=\left(
\begin{array}
[c]{c}%
x_{i}\\
x_{i+1}%
\end{array}
\right)  $ and $v_{i+1}=\left(
\begin{array}
[c]{c}%
x_{i+1}\\
x_{i+2}%
\end{array}
\right)  $). Therefore, the determinant of $V_{i}$ is
\begin{equation}
\det\left(  V_{i}\right)  =\det\left(
\begin{array}
[c]{cc}%
x_{i} & x_{i+1}\\
x_{i+1} & x_{i+2}%
\end{array}
\right)  =x_{i}x_{i+2}-x_{i+1}^{2} \label{sol.rec.cassini.detVi=}%
\end{equation}
for each $i\in\mathbb{N}$.

It is well-known (see, e.g., \cite[Theorem 6.23]{detnotes}) that any
$n\in\mathbb{N}$ and any two $n\times n$-matrices $A$ and $B$ satisfy%
\begin{equation}
\det\left(  AB\right)  =\det A\cdot\det B. \label{sol.rec.cassini.detUV=}%
\end{equation}
(In the current solution, we shall only use this equality in the case $n=2$;
in this case it can be proved by straightforward computation.)

An easy consequence of (\ref{sol.rec.cassini.detUV=}) is the following formula
(see, e.g., \cite[Corollary 6.25 \textbf{(b)}]{detnotes}): If $n\in\mathbb{N}%
$, and if $B$ is an $n\times n$-matrix, then%
\begin{equation}
\det\left(  B^{k}\right)  =\left(  \det B\right)  ^{k}
\label{sol.rec.cassini.detBk=}%
\end{equation}
for any $k\in\mathbb{N}$. (This follows by induction on $k$.)

Now, let $n$ be a positive integer. Thus, $n-1\in\mathbb{N}$. Let $A$ be the
$2\times2$-matrix $\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  $. Then, Proposition \ref{prop.rec.matrix-1} \textbf{(b)} (applied to
$n-1$ and $0$ instead of $n$ and $i$) yields $A^{n-1}v_{0}=v_{0+n-1}=v_{n-1}$.
Also, Proposition \ref{prop.rec.matrix-1} \textbf{(b)} (applied to $n-1$ and
$1$ instead of $n$ and $i$) yields $A^{n-1}v_{1}=v_{1+n-1}=v_{n}$. But the
definition of $V_{0}$ yields $V_{0}=\left(  v_{0}\mid v_{1}\right)  $. Hence,%
\begin{align*}
A^{n-1}\underbrace{V_{0}}_{=\left(  v_{0}\mid v_{1}\right)  }  &
=A^{n-1}\left(  v_{0}\mid v_{1}\right)  =\left(  A^{n-1}v_{0}\mid A^{n-1}%
v_{1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.rec.cassini.Buv}), applied
to }B=A^{n-1}\text{, }u=v_{0}\text{ and }v=v_{1}\right) \\
&  =\left(  v_{n-1}\mid v_{n}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since
}A^{n-1}v_{0}=v_{n-1}\text{ and }A^{n-1}v_{1}=v_{n}\right) \\
&  =V_{n-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }V_{n-1}\text{ was defined
as }\left(  v_{n-1}\mid v_{n}\right)  \right)  .
\end{align*}
Hence,%
\[
\det\left(  A^{n-1}V_{0}\right)  =\det\left(  V_{n-1}\right)  =x_{n-1}%
x_{n+1}-x_{n}^{2}%
\]
(by (\ref{sol.rec.cassini.detVi=}), applied to $i=n-1$). Therefore,%
\begin{align}
&  x_{n-1}x_{n+1}-x_{n}^{2}\nonumber\\
&  =\det\left(  A^{n-1}V_{0}\right)  =\underbrace{\det\left(  A^{n-1}\right)
}_{\substack{=\left(  \det A\right)  ^{n-1}\\\text{(by
(\ref{sol.rec.cassini.detBk=}), applied to }n=2\text{, }B=A\text{ and
}k=n-1\text{)}}}\underbrace{\det\left(  V_{0}\right)  }_{\substack{=x_{0}%
x_{2}-x_{1}^{2}\\\text{(by (\ref{sol.rec.cassini.detVi=}), applied to
}i=0\text{)}}}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.rec.cassini.detUV=}),
applied to }2\text{, }A^{n-1}\text{ and }V_{0}\text{ instead of }n\text{,
}A\text{ and }B\right) \nonumber\\
&  =\left(  \det A\right)  ^{n-1}\cdot\left(  x_{0}x_{2}-x_{1}^{2}\right)  .
\label{sol.rec.cassini.at}%
\end{align}
But $A=\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  $ and thus $\det A=\det\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  =0a-1b=-b$. Hence, (\ref{sol.rec.cassini.at}) rewrites as
$x_{n-1}x_{n+1}-x_{n}^{2}=\left(  -b\right)  ^{n-1}\cdot\left(  x_{0}%
x_{2}-x_{1}^{2}\right)  $. In other words, $x_{n+1}x_{n-1}-x_{n}^{2}=\left(
-b\right)  ^{n-1}\left(  x_{2}x_{0}-x_{1}^{2}\right)  $. This solves Exercise
\ref{exe.rec.cassini} again.
\end{proof}

Another application of Proposition \ref{prop.rec.matrix-1} is a second proof
of Theorem \ref{thm.rec.binet} (recall that the first proof was sketched in
our discussion of Exercise \ref{exe.rec.binet}):

\begin{proof}
[Second proof of Theorem \ref{thm.rec.binet} (sketched).]Let $A$ be the
$2\times2$-matrix $\left(
\begin{array}
[c]{cc}%
0 & 1\\
b & a
\end{array}
\right)  $. Proposition \ref{prop.rec.matrix-1} \textbf{(b)} (applied to
$i=0$) yields that each $n\in\mathbb{N}$ satisfies%
\begin{equation}
A^{n}v_{0}=v_{0+n}=v_{n}=\left(
\begin{array}
[c]{c}%
x_{n}\\
x_{n+1}%
\end{array}
\right)  \label{pf.thm.rec.binet.Anv0}%
\end{equation}
(by the definition of $v_{n}$). We thus obtain an explicit formula for $v_{n}$
if we have an explicit formula for $A^{n}$.

How can we find an explicit formula for $A^{n}$ ? In linear algebra, the
powers of a matrix are easiest to compute by diagonalizing the matrix. Indeed,
if we can diagonalize the matrix $A$ as $A=TDT^{-1}$ (with $T$ invertible and
$D$ diagonal), then
\begin{equation}
A^{n}=TD^{n}T^{-1}\ \ \ \ \ \ \ \ \ \ \text{for every }n\in\mathbb{N}.
\label{pf.thm.rec.binet.An-via-Dn}%
\end{equation}
(If you don't know this, you can easily prove it by induction on $n$.) For a
diagonal matrix $D$, computing its powers $D^{n}$ is a trivial task (it
suffices to take each diagonal entry of $D$ to the $n$-th power). Thus, in
order to compute $A^{n}$, it will suffice to diagonalize $A$.

Not every square matrix can be diagonalized; however, over the complex
numbers, \textquotedblleft most\textquotedblright\ matrices can
be\footnote{The word \textquotedblleft most\textquotedblright\ here can be
interpreted in many ways, most of which are correct :)
\par
We will soon see what it means in our specific case.}. Diagonalizing a matrix
is particularly easy for a $2\times2$-matrix like $A$, since it only requires
solving a quadratic (as opposed to a higher-degree) equation. Let me omit the
details and merely state the result:

\begin{itemize}
\item If $a^{2}+4b\neq0$, then $A$ can be diagonalized as $A=TDT^{-1}$, where
we define two complex numbers $\lambda$ and $\mu$ as in
(\ref{eq.thm.rec.binet.a.lm}) and set%
\[
D=\operatorname*{diag}\left(  \lambda,\mu\right)  =\left(
\begin{array}
[c]{cc}%
\lambda & 0\\
0 & \mu
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ T=\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  .
\]
(The appearance of the numbers $\lambda$ and $\mu$ should not be surprising:
They are the two eigenvalues of $A$.)

\item If $a^{2}+4b=0$, then $A$ cannot be diagonalized.
\end{itemize}

Let us first draw some conclusions in the case $a^{2}+4b\neq0$, and then
discuss what can be done in the case $a^{2}+4b=0$.

Assume that $a^{2}+4b\neq0$. Then, we have just found a way to diagonalize
$A$. Namely, we have defined two complex numbers $\lambda$ and $\mu$ as in
(\ref{eq.thm.rec.binet.a.lm}), and we have set%
\[
D=\operatorname*{diag}\left(  \lambda,\mu\right)  =\left(
\begin{array}
[c]{cc}%
\lambda & 0\\
0 & \mu
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ T=\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  .
\]
Then, $A=TDT^{-1}$. Thus, for each $n\in\mathbb{N}$, we have
\begin{align*}
A^{n}  &  =TD^{n}T^{-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.rec.binet.An-via-Dn})}\right) \\
&  =\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  \left(
\begin{array}
[c]{cc}%
\lambda & 0\\
0 & \mu
\end{array}
\right)  ^{n}\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  ^{-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }T=\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  \text{ and }D=\left(
\begin{array}
[c]{cc}%
\lambda & 0\\
0 & \mu
\end{array}
\right)  \right) \\
&  =\left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  \left(
\begin{array}
[c]{cc}%
\lambda^{n} & 0\\
0 & \mu^{n}%
\end{array}
\right)  \left(
\begin{array}
[c]{cc}%
1 & 1\\
\lambda & \mu
\end{array}
\right)  ^{-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
\begin{array}
[c]{cc}%
\lambda & 0\\
0 & \mu
\end{array}
\right)  ^{n}=\left(
\begin{array}
[c]{cc}%
\lambda^{n} & 0\\
0 & \mu^{n}%
\end{array}
\right)  \right) \\
&  =\left(
\begin{array}
[c]{cc}%
\dfrac{\lambda\mu^{n}-\lambda^{n}\mu}{\lambda-\mu} & \dfrac{\lambda^{n}%
-\mu^{n}}{\lambda-\mu}\\
-\lambda\mu\dfrac{\lambda^{n}-\mu^{n}}{\lambda-\mu} & \dfrac{\lambda
\lambda^{n}-\mu\mu^{n}}{\lambda-\mu}%
\end{array}
\right)
\end{align*}
(by straightforward matrix computations). Hence,%
\begin{align}
A^{n}v_{0}  &  =\left(
\begin{array}
[c]{cc}%
\dfrac{\lambda\mu^{n}-\lambda^{n}\mu}{\lambda-\mu} & \dfrac{\lambda^{n}%
-\mu^{n}}{\lambda-\mu}\\
-\lambda\mu\dfrac{\lambda^{n}-\mu^{n}}{\lambda-\mu} & \dfrac{\lambda
\lambda^{n}-\mu\mu^{n}}{\lambda-\mu}%
\end{array}
\right)  \left(
\begin{array}
[c]{c}%
x_{0}\\
x_{1}%
\end{array}
\right) \nonumber\\
&  =\left(
\begin{array}
[c]{c}%
\dfrac{\lambda\mu^{n}-\lambda^{n}\mu}{\lambda-\mu}x_{0}+\dfrac{\lambda^{n}%
-\mu^{n}}{\lambda-\mu}x_{1}\\
\ast
\end{array}
\right)  . \label{pf.thm.rec.binet.Anv02}%
\end{align}
Here, the asterisk $\ast$ in the bottom row means \textquotedblleft we don't
care what the value here is\textquotedblright\ (we will see why in a moment).
Comparing this with (\ref{pf.thm.rec.binet.Anv0}), we obtain%
\[
\left(
\begin{array}
[c]{c}%
x_{n}\\
x_{n+1}%
\end{array}
\right)  =\left(
\begin{array}
[c]{c}%
\dfrac{\lambda\mu^{n}-\lambda^{n}\mu}{\lambda-\mu}x_{0}+\dfrac{\lambda^{n}%
-\mu^{n}}{\lambda-\mu}x_{1}\\
\ast
\end{array}
\right)  .
\]
Comparing the top entries of the vectors on both sides of this equality, we
find%
\[
x_{n}=\dfrac{\lambda\mu^{n}-\lambda^{n}\mu}{\lambda-\mu}x_{0}+\dfrac
{\lambda^{n}-\mu^{n}}{\lambda-\mu}x_{1}=\dfrac{x_{1}-\mu x_{0}}{\lambda-\mu
}\lambda^{n}+\dfrac{\lambda x_{0}-x_{1}}{\lambda-\mu}\mu^{n}=\gamma\lambda
^{n}+\delta\mu^{n},
\]
where $\gamma$ and $\delta$ are as in (\ref{eq.thm.rec.binet.a.gd}). So we
have recovered the formula (\ref{eq.thm.rec.binet.a.eq}) and thus reproved
Theorem \ref{thm.rec.binet} \textbf{(a)}. Note that this approach to finding
an explicit formula for $x_{n}$ was entirely self-motivated (assuming that you
know about diagonalization of matrices); unlike our first approach above, it
did not rely on us reverse-engineering the Binet formula (which came out of
clear skies).

Let us now consider the case when $a^{2}+4b=0$. In this case, the matrix $A$
cannot be diagonalized. The closest thing to a diagonalization in such a case
is the \textit{Jordan normal form} (see, e.g., \cite[Chapter Five, Section
IV]{Heffer20}). Again omitting the details, a computation shows that the
Jordan normal form of $A$ is%
\[
A=TJT^{-1},
\]
where%
\[
T=\left(
\begin{array}
[c]{cc}%
0 & 1\\
1 & \dfrac{a}{2}%
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ J=\left(
\begin{array}
[c]{cc}%
\dfrac{a}{2} & 0\\
1 & \dfrac{a}{2}%
\end{array}
\right)  .
\]
(The computation is best done by rewriting $b$ as $\dfrac{-a^{2}}{4}$ right
away, thus getting rid of the dependent parameter $b$.) In order to compute
$A^{n}$, we thus need to know how to compute $J^{n}$. Fortunately, there is a
formula for this:%
\begin{equation}
\left(
\begin{array}
[c]{cc}%
d & 0\\
u & d
\end{array}
\right)  ^{n}=\left(
\begin{array}
[c]{cc}%
d^{n} & 0\\
nd^{n-1}u & d^{n}%
\end{array}
\right)  \label{pf.thm.rec.binet.2nd.dudn}%
\end{equation}
for any numbers $d$ and $u$ and any $n\in\mathbb{N}$ (where we agree to
interpret $nd^{n-1}$ as $0$ when $n=0$). This formula
(\ref{pf.thm.rec.binet.2nd.dudn}) is a particular case of a general rule for
taking powers of Jordan blocks, but it also can easily be proved
directly\footnote{With our induction experience, we can prove it in our
sleep.}. Now, from $A=TJT^{-1}$, we obtain%
\[
A^{n}=TJ^{n}T^{-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.rec.binet.An-via-Dn}), applied to }J\text{ instead of }D\right)
\]
for each $n\in\mathbb{N}$. Recalling how $T$ and $J$ were defined, and using
(\ref{pf.thm.rec.binet.2nd.dudn}) to compute $J^{n}$, we thus get an explicit
expression for $A^{n}$, which we can then turn into an explicit expression for
$x_{n}$ in the same way as we did in the case $a^{2}+4b\neq0$ above. Thus we
recover Theorem \ref{thm.rec.binet} \textbf{(b)}.
\end{proof}

\subsubsection{\label{subsect.rec4}Recitation \#4: Two-term recurrences}

Here are two more exercises on $\left(  a,b\right)  $-recurrent sequences:

\begin{exercise}
\label{exe.rec.1-2-rec.1}Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of integers recursively by setting $a_{0}=2$ and $a_{1}=1$
and $a_{n}=a_{n-1}+2a_{n-2}$ for each $n\geq2$.

Find an explicit formula for $a_{n}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.1-2-rec.1}.]The most systematic approach
to this is by using Theorem \ref{thm.rec.binet}. Indeed, the sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ is $\left(  1,2\right)  $-recurrent (due to
the equality $a_{n}=a_{n-1}+2a_{n-2}$ that holds for each $n\geq2$). Since
$1^{2}+4\cdot2=9\neq0$, we can thus apply Theorem \ref{thm.rec.binet}
\textbf{(a)} to $a=1$ and $b=2$ and $x_{i}=a_{i}$. We thus conclude that every
$n\in\mathbb{N}$ satisfies%
\begin{equation}
a_{n}=\gamma\lambda^{n}+\delta\mu^{n}, \label{sol.rec.1-2-rec.1.1}%
\end{equation}
where we set%
\begin{equation}
\lambda=\dfrac{1+\sqrt{1^{2}+4\cdot1}}{2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \mu=\dfrac{1-\sqrt{1^{2}+4\cdot1}}{2}
\label{sol.rec.1-2-rec.1.1lm}%
\end{equation}
and%
\begin{equation}
\gamma=\dfrac{a_{1}-\mu a_{0}}{\lambda-\mu}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ \delta=\dfrac{\lambda a_{0}-a_{1}}{\lambda-\mu}.
\label{sol.rec.1-2-rec.1.1gd}%
\end{equation}
The equalities (\ref{sol.rec.1-2-rec.1.1lm}) yield%
\begin{align*}
\lambda &  =\dfrac{1+\sqrt{1^{2}+4\cdot1}}{2}=\dfrac{1+\sqrt{9}}{2}%
=\dfrac{1+3}{2}=2\ \ \ \ \ \ \ \ \ \ \text{and}\\
\mu &  =\dfrac{1-\sqrt{1^{2}+4\cdot1}}{2}=\dfrac{1-\sqrt{9}}{2}=\dfrac{1-3}%
{2}=-1.
\end{align*}
Hence, (\ref{sol.rec.1-2-rec.1.1gd}) yields%
\begin{align*}
\gamma &  =\dfrac{a_{1}-\mu a_{0}}{\lambda-\mu}=\dfrac{1-\left(  -1\right)
\cdot2}{2-\left(  -1\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
\lambda=2\text{ and }\mu=-1\text{ and }a_{0}=2\text{ and }a_{1}=1\right) \\
&  =1
\end{align*}
and (by a similar computation) $\delta=1$. Thus, (\ref{sol.rec.1-2-rec.1.1})
shows that every $n\in\mathbb{N}$ satisfies%
\[
a_{n}=\underbrace{\gamma}_{=1}\lambda^{n}+\underbrace{\delta}_{=1}\mu
^{n}=\lambda^{n}+\mu^{n}=2^{n}+\left(  -1\right)  ^{n}%
\]
(since $\lambda=2$ and $\mu=-1$). This solves Exercise \ref{exe.rec.1-2-rec.1}.

Here are two alternative ways to get the formula $a_{n}=2^{n}+\left(
-1\right)  ^{n}$:

\begin{itemize}
\item One can simply compute the first few entries of the sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ and observe that they each differ by $1$
from the respective powers of $2$. The formula $a_{n}=2^{n}+\left(  -1\right)
^{n}$ is then easily guessed and just as easily proved (by strong induction on
$n$).

\item Here is a more sophisticated approach: Rewrite the recursive relation
$a_{n}=a_{n-1}+2a_{n-2}$ as $a_{n}+a_{n-1}=2\left(  a_{n-1}+a_{n-2}\right)  $
(indeed, adding $a_{n-1}$ to both sides of $a_{n}=a_{n-1}+2a_{n-2}$ yields
$a_{n}+a_{n-1}=2a_{n-1}+2a_{n-2}=2\left(  a_{n-1}+a_{n-2}\right)  $). We can
rewrite the latter equation as $b_{n-1}=2b_{n-2}$, where we define an
auxiliary sequence $\left(  b_{0},b_{1},b_{2},\ldots\right)  $ by
$b_{m}:=a_{m}+a_{m+1}$. So we have $b_{n-1}=2b_{n-2}$ for each $n\geq2$;
equivalently, $b_{m}=2b_{m-1}$ for each $m\geq1$. In other words, each entry
of the sequence $\left(  b_{0},b_{1},b_{2},\ldots\right)  $ equals twice the
preceding entry. In other words, the sequence $\left(  b_{0},b_{1}%
,b_{2},\ldots\right)  $ is a geometric progression with ratio $2$. Thus,
$b_{m}=2^{m}b_{0}$ for each $m\in\mathbb{N}$. In view of $b_{0}%
=\underbrace{a_{0}}_{=2}+\underbrace{a_{1}}_{=1}=2+1=3$, this rewrites as
$b_{m}=2^{m}\cdot3$ for each $m\in\mathbb{N}$.

Now, how do we recover the $a_{n}$ from the $b_{m}$ ? Experiments with small
entries suggest (and a simple argument using the telescope principle proves)
that%
\[
a_{n}=b_{n-1}-b_{n-2}+b_{n-3}-b_{n-4}\pm\cdots\pm b_{0}\pm\left(
-a_{0}\right)  .
\]
(The last two $\pm$ signs are $+$ signs if $n$ is odd, and $-$ signs if $n$ is
even.) Plugging our formula $b_{m}=2^{m}\cdot3$ into this equality, and
summing the resulting geometric sum, we eventually obtain $a_{n}=2^{n}+\left(
-1\right)  ^{n}$.
\end{itemize}
\end{proof}

\begin{exercise}
\label{exe.fib.round-and-phin}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Let $\varphi=\dfrac{1+\sqrt{5}}{2}$.

\textbf{(a)} Prove that $f_{n}=\left\lfloor \dfrac{1}{\sqrt{5}}\varphi
^{n}+\dfrac{1}{2}\right\rfloor $ for each $n\in\mathbb{N}$.

\textbf{(b)} Prove that $\varphi^{n}=f_{n-1}+f_{n}\varphi$ for each positive
integer $n$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.round-and-phin}.]\textbf{(a)} First, we
observe that if $u$ is a real number, then $\left\lfloor u+\dfrac{1}%
{2}\right\rfloor $ is the result of \textquotedblleft
rounding\textquotedblright\ $u$ to the nearest integer (where a possible tie
is resolved in favor of the larger integer\footnote{For example, $\dfrac{1}%
{2}=0.5$ is rounded to $1$, not to $0$.}). Thus, we have the following:

\begin{statement}
\textit{Claim 1:} Let $u\in\mathbb{R}$. Let $v\in\mathbb{Z}$ be such that
$v-\dfrac{1}{2}\leq u<v+\dfrac{1}{2}$. Then, $\left\lfloor u+\dfrac{1}%
{2}\right\rfloor =v$.
\end{statement}

\begin{fineprint}
[\textit{Proof of Claim 1:} For the sake of completeness, let us give a formal
proof of this. Let $x=u+\dfrac{1}{2}$. Adding $\dfrac{1}{2}$ to all sides of
the inequality chain $v-\dfrac{1}{2}\leq u<v+\dfrac{1}{2}$, we obtain $v\leq
u+\dfrac{1}{2}<v+\dfrac{1}{2}+\dfrac{1}{2}$. In other words, $v\leq x<v+1$
(since $u+\dfrac{1}{2}=x$ and $v+\dfrac{1}{2}+\dfrac{1}{2}=v+1$). Thus, the
integer $v$ is $\leq x$ (since $v\leq x$), but the next integer $v+1$ is no
longer $\leq x$ (since $x<v+1$). Hence, the largest integer that is $\leq x$
is $v$. In other words, $\left\lfloor x\right\rfloor $ is $v$ (since
$\left\lfloor x\right\rfloor $ was defined as the largest integer that is
$\leq x$). In other words, $\left\lfloor x\right\rfloor =v$. This rewrites as
$\left\lfloor u+\dfrac{1}{2}\right\rfloor =v$ (since $x=u+\dfrac{1}{2}$). This
proves Claim 1.]
\end{fineprint}

Now, let us apply this. Set $\psi=\dfrac{1-\sqrt{5}}{2}$. Then, $\psi
\approx-0.618$, so that $\left\vert \psi\right\vert \leq1$.

Let $n\in\mathbb{N}$. Then, Theorem \ref{thm.fib.binet} yields $f_{n}%
=\dfrac{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}}\psi^{n}$, so that%
\begin{equation}
\dfrac{1}{\sqrt{5}}\varphi^{n}=f_{n}+\dfrac{1}{\sqrt{5}}\psi^{n}.
\label{sol.fib.round-and-phin.a.binet}%
\end{equation}
However, $\left\vert \psi^{n}\right\vert =\left\vert \psi\right\vert ^{n}%
\leq1$ (since $\left\vert \psi\right\vert \leq1$), so that $\left\vert
\dfrac{1}{\sqrt{5}}\psi^{n}\right\vert =\dfrac{1}{\sqrt{5}}%
\underbrace{\left\vert \psi^{n}\right\vert }_{\leq1}\leq\dfrac{1}{\sqrt{5}%
}<\dfrac{1}{2}$. In other words, the number $\dfrac{1}{\sqrt{5}}\psi^{n}$ lies
in the open interval $\left(  -\dfrac{1}{2},\dfrac{1}{2}\right)  $; in other
words, $-\dfrac{1}{2}<\dfrac{1}{\sqrt{5}}\psi^{n}<\dfrac{1}{2}$. Hence,
(\ref{sol.fib.round-and-phin.a.binet}) entails%
\[
\dfrac{1}{\sqrt{5}}\varphi^{n}=f_{n}+\underbrace{\dfrac{1}{\sqrt{5}}\psi^{n}%
}_{<\dfrac{1}{2}}<f_{n}+\dfrac{1}{2}%
\]
and%
\[
\dfrac{1}{\sqrt{5}}\varphi^{n}=f_{n}+\underbrace{\dfrac{1}{\sqrt{5}}\psi^{n}%
}_{>-\dfrac{1}{2}}>f_{n}+\left(  -\dfrac{1}{2}\right)  =f_{n}-\dfrac{1}{2}.
\]
Combining the latter two inequalities, we find $f_{n}-\dfrac{1}{2}<\dfrac
{1}{\sqrt{5}}\varphi^{n}<f_{n}+\dfrac{1}{2}$. Hence, Claim 1 (applied to
$u=\dfrac{1}{\sqrt{5}}\varphi^{n}$ and $v=f_{n}$) yields that $\left\lfloor
\dfrac{1}{\sqrt{5}}\varphi^{n}+\dfrac{1}{2}\right\rfloor =f_{n}$ (since
$f_{n}\in\mathbb{Z}$). This solves Exercise \ref{exe.fib.round-and-phin}
\textbf{(a)}.

\textbf{(b)} We apply induction on $n$:

\textit{Induction base:} We have $\varphi^{1}=f_{0}+f_{1}\varphi$ (since
$\underbrace{f_{0}}_{=0}+\underbrace{f_{1}}_{=1}\varphi=0+1\varphi
=\varphi=\varphi^{1}$). In other words, Exercise \ref{exe.fib.round-and-phin}
\textbf{(b)} holds for $n=1$.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Exercise \ref{exe.fib.round-and-phin} \textbf{(b)}
holds for $n=m$. We must prove that Exercise \ref{exe.fib.round-and-phin}
\textbf{(b)} holds for $n=m+1$. In other words, we must prove that
$\varphi^{m+1}=f_{m}+f_{m+1}\varphi$.

We have $\varphi^{2}=\varphi+1$. (This is easily seen by calculation using the
definition of $\varphi$.) Also, the recursive definition of the Fibonacci
sequence yields $f_{m+1}=f_{m}+f_{m-1}=f_{m-1}+f_{m}$.

Our induction hypothesis says that Exercise \ref{exe.fib.round-and-phin}
\textbf{(b)} holds for $n=m$. In other words, we have $\varphi^{m}%
=f_{m-1}+f_{m}\varphi$. Now,%
\begin{align*}
\varphi^{m+1}  &  =\underbrace{\varphi^{m}}_{=f_{m-1}+f_{m}\varphi}%
\varphi=\left(  f_{m-1}+f_{m}\varphi\right)  \varphi=f_{m-1}\varphi
+f_{m}\underbrace{\varphi^{2}}_{=\varphi+1}=f_{m-1}\varphi+f_{m}\left(
\varphi+1\right) \\
&  =f_{m-1}\varphi+f_{m}\varphi+f_{m}=\underbrace{\left(  f_{m-1}%
+f_{m}\right)  }_{=f_{m+1}}\varphi+f_{m}=f_{m+1}\varphi+f_{m}=f_{m}%
+f_{m+1}\varphi.
\end{align*}
In other words, Exercise \ref{exe.fib.round-and-phin} \textbf{(b)} holds for
$n=m+1$. This completes the induction step. Thus, Exercise
\ref{exe.fib.round-and-phin} \textbf{(b)} is solved.
\end{proof}

\subsubsection{Two-term recurrences: arithmetical properties}

Generalizing is a muscle worth training, so let us generalize a few more
properties of Fibonacci numbers to $\left(  a,b\right)  $-recurrent sequences.
The next exercise generalizes Exercise \ref{exe.ent.mod.fn-div} (note that we
are using $\left(  u,v\right)  $ instead of $\left(  a,b\right)  $ in order to
avoid assigning double duty to the letters $a$ and $b$):

\begin{exercise}
\label{exe.ent.rec.fn-div}Let $u$ and $v$ be two integers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  u,v\right)  $-recurrent
sequence of integers with $x_{0}=0$ and $x_{1}=1$.

Show that all $a,b\in\mathbb{N}$ satisfying $a\mid b$ satisfy $x_{a}\mid
x_{b}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.rec.fn-div}.]We essentially repeat our
above solution to Exercise \ref{exe.ent.mod.fn-div}, with the obvious changes
made at every step where they are necessary.

\begin{noncompile}
The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
u,v\right)  $-recurrent. Hence, $x_{0},x_{1},x_{2},\ldots$ are integers (since
$x_{0}$, $x_{1}$, $u$ and $v$ are integers). Thus, the claim we are trying to
prove makes sense.
\end{noncompile}

Fix $a\in\mathbb{N}$. We must prove that for each $b\in\mathbb{N}$, the
following statement holds:%
\begin{equation}
\text{if }a\mid b\text{, then }x_{a}\mid x_{b}.
\label{sol.ent.rec.fn-div.goal}%
\end{equation}


We shall prove (\ref{sol.ent.rec.fn-div.goal}) by strong induction on $b$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ent.rec.fn-div.goal}) holds for all $b<k$. We must
prove that (\ref{sol.ent.rec.fn-div.goal}) holds for $b=k$. In other words, we
must prove that%
\[
\text{if }a\mid k\text{, then }x_{a}\mid x_{k}.
\]


So let us assume that $a\mid k$. We must then prove that $x_{a}\mid x_{k}$.

If $k=0$, then this is clearly true (since we have $x_{k}=x_{0}=0$ in this
case, and since $x_{a}\mid0$ is true\footnote{because any integer divides $0$%
}). Thus, for the rest of this proof, we WLOG assume that $k\neq0$. Hence,
$k\geq1$ (since $k\in\mathbb{N}$).

It is fairly easy to see (from $a\mid k$ and $k\geq1$ and $a\in\mathbb{N}$)
that $a\geq1$ and $k-a\in\mathbb{N}$ and $k-a<k$ and $a\mid k-a$%
\ \ \ \ \footnote{These statements can be proved in the same way as they were
proved in the respective part of the solution to Exercise
\ref{exe.ent.mod.fn-div}.}. From $a\geq1$, we obtain $a-1\in\mathbb{N}$.

Our induction hypothesis says that (\ref{sol.ent.rec.fn-div.goal}) holds for
all $b<k$. In other words, for each $b\in\mathbb{N}$ satisfying $b<k$, the
statement (\ref{sol.ent.rec.fn-div.goal}) holds. We can apply this to $b=k-a$
(since $k-a\in\mathbb{N}$ and $k-a<k$), and thus conclude that the statement
(\ref{sol.ent.rec.fn-div.goal}) holds for $b=k-a$. In other words, if $a\mid
k-a$, then $x_{a}\mid x_{k-a}$. Thus, $x_{a}\mid x_{k-a}$ (since we know that
$a\mid k-a$). In other words, $x_{k-a}\equiv0\operatorname{mod}x_{a}$. Note
also that $x_{a}\equiv0\operatorname{mod}x_{a}$ (since every integer $n$
satisfies $n\equiv0\operatorname{mod}n$).

But Exercise \ref{exe.rec.addition01} (applied to $u$, $v$ and $x_{i}$ instead
of $a$, $b$ and $y_{i}$) shows that%
\[
x_{n+m+1}=vx_{n}x_{m}+x_{n+1}x_{m+1}%
\]
for any nonnegative integers $n$ and $m$. We can apply this to $n=a-1$ and
$m=k-a$ (since $a-1\in\mathbb{N}$ and $k-a\in\mathbb{N}$); thus, we obtain%
\[
x_{\left(  a-1\right)  +\left(  k-a\right)  +1}=vx_{a-1}x_{k-a}+x_{\left(
a-1\right)  +1}x_{\left(  k-a\right)  +1}.
\]
In view of $\left(  a-1\right)  +\left(  k-a\right)  +1=k$ and $\left(
a-1\right)  +1=a$, this rewrites as%
\[
x_{k}=vx_{a-1}x_{k-a}+x_{a}x_{\left(  k-a\right)  +1}.
\]


Hence,%
\[
x_{k}=vx_{a-1}\underbrace{x_{k-a}}_{\equiv0\operatorname{mod}x_{a}%
}+\underbrace{x_{a}}_{\equiv0\operatorname{mod}x_{a}}x_{\left(  k-a\right)
+1}\equiv vx_{a-1}\cdot0+0\cdot x_{\left(  k-a\right)  +1}=0\operatorname{mod}%
x_{a},
\]
and thus $x_{a}\mid x_{k}$. This is precisely what we wanted to show. Thus, we
have proved that (\ref{sol.ent.rec.fn-div.goal}) holds for $b=k$. This
completes the induction step. Thus, Exercise \ref{exe.ent.rec.fn-div} is solved.
\end{proof}

Exercise \ref{exe.ent.rec.fn-div} also appears in \cite[Theorem 2.26
\textbf{(c)}]{detnotes} (with different notations). Note that the $x_{1}=1$
condition is not actually necessary for the claim to hold (see Exercise
\ref{exe.ent.rec.fn-div-not-1} below); it was merely convenient for our proof.
The $x_{0}=0$ condition, on the other hand, is \textquotedblleft more or less
necessary\textquotedblright\ (i.e., if $x_{0}\neq0$, then the claim of
Exercise \ref{exe.ent.rec.fn-div} holds only in a few exceptional
cases\footnote{such as when $u+v=1$ and $x_{0}=x_{1}=x_{2}=x_{3}=\cdots$}).

Next, let us generalize Exercise \ref{exe.sol.fib.gcd-nbrs}:

\begin{exercise}
\label{exe.ent.rec.gcd-nbrs}Let $u$ and $v$ be two integers satisfying $u\perp
v$. Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  u,v\right)
$-recurrent sequence of integers with $x_{1}=1$.

Prove that $x_{n}\perp x_{n+1}$ for each $n\in\mathbb{N}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.rec.gcd-nbrs}.]Let us try to imitate the
solution to Exercise \ref{exe.sol.fib.gcd-nbrs}. Thus, we use induction on $n$.

\textit{Induction base:} Exercise \ref{exe.ent.coprime.01} \textbf{(a)}
(applied to $a=x_{0}$) yields $1\perp x_{0}$. According to Proposition
\ref{prop.ent.coprime.perp-symm}, this entails $x_{0}\perp1$. In other words,
$x_{0}\perp x_{1}$ (since $x_{1}=1$). In other words, Exercise
\ref{exe.ent.rec.gcd-nbrs} holds for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.ent.rec.gcd-nbrs} holds for $n=m$. We must
prove that Exercise \ref{exe.ent.rec.gcd-nbrs} holds for $n=m+1$. In other
words, we must prove that $x_{m+1}\perp x_{m+2}$.

Our induction hypothesis says that Exercise \ref{exe.ent.rec.gcd-nbrs} holds
for $n=m$. In other words, we have $x_{m}\perp x_{m+1}$. According to
Proposition \ref{prop.ent.coprime.perp-symm} (applied to $a=x_{m}$ and
$b=x_{m+1}$), this entails $x_{m+1}\perp x_{m}$. In other words, $\gcd\left(
x_{m+1},x_{m}\right)  =1$ (by the definition of \textquotedblleft
coprime\textquotedblright). But the sequence $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  $ is $\left(  u,v\right)  $-recurrent; thus, $x_{m+2}%
=ux_{m+1}+vx_{m}$. Hence,%
\begin{align*}
\gcd\left(  x_{m+1},x_{m+2}\right)   &  =\gcd\left(  x_{m+1},ux_{m+1}%
+vx_{m}\right)  =\gcd\left(  x_{m+1},vx_{m}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.gcd.props1}
\textbf{(c)}, applied to }a=x_{m+1}\text{ and }b=vx_{m}\right)  .
\end{align*}
It would be nice if we knew that $x_{m+1}\perp vx_{m}$, since that would yield
$\gcd\left(  x_{m+1},vx_{m}\right)  =1$ and we could proceed. Unfortunately,
we only know that $x_{m+1}\perp x_{m}$, which is weaker. What should we do?

Theorem \ref{thm.ent.coprime.ab-to-c} suggests a way we could try to prove
$x_{m+1}\perp vx_{m}$. Namely, if we know that $v\perp x_{m+1}$ and
$x_{m}\perp x_{m+1}$, then an application of Theorem
\ref{thm.ent.coprime.ab-to-c} would yield $vx_{m}\perp x_{m+1}$, and therefore
$x_{m+1}\perp vx_{m}$ (by Proposition \ref{prop.ent.coprime.perp-symm}). The
two necessary ingredients for this argument to work are $v\perp x_{m+1}$ and
$x_{m}\perp x_{m+1}$. We already know that $x_{m}\perp x_{m+1}$, but how do we
get $v\perp x_{m+1}$ ?

The way out of this predicament turns out to be a highly important strategy
that can be useful wherever induction is in play. Namely, we \textbf{insert}
\textquotedblleft$v\perp x_{m+1}$\textquotedblright\ into our induction
hypothesis! This means that, instead of proving the claim \textquotedblleft%
$x_{n}\perp x_{n+1}$\textquotedblright, we prove the stronger claim
\textquotedblleft$x_{n}\perp x_{n+1}$ and $v\perp x_{n+1}$\textquotedblright.
This may look more difficult (after all, we now have to prove two statements
rather than one), but in practice it may turn out to be more doable, as the
extra strength of our claim makes the induction hypothesis stronger as well
(after all, the induction hypothesis now also contains two statements rather
than one). Thus, in the induction step, we have both more work and more to
work with.

What happens if we insert $v\perp x_{n+1}$ into our claim? In the base case,
we just have to show (additionally) that $v\perp x_{1}$, which is easy (since
$x_{1}=1$). In the induction step, we have to show (additionally) that $v\perp
x_{m+2}$, but we can use $v\perp x_{m+1}$ (which is now part of the induction hypothesis).

So how do we show that $v\perp x_{m+2}$ in the induction step? We compute%
\begin{align*}
\gcd\left(  v,x_{m+2}\right)   &  =\gcd\left(  v,x_{m}v+ux_{m+1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }x_{m+2}=ux_{m+1}+vx_{m}%
=x_{m}v+ux_{m+1}\right) \\
&  =\gcd\left(  v,ux_{m+1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.gcd.props1} \textbf{(c)}, applied to
}v\text{, }ux_{m+1}\text{ and }x_{m}\\
\text{instead of }a\text{, }b\text{ and }u
\end{array}
\right) \\
&  =1,
\end{align*}
where the last equality sign follows from noticing that $v\perp ux_{m+1}$
(which, in turn, follows from $v\perp u$ and $v\perp x_{m+1}$ using Theorem
\ref{thm.ent.coprime.ab-to-c}). So we get $v\perp x_{m+2}$, and we win: Our
stronger claim \textquotedblleft$x_{n}\perp x_{n+1}$ and $v\perp x_{n+1}%
$\textquotedblright\ has turned out to be easier to prove than the original
claim \textquotedblleft$x_{n}\perp x_{n+1}$\textquotedblright.
\end{proof}

For the sake of clarity, let me distill the above discussion into a detailed
solution to Exercise \ref{exe.ent.rec.gcd-nbrs}:

\begin{proof}
[Solution to Exercise \ref{exe.ent.rec.gcd-nbrs} (final copy).]We claim that
each $n\in\mathbb{N}$ satisfies%
\begin{equation}
x_{n}\perp x_{n+1}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ v\perp
x_{n+1}. \label{sol.ent.rec.gcd-nbrs.goal}%
\end{equation}


[\textit{Proof of (\ref{sol.ent.rec.gcd-nbrs.goal}):} We shall prove
(\ref{sol.ent.rec.gcd-nbrs.goal}) by induction on $n$:

\textit{Induction base:} Exercise \ref{exe.ent.coprime.01} \textbf{(a)}
(applied to $a=x_{0}$) yields $1\perp x_{0}$. According to Proposition
\ref{prop.ent.coprime.perp-symm} (applied to $a=1$ and $b=x_{0}$), this
entails $x_{0}\perp1$. In other words, $x_{0}\perp x_{1}$ (since $x_{1}=1$).
The same argument (applied to $v$ instead of $x_{0}$) yields $v\perp x_{1}$.
We have now shown that $x_{0}\perp x_{1}$ and $v\perp x_{1}$. In other words,
(\ref{sol.ent.rec.gcd-nbrs.goal}) holds for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ent.rec.gcd-nbrs.goal}) holds for $n=m$. We must
prove that (\ref{sol.ent.rec.gcd-nbrs.goal}) holds for $n=m+1$. In other
words, we must prove that $x_{m+1}\perp x_{m+2}$ and $v\perp x_{m+2}$.

Our induction hypothesis says that (\ref{sol.ent.rec.gcd-nbrs.goal}) holds for
$n=m$. In other words, we have $x_{m}\perp x_{m+1}$ and $v\perp x_{m+1}$.
Proposition \ref{prop.ent.coprime.perp-symm} (applied to $a=v$ and $b=x_{m+1}%
$) shows that $x_{m+1}\perp v$ (since $v\perp x_{m+1}$).

Theorem \ref{thm.ent.coprime.ab-to-c} (applied to $a=v$, $b=x_{m}$ and
$c=x_{m+1}$) yields $vx_{m}\perp x_{m+1}$ (since $v\perp x_{m+1}$ and
$x_{m}\perp x_{m+1}$). Hence, $x_{m+1}\perp vx_{m}$ (by Proposition
\ref{prop.ent.coprime.perp-symm}, applied to $a=vx_{m}$ and $b=x_{m+1}$). In
other words, $\gcd\left(  x_{m+1},vx_{m}\right)  =1$ (by the definition of
\textquotedblleft coprime\textquotedblright).

But the sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $\left(
u,v\right)  $-recurrent; in other words, every $n\geq2$ satisfies
$x_{n}=ux_{n-1}+vx_{n-2}$ (by the definition of \textquotedblleft$\left(
u,v\right)  $-recurrent\textquotedblright). Applying this to $n=m+2$, we
obtain $x_{m+2}=ux_{\left(  m+2\right)  -1}+vx_{\left(  m+2\right)
-2}=ux_{m+1}+vx_{m}$. Hence,%
\begin{align*}
\gcd\left(  x_{m+1},x_{m+2}\right)   &  =\gcd\left(  x_{m+1},ux_{m+1}%
+vx_{m}\right)  =\gcd\left(  x_{m+1},vx_{m}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition \ref{prop.ent.gcd.props1}
\textbf{(c)}, applied to }a=x_{m+1}\text{ and }b=vx_{m}\right) \\
&  =1.
\end{align*}
In other words, $x_{m+1}\perp x_{m+2}$.

Furthermore, we have $u\perp v$ and $x_{m+1}\perp v$. Hence, Theorem
\ref{thm.ent.coprime.ab-to-c} (applied to $a=u$, $b=x_{m+1}$ and $c=v$) yields
$ux_{m+1}\perp v$. Hence, $v\perp ux_{m+1}$ (by Proposition
\ref{prop.ent.coprime.perp-symm}, applied to $a=ux_{m+1}$ and $b=v$). In other
words, $\gcd\left(  v,ux_{m+1}\right)  =1$.

Now, $x_{m+2}=ux_{m+1}+vx_{m}=x_{m}v+ux_{m+1}$, so that%
\begin{align*}
\gcd\left(  v,x_{m+2}\right)   &  =\gcd\left(  v,x_{m}v+ux_{m+1}\right)
=\gcd\left(  v,ux_{m+1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.gcd.props1} \textbf{(c)}, applied to
}v\text{, }ux_{m+1}\text{ and }x_{m}\\
\text{instead of }a\text{, }b\text{ and }u
\end{array}
\right) \\
&  =1.
\end{align*}
In other words, $v\perp x_{m+2}$.

Now, we have shown that $x_{m+1}\perp x_{m+2}$ and $v\perp x_{m+2}$. In other
words, (\ref{sol.ent.rec.gcd-nbrs.goal}) holds for $n=m+1$. This completes the
induction step; thus, (\ref{sol.ent.rec.gcd-nbrs.goal}) is proved.]

The claim of Exercise \ref{exe.ent.rec.gcd-nbrs} is part of
(\ref{sol.ent.rec.gcd-nbrs.goal}). Thus, Exercise \ref{exe.ent.rec.gcd-nbrs}
is solved (since (\ref{sol.ent.rec.gcd-nbrs.goal}) is proved).
\end{proof}

The technique we used to solve Exercise \ref{exe.ent.rec.gcd-nbrs} above is
known as \textit{strengthening the induction hypothesis}. The underlying
phenomenon is that induction proofs often become simpler (or even doable in
the first place) when the claim being proved is strengthened (by adding
additional statements to it, or in another way). For a more classical example,
try proving the inequality%
\begin{equation}
\dfrac{1}{1^{2}}+\dfrac{1}{2^{2}}+\cdots+\dfrac{1}{n^{2}}%
<2\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{N}.
\label{eq.ind.backpack.ineq1-weak}%
\end{equation}
It is unclear how to prove this by induction on $n$, since the space between
the left and the right hand sides keeps shrinking as $n$ grows. However, the
\textbf{stronger} inequality%
\begin{equation}
\dfrac{1}{1^{2}}+\dfrac{1}{2^{2}}+\cdots+\dfrac{1}{n^{2}}\leq2-\dfrac{1}%
{n}\ \ \ \ \ \ \ \ \ \ \text{for all }n\in\mathbb{N}
\label{eq.ind.backpack.ineq1-strong}%
\end{equation}
can easily be proved by induction on $n$. (This example has been taken from
\url{https://mathoverflow.net/a/40688} , where other instances of this
phenomenon can also be found.)

I occasionally think of induction proofs as long travels. If the distance is
long enough, one has to take provisions along, even though they encumber the
backpack. Extra statements in the claim (like the $v\perp x_{n+1}$ part of
(\ref{sol.ent.rec.gcd-nbrs.goal}) in the solution above, or like the
$\dfrac{2}{n}$ in (\ref{eq.ind.backpack.ineq1-strong})) are like such
provisions. The art is to find the \textquotedblleft right\textquotedblright%
\ provisions, whose usefulness on the journey makes up for their weight.
Incidentally, when strengthening the induction hypothesis, we also gain a
stronger result in the end; unlike most kinds of provisions, they don't get
consumed during the journey.

An astute reader will have noticed that we have already done something similar
in our solution to Exercise \ref{exe.seqs.putnam2004A3}: We proved the two
equalities (\ref{sol.seqs.putnam2004A3.2m-rule}) and
(\ref{sol.seqs.putnam2004A3.2m+1-rule}) together, rather than proving each of
them separately. Each of them assisted the other in the induction step. Thus,
the best way to prove (\ref{sol.seqs.putnam2004A3.2m-rule}) by induction
(actually the only way I know) is to combine it with the extra claim
(\ref{sol.seqs.putnam2004A3.2m+1-rule}).

\subsubsection{Two-term recurrences: odds and ends}

Let us give a few more remarks about $\left(  a,b\right)  $-recurrent
sequences before moving on.

\paragraph{The vector space of $\left(  a,b\right)  $-recurrent sequences.}

First, while we have used matrices to study $\left(  a,b\right)  $-recurrent
sequences in Subsection \ref{subsect.linrec.ab-matrix}, there is yet another
way in which linear algebra shines light on $\left(  a,b\right)  $-recurrent
sequences. Namely, for any two fixed numbers $a$ and $b$, the $\left(
a,b\right)  $-recurrent sequences form a $2$-dimensional vector subspace of
the vector space of all sequences. More precisely:

\begin{proposition}
\label{prop.rec.ab-vs}Let $\mathbb{K}$ be one of the fields $\mathbb{Q}$,
$\mathbb{R}$ and $\mathbb{C}$. Fix two numbers $a,b\in\mathbb{K}$. Let
$\operatorname*{Rec}\nolimits_{a,b}$ denote the set of all $\left(
a,b\right)  $-recurrent sequences $\left(  x_{0},x_{1},x_{2},\ldots\right)
\in\mathbb{K}^{\infty}$. Consider $\mathbb{K}^{\infty}$ (that is, the set of
all infinite sequences of elements of $\mathbb{K}$) as an
(infinite-dimensional) $\mathbb{K}$-vector space, with addition and scaling
defined entrywise\footnotemark. Then, $\operatorname*{Rec}\nolimits_{a,b}$ is
a $2$-dimensional vector subspace of $\mathbb{K}^{\infty}$.
\end{proposition}

\footnotetext{This means that addition is defined by%
\begin{align*}
\left(  x_{0},x_{1},x_{2},\ldots\right)  +\left(  y_{0},y_{1},y_{2}%
,\ldots\right)   &  =\left(  x_{0}+y_{0},x_{1}+y_{1},x_{2}+y_{2},\ldots\right)
\\
&  \ \ \ \ \ \ \ \ \ \ \text{for all }\left(  x_{0},x_{1},x_{2},\ldots\right)
,\left(  y_{0},y_{1},y_{2},\ldots\right)  \in\mathbb{K}^{\infty},
\end{align*}
and that scaling is defined by%
\[
\lambda\left(  x_{0},x_{1},x_{2},\ldots\right)  =\left(  \lambda x_{0},\lambda
x_{1},\lambda x_{2},\ldots\right)  \ \ \ \ \ \ \ \ \ \ \text{for all }\left(
x_{0},x_{1},x_{2},\ldots\right)  \in\mathbb{K}^{\infty}.
\]
(In other words, sequences are considered as row vectors of infinite size.)
The zero vector of this vector space is the sequence $\left(  0,0,0,\ldots
\right)  $.}

\begin{proof}
[Proof of Proposition \ref{prop.rec.ab-vs} (sketched).]Since Proposition
\ref{prop.rec.ab-vs} is nowhere near essential to what we are planning to do,
we shall be on the terse side. First of all, we claim that
$\operatorname*{Rec}\nolimits_{a,b}$ is a vector subspace of $\mathbb{K}%
^{\infty}$. In order to prove this, we need to show the following three facts:

\begin{enumerate}
\item We have $\left(  0,0,0,\ldots\right)  \in\operatorname*{Rec}%
\nolimits_{a,b}$.

\item If $\left(  x_{0},x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}%
\nolimits_{a,b}$ and $\left(  y_{0},y_{1},y_{2},\ldots\right)  \in
\operatorname*{Rec}\nolimits_{a,b}$, then $\left(  x_{0},x_{1},x_{2}%
,\ldots\right)  +\left(  y_{0},y_{1},y_{2},\ldots\right)  \in
\operatorname*{Rec}\nolimits_{a,b}$.

\item If $\left(  x_{0},x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}%
\nolimits_{a,b}$ and $\lambda\in\mathbb{K}$, then $\lambda\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}\nolimits_{a,b}$.
\end{enumerate}

All three of these facts are straightforward to verify\footnote{Just in case,
let me show the proof of fact 2:
\par
Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}%
\nolimits_{a,b}$ and $\left(  y_{0},y_{1},y_{2},\ldots\right)  \in
\operatorname*{Rec}\nolimits_{a,b}$. We must show that $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  +\left(  y_{0},y_{1},y_{2},\ldots\right)
\in\operatorname*{Rec}\nolimits_{a,b}$.
\par
We have $\left(  x_{0},x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}%
\nolimits_{a,b}$. In other words, the sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent (since
$\operatorname*{Rec}\nolimits_{a,b}$ is the set of all $\left(  a,b\right)
$-recurrent sequences). In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$. Likewise, every $n\geq2$ satisfies $y_{n}%
=ay_{n-1}+by_{n-2}$. Hence, every $n\geq2$ satisfies%
\begin{align*}
\underbrace{x_{n}}_{=ax_{n-1}+bx_{n-2}}+\underbrace{y_{n}}_{=ay_{n-1}%
+by_{n-2}}  &  =ax_{n-1}+bx_{n-2}+ay_{n-1}+by_{n-2}\\
&  =a\left(  x_{n-1}+y_{n-1}\right)  +b\left(  x_{n-2}+y_{n-2}\right)  .
\end{align*}
In other words, the sequence $\left(  x_{0}+y_{0},x_{1}+y_{1},x_{2}%
+y_{2},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent (by the definition
of \textquotedblleft$\left(  a,b\right)  $-recurrent\textquotedblright). In
other words, the sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  +\left(
y_{0},y_{1},y_{2},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent (since
$\left(  x_{0},x_{1},x_{2},\ldots\right)  +\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ was defined to be $\left(  x_{0}+y_{0},x_{1}+y_{1}%
,x_{2}+y_{2},\ldots\right)  $). In other words, $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  +\left(  y_{0},y_{1},y_{2},\ldots\right)  \in
\operatorname*{Rec}\nolimits_{a,b}$ (since $\operatorname*{Rec}\nolimits_{a,b}%
$ is the set of all $\left(  a,b\right)  $-recurrent sequences). This proves
fact 2. The proofs of facts 1 and 3 are similar.}. Thus, we have shown that
$\operatorname*{Rec}\nolimits_{a,b}$ is a vector subspace of $\mathbb{K}%
^{\infty}$. It remains to prove that $\operatorname*{Rec}\nolimits_{a,b}$ is
$2$-dimensional. We shall achieve this by constructing a basis $\left(
s,t\right)  $ of $\operatorname*{Rec}\nolimits_{a,b}$.

Indeed, we define a sequence $s=\left(  s_{0},s_{1},s_{2},\ldots\right)
\in\mathbb{K}^{\infty}$ recursively by setting $s_{0}=0$, $s_{1}=1$ and
$s_{n}=as_{n-1}+bs_{n-2}$ for each $n\geq2$. Thus, the sequence $s$ is
$\left(  a,b\right)  $-recurrent.

Furthermore, we define a sequence $t=\left(  t_{0},t_{1},t_{2},\ldots\right)
\in\mathbb{K}^{\infty}$ recursively by setting $t_{0}=1$, $t_{1}=0$ and
$t_{n}=at_{n-1}+bt_{n-2}$ for each $n\geq2$. Thus, the sequence $t$ is
$\left(  a,b\right)  $-recurrent.

The two sequences $s$ and $t$ are $\left(  a,b\right)  $-recurrent, thus
belong to $\operatorname*{Rec}\nolimits_{a,b}$. Furthermore, any $\mathbb{K}%
$-linear combination $\lambda s+\mu t$ (with $\lambda,\mu\in\mathbb{K}$)
starts with the two entries $\lambda\underbrace{s_{0}}_{=0}+\mu
\underbrace{t_{0}}_{=1}=\lambda\cdot0+\mu\cdot1=\mu$ and $\lambda
\underbrace{s_{1}}_{=1}+\mu\underbrace{t_{1}}_{=0}=\lambda\cdot1+\mu
\cdot0=\lambda$, and thus cannot equal the zero sequence $\left(
0,0,0,\ldots\right)  $ unless both $\lambda$ and $\mu$ are $0$. In other
words, the sequences $s$ and $t$ are $\mathbb{K}$-linearly independent.

Moreover, we claim that $s$ and $t$ span $\operatorname*{Rec}\nolimits_{a,b}$.
Indeed, every sequence $x=\left(  x_{0},x_{1},x_{2},\ldots\right)
\in\operatorname*{Rec}\nolimits_{a,b}$ can be written as a $\mathbb{K}$-linear
combination of $s$ and $t$ as follows:%
\begin{equation}
x=x_{1}s+x_{0}t. \label{pf.prop.rec.ab-vs.span}%
\end{equation}


[\textit{Proof of (\ref{pf.prop.rec.ab-vs.span}):} Let $x=\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  \in\operatorname*{Rec}\nolimits_{a,b}$. We must
prove (\ref{pf.prop.rec.ab-vs.span}). Since both $s$ and $t$ belong to
$\operatorname*{Rec}\nolimits_{a,b}$, the linear combination $x_{1}s+x_{0}t$
also belongs to $\operatorname*{Rec}\nolimits_{a,b}$ (since
$\operatorname*{Rec}\nolimits_{a,b}$ is a vector subspace of $\mathbb{K}%
^{\infty}$). In other words, $x_{1}s+x_{0}t$ is an $\left(  a,b\right)
$-recurrent sequence.

Now, recall that an $\left(  a,b\right)  $-recurrent sequence is uniquely
determined by its first two entries (since its recursive equation allows all
other entries to be computed in terms of these first two). Hence, if two
$\left(  a,b\right)  $-recurrent sequences agree in their first two entries,
then these two sequences must be identical. Thus, in order to prove that
$x=x_{1}s+x_{0}t$, it suffices to show that the sequences $x$ and
$x_{1}s+x_{0}t$ agree in their first two entries (since both sequences $x$ and
$x_{1}s+x_{0}t$ are $\left(  a,b\right)  $-recurrent). But this is easy: The
$0$-th entry of $x_{1}s+x_{0}t$ is $x_{1}\underbrace{s_{0}}_{=0}%
+x_{0}\underbrace{t_{0}}_{=1}=x_{1}\cdot0+x_{0}\cdot1=x_{0}$, which is
precisely the $0$-th entry of $x$. The $1$-st entry of $x_{1}s+x_{0}t$ is
$x_{1}\underbrace{s_{1}}_{=1}+x_{0}\underbrace{t_{1}}_{=0}=x_{1}\cdot
1+x_{0}\cdot0=x_{1}$, which is precisely the $1$-st entry of $x$. Thus, the
two sequences $x$ and $x_{1}s+x_{0}t$ agree in their first two entries, and
hence are identical (as we just explained). In other words, $x=x_{1}s+x_{0}t$.
This proves (\ref{pf.prop.rec.ab-vs.span}).]

Now we have shown that the two elements $s$ and $t$ of $\operatorname*{Rec}%
\nolimits_{a,b}$ span $\operatorname*{Rec}\nolimits_{a,b}$ and are
$\mathbb{K}$-linearly independent. In other words, $\left(  s,t\right)  $ is a
basis of the $\mathbb{K}$-vector space $\operatorname*{Rec}\nolimits_{a,b}$.
Hence, the $\mathbb{K}$-vector space $\operatorname*{Rec}\nolimits_{a,b}$ has
a basis consisting of $2$ vectors, and therefore is $2$-dimensional.
Proposition \ref{prop.rec.ab-vs} is now proved.
\end{proof}

\paragraph{The Chebyshev polynomials.}

We have so far been studying $\left(  a,b\right)  $-recurrent sequences of
numbers; but we could apply (most of) the same reasoning to $\left(
a,b\right)  $-recurrent sequences of polynomials or other objects that can be
added and multiplied. (In particular, $a$ and $b$ can themselves be
polynomials.) The most important example of such sequences is a sequence of
polynomials known as the \textit{Chebyshev polynomials of the second kind}:

\begin{example}
\label{exa.rec.chebyshev-T}Consider polynomials in a single variable $x$ with
integer coefficients. Define a sequence $\left(  T_{0},T_{1},T_{2}%
,\ldots\right)  $ of such polynomials recursively by setting%
\begin{align*}
T_{0}\left(  x\right)   &  =1,\ \ \ \ \ \ \ \ \ \ T_{1}\left(  x\right)
=x,\ \ \ \ \ \ \ \ \ \ \text{and}\\
T_{n}\left(  x\right)   &  =2xT_{n-1}\left(  x\right)  -T_{n-2}\left(
x\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq2.
\end{align*}
The polynomials $T_{0},T_{1},T_{2},\ldots$ in this sequence are called
\textit{Chebyshev polynomials of the first kind}. They have several properties
(useful in approximation theory as well as in number theory); the most
well-known one is the fact that%
\begin{equation}
\cos\left(  n\alpha\right)  =T_{n}\left(  \cos\alpha\right)
\ \ \ \ \ \ \ \ \ \ \text{for any angle }\alpha.
\label{eq.exa.rec.chebyshev-T.cosna}%
\end{equation}
(Thus, the polynomial $T_{n}$ is the answer to the rather natural question
\textquotedblleft how can we express $\cos\left(  n\alpha\right)  $ through
$\cos\alpha$ without using arc-cosines?\textquotedblright. It is easy to prove
(\ref{eq.exa.rec.chebyshev-T.cosna}) by induction on $n$.)

The definition of the Chebyshev polynomials $T_{n}$ shows that the sequence
$\left(  T_{0},T_{1},T_{2},\ldots\right)  $ is $\left(  2x,-1\right)
$-recurrent (where we have extended the concept of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright\ to sequences of polynomials in the
obvious way). We can now apply most of what we know about $\left(  a,b\right)
$-recurrent sequences to this sequence $\left(  T_{0},T_{1},T_{2}%
,\ldots\right)  $. For example, Exercise \ref{exe.rec.addition} (applied to
$a=2x$ and $b=-1$ and $x_{i}=T_{i}$ and $y_{i}=T_{i}$) yields that%
\[
\left(  -1\right)  T_{0}\left(  x\right)  \cdot T_{n+m}\left(  x\right)
+T_{1}\left(  x\right)  \cdot T_{n+m+1}\left(  x\right)  =\left(  -1\right)
T_{n}\left(  x\right)  \cdot T_{m}\left(  x\right)  +T_{n+1}\left(  x\right)
\cdot T_{m+1}\left(  x\right)
\]
for any nonnegative integers $n$ and $m$. In view of $T_{0}\left(  x\right)
=1$ and $T_{1}\left(  x\right)  =x$, this rewrites as%
\[
-T_{n+m}\left(  x\right)  +xT_{n+m+1}\left(  x\right)  =-T_{n}\left(
x\right)  \cdot T_{m}\left(  x\right)  +T_{n+1}\left(  x\right)  \cdot
T_{m+1}\left(  x\right)  .
\]
More advanced properties of $\left(  a,b\right)  $-recurrent sequences lead to
more advanced properties of the polynomials $T_{n}$.

The \textit{Chebyshev polynomials of the second kind} form another $\left(
2x,-1\right)  $-recurrent sequence $\left(  U_{0},U_{1},U_{2},\ldots\right)
$, which starts with $U_{0}\left(  x\right)  =1$ and $U_{1}\left(  x\right)
=2x$.

We refer to \href{https://en.wikipedia.org/wiki/Chebyshev_polynomials}{the
Wikipedia page} for an overview of the major properties of Chebyshev
polynomials, to \cite[Chapter 22]{ChaSed97} for an introduction, and to the
book \cite{Rivlin90} for an in-depth treatment.
\end{example}

\begin{noncompile}
(An analogy between ODEs and recurrences)

Next, let us briefly discuss an instructive analogy between $\left(
a,b\right)  $-recurrent sequences and solutions to second-order linear ODEs
with constant coefficients. This analogy does not directly yield any results
about $\left(  a,b\right)  $-recurrent sequences, but it provides context for
some of the results we have already seen.

Some of the most basic differential equations are ODEs (ordinary differential
equations) of the form%
\begin{equation}
x^{\prime\prime}=ux^{\prime}+vx, \label{eq.rmk.rec.ode2.ode}%
\end{equation}
where $x$ is a (twice differentiable) function of a real variable $t$, and
where $u$ and $v$ are two (constant) numbers. See, e.g., \cite[\S 4.3]{Zill17}
or \cite[\S 3.1, \S 3.3, \S 3.4]{BoyDip12} for an analysis of such ODEs. The
notion of an $\left(  a,b\right)  $-recurrent sequence (for two numbers $a$
and $b$) can be viewed as a discrete analogue of a solution of such an ODE.
Namely, a sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ of complex
numbers is the same as a function from $\mathbb{N}$ to $\mathbb{C}$, and thus
can be considered to be a discrete analogue of a function $x:\mathbb{R}%
\rightarrow\mathbb{C}$ (as we discussed at the beginning of Subsection
\ref{subsect.per.func}). With respect to this analogy,

\begin{itemize}
\item the \textquotedblleft first difference sequence\textquotedblright%
\ $x^{\Delta}:=\left(  x_{1}-x_{0},x_{2}-x_{1},x_{3}-x_{2},\ldots\right)  $ of
a sequence $x:=\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is the analogue of
the first derivative $x^{\prime}$ of a function $x:\mathbb{R}\rightarrow
\mathbb{C}$ (because the derivative of a function measures its local growth
rate near a point, just as $x^{\Delta}$ records the local growths of the
sequence $x$);

\item the \textquotedblleft second difference sequence\textquotedblright%
\ $x^{\Delta\Delta}:=\left(  x^{\Delta}\right)  ^{\Delta}$ of a sequence $x$
is the analogue of the second derivative $x^{\prime\prime}$ of a function
$x:\mathbb{R}\rightarrow\mathbb{C}$.
\end{itemize}

\footnote{Our notation $x^{\Delta}$ for the \textquotedblleft first difference
sequence\textquotedblright\ of $x$ is slightly idiosyncratic; the standard
notation for this is $\Delta x$. We are using $x^{\Delta}$ to stress its
analogy with $x^{\prime}$.} Thus, a discrete analogue of the above ODE
(\ref{eq.rmk.rec.ode2.ode}) would be a \textquotedblleft difference
equation\textquotedblright\ of the form%
\begin{equation}
x^{\Delta\Delta}=ux^{\Delta}+vx, \label{eq.rmk.rec.ode2.de}%
\end{equation}
where $x$ is a sequence of complex numbers.\footnote{Here, the right hand side
is to be understood using the $\mathbb{C}$-vector space structure on the set
of all sequences that we introduced in Proposition \ref{prop.rec.ab-vs}.} Now,
let us rewrite (\ref{eq.rmk.rec.ode2.de}) explicitly in an entry-by-entry
fashion. If $x=\left(  x_{0},x_{1},x_{2},\ldots\right)  $, then $x^{\Delta
}=\left(  x_{1}-x_{0},x_{2}-x_{1},x_{3}-x_{2},\ldots\right)  $ (by the
definition of $x^{\Delta}$) and%
\begin{align*}
x^{\Delta\Delta}  &  =\left(  x^{\Delta}\right)  ^{\Delta}=\left(  x_{1}%
-x_{0},x_{2}-x_{1},x_{3}-x_{2},\ldots\right)  ^{\Delta}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }x^{\Delta}=\left(  x_{1}%
-x_{0},x_{2}-x_{1},x_{3}-x_{2},\ldots\right)  \right) \\
&  =\left(  \left(  x_{2}-x_{1}\right)  -\left(  x_{1}-x_{0}\right)  ,\left(
x_{3}-x_{2}\right)  -\left(  x_{2}-x_{1}\right)  ,\left(  x_{4}-x_{3}\right)
-\left(  x_{3}-x_{2}\right)  ,\ldots\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }\left(  x_{1}%
-x_{0},x_{2}-x_{1},x_{3}-x_{2},\ldots\right)  ^{\Delta}\right) \\
&  =\left(  x_{2}-2x_{1}+x_{0},x_{3}-2x_{2}+x_{1},x_{4}-2x_{3}+x_{2}%
,\ldots\right)  .
\end{align*}
Thus, for each $n\in\mathbb{N}$, the $n$-th entry of the sequence
$x^{\Delta\Delta}$ is $x_{n+2}-2x_{n+1}+x_{n}$, whereas the $n$-th entry of
the sequence $ux^{\Delta}+vx$ is $u\left(  x_{n+1}-x_{n}\right)  +vx_{n}$.
Hence, the equation (\ref{eq.rmk.rec.ode2.de}) is equivalent to requiring that%
\[
x_{n+2}-2x_{n+1}+x_{n}=u\left(  x_{n+1}-x_{n}\right)  +vx_{n}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}%
\]
(because two sequences are equal if and only if each entry of the first equals
the corresponding entry of the second). We can rewrite the latter equation as%
\[
x_{n+2}=\left(  u+2\right)  x_{n+1}+\left(  v-u-1\right)  x_{n}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]
Substituting $n-2$ for $n$ in this equation, we obtain%
\[
x_{n}=\left(  u+2\right)  x_{n-1}+\left(  v-u-1\right)  x_{n-2}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq2.
\]
But this is just saying that the sequence $x$ is $\left(  u+2,v-u-1\right)
$-recurrent. Thus, the sequences $x$ that solve the \textquotedblleft
difference equation\textquotedblright\ (\ref{eq.rmk.rec.ode2.de}) are
precisely the $\left(  u+2,v-u-1\right)  $-recurrent sequences.

So we have seen that the discrete analogue of the second-order linear ODE
(\ref{eq.rmk.rec.ode2.ode}) is the \textquotedblleft difference
equation\textquotedblright\ (\ref{eq.rmk.rec.ode2.de}), whose solutions are
precisely the $\left(  u+2,v-u-1\right)  $-recurrent sequences. Note that each
pair $\left(  a,b\right)  $ of two complex numbers $a$ and $b$ can be written
in the form $\left(  u+2,v-u-1\right)  $ for appropriately chosen complex
numbers $u$ and $v$ (namely, $u=a-2$ and $v=b+a-1$). Thus, the theory of
$\left(  a,b\right)  $-recurrent sequences can be viewed as a discrete
analogue of the classical theory of the solutions of a second-order linear ODE
with constant coefficients (see, e.g., ...).

$\ldots$ (to be continued).

e.g., Cassini $\approx$ $\sin^{2}+\cos^{2}=1$.

e.g., resonance case $\approx$ Theorem \ref{thm.rec.binet} \textbf{(b)}.
\end{noncompile}

\subsubsection{$k$-term recurrences}

In the definition of an $\left(  a,b\right)  $-recurrent sequence, the
equality (\ref{eq.def.abrec.eq}) expresses an entry $x_{n}$ of the sequence in
terms of the preceding two entries $x_{n-1}$ and $x_{n-2}$. Nothing speaks
against generalizing this definition to more than two parameters and,
correspondingly, more than two preceding entries:

\begin{definition}
\label{def.akrec}Let $k\in\mathbb{N}$. Let $a_{1},a_{2},\ldots,a_{k}$ be any
$k$ numbers. A sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ of numbers
will be called $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $\textit{-recurrent}%
\ if every $n\geq k$ satisfies%
\begin{equation}
x_{n}=a_{1}x_{n-1}+a_{2}x_{n-2}+\cdots+a_{k}x_{n-k}. \label{eq.def.akrec.eq}%
\end{equation}

\end{definition}

Clearly, Definition \ref{def.abrec} is a particular case of Definition
\ref{def.akrec}. Here are some other particular cases:

\begin{itemize}
\item Here is the case $k=1$ of Definition \ref{def.akrec}: If $a$ is a single
number, then an $\left(  a\right)  $-recurrent sequence is the same as a
geometric progression with ratio $a$.

\item The
\textit{\href{https://en.wikipedia.org/wiki/Padovan_sequence}{\textit{Padovan
sequence}}} is the sequence $\left(  p_{0},p_{1},p_{2},\ldots\right)  $ of
integers defined recursively by setting%
\begin{align*}
p_{0}  &  =1,\ \ \ \ \ \ \ \ \ \ p_{1}=1,\ \ \ \ \ \ \ \ \ \ p_{2}%
=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
p_{n}  &  =p_{n-2}+p_{n-3}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq3.
\end{align*}
This sequence is obviously $\left(  0,1,1\right)  $-recurrent. The
\textit{\href{https://en.wikipedia.org/wiki/Perrin_number}{\textit{Perrin
sequence}}} is also $\left(  0,1,1\right)  $-recurrent but has starting values
$3$, $0$ and $2$ (in this order). For the properties of these two sequences,
we refer to their Wikipedia articles.

\item The sequence $\left(  0^{1},1^{2},2^{2},3^{2},\ldots\right)  $ is
$\left(  3,-3,1\right)  $-recurrent, since a straightforward computation shows
that
\[
n^{2}=3\left(  n-1\right)  ^{2}-3\left(  n-2\right)  ^{2}+\left(  n-3\right)
^{2}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq3.
\]
We will generalize this in an exercise below (Exercise \ref{exe.findiff.poly1}
\textbf{(e)}).

\item The sequence $\left(  t_{0},t_{1},t_{2},\ldots\right)  $ in Exercise
\ref{exe.laurent.t} is $\left(  0,4,0,-1\right)  $-recurrent. Indeed, this is
precisely the claim of Exercise \ref{exe.laurent.t} \textbf{(a)}.

\item If $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is an $\left(
a,b\right)  $-recurrent sequence (for some numbers $a$ and $b$), then $\left(
x_{0}^{2},x_{1}^{2},x_{2}^{2},\ldots\right)  $ is an $\left(  a^{2}+b,b\left(
a^{2}+b\right)  ,-b^{3}\right)  $-recurrent sequence. This is not hard to
check by direct computation\footnote{Indeed, you need to check that $x_{n}%
^{2}=\left(  a^{2}+b\right)  x_{n-1}^{2}+\left(  a^{2}+b\right)  bx_{n-2}%
^{2}-b^{3}x_{n-3}^{2}$ for each $n\geq3$. But this can be done by expressing
$x_{n}$ and $x_{n-1}$ through $x_{n-2}$ and $x_{n-3}$ (via $x_{n-1}%
=ax_{n-2}+bx_{n-3}$ and $x_{n}=a\underbrace{x_{n-1}}_{=ax_{n-2}+bx_{n-3}%
}+bx_{n-2}=a\left(  ax_{n-2}+bx_{n-3}\right)  +bx_{n-2}$) and expanding both
sides.}. Similar results hold for $\left(  a_{1},a_{2},\ldots,a_{k}\right)
$-recurrent sequences, but they get messier as $k$ grows, and require linear
algebra to properly state and prove.

\item If $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is an $\left(
a,b\right)  $-recurrent sequence (for some numbers $a$ and $b$), and if
$\left(  y_{0},y_{1},y_{2},\ldots\right)  $ is a $\left(  c,d\right)
$-recurrent sequence (for some numbers $c$ and $d$), then $\left(  x_{0}%
+y_{0},x_{1}+y_{1},x_{2}+y_{2},\ldots\right)  $ is an $\left(
a+c,b+d-ac,-ad-bc,-bd\right)  $-recurrent sequence, whereas $\left(
x_{0}y_{0},x_{1}y_{1},x_{2}y_{2},\ldots\right)  $ is an \newline$\left(
ac,a^{2}d+c^{2}b+2bd,abcd,-b^{2}d^{2}\right)  $-recurrent sequence. Both of
these claims can be checked by (laborious yet fairly straightforward)
computation; however, lurking behind them are certain properties of
polynomials and matrices that are best understood from a linear-algebraic
viewpoint. (This would also allow us to generalize them to $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $-recurrent sequences.)
\end{itemize}

Theorem \ref{thm.rec.binet} can be generalized to $\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  $-recurrent sequences, although it is a judgment call
whether the result counts as an \textquotedblleft explicit
formula\textquotedblright:

\Needspace{8cm}

\begin{theorem}
\label{thm.akrec.binet}Let $k\in\mathbb{N}$. Let $a_{1},a_{2},\ldots,a_{k}$ be
any $k$ numbers. Let $p\left(  X\right)  $ be the polynomial $X^{k}%
-a_{1}X^{k-1}-a_{2}X^{k-2}-\cdots-a_{k}X^{k-k}$. Let $\lambda_{1},\lambda
_{2},\ldots,\lambda_{h}$ be all the distinct complex roots of $p\left(
X\right)  $. For each $i\in\left\{  1,2,\ldots,h\right\}  $, let $m_{i}$ be
the multiplicity of the root $\lambda_{i}$ of $p\left(  X\right)  $.

Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  $-recurrent sequence. Then, there exist constants
$\gamma_{i,j}$ for all $i\in\left\{  1,2,\ldots,h\right\}  $ and $j\in\left\{
0,1,\ldots,m_{i}-1\right\}  $ with the property that each $n\in\mathbb{N}$
satisfies%
\begin{equation}
x_{n}=\sum_{i=1}^{h}\sum_{j=0}^{m_{i}-1}\gamma_{i,j}n^{j}\lambda_{i}^{n}.
\label{eq.thm.akrec.binet.full}%
\end{equation}
In other words, there exist polynomials $\delta_{i}\left(  X\right)  $ of
degree $<m_{i}$ for all $i\in\left\{  1,2,\ldots,h\right\}  $ with the
property that each $n\in\mathbb{N}$ satisfies%
\begin{equation}
x_{n}=\sum_{i=1}^{h}\delta_{i}\left(  n\right)  \lambda_{i}^{n}.
\label{eq.thm.akrec.binet.full-pol}%
\end{equation}
(Here, we agree that the zero polynomial has degree $<m_{i}$, whatever $m_{i}$ is.)

Thus, in particular, if all roots of $p\left(  X\right)  $ are distinct (i.e.,
we have $h=k$, and the multiplicities $m_{i}$ are all equal to $1$), then each
$n\in\mathbb{N}$ satisfies%
\begin{equation}
x_{n}=\gamma_{1,0}\lambda_{1}^{n}+\gamma_{2,0}\lambda_{2}^{n}+\cdots
+\gamma_{k,0}\lambda_{k}^{n}. \label{eq.thm.akrec.binet.distinct}%
\end{equation}

\end{theorem}

We shall not dwell on the proof of Theorem \ref{thm.akrec.binet}, nor on its
uses. Proofs of Theorem \ref{thm.akrec.binet} can be found in \cite[Theorem
1]{Melian01} and in \cite[Theorem 2]{Ivanov08}. The proof in \cite[Theorem
1]{Melian01} is essentially a straightforward generalization of our above
second proof of Theorem \ref{thm.rec.binet} in Subsection
\ref{subsect.linrec.ab-matrix}; it relies on the $k\times k$-matrix
\begin{equation}
\left(
\begin{array}
[c]{ccccc}%
0 & 1 & 0 & \cdots & 0\\
0 & 0 & 1 & \cdots & 0\\
\vdots & \vdots & \vdots & \ddots & \vdots\\
0 & 0 & 0 & \cdots & 1\\
a_{k} & a_{k-1} & a_{k-2} & \cdots & a_{1}%
\end{array}
\right)  \label{eq.thm.akrec.binet.mtx}%
\end{equation}
(a generalization of the matrix $A$ from Proposition \ref{prop.rec.matrix-1})
and its Jordan normal form\footnote{To be more precise, the matrix used in
\cite[Theorem 1]{Melian01} is obtained from the above matrix by a $180^{\circ
}$-rotation; but this is just a matter of relabeling rows and columns.}. The
generalization of Proposition \ref{prop.rec.matrix-1} to $\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  $-recurrent sequences is easily stated and proved,
and this generalization provides a way to study $\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  $-recurrent sequences via matrix algebra. Unlike the
particular case $k=2$ (in which case explicit computations are a viable
method), it is this matrix approach that bears the most fruits in the general
case. For example, here is a neat folklore result whose only proof I know uses
the matrix approach:

\begin{proposition}
\label{prop.akrec.accel}Let $d\in\mathbb{N}$ and $k\in\mathbb{N}$. Let
$a_{1},a_{2},\ldots,a_{k}$ be any $k$ numbers. Then, there exist $k$ numbers
$b_{1},b_{2},\ldots,b_{k}$ with the following property: If $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ is any $\left(  a_{1},a_{2},\ldots
,a_{k}\right)  $-recurrent sequence, then the sequence $\left(  x_{p+0d}%
,x_{p+1d},x_{p+2d},\ldots\right)  $ is $\left(  b_{1},b_{2},\ldots
,b_{k}\right)  $-recurrent for each $p\in\mathbb{N}$.
\end{proposition}

Note that these $k$ numbers $b_{1},b_{2},\ldots,b_{k}$ depend neither on the
sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ nor on the integer $p$;
they are determined by $d$, $k$ and $a_{1},a_{2},\ldots,a_{k}$ alone. For
example, for $k=2$ and $d=2$, this is saying that if $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ is any $\left(  a_{1},a_{2}\right)  $-recurrent
sequence, then both sequences $\left(  x_{0},x_{2},x_{4},\ldots\right)  $ and
$\left(  x_{1},x_{3},x_{5},\ldots\right)  $ are $\left(  b_{1},b_{2}\right)
$-recurrent. In the particular case $k=2$, Proposition \ref{prop.akrec.accel}
can be proved by elementary means (see \cite[solution to Exercise 4.2
\textbf{(c)}]{detnotes}); but in the general case, the only proof I know uses
the matrix (\ref{eq.thm.akrec.binet.mtx}) and the Cayley--Hamilton theorem.
(See \cite[Theorem 1]{mse2779502} for this proof.)

\subsection{\label{sect.hw4}Homework set \#4: More sequences}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the above parts of Chapter \ref{chp.seqsum}. Some of
the problems may be unrelated.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.seqs.binom-periodic}Let $u$ be a positive integer. Let
$k\in\mathbb{N}$. Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)
$ of integers by setting%
\[
a_{n}=\dbinom{n}{k}\%u\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]
Show that this sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is $uk!$-periodic.
\end{exercise}

The next exercise generalizes Exercise \ref{exe.ent.rec.fn-div}:

\begin{exercise}
\label{exe.ent.rec.fn-div-not-1}Let $u$ and $v$ be two integers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be a $\left(  u,v\right)  $-recurrent
sequence of integers with $x_{0}=0$.

Show that all $a,b\in\mathbb{N}$ satisfying $a\mid b$ satisfy $x_{a}\mid
x_{b}$.
\end{exercise}

\begin{exercise}
\label{exe.rec.cassini-gen}Generalize Exercise \ref{exe.rec.cassini} further,
to a claim about two $\left(  a,b\right)  $-recurrent sequences $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $.

[\textbf{Hint:} The left hand side will be $x_{n+1}y_{n-1}-x_{n}y_{n}$.]
\end{exercise}

\begin{exercise}
\label{exe.rec.xn-mynpm}Let $a$ be any number. Let $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ be two
$\left(  a,1\right)  $-recurrent sequences of numbers with $x_{0}=0$. (We
don't require anything of $y_{0}$.) Let $n,m\in\mathbb{N}$ satisfy $n\geq m$.
Prove that%
\[
x_{n-m}y_{n+m}=x_{n}y_{n}-\left(  -1\right)  ^{n+m}x_{m}y_{m}.
\]

\end{exercise}

The next exercise is about generalizing Exercise \ref{exe.fib.gcd-nbr} and
Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)}:

\begin{exercise}
\label{exe.rec.gcd}Let $u$ and $v$ be two integers such that $u\perp v$. Let
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be a $\left(  u,v\right)
$-recurrent sequence of integers with $x_{0}=0$ and $x_{1}=1$. Show that all
$a,b\in\mathbb{N}$ satisfy $\gcd\left(  x_{a},x_{b}\right)  =\left\vert
x_{\gcd\left(  a,b\right)  }\right\vert $.
\end{exercise}

\begin{exercise}
\label{exe.rec.VSE28}Let $n\in\mathbb{N}$. Prove that there exists some
$m\in\mathbb{N}$ such that $\left(  \sqrt{2}-1\right)  ^{n}=\sqrt{m+1}%
-\sqrt{m}$.
\end{exercise}

\begin{exercise}
\label{exe.seqs.v33-2}A sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $
of numbers is defined recursively by $a_{0}=-1$ and $a_{1}=0$ and
$a_{n}=a_{n-1}^{2}-n^{2}a_{n-2}-1$ for all $n\geq2$. Find $a_{100}$.
\end{exercise}

\begin{exercise}
\label{exe.rec.galv-7.2}Let $n\in\mathbb{N}$. Prove that $\left\lfloor \left(
1+\sqrt{2}\right)  ^{n}\right\rfloor $ is even if and only if $n$ is odd.
\end{exercise}

\begin{exercise}
\label{exe.rec.ML49408}Let $m$ and $k$ be two positive integers such that
$m\mid k+1$. Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of
positive integers recursively by
\begin{align*}
a_{0}  &  =1,\ \ \ \ \ \ \ \ \ \ a_{1}=1,\ \ \ \ \ \ \ \ \ \ a_{2}%
=m\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =\dfrac{k+a_{n-1}a_{n-2}}{a_{n-3}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq3.
\end{align*}
Prove that $a_{n}$ is an integer for each $n\in\mathbb{N}$.

[\textbf{Hint:} Prove that each of the two subsequences $\left(  a_{0}%
,a_{2},a_{4},a_{6},\ldots\right)  $ and $\left(  a_{1},a_{3},a_{5}%
,a_{7},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent for some integers
$a$ and $b$.]
\end{exercise}

\begin{exercise}
\label{exe.seq.geo-in-ari}Let $\left(  a,a+d,a+2d,a+3d,\ldots\right)  $ be any
(infinite) arithmetic progression with $d\neq0$. Prove that this arithmetic
progression contains an infinite geometric progression as a subsequence (i.e.,
there is an infinite strictly increasing sequence $\left(  i_{0},i_{1}%
,i_{2},\ldots\right)  $ of nonnegative integers such that $\left(
a+i_{0}d,a+i_{1}d,a+i_{2}d,\ldots\right)  $ is a geometric progression) if and
only if $\dfrac{a}{d}\in\mathbb{Q}$.
\end{exercise}

\subsection{\label{sect.seqsum.more-int}More integer sequences}

Exercise \ref{exe.laurent.t} \textbf{(b)}, Exercise
\ref{exe.seqs.putnam2004A3} and Exercise \ref{exe.rec.ML49408} are three
instances of a common type of problem: Given a sequence of numbers defined
recursively, to prove that all entries of the sequence are integers. (Usually
this is not obvious from the definition, since the definition involves
division or even taking roots.) This type of problem has recently become
popular; famous examples are the \textit{Somos sequences} and various variants
thereof. See \cite[Chapters 1 and 4]{Gale98} and \cite[\S 2.9]{detnotes} for a
few examples of such problems. There is also a theory that unifies some (but
not all) instances of this \textquotedblleft unexpected
integrality\textquotedblright\ phenomenon, but properly understanding this
theory goes beyond these notes. (See \cite{AlCuHu16} for a large part of this
theory. For more, google \textquotedblleft cluster algebras\textquotedblright%
\ and \textquotedblleft Laurent phenomenon\textquotedblright.)

In this short section, we shall see more examples of such problems.

\subsubsection{\label{subsect.seqsum.more-int.1plus}Propp's $t_{n}%
t_{n-k}=1+t_{n-1}t_{n-2}...t_{n-k+1}$ recurrence}

Let us generalize the sequence $\left(  t_{0},t_{1},t_{2},\ldots\right)  $
from Exercise \ref{exe.laurent.t}:

\begin{exercise}
\label{exe.laurent.tk1}Fix a positive integer $k\geq2$. Define a sequence
$\left(  t_{0},t_{1},t_{2},\ldots\right)  $ of positive rational numbers
recursively by setting%
\begin{equation}
t_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k \label{eq.exe.laurent.tk1.bas}%
\end{equation}
and%
\begin{equation}
t_{n}=\dfrac{1+t_{n-1}t_{n-2}\cdots t_{n-k+1}}{t_{n-k}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k. \label{eq.exe.laurent.tk1.rec}%
\end{equation}
(For example, $t_{k}=\dfrac{1+t_{k-1}t_{k-2}\cdots t_{1}}{t_{0}}%
=\dfrac{1+1\cdot1\cdot\cdots\cdot1}{1}=2$ and likewise $t_{k+1}=3$.)

Prove that $t_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

Let us see what this means for small values of $k$:{}

\begin{example}
\label{exa.laurent.tk1-2}Set $k=3$ in Exercise \ref{exe.laurent.tk1}. Then,
$t_{0}=t_{1}=t_{2}=1$ and
\[
t_{n}=\dfrac{1+t_{n-1}t_{n-2}}{t_{n-3}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq3
\]
(since the right hand side of (\ref{eq.exe.laurent.tk1.rec}) becomes
$\dfrac{1+t_{n-1}t_{n-2}}{t_{n-3}}$). Hence, the sequence $\left(  t_{0}%
,t_{1},t_{2},\ldots\right)  $ is precisely the sequence $\left(  t_{0}%
,t_{1},t_{2},\ldots\right)  $ from Exercise \ref{exe.laurent.t}. Thus, the
claim of Exercise \ref{exe.laurent.tk1} in the case $k=3$ is precisely the
claim of Exercise \ref{exe.laurent.t} \textbf{(b)}.

Let us make a table of the first few entries of the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $ (for $k=3$):
\[%
\begin{tabular}
[c]{|c||c|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$ & $10$ & $11$
& $12$ & $13$\\\hline
$t_{n}$ & $1$ & $1$ & $1$ & $2$ & $3$ & $7$ & $11$ & $26$ & $41$ & $97$ &
$153$ & $362$ & $571$ & $1351$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]
This sequence is sequence \href{https://oeis.org/A005246}{A005246 in the
OEIS}, and is $\left(  0,4,0,-1\right)  $-recurrent (as we know from Exercise
\ref{exe.laurent.t} \textbf{(a)}).
\end{example}

\begin{example}
\label{exa.laurent.tk1-1}Set $k=2$ in Exercise \ref{exe.laurent.tk1}. Then,
$t_{0}=t_{1}=1$ and
\begin{equation}
t_{n}=\dfrac{1+t_{n-1}}{t_{n-2}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq2.
\label{eq.exa.laurent.tk1-1.rec}%
\end{equation}
Let us make a table of the first few entries of the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $:%
\[%
\begin{tabular}
[c]{|c||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$ & $10$ & $11$
& $12$\\\hline
$t_{n}$ & $1$ & $1$ & $2$ & $3$ & $2$ & $1$ & $1$ & $2$ & $3$ & $2$ & $1$ &
$1$ & $2$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]
This reveals that the sequence $\left(  t_{0},t_{1},t_{2},\ldots\right)  $ is
$5$-periodic (with values $1,1,2,3,2$ repeating over and over). This can be
proved by a straightforward computation (just use
(\ref{eq.exa.laurent.tk1-1.rec}) four times to show that $t_{n}=t_{n+5}$).
Despite its trivial nature, this sequence appears in the OEIS (as
\href{https://oeis.org/A076839}{sequence A076839}).
\end{example}

\begin{example}
\label{exa.laurent.tk1-3}Set $k=4$ in Exercise \ref{exe.laurent.tk1}. Then,
$t_{0}=t_{1}=t_{2}=t_{3}=1$ and
\[
t_{n}=\dfrac{1+t_{n-1}t_{n-2}t_{n-3}}{t_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for
each }n\geq4.
\]
Let us make a table of the first few entries of the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$t_{n}$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $7$ & $43$ & $452$ & $45351$ &
$125920291$ & $60027819184831$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]
The rapid growth of the $t_{n}$ (after a slow start for $n\leq7$) strikes the
eye. Actually, the sequence grows at least doubly exponentially\footnotemark,
whence it is not $\left(  a_{1},a_{2},\ldots,a_{m}\right)  $-recurrent for any
positive integer $m$ and any numbers $a_{1},a_{2},\ldots,a_{m}$ (because
Theorem \ref{thm.akrec.binet} shows that any $\left(  a_{1},a_{2},\ldots
,a_{m}\right)  $-recurrent sequence grows at most exponentially). The sequence
$\left(  t_{0},t_{1},t_{2},\ldots\right)  $ is
\href{https://oeis.org/A051786}{A051786 in the OEIS}.
\end{example}

\footnotetext{To make this more precise: It is not hard to prove that
$t_{n}\geq2^{f_{n-3}}$ for each $n\geq3$ (where $\left(  f_{0},f_{1}%
,f_{2},\ldots\right)  $ is the Fibonacci sequence). Since the Fibonacci
sequence grows exponentially, we thus conclude that $t_{n}$ grows at least
doubly exponentially.
\par
The inequality $t_{n}\geq2^{f_{n-3}}$ can be proved by induction on $n$. Here
is an outline: The first step is to show (by strong induction) that $t_{n}\geq
t_{n-1}$ for each positive integer $n$. The next step is to show that
$t_{n}\geq t_{n-1}t_{n-2}$ for each integer $n\geq2$. Once this is done,
$t_{n}\geq2^{f_{n-3}}$ can be proved by strong induction (the induction step
is arguing that $t_{m}\geq\underbrace{t_{m-1}}_{\geq2^{f_{m-4}}}%
\underbrace{t_{m-2}}_{\geq2^{f_{m-5}}}\geq2^{f_{m-4}}2^{f_{m-5}}%
=2^{f_{m-4}+f_{m-5}}=2^{f_{m-3}}$).} Rather than solving Exercise
\ref{exe.laurent.tk1} directly, let us generalize it even further:

\begin{exercise}
\label{exe.laurent.tk2}Fix a positive integer $k\geq2$. Fix $k-1$ positive
integers $p_{1},p_{2},\ldots,p_{k-1}$. Define a sequence $\left(  t_{0}%
,t_{1},t_{2},\ldots\right)  $ of positive rational numbers recursively by
setting%
\begin{equation}
t_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k \label{eq.exe.laurent.tk2.bas}%
\end{equation}
and%
\begin{equation}
t_{n}=\dfrac{1+t_{n-1}^{p_{1}}t_{n-2}^{p_{2}}\cdots t_{n-k+1}^{p_{k-1}}%
}{t_{n-k}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.
\label{eq.exe.laurent.tk2.rec}%
\end{equation}
(For example, $t_{k}=\dfrac{1+t_{k-1}^{p_{1}}t_{k-2}^{p_{2}}\cdots
t_{1}^{p_{k-1}}}{t_{0}}=\dfrac{1+1^{p_{1}}1^{p_{2}}\cdots1^{p_{k-1}}}{1}=2$
and likewise $t_{k+1}=1+2^{p_{1}}$.)

Prove that $t_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{example}
\label{exa.laurent.tk2.1}Exercise \ref{exe.laurent.tk1} is the particular case
of Exercise \ref{exe.laurent.tk2} when all the integers $p_{1},p_{2}%
,\ldots,p_{k-1}$ equal $1$. (Indeed, the equality
(\ref{eq.exe.laurent.tk2.rec}) turns into (\ref{eq.exe.laurent.tk1.rec}) in
this case.)
\end{example}

\begin{example}
\label{exa.laurent.tk2.cex1}Let us illustrate why it is important that the
integers $p_{1},p_{2},\ldots,p_{k-1}$ in Exercise \ref{exe.laurent.tk2} are
positive. Indeed, let us pick $k=4$, $p_{1}=1$, $p_{2}=1$ and $p_{3}=0$ (so
$p_{3}$ is not positive but merely nonnegative). Then, the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $ satisfies $t_{0}=t_{1}=t_{2}=t_{3}=1$ and
\[
t_{n}=\dfrac{1+t_{n-1}t_{n-2}}{t_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq4.
\]
Let us make a table of the first few entries of the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $:%
\[%
\begin{tabular}
[c]{|c||c|c|c|c|c|c|c|c|c|c|}\hline
$n$ & $0$ & $1$ & $2$ & $3$ & $4$ & $5$ & $6$ & $7$ & $8$ & $9$\\\hline
$t_{n}$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $7$ & $22$ & $\dfrac{155}{2}$ &
$\dfrac{1706}{3}$\\\hline
\end{tabular}
\ \ \ \ \ \ .
\]
We see that $t_{8}$ and $t_{9}$ are not positive integers. So the claim of
Exercise \ref{exe.laurent.tk2} does not hold in this case.
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.laurent.tk2}.]For each integer $n\geq k$, we
have%
\begin{equation}
t_{n}t_{n-k}=1+t_{n-1}^{p_{1}}t_{n-2}^{p_{2}}\cdots t_{n-k+1}^{p_{k-1}}.
\label{sol.laurent.tk2.rec}%
\end{equation}
(Indeed, this follows by multiplying both sides of the equality
(\ref{eq.exe.laurent.tk2.rec}) by $t_{n-k}$.)

We must prove that%
\begin{equation}
t_{n}\text{ is a positive integer} \label{sol.laurent.tk2.goal}%
\end{equation}
for each integer $n\geq0$.

We shall prove (\ref{sol.laurent.tk2.goal}) by strong induction on $n$:

\textit{Induction step:} Let $m\geq0$ be an integer. Assume (as the induction
hypothesis) that (\ref{sol.laurent.tk2.goal}) holds for $n<m$. We must prove
that (\ref{sol.laurent.tk2.goal}) holds for $n=m$. In other words, we must
prove that $t_{m}$ is a positive integer. It clearly suffices to show that
$t_{m}$ is an integer (since we already know that $t_{m}$ is positive).

Hence, our goal is to prove that $t_{m}$ is an integer. If $m<k$, then this is
clearly true\footnote{Indeed, if $m<k$, then $t_{m}=1$ (by
(\ref{eq.exe.laurent.tk2.bas}), applied to $n=m$), and thus $t_{m}$ is an
integer (since $1$ is an integer).}. Thus, for the rest of this proof, we WLOG
assume that we don't have $m<k$. Hence, $m\geq k$. Thus,
(\ref{eq.exe.laurent.tk2.rec}) (applied to $n=m$) yields%
\begin{equation}
t_{m}=\dfrac{1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}%
}{t_{m-k}}. \label{sol.laurent.tk2.tm=}%
\end{equation}


We have assumed that (\ref{sol.laurent.tk2.goal}) holds for $n<m$. In other
words, $t_{n}$ is a positive integer for each $n<m$. In other words,
$t_{0},t_{1},\ldots,t_{m-1}$ are positive integers. In other words, the
numbers $t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$ are positive integers. This
will allow us to do modular arithmetic with these numbers (i.e., to state
congruences between these numbers).

Recall that our goal is to prove that $t_{m}$ is an integer. If $m-k<k$, then
this can easily be done\footnote{\textit{Proof.} Assume that $m-k<k$. Note
that $m-k\in\mathbb{N}$ (since $m\geq k$). Hence,
(\ref{eq.exe.laurent.tk2.bas}) (applied to $n=m-k$) yields $t_{m-k}=1$ (since
$m-k<k$). Now, (\ref{sol.laurent.tk2.tm=}) becomes%
\begin{align*}
t_{m}  &  =\dfrac{1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}%
}{t_{m-k}}=\dfrac{1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}%
}{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }t_{m-k}=1\right) \\
&  =1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}.
\end{align*}
The right hand side of this equality is an integer (since $t_{m-1}%
,t_{m-2},t_{m-3},\ldots,t_{0}$ are integers). Therefore, so is the left hand
side. In other words, $t_{m}$ is an integer. Hence, we have shown that $t_{m}$
is an integer under the assumption that $m-k<k$. Qed.}. Hence, for the rest of
this proof, we WLOG assume that we don't have $m-k<k$. Thus, $m-k\geq k$.

Let $r=m-k$. Then, $r=m-k\geq k\geq0$, so that $r\in\mathbb{N}$. Hence,
(\ref{sol.laurent.tk2.rec}) (applied to $n=r$) yields%
\begin{equation}
t_{r}t_{r-k}=1+t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots t_{r-k+1}^{p_{k-1}}
\label{sol.laurent.tk2.trtr-k=}%
\end{equation}
(since $r\geq k$). Note that the numbers $t_{r},t_{r-1},t_{r-2},\ldots
,t_{r-k}$ are among the numbers $t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}%
$\ \ \ \ \footnote{because $r=m-\underbrace{k}_{\geq2\geq1}\leq m-1$ and
$\underbrace{r}_{\geq k}-k\geq k-k=0$}, and thus are integers\footnote{since
the numbers $t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$ are integers}. Thus, all
the numbers that occur on either side of (\ref{sol.laurent.tk2.trtr-k=}) are
integers. Therefore,%
\begin{align*}
t_{r}  &  \mid t_{r}t_{r-k}=1+t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots
t_{r-k+1}^{p_{k-1}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.laurent.tk2.trtr-k=})}\right) \\
&  =t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots t_{r-k+1}^{p_{k-1}}-\left(
-1\right)  .
\end{align*}
In other words,%
\[
t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots t_{r-k+1}^{p_{k-1}}\equiv
-1\operatorname{mod}t_{r}.
\]
In other words,%
\begin{equation}
-1\equiv t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots t_{r-k+1}^{p_{k-1}%
}\operatorname{mod}t_{r}. \label{sol.laurent.tk2.mod1a}%
\end{equation}
Also, the numbers $t_{m-1},t_{m-2},\ldots,t_{m-k+1}$ are among the numbers
$t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$\ \ \ \ \footnote{since
$\underbrace{m-k}_{=r}+1=r+1\geq r\geq0$}, and thus are
integers\footnote{since the numbers $t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$ are
integers}. Hence,
\begin{align}
&  -t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}\nonumber\\
&  =\underbrace{\left(  -1\right)  }_{\substack{\equiv t_{r-1}^{p_{1}}%
t_{r-2}^{p_{2}}\cdots t_{r-k+1}^{p_{k-1}}\operatorname{mod}t_{r}\\\text{(by
(\ref{sol.laurent.tk2.mod1a}))}}}\left(  t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots
t_{m-k+1}^{p_{k-1}}\right) \nonumber\\
&  \equiv\underbrace{\left(  t_{r-1}^{p_{1}}t_{r-2}^{p_{2}}\cdots
t_{r-k+1}^{p_{k-1}}\right)  }_{=\prod_{i=1}^{k-1}t_{r-i}^{p_{i}}%
}\underbrace{\left(  t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}%
}\right)  }_{=\prod_{i=1}^{k-1}t_{m-i}^{p_{i}}}=\left(  \prod_{i=1}%
^{k-1}t_{r-i}^{p_{i}}\right)  \left(  \prod_{i=1}^{k-1}t_{m-i}^{p_{i}}\right)
\nonumber\\
&  =\prod_{i=1}^{k-1}\underbrace{\left(  t_{r-i}^{p_{i}}t_{m-i}^{p_{i}%
}\right)  }_{=\left(  t_{r-i}t_{m-i}\right)  ^{p_{i}}}=\prod_{i=1}%
^{k-1}\left(  t_{r-i}t_{m-i}\right)  ^{p_{i}}\operatorname{mod}t_{r}.
\label{sol.laurent.tk2.mod1b}%
\end{align}


On the other hand, we claim that%
\begin{equation}
t_{r-i}t_{m-i}\equiv1\operatorname{mod}t_{r} \label{sol.laurent.tk2.mod2}%
\end{equation}
for each $i\in\left\{  1,2,\ldots,k-1\right\}  $.

[\textit{Proof of (\ref{sol.laurent.tk2.mod2}):} Let $i\in\left\{
1,2,\ldots,k-1\right\}  $. Then, $1\leq i\leq k-1$, so that $m-\underbrace{i}%
_{\leq k-1\leq k}\geq m-k\geq k\geq0$. We now know that $m-i\geq k$, so that
we can apply (\ref{sol.laurent.tk2.rec}) to $n=m-i$. We thus find%
\[
t_{m-i}t_{m-i-k}=1+t_{m-i-1}^{p_{1}}t_{m-i-2}^{p_{2}}\cdots t_{m-i-k+1}%
^{p_{k-1}}.
\]
In other words,%
\begin{equation}
t_{m-i-1}^{p_{1}}t_{m-i-2}^{p_{2}}\cdots t_{m-i-k+1}^{p_{k-1}}=t_{m-i}%
t_{m-i-k}-1. \label{sol.laurent.tk2.mod2.pf.1}%
\end{equation}
The numbers $t_{m-i},t_{m-i-1},\ldots,t_{m-i-k}$ are among the numbers
$t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$\ \ \ \ \footnote{because
$m-\underbrace{i}_{\geq1}\leq m-1$ and $\underbrace{m-i}_{\geq k}-k\geq
k-k=0$}, and thus are integers\footnote{since the numbers $t_{m-1}%
,t_{m-2},t_{m-3},\ldots,t_{0}$ are integers}. Thus, all the numbers that occur
on either side of (\ref{sol.laurent.tk2.mod2.pf.1}) are integers. Let us now
set $j=k-i$. Then, $j=k-i\in\left\{  1,2,\ldots,k-1\right\}  $ (since
$i\in\left\{  1,2,\ldots,k-1\right\}  $). Hence, $t_{m-i-j}^{p_{j}}$ is one of
the factors in the product $t_{m-i-1}^{p_{1}}t_{m-i-2}^{p_{2}}\cdots
t_{m-i-k+1}^{p_{k-1}}$. Therefore, $t_{m-i-j}^{p_{j}}\mid t_{m-i-1}^{p_{1}%
}t_{m-i-2}^{p_{2}}\cdots t_{m-i-k+1}^{p_{k-1}}$ (since the numbers
$t_{m-i},t_{m-i-1},\ldots,t_{m-i-k}$ are integers). Moreover, $p_{j}$ is a
positive integer\footnote{since $p_{1},p_{2},\ldots,p_{k-1}$ are positive
integers}; thus, $t_{m-i-j}\mid t_{m-i-j}^{p_{j}}$. Hence,%
\begin{align*}
t_{m-i-j}  &  \mid t_{m-i-j}^{p_{j}}\mid t_{m-i-1}^{p_{1}}t_{m-i-2}^{p_{2}%
}\cdots t_{m-i-k+1}^{p_{k-1}}=t_{m-i}t_{m-i-k}-1\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.laurent.tk2.mod2.pf.1})}\right) \\
&  =t_{m-i}t_{r-i}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
m-i-k=\underbrace{m-k}_{=r}-i=r-i\right) \\
&  =t_{r-i}t_{m-i}-1.
\end{align*}
In other words, $t_{r-i}t_{m-i}\equiv1\operatorname{mod}t_{m-i-j}$. In view of
$m-i-\underbrace{j}_{=k-i}=m-i-\left(  k-i\right)  =m-k=r$, this rewrites as
$t_{r-i}t_{m-i}\equiv1\operatorname{mod}t_{r}$. This proves
(\ref{sol.laurent.tk2.mod2}).]

Now, each $i\in\left\{  1,2,\ldots,k-1\right\}  $ satisfies $t_{r-i}%
t_{m-i}\equiv1\operatorname{mod}t_{r}$ (by (\ref{sol.laurent.tk2.mod2})) and
therefore%
\begin{align}
\left(  t_{r-i}t_{m-i}\right)  ^{p_{i}}  &  \equiv1^{p_{i}}%
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.mod.k-power}, applied to }t_{r-i}%
t_{m-i}\text{, }1\text{, }t_{r}\text{ and }p_{i}\\
\text{instead of }a\text{, }b\text{, }n\text{ and }k
\end{array}
\right) \nonumber\\
&  =1\operatorname{mod}t_{r}. \label{sol.laurent.tk2.mod2b}%
\end{align}
Hence, (\ref{sol.laurent.tk2.mod1b}) becomes\footnote{In the following
computation, we use (\ref{eq.exe.ent.mod.k-sum.b}) to multiply several
congruences modulo $t_{r}$.}%
\[
-t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}\equiv\prod
_{i=1}^{k-1}\underbrace{\left(  t_{r-i}t_{m-i}\right)  ^{p_{i}}}%
_{\substack{\equiv1\operatorname{mod}t_{r}\\\text{(by
(\ref{sol.laurent.tk2.mod2b}))}}}\equiv\prod_{i=1}^{k-1}1=1\operatorname{mod}%
t_{r}.
\]
In other words, $1\equiv-t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}%
^{p_{k-1}}\operatorname{mod}t_{r}$. In other words,
\begin{equation}
t_{r}\mid1-\left(  -t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}%
}\right)  =1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}.
\label{sol.laurent.tk2.mod3}%
\end{equation}


The number $t_{r}$ is among the numbers $t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}%
$\ \ \ \ \footnote{because $r=m-\underbrace{k}_{\geq2\geq1}\leq m-1$ and
$r\geq k\geq0$}, and thus is a positive integer\footnote{since the numbers
$t_{m-1},t_{m-2},t_{m-3},\ldots,t_{0}$ are positive integers}, hence is
nonzero. Thus, from (\ref{sol.laurent.tk2.mod3}), we conclude that%
\[
\dfrac{1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}}{t_{r}}%
\in\mathbb{Z}.
\]
In view of $r=m-k$, this rewrites as%
\[
\dfrac{1+t_{m-1}^{p_{1}}t_{m-2}^{p_{2}}\cdots t_{m-k+1}^{p_{k-1}}}{t_{m-k}}%
\in\mathbb{Z}.
\]
In view of (\ref{sol.laurent.tk2.tm=}), this rewrites as $t_{m}\in\mathbb{Z}$.
In other words, $t_{m}$ is an integer. As we know, this is sufficient to
complete the induction step. Thus, the induction step is complete, and
(\ref{sol.laurent.tk2.goal}) is proved. This solves Exercise
\ref{exe.laurent.tk2}.
\end{proof}

Thus, we have solved Exercise \ref{exe.laurent.tk1} as well (since Exercise
\ref{exe.laurent.tk1} is the particular case of Exercise \ref{exe.laurent.tk2}
when all of $p_{1},p_{2},\ldots,p_{k-1}$ equal $1$). This yields a new
solution to Exercise \ref{exe.laurent.t} \textbf{(b)} (since the claim of
Exercise \ref{exe.laurent.tk1} in the case $k=3$ is precisely the claim of
Exercise \ref{exe.laurent.t} \textbf{(b)}).

\subsubsection{The Somos sequences}

Here is another problem of the \textquotedblleft unexpected
integrality\textquotedblright\ type (\cite[Chapter 2, Exercise 25]{Negut05},
\cite[Theorem 2.6]{Wemyss14}):

\begin{exercise}
\label{exe.laurent.somos5}Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<5
\label{eq.exe.laurent.somos5.bas}%
\end{equation}
and%
\begin{equation}
a_{n}=\dfrac{a_{n-1}a_{n-4}+a_{n-2}a_{n-3}}{a_{n-5}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq5. \label{eq.exe.laurent.somos5.rec}%
\end{equation}
(For example, $a_{5}=\dfrac{a_{4}a_{1}+a_{3}a_{2}}{a_{0}}=\dfrac
{1\cdot1+1\cdot1}{1}=2$ and likewise $a_{6}=3$.)

Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

The sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ in Exercise
\ref{exe.laurent.somos5} is known as the \textit{Somos-}$5$\textit{ sequence};
it is sequence \href{https://oeis.org/A006721}{A006721 in the OEIS}. Here is a
table of its first few entries:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$a_{n}$ & $1$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $5$ & $11$ & $37$ & $83$ &
$274$\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ .
\]
The growth rate of this sequence is faster than exponential\footnote{In fact,
using Landau's Big-O notation, we have $a_{n}=O\left(  q^{n^{2}}\right)  $ for
a constant $q\approx1.0728$. See \cite{Brown20} for a proof.}; thus, the
sequence is not $\left(  b_{1},b_{2},\ldots,b_{k}\right)  $-recurrent (for any
$b_{1},b_{2},\ldots,b_{k}$).

Here is a similar sequence (\cite[Theorem 1]{Malouf92}):

\begin{exercise}
\label{exe.laurent.somos4}Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of positive rational numbers recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<4
\]
and%
\[
a_{n}=\dfrac{a_{n-1}a_{n-3}+a_{n-2}^{2}}{a_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for
each }n\geq4.
\]


Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

The sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ in Exercise
\ref{exe.laurent.somos4} is known as the \textit{Somos-}$4$\textit{ sequence};
it is sequence \href{https://oeis.org/A006720}{A006720 in the OEIS}. Here is a
table of its first few entries:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$a_{n}$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $7$ & $23$ & $59$ & $314$ &
$1529$ & $8209$\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ .
\]


\begin{noncompile}
Exercise \ref{exe.laurent.somos4} also appeared as problem 2 in Round 2 of the
2nd MathLinks Contest, and was discussed in
https://artofproblemsolving.com/community/c6h18248 and
https://artofproblemsolving.com/community/c6h330409 .
\end{noncompile}

At this point, it should be clear (both from their names and from their
definitions) that the Somos-$4$ and Somos-$5$ sequences are part of a sequence
of sequences:

\begin{definition}
\label{def.laurent.somos-k}Let $k\geq2$ be an integer. The \textit{Somos-}%
$k$\textit{ sequence} is the sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of positive rational numbers defined recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\]
and%
\begin{align*}
a_{n}  &  =\dfrac{a_{n-1}a_{n-k+1}+a_{n-2}a_{n-k+2}+\cdots+a_{n-\left\lfloor
k/2\right\rfloor }a_{n-k+\left\lfloor k/2\right\rfloor }}{a_{n-k}}\\
&  =\dfrac{\sum_{i=1}^{\left\lfloor k/2\right\rfloor }a_{n-i}a_{n-k+i}%
}{a_{n-k}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.
\end{align*}

\end{definition}

It is easy to see that the Somos-$2$ and Somos-$3$ sequences are just the
constant sequence $\left(  1,1,1,\ldots\right)  $. We have seen the Somos-$4$
and Somos-$5$ sequences. Surprisingly, all entries of the Somos-$k$ sequences
for all $k\in\left\{  2,3,\ldots,7\right\}  $ are integers. However, the magic
stops at $k=7$: The $17$-th entry of the Somos-$8$ sequence is not an integer.

There is much to say about the Somos-$k$ sequences, as well as other sequences
with similar definitions and properties (we will in fact see some of them
later on). Good starting points are
\href{https://en.wikipedia.org/wiki/Somos_sequence}{the Wikipedia page for
\textquotedblleft Somos sequence\textquotedblright} and
\href{http://faculty.uml.edu/jpropp/somos.html}{Jim Propp's \textquotedblleft
Somos Sequences Site\textquotedblright}. As mentioned above, \cite[Chapters 1
and 4]{Gale98} gives an introduction with a few of the simplest proofs.
Similar sequences can be found in \cite{FomZel02}, \cite{AlCuHu16} and
\cite[Chapters 5--6]{Russel16}. Most of these sequences have connections to
combinatorics (in particular, the Somos-$k$ sequences for all $k\in\left\{
4,5,6,7\right\}  $ are known to enumerate perfect matchings in certain
graphs); also, the Somos-$k$ sequences are related to elliptic curves (see,
e.g., \cite{Poorte04}, or -- for a particularly short connection -- the
solution to Fifth Day problem 1 in \cite{Zagier96}). The Somos-$4$ and
Somos-$5$ sequences have nontrivial divisibility properties as well
(\cite{Kamp15}).

We shall not dwell on these wide and fertile grounds; however, we shall state
(without proof) two theorems that generalize the integrality of the Somos-$k$
sequences for $k\in\left\{  4,5,6,7\right\}  $. The first generalizes the
integrality of the Somos-$4$ and Somos-$5$ sequences:

\begin{theorem}
\label{thm.laurent.gale-rob2}Let $k\geq2$ be an integer. Let $i$ and $j$ be
two elements of $\left\{  1,2,\ldots,k-1\right\}  $. Let $w$ and $z$ be two
positive integers. Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)
$ of positive rational numbers recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\]
and%
\begin{equation}
a_{n}=\dfrac{wa_{n-i}a_{n-k+i}+za_{n-j}a_{n-k+j}}{a_{n-k}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.
\label{eq.thm.laurent.gale-rob2.rec}%
\end{equation}
Then, $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{theorem}

Exercise \ref{exe.laurent.somos4} (that is, the integrality of the Somos-$4$
sequence) is the particular case of Theorem \ref{thm.laurent.gale-rob2} for
$k=4$, $i=1$, $j=2$, $w=1$ and $z=1$. Exercise \ref{exe.laurent.somos5} (that
is, the integrality of the Somos-$5$ sequence) is the particular case of
Theorem \ref{thm.laurent.gale-rob2} for $k=5$, $i=1$, $j=2$, $w=1$ and $z=1$.

Note that the only reason why we required $w$ and $z$ to be positive in
Theorem \ref{thm.laurent.gale-rob2} is to ensure that all of $a_{0}%
,a_{1},a_{2},\ldots$ are positive; this prevents the denominator $a_{n-k}$ in
(\ref{eq.thm.laurent.gale-rob2.rec}) from becoming zero. If $a_{n-k}\neq0$ can
be guaranteed in some other way, then we can drop the requirement that $w$ and
$z$ be positive (although, of course, the claim must be changed: $a_{n}$ will
not generally be a positive integer, but merely an integer). The
\textquotedblleft grown-up\textquotedblright\ version of Theorem
\ref{thm.laurent.gale-rob2} does not deal with a sequence of integers at all;
instead, it considers $w$ and $z$ as indeterminates, so all of $a_{0}%
,a_{1},a_{2},\ldots$ are rational functions in these two indeterminates $w$
and $z$ (with integer coefficients). The claim is then that these rational
functions $a_{0},a_{1},a_{2},\ldots$ are actually polynomials with nonnegative
integer coefficients. This has been proved combinatorially (meaning that these
polynomials $a_{n}$ have been described explicitly, as sums over matchings in
certain graphs!) in \cite[Theorem 11]{BMPrWe09}. An alternative algebraic
proof (using the algebra of Laurent polynomials) has been given in
\cite[Example 1.7]{FomZel02}.

The next theorem generalizes the integrality of the Somos-$6$ and Somos-$7$ sequences:

\begin{theorem}
\label{thm.laurent.gale-rob3}Let $i$, $j$ and $\ell$ be three distinct
positive integers. Let $k=i+j+\ell$. Let $u$, $v$ and $w$ be three positive
integers. Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of
positive rational numbers recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\]
and%
\[
a_{n}=\dfrac{ua_{n-i}a_{n-k+i}+va_{n-j}a_{n-k+j}+wa_{n-\ell}a_{n-k+\ell}%
}{a_{n-k}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.
\]
Then, $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{theorem}

The integrality of the Somos-$6$ sequence is the particular case of Theorem
\ref{thm.laurent.gale-rob3} for $k=6$, $i=1$, $j=2$, $\ell=3$, $u=1$, $v=1$
and $w=1$. The integrality of the Somos-$7$ sequence is the particular case of
Theorem \ref{thm.laurent.gale-rob3} for $k=7$, $i=1$, $j=2$, $\ell=4$, $u=1$,
$v=1$ and $w=1$.

Theorem \ref{thm.laurent.gale-rob3} is known as the \textit{Gale-Robinson
sequence theorem}; it has been proved combinatorially in \cite[Theorem
6]{CarSpe04}, and algebraically in \cite[Example 1.3]{FomZel02}. Again, $u$,
$v$ and $w$ are best considered as indeterminates rather than fixed positive
integers; the resulting rational functions $a_{n}$ are polynomials having
explicit combinatorial interpretations.

\subsubsection{Odds and ends}

Exercise \ref{exe.laurent.somos4} can be generalized in yet another direction:
by putting exponents on the $a_{n-i}$'s (just as in Exercise
\ref{exe.laurent.tk2}). Indeed, we have the following (\cite[Chapter 1,
(8)]{Gale98}):

\begin{exercise}
\label{exe.laurent.somos4pqr}Fix three positive integers $p$, $q$ and $r$.
Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of positive
rational numbers recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<4
\]
and%
\begin{equation}
a_{n}=\dfrac{a_{n-1}^{p}a_{n-3}^{q}+a_{n-2}^{r}}{a_{n-4}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq4.
\label{eq.exe.laurent.somos4pqr.rec}%
\end{equation}


Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

However, this generalization cannot be merged with the $w$ and $z$ from
Theorem \ref{thm.laurent.gale-rob2}. To wit, if we replace
(\ref{eq.exe.laurent.somos4pqr.rec}) by%
\[
a_{n}=\dfrac{3a_{n-1}a_{n-3}+a_{n-2}}{a_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for
each }n\geq4,
\]
then $a_{8}=10337/2$ will fail to be an integer. On the other hand, the
recurrence%
\[
a_{n}=\dfrac{a_{n-1}a_{n-3}+za_{n-2}}{a_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for
each }n\geq4
\]
appears to produce integers $a_{n}$ for each $z\in\mathbb{N}$ and each
$n\in\mathbb{N}$. (Is there a proof?)

\begin{noncompile}
Indeed, the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ with starting
values $a_{0}=a_{1}=a_{2}=a_{3}=1$ and satisfying this recurrence can also be
shown to satisfy the recurrence%
\[
a_{n}=a_{n-3}+\left(  3+\left[  3\nmid n+1\right]  z\right)  a_{n-1}-\left(
3+\left[  3\nmid n-1\right]  z\right)  a_{n-2}%
\]
for each $n\geq3$ (CHECK THIS!); this allows showing (by induction on $n$)
that all its entries $a_{n}$ are integers.
\end{noncompile}

This area still offers many challenges and surprises. Let me mention a
counterexample and a few open problems:

\begin{example}
\label{exa.laurent.goebel}Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of positive rational numbers recursively by setting
$a_{0}=1$ and%
\begin{equation}
a_{n}=\dfrac{1+a_{0}^{2}+a_{1}^{2}+\cdots+a_{n-1}^{2}}{n}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1. \label{eq.exa.laurent.goebel.rec1}%
\end{equation}
This is known as
\textit{\href{https://mathworld.wolfram.com/GoebelsSequence.html}{\textit{G\"{o}bel's
sequence}}} (see also \href{https://oeis.org/A003504}{OEIS sequence A003504},
which is the same sequence shifted by an entry). It may appear that all its
entries are integers; but this is not so! The smallest $n$ for which $a_{n}$
is not an integer is $43$; the corresponding $a_{n}=a_{43}$ has about a
billion digits before the decimal point. (See \cite[Fifth Day, problem
3]{Zagier96} for a more detailed discussion of this sequence; note, however,
that it is defined starting with $a_{1}=2$ rather than $a_{0}=1$ there.)

Note that the recurrence relation (\ref{eq.exa.laurent.goebel.rec1}) can be
replaced by%
\[
a_{n}=\dfrac{\left(  n-1\right)  a_{n-1}+a_{n-1}^{2}}{n}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1.
\]

\end{example}

\begin{question}
\label{quest.laurent.MO248604}(MathOverflow questions \#248604 and \#323963:)
Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of positive
rational numbers recursively by setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<4
\]
and%
\[
a_{n}=\dfrac{\left(  a_{n-1}+1\right)  \left(  a_{n-2}+1\right)  \left(
a_{n-3}+1\right)  }{a_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq4.
\]
This is \href{https://oeis.org/A276123}{sequence A276123 in the OEIS}. Is
$a_{n}$ an integer for each $n\in\mathbb{N}$ ? It has been shown by mercio
(\href{https://math.stackexchange.com/a/1906097/}{math.stackexchange
\#1906097}) that each $a_{n}$ is a \textquotedblleft$2$%
-integer\textquotedblright\ (i.e., it becomes an integer when multiplied with
a sufficiently large power of $2$), but it is not clear whether the power of
$2$ can be dispensed with.

More generally, we can fix an integer $k\geq2$, and define a sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ of positive rational numbers recursively by
setting%
\[
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\]
and%
\[
a_{n}=\dfrac{\left(  a_{n-1}+1\right)  \left(  a_{n-2}+1\right)  \cdots\left(
a_{n-k+1}+1\right)  }{a_{n-k}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.
\]
The above sequence is obtained for $k=4$. For each $k\geq2$, one can ask
whether all the $a_{n}$ are integers. The cases $k=2$ and $k=3$ have been
resolved in the positive (i.e., it is known that each $a_{n}$ is an integer
when $k\in\left\{  2,3\right\}  $). The case $k=5$ is also open
(\href{https://mathoverflow.net/questions/323963}{MathOverflow question
\#323963}). For each $k>5$, the answer is negative (viz., $a_{2k}$ is not an integer).
\end{question}

Here are three similar questions (all found by the same Michael Somos who the
Somos-$k$ sequences originate with\footnote{See
\href{https://math.stackexchange.com/questions/3586309/is-oeis-a248049-an-integer-sequence}{math.stackexchange
question \#3586309}.}) that have been answered in the positive:

\begin{exercise}
\label{exe.laurent.mse3586309b}Define a sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{equation}
x_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<6,
\label{eq.exe.laurent.mse3586309b.bas}%
\end{equation}
and%
\begin{equation}
x_{n}=\dfrac{x_{n-3}\left(  x_{n-1}+x_{n-5}\right)  }{x_{n-6}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq6.
\label{eq.exe.laurent.mse3586309b.rec}%
\end{equation}


\textbf{(a)} Prove that $x_{n}+x_{n-4}+x_{n-8}=6x_{n-3}x_{n-4}x_{n-5}$ for
each $n\geq8$.

\textbf{(b)} Prove that $x_{n}$ an integer for each $n\in\mathbb{N}$.
\end{exercise}

Here is a table of the first few entries of this sequence:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$x_{n}$ & $1$ & $1$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $4$ & $10$ & $33$ &
$140$\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ \ .
\]


\begin{exercise}
\label{exe.laurent.mse3586309}Define a sequence $\left(  a_{0},a_{1}%
,a_{2},\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{equation}
a_{0}=2,\ \ \ \ \ \ \ \ \ \ a_{1}=1,\ \ \ \ \ \ \ \ \ \ a_{2}%
=1,\ \ \ \ \ \ \ \ \ \ a_{3}=1, \label{eq.exe.laurent.mse3586309.bas}%
\end{equation}
and%
\begin{equation}
a_{n}=\dfrac{\left(  a_{n-1}+a_{n-2}\right)  \left(  a_{n-2}+a_{n-3}\right)
}{a_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq4.
\label{eq.exe.laurent.mse3586309.rec}%
\end{equation}
This is \href{https://oeis.org/A248049}{sequence A248049 in the OEIS}.

\textbf{(a)} Prove that $a_{n}$ an integer for each $n\in\mathbb{N}$.

\textbf{(b)} Prove that $a_{n}=x_{n+2}x_{n+1}x_{n}x_{n-1}$ for each $n\geq1$,
where $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is the sequence defined in
Exercise \ref{exe.laurent.mse3586309b}.
\end{exercise}

Here is a table of the first few entries of this sequence:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$a_{n}$ & $2$ & $1$ & $1$ & $1$ & $2$ & $6$ & $24$ & $240$ & $3960$ & $184800$
& $33033000$ & $26125799700$\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ \ \ .
\]


\begin{exercise}
\label{exe.laurent.mse3586309c}Define a sequence $\left(  b_{0},b_{1}%
,b_{2},\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{equation}
b_{0}=1,\ \ \ \ \ \ \ \ \ \ b_{1}=1,\ \ \ \ \ \ \ \ \ \ b_{2}%
=1,\ \ \ \ \ \ \ \ \ \ b_{3}=1, \label{eq.exe.laurent.mse3586309c.bas}%
\end{equation}
and%
\begin{equation}
b_{n}=\dfrac{b_{n-2}\left(  b_{n-1}+b_{n-3}\right)  }{b_{n-4}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq4.
\label{eq.exe.laurent.mse3586309c.rec}%
\end{equation}
This is \href{https://oeis.org/A078918}{sequence A078918 in the OEIS}.

\textbf{(a)} Prove that $b_{n}$ an integer for each $n\in\mathbb{N}$.

\textbf{(b)} Prove that $b_{n}=x_{n+2}x_{n}$ for each $n\geq0$, where $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ is the sequence defined in Exercise
\ref{exe.laurent.mse3586309b}.

\textbf{(c)} Prove that $a_{n}=b_{n}b_{n-1}$ for each $n\geq1$, where $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ is the sequence defined in Exercise
\ref{exe.laurent.mse3586309}.
\end{exercise}

Here is a table of the first few entries of this sequence:%
\[%
\begin{tabular}
[c]{|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$ & $10$ &
$11$\\\hline
$b_{n}$ & $1$ & $1$ & $1$ & $1$ & $2$ & $3$ & $8$ & $30$ & $132$ & $1400$ &
$23595$ & $1107260$\\\hline
\end{tabular}
\ \ \ \ \ \ \ \ \ .
\]


Solutions to Exercises \ref{exe.laurent.mse3586309b},
\ref{exe.laurent.mse3586309} and Exercise \ref{exe.laurent.mse3586309c} can be
found in Section \ref{sect.hw4s}.

\newpage

\section{\label{chp.ext}The Extremal Principle}

This chapter is devoted to one of the simplest tricks in mathematics:
\textbf{When you have a bunch of objects, look at the smallest or the largest
among them}. This is known as the \textit{Extremal Principle}, since the word
\textquotedblleft extremal\textquotedblright\ includes both \textquotedblleft
smallest\textquotedblright\ and \textquotedblleft largest\textquotedblright.
This principle is far from a universal strategy that can be applied
mechanically; in particular, figuring out the exact meaning of
\textquotedblleft smallest\textquotedblright\ and \textquotedblleft
largest\textquotedblright\ is often a delicate and creative matter. For
example, if you have a bunch of finite sets of integers, which one is the
smallest? The one of smallest size?\footnote{We are saying \textquotedblleft
The one\textquotedblright\ here, but of course there can be several ones. For
example, among the three sets $\left\{  1,2\right\}  $, $\left\{  1,3\right\}
$ and $\left\{  0,1,2\right\}  $, the first two have the smallest size.} The
one whose smallest element is the smallest? The one whose sum of elements is
the smallest? The answer depends on what you are trying to achieve. When
applying the Extremal Principle, it is often necessary to cycle through
several possible meanings of \textquotedblleft smallest\textquotedblright\ (or
\textquotedblleft largest\textquotedblright) before finding one that helps
solve the problem.

\subsection{\label{sect.ext.principles}Existence theorems}

Before we see the Extremal Principle applied, let me recall some theorems that
guarantee the existence of extremal (i.e., minimal or maximal) objects. These
theorems are all fairly basic and will mostly be used without proof;
nevertheless it is worth recalling them at least once.

\begin{theorem}
\label{thm.ext.exist.fin}Let $S$ be a nonempty finite set of real numbers.
Then, $S$ has a minimum and a maximum.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ext.exist.fin}.]Proposition \ref{prop.ind.fin-min}
shows that $S$ has a maximum\footnote{To be more precise, Proposition
\ref{prop.ind.fin-min} shows this under the assumption that $S$ is a set of
\textbf{integers}, while we are here only assuming that $S$ is a set of
\textbf{real numbers}. However, the proof is the same in either case.}. The
same argument (mutatis mutandis\footnote{Once again, the words
\textquotedblleft mutatis mutandis\textquotedblright\ mean \textquotedblleft
once the things that need to be changed have been changed\textquotedblright.
The things that need to be changed here are the following: The
\textquotedblleft$\geq$\textquotedblright\ sign needs to be flipped (i.e.,
replaced by a \textquotedblleft$\leq$\textquotedblright\ sign); the word
\textquotedblleft maximum\textquotedblright\ needs to be replaced by
\textquotedblleft minimum\textquotedblright.}) shows that $S$ has a minimum.
This proves Theorem \ref{thm.ext.exist.fin}.
\end{proof}

The word \textquotedblleft nonempty\textquotedblright\ in Theorem
\ref{thm.ext.exist.fin} is clearly necessary: The empty set has neither a
minimum nor a maximum. The word \textquotedblleft finite\textquotedblright,
too, cannot simply be dropped (for example, the set $\left\{  \dfrac{1}%
{1},\dfrac{1}{2},\dfrac{1}{3},\ldots\right\}  $ has no minimum); but there are
many infinite sets that nevertheless have minima or maxima. For example, the
following holds (\cite[Theorem 2.44]{detnotes}):

\begin{theorem}
\label{thm.ext.exist.NN-min}Let $S$ be a nonempty set of nonnegative integers.
Then, $S$ has a minimum.
\end{theorem}

Of course, $S$ will not usually have a maximum in this situation; for example,
$\mathbb{N}$ itself has no maximum.

Note that we have used Theorem \ref{thm.ext.exist.NN-min} in Definition
\ref{def.ent.lcm.lcm} (when arguing that the smallest positive common multiple
of $k$ nonzero integers is well-defined). We have also tacitly used Theorem
\ref{thm.ext.exist.NN-min} in Corollary \ref{cor.seqs.per.min} (in the
corollary itself, not in the proof), when defining $m$ as the smallest period
of $u$. Indeed, the existence of \textquotedblleft the smallest period of
$u$\textquotedblright\ follows from the fact that the set $\left\{
\text{periods of }u\right\}  $ has a smallest element (i.e., a minimum); but
this is a particular case of Theorem \ref{thm.ext.exist.NN-min}.

Theorem \ref{thm.ext.exist.NN-min} can be generalized: For a set of integers,
the existence of a \textit{lower bound} guarantees the existence of a minimum,
while the existence of an \textit{upper bound} guarantees the existence of a
maximum. Let us recall what lower and upper bounds are:

\begin{definition}
Let $S$ be a set of real numbers. Let $a$ be a real number.

\textbf{(a)} We say that $a$ is a \textit{lower bound} for $S$ if and only if
every $s\in S$ satisfies $a\leq s$.

\textbf{(b)} We say that $a$ is an \textit{upper bound} for $S$ if and only if
every $s\in S$ satisfies $a\geq s$.
\end{definition}

For example, $0$ and any negative real number are lower bounds for the set
$\left\{  \dfrac{1}{1},\dfrac{1}{2},\dfrac{1}{3},\ldots\right\}  $, whereas
$1$ and any larger number are upper bounds for this set. No positive real is a
lower bound for this set, because if $a$ is a positive real, then there exists
a positive integer $n$ such that $\dfrac{1}{n}<a$ (for example, we can take
$n=\left\lfloor \dfrac{1}{a}+1\right\rfloor $).

Now, here is the promised generalization of Theorem \ref{thm.ext.exist.NN-min}:

\begin{theorem}
\label{thm.ext.exist.ZZ-min-max}Let $S$ be a nonempty set of integers. Then:

\textbf{(a)} If $S$ has a lower bound, then $S$ has a minimum.

\textbf{(b)} If $S$ has an upper bound, then $S$ has a maximum.
\end{theorem}

Note that the word \textquotedblleft integers\textquotedblright\ in Theorem
\ref{thm.ext.exist.ZZ-min-max} is important. Even with rational numbers, the
theorem would fail; for example, as we have seen above, the set $\left\{
\dfrac{1}{1},\dfrac{1}{2},\dfrac{1}{3},\ldots\right\}  $ has a lower bound but
no minimum. (And likewise, the set $\left\{  -\dfrac{1}{1},-\dfrac{1}%
{2},-\dfrac{1}{3},\ldots\right\}  $ has an upper bound but no maximum.)

\begin{fineprint}
For the sake of completeness, let us give a proof of Theorem
\ref{thm.ext.exist.ZZ-min-max}:

\begin{proof}
[Proof of Theorem \ref{thm.ext.exist.ZZ-min-max}.]\textbf{(a)} Assume that $S$
has a lower bound. Let $a$ be this lower bound.

Thus, $a$ is a lower bound of $S$. In other words, every $s\in S$ satisfies%
\begin{equation}
a\leq s \label{pf.thm.ext.exist.ZZ-min-max.a.aleqs}%
\end{equation}
(by the definition of a \textquotedblleft lower bound\textquotedblright).

There exists some $t\in S$ (since $t$ is nonempty). Consider this $t$.
Applying (\ref{pf.thm.ext.exist.ZZ-min-max.a.aleqs}) to $s=t$, we obtain
$a\leq t$.

Let $H$ denote the set of all integers $z$ satisfying $a\leq z\leq t$. Then,
the set $H$ is finite (since there are only finitely many integers between $a$
and $t$). Note that $t$ is an integer $z$ satisfying $a\leq z\leq t$ (since
$t$ is an integer\footnote{because $t\in S$ (and since $S$ is a set of
integers)} and since $a\leq t\leq t$). In other words, $t\in H$ (since $H$ is
the set of all such integers $z$).

Define a set $T$ of real numbers by $T=S\cap H$. Then, the set $T$ is a subset
of $H$ (since $T=S\cap H\subseteq H$), and thus is finite (since the set $H$
is finite). Moreover, $t\in T$\ \ \ \ \footnote{\textit{Proof.} We have $t\in
S$ and $t\in H$. Thus, $t\in S\cap H$. In other words, $t\in T$ (since
$T=S\cap H$).}. Hence, the set $T$ is nonempty. Now, we know that $T$ is a
nonempty finite set of real numbers. Therefore, Theorem
\ref{thm.ext.exist.fin} (applied to $T$ instead of $S$) yields that $T$ has a
minimum and a maximum. In particular, this shows that $T$ has a minimum. Let
$m$ be this minimum. By the definition of a \textquotedblleft
minimum\textquotedblright, this means that $m\in T$ and that we have
\begin{equation}
m\leq u\text{ for all }u\in T. \label{pf.thm.ext.exist.ZZ-min-max.a.mgeqt}%
\end{equation}
Applying (\ref{pf.thm.ext.exist.ZZ-min-max.a.mgeqt}) to $u=t$, we find $m\leq
t$ (since $t\in T$).

Now, it is easy to see that $m\in S$ (since $m\in T=S\cap H\subseteq S$) and
that we have $m\leq u$ for all $u\in S$\ \ \ \ \footnote{\textit{Proof.} Let
$u\in S$. We must show that $m\leq u$. Indeed, assume the contrary. Thus,
$m>u$, so that $u<m\leq t$. Also, $u\in S$ and thus $a\leq u$ (by
(\ref{pf.thm.ext.exist.ZZ-min-max.a.aleqs}), applied to $s=u$).\ Also, $u$ is
an integer (since $u\in S$, but $S$ is a set of integers). Hence, $u$ is an
integer and satisfies $a\leq u\leq t$ (since $u<t$). In other words, $u$ is an
integer $z$ satisfying $a\leq z\leq t$. In other words, $u\in H$ (since $H$ is
the set of all such integers $z$).
\par
Combining $u\in S$ with $u\in H$, we obtain $u\in S\cap H=T$. Hence,
(\ref{pf.thm.ext.exist.ZZ-min-max.a.mgeqt}) shows that $m\leq u$. But this
contradicts $m>u$. This contradiction shows that our assumption was false.
Hence, $m\leq u$ is proved.}. In other words, $m$ is a minimum of $S$ (by the
definition of a \textquotedblleft minimum\textquotedblright). Therefore, the
set $S$ has a minimum. This proves Theorem \ref{thm.ext.exist.ZZ-min-max}
\textbf{(a)}.

\textbf{(b)} The same argument that we just used to prove Theorem
\ref{thm.ext.exist.ZZ-min-max} \textbf{(a)} can be reused (mutatis mutandis)
to prove Theorem \ref{thm.ext.exist.ZZ-min-max} \textbf{(b)}.
(\textquotedblleft Mutatis mutandis\textquotedblright\ here means replacing
\textquotedblleft minimum\textquotedblright\ by \textquotedblleft
maximum\textquotedblright\ and \textquotedblleft lower bound\textquotedblright%
\ by \textquotedblleft upper bound\textquotedblright, as well as flipping all
inequality signs.)
\end{proof}
\end{fineprint}

Theorem \ref{thm.ext.exist.NN-min} is a particular case of Theorem
\ref{thm.ext.exist.ZZ-min-max} \textbf{(a)}, since any set of nonnegative
integers has a lower bound (namely, $0$).

We note in passing that some things can be said about infinite sets of real
numbers, even if neither Theorem \ref{thm.ext.exist.fin} nor Theorem
\ref{thm.ext.exist.ZZ-min-max} apply to them. Namely, we can define two
\textquotedblleft weaker\textquotedblright\ versions of minima and maxima:

\begin{definition}
Let $S$ be a set of real numbers.

\textbf{(a)} An \textit{infimum} (or \textit{greatest lower bound}) of $S$
means a maximum of the set of all lower bounds of $S$. That is, it means a
lower bound $a$ of $S$ with the property that every lower bound $b$ of $S$
satisfies $a\geq b$. An infimum of $S$ is unique if it exists, and is denoted
by $\inf S$.

\textbf{(b)} A \textit{supremum} (or \textit{least upper bound}) of $S$ means
a minimum of the set of all upper bounds of $S$. That is, it means an upper
bound $a$ of $S$ with the property that every upper bound $b$ of $S$ satisfies
$a\leq b$. A supremum of $S$ is unique if it exists, and is denoted by $\sup
S$.
\end{definition}

If a set $S$ of real numbers has a minimum, then this minimum is also an
infimum of $S$; but the converse is not true. For example, the set $\left\{
\dfrac{1}{1},\dfrac{1}{2},\dfrac{1}{3},\ldots\right\}  $ has infimum $0$ but
no minimum. Similar claims hold for maxima and suprema. See \cite[Example
2.7.3]{Swanso20} for various examples of infima and suprema. Now, the
following weakening of Theorem \ref{thm.ext.exist.ZZ-min-max} holds for sets
of reals:

\begin{theorem}
\label{thm.ext.exist.RR-inf-sup}Let $S$ be a nonempty set of reals. Then:

\textbf{(a)} If $S$ has a lower bound, then $S$ has an infimum. This infimum
is a minimum of $S$ if and only if it belongs to $S$.

\textbf{(b)} If $S$ has an upper bound, then $S$ has a supremum. This supremum
is a maximum of $S$ if and only if it belongs to $S$.
\end{theorem}

Theorem \ref{thm.ext.exist.RR-inf-sup} is one of the most fundamental results
in analysis. We refer to \cite[Theorem 3.8.5]{Swanso20} for its proof (more
precisely, for the proofs of the first sentences of parts \textbf{(a)} and
\textbf{(b)}; but the second sentences are easy exercises).

An infimum is a weaker concept than a minimum, and often less useful. Thus,
one sometimes wants stronger results that guarantee the existence of minima
and maxima rather than merely infima and suprema. Topology can sometimes
provide such results; in particular, the following holds:\footnote{We refer to
\cite[\S 3.13]{Swanso20} for the definition of the topology on $\mathbb{R}$.}

\begin{theorem}
\label{thm.ext.exist.RR-min-max}Let $S$ be a nonempty set of reals that is
closed with respect to the topology on $\mathbb{R}$. Then:

\textbf{(a)} If $S$ has a lower bound, then $S$ has a minimum.

\textbf{(b)} If $S$ has an upper bound, then $S$ has a maximum.
\end{theorem}

The proof of Theorem \ref{thm.ext.exist.RR-min-max} is implicit in \cite[proof
of Theorem 5.2.2]{Swanso20}.

\subsection{Applications}

\subsubsection{Writing numbers as sums of powers of $2$}

We shall now see various uses of the Extremal Principle. We begin with a
well-known result:

\begin{theorem}
\label{thm.ext.base-2.eu}Let $n\in\mathbb{N}$. Then, there is a unique finite
subset $T$ of $\mathbb{N}$ such that $n=\sum_{t\in T}2^{t}$.
\end{theorem}

In words, Theorem \ref{thm.ext.base-2.eu} is saying that each $n\in\mathbb{N}$
can be written in a unique way as a sum of (finitely many) distinct powers of
$2$ (where \textquotedblleft powers of $2$\textquotedblright\ means numbers of
the form $2^{t}$ with $t\in\mathbb{N}$). Here, of course, \textquotedblleft in
a unique way\textquotedblright\ means that the set of powers of $2$ being
added is unique (so we aren't counting $2^{3}+2^{6}$ and $2^{6}+2^{3}$ as two
different ways). Here are some examples:

\begin{example}
If $n=12$, then $n=2^{2}+2^{3}=\sum_{t\in\left\{  2,3\right\}  }2^{t}$.

If $n=23$, then $n=2^{0}+2^{1}+2^{2}+2^{4}=\sum_{t\in\left\{  0,1,2,4\right\}
}2^{t}$.

If $n=0$, then $n=\left(  \text{empty sum}\right)  =\sum_{t\in\varnothing
}2^{t}$.
\end{example}

The reader will probably have noticed that Theorem \ref{thm.ext.base-2.eu} is
just the existence and uniqueness of the base-$2$ representation of $n$ in
disguise. Indeed, if the base-$2$ representation of an $n\in\mathbb{N}$ is%
\[
n=b_{k}\cdot2^{k}+b_{k-1}\cdot2^{k-1}+\cdots+b_{0}\cdot2^{0}%
\]
(with $b_{0},b_{1},\ldots,b_{k}\in\left\{  0,1\right\}  $), then
\[
n=\sum_{t\in T}2^{t},\ \ \ \ \ \ \ \ \ \ \text{where }T=\left\{  i\in\left\{
0,1,\ldots,k\right\}  \ \mid\ b_{i}=1\right\}  .
\]
(And conversely, if we have a finite subset $T$ of $\mathbb{N}$ such that
$n=\sum_{t\in T}2^{t}$, then we can easily obtain a base-$2$ representation of
$n$ from it.) Thus, we don't have a pressing need to prove Theorem
\ref{thm.ext.base-2.eu}. Nevertheless, let us do so, since the proof
illustrates the Extremal Principle rather nicely.

We split Theorem \ref{thm.ext.base-2.eu} into two pieces: the existence and
the uniqueness. While it is possible to prove them together, I prefer shorter
proofs, even if some of the work will end up duplicated. The existence part of
Theorem \ref{thm.ext.base-2.eu} is the following proposition:

\begin{proposition}
\label{prop.ext.base-2.e}Let $n\in\mathbb{N}$. Then, there exists a finite
subset $T$ of $\mathbb{N}$ such that $n=\sum_{t\in T}2^{t}$.
\end{proposition}

The uniqueness part of Theorem \ref{thm.ext.base-2.eu} is the following proposition:

\begin{proposition}
\label{prop.ext.base-2.u}Let $n\in\mathbb{N}$. Let $T$ and $T^{\prime}$ be two
finite subsets of $\mathbb{N}$ such that $n=\sum_{t\in T}2^{t}$ and
$n=\sum_{t\in T^{\prime}}2^{t}$. Then, $T=T^{\prime}$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ext.base-2.e}.]We shall prove Proposition
\ref{prop.ext.base-2.e} by strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Proposition \ref{prop.ext.base-2.e} holds for $n<m$. We must
prove that Proposition \ref{prop.ext.base-2.e} holds for $n=m$. In other
words, we must prove that there exists a finite subset $T$ of $\mathbb{N}$
such that $m=\sum_{t\in T}2^{t}$.

If $m=0$, then this is obvious\footnote{\textit{Proof.} Assume that $m=0$.
Then, the empty set $\varnothing$ is a finite subset of $\mathbb{N}$ and
satisfies $\sum_{t\in\varnothing}2^{t}=\left(  \text{empty sum}\right)  =0$
and thus $m=0=\sum_{t\in\varnothing}2^{t}$. Hence, there exists a finite
subset $T$ of $\mathbb{N}$ such that $m=\sum_{t\in T}2^{t}$ (namely,
$T=\varnothing$). Thus, we have proved our claim under the assumption that
$m=0$.}. Thus, for the rest of this proof, we WLOG assume that $m\neq0$.
Hence, $m\geq1$.

It is easy to see that $m<2^{m}$\ \ \ \ \footnote{The quickest way to see this
is to apply (\ref{eq.exe.ind.geoser-b.b=2}) to $n=m$ and conclude that
$2^{0}+2^{1}+\cdots+2^{m-1}=2^{m}-1<2^{m}$, so that $2^{m}>\underbrace{2^{0}%
}_{\geq1}+\underbrace{2^{1}}_{\geq1}+\cdots+\underbrace{2^{m-1}}_{\geq1}%
\geq\underbrace{1+1+\cdots+1}_{m\text{ times}}=m$, and thus $m<2^{m}$.}.
Hence, there exists at least one $p\in\mathbb{N}$ such that $m<2^{p}$ (for
example, $p=m$ works). In other words, the set $\left\{  p\in\mathbb{N}%
\ \mid\ m<2^{p}\right\}  $ is nonempty. Hence, Theorem
\ref{thm.ext.exist.NN-min} shows that this set has a minimum (since it is a
set of nonnegative integers). In other words, there is a \textbf{smallest}
$p\in\mathbb{N}$ satisfying $m<2^{p}$. Let $q$ be this smallest $p$.

Thus, $q$ itself is a $p\in\mathbb{N}$ satisfying $m<2^{p}$. In other words,
$q\in\mathbb{N}$ and $m<2^{q}$. Hence, $2^{q}>m\geq1$, so that $q>0$.
Therefore, $q-1\in\mathbb{N}$. If we had $m<2^{q-1}$, then $q-1$ would
therefore be a $p\in\mathbb{N}$ satisfying $m<2^{p}$; but this would
contradict the fact that $q$ is the \textbf{smallest} such $p$. Hence, we
cannot have $m<2^{q-1}$. In other words, we have $m\geq2^{q-1}$.

Hence, $m-2^{q-1}\in\mathbb{N}$. Also, $m-2^{q-1}<m$ (since $2^{q-1}>0$).
Thus, Proposition \ref{prop.ext.base-2.e} holds for $n=m-2^{q-1}$ (since we
assumed that Proposition \ref{prop.ext.base-2.e} holds for $n<m$). In other
words, there exists a finite subset $T$ of $\mathbb{N}$ such that
$m-2^{q-1}=\sum_{t\in T}2^{t}$. Consider this $T$, and denote it by $T_{0}$.
Hence, $T_{0}$ is a finite subset of $\mathbb{N}$ such that $m-2^{q-1}%
=\sum_{t\in T_{0}}2^{t}$.

Now, from $m-2^{q-1}=\sum_{t\in T_{0}}2^{t}$, we obtain
\begin{equation}
m=2^{q-1}+\sum_{t\in T_{0}}2^{t}. \label{pf.thm.ext.base-2.eu.5}%
\end{equation}
It is not hard to see that $q-1\notin T_{0}$\ \ \ \ \footnote{\textit{Proof.}
Assume the contrary. Thus, $q-1\in T_{0}$. Hence, $2^{q-1}$ is an addend of
the sum $\sum_{t\in T_{0}}2^{t}$. Since all addends of this sum are
nonnegative, we thus conclude that $\sum_{t\in T_{0}}2^{t}\geq2^{q-1}$
(because a sum of nonnegative reals is always $\geq$ to each of its addends).
Hence, $m-2^{q-1}=\sum_{t\in T_{0}}2^{t}\geq2^{q-1}$, so that $m\geq
2^{q-1}+2^{q-1}=2\cdot2^{q-1}=2^{q}$. But this contradicts $m<2^{q}$. This
contradiction shows that our assumption was false. Qed.}. Hence, $\sum_{t\in
T_{0}\cup\left\{  q-1\right\}  }2^{t}=2^{q-1}+\sum_{t\in T_{0}}2^{t}$.
Comparing this with (\ref{pf.thm.ext.base-2.eu.5}), we find $m=\sum_{t\in
T_{0}\cup\left\{  q-1\right\}  }2^{t}$. Thus, there exists a finite subset $T$
of $\mathbb{N}$ such that $m=\sum_{t\in T}2^{t}$ (namely, $T=T_{0}\cup\left\{
q-1\right\}  $). This completes the induction step. Thus, Proposition
\ref{prop.ext.base-2.e} is proved by strong induction.
\end{proof}

\begin{proof}
[Proof of Proposition \ref{prop.ext.base-2.u}.]We shall prove Proposition
\ref{prop.ext.base-2.u} by strong induction on $n$:

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

We have assumed that Proposition \ref{prop.ext.base-2.u} holds for $n<m$. In
other words, the following claim holds:

\begin{statement}
\textit{Claim 1:} Let $n\in\mathbb{N}$ satisfy $n<m$. Let $T$ and $T^{\prime}$
be two finite subsets of $\mathbb{N}$ such that $n=\sum_{t\in T}2^{t}$ and
$n=\sum_{t\in T^{\prime}}2^{t}$. Then, $T=T^{\prime}$.
\end{statement}

Now, let us prove that Proposition \ref{prop.ext.base-2.u} holds for $n=m$.
Let $T$ and $T^{\prime}$ be two finite subsets of $\mathbb{N}$ such that
$m=\sum_{t\in T}2^{t}$ and $m=\sum_{t\in T^{\prime}}2^{t}$. We shall show that
$T=T^{\prime}$.

If $m=0$, then this is easy to prove\footnote{\textit{Proof.} Assume that
$m=0$. Then, $0=m=\sum_{t\in T}2^{t}$. Hence, $\sum_{t\in T}2^{t}=0$. In other
words, the sum $\sum_{t\in T}2^{t}$ is $0$. But all addends of the sum
$\sum_{t\in T}2^{t}$ are positive. Thus, if this sum was nonempty, then it
would be positive (because a nonempty sum of positive reals is positive),
which would contradict the fact that this sum is $0$. Hence, this sum must be
empty. In other words, $T=\varnothing$. The same argument (applied to
$T^{\prime}$ instead of $T$) yields $T^{\prime}=\varnothing$. Hence,
$T=\varnothing=T^{\prime}$. Thus, we have proved that $T=T^{\prime}$ under the
assumption that $m=0$.}. Thus, for the rest of this proof, we WLOG assume that
$m\neq0$.

If we had $T=\varnothing$, then we would have $\sum_{t\in T}2^{t}=\sum
_{t\in\varnothing}2^{t}=\left(  \text{empty sum}\right)  =0$, which would
contradict $\sum_{t\in T}2^{t}=m\neq0$. Hence, we cannot have $T=\varnothing$.
Thus, the set $T$ is nonempty. Hence, $T$ is a nonempty finite set of
integers. Therefore, Theorem \ref{thm.ext.exist.fin} (applied to $S=T$) shows
that $T$ has a minimum and a maximum. Thus, in particular, $T$ has a maximum.
Similarly, $T^{\prime}$ has a maximum. Consider these two maxima $\max T$ and
$\max\left(  T^{\prime}\right)  $.

We shall show that $\max T\leq\max\left(  T^{\prime}\right)  $. Indeed, assume
the contrary. Thus, $\max T>\max\left(  T^{\prime}\right)  $. The number $\max
T$ is an element of $T$ (by the definition of a maximum); therefore, $2^{\max
T}$ is an addend of the sum $\sum_{t\in T}2^{t}$. Since all addends of this
sum are nonnegative integers, we thus conclude that
\begin{equation}
\sum_{t\in T}2^{t}\geq2^{\max T} \label{pf.prop.ext.base-2.u.1}%
\end{equation}
(since a sum of nonnegative integers is always $\geq$ to any addend of this
sum). On the other hand, each element $s$ of the set $T^{\prime}$ satisfies
$s\leq\max\left(  T^{\prime}\right)  $ (by the definition of $\max\left(
T^{\prime}\right)  $) and therefore $s\leq\max\left(  T^{\prime}\right)  <\max
T$ (since $\max T>\max\left(  T^{\prime}\right)  $) and therefore
$s\in\left\{  0,1,\ldots,\max T-1\right\}  $ (since $s\in T^{\prime}%
\subseteq\mathbb{N}$). In other words, $T^{\prime}\subseteq\left\{
0,1,\ldots,\max T-1\right\}  $. Hence, the sum $\sum_{t\in T^{\prime}}2^{t}$
is a subsum\footnote{A \textit{subsum} of a sum $\sum_{s\in S}a_{s}$ means a
sum of the form $\sum_{s\in S^{\prime}}a_{s}$, where $S^{\prime}$ is a subset
of $S$.} of the sum $\sum_{t\in\left\{  0,1,\ldots,\max T-1\right\}  }2^{t}$.
Since all addends of the latter sum are nonnegative, we thus conclude that
$\sum_{t\in T^{\prime}}2^{t}\leq\sum_{t\in\left\{  0,1,\ldots,\max
T-1\right\}  }2^{t}$ (since a subsum of a sum of nonnegative reals is always
$\leq$ to the whole sum). Hence,%
\begin{align*}
m  &  =\sum_{t\in T^{\prime}}2^{t}\leq\sum_{t\in\left\{  0,1,\ldots,\max
T-1\right\}  }2^{t}=2^{0}+2^{1}+\cdots+2^{\max T-1}\\
&  =2^{\max T}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.exe.ind.geoser-b.b=2}), applied to }n=\max T\right) \\
&  <2^{\max T}.
\end{align*}
This contradicts
\[
m=\sum_{t\in T}2^{t}\geq2^{\max T}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.prop.ext.base-2.u.1})}\right)  .
\]
This contradiction shows that our assumption was wrong. Hence, $\max T\leq
\max\left(  T^{\prime}\right)  $ is proved. The same argument (with the roles
of $T$ and $T^{\prime}$ interchanged) yields $\max\left(  T^{\prime}\right)
\leq\max T$. Combining these two inequalities, we obtain $\max T=\max\left(
T^{\prime}\right)  $. Set $g=\max T$; thus, $g=\max T\in T$ and $g=\max
T=\max\left(  T^{\prime}\right)  \in T^{\prime}$.

Define an integer $n\in\mathbb{N}$ by $n=\sum_{t\in T\setminus\left\{
g\right\}  }2^{t}$. Then,
\begin{align*}
m  &  =\sum_{t\in T}2^{t}=2^{g}+\underbrace{\sum_{t\in T\setminus\left\{
g\right\}  }2^{t}}_{=n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }g\in T\right)
\\
&  =2^{g}+n,
\end{align*}
so that $n=m-2^{g}<m$ (since $2^{g}>0$). Also, from $n=m-2^{g}$, we obtain%
\[
2^{g}+n=m=\sum_{t\in T^{\prime}}2^{t}=2^{g}+\sum_{t\in T^{\prime}%
\setminus\left\{  g\right\}  }2^{t}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}g\in T^{\prime}\right)  .
\]
Subtracting $2^{g}$ from both sides of this equality, we find $n=\sum_{t\in
T^{\prime}\setminus\left\{  g\right\}  }2^{t}$.

Now, we know that $n\in\mathbb{N}$ satisfies $n<m$. Furthermore,
$T\setminus\left\{  g\right\}  $ and $T^{\prime}\setminus\left\{  g\right\}  $
are two finite subsets of $\mathbb{N}$ satisfying $n=\sum_{t\in T\setminus
\left\{  g\right\}  }2^{t}$ and $n=\sum_{t\in T^{\prime}\setminus\left\{
g\right\}  }2^{t}$. Hence, Claim 1 (applied to $T\setminus\left\{  g\right\}
$ and $T^{\prime}\setminus\left\{  g\right\}  $ instead of $T$ and $T^{\prime
}$) yields $T\setminus\left\{  g\right\}  =T^{\prime}\setminus\left\{
g\right\}  $. But $g\in T$ and thus%
\[
T=\underbrace{\left(  T\setminus\left\{  g\right\}  \right)  }_{=T^{\prime
}\setminus\left\{  g\right\}  }\cup\left\{  g\right\}  =\left(  T^{\prime
}\setminus\left\{  g\right\}  \right)  \cup\left\{  g\right\}  =T^{\prime
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }g\in T^{\prime}\right)  .
\]


Forget that we fixed $T$ and $T^{\prime}$. We thus have shown that if $T$ and
$T^{\prime}$ are two finite subsets of $\mathbb{N}$ such that $m=\sum_{t\in
T}2^{t}$ and $m=\sum_{t\in T^{\prime}}2^{t}$, then $T=T^{\prime}$. In other
words, Proposition \ref{prop.ext.base-2.u} holds for $n=m$. This completes the
induction step; thus, Proposition \ref{prop.ext.base-2.u} is proved.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.ext.base-2.eu}.]Proposition \ref{prop.ext.base-2.e}
shows that there exists a finite subset $T$ of $\mathbb{N}$ such that
$n=\sum_{t\in T}2^{t}$. Proposition \ref{prop.ext.base-2.u} then shows that
such a $T$ is unique. Theorem \ref{thm.ext.base-2.eu} is thus proved.
\end{proof}

The reader will have an opportunity to make a similar argument in Exercise
\ref{exe.ext.zeckendorf} below.

\subsubsection{Students in a lecture}

Our next application of the extremal principle is \cite[Exercise 3.11]{ngrin}
(slightly generalized):

\begin{exercise}
\label{exe.ext.studs}Let $n$ be a positive integer. A lecture is attended by
$n$ students. Each student enters the classroom once and leaves it once (and
does not come back). We know that among any three (distinct) students, there
are at least two that are together in the room at some moment. The lecturer
wants to make an announcement that every student will hear. Prove that the
lecturer can pick two moments at which to make the announcement so that each
student will hear it. (We assume that the announcement takes no time -- i.e.,
if a student leaves at the same moment that another student enters, the
lecturer can make the announcement at this moment and both students will hear it.)
\end{exercise}

Before we solve this exercise, let us formalize it mathematically. We do so by
labelling the $n$ students $1,2,\ldots,n$, and by encoding the times that
student $i$ is present in the classroom as a closed interval $I_{i}$ on the
real axis. We denote the two moments at which the announcement is made by $a$
and $b$. Thus, Exercise \ref{exe.ext.studs} takes the following shape:

\begin{exercise}
\label{exe.ext.studs-fml}Let $n$ be a positive integer. Let $I_{1}%
,I_{2},\ldots,I_{n}$ be $n$ nonempty finite closed intervals on the real axis.
Assume that for any three distinct elements $i,j,k\in\left\{  1,2,\ldots
,n\right\}  $, at least two of the three intervals $I_{i},I_{j},I_{k}$
intersect\footnotemark. Prove that there exist two reals $a$ and $b$ such that
each of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at least one of $a$
and $b$.
\end{exercise}

\footnotetext{Two sets $U$ and $V$ are said to \textit{intersect} if and only
if $U\cap V\neq\varnothing$. Note that two intervals $\left[  a,b\right]  $
and $\left[  b,c\right]  $ always intersect, even though the intersection is a
singleton set.}

\begin{proof}
[Solution to Exercise \ref{exe.ext.studs-fml}.]Write each interval $I_{m}$ as
$\left[  a_{m},b_{m}\right]  $ for two reals $a_{m}$ and $b_{m}$. Let
\begin{align*}
a  &  =\max\left\{  a_{m}\ \mid\ m\in\left\{  1,2,\ldots,n\right\}  \right\}
\ \ \ \ \ \ \ \ \ \ \text{and}\\
b  &  =\min\left\{  b_{m}\ \mid\ m\in\left\{  1,2,\ldots,n\right\}  \right\}
.
\end{align*}
\footnote{These maximum and minimum exist because of Theorem
\ref{thm.ext.exist.fin}.} (Thus, in the language of Exercise
\ref{exe.ext.studs}, the number $a$ is the moment at which the last student to
enter enters; likewise, $b$ is the moment at which the first student to leave leaves.)

We shall show that $a$ and $b$ have the required property -- i.e., that each
of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at least one of $a$ and
$b$.

Indeed, assume the contrary. Thus, there is a $p\in\left\{  1,2,\ldots
,n\right\}  $ such that the interval $I_{p}$ contains neither $a$ nor $b$.
Consider this $p$.

The interval $I_{p}$ contains neither $a$ nor $b$. That is, we have $a\notin
I_{p}$ and $b\notin I_{p}$. Recall that $I_{p}=\left[  a_{p},b_{p}\right]  $
(since $I_{m}=\left[  a_{m},b_{m}\right]  $ for each $m\in\left\{
1,2,\ldots,n\right\}  $). Thus, $a_{p}\leq b_{p}$ (since the interval $I_{p}$
is nonempty).

But we have $a=\max\left\{  a_{m}\ \mid\ m\in\left\{  1,2,\ldots,n\right\}
\right\}  $ and therefore $a\geq a_{m}$ for each $m\in\left\{  1,2,\ldots
,n\right\}  $ (by the definition of a maximum). Applying this to $m=p$, we
obtain $a\geq a_{p}$. Likewise, from $b=\min\left\{  b_{m}\ \mid\ m\in\left\{
1,2,\ldots,n\right\}  \right\}  $, we obtain $b\leq b_{p}$.

We have $a\geq a_{p}$. If we had $a\leq b_{p}$, then we would thus have
$a\in\left[  a_{p},b_{p}\right]  =I_{p}$, which would contradict $a\notin
I_{p}$. Hence, we cannot have $a\leq b_{p}$. In other words, we have $a>b_{p}$.

We have $b\leq b_{p}$. If we had $b\geq a_{p}$, then we would thus have
$b\in\left[  a_{p},b_{p}\right]  =I_{p}$, which would contradict $b\notin
I_{p}$. Hence, we cannot have $b\geq a_{p}$. In other words, we have $b<a_{p}$.

However, we also have $a=\max\left\{  a_{m}\ \mid\ m\in\left\{  1,2,\ldots
,n\right\}  \right\}  \in\left\{  a_{m}\ \mid\ m\in\left\{  1,2,\ldots
,n\right\}  \right\}  $ (since the maximum of a set is always an element of
that set). In other words, there exists some $m\in\left\{  1,2,\ldots
,n\right\}  $ such that $a=a_{m}$. Consider this $m$, and denote it by $u$.
Thus, $u\in\left\{  1,2,\ldots,n\right\}  $ such that $a=a_{u}$. Similarly, we
can find a $v\in\left\{  1,2,\ldots,n\right\}  $ such that $b=b_{v}$.

Recall that $I_{m}=\left[  a_{m},b_{m}\right]  $ for each $m\in\left\{
1,2,\ldots,n\right\}  $. Hence, $I_{u}=\left[  a_{u},b_{u}\right]  $ and
$I_{v}=\left[  a_{v},b_{v}\right]  $.

Now, $b_{u}=b<a_{p}$. Hence, the intervals $\left[  a_{u},b_{u}\right]  $ and
$\left[  a_{p},b_{p}\right]  $ do not intersect (since the interval $\left[
a_{u},b_{u}\right]  $ ends at $b_{u}$, whereas the interval $\left[
a_{p},b_{p}\right]  $ begins at $a_{p}$).

Also, $a>b_{p}$, so that $b_{p}<a=a_{v}$. Hence, the intervals $\left[
a_{p},b_{p}\right]  $ and $\left[  a_{v},b_{v}\right]  $ do not intersect
(since the interval $\left[  a_{p},b_{p}\right]  $ ends at $b_{p}$, whereas
the interval $\left[  a_{v},b_{v}\right]  $ begins at $a_{v}$).

Finally, $b_{u}<a_{p}\leq b_{p}<a_{v}$. Hence, the intervals $\left[
a_{u},b_{u}\right]  $ and $\left[  a_{v},b_{v}\right]  $ do not intersect
(since the interval $\left[  a_{u},b_{u}\right]  $ ends at $b_{u}$, whereas
the interval $\left[  a_{v},b_{v}\right]  $ begins at $a_{v}$).

Combining the results of the previous three paragraphs, we conclude that no
two of the three intervals $\left[  a_{u},b_{u}\right]  ,\left[  a_{p}%
,b_{p}\right]  ,\left[  a_{v},b_{v}\right]  $ intersect. In other words, no
two of the three intervals $I_{u},I_{p},I_{v}$ intersect (since $I_{u}=\left[
a_{u},b_{u}\right]  $ and $I_{p}=\left[  a_{p},b_{p}\right]  $ and
$I_{v}=\left[  a_{v},b_{v}\right]  $). This shows that $u$, $p$ and $v$ are
distinct (since otherwise, two of the three intervals $I_{u},I_{p},I_{v}$
would be equal, and thus would intersect\footnote{since these intervals are
nonempty}).

But we assumed that for any three distinct elements $i,j,k\in\left\{
1,2,\ldots,n\right\}  $, at least two of the three intervals $I_{i}%
,I_{j},I_{k}$ intersect. Applying this to $i=u$, $j=p$ and $k=v$, we conclude
that at least two of the three intervals $I_{u},I_{p},I_{v}$ intersect. But
this contradicts the fact that no two of the three intervals $I_{u}%
,I_{p},I_{v}$ intersect. This contradiction shows that our assumption was
false. Hence, we have shown that each of the intervals $I_{1},I_{2}%
,\ldots,I_{n}$ contains at least one of $a$ and $b$. This solves Exercise
\ref{exe.ext.studs-fml}.
\end{proof}

Does this mean we have solved Exercise \ref{exe.ext.studs}? It looks like it
does, but there is a minor wrinkle. Exercise \ref{exe.ext.studs} does not just
claim that there exist two moments such that each student is present in the
classroom at least at one of them. It also claims that the lecturer can pick
these two moments. This is a slightly stronger claim, as the lecturer might
not know in advance when the students will enter or leave the classroom until
they have done so (and by then, it might be too late to make the
announcements). Thus, the lecturer needs to work with incomplete information
(or at least Exercise \ref{exe.ext.studs} allows for such an interpretation).

To some extent, our solution to Exercise \ref{exe.ext.studs-fml} above works
even with this incomplete information. Indeed, the numbers $a$ and $b$ we
defined can be computed \textquotedblleft on the fly\textquotedblright\ if the
lecturer knows how many students she has (i.e., the number $n$) and pays
attention to their comings and goings. The number $a$ is the moment at which
the last student enters the classroom (so the head count is complete), and the
number $b$ is the moment at which the first student leaves the classroom. At
both of these moments, the lecturer (if she keeps a head count and pays
attention to students leaving) can immediately make the announcement.

But what if the lecturer does not know $n$? Without knowing how many students
there are in total, how to tell when the last one has entered? The way
Exercise \ref{exe.ext.studs} is stated, it is not clear whether this is a
situation to be considered\footnote{The original wording in \cite[Exercise
3.11]{ngrin} uses $n=100$, so this situation needs not be addressed.}, but we
can choose to do so anyway. Can the lecturer find $a$ and $b$ independently of
the number of students? Yes -- but this needs a different choice of $a$ and
$b$. See Exercise \ref{exe.ext.studs-strong} below for this. See also Exercise
\ref{exe.ext.studs-fml-k} for a generalization of Exercise
\ref{exe.ext.studs-fml}.

\subsubsection{Matching $n$ points to $n$ points with no intersection}

The next exercise comes from the realm of combinatorial geometry (see, e.g.,
\cite[Chapter 3, Example E4]{Engel} or \cite[Aufgabe 3.8]{ngrin} for somewhat
weaker versions of it):

\begin{exercise}
\label{exe.ext.no-intersect-1}Let $n\in\mathbb{N}$. Let $F_{1},F_{2}%
,\ldots,F_{n}$ be $n$ distinct points in the plane. Let $W_{1},W_{2}%
,\ldots,W_{n}$ be $n$ further distinct points in the plane. Assume that no
four of the $2n$ points $F_{1},F_{2},\ldots,F_{n},W_{1},W_{2},\ldots,W_{n}$
are collinear (i.e., lie on a common line). Let $\left[  n\right]  =\left\{
1,2,\ldots,n\right\}  $. Prove that there exists a bijection $\sigma:\left[
n\right]  \rightarrow\left[  n\right]  $ such that no two of the $n$
segments\footnotemark\ $F_{1}W_{\sigma\left(  1\right)  },F_{2}W_{\sigma
\left(  2\right)  },\ldots,F_{n}W_{\sigma\left(  n\right)  }$ intersect.
\end{exercise}

\footnotetext{The word \textquotedblleft segment\textquotedblright\ mens
\textquotedblleft line segment\textquotedblright. Two sets $U$ and $V$ are
said to \textit{intersect} if and only if $U\cap V\neq\varnothing$. Thus, two
line segments intersect even if they just have an endpoint in common (or an
endpoint of one lies on the other).}Exercise \ref{exe.ext.no-intersect-1} is
commonly worded as a road planning problem: The points $F_{1},F_{2}%
,\ldots,F_{n}$ are the positions of $n$ farms, while the points $W_{1}%
,W_{2},\ldots,W_{n}$ are the positions of $n$ wells. The exercise then claims
that there is a way to connect each farm to a well by a straight-line road in
such a way that no two roads intersect. (It is understood that different farms
should be connected to different wells.)

We note that Exercise \ref{exe.ext.no-intersect-1} would still hold if we
replaced \textquotedblleft plane\textquotedblright\ by \textquotedblleft
space\textquotedblright\ or even \textquotedblleft$d$-dimensional
space\textquotedblright\ for any $d\geq1$; we have just stated it on the plane
for reasons of familiarity. (Even the solution we will give below would still
apply in $d$-dimensional space for any $d\geq1$.)

Before we solve Exercise \ref{exe.ext.no-intersect-1}, let us illustrate it on
a small example.

\Needspace{15cm}

\begin{example}
Let $n=3$. Let $F_{1},F_{2},F_{3},W_{1},W_{2},W_{3}$ be the following six
points on the plane:%
\[%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\end{tikzpicture}%
%EndExpansion
\]
(Looks familiar?) There are six bijections $\sigma:\left[  n\right]
\rightarrow\left[  n\right]  $; let us draw the $n$ segments $F_{1}%
W_{\sigma\left(  1\right)  },F_{2}W_{\sigma\left(  2\right)  },\ldots
,F_{n}W_{\sigma\left(  n\right)  }$ for each of them:%
\[%
\begin{tabular}
[c]{|c|c|}\hline
$%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (e) -- (ee) (ll) -- (mm) (l) -- (m);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (e) -- (ee) (ll) -- (mm) (l) -- (m);
\end{tikzpicture}%
%EndExpansion
$ & $%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (e) -- (ee) (ll) -- (l) (mm) -- (m);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (e) -- (ee) (ll) -- (l) (mm) -- (m);
\end{tikzpicture}%
%EndExpansion
$\\\hline
$%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (ee) -- (ll) (mm) -- (m) (l) -- (e);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (ee) -- (ll) (mm) -- (m) (l) -- (e);
\end{tikzpicture}%
%EndExpansion
$ & $%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (ee) -- (ll) (mm) -- (e) (l) -- (m);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (ee) -- (ll) (mm) -- (e) (l) -- (m);
\end{tikzpicture}%
%EndExpansion
$\\\hline
$%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (ee) -- (m) (mm) -- (e) (l) -- (ll);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (ee) -- (m) (mm) -- (e) (l) -- (ll);
\end{tikzpicture}%
%EndExpansion
$ & $%
%TCIMACRO{\TeXButton{tikz F1-F3 W1-W3}{\begin{tikzpicture}[scale=1.5]
%\node(l) at (0.5 cm, 0.866 cm) {};
%\node(m) at (0.5 cm, -0.866 cm) {};
%\node(e) at (1 cm, 0 cm) {};
%\node(ll) at (-0.5 cm, -0.866 cm) {};
%\node(mm) at (-0.5 cm, 0.866 cm) {};
%\node(ee) at (-1 cm, 0 cm) {};
%\fill(l) circle (1pt) node[above right] {$F_3$};
%\fill(ll) circle (1pt) node[below left] {$W_2$};
%\fill(m) circle (1pt) node[below right] {$W_3$};
%\fill(mm) circle (1pt) node[above left] {$F_2$};
%\fill(e) circle (1pt) node[above right] {$W_1$};
%\fill(ee) circle (1pt) node[above left] {$F_1$};
%\draw[very thick, blue] (ee) -- (m) (mm) -- (ll) (l) -- (e);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(l) at (0.5 cm, 0.866 cm) {};
\node(m) at (0.5 cm, -0.866 cm) {};
\node(e) at (1 cm, 0 cm) {};
\node(ll) at (-0.5 cm, -0.866 cm) {};
\node(mm) at (-0.5 cm, 0.866 cm) {};
\node(ee) at (-1 cm, 0 cm) {};
\fill(l) circle (1pt) node[above right] {$F_3$};
\fill(ll) circle (1pt) node[below left] {$W_2$};
\fill(m) circle (1pt) node[below right] {$W_3$};
\fill(mm) circle (1pt) node[above left] {$F_2$};
\fill(e) circle (1pt) node[above right] {$W_1$};
\fill(ee) circle (1pt) node[above left] {$F_1$};
\draw[very thick, blue] (ee) -- (m) (mm) -- (ll) (l) -- (e);
\end{tikzpicture}%
%EndExpansion
$\\\hline
\end{tabular}
\
\]
The third bijection (i.e., the first one in the second row of the table) has
the property required in the problem (viz., that no two of the $n$ segments
$F_{1}W_{\sigma\left(  1\right)  },F_{2}W_{\sigma\left(  2\right)  }%
,\ldots,F_{n}W_{\sigma\left(  n\right)  }$ intersect).
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.ext.no-intersect-1} (sketched).]For any
bijection $\sigma:\left[  n\right]  \rightarrow\left[  n\right]  $, we define
the \textit{road length} $r\left(  \sigma\right)  $ by%
\[
r\left(  \sigma\right)  =\left\vert F_{1}W_{\sigma\left(  1\right)
}\right\vert +\left\vert F_{2}W_{\sigma\left(  2\right)  }\right\vert
+\cdots+\left\vert F_{n}W_{\sigma\left(  n\right)  }\right\vert \in
\mathbb{R}.
\]
(Visually speaking, this is the total length of road that needs to be paved if
we choose to connect the farms $F_{1},F_{2},\ldots,F_{n}$ to the wells
$W_{\sigma\left(  1\right)  },W_{\sigma\left(  2\right)  },\ldots
,W_{\sigma\left(  n\right)  }$, respectively.)

The set $\left\{  \text{bijections }\sigma:\left[  n\right]  \rightarrow
\left[  n\right]  \right\}  $ is clearly nonempty and finite\footnote{Indeed,
anyone familiar with basic combinatorics (or abstract algebra) will recognize
this set as the $n$\textit{-th symmetric group }$S_{n}$, and will know that it
has size $n!$. (See, e.g., Theorem \ref{thm.enum.perms} or \cite[Theorem
1.7.2]{19fco} for the proof of the latter fact.) But even if we don't know
this, we can easily see that this set is nonempty and finite. Indeed, it is
nonempty (since the identity map $\operatorname*{id}\nolimits_{\left[
n\right]  }:\left[  n\right]  \rightarrow\left[  n\right]  $ belongs to this
set) and finite (since it is a subset of the finite set $\left\{  \text{maps
}\left[  n\right]  \rightarrow\left[  n\right]  \right\}  $).}. Thus, the set
$\left\{  r\left(  \sigma\right)  \ \mid\ \sigma:\left[  n\right]
\rightarrow\left[  n\right]  \text{ is a bijection}\right\}  $ also is
nonempty and finite. Hence, this set has a minimum element\footnote{by Theorem
\ref{thm.ext.exist.fin}}. In other words, there exists a bijection
$\sigma:\left[  n\right]  \rightarrow\left[  n\right]  $ for which $r\left(
\sigma\right)  $ is minimum (among all such bijections). Consider this
$\sigma$. (If there are several $\sigma$ that all give the same minimum value
of $r\left(  \sigma\right)  $, then we just pick any of them.) Note that any
bijection $\sigma^{\prime}:\left[  n\right]  \rightarrow\left[  n\right]  $
satisfies%
\begin{equation}
r\left(  \sigma\right)  \leq r\left(  \sigma^{\prime}\right)
\label{sol.ext.no-intersect-1.min}%
\end{equation}
(since $\sigma$ was chosen in such a way that $r\left(  \sigma\right)  $ is
minimum). (Intuitively, the bijection $\sigma$ is an assignment of wells to
farms that minimizes the total road length.)

We shall now show that no two of the $n$ segments $F_{1}W_{\sigma\left(
1\right)  },F_{2}W_{\sigma\left(  2\right)  },\ldots,F_{n}W_{\sigma\left(
n\right)  }$ intersect. Indeed, assume the contrary. Thus, there exist two
distinct elements $i,j\in\left[  n\right]  $ such that the two segments
$F_{i}W_{\sigma\left(  i\right)  }$ and $F_{j}W_{\sigma\left(  j\right)  }$
intersect. Consider these $i,j$. The segments $F_{i}W_{\sigma\left(  i\right)
}$ and $F_{j}W_{\sigma\left(  j\right)  }$ intersect. The situation is
illustrated in the following picture (which also suggests the next step):%
\[%
%TCIMACRO{\TeXButton{tikz ij}{\begin{tikzpicture}[scale=1.5]
%\node(Fi) at (-1 cm, 0 cm) {};
%\node(Fj) at (0 cm, -1 cm) {};
%\node(Wsi) at (3 cm, 0 cm) {};
%\node(Wsj) at (1 cm, 1 cm) {};
%\fill(Fi) circle (1pt) node[above left] {$F_i$};
%\fill(Fj) circle (1pt) node[below left] {$F_j$};
%\fill(Wsi) circle (1pt) node[below right] {$W_{\sigma\left(i\right)}$};
%\fill(Wsj) circle (1pt) node[above left] {$W_{\sigma\left(j\right)}$};
%\draw[very thick, blue] (Fi) -- (Wsi) (Fj) -- (Wsj);
%\draw[thick, dotted, red] (Fi) -- (Wsj) (Fj) -- (Wsi);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(Fi) at (-1 cm, 0 cm) {};
\node(Fj) at (0 cm, -1 cm) {};
\node(Wsi) at (3 cm, 0 cm) {};
\node(Wsj) at (1 cm, 1 cm) {};
\fill(Fi) circle (1pt) node[above left] {$F_i$};
\fill(Fj) circle (1pt) node[below left] {$F_j$};
\fill(Wsi) circle (1pt) node[below right] {$W_{\sigma\left(i\right)}$};
\fill(Wsj) circle (1pt) node[above left] {$W_{\sigma\left(j\right)}$};
\draw[very thick, blue] (Fi) -- (Wsi) (Fj) -- (Wsj);
\draw[thick, dotted, red] (Fi) -- (Wsj) (Fj) -- (Wsi);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]


We have $i\neq j$ (since $i,j$ are distinct) and thus $\sigma\left(  i\right)
\neq\sigma\left(  j\right)  $ (since $\sigma$ is a bijection). Recall that no
four of the $2n$ points $F_{1},F_{2},\ldots,F_{n},W_{1},W_{2},\ldots,W_{n}$
are collinear. Hence, the four points $F_{i},F_{j},W_{\sigma\left(  i\right)
},W_{\sigma\left(  j\right)  }$ are not collinear (since $i\neq j$ and
$\sigma\left(  i\right)  \neq\sigma\left(  j\right)  $). Moreover, from $i\neq
j$, we obtain $F_{i}\neq F_{j}$ (since the $n$ points $F_{1},F_{2}%
,\ldots,F_{n}$ are distinct). Also, from $\sigma\left(  i\right)  \neq
\sigma\left(  j\right)  $, we obtain $W_{\sigma\left(  i\right)  }\neq
W_{\sigma\left(  j\right)  }$ (since the $n$ points $W_{1},W_{2},\ldots,W_{n}$
are distinct).

Now, we claim that%
\begin{equation}
\left\vert F_{i}W_{\sigma\left(  j\right)  }\right\vert +\left\vert
F_{j}W_{\sigma\left(  i\right)  }\right\vert <\left\vert F_{i}W_{\sigma\left(
i\right)  }\right\vert +\left\vert F_{j}W_{\sigma\left(  j\right)
}\right\vert . \label{sol.ext.no-intersect-1.smaller}%
\end{equation}
This appears rather obvious from a look at the above picture, but a rigorous
proof takes some work. We thus outsource this work into a lemma (Lemma
\ref{lem.ext.no-intersect-1.XYZW} below). The inequality
(\ref{sol.ext.no-intersect-1.smaller}) follows from Lemma
\ref{lem.ext.no-intersect-1.XYZW}, applied to $X=F_{i}$, $Y=W_{\sigma\left(
i\right)  }$, $Z=F_{j}$ and $W=W_{\sigma\left(  j\right)  }$ (since $F_{i}\neq
F_{j}$ and $W_{\sigma\left(  i\right)  }\neq W_{\sigma\left(  j\right)  }$,
and since the points $X,Z,Y,W$ are not collinear, and since the segments
$F_{i}W_{\sigma\left(  i\right)  }$ and $F_{j}W_{\sigma\left(  j\right)  }$ intersect).

Now, what do we gain from the inequality (\ref{sol.ext.no-intersect-1.smaller}%
)? Intuitively, it is telling us that if we replace the roads $F_{i}%
W_{\sigma\left(  i\right)  }$ and $F_{j}W_{\sigma\left(  j\right)  }$ by
$F_{i}W_{\sigma\left(  j\right)  }$ and $F_{j}W_{\sigma\left(  i\right)  }$
(that is, if we reconnect the wells $W_{\sigma\left(  i\right)  }$ and
$W_{\sigma\left(  j\right)  }$, which we originally connected to the farms
$F_{j}$ and $F_{i}$, to the farms $F_{j}$ and $F_{i}$ instead), then the total
road length decreases. This observation is helpful, since it contradicts the
fact that our original road connections were chosen to minimize the road
length. So let us formalize this: We define a new map $\sigma^{\prime}:\left[
n\right]  \rightarrow\left[  n\right]  $ by setting%
\[
\sigma^{\prime}\left(  k\right)  =%
\begin{cases}
\sigma\left(  k\right)  , & \text{if }k\neq i\text{ and }k\neq j;\\
\sigma\left(  j\right)  , & \text{if }k=i;\\
\sigma\left(  i\right)  , & \text{if }k=j
\end{cases}
\ \ \ \ \ \ \ \ \ \ \text{for each }k\in\left[  n\right]  .
\]
That is, the map $\sigma^{\prime}$ is obtained from $\sigma$ by swapping the
values at $i$ and $j$. It is clear that this map $\sigma^{\prime}$ is a
bijection (since $\sigma$ was a bijection, and we obtained $\sigma^{\prime}$
from $\sigma$ by swapping two values). Consequently,
(\ref{sol.ext.no-intersect-1.min}) yields $r\left(  \sigma\right)  \leq
r\left(  \sigma^{\prime}\right)  $. However, the definition of $r\left(
\sigma\right)  $ yields%
\begin{align}
r\left(  \sigma\right)   &  =\left\vert F_{1}W_{\sigma\left(  1\right)
}\right\vert +\left\vert F_{2}W_{\sigma\left(  2\right)  }\right\vert
+\cdots+\left\vert F_{n}W_{\sigma\left(  n\right)  }\right\vert =\sum
_{k\in\left[  n\right]  }\left\vert F_{k}W_{\sigma\left(  k\right)
}\right\vert \nonumber\\
&  =\left\vert F_{i}W_{\sigma\left(  i\right)  }\right\vert +\left\vert
F_{j}W_{\sigma\left(  j\right)  }\right\vert +\sum_{\substack{k\in\left[
n\right]  ;\\k\neq i\text{ and }k\neq j}}\left\vert F_{k}W_{\sigma\left(
k\right)  }\right\vert \label{sol.ext.no-intersect-1.rsi=}%
\end{align}
(here we have split off the addends for $k=i$ and for $k=j$ from the sum). The
same argument (applied to $\sigma^{\prime}$ instead of $\sigma$) yields%
\begin{align*}
r\left(  \sigma^{\prime}\right)   &  =\underbrace{\left\vert F_{i}%
W_{\sigma^{\prime}\left(  i\right)  }\right\vert }_{\substack{=\left\vert
F_{i}W_{\sigma\left(  j\right)  }\right\vert \\\text{(since }\sigma^{\prime
}\left(  i\right)  =\sigma\left(  j\right)  \text{)}}}+\underbrace{\left\vert
F_{j}W_{\sigma^{\prime}\left(  j\right)  }\right\vert }_{\substack{=\left\vert
F_{j}W_{\sigma\left(  i\right)  }\right\vert \\\text{(since }\sigma^{\prime
}\left(  j\right)  =\sigma\left(  i\right)  \text{)}}}+\sum_{\substack{k\in
\left[  n\right]  ;\\k\neq i\text{ and }k\neq j}}\underbrace{\left\vert
F_{k}W_{\sigma^{\prime}\left(  k\right)  }\right\vert }_{\substack{=\left\vert
F_{k}W_{\sigma\left(  k\right)  }\right\vert \\\text{(since }\sigma^{\prime
}\left(  k\right)  =\sigma\left(  k\right)  \\\text{(because }k\neq i\text{
and }k\neq j\text{))}}}\\
&  =\underbrace{\left\vert F_{i}W_{\sigma\left(  j\right)  }\right\vert
+\left\vert F_{j}W_{\sigma\left(  i\right)  }\right\vert }%
_{\substack{<\left\vert F_{i}W_{\sigma\left(  i\right)  }\right\vert
+\left\vert F_{j}W_{\sigma\left(  j\right)  }\right\vert \\\text{(by
(\ref{sol.ext.no-intersect-1.smaller}))}}}+\sum_{\substack{k\in\left[
n\right]  ;\\k\neq i\text{ and }k\neq j}}\left\vert F_{k}W_{\sigma\left(
k\right)  }\right\vert \\
&  <\left\vert F_{i}W_{\sigma\left(  i\right)  }\right\vert +\left\vert
F_{j}W_{\sigma\left(  j\right)  }\right\vert +\sum_{\substack{k\in\left[
n\right]  ;\\k\neq i\text{ and }k\neq j}}\left\vert F_{k}W_{\sigma\left(
k\right)  }\right\vert =r\left(  \sigma\right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.ext.no-intersect-1.rsi=})}\right)  .
\end{align*}
This contradicts $r\left(  \sigma\right)  \leq r\left(  \sigma^{\prime
}\right)  $. This contradiction shows that our assumption was wrong. Hence, no
two of the $n$ segments $F_{1}W_{\sigma\left(  1\right)  },F_{2}%
W_{\sigma\left(  2\right)  },\ldots,F_{n}W_{\sigma\left(  n\right)  }$
intersect. Thus, Exercise \ref{exe.ext.no-intersect-1} is solved, except that
we still owe a proof of the following lemma:
\end{proof}

\begin{lemma}
\label{lem.ext.no-intersect-1.XYZW}Let $X,Y,Z,W$ be four points in the plane.
Assume that $X\neq Z$ and $Y\neq W$. Assume furthermore that
\begin{equation}
\text{the points }X,Z,Y,W\text{ are not collinear.}
\label{eq.lem.ext.no-intersect-1.XYZW.non-coll}%
\end{equation}
Assume that the segments $XY$ and $ZW$ intersect. Then,%
\[
\left\vert XW\right\vert +\left\vert ZY\right\vert <\left\vert XY\right\vert
+\left\vert ZW\right\vert .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ext.no-intersect-1.XYZW}.]The segments $XY$ and $ZW$
intersect, i.e., have some point $Q$ in common. Consider this point $Q$. We
illustrate this situation with a picture, albeit we don't harbor any illusions
about its generality:%
\[%
%TCIMACRO{\TeXButton{tikz XYZW}{\begin{tikzpicture}[scale=1.5]
%\node(Fi) at (-1 cm, 0 cm) {};
%\node(Fj) at (0 cm, -1 cm) {};
%\node(Wsi) at (3 cm, 0 cm) {};
%\node(Wsj) at (1 cm, 1 cm) {};
%\node(Q) at (0.5 cm, 0 cm) {};
%\fill(Fi) circle (1pt) node[above left] {$X$};
%\fill(Fj) circle (1pt) node[below left] {$Z$};
%\fill(Wsi) circle (1pt) node[below right] {$Y$};
%\fill(Wsj) circle (1pt) node[above left] {$W$};
%\fill(Q) circle (1pt) node[above left] {$Q$};
%\draw[very thick, blue] (Fi) -- (Wsi) (Fj) -- (Wsj);
%\draw[thick, dotted, red] (Fi) -- (Wsj) (Fj) -- (Wsi);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(Fi) at (-1 cm, 0 cm) {};
\node(Fj) at (0 cm, -1 cm) {};
\node(Wsi) at (3 cm, 0 cm) {};
\node(Wsj) at (1 cm, 1 cm) {};
\node(Q) at (0.5 cm, 0 cm) {};
\fill(Fi) circle (1pt) node[above left] {$X$};
\fill(Fj) circle (1pt) node[below left] {$Z$};
\fill(Wsi) circle (1pt) node[below right] {$Y$};
\fill(Wsj) circle (1pt) node[above left] {$W$};
\fill(Q) circle (1pt) node[above left] {$Q$};
\draw[very thick, blue] (Fi) -- (Wsi) (Fj) -- (Wsj);
\draw[thick, dotted, red] (Fi) -- (Wsj) (Fj) -- (Wsi);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]


Recall the triangle inequality, which says that any triangle $ABC$ satisfies
$\left\vert AC\right\vert <\left\vert AB\right\vert +\left\vert BC\right\vert
$. This inequality holds even when the triangle $ABC$ is degenerate (i.e.,
when the three points $A,B,C$ are collinear), as long as we replace the
\textquotedblleft$<$\textquotedblright\ sign by a \textquotedblleft$\leq
$\textquotedblright\ sign. In other words, any three points $A,B,C$ in the
plane satisfy
\begin{equation}
\left\vert AC\right\vert \leq\left\vert AB\right\vert +\left\vert
BC\right\vert . \label{sol.ext.no-intersect-1.smaller.pf.treq}%
\end{equation}
Applying this to $A=X$, $B=Q$ and $C=W$, we obtain
\begin{equation}
\left\vert XW\right\vert \leq\left\vert XQ\right\vert +\left\vert
QW\right\vert . \label{sol.ext.no-intersect-1.smaller.pf.1}%
\end{equation}
The same argument (applied to $Z$ and $Y$ instead of $X$ and $W$) yields
\begin{equation}
\left\vert ZY\right\vert \leq\left\vert ZQ\right\vert +\left\vert
QY\right\vert . \label{sol.ext.no-intersect-1.smaller.pf.2}%
\end{equation}
However, the point $Q$ lies on the segment $XY$, and thus satisfies
$\left\vert XQ\right\vert +\left\vert QY\right\vert =\left\vert XY\right\vert
$. The same argument (applied to $Z$ and $W$ instead of $X$ and $Y$) yields
$\left\vert ZQ\right\vert +\left\vert QW\right\vert =\left\vert ZW\right\vert
$.

Now, adding the two inequalities (\ref{sol.ext.no-intersect-1.smaller.pf.1})
and (\ref{sol.ext.no-intersect-1.smaller.pf.2}) together, we find%
\begin{align}
\left\vert XW\right\vert +\left\vert ZY\right\vert  &  \leq\left(  \left\vert
XQ\right\vert +\left\vert QW\right\vert \right)  +\left(  \left\vert
ZQ\right\vert +\left\vert QY\right\vert \right) \nonumber\\
&  =\underbrace{\left\vert XQ\right\vert +\left\vert QY\right\vert
}_{=\left\vert XY\right\vert }+\underbrace{\left\vert ZQ\right\vert
+\left\vert QW\right\vert }_{=\left\vert ZW\right\vert }\nonumber\\
&  =\left\vert XY\right\vert +\left\vert ZW\right\vert .
\label{sol.ext.no-intersect-1.smaller.pf.leq}%
\end{align}
This is almost the inequality $\left\vert XW\right\vert +\left\vert
ZY\right\vert <\left\vert XY\right\vert +\left\vert ZW\right\vert $ that we
need to prove. But only \textquotedblleft almost\textquotedblright. In fact,
the inequality in (\ref{sol.ext.no-intersect-1.smaller.pf.leq}) has a
\textquotedblleft$\leq$\textquotedblright\ sign, while we want to prove the
same inequality with a \textquotedblleft$<$\textquotedblright\ sign. In other
words, we want to prove that the inequality
(\ref{sol.ext.no-intersect-1.smaller.pf.leq}) cannot be an equality.

We assume the contrary. That is, we assume that the inequality
(\ref{sol.ext.no-intersect-1.smaller.pf.leq}) is an equality. Thus, we have%
\begin{align}
\left\vert XW\right\vert +\left\vert ZY\right\vert  &  =\left\vert
XY\right\vert +\left\vert ZW\right\vert \nonumber\\
&  =\left(  \left\vert XQ\right\vert +\left\vert QW\right\vert \right)
+\left(  \left\vert ZQ\right\vert +\left\vert QY\right\vert \right)
\label{sol.ext.no-intersect-1.smaller.pf.eq1}%
\end{align}
(since we have previously shown that $\left(  \left\vert XQ\right\vert
+\left\vert QW\right\vert \right)  +\left(  \left\vert ZQ\right\vert
+\left\vert QY\right\vert \right)  =\left\vert XY\right\vert +\left\vert
ZW\right\vert $).

We notice the following basic fact: If $a,b,c,d$ are four real numbers
satisfying $a\leq b$ and $c\leq d$ and $a+c=b+d$, then $a=b$ and
$c=d$\ \ \ \ \footnote{\textit{Proof.} Let $a,b,c,d$ be four real numbers
satisfying $a\leq b$ and $c\leq d$ and $a+c=b+d$. Then, $b+d=\underbrace{a}%
_{\leq b}+c\leq b+c$ and $b+\underbrace{c}_{\leq d}\leq b+d$. Combining these
two inequalities, we find $b+d=b+c$. Hence, $d=c$, so that $c=d$. Now,
$a+c=b+\underbrace{d}_{=c}=b+c$, so that $a=b$. Hence, we have proved that
$a=b$ and $c=d$, qed.}. We can apply this to $a=\left\vert XW\right\vert $ and
$b=\left\vert XQ\right\vert +\left\vert QW\right\vert $ and $c=\left\vert
ZY\right\vert $ and $d=\left\vert ZQ\right\vert +\left\vert QY\right\vert $
(because the three relations (\ref{sol.ext.no-intersect-1.smaller.pf.1}),
(\ref{sol.ext.no-intersect-1.smaller.pf.2}) and
(\ref{sol.ext.no-intersect-1.smaller.pf.eq1}) are saying precisely that these
four numbers $a,b,c,d$ satisfy $a\leq b$ and $c\leq d$ and $a+c=b+d$). As a
result, we conclude that%
\begin{equation}
\left\vert XW\right\vert =\left\vert XQ\right\vert +\left\vert QW\right\vert
\label{sol.ext.no-intersect-1.smaller.pf.eqFi}%
\end{equation}
and%
\begin{equation}
\left\vert ZY\right\vert =\left\vert ZQ\right\vert +\left\vert QY\right\vert .
\label{sol.ext.no-intersect-1.smaller.pf.eqFj}%
\end{equation}


Now, we recall the triangle inequality in its original form. It says that if
three points $A,B,C$ form a nondegenerate triangle (i.e., are not collinear),
then $\left\vert AC\right\vert <\left\vert AB\right\vert +\left\vert
BC\right\vert $. Hence, the contrapositive holds: If three points $A,B,C$
satisfy $\left\vert AC\right\vert =\left\vert AB\right\vert +\left\vert
BC\right\vert $, then they are collinear. A bit of thought reveals an even
stronger conclusion: If three points $A,B,C$ satisfy $\left\vert AC\right\vert
=\left\vert AB\right\vert +\left\vert BC\right\vert $, then $B$ lies on the
segment $AC$. Applying this to $A=X$, $B=Q$ and $C=W$, we conclude that $Q$
lies on the segment $XW$ (since we have $\left\vert XW\right\vert =\left\vert
XQ\right\vert +\left\vert QW\right\vert $). The same argument (applied to $Z$
and $Y$ instead of $X$ and $W$) yields that $Q$ lies on the segment $ZY$.
Hence, in total, we know that the point $Q$ lies on the four segments
$XY,XW,ZY,ZW$.

It is now tempting to conclude right away that this forces all four points
$X,Z,Y,W$ are collinear. In truth, this is not totally obvious yet, since some
of the segments $XY,XW,ZY,ZW$ may be degenerate, or the point $Q$ might be an
endpoint of some of them. Thus, we proceed more cautiously.

We claim that we have $Q=X$ or $Q=Y$. Indeed, assume the contrary. Thus,
$Q\neq X$ and $Q\neq Y$. Thus, the lines $QX$ and $QY$ are well-defined. These
two lines $QX$ and $QY$ are furthermore equal (since $Q$ lies on the segment
$XY$), so we can call them the \textquotedblleft line $QXY$\textquotedblright.
This line $QXY$ contains the points $X$ and $Y$, thus also the point $W$
(since $Q$ lies on the segment $XW$) and the point $Z$ (since $Q$ lies on the
segment $ZY$); thus, it contains all four points $X,Z,Y,W$. Hence, these four
points $X,Z,Y,W$ are collinear. But this contradicts
(\ref{eq.lem.ext.no-intersect-1.XYZW.non-coll}). This contradiction shows that
our assumption was false.

Hence, we have shown that $Q=X$ or $Q=Y$. Similarly, we can see that $Q=Z$ or
$Q=W$. Hence, we are in one of the following two cases:

\textit{Case 1:} We have $Q=Z$.

\textit{Case 2:} We have $Q=W$.

Let us first consider Case 1. In this case, we have $Q=Z$. Hence, $Q=Z\neq X$
(since $X\neq Z$). But recall that we have $Q=X$ or $Q=Y$. Hence, we must have
$Q=Y$ (since $Q\neq X$). But $Q$ lies on the segment $XW$. In other words, $Z$
and $Y$ lie on the segment $XW$ (since $Q=Z$ and $Q=Y$). This shows that the
four points $X,Z,Y,W$ are collinear. But this contradicts
(\ref{eq.lem.ext.no-intersect-1.XYZW.non-coll}). Thus, we have found a
contradiction in Case 1.

Let us next consider Case 2. In this case, we have $Q=W$. Hence, $Q=W\neq Y$
(since $Y\neq W$). But recall that we have $Q=X$ or $Q=Y$. Hence, we must have
$Q=X$ (since $Q\neq Y$). But $Q$ lies on the segment $ZY$. In other words, $W$
and $X$ lie on the segment $ZY$ (since $Q=W$ and $Q=X$). This shows that the
four points $X,Z,Y,W$ are collinear. But this contradicts
(\ref{eq.lem.ext.no-intersect-1.XYZW.non-coll}). Thus, we have found a
contradiction in Case 2.

We have now found a contradiction in each of the Cases 1 and 2. Hence, we
always obtain a contradiction. Thus, our assumption was wrong. This means we
have shown that the inequality (\ref{sol.ext.no-intersect-1.smaller.pf.leq})
cannot be an equality. Hence, the \textquotedblleft$\leq$\textquotedblright%
\ sign in this inequality can be replaced by a \textquotedblleft%
$<$\textquotedblright\ sign. In other words, we have $\left\vert XW\right\vert
+\left\vert ZY\right\vert <\left\vert XY\right\vert +\left\vert ZW\right\vert
$. This proves Lemma \ref{lem.ext.no-intersect-1.XYZW}.
\end{proof}

\subsubsection{The round track puzzle}

The next exercise is a classic (e.g., \cite[Exercise 3.15]{Engel},
\cite[Exercise 8.2]{Engel},
\url{https://math.stackexchange.com/questions/2338579/} just to mention three sources):

\begin{exercise}
\label{exe.ext.cars-circular}Let $n$ be a positive integer. Consider a
circular track with $n$ gas stations on it. Consider a car. Assume that, taken
together, the $n$ gas stations have just enough gas for the car to complete
the entire track. Prove that at least one of these $n$ gas stations has the
property that if the car starts at this gas station with an initially empty
gas tank, then it can traverse the entire track without ever running out of
gas, provided that it refuels at every gas station it comes across (including
the one at which it starts).

(It is understood that the car's tank is large enough to fit all the gas it
can get. It is also understood that the track is one-way, so the car can only
move in one direction. It is also understood that the use of gas is
proportional to the length of road covered -- i.e., independent of speed and acceleration.)
\end{exercise}

\begin{example}
\label{exa.exe.ext.cars-circular.1}The following picture shows an example for
$n=5$:%
\[%
%TCIMACRO{\TeXButton{tikz circular track}{\begin{tikzpicture}[scale=2.5]
%\node(a) at ({cos(0)}, {sin(0)}) {};
%\node(b) at ({cos(-0.1*360)}, {sin(-0.1*360)}) {};
%\node(c) at ({cos(-0.4*360)}, {sin(-0.4*360)}) {};
%\node(d) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
%\node(e) at ({cos(-0.8*360)}, {sin(-0.8*360)}) {};
%\fill(a) circle (1pt) node[right] {$A$} node[left]{$(0.2)$};
%\fill(b) circle (1pt) node[below right] {$B$} node[above left]{$(0.1)$};
%\fill(c) circle (1pt) node[below left] {$C$} node[above right] {$(0.4)$};
%\fill(d) circle (1pt) node[left] {$D$} node[right] {$(0.2)$};
%\fill(e) circle (1pt) node[above] {$E$} node[below] {$(0.1)$};
%\draw[black] (1,0)
%arc[radius = 1, start angle=0, delta angle=0.1*360]
%node[above right] {$0.2$}
%arc[radius = 1, start angle=0.1*360, end angle=0.35*360]
%node[above left] {$0.3$}
%arc[radius = 1, start angle=0.35*360, end angle=0.55*360]
%node[left] {$0.1$}
%arc[radius = 1, start angle=0.55*360, end angle=0.75*360]
%node[below] {$0.3$}
%arc[radius = 1, start angle=0.75*360, end angle=0.95*360]
%node[right] {$0.1$}
%arc[radius = 1, start angle=0.95*360, end angle=360];
%\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\node(a) at ({cos(0)}, {sin(0)}) {};
\node(b) at ({cos(-0.1*360)}, {sin(-0.1*360)}) {};
\node(c) at ({cos(-0.4*360)}, {sin(-0.4*360)}) {};
\node(d) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
\node(e) at ({cos(-0.8*360)}, {sin(-0.8*360)}) {};
\fill(a) circle (1pt) node[right] {$A$} node[left]{$(0.2)$};
\fill(b) circle (1pt) node[below right] {$B$} node[above left]{$(0.1)$};
\fill(c) circle (1pt) node[below left] {$C$} node[above right] {$(0.4)$};
\fill(d) circle (1pt) node[left] {$D$} node[right] {$(0.2)$};
\fill(e) circle (1pt) node[above] {$E$} node[below] {$(0.1)$};
\draw[black] (1,0)
arc[radius = 1, start angle=0, delta angle=0.1*360]
node[above right] {$0.2$}
arc[radius = 1, start angle=0.1*360, end angle=0.35*360]
node[above left] {$0.3$}
arc[radius = 1, start angle=0.35*360, end angle=0.55*360]
node[left] {$0.1$}
arc[radius = 1, start angle=0.55*360, end angle=0.75*360]
node[below] {$0.3$}
arc[radius = 1, start angle=0.75*360, end angle=0.95*360]
node[right] {$0.1$}
arc[radius = 1, start angle=0.95*360, end angle=360];
\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
\end{tikzpicture}%
%EndExpansion
\]
Here, the $5$ gas stations are called $A,B,C,D,E$; the amount of gas available
from each gas station is written in parentheses beside the station; and the
length of road between two consecutive gas stations is written on the
corresponding piece of track. The measures of gas and road length are
normalized in such a way that the total length of the track is $1$, and the
total amount of gas in all stations is $1$. We understand that the car can
only go clockwise around the track.

In this example, we see that if a car with an empty tank were to start at $A$,
then it would not be able to traverse the entire track. Indeed, it would first
refuel at $A$; this would put $0.2$ units of gas in its tank; it would then
use $0.1$ units of gas to get to $B$; then it would refuel at $B$; then it
would have $0.2-0.1+0.1=0.2$ units of gas in its tank; but it would then run
out of gas between $B$ and $C$.

On the other hand, if a car with an empty tank were to start at $C$, then it
would be able to traverse the entire track; here is a plot of the gas in its
tank over the entire journey:%
\[%
%TCIMACRO{\TeXButton{tikz fuel plot}{\begin{tikzpicture}[scale=5.5]
%\draw
%[blue, very thick] (0, 0) -- (0, 0.4) -- (0.1, 0.3) -- (0.1, 0.3) -- (0.1, 0.5) -- (0.4, 0.2) -- (0.4, 0.3) -- (0.6, 0.1) -- (0.6, 0.3) -- (0.7, 0.2) -- (0.7, 0.3) -- (1,0);
%\draw[->] (-0.2,0) -- (1.2,0);
%\draw[->] (0,-0.2) -- (0,0.6);
%\node at (0, 0) [below] {$C$};
%\node at (0.1, 0) [below] {$D$};
%\node at (0.4, 0) [below] {$E$};
%\node at (0.6, 0) [below] {$A$};
%\node at (0.7, 0) [below] {$B$};
%\node at (1, 0) [below] {$C$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=5.5]
\draw
[blue, very thick] (0, 0) -- (0, 0.4) -- (0.1, 0.3) -- (0.1, 0.3) -- (0.1, 0.5) -- (0.4, 0.2) -- (0.4, 0.3) -- (0.6, 0.1) -- (0.6, 0.3) -- (0.7, 0.2) -- (0.7, 0.3) -- (1,0);
\draw[->] (-0.2,0) -- (1.2,0);
\draw[->] (0,-0.2) -- (0,0.6);
\node at (0, 0) [below] {$C$};
\node at (0.1, 0) [below] {$D$};
\node at (0.4, 0) [below] {$E$};
\node at (0.6, 0) [below] {$A$};
\node at (0.7, 0) [below] {$B$};
\node at (1, 0) [below] {$C$};
\end{tikzpicture}%
%EndExpansion
\]
(with the horizontal axis standing for road length covered, while the vertical
axis stands for the gas in the car's tank). (The labels $C,D,E,A,B,C$ at the
bottom mark the points at which the car is at a gas station.) Note that this
is a \textquotedblleft sawtooth function\textquotedblright\ plot, in which the
vertical segments correspond to refuelling and the downward slopes correspond
to gas being burned along the road.
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.ext.cars-circular} (sketched).]Imagine a new
car that starts somewhere on the track with enough gas to go through the
entire track. We call this the \textit{ghost car}. Now, let the ghost car go
around the track\footnote{We assume that the ghost car uses gas at the same
rate as the original car.}, refueling at each gas station (even though it does
not actually need this extra gas).

For example, in Example \ref{exa.exe.ext.cars-circular.1}, if the ghost car
starts at gas station $A$, then here is the plot of the gas in its tank:%
\[
\begin{tikzpicture}[scale=5.5]
\draw
[gray, very thick] (0, 1) -- (0, 1.2) -- (0.1, 1.1) -- (0.1, 1.2) -- (0.4, 0.9) -- (0.4, 1.3) -- (0.5, 1.2) -- (0.5, 1.4) -- (0.8, 1.1) -- (0.8, 1.2) -- (1, 1);
\draw[->] (-0.2,0) -- (1.2,0);
\draw[->] (0,-0.2) -- (0,1.5);
\node at (0, 0) [below] {$A$};
\node at (0.1, 0) [below] {$B$};
\node at (0.4, 0) [below] {$C$};
\node at (0.5, 0) [below] {$D$};
\node at (0.8, 0) [below] {$E$};
\node at (1, 0) [below] {$A$};
\end{tikzpicture}\ \ .
\]
Clearly, the ghost car never runs out of gas (since it had enough even before
refuelling); but there will be a point in its journey where its gas level is
minimum. More precisely, there will be a gas station at which the ghost car's
gas level (before refuelling) is minimum; let us pick such a gas station and
call it $P$. Thus, the ghost car's gas level at $P$ is $\leq$ to its gas level
at any other gas station, and thus also $\leq$ to its gas level at any point
on the road (because its gas level only declines between gas stations). In the
example above, $P=C$.

After the ghost car has completed its loop around the track, it is back at the
same station it started, and with the same amount of gas in its tank (since
the total gas it has spent during the loop was precisely the amount it
collected from the gas stations). At that point, we refill all gas stations
(with the same amount of gas that they initially had) and we let the ghost car
keep going around the circle (again collecting gas at the stations). Thus, the
ghost car makes another loop. This second loop is an exact repetition of its
previous loop (i.e., at each point, the ghost car has the same gas level on
its second loop as it did on its first loop), because the ghost car started
with the same gas level as initially and the gas stations had the same amount
of gas as initially. Thus, if we plot the gas level in the car, the part of
the plot that corresponds to the second loop is just a horizontally shifted
copy of the part corresponding to the first loop:%
\[
\begin{tikzpicture}[scale=5.5]
\draw
[gray, very thick] (0, 1) -- (0, 1.2) -- (0.1, 1.1) -- (0.1, 1.2) -- (0.4, 0.9) -- (0.4, 1.3) -- (0.5, 1.2) -- (0.5, 1.4) -- (0.8, 1.1) -- (0.8, 1.2) -- (1, 1) -- (1, 1.2) -- (1.1, 1.1) -- (1.1, 1.2) -- (1.4, 0.9) -- (1.4, 1.3) -- (1.5, 1.2) -- (1.5, 1.4) -- (1.8, 1.1) -- (1.8, 1.2) -- (2, 1);
\draw[->] (-0.2,0) -- (2.2,0);
\draw[->] (0,-0.2) -- (0,1.5);
\draw[dotted, ->] (1, -0.2) -- (1, 1.5);
\node at (0, 0) [below] {$A$};
\node at (0.1, 0) [below] {$B$};
\node at (0.4, 0) [below] {$C$};
\node at (0.5, 0) [below] {$D$};
\node at (0.8, 0) [below] {$E$};
\node at (1, 0) [below] {$A$};
\node at (1.1, 0) [below] {$B$};
\node at (1.4, 0) [below] {$C$};
\node at (1.5, 0) [below] {$D$};
\node at (1.8, 0) [below] {$E$};
\node at (2, 0) [below] {$A$};
\end{tikzpicture}\ \ .
\]
Thus, the minimum gas level (over both loops of the ghost car) is still
achieved at station $P$. In other words, the ghost car never has less gas in
its tank than it does at station $P$ (before refuelling).

Now, let us start our original car (not the ghost car) from station $P$. We
claim that it will complete the entire track without running out of gas.
Indeed, the following picture shows (again in our above example) both the gas
level of the ghost car (in grey) and the gas level of the original car (in
blue):%
\[
\begin{tikzpicture}[scale=5.5]
\draw
[gray, very thick] (0, 1) -- (0, 1.2) -- (0.1, 1.1) -- (0.1, 1.2) -- (0.4, 0.9) -- (0.4, 1.3) -- (0.5, 1.2) -- (0.5, 1.4) -- (0.8, 1.1) -- (0.8, 1.2) -- (1, 1) -- (1, 1.2) -- (1.1, 1.1) -- (1.1, 1.2) -- (1.4, 0.9) -- (1.4, 1.3) -- (1.5, 1.2) -- (1.5, 1.4) -- (1.8, 1.1) -- (1.8, 1.2) -- (2, 1);
\draw [blue, very thick] (0.4, 0) -- (0.4, 0.4) -- (0.5, 0.3) -- (0.5, 0.5) -- (0.8, 0.2) -- (0.8, 0.3) -- (1, 0.1) -- (1, 0.3) -- (1.1, 0.2) -- (1.1, 0.3) -- (1.4, 0);
\draw[->] (-0.2,0) -- (2.2,0);
\draw[->] (0,-0.2) -- (0,1.5);
\node at (0, 0) [below] {$A$};
\node at (0.1, 0) [below] {$B$};
\node at (0.4, 0) [below] {$C$};
\node at (0.5, 0) [below] {$D$};
\node at (0.8, 0) [below] {$E$};
\node at (1, 0) [below] {$A$};
\node at (1.1, 0) [below] {$B$};
\node at (1.4, 0) [below] {$C$};
\node at (1.5, 0) [below] {$D$};
\node at (1.8, 0) [below] {$E$};
\node at (2, 0) [below] {$A$};
\end{tikzpicture}\ \ .
\]
We see that the gas level plot of the original car is just a copy of a piece
of the gas level plot of the ghost car, shifted downwards so it starts on the
horizontal axis. Indeed, the original car makes the same journey as the ghost
car from $P$ to $P$, except that the original car starts with an empty tank
whereas the ghost car starts with some gas.

But recall that the ghost car never has less gas in its tank than it does at
station $P$. In other words, the gas level plot of the ghost car never goes
below the level at station $P$. Therefore, the gas level plot of the original
car never goes below the horizontal axis\footnote{since the gas level plot of
the original car is just a copy of a piece of the gas level plot of the ghost
car, shifted downwards so it starts on the horizontal axis}. In other words,
the original car (on its journey from $P$ to $P$) never runs out of gas. This
is precisely what we wanted to show. Thus, Exercise
\ref{exe.ext.cars-circular} is solved.
\end{proof}

\subsubsection{$n$ cowboys, $n$ bullets}

Here is another classic exercise (essentially \cite[Chapter 3, Exercise 7
(a)]{Engel}), which illustrates how the Extremal Principle can be applied
during an induction step:

\begin{exercise}
\label{exe.ext.cowboys-a}Let $n\geq1$ be an odd integer. Consider $n$ cowboys,
each standing at some point in space.

At high noon, each cowboy shoots his nearest neighbor, provided that he has a
unique nearest neighbor. (If his nearest neighbor does not
exist\footnotemark\ or is not unique, then he shoots no one.)

Prove that at least one cowboy does not get shot.
\end{exercise}

\footnotetext{Of course, this happens precisely when $n=1$.}

\begin{example}
\label{exa.ext.cowboys-a.1}Let $n=7$, and consider seven cowboys
$A,B,C,D,E,F,G$ placed in the plane as follows:%
\[%
%TCIMACRO{\TeXButton{tikz cowboys}{\begin{tikzpicture}
%\node(A) at (1 cm, 0 cm) {};
%\node(B) at (0 cm, 1 cm) {};
%\node(C) at (0 cm, 3 cm) {};
%\node(D) at (4 cm, 4 cm) {};
%\node(E) at (4 cm, 1 cm) {};
%\node(F) at (3 cm, 1 cm) {};
%\node(G) at (5 cm, 1 cm) {};
%\fill(A) circle (2pt) node[below] {$A$};
%\fill(B) circle (2pt) node[left] {$B$};
%\fill(C) circle (2pt) node[left] {$C$};
%\fill(D) circle (2pt) node[right] {$D$};
%\fill(E) circle (2pt) node[below] {$E$};
%\fill(F) circle (2pt) node[below] {$F$};
%\fill(G) circle (2pt) node[below] {$G$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\node(A) at (1 cm, 0 cm) {};
\node(B) at (0 cm, 1 cm) {};
\node(C) at (0 cm, 3 cm) {};
\node(D) at (4 cm, 4 cm) {};
\node(E) at (4 cm, 1 cm) {};
\node(F) at (3 cm, 1 cm) {};
\node(G) at (5 cm, 1 cm) {};
\fill(A) circle (2pt) node[below] {$A$};
\fill(B) circle (2pt) node[left] {$B$};
\fill(C) circle (2pt) node[left] {$C$};
\fill(D) circle (2pt) node[right] {$D$};
\fill(E) circle (2pt) node[below] {$E$};
\fill(F) circle (2pt) node[below] {$F$};
\fill(G) circle (2pt) node[below] {$G$};
\end{tikzpicture}%
%EndExpansion
\]
Then, the following picture shows the paths of the bullets:%
\[%
%TCIMACRO{\TeXButton{tikz cowboys with bullet paths}{\begin{tikzpicture}
%\node(A) at (1 cm, 0 cm) {};
%\node(B) at (0 cm, 1 cm) {};
%\node(C) at (0 cm, 3 cm) {};
%\node(D) at (4 cm, 4 cm) {};
%\node(E) at (4 cm, 1 cm) {};
%\node(F) at (3 cm, 1 cm) {};
%\node(G) at (5 cm, 1 cm) {};
%\fill(A) circle (2pt) node[below] {$A$};
%\fill(B) circle (2pt) node[left] {$B$};
%\fill(C) circle (2pt) node[left] {$C$};
%\fill(D) circle (2pt) node[right] {$D$};
%\fill(E) circle (2pt) node[below] {$E$};
%\fill(F) circle (2pt) node[below] {$F$};
%\fill(G) circle (2pt) node[below] {$G$};
%\draw[->, very thick, blue] (C) -- (B);
%\draw[->, very thick, blue] (A) -- (B);
%\draw[->, very thick, blue] (B) -- (A);
%\draw[->, very thick, blue] (D) -- (E);
%\draw[->, very thick, blue] (F) -- (E);
%\draw[->, very thick, blue] (G) -- (E);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\node(A) at (1 cm, 0 cm) {};
\node(B) at (0 cm, 1 cm) {};
\node(C) at (0 cm, 3 cm) {};
\node(D) at (4 cm, 4 cm) {};
\node(E) at (4 cm, 1 cm) {};
\node(F) at (3 cm, 1 cm) {};
\node(G) at (5 cm, 1 cm) {};
\fill(A) circle (2pt) node[below] {$A$};
\fill(B) circle (2pt) node[left] {$B$};
\fill(C) circle (2pt) node[left] {$C$};
\fill(D) circle (2pt) node[right] {$D$};
\fill(E) circle (2pt) node[below] {$E$};
\fill(F) circle (2pt) node[below] {$F$};
\fill(G) circle (2pt) node[below] {$G$};
\draw[->, very thick, blue] (C) -- (B);
\draw[->, very thick, blue] (A) -- (B);
\draw[->, very thick, blue] (B) -- (A);
\draw[->, very thick, blue] (D) -- (E);
\draw[->, very thick, blue] (F) -- (E);
\draw[->, very thick, blue] (G) -- (E);
\end{tikzpicture}%
%EndExpansion
\]
(where an arrow from $I$ to $J$ means that $I$ shoots $J$). (Note that cowboy
$E$ shoots no one, since he has two nearest neighbors $F$ and $G$.) Thus,
cowboys $C$, $D$, $F$ and $G$ do not get shot.
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.ext.cowboys-a}.]We proceed by strong induction
on $n$:

\textit{Induction step:} Let $m\geq1$ be an odd integer. Assume (as the
induction hypothesis) that Exercise \ref{exe.ext.cowboys-a} holds for $n<m$.
We must prove that Exercise \ref{exe.ext.cowboys-a} holds for $n=m$.

Thus, let $m\geq1$ be an odd integer. Consider $m$ cowboys, each standing at
some point in space. At high noon, each cowboy shoots his nearest neighbor,
provided that he has a unique nearest neighbor. We must prove that at least
one cowboy does not get shot.

Indeed, if $m=1$, then there is only one cowboy, and he has no nearest
neighbor and thus does not shoot anyone. Thus, if $m=1$, then the lone cowboy
does not got shot. Hence, we are done if $m=1$. Thus, for the rest of this
proof, we WLOG assume that $m\neq1$. Hence, $m>1$ (since $m\geq1$), and thus
$m\geq3$ (since $m$ is odd). Consequently, $m-2\geq1$. Also, the integer $m-2$
is odd (since $m$ is odd).

Moreover, $m\geq3\geq2$. Thus, there exists at least one pair $\left(
A,B\right)  $ of two distinct cowboys $A$ and $B$. Let us pick a pair $\left(
A,B\right)  $ of two distinct cowboys $A$ and $B$ with \textbf{minimum}
distance $\left\vert AB\right\vert $. Then, $B$ is a nearest neighbor of $A$,
so that $A$ shoots either $B$ or no one (depending on whether $B$ is the
\textbf{only} nearest neighbor of $A$). Likewise, $B$ shoots either $A$ or no one.

Now, let us consider the $m-2$ cowboys distinct from $A$ and $B$. We call
these $m-2$ cowboys \textit{lucky} (because they might get to live a bit
longer than $A$ and $B$). The two cowboys $A$ and $B$ do not shoot any lucky
cowboy (since $A$ shoots either $B$ or no one, and since $B$ shoots either $A$
or no one).

Now, we know that $m-2\geq1$ is an odd integer satisfying $m-2<m$. Hence, our
induction hypothesis yields that Exercise \ref{exe.ext.cowboys-a} holds for
$n=m-2$. Therefore, we can apply Exercise \ref{exe.ext.cowboys-a} to the $m-2$
lucky cowboys. We thus conclude that if the two cowboys $A$ and $B$ did not
exist (i.e., if the only cowboys around were the lucky ones), then at least
one lucky cowboy would not get shot. In other words, if the two cowboys $A$
and $B$ did not exist, then there would be a lucky cowboy $C$ that would not
get shot. Consider this $C$.

Now, we claim that $C$ does not get shot even in our original setup (i.e.,
even when $A$ and $B$ do exist). Indeed, assume the contrary. Thus, there is a
cowboy $D$ that shoots $C$. Then, $D$ must be a lucky cowboy (since $A$ and
$B$ do not shoot any lucky cowboy, and hence do not shoot $C$), and $C$ must
be his unique nearest neighbor (since any cowboy shoots his unique nearest
neighbor). But this entails that $D$ would shoot $C$ even if $A$ and $B$ did
not exist (because its unique nearest neighbor would not change when the two
unrelated cowboys $A$ and $B$ are removed, unless this neighbor was one of $A$
and $B$); but this is impossible, since we know that $C$ would not get shot if
$A$ and $B$ did not exist. This contradiction shows that our assumption was wrong.

Hence, we have showed that $C$ does not get shot even in our original setup.
Therefore, at least one cowboy does not get shot.

We have thus proved that Exercise \ref{exe.ext.cowboys-a} holds for $n=m$.
This completes the induction step, so Exercise \ref{exe.ext.cowboys-a} is solved.
\end{proof}

Another example of the Extremal Principle used in an induction is found in the
solution of Exercise \ref{exe.ind.engel-8-26}.

\subsubsection{The three chess clubs problem}

The following problem (\cite[Exercise 3.44]{Engel}, \cite[Chapter 3, problem
27]{Negut05}) requires a fairly subtle application of the extremal principle:

\begin{exercise}
\label{exe.ext.3-chess}Let $n$ be a positive integer. Consider three chess
clubs, each of which has $n$ players. Assume that no two players in the same
club have played against each other, but each player has played against at
least $n+1$ other players. Prove that there exist three players $a$, $b$ and
$c$ that have mutually played against each other (that is, $a$ has played
against $b$, and $b$ has played against $c$, and $c$ has played against $a$).
\end{exercise}

\begin{example}
Let us take $n=3$, and consider the following constellation:%
\[%
%TCIMACRO{\TeXButton{tikz 3 chess clubs}{\begin{tikzpicture}
%\draw(1, 2.5) ellipse (0.7 and 2.5);
%\draw(3, 2.5) ellipse (0.7 and 2.5);
%\draw(5, 2.5) ellipse (0.7 and 2.5);
%\node(a1) at (1 cm, 1 cm) {};
%\node(a2) at (1 cm, 3 cm) {};
%\node(a3) at (1 cm, 4 cm) {};
%\node(b1) at (3 cm, 1 cm) {};
%\node(b2) at (3 cm, 3 cm) {};
%\node(b3) at (3 cm, 4 cm) {};
%\node(c1) at (5 cm, 1 cm) {};
%\node(c2) at (5 cm, 3 cm) {};
%\node(c3) at (5 cm, 4 cm) {};
%\fill(a1) circle (2pt) node[below] {$a_1$};
%\fill(a2) circle (2pt) node[left] {$a_2$};
%\fill(a3) circle (2pt) node[above] {$a_3$};
%\fill(b1) circle (2pt) node[below] {$b_1$};
%\fill(b2) circle (2pt) node[above] {$b_2$};
%\fill(b3) circle (2pt) node[above] {$b_3$};
%\fill(c1) circle (2pt) node[below] {$c_1$};
%\fill(c2) circle (2pt) node[right] {$c_2$};
%\fill(c3) circle (2pt) node[above] {$c_3$};
%\draw
%[very thick, blue] (a1) -- (b2) -- (c1) -- (a3) -- (b2) -- (c2) -- (b3) -- (a2) -- (b1) -- (c3) -- (b3) -- (a1);
%\draw[very thick, blue] (a3) -- (b1) -- (c1) -- (a2) -- (c3) -- (a1);
%\draw[very thick, blue] (a1) -- (c2) -- (a3);
%\end{tikzpicture}
%}}%
%BeginExpansion
\begin{tikzpicture}
\draw(1, 2.5) ellipse (0.7 and 2.5);
\draw(3, 2.5) ellipse (0.7 and 2.5);
\draw(5, 2.5) ellipse (0.7 and 2.5);
\node(a1) at (1 cm, 1 cm) {};
\node(a2) at (1 cm, 3 cm) {};
\node(a3) at (1 cm, 4 cm) {};
\node(b1) at (3 cm, 1 cm) {};
\node(b2) at (3 cm, 3 cm) {};
\node(b3) at (3 cm, 4 cm) {};
\node(c1) at (5 cm, 1 cm) {};
\node(c2) at (5 cm, 3 cm) {};
\node(c3) at (5 cm, 4 cm) {};
\fill(a1) circle (2pt) node[below] {$a_1$};
\fill(a2) circle (2pt) node[left] {$a_2$};
\fill(a3) circle (2pt) node[above] {$a_3$};
\fill(b1) circle (2pt) node[below] {$b_1$};
\fill(b2) circle (2pt) node[above] {$b_2$};
\fill(b3) circle (2pt) node[above] {$b_3$};
\fill(c1) circle (2pt) node[below] {$c_1$};
\fill(c2) circle (2pt) node[right] {$c_2$};
\fill(c3) circle (2pt) node[above] {$c_3$};
\draw
[very thick, blue] (a1) -- (b2) -- (c1) -- (a3) -- (b2) -- (c2) -- (b3) -- (a2) -- (b1) -- (c3) -- (b3) -- (a1);
\draw[very thick, blue] (a3) -- (b1) -- (c1) -- (a2) -- (c3) -- (a1);
\draw[very thick, blue] (a1) -- (c2) -- (a3);
\end{tikzpicture}
%EndExpansion
\]
Here, the nodes are the players; the oval blobs are the three clubs; and the
connecting lines show who has played against whom (viz., two players are
connected by a line segment if and only if they have played against each
other). We thus see that $a_{2}$, $b_{3}$ and $c_{3}$ have mutually played
against each other.
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.ext.3-chess}.]If $a$ is any player, then we
define the \textit{score} of $a$ to be the maximum number of players from a
single club that $a$ has played against. (For example, if $A$, $B$ and $C$ are
the three clubs, and if a player $a$ has played against $0$ players from club
$A$ and against $6$ players from club $B$ and against $4$ players from club
$C$, then the score of $a$ is $6$.)

It is easy to see that the score of any player is
positive\footnote{\textit{Proof.} Let $a$ be a player. We must show that the
score of $a$ is positive.
\par
We assumed that each player has played against at least $n+1$ other players.
Hence, $a$ has played against at least $n+1$ other players. Thus, $a$ has
played against at least one other player (since $n+1\geq1$). Hence, in
particular, $a$ has played against at least one player from a single club.
\par
But the score of $a$ was defined as the maximum number of players from a
single club that $a$ has played against. Hence, this score is at least $1$
(since $a$ has played against at least one player from a single club), and
thus is positive. Hence we have shown that the score of $a$ is positive.
Qed.}. (Actually, it is at least $\dfrac{n+1}{2}$, but we won't need this.)

The three clubs have $3n$ players altogether. Among these $3n$ players, let
$a$ be the player with maximum score. Let $k$ be the score of $a$. Thus, $a$
has played against $k$ players from some club (by the definition of a score).
Let $B$ be this club, and let $A$ be the club that contains $a$. It is clear
that $A\neq B$\ \ \ \ \footnote{\textit{Proof.} Assume the contrary. Thus,
$A=B$. Hence, $B$ is the club that contains $a$ (since $A$ is the club that
contains $a$). Thus, $a$ has played against no players from club $B$ (since no
two players in the same club have played against each other). But we recall
that player $a$ has played against $k$ players from club $B$. Comparing the
previous two sentences, we conclude that $k=0$. However, $k$ is the score of
$A$ and therefore positive (since the score of any player is positive). This
contradicts $k=0$. This contradiction shows that our assumption was wrong.
Qed.}. Thus, $A$ and $B$ are two of the three clubs. Let $C$ be the remaining club.

Player $a$ belongs to club $A$, and thus has played against no one from club
$A$ (since no two players in the same club have played against each other).
Furthermore, player $a$ has played against $k$ players from club $B$. But we
also know that player $a$ has played against at least $n+1$ other players in
total\footnote{because each player has played against at least $n+1$ other
players}. Hence, we can easily see that player $a$ must have played against at
least one player $c$ from club $C$\ \ \ \ \footnote{\textit{Proof.} Assume the
contrary. Thus, player $a$ has played against no one from club $C$. We further
know that $a$ has played against no one from club $A$. Recall hat player $a$
has played against at least $n+1$ other players in total. All these at least
$n+1$ players must belong to club $B$ (since player $a$ has played against no
one from club $C$ and against no one from club $A$). Thus, club $B$ must have
at least $n+1$ players. But this contradicts the fact that club $B$ has only
$n$ players (since any club has exactly $n$ players). This contradiction shows
that our assumption was wrong. Qed.}. Consider this $c$.

Recall that $a$ is a player with maximum score. Since the score of $a$ is $k$,
this entails that the maximum score of a player is $k$. Therefore, the score
of $c$ is at most $k$. Thus, player $c$ has played against at most $k$ players
from club $A$ (because otherwise, $c$ would have played against more than $k$
players from club $A$, and therefore the score of $c$ would be greater than
$k$). Therefore, player $c$ must have played against at least $n+1-k$ players
from club $B$\ \ \ \ \footnote{\textit{Proof.} Assume the contrary. Thus,
player $c$ has played against fewer than $n+1-k$ players from club $B$. In
other words,%
\[
\left(  \text{the number of players from club }B\text{ that }c\text{ has
played against}\right)  <n+1-k.
\]
Moreover, player $c$ has played against at most $k$ players from club $A$ (as
we have already seen); in other words,
\[
\left(  \text{the number of players from club }A\text{ that }c\text{ has
played against}\right)  \leq k.
\]
Finally, player $c$ belongs to club $C$, and thus cannot have played against
anyone from club $C$ (because no two players in the same club have played
against each other). Hence,%
\[
\left(  \text{the number of players from club }C\text{ that }c\text{ has
played against}\right)  =0.
\]
\par
Now, recall that each player has played against at least $n+1$ other players.
Hence, $c$ has played against at least $n+1$ other players. In other words,%
\[
\left(  \text{the number of players that }c\text{ has played against}\right)
\geq n+1.
\]
Thus,
\begin{align*}
n+1  &  \leq\left(  \text{the number of players that }c\text{ has played
against}\right) \\
&  =\underbrace{\left(  \text{the number of players from club }A\text{ that
}c\text{ has played against}\right)  }_{\leq k}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{the number of players from
club }B\text{ that }c\text{ has played against}\right)  }_{<n+1-k}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{the number of players from
club }C\text{ that }c\text{ has played against}\right)  }_{=0}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since each player
belongs to exactly one of the clubs }A\text{, }B\text{ and }C\right) \\
&  <k+\left(  n+1-k\right)  +0=n+1.
\end{align*}
This is absurd. This contradiction shows that our assumption was wrong, qed.}.

Now, let $X$ be the set of all players from club $B$ that player $a$ has
played against. Then, $\left\vert X\right\vert =k$ (since $a$ has played
against $k$ players from club $B$).

Also, let $Z$ be the set of all players from club $B$ that player $c$ has
played against. Then, $\left\vert Z\right\vert \geq n+1-k$ (since player $c$
must have played against at least $n+1-k$ players from club $B$).

Consider the club $B$ as a set of players; thus, $\left\vert B\right\vert =n$
(since each club has exactly $n$ players). The sets $X$ and $Z$ are subsets of
$B$ (since they consist of players from club $B$); therefore, their union
$X\cup Z$ is a subset of $B$ as well. Hence, $\left\vert X\cup Z\right\vert
\leq\left\vert B\right\vert =n$.

If the sets $X$ and $Z$ were disjoint, then they would satisfy
\begin{align*}
\left\vert X\cup Z\right\vert  &  =\underbrace{\left\vert X\right\vert }%
_{=k}+\underbrace{\left\vert Z\right\vert }_{\geq n+1-k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.thm.enum.sumrule2.eq}), applied
to }P=X\text{ and }Q=Z\right) \\
&  \geq k+\left(  n+1-k\right)  =n+1>n,
\end{align*}
which would contradict $\left\vert X\cup Z\right\vert \leq n$. Thus, the sets
$X$ and $Z$ cannot be disjoint. In other words, there exists some $b\in X\cap
Z$.

Now, $b\in X\cap Z\subseteq X$; in other words, $b$ is a player from club $B$
that player $a$ has played against (by the definition of $X$). Also, $b\in
X\cap Z\subseteq Z$; in other words, $b$ is a player from club $B$ that player
$c$ has played against (by the definition of $Z$).

We now know that player $a$ has played against player $c$, and we know that
both players $a$ and $c$ have played against $b$. Therefore, the three players
$a$, $b$ and $c$ have mutually played against each other. This shows that
there exist three players that have mutually played against each other. This
solves Exercise \ref{exe.ext.3-chess}.
\end{proof}

It is worth highlighting a certain part of the above argument: namely, the
part where we argued that the sets $X$ and $Z$ cannot be disjoint because they
have too many elements among them (that is, $\left\vert X\right\vert
+\left\vert Z\right\vert \geq n+1$). This is a relative of what is called the
\textit{pigeonhole principle}, which we shall discuss in the next chapter.

(A few years ago I unsuccessfully tried to generalize Exercise
\ref{exe.ext.3-chess} to four chess clubs. See
\url{https://mathoverflow.net/questions/247079} for details.)

\begin{noncompile}
subsubsection: {Equilateral triangles on the lattice}

Our next application of the Extremal Principle also has a geometric flavor,
even though it is really a number theory problem.

\begin{definition}
We regard the plane as $\mathbb{R}^{2}$ (that is, the set of pairs of real
numbers), by fixing a Cartesian coordinate system and identifying each point
with its pair of coordinates.

A \textit{lattice point} is defined to be a point in $\mathbb{R}^{2}$ whose
both coordinates are integers. Thus, the set of all lattice points is
$\mathbb{Z}^{2}$.
\end{definition}

\begin{exercise}
\label{exe.ext.lattice.tria-eq}Prove that there exists no nondegenerate
equilateral triangle in the plane whose all three vertices are lattice points.
\end{exercise}

A few remarks are in order. Obviously, if $P$ is any lattice point, then the
degenerate triangle $PPP$ is equilateral; this is why the word
\textquotedblleft nondegenerate\textquotedblright\ needs to be said in
Exercise \ref{exe.ext.lattice.tria-eq} (though one may argue that it is
implicit in the notion of a triangle; but not everyone would agree). The word
\textquotedblleft plane\textquotedblright\ is also important: There are many
nondegenerate equilateral triangles in \textbf{space} whose all three vertices
are lattice points (in the sense that all their coordinates are integers); an
example is the triangle with vertices $\left(  1,0,0\right)  $, $\left(
0,1,0\right)  $ and $\left(  0,0,1\right)  $. On the plane, we can find many
\textquotedblleft almost-equilateral\textquotedblright\ triangles whose
vertices are lattice points; for example, the triangle with vertices $\left(
0,0\right)  $, $\left(  6,0\right)  $ and $\left(  3,5\right)  $ has
sidelengths $6$, $\sqrt{34}\approx5.8$ and $\sqrt{34}\approx5.8$:%
\[%
%TCIMACRO{\TeXButton{tikz triangle}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,gray,very thin] (-0.4, -0.4) grid (6.4, 6.4);
%\draw[->] (-0.6,0) -- (6.6,0);
%\draw[->] (0,-0.6) -- (0,6.6);
%\node(a) at (6 cm, 0 cm) {};
%\node(b) at (3 cm, 5 cm) {};
%\node(o) at (0 cm, 0 cm) {};
%\fill(a) circle (7pt) node[above right] {$\left(6, 0\right)$};
%\fill(b) circle (7pt) node[above left] {$\left(3, 5\right)$};
%\fill(o) circle (7pt) node[above left] {$\left(0, 0\right)$};
%\draw[very thick, blue] (o) -- (a) -- (b) -- (o);
%\end{tikzpicture}
%.}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,gray,very thin] (-0.4, -0.4) grid (6.4, 6.4);
\draw[->] (-0.6,0) -- (6.6,0);
\draw[->] (0,-0.6) -- (0,6.6);
\node(a) at (6 cm, 0 cm) {};
\node(b) at (3 cm, 5 cm) {};
\node(o) at (0 cm, 0 cm) {};
\fill(a) circle (7pt) node[above right] {$\left(6, 0\right)$};
\fill(b) circle (7pt) node[above left] {$\left(3, 5\right)$};
\fill(o) circle (7pt) node[above left] {$\left(0, 0\right)$};
\draw[very thick, blue] (o) -- (a) -- (b) -- (o);
\end{tikzpicture}
.%
%EndExpansion
\]
Nevertheless, as the three sidelengths can get very close, they can never be
equal (short of being $0$). This is what Exercise
\ref{exe.ext.lattice.tria-eq} claims. How can we prove this?

\begin{proof}
[Solution to Exercise \ref{exe.ext.lattice.tria-eq} (sketched).]In the
following, a \textit{strange triangle} will mean a nondegenerate equilateral
triangle in the plane whose all three vertices are lattice points. Thus, we
must prove that there exists no strange triangle.

Assume the contrary. Thus, there exists a strange triangle.

We would like to pick a strange triangle with the smallest possible
sidelength. For this to work, we need to guarantee that the set of the
sidelengths of all strange triangles has a minimum. Unfortunately, this does
not follow immediately from any of the principles in Section
\ref{sect.ext.principles}; indeed, this set is neither finite nor does it
consist of integers.

However, a little tweak saves us: We define the \textit{squared sidelength} of
an equilateral triangle to be the square of its sidelength. Then, the squared
sidelength of any strange triangle is a nonnegative
integer\footnote{\textit{Proof.} Let $ABC$ be a strange triangle. Then, the
squared sidelength of this triangle is $\left\vert AB\right\vert ^{2}$. Hence,
we must show that $\left\vert AB\right\vert ^{2}$ is a nonnegative integer.
\par
Note that $A$, $B$ and $C$ are lattice points (since $ABC$ is a strange
triangle). Write the points $A$ and $B$ as $A=\left(  x,y\right)  $ and
$B=\left(  x^{\prime},y^{\prime}\right)  $ (in Cartesian coordinates). Then,
$x,y,x^{\prime},y^{\prime}$ are integers (since $A$ and $B$ are lattice
points). But the standard formula for the distance of two points in Cartesian
coordinates says that $\left\vert AB\right\vert ^{2}=\left(  x-x^{\prime
}\right)  ^{2}+\left(  y-y^{\prime}\right)  ^{2}$ (since $A=\left(
x,y\right)  $ and $B=\left(  x^{\prime},y^{\prime}\right)  $). The right hand
side of this equality is a nonnegative integer (since $x,y,x^{\prime
},y^{\prime}$ are integers, and since the square of an integer is always a
nonnegative integer). Thus, so is the left hand side. In other words,
$\left\vert AB\right\vert ^{2}$ is a nonnegative integer. This completes our
proof.}. Hence, the set of the \textbf{squared} sidelengths of all strange
triangles is a set of nonnegative integers. Since this set is nonempty
(because we assumed that there exists a strange triangle), we thus conclude
that it has a minimum (by Theorem \ref{thm.ext.exist.NN-min}). In other words,
there exists a strange triangle $ABC$ with minimum squared sidelength.
Consider this $ABC$.

The points $A,B,C$ are lattice points (since $ABC$ is a strange triangle).
Write them as $A=\left(  x,y\right)  $, $B=\left(  x^{\prime},y^{\prime
}\right)  $ and $C=\left(  x^{\prime\prime},y^{\prime\prime}\right)  $ (in
Cartesian coordinates). Then, $x,y,x^{\prime},y^{\prime},x^{\prime\prime
},y^{\prime\prime}$ are integers (since $A,B,C$ are lattice points). But the
standard formula for the distance of two points in Cartesian coordinates says
that
\[
\left\vert AB\right\vert ^{2}=\left(  x-x^{\prime}\right)  ^{2}+\left(
y-y^{\prime}\right)  ^{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }A=\left(
x,y\right)  \text{ and }B=\left(  x^{\prime},y^{\prime}\right)  \right)
\]
and%
\[
\left\vert BC\right\vert ^{2}=\left(  x^{\prime}-x^{\prime\prime}\right)
^{2}+\left(  y^{\prime}-y^{\prime\prime}\right)  ^{2}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }B=\left(  x^{\prime},y^{\prime
}\right)  \text{ and }C=\left(  x^{\prime\prime},y^{\prime\prime}\right)
\right)
\]
and%
\[
\left\vert CA\right\vert ^{2}=\left(  x^{\prime\prime}-x\right)  ^{2}+\left(
y^{\prime\prime}-y\right)  ^{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}C=\left(  x^{\prime\prime},y^{\prime\prime}\right)  \text{ and }A=\left(
x,y\right)  \right)  .
\]


Now, we claim that $x\equiv x^{\prime}\operatorname{mod}2$. Indeed, ...
\end{proof}
\end{noncompile}

\subsection{Infinite descent}

\textit{Infinite descent} is a problem solving technique that is closely
related to both induction and the extremal principle (and, in fact, can easily
be restated as either of the two). We motivate it with an example that is
perhaps too simple:

\begin{exercise}
\label{exe.infdesc.sqrt3}Prove that $\sqrt{3}\notin\mathbb{Q}$.
\end{exercise}

There are many simple ways to solve Exercise \ref{exe.infdesc.sqrt3}. In
particular, Corollary \ref{cor.ent.coprime.frac-red} could be used to obtain
an easy contradiction from an assumption of $\sqrt{3}\in\mathbb{Q}$. However,
let us forget for a moment about Corollary \ref{cor.ent.coprime.frac-red}, and
discover a more complicated solution to Exercise \ref{exe.infdesc.sqrt3} that
illustrates how infinite descent works.

\begin{proof}
[Discussion of Exercise \ref{exe.infdesc.sqrt3}.]Assume the contrary. Thus,
$\sqrt{3}\in\mathbb{Q}$. In other words, there exists a pair $\left(
a,b\right)  $ of integers $a$ and $b$ satisfying $b\neq0$ and $\sqrt{3}=a/b$.
We shall call such a pair a \textit{solution}.\footnote{The word
\textquotedblleft solution\textquotedblright\ here has been chosen in analogy
to \textquotedblleft solution of an equation\textquotedblright, not to
\textquotedblleft solution of a problem\textquotedblright. In particular,
Exercise \ref{exe.infdesc.sqrt3} will be solved once we have shown that there
is no solution.} Thus, by our assumption, there exists a solution.

Consider any solution $\left(  a,b\right)  $. Thus, $a$ and $b$ are integers
satisfying $b\neq0$ and $\sqrt{3}=a/b$. Squaring the equality $\sqrt{3}=a/b$,
we obtain $3=\left(  a/b\right)  ^{2}=a^{2}/b^{2}$, so that $a^{2}=3b^{2}$.

Now, let us analyze the parity of $b$ (that is, whether $b$ is even or odd).
Assume first that $b$ is odd. Hence, Exercise \ref{exe.ent.even-odd-sumsq}
\textbf{(b)} (applied to $u=b$) yields $b^{2}\equiv1\operatorname{mod}4$.
Hence, $a^{2}=3\underbrace{b^{2}}_{\equiv1\operatorname{mod}4}\equiv
3\cdot1=3\operatorname{mod}4$. But if $a$ was odd, then we would have
$a^{2}\equiv1\operatorname{mod}4$ (by Exercise \ref{exe.ent.even-odd-sumsq}
\textbf{(b)}, applied to $u=a$), which would entail $1\equiv a^{2}%
\equiv3\operatorname{mod}4$, which would in turn contradict $1\not \equiv
3\operatorname{mod}4$. Hence, $a$ cannot be odd. Thus, $a$ is even. Hence,
$a^{2}\equiv0\operatorname{mod}4$ (by Exercise \ref{exe.ent.even-odd-sumsq}
\textbf{(a)}, applied to $u=a$), so that $0\equiv a^{2}\equiv
3\operatorname{mod}4$, which contradicts $0\not \equiv 3\operatorname{mod}4$.
This contradiction shows that our assumption (that $b$ is odd) was false.
Hence, $b$ is not odd. In other words, $b$ is even.

Hence, $b^{2}\equiv0\operatorname{mod}4$ (by Exercise
\ref{exe.ent.even-odd-sumsq} \textbf{(a)}, applied to $u=b$). If $a$ was odd,
then we would have $a^{2}\equiv1\operatorname{mod}4$ (by Exercise
\ref{exe.ent.even-odd-sumsq} \textbf{(b)}, applied to $u=a$), which would
entail $1\equiv a^{2}=3\underbrace{b^{2}}_{\equiv0\operatorname{mod}4}%
\equiv3\cdot0=0\operatorname{mod}4$, which would in turn contradict
$1\not \equiv 0\operatorname{mod}4$. Thus, $a$ cannot be odd. Hence, $a$ must
be even.

We have now shown that both $a$ and $b$ are even. In other words, $a/2$ and
$b/2$ are integers. Furthermore, $b/2\neq0$ (since $b\neq0$) and $\sqrt
{3}=\left(  a/2\right)  /\left(  b/2\right)  $ (since $\left(  a/2\right)
/\left(  b/2\right)  =a/b=\sqrt{3}$). Therefore, the pair $\left(
a/2,b/2\right)  $ is a solution again (by the definition of a
\textquotedblleft solution\textquotedblright).

Let us see what we have achieved. We have not obtained the contradiction that
we were hoping for. However, proceeding from our original (assumed) solution
$\left(  a,b\right)  $, we have found a new solution $\left(  a/2,b/2\right)
$. This new solution is \textquotedblleft smaller\textquotedblright\ than
$\left(  a,b\right)  $ in various regards: For example, $\left\vert
b/2\right\vert <\left\vert b\right\vert $ (since $b\neq0$). Let us define the
\textit{weight} of a solution $\left(  a,b\right)  $ to be the nonnegative
integer $\left\vert b\right\vert $. Thus, the new solution $\left(
a/2,b/2\right)  $ has smaller weight than $\left(  a,b\right)  $ (since
$b\neq0$ and thus $\left\vert b/2\right\vert <\left\vert b\right\vert $).
Hence, we have proved the following observation:

\begin{statement}
\textit{Observation 1:} If $\left(  a,b\right)  $ is any solution, then there
exists a solution of smaller weight than $\left(  a,b\right)  $.
\end{statement}

It turns out that this observation is almost as good as a contradiction. Here
are three ways to complete the solution of Exercise \ref{exe.infdesc.sqrt3}
using Observation 1:

\begin{itemize}
\item \textit{First way:} We have assumed that there exists a solution.
Consider such a solution, and call it $\left(  a_{0},b_{0}\right)  $.

Observation 1 (applied to $\left(  a,b\right)  =\left(  a_{0},b_{0}\right)  $)
thus yields that there exists a solution of smaller weight than $\left(
a_{0},b_{0}\right)  $. Consider such a solution, and call it $\left(
a_{1},b_{1}\right)  $.

Observation 1 (applied to $\left(  a,b\right)  =\left(  a_{1},b_{1}\right)  $)
thus yields that there exists a solution of smaller weight than $\left(
a_{1},b_{1}\right)  $. Consider such a solution, and call it $\left(
a_{2},b_{2}\right)  $.

Clearly, this argument (in which we apply Observation 1 to construct a new
solution from an old one) can be applied over and over. Thus, we obtain an
infinite sequence of solutions $\left(  a_{0},b_{0}\right)  ,\left(
a_{1},b_{1}\right)  ,\left(  a_{2},b_{2}\right)  ,\ldots$, each of which has
smaller weight than the previous one. Thus, the weights of these solutions
form an infinite strictly decreasing sequence. In other words, if we denote
the weight of the solution $\left(  a_{i},b_{i}\right)  $ by $w_{i}$, then the
sequence $\left(  w_{0},w_{1},w_{2},\ldots\right)  $ is strictly decreasing.

However, the weight of a solution is a nonnegative integer. Thus, $w_{0}%
,w_{1},w_{2},\ldots$ are nonnegative integers; therefore, $\left(  w_{0}%
,w_{1},w_{2},\ldots\right)  $ is a strictly decreasing sequence of nonnegative
integers. But there is no strictly decreasing sequence of nonnegative integers
(in fact, if $\left(  k_{0},k_{1},k_{2},\ldots\right)  $ is any strictly
decreasing sequence of integers, then it is easy to see that $k_{i}$ will be
negative for any $i>k_{0}$). The preceding two sentences contradict each
other; thus we have found the contradiction we wanted.

\item \textit{Second way:} We recall the Extremal Principle, and pick a
solution $\left(  a,b\right)  $ of smallest possible weight. This can be done,
since the set of weights of all solutions is a nonempty set of nonnegative
integers\footnote{It is nonempty because we have assumed that there exists a
solution.} and therefore has a minimum\footnote{by Theorem
\ref{thm.ext.exist.NN-min}}. Now, Observation 1 yields that there exists a
solution of smaller weight than $\left(  a,b\right)  $. But this contradicts
the fact that the solution $\left(  a,b\right)  $ has the smallest possible
weight. This gives us the contradiction we were looking for.

\item \textit{Third way:} Finally, we can also finish our argument by
induction. Namely, we use strong induction to prove the following claim: For
each $n\in\mathbb{N}$,%
\begin{equation}
\text{there exists no solution with weight }n.
\label{sol.infdesc.sqrt3.induct-claim}%
\end{equation}


[\textit{Proof of (\ref{sol.infdesc.sqrt3.induct-claim}):} We proceed by
strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.infdesc.sqrt3.induct-claim}) holds for $n<m$. We
must prove that (\ref{sol.infdesc.sqrt3.induct-claim}) holds for $n=m$.

Indeed, let $\left(  a,b\right)  $ be a solution with weight $m$. Thus,
Observation 1 yields that there exists a solution of smaller weight than
$\left(  a,b\right)  $. In other words, there exists a solution of weight $<m$
(since the weight of $\left(  a,b\right)  $ is $m$). Let $\left(  a^{\prime
},b^{\prime}\right)  $ be this latter solution, and let $q$ be its weight.
Thus, $q$ is a nonnegative integer (since the weight of any solution is a
nonnegative integer). That is, $q\in\mathbb{N}$. Also, $q<m$ (since $q$ is the
weight of the solution $\left(  a,b\right)  $, which has weight $<m$). Our
induction hypothesis says that (\ref{sol.infdesc.sqrt3.induct-claim}) holds
for $n<m$. Thus, (\ref{sol.infdesc.sqrt3.induct-claim}) holds for $n=q$ (since
$q<m$). In other words, there exists no solution with weight $q$. But this
contradicts the fact that the solution $\left(  a^{\prime},b^{\prime}\right)
$ has weight $q$.

Forget that we fixed $\left(  a,b\right)  $. We thus have found a
contradiction for each solution $\left(  a,b\right)  $ with weight $m$. Hence,
there exists no solution with weight $m$. In other words,
(\ref{sol.infdesc.sqrt3.induct-claim}) holds for $n=m$. This completes the
induction step. Thus, (\ref{sol.infdesc.sqrt3.induct-claim}) is proved.]

Now, having proved (\ref{sol.infdesc.sqrt3.induct-claim}), we easily see that
there exists no solution whatsoever. (Indeed, if there was a solution, then it
would have weight $n$ for some $n\in\mathbb{N}$; but this would then
contradict (\ref{sol.infdesc.sqrt3.induct-claim}).) This contradicts our
assumption that there is a solution. Thus, again, we have found a contradiction.
\end{itemize}

Thus, we have finished the solution of Exercise \ref{exe.infdesc.sqrt3} in
three different ways. It is fairly clear that these three ways formalize the
same intuition: that a nonnegative integer cannot keep getting decreased
indefinitely (without eventually falling below $0$), and therefore a method to
decrease the weight of a solution (no matter how small it originally was)
gives a guarantee that no solutions can exist. This principle is known as the
\textit{principle of Infinite Descent}, and is often ascribed to Fermat even
though it was known to the ancient Greeks. Note that our arguments (in all
three ways) crucially rely on the fact that the weight of a solution was a
nonnegative integer. If it was merely an integer or a nonnegative rational
number, then we could not conclude much from Observation 1, since an infinite
sequence of integers (or of nonnegative rational numbers) could decrease indefinitely.
\end{proof}

Here is a more sophisticated example for the Infinite Descent technique
(\href{https://prase.cz/kalva/putnam/psoln/psol737.html}{Putnam 1973 problem
B1}):

\begin{exercise}
\label{exe.infdesc.put1973B1.1}Let $n\in\mathbb{N}$. Assume that $a_{1}%
,a_{2},\ldots,a_{2n+1}$ are $2n+1$ integers with the following property:

\begin{statement}
\textit{Splitting property:} If any of the $2n+1$ numbers $a_{1},a_{2}%
,\ldots,a_{2n+1}$ is removed, then the remaining $2n$ numbers can be split
into two equinumerous heaps with equal sum. (\textquotedblleft
Equinumerous\textquotedblright\ means that each heap contains exactly $n$ numbers.)
\end{statement}

Prove that all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
\end{exercise}

\begin{example}
Let $n=1$, so that $2n+1=3$. Then, in Exercise \ref{exe.infdesc.put1973B1.1},
we have three integers $a_{1},a_{2},a_{3}$. The splitting property boils down
to requiring that $a_{2}=a_{3}$ and $a_{3}=a_{1}$ and $a_{1}=a_{2}$ (because
if one of the $3$ numbers $a_{1},a_{2},a_{3}$ is removed, then the remaining
$2$ numbers can only be split into two equinumerous heaps in one way -- up to
the order of the heaps). Thus, for $n=1$, Exercise
\ref{exe.infdesc.put1973B1.1} says that if $a_{2}=a_{3}$ and $a_{3}=a_{1}$ and
$a_{1}=a_{2}$, then all $3$ numbers $a_{1},a_{2},a_{3}$ are equal. This is obvious.
\end{example}

\begin{example}
Let $n=2$, so that $2n+1=5$. Then, in Exercise \ref{exe.infdesc.put1973B1.1},
we have five integers $a_{1},a_{2},a_{3},a_{4},a_{5}$. The splitting property
requires that if any of these five integers is removed, then the remaining
four integers can be split into two equinumerous heaps with equal sum. For
instance, if $a_{2}$ is removed, then the remaining four integers $a_{1}%
,a_{3},a_{4},a_{5}$ should satisfy $a_{1}+a_{3}=a_{4}+a_{5}$ or $a_{1}%
+a_{4}=a_{3}+a_{5}$ or $a_{1}+a_{5}=a_{3}+a_{4}$. Again, Exercise
\ref{exe.infdesc.put1973B1.1} is saying that if the splitting property is
satisfied (not just for $a_{2}$, but also for each of the other numbers), then
all $5$ numbers $a_{1},a_{2},a_{3},a_{4},a_{5}$ are equal. This time, there is
no quick way to see this; there are too many ways in which the splitting
property may be satisfied.
\end{example}

\begin{example}
Here is a non-example. Set $n=2$ (so that $2n+1=5$) and%
\[
a_{1}=1,\ \ \ \ \ \ \ \ \ \ a_{2}=2,\ \ \ \ \ \ \ \ \ \ a_{3}%
=3,\ \ \ \ \ \ \ \ \ \ a_{4}=4,\ \ \ \ \ \ \ \ \ \ a_{5}=5.
\]
Then, the splitting property holds for removing $a_{1}$: Indeed, after
removing $a_{1}$, we can split the remaining four numbers $a_{2},a_{3}%
,a_{4},a_{5}$ into the two equinumerous heaps $a_{2},a_{5}$ and $a_{3},a_{4}$
with equal sums ($a_{2}+a_{5}=a_{3}+a_{4}$). Likewise, the splitting property
holds for removing $a_{3}$ (since $a_{1}+a_{5}=a_{2}+a_{4}$) and for removing
$a_{5}$ (since $a_{1}+a_{4}=a_{2}+a_{3}$), but not for removing $a_{2}$ or
$a_{4}$.
\end{example}

\begin{proof}
[Solution to Exercise \ref{exe.infdesc.put1973B1.1} (sketched).]Some notations first.

A \textit{solution} will mean an $\left(  2n+1\right)  $-tuple $\left(
a_{1},a_{2},\ldots,a_{2n+1}\right)  $ of integers that has the splitting property.

A solution $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ will be called
\textit{flat} if all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
Thus, our goal is to show that every solution is flat. In other words, our
goal is to show that there is no non-flat solution.

A solution $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ will be called
\textit{nonnegative} if all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are nonnegative.

First, we observe the following:

\begin{statement}
\textit{Observation 1:} If there exists a non-flat solution, then there exists
a nonnegative non-flat solution.
\end{statement}

[\textit{Proof of Observation 1:} Assume that there exists a non-flat solution
$\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $. Set $b=\min\left\{
a_{1},a_{2},\ldots,a_{2n+1}\right\}  $. Then, all $2n+1$ integers $a_{1}%
,a_{2},\ldots,a_{2n+1}$ are $\geq b$; hence, all $2n+1$ differences
$a_{1}-b,a_{2}-b,\ldots,a_{2n+1}-b$ are nonnegative. Moreover, it is easy to
see that the $\left(  2n+1\right)  $-tuple $\left(  a_{1}-b,a_{2}%
-b,\ldots,a_{2n+1}-b\right)  $ is still a solution (indeed, subtracting $b$
from all $2n+1$ numbers does not invalidate the splitting
property\footnote{For example, in the case $2n+1=5$, if we had $a_{2}%
+a_{3}=a_{1}+a_{4}$, then after subtraction of $b$ we still have $\left(
a_{2}-b\right)  +\left(  a_{3}-b\right)  =\left(  a_{1}-b\right)  +\left(
a_{4}-b\right)  $. Here it is important that the two heaps in the splitting
property were required to be equinumerous!}) and still non-flat (since
$a_{1}-b=a_{2}-b=\cdots=a_{2n+1}-b$ would imply $a_{1}=a_{2}=\cdots=a_{2n+1}$,
which would contradict the assumption that $\left(  a_{1},a_{2},\ldots
,a_{2n+1}\right)  $ is non-flat). Thus, this $\left(  2n+1\right)  $-tuple
$\left(  a_{1}-b,a_{2}-b,\ldots,a_{2n+1}-b\right)  $ is a nonnegative non-flat
solution. Hence, there exists a nonnegative non-flat solution. This proves
Observation 1.]

Thanks to Observation 1, we don't need to bother with negative integers if we
don't want to. This will come useful later.

Next, let us study the parity of the integers in a solution:

\begin{statement}
\textit{Observation 2:} If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is a
solution, then the $2n+1$ integers $a_{1},a_{2},\ldots,a_{2n+1}$ all have the
same parity (i.e., are either all even or all odd).
\end{statement}

[\textit{Proof of Observation 2:} Let $\left(  a_{1},a_{2},\ldots
,a_{2n+1}\right)  $ be a solution. Let $t=a_{1}+a_{2}+\cdots+a_{2n+1}$ be the
sum of all its entries.

The splitting property shows that if the integer $a_{2n+1}$ is removed, then
the remaining $2n$ numbers can be split into two equinumerous heaps with equal
sum. In other words, the $2n$ numbers $a_{1},a_{2},\ldots,a_{2n}$ can be split
into two equinumerous heaps with equal sum. Let $s$ be the sum of either heap.
Then, $s$ is an integer (since $a_{1},a_{2},\ldots,a_{2n}$ are integers). But
the sum $a_{1}+a_{2}+\cdots+a_{2n}$ of all the $2n$ numbers $a_{1}%
,a_{2},\ldots,a_{2n}$ must be $s+s$ (since these $2n$ numbers can be split
into two heaps, each of which has sum $s$). Thus,%
\[
a_{1}+a_{2}+\cdots+a_{2n}=s+s=2s\equiv0\operatorname{mod}%
2\ \ \ \ \ \ \ \ \ \ \left(  \text{since }s\text{ is an integer}\right)  .
\]
Hence,%
\[
t=a_{1}+a_{2}+\cdots+a_{2n+1}=\underbrace{\left(  a_{1}+a_{2}+\cdots
+a_{2n}\right)  }_{\equiv0\operatorname{mod}2}+a_{2n+1}\equiv a_{2n+1}%
\operatorname{mod}2,
\]
so that $a_{2n+1}\equiv t\operatorname{mod}2$.

Thus, by removing $a_{2n+1}$ and applying the splitting property, we have
obtained $a_{2n+1}\equiv t\operatorname{mod}2$. But we can apply the same
argument to any of our $2n+1$ integers $a_{1},a_{2},\ldots,a_{2n+1}$ in place
of $a_{2n+1}$. Thus, we find that $a_{i}\equiv t\operatorname{mod}2$ for each
$i\in\left\{  1,2,\ldots,2n+1\right\}  $. As a consequence,

\begin{itemize}
\item if $t$ is even, then all of $a_{1},a_{2},\ldots,a_{2n+1}$ are even;

\item if $t$ is odd, then all of $a_{1},a_{2},\ldots,a_{2n+1}$ are odd.
\end{itemize}

\noindent Thus, $a_{1},a_{2},\ldots,a_{2n+1}$ all have the same parity. This
proves Observation 2.]

Now, Observation 2 helps us transform non-flat solutions into smaller non-flat
solutions with an appropriate meaning of \textquotedblleft
smaller\textquotedblright. To be more precise, we consider nonnegative
solutions. If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is a nonnegative
solution, then the \textit{weight} of this solution is defined to be the
nonnegative integer $a_{1}+a_{2}+\cdots+a_{2n+1}$. Now we claim:

\begin{statement}
\textit{Observation 3:} If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is a
nonnegative non-flat solution, then there exists a nonnegative non-flat
solution with smaller weight than $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)
$.
\end{statement}

[\textit{Proof of Observation 3:} Let $\left(  a_{1},a_{2},\ldots
,a_{2n+1}\right)  $ be a nonnegative non-flat solution. Then, Observation 2
yields that $a_{1},a_{2},\ldots,a_{2n+1}$ all have the same parity. In other
words, the numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are either all even or all
odd. Now, we construct a new nonnegative non-flat solution $\left(
b_{1},b_{2},\ldots,b_{2n+1}\right)  $ as follows:

\begin{itemize}
\item If $a_{1},a_{2},\ldots,a_{2n+1}$ are all even, then we set
\[
\left(  b_{1},b_{2},\ldots,b_{2n+1}\right)  =\left(  \dfrac{a_{1}}{2}%
,\dfrac{a_{2}}{2},\ldots,\dfrac{a_{2n+1}}{2}\right)  .
\]


\item If $a_{1},a_{2},\ldots,a_{2n+1}$ are all odd, then we set
\[
\left(  b_{1},b_{2},\ldots,b_{2n+1}\right)  =\left(  \dfrac{a_{1}-1}{2}%
,\dfrac{a_{2}-1}{2},\ldots,\dfrac{a_{2n+1}-1}{2}\right)  .
\]

\end{itemize}

\noindent It is easy to check that (in either case) $\left(  b_{1}%
,b_{2},\ldots,b_{2n+1}\right)  $ is a nonnegative non-flat solution with
smaller weight than $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)
$.\ \ \ \ \footnote{Note that the weight of $\left(  b_{1},b_{2}%
,\ldots,b_{2n+1}\right)  $ is indeed \textbf{smaller} (and not just
smaller-or-equal) than the weight of $\left(  a_{1},a_{2},\ldots
,a_{2n+1}\right)  $, because $a_{1},a_{2},\ldots,a_{2n+1}$ cannot all be $0$
(since $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is non-flat).} Thus,
there exists a nonnegative non-flat solution with smaller weight than $\left(
a_{1},a_{2},\ldots,a_{2n+1}\right)  $. This proves Observation 3.]

Now, all we need is to reap our rewards. By the Principle of Infinite Descent,
Observation 3 entails that there exists no nonnegative non-flat solution.
Hence, by Observation 1, we conclude that there exists no non-flat solution
either. In other words, any solution is flat. Exercise
\ref{exe.infdesc.put1973B1.1} is solved.
\end{proof}

There are some variants of this solution; in particular, it is possible to
avoid Observation 1, at the expense of a more complicated notion of
weight\footnote{Indeed, the way we defined the weight of a solution $\left(
a_{1},a_{2},\ldots,a_{2n+1}\right)  $, it would not be nonnegative in general
if we don't require $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ to be
nonnegative. Thus, we would have to fix this -- e.g., by redefining this
weight as $\left\vert a_{1}\right\vert +\left\vert a_{2}\right\vert
+\cdots+\left\vert a_{2n+1}\right\vert $ instead.} and a more complicated
proof of (the analogue of) Observation 3.

Can we replace the \textquotedblleft integers\textquotedblright\ in Exercise
\ref{exe.infdesc.put1973B1.1} by some more general types of numbers? Let's
first try rational numbers:

\begin{exercise}
\label{exe.infdesc.put1973B1.2}Let $n\in\mathbb{N}$. Assume that $a_{1}%
,a_{2},\ldots,a_{2n+1}$ are $2n+1$ \textbf{rational numbers} with the
following property:

\begin{statement}
\textit{Splitting property:} If any of the $2n+1$ numbers $a_{1},a_{2}%
,\ldots,a_{2n+1}$ is removed, then the remaining $2n$ numbers can be split
into two equinumerous heaps with equal sum. (\textquotedblleft
Equinumerous\textquotedblright\ means that each heap contains exactly $n$ numbers.)
\end{statement}

Prove that all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.infdesc.put1973B1.2} (sketched).]The numbers
$a_{1},a_{2},\ldots,a_{2n+1}$ are rational. Thus, there exists a positive
integer $d$ such that all the $2n+1$ products $da_{1},da_{2},\ldots,da_{2n+1}$
are integers. (Such a $d$ is called a \textit{common denominator} of
$a_{1},a_{2},\ldots,a_{2n+1}$.) Consider such a $d$.

We assumed that the splitting property holds for our $2n+1$ numbers
$a_{1},a_{2},\ldots,a_{2n+1}$; thus, it also holds for the $2n+1$ numbers
$da_{1},da_{2},\ldots,da_{2n+1}$. (For example, in the case $2n+1=5$, if we
had $a_{2}+a_{3}=a_{1}+a_{4}$, then upon multiplication by $d$ we get
$da_{2}+da_{3}=da_{1}+da_{4}$.) Hence, we can apply Exercise
\ref{exe.infdesc.put1973B1.1} to the $2n+1$ integers $da_{1},da_{2}%
,\ldots,da_{2n+1}$ instead of $a_{1},a_{2},\ldots,a_{2n+1}$. Thus, we conclude
that all $2n+1$ numbers $da_{1},da_{2},\ldots,da_{2n+1}$ are equal. Hence, all
$2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal as well (since $d\neq
0$). This solves Exercise \ref{exe.infdesc.put1973B1.2}.
\end{proof}

Can we go further and replace the integers in Exercise
\ref{exe.infdesc.put1973B1.1} by real numbers? Yes, as the following shows:

\begin{exercise}
\label{exe.infdesc.put1973B1.3}Let $n\in\mathbb{N}$. Assume that $a_{1}%
,a_{2},\ldots,a_{2n+1}$ are $2n+1$ \textbf{real numbers} with the following property:

\begin{statement}
\textit{Splitting property:} If any of the $2n+1$ numbers $a_{1},a_{2}%
,\ldots,a_{2n+1}$ is removed, then the remaining $2n$ numbers can be split
into two equinumerous heaps with equal sum. (\textquotedblleft
Equinumerous\textquotedblright\ means that each heap contains exactly $n$ numbers.)
\end{statement}

Prove that all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
\end{exercise}

We are not going to solve Exercise \ref{exe.infdesc.put1973B1.3} now; but we
may come back to it later when discussing the use of linear algebra. (Two
solutions can be found in \cite[Problem 300]{GelAnd}.)

\begin{noncompile}
\textit{Discussion of Exercise \ref{exe.infdesc.put1973B1.3}.} Take the
example%
\begin{align*}
a_{2}+a_{3}  &  =a_{4}+a_{5};\\
a_{1}+a_{4}  &  =a_{3}+a_{5};\\
a_{1}+a_{4}  &  =a_{2}+a_{5};\\
a_{1}+a_{5}  &  =a_{2}+a_{3};\\
a_{2}+a_{4}  &  =a_{1}+a_{3}.
\end{align*}
This is a system of $5$ linear equations in $5$ variables. We are claiming
that its only solution is $a_{1}=a_{2}=a_{3}=a_{4}=a_{5}$. In other words, we
are claiming that the matrix%
\[
\left(
\begin{array}
[c]{ccccc}%
0 & 1 & 1 & -1 & -1\\
1 & 0 & -1 & 1 & -1\\
1 & -1 & 0 & 1 & -1\\
1 & -1 & -1 & 0 & 1\\
-1 & 1 & -1 & 1 & 0
\end{array}
\right)
\]
has rank $4$.

Now, however, we have already proved this over the rational numbers (in the
previous exercise). But when a matrix has rational entries, its rank does not
depend on whether we work over the rational numbers or over the real numbers.
After all, when we use Gaussian elimination to transform the matrix into RREF,
we only add, subtract, multiply and divide, so we never leave the rational numbers.

Thus, having proved the claim for rational numbers, we conclude that it must
hold for real numbers as well.

\textit{Example:} If you know that the solutions of a system of linear
equations%
\[
\left\{
\begin{array}
[c]{c}%
x+2y=5,\\
2x-3z=3
\end{array}
\right.
\]
over $\mathbb{Q}$ have the form
\[
\left[  x=\dfrac{3}{2}z+\dfrac{3}{2},\ \ \ \ \ y=\dfrac{7}{4}-\dfrac{3}%
{4}z\right]  \ \ \ \ \ \ \ \ \ \ \text{with }z\in\mathbb{Q},
\]
then it follows that the solutions of a system of linear equations%
\[
\left\{
\begin{array}
[c]{c}%
x+2y=5,\\
2x-3z=3
\end{array}
\right.
\]
over $\mathbb{R}$ have the form
\[
\left[  x=\dfrac{3}{2}z+\dfrac{3}{2},\ \ \ \ \ y=\dfrac{7}{4}-\dfrac{3}%
{4}z\right]  \ \ \ \ \ \ \ \ \ \ \text{with }z\in\mathbb{R}.
\]


(EMAIL:)

The main lemma is:

LEMMA: Consider a system of homogeneous linear equations with rational
coefficients. Assume that this system has a nontrivial solution over the
reals. ("Nontrivial" means that "not the zero vector (0, 0, ..., 0)".) Then,
the system also has a nontrivial solution over the rationals.

PROOF SKETCH: Solve the system using Gaussian elimination: i.e., reduce the
system to a RREF (= row-reduced echelon form) and then solve it in the obvious
way. (This is explained in most texts on linear algebra; for instance, in the
very computational notes by Neil Strickland
http://www.cip.ifi.lmu.de/\symbol{126}grinberg/t/19fla/MAS201.pdf , it's
Method 6.3 and Method 5.4.) How many independent variables (aka free
variables) does the solution have? If it has none, then the system has only
one solution, which must therefore be (0, 0, ..., 0) (because the system is
homogeneous, so (0, 0, ..., 0) is always a solution); but this contradicts our
assumption that the system has a nontrivial solution over the reals. Thus, it
must have at least one independent variable. Set these independent variables
to 1 and compute the dependent variables by the standard method to obtain a
nontrivial solution. Nowhere in this process have you obtained any irrational
numbers, because the original coefficients were rational, Gaussian elimination
does not introduce any irrationalities (it's just subtracting, multiplying and
dividing the entries of the matrix by one another), and the free variables
were set to the rational number 1. So you found a nontrivial solution over the
rationals; qed.

This applies to the Putnam problem because if you fix the way how the numbers
are subdivided, then the "equal sums" conditions are a system of linear equations.

The idea of the above is pretty useful, not just in this problem. For example,
if two polynomials with rational coefficients have a non-constant common
divisor over the complex numbers, then they have a non-constant common divisor
over the rational numbers. Why? Because the Euclidean algorithm for
polynomials (just as the Gaussian elimination algorithm for systems of linear
equations) never produces any irrationalities (actually the two algorithms
have a lot in common), so whatever gcd it computes over the rationals must
also be the gcd over the complexes.
\end{noncompile}

\subsection{\label{sect.hw5}Homework set \#5: More sequences and the extremal
principle}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the above parts of Chapter \ref{chp.seqsum} and
Chapter \ref{chp.ext}. Some of the problems may be unrelated.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.binom.fusscat-1}Let $n\in\mathbb{N}$ and $a\in\mathbb{N}$. Prove
that $an+1\mid\dbinom{\left(  a+1\right)  n}{n}$.
\end{exercise}

In the following exercise, we shall consider polynomials in a single variable
$x$. The coefficients of these polynomials can be any kinds of numbers
(rational, real or complex). Recall that a polynomial has degree $\leq m$ (for
some integer $m$) if and only if it can be written as a sum $\sum_{i=0}%
^{m}c_{i}x^{i}$ with some constants $c_{0},c_{1},\ldots,c_{m}$. If $m<0$, then
the only polynomial that has degree $\leq m$ is the zero polynomial $0$ (since
the sum $\sum_{i=0}^{m}c_{i}x^{i}$ is an empty sum when $m<0$).

If $P=P\left(  x\right)  $ is a polynomial, then $\Delta P$ shall denote the
polynomial defined by%
\[
\left(  \Delta P\right)  \left(  x\right)  =P\left(  x\right)  -P\left(
x-1\right)  .
\]
For example, if $P\left(  x\right)  =x^{3}$, then $\left(  \Delta P\right)
\left(  x\right)  =P\left(  x\right)  -P\left(  x-1\right)  =x^{3}-\left(
x-1\right)  ^{3}=3x^{2}-3x+1$.

If $P$ is a polynomial, and if $n\in\mathbb{N}$, then $\Delta^{n}P$ shall
denote the polynomial $\Delta\left(  \Delta\left(  \cdots\left(  \Delta
P\right)  \cdots\right)  \right)  $ with $n$ copies of $\Delta$ in front of
the $P$. (Formally speaking, this means that $\Delta^{n}P$ is defined
recursively by setting $\Delta^{0}P=P$ and $\Delta^{n}P=\Delta\left(
\Delta^{n-1}P\right)  $ for each $n\geq1$.)

\begin{exercise}
\label{exe.findiff.poly1}Let $m\in\mathbb{Z}$. Let $P$ be a polynomial in a
single variable $x$. Assume that $P$ has degree $\leq m$. Prove the following:

\textbf{(a)} The polynomial $\Delta P$ has degree $\leq m-1$.

\textbf{(b)} The polynomial $\Delta^{n}P$ has degree $\leq m-n$ for each
$n\in\mathbb{N}$.

\textbf{(c)} For each $n\in\mathbb{N}$, we have%
\[
\left(  \Delta^{n}P\right)  \left(  x\right)  =\sum_{k=0}^{n}\left(
-1\right)  ^{k}\dbinom{n}{k}P\left(  x-k\right)  .
\]


\textbf{(d)} For each $n\in\mathbb{N}$ satisfying $n>m$, we have%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(  x-k\right)  =0.
\]


\textbf{(e)} Assume that $m\geq0$. The sequence $\left(  P\left(  0\right)
,P\left(  1\right)  ,P\left(  2\right)  ,\ldots\right)  $ is $\left(
d_{1},d_{2},\ldots,d_{m+1}\right)  $-recurrent, where we set $d_{i}=\left(
-1\right)  ^{i-1}\dbinom{m+1}{i}$ for each $i\in\left\{  1,2,\ldots
,m+1\right\}  $.
\end{exercise}

\begin{exercise}
\label{exe.binom.sum-frac-akbk}Let $a,b,c\in\mathbb{N}$ be such that $c\leq b$
and $a\leq b$. Simplify%
\[
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}.
\]

\end{exercise}

\begin{exercise}
\label{exe.seqs.vor57var1}Let $q\in\mathbb{R}$ and $s\in\mathbb{R}$. Define a
sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of reals recursively by%
\begin{align*}
a_{0}  &  =s,\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =a_{n-1}\left(  qa_{n-1}+2\right)  \ \ \ \ \ \ \ \ \ \ \text{for
each integer }n\geq1.
\end{align*}
Find an explicit formula for $a_{n}$.
\end{exercise}

\begin{exercise}
\label{exe.seqs.rec-ff}Define a sequence $\left(  a_{1},a_{2},a_{3}%
,\ldots\right)  $ of integers recursively by%
\begin{align*}
a_{1}  &  =1,\ \ \ \ \ \ \ \ \ \ a_{2}=1,\ \ \ \ \ \ \ \ \ \ a_{3}%
=3,\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =\dfrac{a_{n-1}^{2}-a_{n-2}^{2}}{a_{n-3}}%
\ \ \ \ \ \ \ \ \ \ \text{for each integer }n\geq4.
\end{align*}
Compute $a_{n}$ explicitly (in terms of sequences we already know).
\end{exercise}

The next exercise is a \textquotedblleft Fibonacci analogue\textquotedblright%
\ of Theorem \ref{thm.ext.base-2.eu}; it uses the notion of a lacunar subset
(defined in Definition \ref{def.fib.lac}).

\begin{exercise}
\label{exe.ext.zeckendorf}Let $n\in\mathbb{N}$. Let $\mathbb{N}_{2}$ denote
the set $\left\{  2,3,4,\ldots\right\}  $. Prove that there is a unique
lacunar finite subset $T$ of $\mathbb{N}_{2}$ such that $n=\sum_{t\in T}f_{t}$.

(For example, $28=f_{3}+f_{5}+f_{8}=\sum_{t\in\left\{  3,5,8\right\}  }f_{t}$.)
\end{exercise}

\begin{exercise}
\label{exe.ext.studs-strong}Solve Exercise \ref{exe.ext.studs} if $n$ is not
known to the lecturer. That is, find a way to construct the moments $a$ and
$b$ in Exercise \ref{exe.ext.studs} in such a way that the lecturer will know
that these moments have arrived the very time they arrive (rather than only in hindsight).
\end{exercise}

The following exercise generalizes Exercise \ref{exe.ext.studs-fml}:

\begin{exercise}
\label{exe.ext.studs-fml-k}Let $n$ and $k$ be positive integers with $k\geq2$.
Let $I_{1},I_{2},\ldots,I_{n}$ be $n$ nonempty finite closed intervals on the
real axis. Assume that for any $k$ distinct elements $i_{1},i_{2},\ldots
,i_{k}\in\left\{  1,2,\ldots,n\right\}  $, at least two of the $k$ intervals
$I_{i_{1}},I_{i_{2}},\ldots,I_{i_{k}}$ intersect. Prove that there exist $k-1$
reals $a_{1},a_{2},\ldots,a_{k-1}$ such that each of the intervals
$I_{1},I_{2},\ldots,I_{n}$ contains at least one of $a_{1},a_{2}%
,\ldots,a_{k-1}$.
\end{exercise}

\begin{exercise}
\label{exe.ext.periodic-nonneg}Let $n$ be a positive integer. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ be an $n$-periodic sequence of reals such
that $x_{0}+x_{1}+\cdots+x_{n-1}=0$. Prove that there exists some
$k\in\left\{  0,1,\ldots,n-1\right\}  $ such that every $m\geq k$ satisfies
$x_{k}+x_{k+1}+\cdots+x_{m}\geq0$.
\end{exercise}

\begin{exercise}
\label{exe.infdesc.gold}A \textit{golden pair} will mean a pair $\left(
x,y\right)  $ of nonnegative integers such that $\left\vert x^{2}%
-xy-y^{2}\right\vert =1$. For example, $\left(  3,2\right)  $ is a golden
pair, since $\left\vert 3^{2}-3\cdot2-2^{2}\right\vert =\left\vert
-1\right\vert =1$. Prove the following:

\textbf{(a)} If $\left(  x,y\right)  $ is a golden pair such that $\left(
x,y\right)  \neq\left(  0,1\right)  $, then $x-y\geq0$.

\textbf{(b)} If $\left(  x,y\right)  $ is a golden pair such that $\left(
x,y\right)  \neq\left(  0,1\right)  $, then $\left(  y,x-y\right)  $ is a
golden pair.

\textbf{(c)} If $\left(  x,y\right)  $ is a golden pair such that $\left(
x,y\right)  \neq\left(  1,0\right)  $, then $y>0$.

\textbf{(d)} Find an explicit formula for all golden pairs different from
$\left(  0,1\right)  $.

[\textbf{Remark:} The word \textquotedblleft golden\textquotedblright\ in
\textquotedblleft golden pair\textquotedblright\ refers to the resemblance of
the equality $\left\vert x^{2}-xy-y^{2}\right\vert =1$ to the equation
$\varphi^{2}-\varphi-1=0$ satisfied by the golden ratio $\varphi\approx1.618$.
Dividing the equation $\left\vert x^{2}-xy-y^{2}\right\vert =1$ by $y^{2}$
yields $\left\vert \left(  \dfrac{x}{y}\right)  ^{2}-\dfrac{x}{y}-1\right\vert
=\dfrac{1}{y^{2}}$, which is a way of saying that $\dfrac{x}{y}$ is a close
rational approximation to $\varphi$.]
\end{exercise}

\newpage

\section{The Pigeonhole Principle}

Next, we shall explore the \textit{pigeonhole principle} (also known as the
\textit{box principle} or \textit{Dirichlet's principle}) and its
consequences. Most textbooks on problem solving devote a chapter or at least a
section to it; examples are \cite[Chapter 4]{Engel}, \cite[\S 1.3]{GelAnd},
\cite[\S 3.3]{Zeitz17}, \cite[Kapitel 2]{ngrin}, \cite[Kapitel 3]{Carl17},
\cite[Week 2]{Galvin20} and \cite{Macgil17}. The pigeonhole principle is
generally considered to be a part of combinatorics; thus, it tends to be
explored in texts on combinatorics as well (e.g., \cite[Chapter 1]{Bona17},
\cite[\S 4.8]{Liu85}, \cite[Chapter 3]{Bruald09}).

\subsection{The principles}

The words \textquotedblleft\textit{pigeonhole principle}\textquotedblright%
\ typically refer to one of several related theorems which we shall explore in
this section. As usual, the theorems are simple; the art is to find a way to
apply them to a given problem.

\subsubsection{The Pigeonhole Principle for Injections}

We begin with the best-known \textquotedblleft pigeonhole
principle\textquotedblright. It is saying that if more than $n$ pigeons are
distributed into $n$ pigeonholes (for a given $n\in\mathbb{N}$), then at least
two pigeons must be in the same pigeonhole. This formulation is what gave this
principle its common name\footnote{The variant name \textquotedblleft box
principle\textquotedblright\ likewise results from stating the principle in
terms of pearls and boxes (instead of pigeons and pigeonholes).}; however, we
prefer a more formal way of stating it:\footnote{We will give proofs of these
theorems (or references to such proofs) later.}

\begin{theorem}
\label{thm.php.php-inj-1c}Let $U$ and $V$ be two finite sets such that
$\left\vert U\right\vert >\left\vert V\right\vert $. Let $f:U\rightarrow V$ be
any map. Then, $f$ cannot be injective.
\end{theorem}

Indeed, our previous informal statement about pigeons is precisely Theorem
\ref{thm.php.php-inj-1c} (applied to $U=\left\{  \text{pigeons}\right\}  $ and
$V=\left\{  \text{pigeonholes}\right\}  $ and to $f$ being the map that sends
each pigeon to its pigeonhole).

Here is the contrapositive of Theorem \ref{thm.php.php-inj-1c}:

\begin{theorem}
\label{thm.php.php-inj-1}Let $U$ and $V$ be two finite sets. Let
$f:U\rightarrow V$ be an injective map. Then, $\left\vert U\right\vert
\leq\left\vert V\right\vert $.
\end{theorem}

In terms of pigeons and pigeonholes, this is saying that any injective
distribution of pigeons into pigeonholes (where \textquotedblleft
injective\textquotedblright\ means \textquotedblleft no two pigeons sharing a
hole\textquotedblright) requires at least as many pigeonholes as pigeons.

Most of the time, the words \textquotedblleft\textit{pigeonhole principle}%
\textquotedblright\ refer to one of Theorems \ref{thm.php.php-inj-1c} and
\ref{thm.php.php-inj-1}. The next theorems in this section are closely related
but less commonly used.

The \textquotedblleft equality case\textquotedblright\ of Theorem
\ref{thm.php.php-inj-1} is also interesting: If we have equally many pigeons
and pigeonholes, then any injective distribution of pigeons into pigeonholes
must be surjective as well (i.e., each pigeonhole is inhabited), and thus must
be bijective. Let us state this formally, too:

\begin{theorem}
\label{thm.php.php-inj-2}Let $U$ and $V$ be two finite sets. Let
$f:U\rightarrow V$ be an injective map. Assume that $\left\vert U\right\vert
=\left\vert V\right\vert $. Then, $f$ is bijective.
\end{theorem}

\begin{fineprint}
A few words about the proofs: Theorem \ref{thm.php.php-inj-2} follows
immediately from \cite[Lemma 1.5]{detnotes}. Theorem \ref{thm.php.php-inj-1c}
is an easy consequence of \cite[Lemma 1.5]{detnotes} as
well\footnote{\textit{Proof.} Let $U$ and $V$ be two finite sets such that
$\left\vert U\right\vert >\left\vert V\right\vert $. Let $f:U\rightarrow V$ be
any map. Assume that $f$ is injective. Then, \cite[Lemma 1.5]{detnotes} yields
the logical equivalence
\[
\left(  f\text{ is injective}\right)  \Longleftrightarrow\left(  f\text{ is
bijective}\right)  .
\]
Hence, $f$ is bijective (since $f$ is injective). Thus, $f$ is a bijection.
Hence, there exists a bijection from $U$ to $V$ (namely, $f$). This yields
$\left\vert U\right\vert =\left\vert V\right\vert $, which contradicts
$\left\vert U\right\vert >\left\vert V\right\vert $. This contradiction shows
that our assumption (that $f$ is injective) was wrong. Hence, $f$ cannot be
injective. This proves Theorem \ref{thm.php.php-inj-1c}.}. Theorem
\ref{thm.php.php-inj-1} is just the contrapositive of Theorem
\ref{thm.php.php-inj-1c}. All three theorems are basic facts about finite sets
and can be used without proof on any contest.
\end{fineprint}

A warning about infinite sets: Theorem \ref{thm.php.php-inj-2} fails badly
when $U$ and $V$ are allowed to be infinite. For example, the map
$\mathbb{N}\rightarrow\mathbb{N},\ i\mapsto i+1$ is injective, but not
bijective.\footnote{Compare \textquotedblleft%
\href{https://en.wikipedia.org/wiki/Hilbert's_paradox_of_the_Grand_Hotel}{Hilbert's
Hotel}\textquotedblright\ for various phenomena like this. (Hilbert seemed to
prefer humans to pigeons in his thought experiments.)}

For future use, let us restate Theorem \ref{thm.php.php-inj-1c} in more
explicit terms:

\begin{corollary}
\label{cor.php.php-inj-dist}Let $n,m\in\mathbb{N}$ satisfy $m>n$. Let $V$ be
an $n$-element set. Let $a_{1},a_{2},\ldots,a_{m}$ be $m$ elements of $V$.
Then, at least two of these $m$ elements $a_{1},a_{2},\ldots,a_{m}$ must be equal.
\end{corollary}

\begin{fineprint}
\begin{proof}
[Proof of Corollary \ref{cor.php.php-inj-dist}.]We have $\left\vert
V\right\vert =n$ (since $V$ is an $n$-element set). Let $f:\left\{
1,2,\ldots,m\right\}  \rightarrow V$ be the map that sends each $i\in\left\{
1,2,\ldots,m\right\}  $ to $a_{i}$. Then, Theorem \ref{thm.php.php-inj-1c}
(applied to $U=\left\{  1,2,\ldots,m\right\}  $) shows that this map $f$
cannot be injective (since $\left\vert \left\{  1,2,\ldots,m\right\}
\right\vert =m>n=\left\vert V\right\vert $). In other words, there exist two
distinct elements $i$ and $j$ of $\left\{  1,2,\ldots,m\right\}  $ such that
$f\left(  i\right)  =f\left(  j\right)  $. In other words, there exist two
distinct elements $i$ and $j$ of $\left\{  1,2,\ldots,m\right\}  $ such that
$a_{i}=a_{j}$ (since the definition of $f$ yields $f\left(  i\right)  =a_{i}$
and $f\left(  j\right)  =a_{j}$). In other words, at least two of the $m$
elements $a_{1},a_{2},\ldots,a_{m}$ must be equal. This proves Corollary
\ref{cor.php.php-inj-dist}.
\end{proof}
\end{fineprint}

\subsubsection{The Pigeonhole Principle for \textquotedblleft
Multi-injections\textquotedblright}

The pigeonhole principle can be generalized. Namely, if more than $kn$ pigeons
are distributed into $n$ pigeonholes (for given $n,k\in\mathbb{N}$), then at
least $k+1$ pigeons must be in the same pigeonhole. Let us restate this as a
contrapositive: If we have $n$ pigeonholes and each pigeonhole fits only $k$
pigeons, then we cannot distribute more than $kn$ pigeons into these holes.
Let us restate this formally:

\begin{theorem}
\label{thm.php.php-mulinj}Let $U$ and $V$ be two finite sets. Let
$k\in\mathbb{N}$. Let $f:U\rightarrow V$ be a map. Assume that each $v\in V$
satisfies%
\begin{equation}
\left(  \text{the number of all }u\in U\text{ such that }f\left(  u\right)
=v\right)  \leq k. \label{eq.thm.php.php-mulinj.ass}%
\end{equation}
Then, $\left\vert U\right\vert \leq k\left\vert V\right\vert $.
\end{theorem}

\begin{fineprint}
\begin{proof}
[Proof of Theorem \ref{thm.php.php-mulinj}.]We have $\sum_{s\in U}1=\left\vert
U\right\vert \cdot1=\left\vert U\right\vert $, so that%
\begin{align*}
\left\vert U\right\vert  &  =\sum_{s\in U}1=\sum_{w\in V}\sum_{\substack{s\in
U;\\f\left(  s\right)  =w}}1\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.sum.sheph}), applied to }S=U\text{ and }W=V\text{ and }a_{s}=1\right)
\\
&  =\sum_{v\in V}\underbrace{\sum_{\substack{u\in U;\\f\left(  u\right)
=v}}1}_{\substack{=\left(  \text{the number of all }u\in U\text{ such that
}f\left(  u\right)  =v\right)  \cdot1\\=\left(  \text{the number of all }u\in
U\text{ such that }f\left(  u\right)  =v\right)  \\\leq k\\\text{(by
(\ref{eq.thm.php.php-mulinj.ass}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed the summation
indices }w\text{ and }s\text{ as }v\text{ and }u\right) \\
&  \leq\sum_{v\in V}k=\left\vert V\right\vert \cdot k=k\left\vert V\right\vert
.
\end{align*}
This proves Theorem \ref{thm.php.php-mulinj}.
\end{proof}
\end{fineprint}

The contrapositive of Theorem \ref{thm.php.php-mulinj} says the following:

\begin{theorem}
\label{thm.php.php-mulinj-c}Let $U$ and $V$ be two finite sets. Let
$k\in\mathbb{N}$. Let $f:U\rightarrow V$ be a map. Assume that $\left\vert
U\right\vert >k\left\vert V\right\vert $. Then, there exists a $v\in V$ such
that%
\[
\left(  \text{the number of all }u\in U\text{ such that }f\left(  u\right)
=v\right)  >k.
\]

\end{theorem}

Theorem \ref{thm.php.php-mulinj}, too, is known as the \textquotedblleft
pigeonhole principle\textquotedblright. There is again an equality case
statement, whose proof we leave to the reader:

\begin{exercise}
\label{exe.php.php-mulinj.eq}Let $U$ and $V$ be two finite sets. Let
$k\in\mathbb{N}$. Let $f:U\rightarrow V$ be a map. Assume that each $v\in V$
satisfies (\ref{eq.thm.php.php-mulinj.ass}). Assume that $\left\vert
U\right\vert =k\left\vert V\right\vert $. Then, the inequality
(\ref{eq.thm.php.php-mulinj.ass}) is an equality for each $v\in V$.
\end{exercise}

\subsubsection{The Dual Pigeonhole Principle for Surjections}

The \textquotedblleft dual pigeonhole principle\textquotedblright\ (my own
name) says that if fewer than $n$ pigeons are distributed into $n$ pigeonholes
(for a given $n\in\mathbb{N}$), then at least one pigeonhole is empty.
Formally speaking:

\begin{theorem}
\label{thm.php.php-surj-1c}Let $U$ and $V$ be two finite sets such that
$\left\vert U\right\vert <\left\vert V\right\vert $. Let $f:U\rightarrow V$ be
any map. Then, $f$ cannot be surjective.
\end{theorem}

Here is the contrapositive of Theorem \ref{thm.php.php-surj-1c}:

\begin{theorem}
\label{thm.php.php-surj-1}Let $U$ and $V$ be two finite sets. Let
$f:U\rightarrow V$ be a surjective map. Then, $\left\vert U\right\vert
\geq\left\vert V\right\vert $.
\end{theorem}

In terms of pigeons and pigeonholes, this is saying that any surjective
distribution of pigeons into pigeonholes (where \textquotedblleft
surjective\textquotedblright\ means \textquotedblleft no hole stays
empty\textquotedblright) requires at least as many pigeons as pigeonholes.

Again, the \textquotedblleft equality case\textquotedblright\ is interesting:
If we have equally many pigeons and pigeonholes, then any surjective
distribution of pigeons into pigeonholes must be injective as well (i.e., no
two pigeons share a hole). In formal terms, this is saying the following:

\begin{theorem}
\label{thm.php.php-surj-2}Let $U$ and $V$ be two finite sets. Let
$f:U\rightarrow V$ be a surjective map. Assume that $\left\vert U\right\vert
=\left\vert V\right\vert $. Then, $f$ is bijective.
\end{theorem}

\begin{fineprint}
A few words about the proofs: Theorem \ref{thm.php.php-surj-2} follows
immediately from \cite[Lemma 1.4]{detnotes}. Theorem \ref{thm.php.php-surj-1c}
is an easy consequence of \cite[Lemma 1.4]{detnotes} as
well\footnote{\textit{Proof.} Let $U$ and $V$ be two finite sets such that
$\left\vert U\right\vert <\left\vert V\right\vert $. Let $f:U\rightarrow V$ be
any map. Assume that $f$ is surjective. Then, \cite[Lemma 1.4]{detnotes}
yields the logical equivalence
\[
\left(  f\text{ is surjective}\right)  \Longleftrightarrow\left(  f\text{ is
bijective}\right)  .
\]
Hence, $f$ is bijective (since $f$ is surjective). Thus, $f$ is a bijection.
Hence, there exists a bijection from $U$ to $V$ (namely, $f$). This yields
$\left\vert U\right\vert =\left\vert V\right\vert $, which contradicts
$\left\vert U\right\vert <\left\vert V\right\vert $. This contradiction shows
that our assumption (that $f$ is surjective) was wrong. Hence, $f$ cannot be
surjective. This proves Theorem \ref{thm.php.php-surj-1c}.}. Theorem
\ref{thm.php.php-surj-1} is just the contrapositive of Theorem
\ref{thm.php.php-surj-1c}. Again, these are basic results that need no proof
in real mathematics.
\end{fineprint}

Again, Theorem \ref{thm.php.php-surj-2} fails when $U$ and $V$ are allowed to
be infinite. For example, the map $\mathbb{N}\rightarrow\mathbb{N},\ i\mapsto
i//2$ is surjective, but not bijective.

\subsection{Applications}

\subsubsection{Simple applications}

There are many ways in which the pigeonhole principle (in its various forms)
can be used. Let us first collect some simple examples (before moving on to
more sophisticated ones):

\begin{itemize}
\item Among any $13$ persons, there are two that are born in the same month.

This follows from Theorem \ref{thm.php.php-inj-1c} (applied to $U=\left\{
\text{the }13\text{ persons}\right\}  $ and $V=\left\{  \text{the }12\text{
months}\right\}  $ and to $f$ being the map that sends each person to their
birth month). Or, to say this in less formal terms: This follows from the
pigeonhole principle, where the \textquotedblleft pigeons\textquotedblright%
\ are the $13$ persons and the \textquotedblleft pigeonholes\textquotedblright%
\ are the $12$ months.

\item There are two people alive right now with the exact same number of hairs
on their heads.

Indeed, we can safely assume that any human has at most $5\ 000\ 000$ hairs on
their head (in fact, the typical number of hairs on a human head is around
$100\ 000$), but the world population is far larger (over $7$ billion). Thus,
we can apply Theorem \ref{thm.php.php-inj-1c} to $U=\left\{  \text{humans
alive right now}\right\}  $ and $V=\left\{  0,1,\ldots,5\ 000\ 000\right\}  $
and to $f$ being the map that sends each person to their number of hairs.

(Alternatively, it suffices to find two baldies.)

I have stolen this example from \cite[Week 2]{Galvin20}, but in fact it is one
of the oldest examples of the Pigeonhole Principle; it appeared in a 1622 book
by Jean Leurechon (see \cite{RitHee13}).

\item If $26$ mosquitoes are hanging from a $1\operatorname*{m}\times
1\operatorname*{m}$-sized rectangular window, and you have a
$20\operatorname*{cm}\times20\operatorname*{cm}$-sized rectangular flyswatter,
then you can hit (at least) two mosquitoes with one strike of the flyswatter
(if you are fast enough).

Indeed, we can subdivide the window into $25$ flyswatter-sized squares as
follows:%
\[%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (5, 5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (5, 5);
\end{tikzpicture}%
%EndExpansion
\]
and then the pigeonhole principle (i.e., Theorem \ref{thm.php.php-inj-1c})
will ensure that at least one of these $25$ squares will contain at least $2$ mosquitoes.

\item Consider a triangle $ABC$, and a straight line $\ell$ in its plane.
Assume that $\ell$ contains none of the vertices $A$, $B$ and $C$. Then, the
line $\ell$ cannot cut more than two sides of the triangle $ABC$.

Indeed, if $\ell$ cuts a segment $XY$ without passing through either of its
endpoints $X$ and $Y$, then the two points $X$ and $Y$ must lie on different
sides\footnote{formally speaking: half-planes} of the line $\ell$. But the
line $\ell$ has only two sides, and therefore the pigeonhole principle (i.e.,
Theorem \ref{thm.php.php-inj-1c}) guarantees that at least two vertices of the
triangle $ABC$ will lie on one side of $\ell$; therefore, the side connecting
these two vertices cannot be cut by $\ell$.

\item Among any $25$ persons, there are three that are born in the same month.

This follows by applying Theorem \ref{thm.php.php-mulinj-c} to $k=2$ and
$U=\left\{  \text{the }25\text{ persons}\right\}  $ and $V=\left\{  \text{the
}12\text{ months}\right\}  $, because these two sets $U$ and $V$ satisfy
$\left\vert U\right\vert >2\left\vert V\right\vert $.

\item If $n$ is a positive integer, and if $x_{1},x_{2},\ldots,x_{n+1}$ are
$n+1$ integers, then at least two of these $n+1$ integers $x_{1},x_{2}%
,\ldots,x_{n+1}$ are congruent modulo $n$.

Indeed, the remainders $x_{1}\%n,\ \ x_{2}\%n,\ \ \ldots,\ \ x_{n+1}\%n$ are
$n+1$ elements of the $n$-element set $\left\{  0,1,\ldots,n-1\right\}  $;
thus, Corollary \ref{cor.php.php-inj-dist} (applied to $m=n+1$ and $V=\left\{
0,1,\ldots,n-1\right\}  $ and $a_{i}=x_{i}\%n$) shows that at least two of
these $n+1$ elements $x_{1}\%n,\ \ x_{2}\%n,\ \ \ldots,\ \ x_{n+1}\%n$ must be
equal; but this entails that the corresponding two of the integers
$x_{1},x_{2},\ldots,x_{n+1}$ are congruent modulo $n$ (by Proposition
\ref{prop.ent.quo-rem.mod=rem}).

\item If $n+1$ distinct numbers are selected from the set $\left\{
1,2,\ldots,2n\right\}  $ (for some positive integer $n$), then some two of
these $n+1$ numbers sum to $2n+1$.\ \ \ \ \footnote{For example, for $n=5$, if
we select the $6$ numbers $1,3,4,5,7,9$ from the set $\left\{  1,2,\ldots
,10\right\}  $, then some two of these $6$ numbers (namely, $4$ and $7$) sum
to $11$.}

Indeed, define the \textquotedblleft pigeons\textquotedblright\ to be our
$n+1$ selected numbers. Define the \textquotedblleft
pigeonholes\textquotedblright\ to be the $n$ two-element sets
\[
\left\{  1,2n\right\}  ,\ \ \left\{  2,2n-1\right\}  ,\ \ \left\{
3,2n-2\right\}  ,\ \ \ldots,\ \ \left\{  n,n+1\right\}
\]
(that is, the two-element sets $\left\{  i,2n+1-i\right\}  $ for all
$i\in\left\{  1,2,\ldots,n\right\}  $). These $n$ two-element sets are
disjoint and together cover the whole set $\left\{  1,2,\ldots,2n\right\}  $.
Thus, each of our $n+1$ selected numbers lies in precisely one of these $n$
two-element sets. In other words, each of our $n+1$ \textquotedblleft
pigeons\textquotedblright\ lies in precisely one \textquotedblleft
pigeonhole\textquotedblright. By the Pigeonhole Principle (Theorem
\ref{thm.php.php-inj-1c}), this entails that two of our \textquotedblleft
pigeons\textquotedblright\ share a \textquotedblleft
pigeonhole\textquotedblright\ -- i.e., that two of our $n+1$ selected numbers
lie in the same two-element set. Since the selected numbers are distinct, this
means that these two numbers must be the two elements of the two-element set
they lie in; therefore, they sum to $2n+1$.

\item You have $10$ pairs of shoes: $5$ pairs of black shoes and $5$ pairs of
yellow shoes. You pick $k$ shoes at random. How high must $k$ be so you can be
sure that among the shoes you pick, there will be at least one matching pair
(i.e., one left and one right shoe of the same color)?

The answer is that $k$ must be at least $11$. Indeed, $k\leq10$ is
insufficient, since picking $k\leq10$ shoes may leave you with $k$ left shoes.
On the other hand, picking $11$ shoes will suffice, because the Pigeonhole
Principle (Theorem \ref{thm.php.php-mulinj}) guarantees that among these $11$
shoes there will be at least $6$ of the same color, and (by assumption) these
$6$ shoes cannot all be left or all be right (since there are only $5$ left
shoes of each color, and only $5$ right shoes of each color).
\end{itemize}

More such examples can be found, e.g., in \cite[Notes on the Pigeonhole
Principle]{Macgil17}.

We have also seen an application of the Pigeonhole Principle (specifically, of
Corollary \ref{cor.php.php-inj-dist}) in the solution to Exercise
\ref{exe.nt.p1}. The third solution to Exercise \ref{exe.lac.size} can also be
viewed as a use of the Pigeonhole Principle (indeed, regard the elements of
the $k$-lacunar subset $S$ as pigeons, and regard the $q+1$ intervals
$I_{0},I_{1},\ldots,I_{q}$ as pigeonholes).

Here is another simple consequence of the pigeonhole principles:

\begin{corollary}
\label{cor.php.endofunc.fg}Let $U$ and $V$ be two finite sets such that
$\left\vert U\right\vert \leq\left\vert V\right\vert $. Let $f:U\rightarrow V$
and $g:V\rightarrow U$ be two maps such that $f\circ g=\operatorname*{id}%
\nolimits_{V}$. Then, the maps $f$ and $g$ are mutually inverse.
\end{corollary}

Note that Corollary \ref{cor.php.endofunc.fg} fails if the condition
$\left\vert U\right\vert \leq\left\vert V\right\vert $ is removed\footnote{For
example, if $U=\left\{  0,1,2,3\right\}  $ and $V=\left\{  0,1\right\}  $ and
$f\left(  u\right)  =u//2$ and $g\left(  v\right)  =2v$, then $f\circ
g=\operatorname*{id}\nolimits_{V}$, but the maps $f$ and $g$ are not mutually
inverse.}, and also fails if $U$ and $V$ are allowed to be
infinite\footnote{For example, if $U=\mathbb{N}$ and $V=\mathbb{N}$ and
$f\left(  u\right)  =u//2$ and $g\left(  v\right)  =2v$, then $f\circ
g=\operatorname*{id}\nolimits_{V}$, but the maps $f$ and $g$ are not mutually
inverse.}.

\begin{proof}
[Proof of Corollary \ref{cor.php.endofunc.fg}.]The assumption $f\circ
g=\operatorname*{id}\nolimits_{V}$ shows that the map $f$ is
surjective\footnote{\textit{Proof.} Let $v\in V$. Then, from $f\circ
g=\operatorname*{id}\nolimits_{V}$, we obtain $\left(  f\circ g\right)
\left(  v\right)  =\operatorname*{id}\nolimits_{V}\left(  v\right)  $, so that
$v=\operatorname*{id}\nolimits_{V}\left(  v\right)  =\left(  f\circ g\right)
\left(  v\right)  =f\left(  g\left(  v\right)  \right)  $. Hence, $v$ is a
value of the map $f$ (namely, the value of $f$ on $g\left(  v\right)  $).
\par
Forget that we fixed $v$. We thus have shown that each $v\in V$ is a value of
the map $f$. In other words, the map $f$ is surjective.}. Hence, Theorem
\ref{thm.php.php-surj-1} shows that $\left\vert U\right\vert \geq\left\vert
V\right\vert $. Combining this with $\left\vert U\right\vert \leq\left\vert
V\right\vert $, we obtain $\left\vert U\right\vert =\left\vert V\right\vert $.
Thus, Theorem \ref{thm.php.php-surj-2} yields that $f$ is bijective. In other
words, $f$ is invertible (since a map is bijective if and only if it is
invertible). Hence, the inverse map $f^{-1}$ exists. Now, from $f\circ
g=\operatorname*{id}\nolimits_{V}$, we conclude that $f^{-1}=g$ (because
comparing $\underbrace{f^{-1}\circ f}_{=\operatorname*{id}\nolimits_{U}}\circ
g=\operatorname*{id}\nolimits_{U}\circ g=g$ with $f^{-1}\circ
\underbrace{f\circ g}_{=\operatorname*{id}\nolimits_{V}}=f^{-1}\circ
\operatorname*{id}\nolimits_{V}=f^{-1}$ results in $f^{-1}=g$). Thus, the maps
$f$ and $g$ are mutually inverse. This proves Corollary
\ref{cor.php.endofunc.fg}.
\end{proof}

Note that, just as we have proved Corollary \ref{cor.php.endofunc.fg} using
Theorems \ref{thm.php.php-surj-1} and \ref{thm.php.php-surj-2}, we can also
prove Corollary \ref{cor.php.endofunc.fg} using Theorems
\ref{thm.php.php-inj-1} and \ref{thm.php.php-inj-2} instead (by applying the
latter theorems to $V$, $U$ and $g$ instead of $U$, $V$ and $f$). The details
of this alternative proof are left to the reader.

\subsubsection{Handshakes}

A slightly less obvious application of the pigeonhole principle is the
following exercise (\cite[Aufgabe 2.10]{ngrin} or \cite[Exercise 4.13]{Engel}):

\begin{exercise}
\label{exe.php.handshakes}Let $n\geq2$ be an integer. At a conference long
ago, $n$ scientists have met; some of them have exchanged handshakes among
each other\footnotemark. Prove that two of these $n$ scientists have shaken
the same number of hands during the conference. (We assume that any pair of
scientists shakes hands at most once. We also assume that no one shakes their
own hands.)
\end{exercise}

\footnotetext{For readers from the future: Handshakes were a form of greeting
popular until 2020. A handshake involves two people, each of whom shakes
exactly one hand of the other. Thus, when person $a$ shakes person $b$'s
hands, person $b$ also shakes person $a$'s hands.}

\begin{example}
Let $n=6$, and consider the following situation:%
\[%
%TCIMACRO{\TeXButton{tikz 6-graph}{\begin{tikzpicture}[scale=2.5]
%\node(A) at (0.5 cm, 0.866 cm) {};
%\node(B) at (0.5 cm, -0.866 cm) {};
%\node(C) at (1 cm, 0 cm) {};
%\node(D) at (-0.5 cm, -0.866 cm) {};
%\node(E) at (-0.5 cm, 0.866 cm) {};
%\node(F) at (-1 cm, 0 cm) {};
%\fill(A) circle (1pt) node[above right] {$A$};
%\fill(B) circle (1pt) node[below left] {$B$};
%\fill(C) circle (1pt) node[below right] {$C$};
%\fill(D) circle (1pt) node[below left] {$D$};
%\fill(E) circle (1pt) node[above right] {$E$};
%\fill(F) circle (1pt) node[above left] {$F$};
%\draw
%[very thick, blue] (E) -- (F) (A) -- (B) -- (C) (D) -- (C) -- (E) -- (B) (D) -- (F) -- (C) -- (A);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\node(A) at (0.5 cm, 0.866 cm) {};
\node(B) at (0.5 cm, -0.866 cm) {};
\node(C) at (1 cm, 0 cm) {};
\node(D) at (-0.5 cm, -0.866 cm) {};
\node(E) at (-0.5 cm, 0.866 cm) {};
\node(F) at (-1 cm, 0 cm) {};
\fill(A) circle (1pt) node[above right] {$A$};
\fill(B) circle (1pt) node[below left] {$B$};
\fill(C) circle (1pt) node[below right] {$C$};
\fill(D) circle (1pt) node[below left] {$D$};
\fill(E) circle (1pt) node[above right] {$E$};
\fill(F) circle (1pt) node[above left] {$F$};
\draw
[very thick, blue] (E) -- (F) (A) -- (B) -- (C) (D) -- (C) -- (E) -- (B) (D) -- (F) -- (C) -- (A);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Here, $A,B,C,D,E,F$ are the $6$ scientists, and a line segment connects any
pair of scientists that has exchanged a handshake. Thus, scientist $A$ has
shaken $2$ hands; $B$ has shaken $3$ hands; $C$ has shaken $5$ hands; $D$ has
shaken $2$ hands; etc.. Thus, $A$ and $D$ have shaken the same number of hands.
\end{example}

\begin{example}
The two assumptions in Exercise \ref{exe.php.handshakes} (that any pair shakes
hands at most once, and that no one shakes their own hands) are important. If
a scientist is allowed to shake hands with themselves, then a counterexample
can be obtained even for $n=2$ (imagine two scientists, one of whom shakes
their own hands while the other doesn't), independently of whether we count a
\textquotedblleft self-handshake\textquotedblright\ as one or two hands being
shaken. If a pair of scientists is allowed to shake hands multiple times, then
a counterexample can be found for $n=3$ (imagine three scientists $A$, $B$ and
$C$, where $A$ shakes hands with $B$ once and with $C$ twice). The language of
graph theory will later give us faster ways to state such assumptions (in
particular, we will be able to model the $n$ scientists as a \textit{loopless
simple graph}).
\end{example}

\begin{noncompile}
Pictures showing the counterexamples:%
\[%
%TCIMACRO{\TeXButton{tikzpicture}{\begin{tikzpicture}[scale=2.5]
%\node(A) at (0.5 cm, 0.866 cm) {};
%\node(B) at (0.5 cm, -0.866 cm) {};
%\node(C) at (-1 cm, 0 cm) {};
%\fill(A) circle (1pt) node[above right] {$A$};
%\fill(B) circle (1pt) node[below left] {$B$};
%\fill(C) circle (1pt) node[above left] {$C$};
%\path[every node/.style={font=\sffamily\small}, -]
%(A) edge [very thick, blue] (B)
%(B) edge [very thick, blue, bend right] (C)
%(C) edge [very thick, blue, bend right] (B);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\node(A) at (0.5 cm, 0.866 cm) {};
\node(B) at (0.5 cm, -0.866 cm) {};
\node(C) at (-1 cm, 0 cm) {};
\fill(A) circle (1pt) node[above right] {$A$};
\fill(B) circle (1pt) node[below left] {$B$};
\fill(C) circle (1pt) node[above left] {$C$};
\path[every node/.style={font=\sffamily\small}, -]
(A) edge [very thick, blue] (B)
(B) edge [very thick, blue, bend right] (C)
(C) edge [very thick, blue, bend right] (B);
\end{tikzpicture}%
%EndExpansion
\]%
\[%
%TCIMACRO{\TeXButton{tikzpicture}{\begin{tikzpicture}[scale=2.5]
%\node(A) at (0.5 cm, 0.866 cm) {};
%\node(B) at (0.5 cm, -0.866 cm) {};
%\fill(A) circle (1pt) node[above right] {$A$};
%\fill(B) circle (1pt) node[below left] {$B$};
%\path[every node/.style={font=\sffamily\small}, -]
%(B) edge [very thick, blue, loop right] (B);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\node(A) at (0.5 cm, 0.866 cm) {};
\node(B) at (0.5 cm, -0.866 cm) {};
\fill(A) circle (1pt) node[above right] {$A$};
\fill(B) circle (1pt) node[below left] {$B$};
\path[every node/.style={font=\sffamily\small}, -]
(B) edge [very thick, blue, loop right] (B);
\end{tikzpicture}%
%EndExpansion
\]

\end{noncompile}

\begin{proof}
[Solution to Exercise \ref{exe.php.handshakes}.]Assume the contrary. Thus, any
two distinct scientists have shaken different numbers of hands.

Let $U$ be the set of our $n$ scientists. Let $V$ be the set $\left\{
0,1,\ldots,n-1\right\}  $. Thus, both $U$ and $V$ are $n$-element sets; hence,
$\left\vert U\right\vert =\left\vert V\right\vert $. From $n\geq2$, we obtain
$n-1\neq0$ and $0\in V$ and $n-1\in V$.

Define a map $f:U\rightarrow V$ as follows: For each scientist $s\in U$, we
let $f\left(  s\right)  $ be the number of hands that $s$ has shaken. This is
well-defined, because $s$ has shaken at most $n-1$ hands\footnote{Here we use
our assumptions that any pair of scientists shakes hands at most once, and
that no one shakes their own hands.} and thus we have $f\left(  s\right)
\in\left\{  0,1,\ldots,n-1\right\}  =V$.

We have assumed that any two distinct scientists have shaken different numbers
of hands. In other words, if $s$ and $t$ are two distinct scientists, then
$f\left(  s\right)  \neq f\left(  t\right)  $. In other words, the map $f$ is
injective. Hence, Theorem \ref{thm.php.php-inj-2} yields that $f$ is bijective
(since $\left\vert U\right\vert =\left\vert V\right\vert $). Thus, in
particular, $f$ is surjective. Hence, there exists a scientist $a\in U$ such
that $f\left(  a\right)  =n-1$ (since $n-1\in V$), and there exists a
scientist $b\in U$ such that $f\left(  b\right)  =0$ (since $0\in V$).
Consider these $a$ and $b$. Note that $a\neq b$ (since $f\left(  a\right)
=n-1\neq0=f\left(  b\right)  $).

The scientist $a$ has shaken $n-1$ hands (since $f\left(  a\right)  =n-1$).
Thus, $a$ must have shaken everyone's hands (except for $a$ themselves),
because there are only $n-1$ hands in total for $a$ to possibly shake. Hence,
in particular, $a$ must have shaken the hands of $b$ (since $a\neq b$). Thus,
$b$ must have shaken the hands of $a$. But from $f\left(  b\right)  =0$, we
see that $b$ has shaken no hands at all. The previous two sentences contradict
each other. This contradiction shows that our assumption was false. Hence,
Exercise \ref{exe.php.handshakes} is solved.
\end{proof}

\subsubsection{Back to Bezout}

Let us next solve Exercise \ref{exe.ent.gcd.diff-pos} again, this time using
the pigeonhole principle. We begin with the particular case in which $a\perp
b$ (\cite[Chapter 4, Example E5]{Engel}):

\begin{exercise}
\label{exe.php.gcd.diff-pos.1}Let $a$ and $b$ be two positive integers such
that $a\perp b$. Prove that there exist positive integers $x$ and $y$ such
that $1=xa-yb$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.php.gcd.diff-pos.1}.]Let $U=\left\{
2,3,\ldots,b+1\right\}  $ and $V=\left\{  0,1,\ldots,b-1\right\}  $. Both $U$
and $V$ are $b$-element sets; thus, $\left\vert U\right\vert =\left\vert
V\right\vert $.

Let $f:U\rightarrow V$ be the map that sends each $u\in U$ to the remainder
$\left(  ua\right)  \%b$. (This is well-defined, since each $u\in U$ satisfies
$\left(  ua\right)  \%b\in\left\{  0,1,\ldots,b-1\right\}  =V$.)

We shall now show the following:

\begin{statement}
\textit{Claim 1:} The map $f$ is injective.
\end{statement}

[\textit{Proof of Claim 1:} Let $u_{1}$ and $u_{2}$ be two distinct elements
of $U$. We shall show that $f\left(  u_{1}\right)  \neq f\left(  u_{2}\right)
$.

Indeed, assume the contrary. Thus, $f\left(  u_{1}\right)  =f\left(
u_{2}\right)  $, so that $f\left(  u_{2}\right)  =f\left(  u_{1}\right)  $. We
WLOG assume that $u_{1}\leq u_{2}$ (since otherwise, we can simply swap
$u_{1}$ with $u_{2}$). Hence, $u_{1}<u_{2}$ (since $u_{1}$ and $u_{2}$ are
distinct), so that $u_{2}-u_{1}>0$. Thus, $u_{2}-u_{1}\neq0$.

From $u_{1}\in U=\left\{  2,3,\ldots,b+1\right\}  $, we obtain $u_{1}\geq2$.
From $u_{2}\in U=\left\{  2,3,\ldots,b+1\right\}  $, we obtain $u_{2}\leq
b+1$. Hence,%
\[
\underbrace{u_{2}}_{\leq b+1}-\underbrace{u_{1}}_{\geq2}\leq\left(
b+1\right)  -2=b-1<b.
\]


The definition of $f$ yields $f\left(  u_{1}\right)  =\left(  u_{1}a\right)
\%b$ and $f\left(  u_{2}\right)  =\left(  u_{2}a\right)  \%b$. Hence, $\left(
u_{2}a\right)  \%b=f\left(  u_{2}\right)  =f\left(  u_{1}\right)  =\left(
u_{1}a\right)  \%b$. But Proposition \ref{prop.ent.quo-rem.mod=rem} (applied
to $u_{2}a$, $u_{1}a$ and $b$ instead of $u$, $v$ and $n$) yields that
$u_{2}a\equiv u_{1}a\operatorname{mod}b$ if and only if $\left(
u_{2}a\right)  \%b=\left(  u_{1}a\right)  \%b$. Hence, we have $u_{2}a\equiv
u_{1}a\operatorname{mod}b$ (since we have $\left(  u_{2}a\right)  \%b=\left(
u_{1}a\right)  \%b$). Thus, $au_{2}=u_{2}a\equiv u_{1}a=au_{1}%
\operatorname{mod}b$. Therefore, Lemma \ref{lem.ent.coprime.cancel} (applied
to $u_{2}$, $u_{1}$ and $b$ instead of $b$, $c$ and $n$) yields $u_{2}\equiv
u_{1}\operatorname{mod}b$ (since $a\perp b$). In other words, $b\mid
u_{2}-u_{1}$. Hence, Proposition \ref{prop.ent.div.1} \textbf{(b)} (applied to
$b$ and $u_{2}-u_{1}$ instead of $a$ and $b$) yields $\left\vert b\right\vert
\leq\left\vert u_{2}-u_{1}\right\vert =u_{2}-u_{1}$ (since $u_{2}-u_{1}>0$).
Hence, $u_{2}-u_{1}\geq\left\vert b\right\vert =b$ (since $b>0$). This
contradicts $u_{2}-u_{1}<b$.

This contradiction shows that our assumption was false. Hence, $f\left(
u_{1}\right)  \neq f\left(  u_{2}\right)  $ is proved.

Now, forget that we fixed $u_{1}$ and $u_{2}$. We thus have shown that
$f\left(  u_{1}\right)  \neq f\left(  u_{2}\right)  $ for any two distinct
elements $u_{1}$ and $u_{2}$ of $U$. In other words, the map $f$ is injective.
This proves Claim 1.]

Claim 1 says that $f$ is injective. Thus, Theorem \ref{thm.php.php-inj-2}
yields that $f$ is bijective (since $\left\vert U\right\vert =\left\vert
V\right\vert $). Therefore, $f$ is surjective. Hence, there exists some $u\in
U$ such that $f\left(  u\right)  =1\%b$ (since $1\%b\in\left\{  0,1,\ldots
,b-1\right\}  =V$). Consider this $u$. (Note that $1\%b=1$ whenever $b>1$; but
I don't want to make an exception for the case $b=1$.)

The definition of $f$ yields $f\left(  u\right)  =\left(  ua\right)  \%b$.
Hence, $\left(  ua\right)  \%b=f\left(  u\right)  =1\%b$. But Proposition
\ref{prop.ent.quo-rem.mod=rem} (applied to $ua$, $1$ and $b$ instead of $u$,
$v$ and $n$) yields that $ua\equiv1\operatorname{mod}b$ if and only if
$\left(  ua\right)  \%b=1\%b$. Hence, we have $ua\equiv1\operatorname{mod}b$
(since we have $\left(  ua\right)  \%b=1\%b$). In other words, $b\mid ua-1$.
In other words, there exists some integer $v$ such that $ua-1=bv$. Consider
this $v$. From $ua-1=bv$, we obtain $1=ua-bv=ua-vb$.

We have $u\in U=\left\{  2,3,\ldots,b+1\right\}  $; thus, $u$ is a positive
integer. Furthermore, it is easy to see that $v$ is a positive
integer\footnote{\textit{Proof.} From $u\in U=\left\{  2,3,\ldots,b+1\right\}
$, we obtain $u\geq2>1$. Multiplying this inequality by $a$, we obtain $ua>1a$
(since $a$ is positive). Hence, $ua>1a=a\geq1$ (since $a$ is a positive
integer). However, $ua-1=bv$, so that $bv=ua-1>0$ (since $ua>1$). We can
divide this equality by $b$ (since $b$ is positive), and obtain $v>0$. Hence,
$v$ is a positive integer (since $v$ is an integer).}. Thus, $u$ and $v$ are
two positive integers and satisfy $1=ua-vb$. Therefore, there exist positive
integers $x$ and $y$ such that $1=xa-yb$ (namely, $x=u$ and $y=v$). This
solves Exercise \ref{exe.php.gcd.diff-pos.1}.
\end{proof}

It is now easy to reduce Exercise \ref{exe.ent.gcd.diff-pos} to Exercise
\ref{exe.php.gcd.diff-pos.1}:

\begin{proof}
[Second solution to Exercise \ref{exe.ent.gcd.diff-pos}.]Both numbers $a$ and
$b$ are positive and thus nonzero; hence, $\left(  a,b\right)  \neq\left(
0,0\right)  $. Let $g=\gcd\left(  a,b\right)  $. Thus, Proposition
\ref{prop.ent.coprime.div-away} yields that $g>0$ and $\dfrac{a}{g}\perp
\dfrac{b}{g}$. In particular, the numbers $\dfrac{a}{g}$ and $\dfrac{b}{g}$
are integers. Moreover, these integers $\dfrac{a}{g}$ and $\dfrac{b}{g}$ are
positive (since $a$, $b$ and $g$ are positive). Hence, Exercise
\ref{exe.php.gcd.diff-pos.1} (applied to $\dfrac{a}{g}$ and $\dfrac{b}{g}$
instead of $a$ and $b$) shows that there exist positive integers $x$ and $y$
such that $1=x\cdot\dfrac{a}{g}-y\cdot\dfrac{b}{g}$. Consider these $x$ and
$y$, and denote them by $u$ and $v$. Thus, $u$ and $v$ are two positive
integers and satisfy $1=u\cdot\dfrac{a}{g}-v\cdot\dfrac{b}{g}$. Hence,
$1=u\cdot\dfrac{a}{g}-v\cdot\dfrac{b}{g}=\dfrac{1}{g}\left(  ua-vb\right)  $,
so that $g=ua-vb$. In view of $g=\gcd\left(  a,b\right)  $, this rewrites as
$\gcd\left(  a,b\right)  =ua-vb$. Hence, there exist positive integers $x$ and
$y$ such that $\gcd\left(  a,b\right)  =xa-yb$ (namely, $x=u$ and $y=v$). This
solves Exercise \ref{exe.ent.gcd.diff-pos} again.
\end{proof}

\subsubsection{An endofunction of a finite set}

An \textit{endofunction} of a set $X$ means a map from $X$ to $X$. While we
will not use this notation, its very existence suggests that there is
something to say about these kinds of maps. Here is a first example:

\begin{example}
\label{exa.php.endofunc.1}Let $X=\left\{  0,1,\ldots,11\right\}  $. Define a
map $f:X\rightarrow X$ by setting%
\[
f\left(  i\right)  =\left(  i^{3}+3i+1\right)
\%12\ \ \ \ \ \ \ \ \ \ \text{for each }i\in X.
\]
For example, $f\left(  5\right)  =\underbrace{\left(  5^{3}+3\cdot5+1\right)
}_{=141}\%12=141\%12=9$. The following diagram shows all elements of $X$ (as
nodes) and how the map $f$ acts on them (by drawing an arrow from each node
$i\in X$ to the node $f\left(  i\right)  $):%
\[%
%TCIMACRO{\TeXButton{tikz cycle digraph}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
%]
%\node[main node] (0) {0};
%\node[main node] (2) [right of=0] {2};
%\node[main node] (10) [right of=2] {10};
%\node[main node] (1) [right of=10] {1};
%\node[main node] (3) [above of=1] {3};
%\node[main node] (4) [above of=2] {4};
%\node[main node] (5) [below right of=1] {5};
%\node[main node] (6) [below of=2] {6};
%\node[main node] (7) [below right of=3] {7};
%\node[main node] (8) [left of=6] {8};
%\node[main node] (9) [below left of=1] {9};
%\node[main node] (11) [right of=3] {11};
%\path[-{Stealth[length=4mm]}]
%(0) edge (2)
%(1) edge (5)
%(2) edge (6)
%(3) edge (7)
%(4) edge (2)
%(5) edge (9)
%(6) edge (10)
%(7) edge (11)
%(8) edge (6)
%(9) edge (1)
%(10) edge (2)
%(11) edge (3);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
]
\node[main node] (0) {0};
\node[main node] (2) [right of=0] {2};
\node[main node] (10) [right of=2] {10};
\node[main node] (1) [right of=10] {1};
\node[main node] (3) [above of=1] {3};
\node[main node] (4) [above of=2] {4};
\node[main node] (5) [below right of=1] {5};
\node[main node] (6) [below of=2] {6};
\node[main node] (7) [below right of=3] {7};
\node[main node] (8) [left of=6] {8};
\node[main node] (9) [below left of=1] {9};
\node[main node] (11) [right of=3] {11};
\path[-{Stealth[length=4mm]}]
(0) edge (2)
(1) edge (5)
(2) edge (6)
(3) edge (7)
(4) edge (2)
(5) edge (9)
(6) edge (10)
(7) edge (11)
(8) edge (6)
(9) edge (1)
(10) edge (2)
(11) edge (3);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]

\end{example}

We observe on this diagram that if we start at any node and follow the arrows,
we will eventually get stuck in a cycle (i.e., we will start walking around in
circles). This observation holds in general whenever $X$ is a finite set and
$f:X\rightarrow X$ is a map (although the cycles in which we get stuck might
be $1$-node cycles -- i.e., we may run into a fixed point). Here is a somewhat
stronger statement:\footnote{If $X$ is a set, and if $f:X\rightarrow X$ is a
map, then the notation $f^{n}$ (for $n\in\mathbb{N}$) denotes the $n$-fold
composition $\underbrace{f\circ f\circ\cdots\circ f}_{n\text{ times}%
}:X\rightarrow X$. In particular, $f^{0}=\operatorname*{id}\nolimits_{X}$ and
$f^{n}=f\circ f^{n-1}=f^{n-1}\circ f$ for each positive integer $n$.}

\begin{theorem}
\label{thm.php.endofunc.1}Let $X$ be a finite set. Let $n=\left\vert
X\right\vert $. Let $f:X\rightarrow X$ be a map. Let $x\in X$. Then:

\textbf{(a)} There exist two integers $i$ and $j$ with $0\leq i<j\leq n$ and
$f^{i}\left(  x\right)  =f^{j}\left(  x\right)  $.

\textbf{(b)} Let $i$ and $j$ be two integers with $0\leq i<j$ and
$f^{i}\left(  x\right)  =f^{j}\left(  x\right)  $. Then, the sequence $\left(
f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)
,\ldots\right)  $ is $\left(  j-i\right)  $-periodic.
\end{theorem}

Here is an illustration of this behavior (showing only an element $x\in X$ and
its images $f^{0}\left(  x\right)  ,f^{1}\left(  x\right)  ,f^{2}\left(
x\right)  ,\ldots$ under repeated application of $f$):%
\[%
%TCIMACRO{\TeXButton{tikz lollipop}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
%]
%\node[main node] (0) {$f^0\left(x\right)$};
%\node[main node] (1) [right of=0] {$f^1\left(x\right)$};
%\node[main node] (2) [right of=1] {$f^2\left(x\right)$};
%\node[main node] (i) [right of=2] {$f^3\left(x\right)$};
%\node[main node] (ip1) [below right of=i] {$f^4\left(x\right)$};
%\node[main node] (ip2) [below left of=ip1] {$f^5\left(x\right)$};
%\node[main node] (jm1) [below left of=i] {$f^6\left(x\right)$};
%\path[-{Stealth[length=4mm]}]
%(0) edge (1)
%(1) edge (2)
%(2) edge (i)
%(i) edge [bend left] (ip1)
%(ip1) edge [bend left] (ip2)
%(ip2) edge [bend left] (jm1)
%(jm1) edge [bend left] (i);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
]
\node[main node] (0) {$f^0\left(x\right)$};
\node[main node] (1) [right of=0] {$f^1\left(x\right)$};
\node[main node] (2) [right of=1] {$f^2\left(x\right)$};
\node[main node] (i) [right of=2] {$f^3\left(x\right)$};
\node[main node] (ip1) [below right of=i] {$f^4\left(x\right)$};
\node[main node] (ip2) [below left of=ip1] {$f^5\left(x\right)$};
\node[main node] (jm1) [below left of=i] {$f^6\left(x\right)$};
\path[-{Stealth[length=4mm]}]
(0) edge (1)
(1) edge (2)
(2) edge (i)
(i) edge [bend left] (ip1)
(ip1) edge [bend left] (ip2)
(ip2) edge [bend left] (jm1)
(jm1) edge [bend left] (i);
\end{tikzpicture}%
%EndExpansion
\]
(this shows a case when $f^{3}\left(  x\right)  =f^{7}\left(  x\right)  $, so
that the $i$ and $j$ in Theorem \ref{thm.php.endofunc.1} can be chosen to be
$3$ and $7$). This kind of picture is known as a \textit{rho} to number
theorists (in honor of the Greek letter rho, which it vaguely resembles) or as
a \textit{lollipop} to graph theorists. Note that we can have $i=0$ (in which
the picture consists just of a cycle with no \textquotedblleft
running-in\textquotedblright) or $j=i+1$ (in which case the cycle is just a
single node with an arrow directly to itself).

\begin{proof}
[Proof of Theorem \ref{thm.php.endofunc.1}.]\textbf{(a)} Consider the $n+1$
elements $f^{0}\left(  x\right)  ,f^{1}\left(  x\right)  ,\ldots,f^{n}\left(
x\right)  $ of the $n$-element set $X$. Corollary \ref{cor.php.php-inj-dist}
(applied to $m=n+1$, $V=X$ and $a_{i}=f^{i-1}\left(  x\right)  $) yields that
at least two of these $n+1$ elements $f^{0}\left(  x\right)  ,f^{1}\left(
x\right)  ,\ldots,f^{n}\left(  x\right)  $ must be equal (since $n+1>n$). In
other words, there exist two integers $i$ and $j$ with $0\leq i<j\leq n$ and
$f^{i}\left(  x\right)  =f^{j}\left(  x\right)  $. This proves Theorem
\ref{thm.php.endofunc.1} \textbf{(a)}.

\textbf{(b)} Let $d=j-i$. Then, $d=j-i>0$ (since $i<j$); thus, $d$ is a
positive integer (since $i<j$). Let us denote the sequence $\left(
f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)
,\ldots\right)  $ by $\left(  u_{0},u_{1},u_{2},\ldots\right)  $. Thus,
\begin{equation}
u_{k}=f^{i+k}\left(  x\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }%
k\in\mathbb{N}. \label{pf.thm.php.endofunc.1.b.uk=}%
\end{equation}


We shall now prove that every $k\in\mathbb{N}$ satisfies $u_{k}=u_{k+d}$.

Indeed, let $k\in\mathbb{N}$. Set $\ell=k+d$. Then, $\ell=k+\underbrace{d}%
_{>0}>k\geq0$, so that $\ell\in\mathbb{N}$. Also, from $\ell=k+\underbrace{d}%
_{=j-i}=k+j-i$, we obtain $k+j=i+\ell$.

It is well-known that $f^{p}\circ f^{q}=f^{p+q}$ for any $p,q\in\mathbb{N}$.
Applying this to $p=k$ and $q=i$, we obtain $f^{k}\circ f^{i}=f^{k+i}$. Hence,
$\left(  f^{k}\circ f^{i}\right)  \left(  x\right)  =f^{k+i}\left(  x\right)
$. But (\ref{pf.thm.php.endofunc.1.b.uk=}) yields $u_{k}=f^{i+k}\left(
x\right)  =f^{k+i}\left(  x\right)  $ (since $i+k=k+i$). Comparing these two
equalities, we obtain $u_{k}=\left(  f^{k}\circ f^{i}\right)  \left(
x\right)  =f^{k}\left(  f^{i}\left(  x\right)  \right)  $.

Recall again that $f^{p}\circ f^{q}=f^{p+q}$ for any $p,q\in\mathbb{N}$.
Applying this to $p=k$ and $q=j$, we obtain $f^{k}\circ f^{j}=f^{k+j}$. Hence,
$\left(  f^{k}\circ f^{j}\right)  \left(  x\right)  =f^{k+j}\left(  x\right)
=f^{i+\ell}\left(  x\right)  $ (since $k+j=i+\ell$). But
(\ref{pf.thm.php.endofunc.1.b.uk=}) (applied to $\ell$ instead of $k$) yields
$u_{\ell}=f^{i+\ell}\left(  x\right)  $. Comparing these two equalities, we
obtain $u_{\ell}=\left(  f^{k}\circ f^{j}\right)  \left(  x\right)
=f^{k}\left(  f^{j}\left(  x\right)  \right)  $.

Now, recall that%
\begin{align*}
u_{k}  &  =f^{k}\left(  \underbrace{f^{i}\left(  x\right)  }_{=f^{j}\left(
x\right)  }\right)  =f^{k}\left(  f^{j}\left(  x\right)  \right)  =u_{\ell
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }u_{\ell}=f^{k}\left(  f^{j}\left(
x\right)  \right)  \right) \\
&  =u_{k+d}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\ell=k+d\right)  .
\end{align*}


Forget that we fixed $k$. We thus have proved that every $k\in\mathbb{N}$
satisfies $u_{k}=u_{k+d}$. However, $d$ is a positive integer; thus, we know
(from Definition \ref{def.seqs.period} \textbf{(a)}) that $d$ is a period of
the sequence $\left(  u_{0},u_{1},u_{2},\ldots\right)  $ if and only if every
$k\in\mathbb{N}$ satisfies $u_{k}=u_{k+d}$. Therefore, $d$ is a period of the
sequence $\left(  u_{0},u_{1},u_{2},\ldots\right)  $ (since every
$k\in\mathbb{N}$ satisfies $u_{k}=u_{k+d}$). In other words, the sequence
$\left(  u_{0},u_{1},u_{2},\ldots\right)  $ is $d$-periodic (by Definition
\ref{def.seqs.period} \textbf{(c)}). In other words, the sequence $\left(
f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)
,\ldots\right)  $ is $\left(  j-i\right)  $-periodic (since $\left(
u_{0},u_{1},u_{2},\ldots\right)  =\left(  f^{i}\left(  x\right)
,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)  ,\ldots\right)  $ and
$d=j-i$). This proves Theorem \ref{thm.php.endofunc.1} \textbf{(b)}.
\end{proof}

Some of the most interesting endofunctions are the bijective ones. They are
known as \textit{permutations}:\footnote{This is only one of two commonly used
meanings of the word \textquotedblleft permutation\textquotedblright; see
(e.g.) \cite[Remark 5.4]{detnotes} or
\href{https://en.wikipedia.org/wiki/Permutation}{the Wikipedia page} for the
distinction. In a nutshell, the second meaning of \textquotedblleft
permutation\textquotedblright\ is a list that contains each element of a set
exactly once. In order to avoid confusion, we shall not use this second
meaning.}

\begin{definition}
\label{def.php.perm}Let $X$ be a set. A \textit{permutation} of $X$ means a
bijective map $f:X\rightarrow X$.
\end{definition}

The identity map $\operatorname*{id}\nolimits_{X}:X\rightarrow X$ of a set $X$
is always a permutation of $X$. Here is another example of a permutation:

\begin{example}
\label{exa.php.endofunc.2}Let $X=\left\{  0,1,\ldots,9\right\}  $. Let
$f:X\rightarrow X$ be the map that sends the elements $0,1,2,3,4,5,6,7,8,9$ to
$7,5,4,3,2,6,0,1,9,8$, respectively. The following diagram shows all elements
of $X$ (as nodes) and how the map $f$ acts on them (by drawing an arrow from
each node $i\in X$ to the node $f\left(  i\right)  $):%
\[%
%TCIMACRO{\TeXButton{tikz cycle digraph}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
%]
%\node[main node] (0) {0};
%\node[main node] (6) [above of=0] {6};
%\node[main node] (5) [above left of=6] {5};
%\node[main node] (1) [below left of=5] {1};
%\node[main node] (7) [below of=1] {7};
%\node[main node] (9) [above right of=6] {9};
%\node[main node] (8) [right of=9] {8};
%\node[main node] (2) [right of=0] {2};
%\node[main node] (4) [right of=2] {4};
%\node[main node] (3) [below of=8] {3};
%\path[-{Stealth[length=4mm]}]
%(1) edge [bend left] (5)
%(5) edge [bend left] (6)
%(6) edge [bend left] (0)
%(0) edge [bend left] (7)
%(7) edge [bend left] (1)
%(9) edge [bend right] (8)
%(8) edge [bend right] (9)
%(2) edge [bend right] (4)
%(4) edge [bend right] (2)
%(3) edge [loop right] (3);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
]
\node[main node] (0) {0};
\node[main node] (6) [above of=0] {6};
\node[main node] (5) [above left of=6] {5};
\node[main node] (1) [below left of=5] {1};
\node[main node] (7) [below of=1] {7};
\node[main node] (9) [above right of=6] {9};
\node[main node] (8) [right of=9] {8};
\node[main node] (2) [right of=0] {2};
\node[main node] (4) [right of=2] {4};
\node[main node] (3) [below of=8] {3};
\path[-{Stealth[length=4mm]}]
(1) edge [bend left] (5)
(5) edge [bend left] (6)
(6) edge [bend left] (0)
(0) edge [bend left] (7)
(7) edge [bend left] (1)
(9) edge [bend right] (8)
(8) edge [bend right] (9)
(2) edge [bend right] (4)
(4) edge [bend right] (2)
(3) edge [loop right] (3);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Note that our map $f$ here is a permutation of $X$; thus, any node has exactly
one arrow arriving at it.
\end{example}

The behavior seen in this diagram is a simpler particular case of that seen in
Example \ref{exa.php.endofunc.1}: Every node is part of a cycle (rather than
merely being connected to a cycle via some arrows). We can formalize this as follows:

\begin{theorem}
\label{thm.php.perm.1}Let $X$ be a finite set. Let $n=\left\vert X\right\vert
$. Let $f:X\rightarrow X$ be a permutation of $X$. Let $x\in X$. Then:

\textbf{(a)} There exists a $k\in\left\{  1,2,\ldots,n\right\}  $ such that
$f^{k}\left(  x\right)  =x$.

\textbf{(b)} Let $k\in\left\{  1,2,\ldots,n\right\}  $ be such that
$f^{k}\left(  x\right)  =x$. Then, the sequence $\left(  f^{0}\left(
x\right)  ,f^{1}\left(  x\right)  ,f^{2}\left(  x\right)  ,\ldots\right)  $ is
$k$-periodic.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.php.perm.1}.]\textbf{(a)} Theorem
\ref{thm.php.endofunc.1} \textbf{(a)} shows that there exist two integers $i$
and $j$ with $0\leq i<j\leq n$ and $f^{i}\left(  x\right)  =f^{j}\left(
x\right)  $. Consider these $i$ and $j$. Let $d=j-i$. Then, $d=j-i>0$ (since
$i<j$) and $i+d=j$ (since $d=j-i$).

It is well-known that $f^{p}\circ f^{q}=f^{p+q}$ for any $p,q\in\mathbb{N}$.
Applying this to $p=i$ and $q=d$, we obtain $f^{i}\circ f^{d}=f^{i+d}=f^{j}$
(since $i+d=j$). Hence, $f^{j}=f^{i}\circ f^{d}$, so that $f^{j}\left(
x\right)  =\left(  f^{i}\circ f^{d}\right)  \left(  x\right)  =f^{i}\left(
f^{d}\left(  x\right)  \right)  $. Therefore, $f^{i}\left(  x\right)
=f^{j}\left(  x\right)  =f^{i}\left(  f^{d}\left(  x\right)  \right)  $, so
that $f^{i}\left(  f^{d}\left(  x\right)  \right)  =f^{i}\left(  x\right)  $.

The map $f$ is a permutation, thus bijective (by the definition of a
permutation). Hence, its power $f^{i}=\underbrace{f\circ f\circ\cdots\circ
f}_{i\text{ times}}$ is bijective as well (since a composition of bijective
maps is always bijective). Thus, in particular, this map $f^{i}$ is injective.
In other words, if $u$ and $v$ are two elements of $X$ satisfying
$f^{i}\left(  u\right)  =f^{i}\left(  v\right)  $, then $u=v$. Applying this
to $u=f^{d}\left(  x\right)  $ and $v=x$, we conclude that $f^{d}\left(
x\right)  =x$ (since $f^{i}\left(  f^{d}\left(  x\right)  \right)
=f^{i}\left(  x\right)  $). Moreover, combining $d=\underbrace{j}_{\leq
n}-\underbrace{i}_{\geq0}\leq n-0=n$ with $d>0$, we obtain $d\in\left\{
1,2,\ldots,n\right\}  $. Hence, there exists a $k\in\left\{  1,2,\ldots
,n\right\}  $ such that $f^{k}\left(  x\right)  =x$ (namely, $k=d$). This
proves Theorem \ref{thm.php.perm.1} \textbf{(a)}.

\textbf{(b)} We have $0\leq0<k$ and $\underbrace{f^{0}}_{=\operatorname*{id}%
\nolimits_{X}}\left(  x\right)  =\operatorname*{id}\nolimits_{X}\left(
x\right)  =x=f^{k}\left(  x\right)  $ (since $f^{k}\left(  x\right)  =x$).
Hence, Theorem \ref{thm.php.endofunc.1} \textbf{(b)} (applied to $i=0$ and
$j=k$) yields that the sequence $\left(  f^{0}\left(  x\right)  ,f^{0+1}%
\left(  x\right)  ,f^{0+2}\left(  x\right)  ,\ldots\right)  $ is $\left(
k-0\right)  $-periodic. In other words, the sequence $\left(  f^{0}\left(
x\right)  ,f^{1}\left(  x\right)  ,f^{2}\left(  x\right)  ,\ldots\right)  $ is
$k$-periodic (since \newline$\left(  f^{0}\left(  x\right)  ,f^{0+1}\left(
x\right)  ,f^{0+2}\left(  x\right)  ,\ldots\right)  =\left(  f^{0}\left(
x\right)  ,f^{1}\left(  x\right)  ,f^{2}\left(  x\right)  ,\ldots\right)  $
and $k-0=k$). This proves Theorem \ref{thm.php.perm.1} \textbf{(b)}.
\end{proof}

For an endofunction of a \textbf{finite} set $X$ to be a permutation, it
suffices to be injective \textbf{or} surjective:

\begin{corollary}
\label{cor.php.endofunc.perm}Let $X$ be a finite set. Let $f:X\rightarrow X$
be a map. Then:

\textbf{(a)} If $f$ is injective, then $f$ is a permutation of $X$.

\textbf{(b)} If $f$ is surjective, then $f$ is a permutation of $X$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.php.endofunc.perm}.]\textbf{(a)} Assume that $f$
is injective. Hence, Theorem \ref{thm.php.php-inj-2} (applied to $U=X$ and
$V=X$) yields that $f$ is bijective (since $\left\vert X\right\vert
=\left\vert X\right\vert $). In other words, $f$ is a permutation of $X$. This
proves Corollary \ref{cor.php.endofunc.perm} \textbf{(a)}.

\textbf{(b)} Assume that $f$ is surjective. Hence, Theorem
\ref{thm.php.php-surj-2} (applied to $U=X$ and $V=X$) yields that $f$ is
bijective (since $\left\vert X\right\vert =\left\vert X\right\vert $). In
other words, $f$ is a permutation of $X$. This proves Corollary
\ref{cor.php.endofunc.perm} \textbf{(b)}.
\end{proof}

We also note that any composition of two permutations of a set $X$ is again a
permutation of $X$ (since a composition of two bijections is always a
bijection). Furthermore, the inverse of any permutation of a set $X$ is again
a permutation of $X$ (since the inverse of a bijection is always a bijection).
If you are familiar with the notion of a group, you will thus recognize the
set of all permutations of a given set $X$ to be a group (known as the
\textit{symmetric group} on $X$).

More can be said about endofunctions. Even the \textquotedblleft
rho\textquotedblright\ (or \textquotedblleft lollipop\textquotedblright) of an
element bears some surprises:

\begin{theorem}
\label{thm.php.endofunc.th}Let $X$ be a finite set. Let $n=\left\vert
X\right\vert $. Let $f:X\rightarrow X$ be a map. Let $x\in X$. Then, there
exists some $k\in\left\{  1,2,\ldots,n\right\}  $ such that $f^{k}\left(
x\right)  =f^{2k}\left(  x\right)  $.
\end{theorem}

For instance, in Example \ref{exa.php.endofunc.1}, we have $f^{3}\left(
4\right)  =f^{2\cdot3}\left(  4\right)  $.

Theorem \ref{thm.php.endofunc.th} is often known as the
\textit{tortoise-and-hare theorem}. (Imagine a tortoise and a hare starting at
the node $x$ on a diagram like the one we drew in Example
\ref{exa.php.endofunc.1}. Both animals walk along the arrows. Each second, the
tortoise makes a single step forward while the hare makes two. Theorem
\ref{thm.php.endofunc.th} then says that the tortoise and the hare will meet
again after at most $n$ seconds. This is used in
\textit{\href{https://en.wikipedia.org/wiki/Cycle_detection}{\textit{Floyd's
tortoise-and-hare algorithm for cycle detection}}}.)

See Exercise \ref{exe.php.endofunc.th-pq} for a generalization of Theorem
\ref{thm.php.endofunc.th} (allowing both the tortoise and the hare to start
with leads).

\subsubsection{Periodicity of linear recurrences modulo $m$}

Exercise \ref{exe.fib.parity} and Exercise \ref{exe.fib.mod5} show that the
Fibonacci numbers $f_{0},f_{1},f_{2},\ldots$ have a periodic behavior modulo
$2$ and modulo $5$. To wit, Exercise \ref{exe.fib.parity} shows that the
sequence $\left(  f_{0}\%2,f_{1}\%2,f_{2}\%2,\ldots\right)  $ is $3$-periodic,
whereas Exercise \ref{exe.fib.mod5} shows (fairly easily) that the sequence
$\left(  f_{0}\%5,f_{1}\%5,f_{2}\%5,\ldots\right)  $ is $20$-periodic (indeed,
each $n\in\mathbb{N}$ satisfies $f_{n\%5}\equiv f_{\left(  n+20\right)
\%5}\operatorname{mod}5$ and $3^{n//5}\equiv3^{\left(  n+20\right)
//5}\operatorname{mod}5$). These are parts of a pattern: For any positive
integer $m$, the sequence $\left(  f_{0}\%m,f_{1}\%m,f_{2}\%m,\ldots\right)  $
is $k$-periodic for some $k\in\left\{  1,2,\ldots,m^{2}\right\}  $. More
generally, we can extend this to $\left(  a,b\right)  $-recurrent sequences
whenever $b\perp m$:

\begin{exercise}
\label{exe.php.abrec-per}Let $m$ be a positive integer. Let $a$ and $b$ be
integers such that $b\perp m$. Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $
be any $\left(  a,b\right)  $-recurrent sequence of integers. Prove that the
sequence $\left(  x_{0}\%m,x_{1}\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic
for some $k\in\left\{  1,2,\ldots,m^{2}\right\}  $.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.php.abrec-per} (sketched).]The matrix approach
from Proposition \ref{prop.rec.matrix-1} \textbf{(a)} will be useful here
again -- even though we don't really need matrices but can simply work with
pairs of numbers. Recall that the idea behind this approach was that, even
though an entry $x_{n}$ of our sequence cannot be directly obtained from the
previous entry $x_{n-1}$, each pair $\left(  x_{n},x_{n+1}\right)  $ of two
consecutive entries can be obtained easily from the preceding such pair
$\left(  x_{n-1},x_{n}\right)  $. It turns out that the same holds for the
remainders $x_{0}\%m,x_{1}\%m,x_{2}\%m,\ldots$: Namely, each pair $\left(
x_{n}\%m,x_{n+1}\%m\right)  $ can be obtained from the preceding such pair
$\left(  x_{n-1}\%m,x_{n}\%m\right)  $ (we shall soon see how).

First, let us introduce some notations.

Let $M$ be the $m$-element set $\left\{  0,1,\ldots,m-1\right\}  $. Thus,
$\left\vert M\times M\right\vert =\left\vert M\right\vert \cdot\left\vert
M\right\vert =\left\vert M\right\vert ^{2}=m^{2}$ (since $\left\vert
M\right\vert =m$).

For each integer $z$, let $\overrightarrow{z}$ denote the remainder $z\%m$.
Thus, every integer $z$ satisfies $\overrightarrow{z}=z\%m\in\left\{
0,1,\ldots,m-1\right\}  =M$ and%
\begin{equation}
\overrightarrow{z}=z\%m\equiv z\operatorname{mod}m
\label{sol.php.abrec-per.ztil=zmodm}%
\end{equation}
(by Proposition \ref{prop.ent.quorem.props} \textbf{(a)}, applied to $u=z$ and
$n=m$).

Define a map $f:M\times M\rightarrow M\times M$ by%
\[
f\left(  \left(  p,q\right)  \right)  =\left(  q,\overrightarrow{aq+bp}%
\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }\left(  p,q\right)  \in M\times
M.
\]
This is well-defined, since each $\left(  p,q\right)  \in M\times M$ satisfies
$\left(  q,\overrightarrow{aq+bp}\right)  \in M\times M$ (because $q\in M$ and
$\overrightarrow{aq+bp}=\left(  aq+bp\right)  \%m\in\left\{  0,1,\ldots
,m-1\right\}  =M$).

Let $\omega$ be the pair $\left(  \overrightarrow{x_{0}},\overrightarrow{x_{1}%
}\right)  \in M\times M$.

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} The map $f$ is bijective (thus a permutation of the set
$M\times M$).
\end{statement}

\begin{statement}
\textit{Claim 2:} We have $f\left(  \left(  \overrightarrow{x_{i}%
},\overrightarrow{x_{i+1}}\right)  \right)  =\left(  \overrightarrow{x_{i+1}%
},\overrightarrow{x_{i+2}}\right)  $ for each $i\in\mathbb{N}$.
\end{statement}

\begin{statement}
\textit{Claim 3:} We have $\left(  \overrightarrow{x_{i}}%
,\overrightarrow{x_{i+1}}\right)  =f^{i}\left(  \omega\right)  $ for each
$i\in\mathbb{N}$.
\end{statement}

Proving these three claims will be an exercise (Exercise
\ref{exe.php.abrec-per.c1-3} below). Assume that they are proved for now. Now,
we can apply Theorem \ref{thm.php.perm.1} \textbf{(a)} to $X=M\times M$,
$n=m^{2}$ and $x=\omega$. This yields that there exists a $k\in\left\{
1,2,\ldots,m^{2}\right\}  $ such that $f^{k}\left(  \omega\right)  =\omega$.
Consider this $k$. Applying Theorem \ref{thm.php.perm.1} \textbf{(b)} to
$X=M\times M$, $n=m^{2}$ and $x=\omega$, we conclude that the sequence
$\left(  f^{0}\left(  \omega\right)  ,f^{1}\left(  \omega\right)
,f^{2}\left(  \omega\right)  ,\ldots\right)  $ is $k$-periodic. In other
words, $k$ is a period of this sequence. In other words, every $i\in
\mathbb{N}$ satisfies%
\begin{equation}
f^{i}\left(  \omega\right)  =f^{i+k}\left(  \omega\right)
\label{sol.php.abrec-per.3}%
\end{equation}
(by the definition of a period).

Now, let $i\in\mathbb{N}$. Then, Claim 3 yields $\left(  \overrightarrow{x_{i}%
},\overrightarrow{x_{i+1}}\right)  =f^{i}\left(  \omega\right)  $. Also, Claim
3 (applied to $i+k$ instead of $i$) yields $\left(  \overrightarrow{x_{i+k}%
},\overrightarrow{x_{i+k+1}}\right)  =f^{i+k}\left(  \omega\right)  $. Hence,
\begin{align*}
\left(  \overrightarrow{x_{i}},\overrightarrow{x_{i+1}}\right)   &
=f^{i}\left(  \omega\right)  =f^{i+k}\left(  \omega\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.php.abrec-per.3})}\right) \\
&  =\left(  \overrightarrow{x_{i+k}},\overrightarrow{x_{i+k+1}}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  \overrightarrow{x_{i+k}%
},\overrightarrow{x_{i+k+1}}\right)  =f^{i+k}\left(  \omega\right)  \right)  .
\end{align*}
In other words, $\overrightarrow{x_{i}}=\overrightarrow{x_{i+k}}$ and
$\overrightarrow{x_{i+1}}=\overrightarrow{x_{i+k+1}}$. Thus, in particular,
$\overrightarrow{x_{i}}=\overrightarrow{x_{i+k}}$.

Forget that we fixed $i$. We thus have shown that every $i\in\mathbb{N}$
satisfies $\overrightarrow{x_{i}}=\overrightarrow{x_{i+k}}$. In other words,
$k$ is a period of the sequence $\left(  \overrightarrow{x_{0}}%
,\overrightarrow{x_{1}},\overrightarrow{x_{2}},\ldots\right)  $ (since $k$ is
a positive integer). In other words, the sequence $\left(
\overrightarrow{x_{0}},\overrightarrow{x_{1}} ,\overrightarrow{x_{2}}%
,\ldots\right)  $ is $k$-periodic. In other words, the sequence $\left(
x_{0}\%m,x_{1}\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic (since
$\overrightarrow{x_{i}}=x_{i}\%m$ for each $i\in\mathbb{N}$). Thus, we have
found a $k\in\left\{  1,2,\ldots,m^{2}\right\}  $ such that the sequence
$\left(  x_{0}\%m,x_{1}\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic. This
solves Exercise \ref{exe.php.abrec-per}.
\end{proof}

The condition $b\perp m$ in Exercise \ref{exe.php.abrec-per} is important. For
example, if $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is the $\left(
1,2\right)  $-recurrent sequence with starting values $x_{0}=0$ and $x_{1}=1$,
then the sequence $\left(  x_{0}\%2,x_{1}\%2,x_{2}\%2,\ldots\right)  =\left(
0,1,1,1,\ldots\right)  $ is not periodic at all. This does not mean that the
claim of Exercise \ref{exe.php.abrec-per} will never hold when $b$ is not
coprime to $m$, but the precise conditions under which it can be ensured are
nontrivial to ascertain.

\subsubsection{The eventual image of an endofunction}

We recall that if $X$ and $Y$ are two sets, and if $f:X\rightarrow Y$ is a
map, and if $U$ is a subset of $X$, then the set $f\left(  U\right)  $ is
defined by%
\begin{equation}
f\left(  U\right)  =\left\{  f\left(  u\right)  \ \mid\ u\in U\right\}  .
\label{eq.maps.image}%
\end{equation}
This set $f\left(  U\right)  $ is a subset of $Y$, and is called the
\textit{image} of $U$ under $f$. In particular, $f\left(  X\right)  $ is
called the \textit{image} of $f$.

When $f$ is an endofunction of a set $X$, we can now consider the images
$f^{i}\left(  X\right)  $ for all $i\in\mathbb{N}$.

\begin{example}
Let $X=\left\{  0,1,\ldots,11\right\}  $. Define a map $f:X\rightarrow X$ by
setting%
\[
f\left(  i\right)  =\left(  i^{3}+2i+1\right)
\%12\ \ \ \ \ \ \ \ \ \ \text{for each }i\in X.
\]
The following diagram shows all elements of $X$ (as nodes) and how the map $f$
acts on them (by drawing an arrow from each node $i\in X$ to the node
$f\left(  i\right)  $):%
\[%
%TCIMACRO{\TeXButton{tikz cycle digraph}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
%]
%\node[main node] (11) {11};
%\node[main node] (8) [above of=11] {8};
%\node[main node] (1) [right of=8] {1};
%\node[main node] (2) [right of=1] {2};
%\node[main node] (0) [right of=2] {0};
%\node[main node] (3) [below of=0] {3};
%\node[main node] (5) [below of=2] {5};
%\node[main node] (6) [below of=5] {6};
%\node[main node] (9) [below left of=6] {9};
%\node[main node] (4) [above left of=9] {4};
%\node[main node] (10) [left of=9] {10};
%\node[main node] (7) [left of=4] {7};
%\path[-{Stealth[length=4mm]}]
%(0) edge (2)
%(1) edge (4)
%(2) edge (1)
%(3) edge (0)
%(4) edge (9)
%(5) edge (2)
%(6) edge (5)
%(7) edge (4)
%(8) edge (1)
%(9) edge (6)
%(10) edge (9)
%(11) edge (8);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
]
\node[main node] (11) {11};
\node[main node] (8) [above of=11] {8};
\node[main node] (1) [right of=8] {1};
\node[main node] (2) [right of=1] {2};
\node[main node] (0) [right of=2] {0};
\node[main node] (3) [below of=0] {3};
\node[main node] (5) [below of=2] {5};
\node[main node] (6) [below of=5] {6};
\node[main node] (9) [below left of=6] {9};
\node[main node] (4) [above left of=9] {4};
\node[main node] (10) [left of=9] {10};
\node[main node] (7) [left of=4] {7};
\path[-{Stealth[length=4mm]}]
(0) edge (2)
(1) edge (4)
(2) edge (1)
(3) edge (0)
(4) edge (9)
(5) edge (2)
(6) edge (5)
(7) edge (4)
(8) edge (1)
(9) edge (6)
(10) edge (9)
(11) edge (8);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
We have%
\begin{align*}
f^{0}\left(  X\right)   &  =X=\left\{  0,1,2,3,4,5,6,7,8,9,10,11\right\}  ,\\
f^{1}\left(  X\right)   &  =f\left(  X\right)  =\left\{
0,1,2,4,5,6,8,9\right\}  ,\\
f^{2}\left(  X\right)   &  =\left\{  1,2,4,5,6,9\right\}
,\ \ \ \ \ \ \ \ \ \ \text{and}\\
f^{i}\left(  X\right)   &  =\left\{  1,2,4,5,6,9\right\}  =f^{2}\left(
X\right)  \text{ for all }i\geq2.
\end{align*}

\end{example}

The pattern we might be seeing here is that the sets $f^{i}\left(  X\right)  $
get smaller and smaller as $i$ gets larger, until they eventually stop
changing at all. This and more is claimed in the following proposition:

\begin{proposition}
\label{prop.php.endofunc.evtl-img}Let $X$ be a finite set. Let $n=\left\vert
X\right\vert $. Let $f:X\rightarrow X$ be a map. Then:

\textbf{(a)} We have $f^{0}\left(  X\right)  \supseteq f^{1}\left(  X\right)
\supseteq f^{2}\left(  X\right)  \supseteq\cdots$.

\textbf{(b)} If some $i\in\mathbb{N}$ satisfies $f^{i}\left(  X\right)
=f^{i+1}\left(  X\right)  $, then $f^{i}\left(  X\right)  =f^{k}\left(
X\right)  $ for each integer $k\geq i$.

\textbf{(c)} We have $f^{n}\left(  X\right)  =f^{k}\left(  X\right)  $ for
each integer $k\geq n$.

\textbf{(d)} The map $f^{n}\left(  X\right)  \rightarrow f^{n}\left(
X\right)  ,\ x\mapsto f\left(  x\right)  $ is well-defined and is a
permutation of $f^{n}\left(  X\right)  $.
\end{proposition}

\begin{noncompile}
Parts \textbf{(a)}, \textbf{(c)} and \textbf{(d)} of Proposition
\ref{prop.php.endofunc.evtl-img} are [17f-hw5os, Exercise 6].
\end{noncompile}

The set $f^{n}\left(  X\right)  $ in Proposition
\ref{prop.php.endofunc.evtl-img} is called the \textit{eventual image} of the
map $f$ (since each element of $X$ eventually ends up in $f^{n}\left(
X\right)  $ if we apply $f$ to it often enough).

\begin{proof}
[Proof of Proposition \ref{prop.php.endofunc.evtl-img}.]\textbf{(a)} We need
to show that $f^{i}\left(  X\right)  \supseteq f^{i+1}\left(  X\right)  $ for
each $i\in\mathbb{N}$.

Indeed, let $i\in\mathbb{N}$. Fix some $p\in f^{i+1}\left(  X\right)  $. Thus,
$p=f^{i+1}\left(  x\right)  $ for some $x\in X$. Consider this $x$. Now,
$p=f^{i+1}\left(  x\right)  =f^{i}\left(  \underbrace{f\left(  x\right)
}_{\in X}\right)  \in f^{i}\left(  X\right)  $.

Forget that we fixed $p$. We thus have shown that $p\in f^{i}\left(  X\right)
$ for each $p\in f^{i+1}\left(  X\right)  $. In other words, $f^{i+1}\left(
X\right)  \subseteq f^{i}\left(  X\right)  $. In other words, $f^{i}\left(
X\right)  \supseteq f^{i+1}\left(  X\right)  $.

Now, forget that we fixed $i$. We thus have shown that $f^{i}\left(  X\right)
\supseteq f^{i+1}\left(  X\right)  $ for each $i\in\mathbb{N}$. In other
words, $f^{0}\left(  X\right)  \supseteq f^{1}\left(  X\right)  \supseteq
f^{2}\left(  X\right)  \supseteq\cdots$. This proves Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(a)}.

\textbf{(b)} Let $i\in\mathbb{N}$ satisfy $f^{i}\left(  X\right)
=f^{i+1}\left(  X\right)  $. We must show that%
\begin{equation}
f^{i}\left(  X\right)  =f^{k}\left(  X\right)  \ \ \ \ \ \ \ \ \ \ \text{for
each integer }k\geq i. \label{pf.prop.php.endofunc.evtl-img.b.goal}%
\end{equation}


[\textit{Proof of (\ref{pf.prop.php.endofunc.evtl-img.b.goal}):} We shall
prove (\ref{pf.prop.php.endofunc.evtl-img.b.goal}) by induction on $k$:

\textit{Induction base:} We have $f^{i}\left(  X\right)  =f^{i}\left(
X\right)  $. In other words, (\ref{pf.prop.php.endofunc.evtl-img.b.goal})
holds for $k=i$.

\textit{Induction step:} Let $m\geq i$ be an integer. Assume (as the induction
hypothesis) that (\ref{pf.prop.php.endofunc.evtl-img.b.goal}) holds for $k=m$.
We must show that (\ref{pf.prop.php.endofunc.evtl-img.b.goal}) holds for
$k=m+1$. In other words, we must show that $f^{i}\left(  X\right)
=f^{m+1}\left(  X\right)  $.

We have assumed that (\ref{pf.prop.php.endofunc.evtl-img.b.goal}) holds for
$k=m$. In other words, we have $f^{i}\left(  X\right)  =f^{m}\left(  X\right)
$.

Proposition \ref{prop.php.endofunc.evtl-img} \textbf{(a)} yields $f^{0}\left(
X\right)  \supseteq f^{1}\left(  X\right)  \supseteq f^{2}\left(  X\right)
\supseteq\cdots$. Thus, $f^{m}\left(  X\right)  \supseteq f^{m+1}\left(
X\right)  $. We shall now show that $f^{m}\left(  X\right)  \subseteq
f^{m+1}\left(  X\right)  $.

Set $j=m-i$. Then, $j=m-i\in\mathbb{N}$ (since $m\geq i$) and $m=j+i$ (since
$j=m-i$). Now, let $p\in f^{m}\left(  X\right)  $. Then, $p=f^{m}\left(
x\right)  $ for some $x\in X$. Consider this $x$. From $m=j+i$, we obtain
$f^{m}=f^{j+i}=f^{j}\circ f^{i}$. Thus, $p=\underbrace{f^{m}}_{=f^{j}\circ
f^{i}}\left(  x\right)  =\left(  f^{j}\circ f^{i}\right)  \left(  x\right)
=f^{j}\left(  f^{i}\left(  x\right)  \right)  $. But $f^{i}\left(  x\right)
\in f^{i}\left(  X\right)  =f^{i+1}\left(  X\right)  $; in other words, there
exists some $y\in X$ such that $f^{i}\left(  x\right)  =f^{i+1}\left(
y\right)  $. Consider this $y$. Now,%
\[
p=f^{j}\left(  \underbrace{f^{i}\left(  x\right)  }_{=f^{i+1}\left(  y\right)
}\right)  =f^{j}\left(  f^{i+1}\left(  y\right)  \right)  =\underbrace{\left(
f^{j}\circ f^{i+1}\right)  }_{=f^{j+\left(  i+1\right)  }}\left(  y\right)
=f^{j+\left(  i+1\right)  }\left(  y\right)  =f^{m+1}\left(  y\right)
\]
(since $j+\left(  i+1\right)  =\underbrace{j+i}_{=m}+1=m+1$). Thus,
$p=f^{m+1}\left(  y\right)  \in f^{m+1}\left(  X\right)  $ (since $y\in X$).

Forget that we fixed $p$. We thus have shown that $p\in f^{m+1}\left(
X\right)  $ for each $p\in f^{m}\left(  X\right)  $. In other words,
$f^{m}\left(  X\right)  \subseteq f^{m+1}\left(  X\right)  $. Combining this
with $f^{m}\left(  X\right)  \supseteq f^{m+1}\left(  X\right)  $, we obtain
$f^{m}\left(  X\right)  =f^{m+1}\left(  X\right)  $. Thus, $f^{i}\left(
X\right)  =f^{m}\left(  X\right)  =f^{m+1}\left(  X\right)  $. This completes
the induction step. Thus, (\ref{pf.prop.php.endofunc.evtl-img.b.goal}) is
proved by induction.]

Having proved (\ref{pf.prop.php.endofunc.evtl-img.b.goal}), we have proved
Proposition \ref{prop.php.endofunc.evtl-img} \textbf{(b)}.

\textbf{(c)} Note that $f^{0}=\operatorname*{id}\nolimits_{X}$, so that
$f^{0}\left(  X\right)  =\operatorname*{id}\nolimits_{X}\left(  X\right)  =X$.
Hence, $\left\vert f^{0}\left(  X\right)  \right\vert =\left\vert X\right\vert
=n$.

We shall first show that there exists some $i\in\left\{  0,1,\ldots,n\right\}
$ such that $f^{i}\left(  X\right)  =f^{i+1}\left(  X\right)  $.

Indeed, assume the contrary. Thus, each $i\in\left\{  0,1,\ldots,n\right\}  $
satisfies%
\begin{equation}
f^{i}\left(  X\right)  \neq f^{i+1}\left(  X\right)  .
\label{pf.prop.php.endofunc.evtl-img.c.ac}%
\end{equation}


Now, let $i\in\left\{  0,1,\ldots,n\right\}  $. Then, Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(a)} yields $f^{0}\left(  X\right)
\supseteq f^{1}\left(  X\right)  \supseteq f^{2}\left(  X\right)
\supseteq\cdots$. Thus, $f^{i}\left(  X\right)  \supseteq f^{i+1}\left(
X\right)  $. In other words, $f^{i+1}\left(  X\right)  $ is a subset of
$f^{i}\left(  X\right)  $. Moreover, this subset is \textbf{proper}, because
(\ref{pf.prop.php.endofunc.evtl-img.c.ac}) shows that $f^{i}\left(  X\right)
\neq f^{i+1}\left(  X\right)  $.

It is a well-known fact that if $U$ is a proper subset of a finite set $V$,
then $\left\vert U\right\vert <\left\vert V\right\vert $. Applying this to
$U=f^{i+1}\left(  X\right)  $ and $V=f^{i}\left(  X\right)  $, we obtain
$\left\vert f^{i+1}\left(  X\right)  \right\vert <\left\vert f^{i}\left(
X\right)  \right\vert $ (since $f^{i+1}\left(  X\right)  $ is a proper subset
of the finite set $f^{i}\left(  X\right)  $). This entails $\left\vert
f^{i+1}\left(  X\right)  \right\vert \leq\left\vert f^{i}\left(  X\right)
\right\vert -1$ (since $\left\vert f^{i+1}\left(  X\right)  \right\vert $ and
$\left\vert f^{i}\left(  X\right)  \right\vert $ are integers). In other
words, $\left\vert f^{i+1}\left(  X\right)  \right\vert -\left\vert
f^{i}\left(  X\right)  \right\vert \leq-1$.

Now, forget that we fixed $i$. We thus have proved the inequality $\left\vert
f^{i+1}\left(  X\right)  \right\vert -\left\vert f^{i}\left(  X\right)
\right\vert \leq-1$ for each $i\in\left\{  0,1,\ldots,n\right\}  $. Summing
these inequalities over all $i\in\left\{  0,1,\ldots,n\right\}  $, we obtain%
\[
\sum_{i=0}^{n}\left(  \left\vert f^{i+1}\left(  X\right)  \right\vert
-\left\vert f^{i}\left(  X\right)  \right\vert \right)  \leq\sum_{i=0}%
^{n}\left(  -1\right)  =\left(  n+1\right)  \cdot\left(  -1\right)  =-\left(
n+1\right)  <-n.
\]
But this contradicts%
\begin{align*}
\sum_{i=0}^{n}\left(  \left\vert f^{i+1}\left(  X\right)  \right\vert
-\left\vert f^{i}\left(  X\right)  \right\vert \right)   &
=\underbrace{\left\vert f^{n+1}\left(  X\right)  \right\vert }_{\geq
0}-\underbrace{\left\vert f^{0}\left(  X\right)  \right\vert }_{=n}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Corollary \ref{cor.seqsum.telesc-pos},}\\
\text{applied to }u=0\text{ and }v=n\text{ and }a_{i}=\left\vert f^{i}\left(
X\right)  \right\vert
\end{array}
\right) \\
&  \geq0-n=-n.
\end{align*}
This contradiction shows that our assumption was false.

Hence, we have shown that there exists some $i\in\left\{  0,1,\ldots
,n\right\}  $ such that $f^{i}\left(  X\right)  =f^{i+1}\left(  X\right)  $.
Consider this $i$.

Now, $i\leq n$ (since $i\in\left\{  0,1,\ldots,n\right\}  $), so that $n\geq
i$. Thus, Proposition \ref{prop.php.endofunc.evtl-img} \textbf{(b)} (applied
to $k=n$) yields $f^{i}\left(  X\right)  =f^{n}\left(  X\right)  $.

Now, let $k\geq n$ be an integer. Then, $k\geq n\geq i$. Hence, Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(b)} yields $f^{i}\left(  X\right)
=f^{k}\left(  X\right)  $. Hence, $f^{k}\left(  X\right)  =f^{i}\left(
X\right)  =f^{n}\left(  X\right)  $. In other words, $f^{n}\left(  X\right)
=f^{k}\left(  X\right)  $. This proves Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(c)}.

\textbf{(d)} Let $x\in f^{n}\left(  X\right)  $. Thus, $x=f^{n}\left(
y\right)  $ for some $y\in X$. Consider this $y$. From $x=f^{n}\left(
y\right)  $, we obtain%
\[
f\left(  x\right)  =f\left(  f^{n}\left(  y\right)  \right)
=\underbrace{\left(  f\circ f^{n}\right)  }_{=f^{n+1}=f^{n}\circ f}\left(
y\right)  =\left(  f^{n}\circ f\right)  \left(  y\right)  =f^{n}\left(
\underbrace{f\left(  y\right)  }_{\in X}\right)  \in f^{n}\left(  X\right)  .
\]


Forget that we fixed $x$. We thus have proved that $f\left(  x\right)  \in
f^{n}\left(  X\right)  $ for each $x\in f^{n}\left(  X\right)  $. Hence, the
map $f^{n}\left(  X\right)  \rightarrow f^{n}\left(  X\right)  ,\ x\mapsto
f\left(  x\right)  $ is well-defined. It remains to prove that this map is a
permutation of $f^{n}\left(  X\right)  $.

Let us denote this map by $g$. We must thus show that $g$ is a permutation of
$f^{n}\left(  X\right)  $.

Indeed, we shall show that this map $g$ is surjective. To wit, let $z\in
f^{n}\left(  X\right)  $. Proposition \ref{prop.php.endofunc.evtl-img}
\textbf{(c)} (applied to $k=n+1$) yields $f^{n}\left(  X\right)
=f^{n+1}\left(  X\right)  $ (since $n+1\geq n$). Hence, $z\in f^{n}\left(
X\right)  =f^{n+1}\left(  X\right)  $. In other words, there exists a $w\in X$
such that $z=f^{n+1}\left(  w\right)  $. Consider this $w$. Now,%
\begin{equation}
z=\underbrace{f^{n+1}}_{=f\circ f^{n}}\left(  w\right)  =\left(  f\circ
f^{n}\right)  \left(  w\right)  =f\left(  f^{n}\left(  w\right)  \right)  .
\label{pf.prop.php.endofunc.evtl-img.d.3}%
\end{equation}
But $f^{n}\left(  w\right)  \in f^{n}\left(  X\right)  $ (since $w\in X$).
Hence, $g\left(  f^{n}\left(  w\right)  \right)  $ is well-defined (since $g$
is a map defined on $f^{n}\left(  X\right)  $). The definition of $g$ yields
$g\left(  f^{n}\left(  w\right)  \right)  =f\left(  f^{n}\left(  w\right)
\right)  $. Comparing this with (\ref{pf.prop.php.endofunc.evtl-img.d.3}), we
obtain $z=g\left(  f^{n}\left(  w\right)  \right)  $. Therefore, $z$ lies in
the image of $g$.

Forget that we fixed $z$. We thus have shown that each $z\in f^{n}\left(
X\right)  $ lies in the image of $g$. Hence, the image of $g$ is the entire
set $f^{n}\left(  X\right)  $. In other words, the map $g$ is surjective.

Now, the set $f^{n}\left(  X\right)  $ is finite; the map $g:f^{n}\left(
X\right)  \rightarrow f^{n}\left(  X\right)  $ is surjective. Hence, Corollary
\ref{cor.php.endofunc.perm} \textbf{(b)} (applied to $f^{n}\left(  X\right)  $
and $g$ instead of $X$ and $f$) shows that $g$ is a permutation of
$f^{n}\left(  X\right)  $. This completes our proof of Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(d)}.
\end{proof}

\subsection{\label{sect.hw6}Homework set \#6: Extremal and pigeonhole
principles}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the above parts of Chapter \ref{chp.seqsum} and
Chapter \ref{chp.ext}. Some of the problems may be unrelated.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

\begin{exercise}
\label{exe.ext.tour-win}Let $n$ be a positive integer. Consider a round-robin
tournament in which $n$ players participate. (\textquotedblleft
Round-robin\textquotedblright\ means that each pair of distinct players play
exactly one match against one another.) No match ends with a draw.

A player $a$ is said to have \textit{directly owned} a player $b$ if $a$ has
won the match against $b$.

A player $a$ is said to have \textit{indirectly owned} a player $b$ if there
exists a player $c$ such that $a$ has won a match against $c$ and $c$ has won
a match against $b$.

Prove that there exists a player who has (directly or indirectly) owned all
other players.

[\textbf{Example:} Consider a tournament between $5$ players $A,B,C,D,E$
encoded by the following diagram:%
\[%
%TCIMACRO{\TeXButton{tikz cycle digraph}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
%]
%\node[main node] (A) {$A$};
%\node[main node] (E) [below left of=A] {$E$};
%\node[main node] (D) [below right of=E] {$D$};
%\node[main node] (C) [right of=D] {$C$};
%\node[main node] (B) [above of=C] {$B$};
%\path[-{Stealth[length=4mm]}]
%(A) edge (B) edge (C)
%(B) edge (C) edge (E) edge (D)
%(C) edge (D)
%(D) edge (A) edge (E)
%(E) edge (A) edge (C);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto,node distance=3cm, thick,main node/.style={circle,fill=blue!20,draw}%
]
\node[main node] (A) {$A$};
\node[main node] (E) [below left of=A] {$E$};
\node[main node] (D) [below right of=E] {$D$};
\node[main node] (C) [right of=D] {$C$};
\node[main node] (B) [above of=C] {$B$};
\path[-{Stealth[length=4mm]}]
(A) edge (B) edge (C)
(B) edge (C) edge (E) edge (D)
(C) edge (D)
(D) edge (A) edge (E)
(E) edge (A) edge (C);
\end{tikzpicture}%
%EndExpansion
\]
(where an arrow from player $p$ to player $q$ means that $p$ has won the match
against $q$). Then, player $A$ has directly owned players $B$ and $C$ and
indirectly owned players $D$ (via $C$) and $E$ (via $B$). Actually, every
player other than $C$ has directly or indirectly owned all other players.]
\end{exercise}

The following exercise is a slight generalization of Exercise
\ref{exe.infdesc.put1973B1.1}:

\begin{exercise}
\label{exe.infdesc.put1973B1.4}Let $n\in\mathbb{N}$. Assume that $a_{1}%
,a_{2},\ldots,a_{2n+1}$ are $2n+1$ integers with the following property:

\begin{statement}
\textit{Weaker splitting property:} If any of the first $2n$ numbers
$a_{1},a_{2},\ldots,a_{2n}$ is removed (from our $2n+1$ numbers $a_{1}%
,a_{2},\ldots,a_{2n+1}$), then the remaining $2n$ numbers (including
$a_{2n+1}$) can be split into two equinumerous heaps with equal sum.
(\textquotedblleft Equinumerous\textquotedblright\ means that each heap
contains exactly $n$ numbers.)
\end{statement}

Prove that all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
\end{exercise}

The following exercise generalizes Theorem \ref{thm.php.endofunc.th}:

\begin{exercise}
\label{exe.php.endofunc.th-pq}Let $X$ be a finite set. Let $n=\left\vert
X\right\vert $. Let $f:X\rightarrow X$ be a map. Let $x\in X$. Let
$p,q\in\mathbb{N}$. Prove that there exists some $k\in\left\{  1,2,\ldots
,n\right\}  $ such that $f^{k+p}\left(  x\right)  =f^{2k+q}\left(  x\right)  $.
\end{exercise}

(Theorem \ref{thm.php.endofunc.th} is the particular case of Exercise
\ref{exe.php.endofunc.th-pq} for $p=0$ and $q=0$.)

\begin{exercise}
\label{exe.php.endofunc.evtl-img2}Let $X$ be a finite nonempty set. Let
$n=\left\vert X\right\vert $. Let $f:X\rightarrow X$ be a map. Prove that
$f^{n}\left(  X\right)  =f^{n-1}\left(  X\right)  $.
\end{exercise}

\begin{exercise}
\label{exe.php.endofunc.order-nfac}Let $X$ be a set. Let $f:X\rightarrow X$ be
a map. Prove the following:

\textbf{(a)} If some $x\in X$ and $k\in\mathbb{N}$ satisfy $f^{k}\left(
x\right)  =f^{2k}\left(  x\right)  $, then $f^{ik}\left(  x\right)
=f^{k}\left(  x\right)  $ for every positive integer $i$.

Now, assume that $X$ is finite, and let $n=\left\vert X\right\vert $. Then:

\textbf{(b)} We have $f^{n!}=f^{2n!}$.

\textbf{(c)} If $f$ is a permutation of $X$, then $f^{n!}=\operatorname*{id}%
\nolimits_{X}$.
\end{exercise}

\begin{noncompile}
\textbf{(d)} If some $x\in X$ and $k\in\mathbb{N}$ satisfy $f^{k}\left(
x\right)  =x$, then $f^{ik}\left(  x\right)  =x$ for every $i\in\mathbb{N}$.
\end{noncompile}

\begin{exercise}
\label{exe.php.abrec-per.c1-3}Complete the above solution to Exercise
\ref{exe.php.abrec-per} by proving Claims 1, 2 and 3.
\end{exercise}

\begin{exercise}
\label{exe.php.abrec-per2}Improve Exercise \ref{exe.php.abrec-per} as follows:

Let $m>1$ be an integer. Let $a$ and $b$ be integers such that $b\perp m$. Let
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be any $\left(  a,b\right)
$-recurrent sequence. Prove that the sequence $\left(  x_{0}\%m,x_{1}%
\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic for some $k\in\left\{
1,2,\ldots,m^{2}-1\right\}  $.
\end{exercise}

\begin{exercise}
\label{exe.nt.bw2004-9}Let $n\geq3$ be an integer. Let $a_{1},a_{2}%
,\ldots,a_{n-1}$ be any $n-1$ integers. Assume that $n\nmid a_{1}-a_{2}$.
Prove that there exists a nonempty subset $I$ of $\left\{  1,2,\ldots
,n-1\right\}  $ such that%
\[
n\mid\sum_{i\in I}a_{i}.
\]

\end{exercise}

The following exercise uses a (very) slight bit of analysis:

\begin{exercise}
\label{exe.php.jacobi}For every $x\in\mathbb{R}$, we define the
\textit{fractional part} $\operatorname*{frac}x$ of $x$ to be the number
$x-\left\lfloor x\right\rfloor $. Note that $0\leq\operatorname*{frac}x<1$ for
each $x\in\mathbb{R}$. Prove the following:

\textbf{(a)} For each $x\in\mathbb{R}$ and each positive integer $n$, there
exists a positive integer $m$ such that $\operatorname*{frac}\left(
mx\right)  $ is either $<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$. (The words
\textquotedblleft either/or\textquotedblright\ are meant non-exclusively here;
i.e., it is allowed for $\operatorname*{frac}\left(  mx\right)  $ to be both
$<\dfrac{1}{n}$ and $>\dfrac{n-1}{n}$ at the same time. Of course, this will
only happen for $n=1$.)

\textbf{(b)} For each $x\in\mathbb{R}$ and each positive integer $n$, there
exists a positive integer $m$ such that $\operatorname*{frac}\left(
mx\right)  <\dfrac{1}{n}$.

\textbf{(c)} For each $x\in\mathbb{R}$ and each positive real $\varepsilon$,
there exists a positive integer $m$ such that $\operatorname*{frac}\left(
mx\right)  <\varepsilon$.

\textbf{(d)} For any positive real $\varepsilon$ and any real $z$, there
exists a positive integer $m$ such that $0\leq\sin\left(  mz\right)
<\varepsilon$.

[\textbf{Hint:} For part \textbf{(a)}, subdivide the half-open interval
$\left[  0,1\right)  $ into $n$ intervals
\[
\left[  \dfrac{0}{n},\dfrac{1}{n}\right)  ,\ \ \left[  \dfrac{1}{n},\dfrac
{2}{n}\right)  ,\ \ \ldots,\ \ \left[  \dfrac{n-1}{n},\dfrac{n}{n}\right)  ,
\]
and argue that two of the numbers $\operatorname*{frac}\left(  0x\right)
,\operatorname*{frac}\left(  1x\right)  ,\ldots,\operatorname*{frac}\left(
nx\right)  $ must lie in one of these $n$ intervals. If these are
$\operatorname*{frac}\left(  ix\right)  $ and $\operatorname*{frac}\left(
jx\right)  $ (with $i<j$), then what can you say about $\operatorname*{frac}%
\left(  jx-ix\right)  $ ?

For part \textbf{(b)}, use part \textbf{(a)} as a stepping stone. If $p$ is a
positive integer satisfying $\operatorname*{frac}\left(  px\right)
>\dfrac{n-1}{n}$, then find a $q>p$ such that $\operatorname*{frac}\left(
qx\right)  $ is either $<\dfrac{1}{n}$ or $>\operatorname*{frac}\left(
px\right)  $ (again using part \textbf{(a)}).]
\end{exercise}

\begin{noncompile}
(continued:) Now, assume that $x\in\mathbb{R}$ is irrational. Let
$y\in\mathbb{R}$. Prove the following:

\textbf{(e)} For any nonempty open interval $B\subseteq\left[  0,1\right)  $,
there exists a positive integer $m$ such that $\operatorname*{frac}\left(
mx+y\right)  \in B$.

\textbf{(f)} For each positive integer $n$, there exists a positive integer
$m$ such that $\operatorname*{frac}\left(  mx+y\right)  <\dfrac{1}{n}$.
\end{noncompile}

\begin{exercise}
\label{exe.php.k-ints}Let $R=\left\{  \dfrac{1}{1},\dfrac{1}{2},\dfrac{1}%
{3},\ldots\right\}  $. Find the smallest positive real $\varepsilon$ such that
the entire set $R$ can be covered with $5$ \textbf{closed} intervals of length
$\varepsilon$ each.
\end{exercise}

\newpage

\section{\label{chp.enum}Mostly Enumerative Combinatorics}

We now come to the topic of \textit{enumerative combinatorics} -- the art of
finding the cardinalities of finite sets (and some related quantities, like
sums over finite sets), also known as \textquotedblleft
counting\textquotedblright. We have seen some examples of this already --
e.g., in Theorem \ref{thm.binom.comb}, which states that the number of
$k$-element subsets of a fixed $n$-element set is $\dbinom{n}{k}$. We will now
see some more, even though we will merely scratch the surface.

For readers wishing to dive deeper, there is a lot to read. Several books have
been written about enumerative combinatorics, such as Stanley's
quasi-encyclopedic two-volume treatise \cite{Stanley-EC1} and
\cite{Stanley-EC2} (with hundreds of problems). Some introductions to this
subject are \cite{Aigner07}, \cite{AndFen04}, \cite{Bogart17}, \cite{Bona17},
\cite{Wagner05}, \cite{Wagner08}, \cite{Galvin17}, \cite{Harju11},
\cite{Mazur10} and (my favorite, due to its readability and comprehensiveness)
\cite{Loehr-BC}. A bigger list of texts can be found at
\url{https://math.stackexchange.com/questions/1454339} . Engel's book also has
a chapter on enumerative combinatorics \cite[Chapter 5]{Engel}. Finally,
\cite{19fco} (work in progress) aims to be a (probably over-)rigorous
introduction with all detail one might want to see.

\subsection{\label{sect.enum.princ}The basic principles}

Let us first state the basic principles of counting that underlie most of the
proofs in enumerative combinatorics:

\begin{theorem}
[Bijection principle]\label{thm.enum.bij}Let $X$ and $Y$ be two sets. Then,
$\left\vert X\right\vert =\left\vert Y\right\vert $ if and only if there
exists a bijection from $X$ to $Y$.
\end{theorem}

\begin{theorem}
[Sum rule]\label{thm.enum.sum}If $S_{1},S_{2},\ldots,S_{k}$ are $k$ disjoint
finite sets, then the set $S_{1}\cup S_{2}\cup\cdots\cup S_{k}$ is finite and
satisfies%
\begin{equation}
\left\vert S_{1}\cup S_{2}\cup\cdots\cup S_{k}\right\vert =\left\vert
S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert . \label{eq.thm.enum.sum.eq}%
\end{equation}
(Note that \textquotedblleft disjoint\textquotedblright\ means
\textquotedblleft pairwise disjoint\textquotedblright; i.e., the $k$ sets
$S_{1},S_{2},\ldots,S_{k}$ are said to be disjoint if and only if every two
distinct elements $i$ and $j$ of $\left\{  1,2,\ldots,k\right\}  $ satisfy
$S_{i}\cap S_{j}=\varnothing$.)
\end{theorem}

\begin{remark}
\label{rmk.enum.sum-nondj}A weaker version of Theorem \ref{thm.enum.sum} holds
even if we don't require $S_{1},S_{2},\ldots,S_{k}$ to be disjoint: If
$S_{1},S_{2},\ldots,S_{k}$ are any $k$ finite sets, then the set $S_{1}\cup
S_{2}\cup\cdots\cup S_{k}$ is finite and satisfies%
\begin{equation}
\left\vert S_{1}\cup S_{2}\cup\cdots\cup S_{k}\right\vert \leq\left\vert
S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert . \label{eq.rmk.enum.sum-nondj.eq}%
\end{equation}
This inequality (\ref{eq.rmk.enum.sum-nondj.eq}) becomes an equality if and
only if the $k$ sets $S_{1},S_{2},\ldots,S_{k}$ are disjoint.
\end{remark}

\begin{theorem}
[Product rule]\label{thm.enum.prod}If $A_{1},A_{2},\ldots,A_{n}$ are finite
sets, then the set $A_{1}\times A_{2}\times\cdots\times A_{n}$ is finite and
satisfies%
\begin{equation}
\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 . \label{eq.thm.enum.prod.eq}%
\end{equation}

\end{theorem}

\begin{remark}
The set $A_{1}\times A_{2}\times\cdots\times A_{n}$ in Theorem
\ref{thm.enum.prod} is the \textit{Cartesian product} of the $n$ sets
$A_{1},A_{2},\ldots,A_{n}$; it is defined to be the set of all $n$-tuples
$\left(  a_{1},a_{2},\ldots,a_{n}\right)  $ with%
\[
a_{1}\in A_{1}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ a_{2}\in
A_{2}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \cdots
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ a_{n}\in A_{n}.
\]
If $n=0$, then this Cartesian product $A_{1}\times A_{2}\times\cdots\times
A_{n}$ is (by convention) a one-element set, consisting only of the $0$-tuple
$\left(  {}\right)  $. This latter $0$-tuple $\left(  {}\right)  $ is also
known as the \textit{empty list}.
\end{remark}

\begin{theorem}
[Power rule]\label{thm.enum.pow}If $A$ is a finite set, and if $n\in
\mathbb{N}$, then the set $A^{n}$ is finite and satisfies%
\begin{equation}
\left\vert A^{n}\right\vert =\left\vert A\right\vert ^{n}.
\label{eq.thm.enum.pow.eq}%
\end{equation}

\end{theorem}

\begin{remark}
The set $A^{n}$ in Theorem \ref{thm.enum.pow} is defined as the Cartesian
product $\underbrace{A\times A\times\cdots\times A}_{n\text{ times}}$; it is
known as the $n$\textit{-th Cartesian power} of $A$. It consists of the
$n$-tuples $\left(  a_{1},a_{2},\ldots,a_{n}\right)  $ whose entries all
belong to $A$.
\end{remark}

\begin{theorem}
[Difference rule]\label{thm.enum.diff}If $A$ is a finite set, and if $B$ is a
subset of $A$, then the set $A\setminus B$ is finite and satisfies%
\begin{equation}
\left\vert A\setminus B\right\vert =\left\vert A\right\vert -\left\vert
B\right\vert . \label{eq.thm.enum.diff.eq}%
\end{equation}

\end{theorem}

All the above theorems are basic facts and can be used without
proof.\footnote{For the sake of completeness, here are some references to
their proofs (except for Theorem \ref{thm.enum.bij}, which is truly
fundamental and even used to define the size of a set by some authors):
\par
\begin{itemize}
\item Theorem \ref{thm.enum.sum} is \cite[1.2]{Loehr-BC}. It can easily be
derived from Theorem \ref{thm.enum.sumrule2} by induction on $n$. (Theorem
\ref{thm.enum.sumrule2}, on the other hand, can be proved, e.g., by induction
on $\left\vert Q\right\vert $; but the details boil down to how the size of a
set is defined.)
\par
\item Remark \ref{rmk.enum.sum-nondj} can also be proved by induction on $k$,
using the fact that $\left\vert P\cup Q\right\vert \leq\left\vert P\right\vert
+\left\vert Q\right\vert $ for any two finite sets $P$ and $Q$. (The latter
fact, in turn, can be shown by induction on $\left\vert Q\right\vert $.)
\par
\item Theorem \ref{thm.enum.prod} is \cite[1.5]{Loehr-BC}. It can be proved by
induction on $n$, using the fact that $\left\vert P\times Q\right\vert
=\left\vert P\right\vert \cdot\left\vert Q\right\vert $ for any two finite
sets $P$ and $Q$. The latter fact can be obtained from Theorem
\ref{thm.enum.sum} as follows: If we denote the elements of $P$ by
$p_{1},p_{2},\ldots,p_{k}$ (where $k=\left\vert P\right\vert $), then $P\times
Q$ is the union of the $k$ disjoint sets
\[
\left\{  p_{1}\right\}  \times Q,\ \ \ \ \left\{  p_{2}\right\}  \times
Q,\ \ \ \ \ldots,\ \ \ \ \left\{  p_{k}\right\}  \times Q,
\]
each of which has size $\left\vert Q\right\vert $ (by Theorem
\ref{thm.enum.bij}). The details are left to the reader.
\par
\item Theorem \ref{thm.enum.pow} follows by applying Theorem
\ref{thm.enum.prod} to $A_{i}=A$.
\par
\item Theorem \ref{thm.enum.diff} is \cite[1.3]{Loehr-BC} and \cite[Theorem
1.4.7 \textbf{(a)}]{19fco}. It is an easy consequence of Theorem
\ref{thm.enum.sumrule2}.
\end{itemize}
}

\subsection{\label{sect.enum.nots}Notations}

The following two conventions will be used throughout Chapter \ref{chp.enum}:

\begin{convention}
\label{conv.enum.nots.bra-n}If $n\in\mathbb{N}$, then $\left[  n\right]  $
shall mean the $n$-element set $\left\{  1,2,\ldots,n\right\}  $. (Thus, in
particular, $\left[  1\right]  =\left\{  1\right\}  $ and $\left[  0\right]
=\left\{  {}\right\}  =\varnothing$.)
\end{convention}

This convention might appear to clash with the Iverson bracket notation for
truth values (Definition \ref{def.iverson}); but in practice, there is never a
chance of confusion. (Convention \ref{conv.enum.nots.bra-n} only defines
$\left[  n\right]  $ when $n$ is a number, whereas Definition
\ref{def.iverson} only defines $\left[  \mathcal{A}\right]  $ when
$\mathcal{A}$ is a logical statement.)

\begin{convention}
\label{conv.enum.nots.hash}The symbol \textquotedblleft\#\textquotedblright%
\ shall mean the word \textquotedblleft number\textquotedblright\ (or
\textquotedblleft the number\textquotedblright). For example,
\textquotedblleft\# of subsets of $\left\{  1,2,3\right\}  $\textquotedblright%
\ means \textquotedblleft the number of subsets of $\left\{  1,2,3\right\}
$\textquotedblright.
\end{convention}

\begin{example}
We have $\left[  7\right]  =\left\{  1,2,3,4,5,6,7\right\}  $ and thus%
\[
\left\{  \text{the odd numbers in }\left[  7\right]  \right\}  =\left\{
1,3,5,7\right\}  .
\]
Hence,%
\[
\left(  \text{\# of odd numbers in }\left[  7\right]  \right)  =4.
\]

\end{example}

\subsection{\label{sect.enum.elem}Elementary examples}

We shall now solve some elementary counting problems to illustrate the use of
the above theorems.

\subsubsection{Subsets}

We have already seen (in Theorem \ref{thm.binom.comb}) how many $k$-element
subsets a given $n$-element set has. Now, let us count all subsets (of all
possible sizes) of a given $n$-element set:

\begin{theorem}
\label{thm.enum.subsets}Let $n\in\mathbb{N}$. Let $S$ be an $n$-element set.
Then,%
\[
\left(  \text{\# of subsets of }S\right)  =2^{n}.
\]

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.enum.subsets} (sketched).]We shall only give a
brief outline; see \cite[Theorem 1.4.1]{19fco} for details. (More precisely,
the proof we are sketching here is the Third proof of \cite[Theorem
1.4.1]{19fco}; it appears in \cite[\S 1.5.3]{19fco}. Two other proofs are
given in \cite[solution to Exercise 1.4.1]{19fco} and \cite[\S 1.4.2]{19fco}.)

We denote the $n$ elements of $S$ by $s_{1},s_{2},\ldots,s_{n}$ (in some order).

If $I$ is any subset of $S$, then the $n$-tuple\footnote{See Definition
\ref{def.iverson} for the meaning of the square brackets.}
\[
\left(  \left[  s_{1}\in I\right]  ,\left[  s_{2}\in I\right]  ,\ldots,\left[
s_{n}\in I\right]  \right)  \in\left\{  0,1\right\}  ^{n}%
\]
\textquotedblleft encodes\textquotedblright\ the set $I$: Indeed, we can read
$I$ off this $n$-tuple, since the $i$-th entry of this $n$-tuple tells us
whether $s_{i}$ lies in $I$ or not. Thus, the map%
\begin{align*}
f:\left\{  \text{subsets of }S\right\}   &  \rightarrow\left\{  0,1\right\}
^{n},\\
I\  &  \mapsto\left(  \left[  s_{1}\in I\right]  ,\left[  s_{2}\in I\right]
,\ldots,\left[  s_{n}\in I\right]  \right)
\end{align*}
is injective. This map $f$ is also surjective, because any $n$-tuple $\left(
a_{1},a_{2},\ldots,a_{n}\right)  \in\left\{  0,1\right\}  ^{n}$ is taken as a
value by $f$. (In fact, if $\left(  a_{1},a_{2},\ldots,a_{n}\right)
\in\left\{  0,1\right\}  ^{n}$ is any $n$-tuple, then $\left(  a_{1}%
,a_{2},\ldots,a_{n}\right)  =f\left(  I\right)  $, where $I$ is the subset
$\left\{  s_{i}\ \mid\ i\in\left[  n\right]  \text{ satisfying }%
a_{i}=1\right\}  $ of $S$.)

Thus, the map $f$ is bijective (since it is surjective and injective). In
other words, $f$ is a bijection. Hence, there exists a bijection from
$\left\{  \text{subsets of }S\right\}  $ to $\left\{  0,1\right\}  ^{n}$. The
bijection principle (Theorem \ref{thm.enum.bij}) therefore yields%
\begin{align*}
\left\vert \left\{  \text{subsets of }S\right\}  \right\vert  &  =\left\vert
\left\{  0,1\right\}  ^{n}\right\vert =\left\vert \left\{  0,1\right\}
\right\vert ^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.thm.enum.pow.eq}%
)}\right) \\
&  =2^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert \left\{
0,1\right\}  \right\vert =2\right)  .
\end{align*}
In other words, $\left(  \text{\# of subsets of }S\right)  =2^{n}$. This
proves Theorem \ref{thm.enum.subsets}.
\end{proof}

\subsubsection{Integer compositions}

Next, we will count some objects called \textit{compositions} (or, to be more
precise, \textit{integer compositions}). These have nothing to do with
compositions of maps; they are tuples of positive integers:\footnote{Recall
that a \textit{tuple} means a finite ordered list (of any kind of objects).}

\begin{definition}
\textbf{(a)} A \textit{composition} (or, to be more precise, an
\textit{integer composition}) means a tuple of positive integers.

\textbf{(b)} Let $n\in\mathbb{N}$. A \textit{composition of }$n$ means a tuple
of positive integers whose sum is $n$.
\end{definition}

\begin{example}
\textbf{(a)} The tuple $\left(  3,1,1,4\right)  $ is a composition. It is a
composition of $9$, since $3+1+1+4=9$.

\textbf{(b)} The tuple $\left(  3,0,1,4\right)  $ is not a composition, since
$0$ is not a positive integer.

\textbf{(c)} The compositions of $3$ are%
\[
\left(  3\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,2\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
1,1,1\right)  .
\]
Note that $\left(  2,1\right)  $ and $\left(  1,2\right)  $ are not the same
composition, since tuples are ordered.
\end{example}

\begin{theorem}
\label{thm.enum.comps}Let $n\in\mathbb{N}$. Then,%
\[
\left(  \text{\# of compositions of }n\right)  =%
\begin{cases}
2^{n-1}, & \text{if }n\geq1;\\
1, & \text{if }n=0.
\end{cases}
\]

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.enum.comps} (sketched).]We shall outline the proof;
the details can be found in \cite[Exercise 1 \textbf{(b)}]{19fco-hw0s}.

The case $n=0$ is easy (the only composition of $0$ is the $0$-tuple $\left(
{}\right)  $). Thus, for the rest of this proof, we WLOG assume that $n\neq0$.
Hence, $n\geq1$. We thus need to show that $\left(  \text{\# of compositions
of }n\right)  =2^{n-1}$. Inspired by the bijection principle, we thus would
like to define a bijection%
\[
\left\{  \text{compositions of }n\right\}  \rightarrow\left\{  \text{subsets
of }\left[  n-1\right]  \right\}  ,
\]
where (as we recall from Convention \ref{conv.enum.nots.bra-n}) we have
$\left[  n-1\right]  =\left\{  1,2,\ldots,n-1\right\}  $. Indeed, once we have
found such a bijection, we can apply the bijection principle to obtain%
\begin{align*}
\left\vert \left\{  \text{compositions of }n\right\}  \right\vert  &
=\left\vert \left\{  \text{subsets of }\left[  n-1\right]  \right\}
\right\vert \\
&  =\left(  \text{\# of subsets of }\left[  n-1\right]  \right)  =2^{n-1}%
\end{align*}
(by Theorem \ref{thm.enum.subsets} (applied to $\left[  n-1\right]  $ and
$n-1$ instead of $S$ and $n$), since $\left[  n-1\right]  $ is an $\left(
n-1\right)  $-element set), so that%
\[
\left(  \text{\# of compositions of }n\right)  =\left\vert \left\{
\text{compositions of }n\right\}  \right\vert =2^{n-1}.
\]
This will clearly prove Theorem \ref{thm.enum.comps}. Thus, in order to
complete this proof, all that remains to be done is to find a bijection
$\left\{  \text{compositions of }n\right\}  \rightarrow\left\{  \text{subsets
of }\left[  n-1\right]  \right\}  $.

How do we do this? If $a=\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a
composition of $n$, then consider the set%
\begin{align*}
C\left(  a\right)  :=  &  \left\{  a_{1}+a_{2}+\cdots+a_{i}\ \mid
\ i\in\left\{  1,2,\ldots,k-1\right\}  \right\} \\
=  &  \ \{a_{1},\\
&  \ \ \ a_{1}+a_{2},\\
&  \ \ \ a_{1}+a_{2}+a_{3},\\
&  \ \ \ \ldots,\\
&  \ \ \ a_{1}+a_{2}+\cdots+a_{k-1}\}.
\end{align*}
This set $C\left(  a\right)  $ consists of all partial sums of the tuple $a$
(not counting the empty sum $0$, and also not counting the full sum
$a_{1}+a_{2}+\cdots+a_{k}$). Since $a=\left(  a_{1},a_{2},\ldots,a_{k}\right)
$ is a composition of $n$, the entries $a_{1},a_{2},\ldots,a_{k}$ are positive
integers and their sum is $a_{1}+a_{2}+\cdots+a_{k}=n$; hence, all their
partial sums $a_{1}+a_{2}+\cdots+a_{i}$ for $i\in\left\{  1,2,\ldots
,k-1\right\}  $ are larger than $0$ and smaller than $n$. In other words, all
these partial sums belong to the set $\left\{  1,2,\ldots,n-1\right\}
=\left[  n-1\right]  $. That is, $C\left(  a\right)  $ is a subset of $\left[
n-1\right]  $ (since $C\left(  a\right)  $ is the set of these partial sums).

Thus, for each composition $a$ of $n$, we have defined a subset $C\left(
a\right)  $ of $\left[  n-1\right]  $. We thus obtain a map%
\begin{align*}
C:\left\{  \text{compositions of }n\right\}   &  \rightarrow\left\{
\text{subsets of }\left[  n-1\right]  \right\}  ,\\
a  &  \mapsto C\left(  a\right)  .
\end{align*}
For example, if $n=7$ and $a=\left(  3,1,2,1\right)  $, then $C\left(
a\right)  =\left\{  3,\ \ 3+1,\ \ 3+1+2\right\}  =\left\{  3,4,6\right\}  $.

Now, we claim that this map $C$ is a bijection. Indeed, its inverse map
$C^{-1}$ can be constructed rather easily: If $I$ is any subset of $\left[
n-1\right]  $, then the elements of $I$ subdivide the interval $\left[
0,n\right]  $ into several blocks; the lengths of these blocks (from left to
right) form a composition of $n$ (since they are positive integers summing to
$n$), and this composition is precisely $C^{-1}\left(  I\right)  $. For
example, if $n=7$ and $I=\left\{  3,4,6\right\}  $, then the elements of $I$
subdivide the interval $\left[  0,n\right]  =\left[  0,7\right]  $ into $4$
blocks as follows:%
\[%
%TCIMACRO{\TeXButton{tikz composition from intervals}{\begin{tikzpicture}%
%[scale=1.5]
%\draw[->, gray] (-0.3,0) -- (7.3,0);
%\node(0) at (0 cm, 0 cm) {};
%\node(3) at (3 cm, 0 cm) {};
%\node(4) at (4 cm, 0 cm) {};
%\node(6) at (6 cm, 0 cm) {};
%\node(7) at (7 cm, 0 cm) {};
%\node[blue] (a) at (1.5 cm, 0.5 cm) {$3$};
%\node[blue] (b) at (3.5 cm, 0.5 cm) {$1$};
%\node[blue] (c) at (5.0 cm, 0.5 cm) {$2$};
%\node[blue] (d) at (6.5 cm, 0.5 cm) {$1$};
%\fill(0) circle (1pt) node[below] {$0$};
%\fill(3) circle (1pt) node[below] {$3$};
%\fill(4) circle (1pt) node[below] {$4$};
%\fill(6) circle (1pt) node[below] {$6$};
%\fill(7) circle (1pt) node[below] {$7$};
%\draw[->, blue] (0.1,0.5) -- (1.35,0.5);
%\draw[->, blue] (2.9,0.5) -- (1.65,0.5);
%\draw[->, blue] (3.1,0.5) -- (3.35,0.5);
%\draw[->, blue] (3.9,0.5) -- (3.65,0.5);
%\draw[->, blue] (4.1,0.5) -- (4.85,0.5);
%\draw[->, blue] (5.9,0.5) -- (5.15,0.5);
%\draw[->, blue] (6.1,0.5) -- (6.35,0.5);
%\draw[->, blue] (6.9,0.5) -- (6.65,0.5);
%\draw[very thick, red] (0,0) -- (0,1);
%\draw[very thick, red] (3,0) -- (3,1);
%\draw[very thick, red] (4,0) -- (4,1);
%\draw[very thick, red] (6,0) -- (6,1);
%\draw[very thick, red] (7,0) -- (7,1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\draw[->, gray] (-0.3,0) -- (7.3,0);
\node(0) at (0 cm, 0 cm) {};
\node(3) at (3 cm, 0 cm) {};
\node(4) at (4 cm, 0 cm) {};
\node(6) at (6 cm, 0 cm) {};
\node(7) at (7 cm, 0 cm) {};
\node[blue] (a) at (1.5 cm, 0.5 cm) {$3$};
\node[blue] (b) at (3.5 cm, 0.5 cm) {$1$};
\node[blue] (c) at (5.0 cm, 0.5 cm) {$2$};
\node[blue] (d) at (6.5 cm, 0.5 cm) {$1$};
\fill(0) circle (1pt) node[below] {$0$};
\fill(3) circle (1pt) node[below] {$3$};
\fill(4) circle (1pt) node[below] {$4$};
\fill(6) circle (1pt) node[below] {$6$};
\fill(7) circle (1pt) node[below] {$7$};
\draw[->, blue] (0.1,0.5) -- (1.35,0.5);
\draw[->, blue] (2.9,0.5) -- (1.65,0.5);
\draw[->, blue] (3.1,0.5) -- (3.35,0.5);
\draw[->, blue] (3.9,0.5) -- (3.65,0.5);
\draw[->, blue] (4.1,0.5) -- (4.85,0.5);
\draw[->, blue] (5.9,0.5) -- (5.15,0.5);
\draw[->, blue] (6.1,0.5) -- (6.35,0.5);
\draw[->, blue] (6.9,0.5) -- (6.65,0.5);
\draw[very thick, red] (0,0) -- (0,1);
\draw[very thick, red] (3,0) -- (3,1);
\draw[very thick, red] (4,0) -- (4,1);
\draw[very thick, red] (6,0) -- (6,1);
\draw[very thick, red] (7,0) -- (7,1);
\end{tikzpicture}%
%EndExpansion
\]
(where the lengths of the blocks are shown in blue, and where the red vertical
lines separate the blocks), and the lengths of these $4$ blocks are $3,1,2,1$
(from left to right), so that $C^{-1}\left(  I\right)  =\left(
3,1,2,1\right)  $. Proving that this construction really defines an inverse
map to $C$ is straightforward and left to the reader (see \cite[solution to
Exercise 1 \textbf{(b)}]{19fco-hw0s}, where it is done rigorously and with no
reference to pictures).

Thus, the map $C:\left\{  \text{compositions of }n\right\}  \rightarrow
\left\{  \text{subsets of }\left[  n-1\right]  \right\}  $ is a bijection. So
we have found a bijection $\left\{  \text{compositions of }n\right\}
\rightarrow\left\{  \text{subsets of }\left[  n-1\right]  \right\}  $. As we
explained above, this completes the proof of Theorem \ref{thm.enum.comps}.
\end{proof}

\subsubsection{\label{subsect.enum.elem.maps}Maps}

Let us next count maps (i.e., functions) between two sets.

\begin{definition}
\label{def.enum.maps.BA}Let $A$ and $B$ be two sets. Then, $B^{A}$ shall mean
the set of all maps from $A$ to $B$.
\end{definition}

\begin{theorem}
\label{thm.enum.maps.maps}Let $A$ and $B$ be two finite sets. Then, the set
$B^{A}$ is finite, and satisfies
\begin{equation}
\left\vert B^{A}\right\vert =\left\vert B\right\vert ^{\left\vert A\right\vert
}. \label{eq.thm.enum.maps.maps.eq}%
\end{equation}

\end{theorem}

The equality (\ref{eq.thm.enum.maps.maps.eq}) can be rewritten as%
\begin{equation}
\left(  \text{\# of maps from }A\text{ to }B\right)  =\left\vert B\right\vert
^{\left\vert A\right\vert }. \label{eq.thm.enum.maps.maps.eq2}%
\end{equation}


\begin{proof}
[Proof of Theorem \ref{thm.enum.maps.maps} (sketched).]This is an outline of
the proof; see \cite[proof of Theorem 1.5.7]{19fco} for details.

Let us denote the elements of $A$ by $a_{1},a_{2},\ldots,a_{n}$ (in any
order). Thus, $\left\vert A\right\vert =n$. Now, any map $f:A\rightarrow B$ is
uniquely determined by the $n$-tuple \newline$\left(  f\left(  a_{1}\right)
,f\left(  a_{2}\right)  ,\ldots,f\left(  a_{n}\right)  \right)  \in B^{n}$
(which is simply its list of values). Conversely, any $n$-tuple $\left(
b_{1},b_{2},\ldots,b_{n}\right)  \in B^{n}$ can be obtained as the list
$\left(  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(
a_{n}\right)  \right)  $ of values of some map $f:A\rightarrow B$. Thus, we
have a bijection%
\begin{align*}
B^{A}  &  \rightarrow B^{n},\\
f  &  \mapsto\left(  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{n}\right)  \right)
\end{align*}
(since $B^{A}$ is the set of all maps from $A$ to $B$). Hence, the bijection
principle yields%
\begin{align*}
\left\vert B^{A}\right\vert  &  =\left\vert B^{n}\right\vert =\left\vert
B\right\vert ^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the power rule}\right)
\\
&  =\left\vert B\right\vert ^{\left\vert A\right\vert }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n=\left\vert A\right\vert \right)  .
\end{align*}
This proves Theorem \ref{thm.enum.maps.maps}.
\end{proof}

The next problem is similar to
\href{https://prase.cz/kalva/putnam/psoln/psol851.html}{Putnam 1985 problem
A1}:\footnote{Recall that $\left[  n\right]  =\left\{  1,2,\ldots,n\right\}  $
for $n\in\mathbb{N}$.}

\begin{exercise}
\label{exe.enum.maps.put85a1}Let $n\in\mathbb{N}$. Find the \# of all triples
$\left(  A,B,C\right)  $ of subsets of $\left[  n\right]  $ satisfying $A\cap
B\cap C=\varnothing$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.maps.put85a1}.]The condition $A\cap
B\cap C=\varnothing$ says that no element belongs to $A$, $B$ and $C$ at the
same time.

Let us construct a triple $\left(  A,B,C\right)  $ of subsets of $\left[
n\right]  $ satisfying $A\cap B\cap C=\varnothing$. It may appear natural to
do this by first choosing $A$, then choosing $B$, then choosing $C$. But this
is not a good way to count these triples, as the number of options for $C$
depends on the choices of $A$ and $B$. We thus take a different way. We
construct a triple $\left(  A,B,C\right)  $ of subsets of $\left[  n\right]  $
satisfying $A\cap B\cap C=\varnothing$ as follows:

\begin{itemize}
\item We decide which of the three sets $A,B,C$ will contain $1$. There are
$7$ options\footnote{What we call \textquotedblleft option\textquotedblright%
\ here is often called \textquotedblleft choice\textquotedblright\ in the
literature. See Convention \ref{conv.enum.choices} below for a discussion of
this concept.} for this decision; namely, the options are \textquotedblleft
only $A$\textquotedblright, \textquotedblleft only $B$\textquotedblright,
\textquotedblleft only $C$\textquotedblright, \textquotedblleft both $A$ and
$B$\textquotedblright, \textquotedblleft both $A$ and $C$\textquotedblright,
\textquotedblleft both $B$ and $C$\textquotedblright\ and \textquotedblleft
none of $A$, $B$ and $C$\textquotedblright. (The option \textquotedblleft all
three of $A$, $B$ and $C$\textquotedblright\ is unavailable, since this would
contradict $A\cap B\cap C=\varnothing$.)

\item We decide which of the three sets $A,B,C$ will contain $2$. Again, there
are $7$ options for this decision.

\item We decide which of the three sets $A,B,C$ will contain $3$. Again, there
are $7$ options for this decision.

\item And so on, until we have placed each of the $n$ elements $1,2,\ldots,n$
of $\left[  n\right]  $ in the sets $A,B,C$ (or, rather, in whichever of these
sets $A,B,C$ we want to place it in).
\end{itemize}

\noindent Altogether, we thus make $n$ decisions, and each time there are $7$
available options. Thus, the total \# of possibilities (for the triple
$\left(  A,B,C\right)  $ we are constructing) is $\underbrace{7\cdot
7\cdot\cdots\cdot7}_{n\text{ times}}=7^{n}$. So the \# of all triples $\left(
A,B,C\right)  $ of subsets of $\left[  n\right]  $ satisfying $A\cap B\cap
C=\varnothing$ is $7^{n}$.

This wasn't very rigorous: what exactly is a \textquotedblleft
decision\textquotedblright, what is an \textquotedblleft
option\textquotedblright, what is a \textquotedblleft
possibility\textquotedblright, and why are we multiplying the $7$'s? The
answer is that our informal argument above was informal code for an
application of the bijection principle. Here is an outline of how to formalize
it: Define the map%
\begin{align*}
\left\{  \text{triples }\left(  A,B,C\right)  \text{ of subsets of }\left[
n\right]  \text{ satisfying }A\cap B\cap C=\varnothing\right\}   &
\rightarrow\left\{  1,2,\ldots,7\right\}  ^{n},\\
\left(  A,B,C\right)   &  \mapsto\left(  u_{1},u_{2},\ldots,u_{n}\right)  ,
\end{align*}
where%
\[
u_{i}=%
\begin{cases}
1, & \text{if }i\notin A\text{ and }i\notin B\text{ and }i\notin C;\\
2, & \text{if }i\in A\text{ and }i\notin B\text{ and }i\notin C;\\
3, & \text{if }i\notin A\text{ and }i\in B\text{ and }i\notin C;\\
4, & \text{if }i\notin A\text{ and }i\notin B\text{ and }i\in C;\\
5, & \text{if }i\in A\text{ and }i\in B\text{ and }i\notin C;\\
6, & \text{if }i\in A\text{ and }i\notin B\text{ and }i\in C;\\
7, & \text{if }i\notin A\text{ and }i\in B\text{ and }i\in C
\end{cases}
\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left[  n\right]
\]
(so that $u_{i}$ essentially encodes which of the sets $A,B,C$ contain $i$).
It is not hard to see that this map is a bijection. Thus, the bijection
principle entails%
\begin{align*}
&  \left\vert \left\{  \text{triples }\left(  A,B,C\right)  \text{ of subsets
of }\left[  n\right]  \text{ satisfying }A\cap B\cap C=\varnothing\right\}
\right\vert \\
&  =\left\vert \left\{  1,2,\ldots,7\right\}  ^{n}\right\vert =\left\vert
\left\{  1,2,\ldots,7\right\}  \right\vert ^{n}\ \ \ \ \ \ \ \ \ \ \left(
\text{by the power rule}\right) \\
&  =7^{n}.
\end{align*}
Thus, we recover our answer to Exercise \ref{exe.enum.maps.put85a1} with a
formal proof.
\end{proof}

For the future, let me clarify my use of certain words:

\begin{convention}
\label{conv.enum.choices}\textbf{(a)} I am using the three words
\textquotedblleft decision\textquotedblright, \textquotedblleft
option\textquotedblright\ and \textquotedblleft possibility\textquotedblright%
\ for what most authors (including Loehr in \cite{Loehr-BC}) call
\textquotedblleft choice\textquotedblright. In my opinion, using the word
\textquotedblleft choice\textquotedblright\ for all three concepts is
misleading, as they are not the same. Let me illustrate the differences on an example:

Imagine you are about to buy a car. You get to choose its color
(\textquotedblleft black\textquotedblright, \textquotedblleft
grey\textquotedblright\ or \textquotedblleft red\textquotedblright) and its
body style (\textquotedblleft sedan\textquotedblright, \textquotedblleft
minivan\textquotedblright\ or \textquotedblleft convertible\textquotedblright%
). All pairs of a color and a body style are available. Thus:

\begin{itemize}
\item you make $2$ \textit{decisions} (namely, the color and the body style);

\item you have $3$ \textit{options} in your first decision (namely,
\textquotedblleft black\textquotedblright, \textquotedblleft
grey\textquotedblright\ and \textquotedblleft red\textquotedblright);

\item you have $3$ \textit{options} in your second decision (namely,
\textquotedblleft sedan\textquotedblright, \textquotedblleft
minivan\textquotedblright\ and \textquotedblleft convertible\textquotedblright);

\item you have a total of $9$ \textit{possibilities} (namely,
\textquotedblleft black sedan\textquotedblright, \textquotedblleft black
minivan\textquotedblright, \textquotedblleft black
convertible\textquotedblright, \textquotedblleft grey sedan\textquotedblright, etc.).
\end{itemize}

The general rule is that you are choosing between a number of \textit{options}
in each \textit{decision}; and the total combination of options you have
chosen after you made all decisions is a \textit{possibility}.

By avoiding the word \textquotedblleft choice\textquotedblright, I am also
eliminating the source of confusion that the standard idioms \textquotedblleft
You have one choice\textquotedblright\ and \textquotedblleft You have no
choice\textquotedblright\ cause. (In my terminology, these would translate as
\textquotedblleft You have one decision, which allows for at least $2$
options\textquotedblright\ and \textquotedblleft You have $1$
option\textquotedblright.) I hope the pedantry will pay off as we get to more
complicated proofs where any bit of clarity will be helpful.

\textbf{(b)} Assume you are making several decisions (as in the example above,
where you are buying a car). The decisions are said to be \textit{independent}
if the set of options you get to choose from in one decision does not depend
on the options you have chosen in the others. Otherwise, they are
\textit{dependent}. For example, in the above example, the two decisions were
independent; however, if a red sedan becomes unavailable, then they become
dependent, since choosing \textquotedblleft red\textquotedblright\ in the
first decision makes the \textquotedblleft sedan\textquotedblright\ option in
the second decision unavailable. (The decision-making process in our above
discussion of Exercise \ref{exe.enum.maps.put85a1} was an example where we had
$n$ independent decisions, each allowing for $7$ options.)
\end{convention}

\subsubsection{Injective maps}

Counting all maps between two given sets was easy. What about injective maps?

\begin{theorem}
\label{thm.enum.maps.inj}Let $m,n\in\mathbb{N}$. Let $A$ be an $m$-element
set. Let $B$ be an $n$-element set. Then,%
\begin{align}
&  \left(  \text{\# of all injective maps from }A\text{ to }B\right)
\nonumber\\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right)
\label{eq.thm.enum.maps.inj.1}\\
&  =m!\cdot\dbinom{n}{m}. \label{eq.thm.enum.maps.inj.2}%
\end{align}

\end{theorem}

\begin{remark}
Let $m,n,A,B$ be as in Theorem \ref{thm.enum.maps.inj}. If $m>n$, then the
product $n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right)
$ contains the factor $n-n=0$, and thus must itself be $0$. Thus, Theorem
\ref{thm.enum.maps.inj} shows that there are \textbf{no} injective maps from
$A$ to $B$ if $m>n$. This is precisely what Theorem \ref{thm.php.php-inj-1c}
tells us.
\end{remark}

\begin{proof}
[Proof of Theorem \ref{thm.enum.maps.inj} (sketched).]We shall give an
informal proof, and later explain what it relies on.

First of all, we note that $m=\left\vert A\right\vert \in\mathbb{N}$ and thus
\[
\dbinom{n}{m}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-m+1\right)  }{m!}%
\]
(by (\ref{eq.def.binom.def.a}), applied to $k=m$). Hence,%
\begin{equation}
m!\cdot\dbinom{n}{m}=n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-m+1\right)  . \label{pf.thm.enum.maps.inj.1}%
\end{equation}


We denote the $m$ elements of $A$ by $a_{1},a_{2},\ldots,a_{m}$ (in some
order). Now, if $f:A\rightarrow B$ is an injective map, then the $m$ values
$f\left(  a_{1}\right)  ,f\left(  a_{2}\right)  ,\ldots,f\left(  a_{m}\right)
$ are distinct (i.e., no two of them are equal), so that they satisfy%
\begin{align*}
f\left(  a_{1}\right)   &  \in B,\\
f\left(  a_{2}\right)   &  \in B\setminus\left\{  f\left(  a_{1}\right)
\right\}  ,\\
f\left(  a_{3}\right)   &  \in B\setminus\left\{  f\left(  a_{1}\right)
,f\left(  a_{2}\right)  \right\}  ,\\
f\left(  a_{4}\right)   &  \in B\setminus\left\{  f\left(  a_{1}\right)
,f\left(  a_{2}\right)  ,f\left(  a_{3}\right)  \right\}  ,\\
&  \ldots.
\end{align*}
Hence, we can construct an injective map $f:A\rightarrow B$ as follows:

\begin{itemize}
\item Choose the value $f\left(  a_{1}\right)  \in B$. We have $n$ options for
this (since $B$ has $n$ elements).

\item Choose the value $f\left(  a_{2}\right)  \in B\setminus\left\{  f\left(
a_{1}\right)  \right\}  $. We have $n-1$ options for this (since
$B\setminus\left\{  f\left(  a_{1}\right)  \right\}  $ has $n-1$ elements).

\item Choose the value $f\left(  a_{3}\right)  \in B\setminus\left\{  f\left(
a_{1}\right)  ,f\left(  a_{2}\right)  \right\}  $. We have $n-2$ options for
this (since $B\setminus\left\{  f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
\right\}  $ has $n-2$ elements\footnote{This is because $f\left(
a_{1}\right)  $ and $f\left(  a_{2}\right)  $ are distinct (because of how we
chose $f\left(  a_{2}\right)  $).}).

\item Choose the value $f\left(  a_{4}\right)  \in B\setminus\left\{  f\left(
a_{1}\right)  ,f\left(  a_{2}\right)  ,f\left(  a_{3}\right)  \right\}  $. We
have $n-3$ options for this (since $B\setminus\left\{  f\left(  a_{1}\right)
,f\left(  a_{2}\right)  ,f\left(  a_{3}\right)  \right\}  $ has $n-3$
elements\footnote{This is because $f\left(  a_{1}\right)  $, $f\left(
a_{2}\right)  $ and $f\left(  a_{3}\right)  $ are distinct (because of how we
chose $f\left(  a_{2}\right)  $ and $f\left(  a_{3}\right)  $).}).

\item And so on, until we have chosen the last value $f\left(  a_{m}\right)  $
(there are $n-m+1$ options for it).
\end{itemize}

\noindent Note that the options that are available to us at each step of this
procedure depend on the previously made decisions (so our decisions are
dependent); however, the \textbf{number} of options at each step does not.
Namely, we have $n$ options in our first decision, $n-1$ options in our second
decision, $n-2$ options in our third decision, and so on. Hence, in total, we
have $n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right)  $
possibilities for how we can make these choices. Since each of these
possibilities leads to a different injective map $f:A\rightarrow B$, and since
each injective map $f:A\rightarrow B$ can be obtained from one of these
possibilities, we thus conclude that%
\begin{align*}
\left(  \text{\# of all injective maps from }A\text{ to }B\right)   &
=n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right) \\
&  =m!\cdot\dbinom{n}{m}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.enum.maps.inj.1})}\right)  \text{.}%
\end{align*}
This proves Theorem \ref{thm.enum.maps.inj} (if you believe in our informal
argument using \textquotedblleft choosing values\textquotedblright).
\end{proof}

Our above proof of Theorem \ref{thm.enum.maps.inj} used the following fact,
which we shall state in an informal way here:

\begin{theorem}
[Dependent product rule]\label{thm.enum.dep-prod.inform}Consider a situation
in which you have to make $n$ decisions (in order). Assume that

\begin{itemize}
\item you have $a_{1}$ options in decision $1$;

\item you have $a_{2}$ options in decision $2$ (no matter what option you
chose in decision $1$);

\item you have $a_{3}$ options in decision $3$ (no matter what options you
chose in decisions $1$ and $2$);

\item $\ldots$;

\item you have $a_{n}$ options in decision $n$ (no matter what options you
chose in the previous decisions).
\end{itemize}

Then, the total \# of possibilities for how you can make these choices is
$a_{1}a_{2}\cdots a_{n}$.
\end{theorem}

This can be made rigorous (see \cite[Theorem 7.2.19]{Newste20} or
\cite[\S 1.8]{Loehr-BC}). Note that we have applied Theorem
\ref{thm.enum.dep-prod.inform} to $m$ instead of $n$ in our proof of Theorem
\ref{thm.enum.maps.inj} (since the procedure by which we constructed an
injective map $f:A\rightarrow B$ required $m$ decisions).

There is also an alternative way of formalizing the above proof of Theorem
\ref{thm.enum.maps.inj}, without explicitly mentioning the Dependent product
rule. Namely, instead of constructing an injective map $f:A\rightarrow B$ by
choosing its values $f\left(  a_{1}\right)  ,f\left(  a_{2}\right)
,\ldots,f\left(  a_{m}\right)  $ in order, we fix an element $a$ of $A$
(unless $A$ is empty, in which case Theorem \ref{thm.enum.maps.inj} is rather
trivial), and we construct an injective map $f:A\rightarrow B$ by first
choosing its value $f\left(  a\right)  $ and then choosing all remaining
values at the same time (which is tantamount to choosing an injective map from
$A\setminus\left\{  a\right\}  $ to $B\setminus\left\{  f\left(  a\right)
\right\}  $, because the values to be chosen must differ from $f\left(
a\right)  $). This procedure involves only two steps, and thus is easier to
formalize. There are always exactly $n$ options at the first step, whereas the
\# of options at the second step is the \# of injective maps from
$A\setminus\left\{  a\right\}  $ to $B\setminus\left\{  f\left(  a\right)
\right\}  $, which we can obtain from our induction hypothesis if we induct on
$\left\vert A\right\vert $. See \cite[\S 2.4.2]{19fco} for the details of this argument.

\subsubsection{Tuples with non-repetition requirements}

The next definition codifies three different ways in which tuples can avoid
having repeated elements:

\begin{definition}
\label{def.enum.smirnov}A tuple $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $
(of any kind of objects) is said to be

\begin{itemize}
\item \textit{injective} if $a_{1},a_{2},\ldots,a_{k}$ are distinct;

\item \textit{Smirnov} (or \textit{Carlitz} or \textit{non-stuttering}) if it
satisfies $a_{i}\neq a_{i+1}$ for each $i\in\left\{  1,2,\ldots,k-1\right\}  $;

\item \textit{cyc-Smirnov} if it satisfies both

\begin{itemize}
\item the relation $a_{i}\neq a_{i+1}$ for each $i\in\left\{  1,2,\ldots
,k-1\right\}  $ and

\item the relation $a_{k}\neq a_{1}$ (assuming that $k>0$).
\end{itemize}
\end{itemize}
\end{definition}

We are using the proper names \textquotedblleft Smirnov\textquotedblright\ and
\textquotedblleft Carlitz\textquotedblright\ as adjectives here.
\textquotedblleft Cyc-Smirnov\textquotedblright\ is short for
\textquotedblleft cyclically Smirnov\textquotedblright. One can think of
Smirnov tuples as tuples that can have repeated entries, but never in
consecutive positions. Cyc-Smirnov tuples are defined in the same way, except
that the last and the first positions also count as consecutive (which is
natural if one imagines the tuple being written on a round band).

Clearly, any injective tuple with at least one entry is cyc-Smirnov; also,
every cyc-Smirnov tuple is Smirnov.

\begin{example}
\textbf{(a)} The tuple $\left(  5,1,2\right)  $ is injective (and thus Smirnov
and cyc-Smirnov).

\textbf{(b)} The tuple $\left(  2,1,2\right)  $ is not injective and not
cyc-Smirnov, but it is Smirnov.

\textbf{(c)} The tuple $\left(  2,1,2,1\right)  $ is cyc-Smirnov (and thus
Smirnov), but not injective.

\textbf{(d)} The tuple $\left(  2,2,1\right)  $ is not Smirnov (and thus
neither cyc-Smirnov nor injective).
\end{example}

Let us now count these tuples:

\begin{exercise}
\label{exe.enum.smirnov.count}Let $n,k\in\mathbb{N}$. Let $A$ be an
$n$-element set.

\textbf{(a)} How many injective $k$-tuples $\left(  a_{1},a_{2},\ldots
,a_{k}\right)  \in A^{k}$ exist?

\textbf{(b)} Assume that $k>0$. How many Smirnov $k$-tuples $\left(
a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$ exist?

\textbf{(c)} Assume that $k>0$. How many cyc-Smirnov $k$-tuples $\left(
a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$ exist?
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.smirnov.count}.]\textbf{(a)} Recall the
notation $\left[  k\right]  =\left\{  1,2,\ldots,k\right\}  $ (from Convention
\ref{conv.enum.nots.bra-n}). Now, we claim that the injective $k$-tuples
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$ are \textquotedblleft the
same as\textquotedblright\ the injective maps from $\left[  k\right]  $ to
$A$. To be more precise, there is a bijection%
\begin{align*}
\left\{  \text{injective maps from }\left[  k\right]  \text{ to }A\right\}
&  \rightarrow\left\{  \text{injective }k\text{-tuples }\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  \in A^{k}\right\}  ,\\
f  &  \mapsto\left(  f\left(  1\right)  ,f\left(  2\right)  ,\ldots,f\left(
k\right)  \right)
\end{align*}
(check this!). Hence, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of injective maps from }\left[  k\right]  \text{ to
}A\right) \\
&  =\left(  \text{\# of injective }k\text{-tuples }\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  \in A^{k}\right)  ,
\end{align*}
therefore%
\begin{align*}
&  \left(  \text{\# of injective }k\text{-tuples }\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  \in A^{k}\right) \\
&  =\left(  \text{\# of injective maps from }\left[  k\right]  \text{ to
}A\right) \\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)
\end{align*}
(by (\ref{eq.thm.enum.maps.inj.1}), applied to $k$, $\left[  k\right]  $ and
$A$ instead of $m$, $A$ and $B$). This solves Exercise
\ref{exe.enum.smirnov.count} \textbf{(a)}.

\textbf{(b)} To construct a Smirnov $k$-tuple $\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  \in A^{k}$, we proceed as follows:

\begin{itemize}
\item We choose its first entry $a_{1}\in A$. (There are $n$ options.)

\item We choose its second entry $a_{2}\in A\setminus\left\{  a_{1}\right\}
$. (There are $n-1$ options.)

\item We choose its third entry $a_{3}\in A\setminus\left\{  a_{2}\right\}  $.
(There are $n-1$ options.)

\item We choose its fourth entry $a_{4}\in A\setminus\left\{  a_{3}\right\}
$. (There are $n-1$ options.)

\item And so on, until the last entry $a_{k}$ has been chosen.
\end{itemize}

\noindent Thus, the Dependent product rule shows that the total \# of
possibilities for how we can make these choices is
\[
n\underbrace{\left(  n-1\right)  \left(  n-1\right)  \cdots\left(  n-1\right)
}_{k-1\text{ times}}=n\left(  n-1\right)  ^{k-1}.
\]
So the \# of Smirnov $k$-tuples $\left(  a_{1},a_{2},\ldots,a_{k}\right)  \in
A^{k}$ is $n\left(  n-1\right)  ^{k-1}$. This solves Exercise
\ref{exe.enum.smirnov.count} \textbf{(b)}.

\textbf{(c)} Forget that we fixed $k$. For each positive integer $k$, we let
$c\left(  n,k\right)  $ denote the \# of cyc-Smirnov $k$-tuples $\left(
a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$. Thus, we want to compute
$c\left(  n,k\right)  $.

First we deal with the case $k=1$: A $1$-tuple $\left(  a_{1}\right)  \in
A^{1}$ cannot be cyc-Smirnov, since the condition \textquotedblleft$a_{k}\neq
a_{1}$\textquotedblright\ in the definition of a cyc-Smirnov tuple would boil
down to the clearly impossible inequality $a_{1}\neq a_{1}$ for a $1$-tuple.
Thus, there exist no cyc-Smirnov $1$-tuples $\left(  a_{1}\right)  \in A^{1}$.
In other words, $c\left(  n,1\right)  =0$.

Assume now that $k>1$. We agree to only consider tuples with entries in $A$ in
this solution. That is, \textquotedblleft$k$-tuple\textquotedblright\ will
always mean \textquotedblleft$k$-tuple of elements of $A$\textquotedblright%
\ (and likewise for $\left(  k-1\right)  $-tuples).

We say that a $k$-tuple $\left(  a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$
is \textit{noncyc-Smirnov} if it is Smirnov and satisfies $a_{k}=a_{1}$. Thus,
each Smirnov $k$-tuple $\left(  a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$ is
either cyc-Smirnov or noncyc-Smirnov (depending on whether it satisfies
$a_{k}\neq a_{1}$ or $a_{k}=a_{1}$); it cannot be both at the same time.
Hence, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of Smirnov }k\text{-tuples}\right) \\
&  =\left(  \text{\# of cyc-Smirnov }k\text{-tuples}\right)  +\left(  \text{\#
of noncyc-Smirnov }k\text{-tuples}\right)  .
\end{align*}
Hence,%
\begin{align*}
&  \left(  \text{\# of cyc-Smirnov }k\text{-tuples}\right) \\
&  =\left(  \text{\# of Smirnov }k\text{-tuples}\right)  -\left(  \text{\# of
noncyc-Smirnov }k\text{-tuples}\right)  .
\end{align*}
This equality turns out to be useful, because we will soon see that both terms
on its right hand side are easier to compute than the left hand side.

If $\left(  a_{1},a_{2},\ldots,a_{k}\right)  \in A^{k}$ is a noncyc-Smirnov
$k$-tuple, then $a_{k-1}\neq a_{k}$ (since $\left(  a_{1},a_{2},\ldots
,a_{k}\right)  $ is Smirnov) and therefore $a_{k-1}\neq a_{k}=a_{1}$ (since
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is noncyc-Smirnov), so that the
$\left(  k-1\right)  $-tuple $\left(  a_{1},a_{2},\ldots,a_{k-1}\right)  \in
A^{k-1}$ is a cyc-Smirnov $\left(  k-1\right)  $-tuple. Thus, we obtain a map%
\begin{align*}
f:\left\{  \text{noncyc-Smirnov }k\text{-tuples}\right\}   &  \rightarrow
\left\{  \text{cyc-Smirnov }\left(  k-1\right)  \text{-tuples}\right\}  ,\\
\left(  a_{1},a_{2},\ldots,a_{k}\right)   &  \mapsto\left(  a_{1},a_{2}%
,\ldots,a_{k-1}\right)  .
\end{align*}
(All that this map $f$ does is removing the last entry of a $k$-tuple.)

Conversely, if $\left(  a_{1},a_{2},\ldots,a_{k-1}\right)  \in A^{k-1}$ is a
cyc-Smirnov $\left(  k-1\right)  $-tuple, then \newline$\left(  a_{1}%
,a_{2},\ldots,a_{k-1},a_{1}\right)  \in A^{k}$ is a noncyc-Smirnov $k$-tuple
(since its last entry equals its first entry). Thus, we obtain a map%
\begin{align*}
g:\left\{  \text{cyc-Smirnov }\left(  k-1\right)  \text{-tuples}\right\}   &
\rightarrow\left\{  \text{noncyc-Smirnov }k\text{-tuples}\right\}  ,\\
\left(  a_{1},a_{2},\ldots,a_{k-1}\right)   &  \mapsto\left(  a_{1}%
,a_{2},\ldots,a_{k-1},a_{1}\right)  .
\end{align*}


It is easy to see that the maps $f$ and $g$ are mutually inverse (indeed,
$f\circ g=\operatorname*{id}$ is clear, whereas $g\circ f=\operatorname*{id}$
follows from the fact that each noncyc-Smirnov $k$-tuple has the form $\left(
a_{1},a_{2},\ldots,a_{k-1},a_{1}\right)  $ for some $a_{1},a_{2}%
,\ldots,a_{k-1}\in A$). Thus, the map $f$ is invertible, i.e., a bijection.
Hence, the bijection principle shows that
\begin{align*}
\left(  \text{\# of noncyc-Smirnov }k\text{-tuples}\right)   &  =\left(
\text{\# of cyc-Smirnov }\left(  k-1\right)  \text{-tuples}\right) \\
&  =c\left(  n,k-1\right)
\end{align*}
(since $c\left(  n,k-1\right)  $ was defined as the \# of cyc-Smirnov $\left(
k-1\right)  $-tuples).

Now, the definition of $c\left(  n,k\right)  $ yields%
\begin{align}
c\left(  n,k\right)   &  =\left(  \text{\# of cyc-Smirnov }k\text{-tuples}%
\right) \nonumber\\
&  =\underbrace{\left(  \text{\# of Smirnov }k\text{-tuples}\right)
}_{\substack{=n\left(  n-1\right)  ^{k-1}\\\text{(by Exercise
\ref{exe.enum.smirnov.count} \textbf{(b)})}}}-\underbrace{\left(  \text{\# of
noncyc-Smirnov }k\text{-tuples}\right)  }_{=c\left(  n,k-1\right)
}\nonumber\\
&  =n\left(  n-1\right)  ^{k-1}-c\left(  n,k-1\right)  .
\label{sol.enum.smirnov.count.c.rec}%
\end{align}


Forget that we fixed $k$. We thus have proved the equality
(\ref{sol.enum.smirnov.count.c.rec}) for each integer $k>1$. Moreover, recall
that $c\left(  n,1\right)  =0$. This gives us a recurrent description of the
sequence $\left(  c\left(  n,1\right)  ,c\left(  n,2\right)  ,c\left(
n,3\right)  ,\ldots\right)  $. We attempt to solve this recurrence by plugging
the recursive equation (\ref{sol.enum.smirnov.count.c.rec}) into itself:%
\begin{align*}
&  c\left(  n,k\right) \\
&  =n\left(  n-1\right)  ^{k-1}-\underbrace{c\left(  n,k-1\right)
}_{\substack{=n\left(  n-1\right)  ^{k-2}-c\left(  n,k-2\right)  \\\text{(by
(\ref{sol.enum.smirnov.count.c.rec}))}}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.enum.smirnov.count.c.rec})}\right) \\
&  =n\left(  n-1\right)  ^{k-1}-\left(  n\left(  n-1\right)  ^{k-2}%
-\underbrace{c\left(  n,k-2\right)  }_{\substack{=n\left(  n-1\right)
^{k-3}-c\left(  n,k-3\right)  \\\text{(by (\ref{sol.enum.smirnov.count.c.rec}%
))}}}\right) \\
&  =n\left(  n-1\right)  ^{k-1}-\left(  n\left(  n-1\right)  ^{k-2}-\left(
n\left(  n-1\right)  ^{k-3}-\underbrace{c\left(  n,k-3\right)  }_{=\cdots
}\right)  \right) \\
&  =\cdots\\
&  =n\left(  n-1\right)  ^{k-1}-\left(  n\left(  n-1\right)  ^{k-2}-\left(
n\left(  n-1\right)  ^{k-3}-\left(  \cdots-\left(  n\left(  n-1\right)
^{1}-\underbrace{c\left(  n,1\right)  }_{=0}\right)  \right)  \right)  \right)
\\
&  =n\left(  n-1\right)  ^{k-1}-\left(  n\left(  n-1\right)  ^{k-2}-\left(
n\left(  n-1\right)  ^{k-3}-\left(  \cdots-\left(  n\left(  n-1\right)
^{1}\right)  \right)  \right)  \right) \\
&  =n\left(  n-1\right)  ^{k-1}-n\left(  n-1\right)  ^{k-2}+n\left(
n-1\right)  ^{k-3}\pm\cdots+\left(  -1\right)  ^{k}n\left(  n-1\right)  ^{1}\\
&  =\sum_{i=0}^{k-2}\underbrace{\left(  -1\right)  ^{k-i}}_{=\left(
-1\right)  ^{k}\left(  -1\right)  ^{i}}n\underbrace{\left(  n-1\right)
^{i+1}}_{=\left(  n-1\right)  \left(  n-1\right)  ^{i}}=\left(  -1\right)
^{k}n\left(  n-1\right)  \cdot\sum_{i=0}^{k-2}\underbrace{\left(  -1\right)
^{i}\left(  n-1\right)  ^{i}}_{\substack{=\left(  \left(  -1\right)  \left(
n-1\right)  \right)  ^{i}\\=\left(  1-n\right)  ^{i}}}\\
&  =\left(  -1\right)  ^{k}n\left(  n-1\right)  \cdot\underbrace{\sum
_{i=0}^{k-2}\left(  1-n\right)  ^{i}}_{\substack{=\left(  1-n\right)
^{0}+\left(  1-n\right)  ^{1}+\cdots+\left(  1-n\right)  ^{k-2}\\=\dfrac
{1-\left(  1-n\right)  ^{k-1}}{1-\left(  1-n\right)  }\\\text{(by
(\ref{eq.exe.ind.geoser-b.eq2}))}}}=\left(  -1\right)  ^{k}n\left(
n-1\right)  \cdot\dfrac{1-\left(  1-n\right)  ^{k-1}}{1-\left(  1-n\right)
}\\
&  =\left(  -1\right)  ^{k}n\left(  n-1\right)  \cdot\dfrac{1-\left(
1-n\right)  ^{k-1}}{n}=\left(  -1\right)  ^{k}\left(  n-1\right)  \cdot\left(
1-\left(  1-n\right)  ^{k-1}\right) \\
&  =\left(  -1\right)  ^{k}\left(  n-1\right)  -\left(  -1\right)  ^{k}\left(
n-1\right)  \underbrace{\left(  1-n\right)  ^{k-1}}_{=\left(  -1\right)
^{k-1}\left(  n-1\right)  ^{k-1}}\\
&  =\left(  -1\right)  ^{k}\left(  n-1\right)  -\underbrace{\left(  -1\right)
^{k}\left(  n-1\right)  \left(  -1\right)  ^{k-1}\left(  n-1\right)  ^{k-1}%
}_{=-\left(  n-1\right)  ^{k}}\\
&  =\left(  n-1\right)  ^{k}+\left(  -1\right)  ^{k}\left(  n-1\right)  .
\end{align*}


Thus our answer is%
\[
c\left(  n,k\right)  =\left(  n-1\right)  ^{k}+\left(  -1\right)  ^{k}\left(
n-1\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }k\geq1.
\]
(If you found the way we derived this answer vertiginous, you can also prove
it by induction on $k$ using $c\left(  n,1\right)  =0$ and
(\ref{sol.enum.smirnov.count.c.rec}). See \cite[solution to Exercise 5
\textbf{(b)}]{17f-hw3s} for the details of this straightforward
proof.\footnote{I have denoted cyc-Smirnov tuples as \textquotedblleft rounded
smords\textquotedblright\ in \cite[Exercise 5 \textbf{(b)}]{17f-hw3s} (and
also denoted Smirnov tuples as \textquotedblleft smords\textquotedblright\ in
\cite[Exercise 5 \textbf{(a)}]{17f-hw3s}). This was mainly done in order to
make googling for solutions harder. (\textquotedblleft Smord\textquotedblright%
\ is short for \textquotedblleft Smirnov word\textquotedblright.)}) Thus, the
\# of cyc-Smirnov $k$-tuples is $c\left(  n,k\right)  =\left(  n-1\right)
^{k}+\left(  -1\right)  ^{k}\left(  n-1\right)  $. This solves Exercise
\ref{exe.enum.smirnov.count} \textbf{(c)}.
\end{proof}

(An aside for the graph-theoretically trained reader: Exercise
\ref{exe.enum.smirnov.count} is equivalent to some known formulas for the
chromatic polynomials of certain graphs. Indeed, the injective $k$-tuples can
be regarded as proper colorings of the complete graph $K_{k}$; the Smirnov
$k$-tuples as proper colorings of the path graph $P_{k}$; the cyc-Smirnov
$k$-tuples as proper colorings of the cycle graph $C_{k}$. From this point of
view, the answers to the three parts of Exercise \ref{exe.enum.smirnov.count}
are really computing the chromatic polynomials of these graphs $K_{k}$,
$P_{k}$ and $C_{k}$, and our approach to Exercise \ref{exe.enum.smirnov.count}
\textbf{(c)} is a particular case of the \textquotedblleft
deletion-contraction recurrence\textquotedblright\ for chromatic polynomials.
See \cite{White-chrom} or \cite[\S 5.9]{Guicha20} for brief introductions to
chromatic polynomials. Four different solutions of Exercise
\ref{exe.enum.smirnov.count} \textbf{(c)} -- all stated in the language of
chromatic polynomials -- can be found in \cite{LeeShi19}.)

\subsection{\label{sect.enum.perm}Permutations}

\subsubsection{\label{subsect.enum.perm.all}All permutations}

Next, let us count the permutations of a finite set (\cite[\S 2.4.4]{19fco}):

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

\end{theorem}

\begin{example}
Let $n=3$ and $X=\left[  n\right]  =\left[  3\right]  $. Then, Theorem
\ref{thm.enum.perms} says that $\left(  \text{\# of permutations of }X\right)
=n!=3!=6$. Here are the $6$ permutations of $X$ (written in two-line notation
-- i.e., the entries in the bottom row are the images of the entries in the
top row):%
\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*}

\end{example}

We shall prove Theorem \ref{thm.enum.perms} as a particular case of the
following fact:

\begin{theorem}
\label{thm.enum.bijs}Let $n\in\mathbb{N}$. Let $U$ and $V$ be two $n$-element
sets. Then,%
\[
\left(  \text{\# of bijections from }U\text{ to }V\right)  =n!.
\]

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.enum.bijs}.]The sets $U$ and $V$ are $n$-element
sets; hence, $\left\vert U\right\vert =n$ and $\left\vert V\right\vert =n$.
Thus, $\left\vert U\right\vert =n=\left\vert V\right\vert $. Therefore,
Theorem \ref{thm.php.php-inj-2} shows that every injective map from $U$ to $V$
is bijective. Conversely, every bijective map from $U$ to $V$ is injective (by
definition). Combining the preceding two sentences, we conclude that the
bijective maps from $U$ to $V$ are precisely the injective maps from $U$ to
$V$. Thus,%
\begin{align*}
&  \left(  \text{\# of bijective maps from }U\text{ to }V\right) \\
&  =\left(  \text{\# of injective maps from }U\text{ to }V\right) \\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\underbrace{\left(
n-n+1\right)  }_{=1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.thm.enum.maps.inj.1}),
applied to }A=U\text{, }B=V\text{ and }m=n\right) \\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots1=1\cdot2\cdot\cdots\cdot
n=n!.
\end{align*}
But \textquotedblleft bijection\textquotedblright\ means the same thing as
\textquotedblleft bijective map\textquotedblright. Hence,%
\[
\left(  \text{\# of bijections from }U\text{ to }V\right)  =\left(  \text{\#
of bijective maps from }U\text{ to }V\right)  =n!.
\]
This proves Theorem \ref{thm.enum.bijs}.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.enum.perms}.]The permutations of $X$ are the same
thing as the bijective maps from $X$ to $X$ (by the definition of
\textquotedblleft permutation\textquotedblright). In other words, they are the
same thing as the bijections from $X$ to $X$. Hence,%
\[
\left(  \text{\# of permutations of }X\right)  =\left(  \text{\# of bijections
from }X\text{ to }X\right)  =n!
\]
(by Theorem \ref{thm.enum.bijs}, applied to $U=X$ and $V=X$).This proves
Theorem \ref{thm.enum.perms}.
\end{proof}

\subsubsection{Permutations $\sigma$ with $\sigma\left(  1\right)
>\sigma\left(  2\right)  $}

The following notation is fairly standard in mathematics:

\begin{definition}
\label{def.enum.perms.Sn}Let $n\in\mathbb{N}$. The set of all permutations of
$\left[  n\right]  $ is denoted by $S_{n}$, and is called the $n$\textit{-th
symmetric group}.
\end{definition}

As we explained above, this set $S_{n}$ is indeed a group (in the sense of
abstract algebra) and thus deserves its name. In particular, the set $S_{n}$
(for each $n\in\mathbb{N}$) is closed under composition (i.e., if $f,g\in
S_{n}$, then $f\circ g\in S_{n}$) and closed under inversion (i.e., if $f\in
S_{n}$, then $f^{-1}\in S_{n}$).

(Some authors use notations like $\mathfrak{S}_{n}$, $\Sigma_{n}$ or
$\operatorname*{Sym}\left(  n\right)  $ instead of $S_{n}$; note that all of
these are variations on the letter \textquotedblleft S\textquotedblright.)

\begin{exercise}
\label{exe.enum.perms.sig1sig2}Let $n\geq2$ be an integer. How many
permutations $\sigma\in S_{n}$ satisfy $\sigma\left(  1\right)  >\sigma\left(
2\right)  $ ?
\end{exercise}

We shall outline two solutions to this exercise, as they illustrate two
different counting strategies that are both rather useful.

\begin{proof}
[First solution to Exercise \ref{exe.enum.perms.sig1sig2} (sketched).]This is
an outline; see \cite[proof of Proposition 0.5]{18s-mt1s} for a more detailed
writeup\footnote{Note that \cite[Proposition 0.5]{18s-mt1s} is not quite the
same as our Exercise \ref{exe.enum.perms.sig1sig2}, but it is completely
analogous; the only difference is that $\sigma\left(  1\right)  >\sigma\left(
2\right)  $ is replaced by $\sigma\left(  3\right)  >\sigma\left(  4\right)
$.}.

Recall that $S_{n}$ is the set of all permutations of $\left[  n\right]  $.
Thus,%
\[
\left\vert S_{n}\right\vert =\left(  \text{\# of permutations of }\left[
n\right]  \right)  =n!
\]
(by Theorem \ref{thm.enum.perms}, applied to $X=\left[  n\right]  $).

We shall say that a permutation $\sigma\in S_{n}$ is

\begin{itemize}
\item \textit{green} if it satisfies $\sigma\left(  1\right)  >\sigma\left(
2\right)  $;

\item \textit{red} if it satisfies $\sigma\left(  1\right)  <\sigma\left(
2\right)  $.
\end{itemize}

Every permutation $\sigma\in S_{n}$ is either green or red\footnote{Indeed,
every permutation $\sigma\in S_{n}$ is injective, and thus satisfies
$\sigma\left(  1\right)  \neq\sigma\left(  2\right)  $, so that it must
satisfy either $\sigma\left(  1\right)  >\sigma\left(  2\right)  $ or
$\sigma\left(  1\right)  <\sigma\left(  2\right)  $.}, but no permutation
$\sigma\in S_{n}$ can be both green and red at the same time\footnote{since
$\sigma\left(  1\right)  >\sigma\left(  2\right)  $ would contradict
$\sigma\left(  1\right)  <\sigma\left(  2\right)  $}. Hence, the set $S_{n}$
is the union of its two disjoint subsets $\left\{  \text{green permutations
}\sigma\in S_{n}\right\}  $ and $\left\{  \text{red permutations }\sigma\in
S_{n}\right\}  $. Thus, the sum rule yields%
\begin{equation}
\left\vert S_{n}\right\vert =\left\vert \left\{  \text{green permutations
}\sigma\in S_{n}\right\}  \right\vert +\left\vert \left\{  \text{red
permutations }\sigma\in S_{n}\right\}  \right\vert .
\label{sol.enum.perms.sig1sig2.1st.sum}%
\end{equation}


On the other hand, I claim that \textquotedblleft the colors are
equidistributed\textquotedblright: i.e., the number of green permutations
$\sigma\in S_{n}$ equals the number of red permutations $\sigma\in S_{n}$.

To prove this, I will construct a bijection from $\left\{  \text{green
permutations }\sigma\in S_{n}\right\}  $ to $\left\{  \text{red permutations
}\sigma\in S_{n}\right\}  $.

Indeed, the idea is simple: If $\sigma\in S_{n}$ is a green permutation, then
interchanging the first two values of $\sigma$\ \ \ \ \footnote{We consider
the values of a permutation $\sigma\in S_{n}$ to be implicitly listed in the
order $\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
n\right)  $. Thus, the \textquotedblleft first two values of $\sigma
$\textquotedblright\ are understood to be $\sigma\left(  1\right)  $ and
$\sigma\left(  2\right)  $. Interchanging these two values means that we
change the permutation so that the values $\sigma\left(  1\right)  $ and
$\sigma\left(  2\right)  $ become the values at $2$ and $1$, respectively
(i.e., they switch their roles).} yields a new permutation $\tau\in S_{n}$,
which is red (because interchanging the first two values $\sigma\left(
1\right)  $ and $\sigma\left(  2\right)  $ obviously inverts the inequality
$\sigma\left(  1\right)  >\sigma\left(  2\right)  $). Thus, we obtain a map%
\begin{align*}
f:\left\{  \text{green permutations }\sigma\in S_{n}\right\}   &
\rightarrow\left\{  \text{red permutations }\sigma\in S_{n}\right\}  ,\\
\sigma &  \mapsto\left(  \sigma\text{ with the first two values interchanged}%
\right)  .
\end{align*}
(More formally, \textquotedblleft$\sigma$ with the first two values
interchanged\textquotedblright\ can be defined as follows: Let $s_{1}$ be the
permutation of $\left[  n\right]  $ that swaps the numbers $1$ and $2$ while
leaving all other numbers unchanged. That is, $s_{1}$ is given by%
\[
s_{1}\left(  i\right)  =%
\begin{cases}
2, & \text{if }i=1;\\
1, & \text{if }i=2;\\
i, & \text{if }i\notin\left\{  1,2\right\}
\end{cases}
\ \ \ \ \ \ \ \ \ \ \text{for all }i\in\left[  n\right]  .
\]
Then, \textquotedblleft$\sigma$ with the first two values
interchanged\textquotedblright\ is the permutation $\sigma\circ s_{1}$ of
$\left[  n\right]  $. To wit, when we compose $\sigma$ with $s_{1}$, the first
two values $\sigma\left(  1\right)  $ and $\sigma\left(  2\right)  $ of
$\sigma$ get interchanged, while all other values of $\sigma$ stay at their places.)

So we have obtained a map%
\[
f:\left\{  \text{green permutations }\sigma\in S_{n}\right\}  \rightarrow
\left\{  \text{red permutations }\sigma\in S_{n}\right\}  .
\]
Likewise, we obtain a map%
\[
g:\left\{  \text{red permutations }\sigma\in S_{n}\right\}  \rightarrow
\left\{  \text{green permutations }\sigma\in S_{n}\right\}
\]
that is defined in the same way as $f$ (viz., it interchanges the first two
values of $\sigma$). The maps $f$ and $g$ are mutually inverse, because if we
interchange the first two values of a permutation $\sigma$ and subsequently
interchange them again, we end up back at our original permutation $\sigma$.
Hence, the map $f$ is invertible, and thus is a bijection. So we have found a
bijection from $\left\{  \text{green permutations }\sigma\in S_{n}\right\}  $
to $\left\{  \text{red permutations }\sigma\in S_{n}\right\}  $ (namely, $f$).
Therefore, the bijection principle yields%
\begin{equation}
\left\vert \left\{  \text{green permutations }\sigma\in S_{n}\right\}
\right\vert =\left\vert \left\{  \text{red permutations }\sigma\in
S_{n}\right\}  \right\vert . \label{sol.enum.perms.sig1sig2.1st.equal}%
\end{equation}


Now, (\ref{sol.enum.perms.sig1sig2.1st.sum}) becomes%
\begin{align*}
\left\vert S_{n}\right\vert  &  =\left\vert \left\{  \text{green permutations
}\sigma\in S_{n}\right\}  \right\vert +\underbrace{\left\vert \left\{
\text{red permutations }\sigma\in S_{n}\right\}  \right\vert }%
_{\substack{=\left\vert \left\{  \text{green permutations }\sigma\in
S_{n}\right\}  \right\vert \\\text{(by
(\ref{sol.enum.perms.sig1sig2.1st.equal}))}}}\\
&  =\left\vert \left\{  \text{green permutations }\sigma\in S_{n}\right\}
\right\vert +\left\vert \left\{  \text{green permutations }\sigma\in
S_{n}\right\}  \right\vert \\
&  =2\cdot\left\vert \left\{  \text{green permutations }\sigma\in
S_{n}\right\}  \right\vert .
\end{align*}
Hence,%
\[
\left\vert \left\{  \text{green permutations }\sigma\in S_{n}\right\}
\right\vert =\dfrac{1}{2}\underbrace{\left\vert S_{n}\right\vert }%
_{=n!}=\dfrac{1}{2}n!=n!/2.
\]
In other words, the number of all green permutations $\sigma\in S_{n}$ is
$n!/2$. In other words, the number of all permutations $\sigma\in S_{n}$
satisfying $\sigma\left(  1\right)  >\sigma\left(  2\right)  $ is $n!/2$
(because these permutations are precisely the green permutations $\sigma\in
S_{n}$). This solves Exercise \ref{exe.enum.perms.sig1sig2}.
\end{proof}

Our above solution was an example of \textquotedblleft counting by
symmetry\textquotedblright: We did not count the green permutations directly;
instead, we showed that they are in bijection with the remaining (i.e., red)
permutations $\sigma\in S_{n}$ (that is, we matched up each green permutation
with a red one), from which we concluded that they make up exactly half of the
set $S_{n}$; and this told us that there are $\dfrac{1}{2}\left\vert
S_{n}\right\vert =n!/2$ of them. This sort of reasoning is not so infrequent
in combinatorics; it often explains why answers to some counting problems turn
out to be representable as fractions (like $n!/2$), even though of course they
are integers.

Here is a more conventional way to solve Exercise
\ref{exe.enum.perms.sig1sig2}:

\begin{proof}
[Second solution to Exercise \ref{exe.enum.perms.sig1sig2} (sketched).]A
permutation $\sigma\in S_{n}$ is the same as an injective map $\sigma:\left[
n\right]  \rightarrow\left[  n\right]  $ (as we have already seen in our proof
of Theorem \ref{thm.enum.perms}). Thus, the following is a way to construct a
permutation $\sigma\in S_{n}$ satisfying $\sigma\left(  1\right)
>\sigma\left(  2\right)  $:

\begin{itemize}
\item First, we choose the \textbf{set} $\left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  \right\}  $. This set must be a $2$-element subset of
$\left[  n\right]  $ (indeed, we must have $\sigma\left(  1\right)  \neq
\sigma\left(  2\right)  $, since $\sigma$ must be injective), but is otherwise
arbitrary; thus, the number of options is the \# of all $2$-element subsets of
$\left[  n\right]  $. But the latter number is $\dbinom{n}{2}$ (by Theorem
\ref{thm.binom.comb}, applied to $S=\left[  n\right]  $ and $k=2$). Hence, the
number of options at this step is $\dbinom{n}{2}$.

Note that, once we have chosen the set $\left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  \right\}  $, the values $\sigma\left(  1\right)  $
and $\sigma\left(  2\right)  $ are uniquely determined, because the inequality
$\sigma\left(  1\right)  >\sigma\left(  2\right)  $ forces $\sigma\left(
1\right)  $ to be the largest element of this set and $\sigma\left(  2\right)
$ to be its smallest element.

\item Next, we choose the value $\sigma\left(  3\right)  $. This value must be
an element of the $\left(  n-2\right)  $-element set $\left[  n\right]
\setminus\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  \right\}
$; thus, there are $n-2$ options for it.

\item Next, we choose the value $\sigma\left(  4\right)  $. This value must be
an element of the $\left(  n-3\right)  $-element set $\left[  n\right]
\setminus\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\sigma\left(  3\right)  \right\}  $ (this is an $\left(  n-3\right)
$-element set because $\sigma\left(  1\right)  ,\sigma\left(  2\right)
,\sigma\left(  3\right)  $ are distinct); thus, there are $n-3$ options for it.

\item Next, we choose the value $\sigma\left(  5\right)  $. This value must be
an element of the $\left(  n-4\right)  $-element set $\left[  n\right]
\setminus\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\sigma\left(  3\right)  ,\sigma\left(  4\right)  \right\}  $; thus, there are
$n-4$ options for it.

\item And so on, until all $n$ values $\sigma\left(  1\right)  ,\sigma\left(
2\right)  ,\ldots,\sigma\left(  n\right)  $ are chosen. (Note that there will
be $n-\left(  n-1\right)  =1$ options for the last value $\sigma\left(
n\right)  $.)
\end{itemize}

\noindent Thus, the Dependent product rule shows that the total \# of
possibilities for how we can make these choices is%
\begin{align*}
&  \underbrace{\dbinom{n}{2}}_{\substack{=\dfrac{n\left(  n-1\right)  }%
{2}\\\text{(by (\ref{eq.exa.binom.small.nC2}))}}}\cdot\left(  n-2\right)
\left(  n-3\right)  \cdots1\\
&  =\dfrac{n\left(  n-1\right)  }{2}\cdot\left(  n-2\right)  \left(
n-3\right)  \cdots1=\dfrac{1}{2}\cdot\underbrace{n\left(  n-1\right)
\cdot\left(  n-2\right)  \left(  n-3\right)  \cdots1}_{=n\left(  n-1\right)
\cdots1=1\cdot2\cdot\cdots\cdot n=n!}\\
&  =\dfrac{1}{2}\cdot n!=n!/2.
\end{align*}
Hence, the \# of all permutations $\sigma\in S_{n}$ satisfying $\sigma\left(
1\right)  >\sigma\left(  2\right)  $ is $n!/2$. This solves Exercise
\ref{exe.enum.perms.sig1sig2} again.

(This solution followed the Hint in \cite[Remark 0.7]{18s-mt1s}.)
\end{proof}

\subsubsection{The average number of fixed points of a permutation}

Recall that for any $n\in\mathbb{N}$, we let $S_{n}$ denote the set of all
permutations of $\left[  n\right]  $.

For our next exercise, we need the following definition:

\begin{definition}
\label{def.enum.fixed}Let $X$ be a set. Let $f:X\rightarrow X$ be a map.

\textbf{(a)} A \textit{fixed point} of $f$ means an element $x\in X$ such that
$f\left(  x\right)  =x$.

\textbf{(b)} We let $\operatorname*{Fix}f$ denote the set of all fixed points
of $f$. (Thus, $\operatorname*{Fix}f=\left\{  x\in X\ \mid\ f\left(  x\right)
=x\right\}  $.)
\end{definition}

\begin{exercise}
\label{exe.perm.sumFix}Let $n$ be a positive integer. Prove that $\sum_{w\in
S_{n}}\left\vert \operatorname*{Fix}w\right\vert =n!$.
\end{exercise}

In other words, this exercise states that the average number of fixed points
of a permutation of $\left[  n\right]  $ is $1$.

Exercise \ref{exe.perm.sumFix} was Problem 1 at
\href{http://artofproblemsolving.com/wiki/index.php?title=1987_IMO_Problems/Problem_1}{the
International Mathematical Olympiad (IMO) 1987}. We give a solution using some
(very basic) probability theory (specifically, the linearity of expectation):

\begin{proof}
[Solution to Exercise \ref{exe.perm.sumFix} (sketched).]We shall use the
language of probability (specifically, discrete random variables and their
expected values). See \cite[\S 6.1]{GriSne07} for a quick refresher. Note that
our solution can just as well be restated as a purely combinatorial argument
(using interchange of summation signs instead of linearity of expectation).

We have
\begin{equation}
\left\vert S_{n}\right\vert =n! \label{sol.perm.sumFix.1}%
\end{equation}
(indeed, this can be shown as in the First solution to Exercise
\ref{exe.enum.perms.sig1sig2}).

Our goal is to prove that $\sum_{w\in S_{n}}\left\vert \operatorname*{Fix}%
w\right\vert =n!$. In other words, our goal is to prove that $\sum_{w\in
S_{n}}\left\vert \operatorname*{Fix}w\right\vert =\left\vert S_{n}\right\vert
$ (since $\left\vert S_{n}\right\vert =n!$). In other words, our goal is to
prove that $\dfrac{1}{\left\vert S_{n}\right\vert }\sum_{w\in S_{n}}\left\vert
\operatorname*{Fix}w\right\vert =1$. The left hand side of this equality is
the average of $\left\vert \operatorname*{Fix}w\right\vert $ when $w$ ranges
over all of $S_{n}$. In other words, it is the expected value of $\left\vert
\operatorname*{Fix}\sigma\right\vert $ when $\sigma$ is a discrete random
variable uniformly distributed over $S_{n}$. This suggests that we use random variables.

We consider a discrete random variable $\sigma$ that is uniformly distributed
over $S_{n}$. We use the notation $\Pr\left(  A\right)  $ for the probability
of an event $A$, and we use the notation $\operatorname*{E}\left(  X\right)  $
for the expected value of a numerically-valued random variable $X$. It is
known that any $n$ numerically-valued random variables $X_{1},X_{2}%
,\ldots,X_{n}$ satisfy%
\begin{equation}
\operatorname*{E}\left(  X_{1}+X_{2}+\cdots+X_{n}\right)  =\operatorname*{E}%
\left(  X_{1}\right)  +\operatorname*{E}\left(  X_{2}\right)  +\cdots
+\operatorname*{E}\left(  X_{n}\right)  . \label{sol.perm.sumFix.linexp}%
\end{equation}
(In fact, this is part of the principle of \textit{linearity of expectation}.
See \cite[Theorem 6.2]{GriSne07} for the case $n=2$; the general case follows
by induction on $n$.)

Now, we claim that each $w\in S_{n}$ satisfies\footnote{We are using the
Iverson bracket notation (see Definition \ref{def.iverson}) here.}%
\begin{equation}
\left\vert \operatorname*{Fix}w\right\vert =\left[  w\left(  1\right)
=1\right]  +\left[  w\left(  2\right)  =2\right]  +\cdots+\left[  w\left(
n\right)  =n\right]  . \label{sol.perm.sumFix.absFix=}%
\end{equation}
[\textit{Proof:} Let $w\in S_{n}$. Let $i=\left\vert \operatorname*{Fix}%
w\right\vert $. Thus, $w$ has $i$ fixed points. If $x$ is one of these $i$
fixed points, then $w\left(  x\right)  =x$ and thus $\left[  w\left(
x\right)  =x\right]  =1$; on the other hand, if $x$ is not a fixed point of
$w$, then $w\left(  x\right)  \neq x$ and thus $\left[  w\left(  x\right)
=x\right]  =0$. Hence, the sum on the right hand side of
(\ref{sol.perm.sumFix.absFix=}) has $i$ addends equal to $1$ (one such addend
for each of the $i$ fixed points of $w$), while the remaining addends are $0$.
Therefore, the right hand side of (\ref{sol.perm.sumFix.absFix=}) equals
$i\cdot1+\left(  n-i\right)  \cdot0=i=\left\vert \operatorname*{Fix}%
w\right\vert $, and thus (\ref{sol.perm.sumFix.absFix=}) is proved.]

Now, applying (\ref{sol.perm.sumFix.absFix=}) to our random permutation
$\sigma$, we find%
\[
\left\vert \operatorname*{Fix}\sigma\right\vert =\left[  \sigma\left(
1\right)  =1\right]  +\left[  \sigma\left(  2\right)  =2\right]
+\cdots+\left[  \sigma\left(  n\right)  =n\right]  .
\]
Hence,%
\begin{align}
\operatorname*{E}\left(  \left\vert \operatorname*{Fix}\sigma\right\vert
\right)   &  =\operatorname*{E}\left(  \left[  \sigma\left(  1\right)
=1\right]  +\left[  \sigma\left(  2\right)  =2\right]  +\cdots+\left[
\sigma\left(  n\right)  =n\right]  \right) \nonumber\\
&  =\operatorname*{E}\left(  \left[  \sigma\left(  1\right)  =1\right]
\right)  +\operatorname*{E}\left(  \left[  \sigma\left(  2\right)  =2\right]
\right)  +\cdots+\operatorname*{E}\left(  \left[  \sigma\left(  n\right)
=n\right]  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.perm.sumFix.linexp})}\right)
\nonumber\\
&  =\sum_{i=1}^{n}\operatorname*{E}\left(  \left[  \sigma\left(  i\right)
=i\right]  \right)  . \label{sol.perm.sumFix.EFix=1}%
\end{align}


Now, let us fix an $i\in\left[  n\right]  $. What is the expected value
$\operatorname*{E}\left(  \left[  \sigma\left(  i\right)  =i\right]  \right)
$ ?

If $E$ is any event, then $\operatorname*{E}\left(  \left[  E\right]  \right)
=\Pr\left(  E\right)  $ (since $\left[  E\right]  =1$ if $E$ holds, and
$\left[  E\right]  =0$ otherwise). Thus, $\operatorname*{E}\left(  \left[
\sigma\left(  i\right)  =i\right]  \right)  =\Pr\left(  \sigma\left(
i\right)  =i\right)  $. Now, what is the probability that $\sigma\left(
i\right)  =i$ ?

Here are two ways of answering this question:\footnote{We are \textbf{not}
doing a proof by double counting here, so we only need to answer this question
in one way. I am showing two ways just for the sake of illustrating different
approaches.}

\begin{itemize}
\item One way is to use symmetry. Namely, since $\sigma$ is uniformly
distributed across $S_{n}$, the random variable $\sigma\left(  i\right)  $
will take each of the $n$ possible values $1,2,\ldots,n$ with equal
probabilities (for symmetry reasons\footnote{For the skeptics, let me spell
these symmetry reasons out:
\par
We must show that if $u$ and $v$ are any two elements of $\left[  n\right]  $,
then the probability of $\sigma\left(  i\right)  =u$ equals the probability of
$\sigma\left(  i\right)  =v$.
\par
So let $u,v\in\left[  n\right]  $. Then, there exists a permutation $t\in
S_{n}$ that sends $u$ to $v$. (For example, we can define $t$ to be the
permutation of $\left[  n\right]  $ that swaps $u$ and $v$ and leaves the
remaining elements of $\left[  n\right]  $ unchanged.) Consider such a $t$.
The inverse $t^{-1}$ of this permutation $t$ is then a permutation of $\left[
n\right]  $ that sends $v$ to $u$.
\par
Now, consider the map%
\begin{align*}
\Phi:\left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =u\right\}   &
\rightarrow\left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =v\right\}  ,\\
w  &  \mapsto t\circ w.
\end{align*}
It is easy to see that this map $\Phi$ is well-defined (i.e., if $w\in S_{n}$
satisfies $w\left(  i\right)  =u$, then $t\circ w\in S_{n}$ and $\left(
t\circ w\right)  \left(  i\right)  =v$). Likewise, consider the map%
\begin{align*}
\Psi:\left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =v\right\}   &
\rightarrow\left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =u\right\}  ,\\
w  &  \mapsto t^{-1}\circ w.
\end{align*}
Then, it is easy to see that the maps $\Phi$ and $\Psi$ are mutually inverse
(for example, $\Phi\circ\Psi=\operatorname*{id}$ is because each permutation
$w\in S_{n}$ satisfies $\left(  \Phi\circ\Psi\right)  \left(  w\right)
=\Phi\left(  \Psi\left(  w\right)  \right)  =t\circ\left(  t^{-1}\circ
w\right)  =\underbrace{\left(  t\circ t^{-1}\right)  }_{=\operatorname*{id}%
}\circ w=w=\operatorname*{id}\left(  w\right)  $). Hence, the map $\Phi$ is
invertible, i.e., is bijective. The bijection principle thus yields%
\begin{equation}
\left\vert \left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =u\right\}
\right\vert =\left\vert \left\{  w\in S_{n}\ \mid\ w\left(  i\right)
=v\right\}  \right\vert . \label{sol.perm.sumFix.fn5.3}%
\end{equation}
\par
However, $\sigma$ is uniformly distributed over $S_{n}$; thus,
\[
\left(  \text{the probability of }\sigma\left(  i\right)  =u\right)
=\dfrac{\left\vert \left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =u\right\}
\right\vert }{\left\vert S_{n}\right\vert }.
\]
Likewise,%
\[
\left(  \text{the probability of }\sigma\left(  i\right)  =v\right)
=\dfrac{\left\vert \left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =v\right\}
\right\vert }{\left\vert S_{n}\right\vert }.
\]
The right hand sides of these two equalities are equal (because of
(\ref{sol.perm.sumFix.fn5.3})). Hence, the left hand sides are also equal. In
other words, the probability of $\sigma\left(  i\right)  =u$ equals the
probability of $\sigma\left(  i\right)  =v$. This is precisely what we wanted
to show.}). In other words, the $n$ probabilities%
\[
\Pr\left(  \sigma\left(  i\right)  =1\right)  ,\ \ \Pr\left(  \sigma\left(
i\right)  =2\right)  ,\ \ \ldots,\ \ \Pr\left(  \sigma\left(  i\right)
=n\right)
\]
are equal. But the sum of these $n$ probabilities is%
\[
\Pr\left(  \sigma\left(  i\right)  =1\right)  +\Pr\left(  \sigma\left(
i\right)  =2\right)  +\cdots+\Pr\left(  \sigma\left(  i\right)  =n\right)  =1
\]
(since $\sigma\left(  i\right)  $ must take one of the $n$ values
$1,2,\ldots,n$, and of course cannot take more than one of them
simultaneously). Hence, these $n$ probabilities must all equal $\dfrac{1}{n}$
(because if we are given $n$ equal numbers whose sum is $1$, then each of
these $n$ numbers must be $\dfrac{1}{n}$). In other words, we have $\Pr\left(
\sigma\left(  i\right)  =j\right)  =\dfrac{1}{n}$ for each $j\in\left[
n\right]  $. Applying this to $j=i$, we obtain $\Pr\left(  \sigma\left(
i\right)  =i\right)  =\dfrac{1}{n}$.

\item Alternatively, we can just count the permutations $w\in S_{n}$
satisfying $w\left(  i\right)  =i$. Indeed, we can construct such a
permutation $w$ by choosing its values $w\left(  1\right)  ,w\left(  2\right)
,\ldots,w\left(  i-1\right)  ,w\left(  i+1\right)  ,w\left(  i+2\right)
,\ldots,w\left(  n\right)  $ in order (skipping $w\left(  i\right)  $, since
$w\left(  i\right)  $ is already predetermined to be $i$). Each value must
differ both from $i$ and from all previously chosen values (since $w$ must be
injective), so we have $n-1$ options for the first value, $n-2$ options for
the second, $n-3$ for the third, and so on. Thus, by the dependent product
rule, the total \# of possibilities for how we can make these choices is
$\left(  n-1\right)  \left(  n-2\right)  \cdots1=1\cdot2\cdot\cdots
\cdot\left(  n-1\right)  =\left(  n-1\right)  !$. Therefore,%
\[
\left(  \text{\# of permutations }w\in S_{n}\text{ satisfying }w\left(
i\right)  =i\right)  =\left(  n-1\right)  !.
\]
In other words,%
\begin{equation}
\left\vert \left\{  w\in S_{n}\ \mid\ w\left(  i\right)  =i\right\}
\right\vert =\left(  n-1\right)  !. \label{sol.perm.sumFix.4}%
\end{equation}
But since $\sigma$ is uniformly distributed over $S_{n}$, we have%
\begin{align*}
\Pr\left(  \sigma\left(  i\right)  =i\right)   &  =\dfrac{\left\vert \left\{
w\in S_{n}\ \mid\ w\left(  i\right)  =i\right\}  \right\vert }{\left\vert
S_{n}\right\vert }\\
&  =\dfrac{\left(  n-1\right)  !}{n!}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.perm.sumFix.4}) and (\ref{sol.perm.sumFix.1})}\right) \\
&  =\dfrac{1}{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n!=n\cdot\left(
n-1\right)  !\right)  .
\end{align*}

\end{itemize}

Thus, we have shown that $\Pr\left(  \sigma\left(  i\right)  =i\right)
=\dfrac{1}{n}$, so that
\begin{equation}
\operatorname*{E}\left(  \left[  \sigma\left(  i\right)  =i\right]  \right)
=\Pr\left(  \sigma\left(  i\right)  =i\right)  =\dfrac{1}{n}.
\label{sol.perm.sumFix.Ei}%
\end{equation}


Forget that we fixed $i$. We thus have proved (\ref{sol.perm.sumFix.Ei}) for
each $i\in\left[  n\right]  $. Hence, (\ref{sol.perm.sumFix.EFix=1}) becomes%
\[
\operatorname*{E}\left(  \left\vert \operatorname*{Fix}\sigma\right\vert
\right)  =\sum_{i=1}^{n}\underbrace{\operatorname*{E}\left(  \left[
\sigma\left(  i\right)  =i\right]  \right)  }_{\substack{=\dfrac{1}%
{n}\\\text{(by (\ref{sol.perm.sumFix.Ei}))}}}=\sum_{i=1}^{n}\dfrac{1}%
{n}=n\cdot\dfrac{1}{n}=1.
\]


But the definition of expected value yields $\operatorname*{E}\left(
\left\vert \operatorname*{Fix}\sigma\right\vert \right)  =\dfrac{1}{\left\vert
S_{n}\right\vert }\sum_{w\in S_{n}}\left\vert \operatorname*{Fix}w\right\vert
$ (since $\sigma$ is uniformly distributed over $S_{n}$). Hence,%
\[
\dfrac{1}{\left\vert S_{n}\right\vert }\sum_{w\in S_{n}}\left\vert
\operatorname*{Fix}w\right\vert =\operatorname*{E}\left(  \left\vert
\operatorname*{Fix}\sigma\right\vert \right)  =1,
\]
so that $\sum_{w\in S_{n}}\left\vert \operatorname*{Fix}w\right\vert
=\left\vert S_{n}\right\vert =n!$. This solves Exercise \ref{exe.perm.sumFix}.
\end{proof}

See \cite[solution to Exercise 2]{17f-hw7s} for the same solution, rewritten
in elementary combinatorial language. See also \cite[Exercise 4]{19fco-mt2s}
for a solution to the following generalization:

\begin{exercise}
\label{exe.perm.sumFixk}Let $k\in\mathbb{N}$. Let $n\geq k$ be an integer.
Prove that%
\[
\sum_{w\in S_{n}}\dbinom{\left\vert \operatorname*{Fix}w\right\vert }%
{k}=\left(  n-k\right)  !\dbinom{n}{k}=\dfrac{n!}{k!}.
\]

\end{exercise}

\subsection{Double counting}

Counting is not just an end in itself; it can also be used to prove
equalities. To wit, many counting problems can be solved in several ways,
yielding different-looking results. (For example, the counting problem
\textquotedblleft how many subsets does the set $\left[  n\right]  $
have?\textquotedblright\ has answer $2^{n}$ because of Theorem
\ref{thm.enum.subsets}; but it also has answer $\sum_{k=0}^{n}\dbinom{n}{k}$
because of Theorem \ref{thm.binom.comb}\footnote{In more detail: Any subset of
$\left[  n\right]  $ has size $k$ for some $k\in\left\{  0,1,\ldots,n\right\}
$. Thus, the sum rule yields%
\[
\left(  \text{\# of subsets of }\left[  n\right]  \right)  =\sum_{k=0}%
^{n}\underbrace{\left(  \text{\# of subsets of }\left[  n\right]  \text{
having size }k\right)  }_{\substack{=\left(  \text{\# of }k\text{-element
subsets of }\left[  n\right]  \right)  \\=\dbinom{n}{k}\\\text{(by Theorem
\ref{thm.binom.comb})}}}=\sum_{k=0}^{n}\dbinom{n}{k},
\]
qed.}.) Of course, these results must therefore be equal (so, for example, the
previous parenthetical sentence entails $2^{n}=\sum_{k=0}^{n}\dbinom{n}{k}$,
which is precisely the claim of Corollary \ref{cor.binom.2pown}). Hence, by
answering a counting problem in two different ways, we obtain an equality
\textquotedblleft for free\textquotedblright. Thus we obtain a powerful method
for proving equalities: Try to find a counting problem such that both sides of
the equality are answers to this problem. This strategy is known as
\textit{double counting}. Let us see a simple but important example of this strategy:

\subsubsection{The Chu--Vandermonde identity for nonnegative integers}

\begin{proposition}
[Chu--Vandermonde identity for nonnegative integers]%
\label{prop.binom.vanderNN}Let $n\in\mathbb{N}$ and $x,y\in\mathbb{N}$. Then,%
\[
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\]

\end{proposition}

For example, for $n=2$, this equality states that%
\begin{align*}
\dbinom{x+y}{2}  &  =\sum_{k=0}^{2}\dbinom{x}{k}\dbinom{y}{2-k}%
=\underbrace{\dbinom{x}{0}}_{=1}\dbinom{y}{2}+\underbrace{\dbinom{x}{1}}%
_{=x}\underbrace{\dbinom{y}{1}}_{=y}+\dbinom{x}{2}\underbrace{\dbinom{y}{0}%
}_{=1}\\
&  =\dbinom{y}{2}+xy+\dbinom{x}{2}=\dbinom{x}{2}+xy+\dbinom{y}{2}.
\end{align*}


\begin{proof}
[Proof of Proposition \ref{prop.binom.vanderNN} (sketched).]We apply double
counting. The counting problem we want to solve in two ways is the following:
Let $S$ be the $\left(  x+y\right)  $-element set $\left\{  1,2,\ldots
,x\right\}  \cup\left\{  -1,-2,\ldots,-y\right\}  $. How many $n$-element
subsets does $S$ have? Let us answer this question in two ways:\footnote{Here
is an illustration of the case $x=5$, $y=3$ and $n=4$ (with the green blob
being the $n$-element subset):%
\[%
%TCIMACRO{\TeXButton{tikz vandermonde proof}{\begin{tikzpicture}
%\filldraw
%[very thick, fill=green!20!white, draw=green!50!black] plot[smooth] coordinates {(-2, 1) (-2.2, 0.8) (-2.5, 0) (-2, -2) (3.5, -2) (4.5, 0) (4, 1) (3, 1) (2.5, 0) (2, -1) (1.5, 0) (1, 1) (0.5, 0) (-1, -1) (-1.5, 0) (-1.8, 0.8)}
%-- cycle;
%\node(1) at (1, 0) {};
%\node(2) at (2, 0) {};
%\node(3) at (3, 0) {};
%\node(4) at (4, 0) {};
%\node(5) at (5, 0) {};
%\node(-1) at (-1, 0) {};
%\node(-2) at (-2, 0) {};
%\node(-3) at (-3, 0) {};
%\draw[very thick, red] (0, -1) -- (0, 1);
%\fill(1) circle (2pt) node[below] {$1$};
%\fill(2) circle (2pt) node[below] {$2$};
%\fill(3) circle (2pt) node[below] {$3$};
%\fill(4) circle (2pt) node[below] {$4$};
%\fill(5) circle (2pt) node[below] {$5$};
%\fill(-1) circle (2pt) node[below] {$-1$};
%\fill(-2) circle (2pt) node[below] {$-2$};
%\fill(-3) circle (2pt) node[below] {$-3$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\filldraw
[very thick, fill=green!20!white, draw=green!50!black] plot[smooth] coordinates {(-2, 1) (-2.2, 0.8) (-2.5, 0) (-2, -2) (3.5, -2) (4.5, 0) (4, 1) (3, 1) (2.5, 0) (2, -1) (1.5, 0) (1, 1) (0.5, 0) (-1, -1) (-1.5, 0) (-1.8, 0.8)}
-- cycle;
\node(1) at (1, 0) {};
\node(2) at (2, 0) {};
\node(3) at (3, 0) {};
\node(4) at (4, 0) {};
\node(5) at (5, 0) {};
\node(-1) at (-1, 0) {};
\node(-2) at (-2, 0) {};
\node(-3) at (-3, 0) {};
\draw[very thick, red] (0, -1) -- (0, 1);
\fill(1) circle (2pt) node[below] {$1$};
\fill(2) circle (2pt) node[below] {$2$};
\fill(3) circle (2pt) node[below] {$3$};
\fill(4) circle (2pt) node[below] {$4$};
\fill(5) circle (2pt) node[below] {$5$};
\fill(-1) circle (2pt) node[below] {$-1$};
\fill(-2) circle (2pt) node[below] {$-2$};
\fill(-3) circle (2pt) node[below] {$-3$};
\end{tikzpicture}%
%EndExpansion
\]
}

\textit{First way:} The answer is $\dbinom{x+y}{n}$. Indeed, this follows from
Theorem \ref{thm.binom.comb} (applied to $x+y$, $S$ and $n$ instead of $n$,
$S$ and $k$), since $S$ is an $\left(  x+y\right)  $-element set.

\textit{Second way:} An $n$-element subset of $S$ has at least $0$ and at most
$n$ positive elements. Thus, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of }n\text{-element subsets of }S\right) \\
&  =\sum_{k=0}^{n}\left(  \text{\# of }n\text{-element subsets of }S\text{
having exactly }k\text{ positive elements}\right)  .
\end{align*}
Now, let us compute the addends on the right hand side of this equality. (Note
that some of these addends can be $0$, but this needs not worry us: The
argument we will be making in the following paragraph applies to them just as
well as it does to the others.)

Fix $k\in\left\{  0,1,\ldots,n\right\}  $. How many $n$-element subsets $I$ of
$S$ have exactly $k$ positive elements? Such a subset $I$ must have exactly
$k$ positive elements, and thus must have exactly $n-k$ negative elements
(since it must have $n$ elements in total, and $0$ is not available because
$0\notin S$). Hence, we can construct such a subset $I$ as follows:

\begin{itemize}
\item First, we choose the $k$ positive elements of $I$. (There are
$\dbinom{x}{k}$ options for them, by Theorem \ref{thm.binom.comb}%
\footnote{since they must belong to the $x$-element set $\left\{
1,2,\ldots,x\right\}  $}.)

\item Then, we choose the $n-k$ negative elements of $I$. (There are
$\dbinom{y}{n-k}$ options for them, by Theorem \ref{thm.binom.comb}%
\footnote{since they must belong to the $y$-element set $\left\{
-1,-2,\ldots,-y\right\}  $}.)
\end{itemize}

\noindent Thus, the product rule shows that the total \# of possibilities for
how we can make these choices is $\dbinom{x}{k}\dbinom{y}{n-k}$. Thus,%
\begin{align}
&  \left(  \text{\# of }n\text{-element subsets of }S\text{ having exactly
}k\text{ positive elements}\right) \nonumber\\
&  =\dbinom{x}{k}\dbinom{y}{n-k}. \label{pf.prop.binom.vanderNN.4}%
\end{align}


Now, forget that we fixed $k$. Hence, we have proved
(\ref{pf.prop.binom.vanderNN.4}) for each $k\in\left\{  0,1,\ldots,n\right\}
$.

Now,%
\begin{align*}
&  \left(  \text{\# of }n\text{-element subsets of }S\right) \\
&  =\sum_{k=0}^{n}\underbrace{\left(  \text{\# of }n\text{-element subsets of
}S\text{ having exactly }k\text{ positive elements}\right)  }%
_{\substack{=\dbinom{x}{k}\dbinom{y}{n-k}\\\text{(by
(\ref{pf.prop.binom.vanderNN.4}))}}}\\
&  =\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\end{align*}
So the answer to our counting problem is $\sum_{k=0}^{n}\dbinom{x}{k}%
\dbinom{y}{n-k}$.

Now, we have answered our counting problem in two ways. The first way yielded
$\dbinom{x+y}{n}$ as an answer; the second way yielded $\sum_{k=0}^{n}%
\dbinom{x}{k}\dbinom{y}{n-k}$. Comparing these answers, we obtain
$\dbinom{x+y}{n}=\sum\limits_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}$. This
proves Proposition \ref{prop.binom.vanderNN}.

(See \cite[proof of Lemma 2.17.15]{19s} or \cite[\S 2.6.1, Second proof of
Theorem 2.6.1 for $x,y\in\mathbb{N}$]{19fco} for different writeups of this proof.)
\end{proof}

The words \textquotedblleft for nonnegative integers\textquotedblright\ in the
name of Proposition \ref{prop.binom.vanderNN} hint at the fact that there is a
more general version of the Chu--Vandermonde identity; we shall see this soon.

\subsubsection{The trinomial revision formula for nonnegative integers}

Here is another identity that can be shown using double counting:

\begin{proposition}
[Trinomial revision formula for nonnegative integers]%
\label{prop.binom.trin-revNN}Let $n,a,b\in\mathbb{N}$. Then,%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\]

\end{proposition}

Proposition \ref{prop.binom.trin-revNN} is known as the \textit{trinomial
revision formula}, since the product $\dbinom{n}{a}\dbinom{a}{b}$ of two
binomial coefficients is known as a \textquotedblleft trinomial
coefficient\textquotedblright, and this proposition allows \textquotedblleft
revising\textquotedblright\ it (i.e., rewriting it as a different product of
two binomial coefficients). It is a useful tool in manipulating binomial
coefficients. Again, we have not stated it in the greatest possible
generality, but we have to start somewhere. Note that particular cases of
Proposition \ref{prop.binom.trin-revNN} have already been used twice in
solutions of problems posed above\footnote{Namely, the equality
(\ref{sol.binom.noncoprime-ML770.tri-rev}) in the solution to Exercise
\ref{exe.binom.noncoprime-ML770} and the equality
(\ref{sol.binom.sum-frac-akbk.trirev}) in the solution to Exercise
\ref{exe.binom.sum-frac-akbk} are particular cases of Proposition
\ref{prop.binom.trin-revNN}.}.

\begin{proof}
[Proof of Proposition \ref{prop.binom.trin-revNN}.]We will use double counting
again. Consider the following counting problem: Assume you have $n$ people.
How many ways are there to choose a \textit{committee} consisting of $a$ of
these $n$ people, and also choose a \textit{subcommittee} consisting of $b$
people from the committee?

Throwing away the unnecessary anthropomorphism, we can restate this problem in
a more convenient language as follows: Fix an $n$-element set $N$ (whose
elements are our $n$ people). We want to count all pairs $\left(  A,B\right)
$, where $A$ is an $a$-element subset of $N$ (this will be our committee) and
$B$ is a $b$-element subset of $A$ (this will be our
subcommittee).\footnote{Here is a symbolic picture of this situation:%
\[
\begin{tikzpicture}
\draw[fill=yellow!50] (0.5, 0.5) rectangle +(6, 3);
\draw[fill=green!50] (3, 2) ellipse (2 and 1);
\draw[fill=red!50] (2, 2) ellipse (0.5 and 0.5);
\node at (2, 2) {$B$};
\node at (4, 2) {$A$};
\node at (6, 3) {$N$};
\end{tikzpicture}\ \ .
\]
} In other words, we want to count all pairs $\left(  A,B\right)  $ of sets
satisfying $B\subseteq A\subseteq N$ and $\left\vert A\right\vert =a$ and
$\left\vert B\right\vert =b$. We shall refer to such pairs as \textit{CS
pairs}\footnote{short for \textquotedblleft committee-subcommittee
pairs\textquotedblright}, and we shall count their \# in two ways\footnote{We
will be using Theorem \ref{thm.binom.comb} in both of these ways.}:

\textit{First way:} In order to construct a CS pair $\left(  A,B\right)  $, we
first choose the committee $A$ and then choose its subcommittee $B$. We have
$\dbinom{n}{a}$ many options for $A$ (because $A$ has to be an $a$-element
subset of the $n$-element set $N$); then, after choosing $A$, we have
$\dbinom{a}{b}$ many options for $B$ (because $B$ has to be a $b$-element
subset of $A$). Thus, by the dependent product rule, the total \# of CS pairs
is $\dbinom{n}{a}\dbinom{a}{b}$.

\textit{Second way:} In order to construct a CS pair $\left(  A,B\right)  $,
we first choose the subcommittee $B$ and then choose the committee $A$. We
have $\dbinom{n}{b}$ many options for $B$ (because $B$ has to be a $b$-element
subset of the $n$-element set $N$). After choosing $B$, how many options do we
have for $A$ ? The committee $A$ has to be an $a$-element subset of $N$, but
it is also required to contain the (already chosen) subcommittee $B$ as a
subset, so that $b$ of its $a$ elements are already decided. We only need to
choose the remaining $a-b$ elements of $A$. These $a-b$ elements have to come
from the $\left(  n-b\right)  $-element set $N\setminus B$ (because the
elements of $B$ have already been chosen to lie in $A$). Thus, we are choosing
an $\left(  a-b\right)  $-element subset of the $\left(  n-b\right)  $-element
set $N\setminus B$. The \# of ways to do this is $\dbinom{n-b}{a-b}%
$.\ \ \ \ \footnote{Here, we need to know that $n-b\in\mathbb{N}$. Why is this
the case? It does not follow from the assumptions of Proposition
\ref{prop.binom.trin-revNN}, since we have \textbf{not} assumed that $b\leq
n$. However, it does follow from the fact that we are in the second step of
our construction of $\left(  A,B\right)  $ and therefore already have chosen a
$b$-element subset $B$ of $N$; indeed, this fact clearly entails that
$b=\left\vert B\right\vert \leq\left\vert N\right\vert =n$. If we didn't have
$b\leq n$, we could not have chosen a $b$-element subset $B$ of $N$ in the
first place, and thus we would have never gotten to the point where we are
choosing $A$.} Therefore, we have $\dbinom{n-b}{a-b}$ many options for
choosing $A$. Hence, by the dependent product rule, the total \# of CS pairs
is $\dbinom{n}{b}\dbinom{n-b}{a-b}$.

Now, we have computed the \# of CS pairs in two different ways. The first way
gave us the result $\dbinom{n}{a}\dbinom{a}{b}$, while the second way gave us
the result $\dbinom{n}{b}\dbinom{n-b}{a-b}$. Comparing these results, we find
$\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}$. Thus, Proposition
\ref{prop.binom.trin-revNN} is proven.
\end{proof}

See \cite[\S 2.2.2]{19fco} for a more formal version of the above proof.
Because of this proof, Proposition \ref{prop.binom.trin-revNN} is sometimes
called the \textquotedblleft\textit{committee-subcommittee identity}%
\textquotedblright.

\subsubsection{The polynomial identity trick}

We have proved both the Chu--Vandermonde identity and the Trinomial revision
formula by double counting. These proofs relied heavily on the combinatorial
interpretation of binomial coefficients (Theorem \ref{thm.binom.comb}). The
latter interpretation makes sense only for binomial coefficients $\dbinom
{n}{k}$ with $n\in\mathbb{N}$; it says nothing about binomial coefficients
$\dbinom{n}{k}$ in which $n$ is negative or non-integer. Nevertheless, the
Chu--Vandermonde identity and the Trinomial revision formula can be
generalized to non-integer values of some of the arguments:\footnote{We are
using the set $\mathbb{C}$ of complex numbers in stating the following two
theorems. Readers unfamiliar with complex numbers can replace the symbol
$\mathbb{C}$ by $\mathbb{R}$ throughout this section; this will result in a
slight loss of generality, but this generality is not important for what we
are doing. (None of our arguments in this section depend on whether our
numbers are real or complex.)}

\begin{theorem}
[Chu--Vandermonde identity]\label{thm.binom.vanderRR}Let $n\in\mathbb{N}$ and
$x,y\in\mathbb{C}$. Then,%
\[
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\]

\end{theorem}

\begin{theorem}
[Trinomial revision formula]\label{thm.binom.trin-revRR}Let $n,a,b\in
\mathbb{C}$. Then,%
\[
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\]

\end{theorem}

Clearly, Proposition \ref{prop.binom.vanderNN} and Proposition
\ref{prop.binom.trin-revNN} are particular cases of Theorem
\ref{thm.binom.vanderRR} and Theorem \ref{thm.binom.trin-revRR} (which is why
we have called them \textquotedblleft propositions\textquotedblright\ rather
than \textquotedblleft theorems\textquotedblright). The proofs we gave for the
two propositions no longer apply to the theorems that generalize them; how
should we then prove the theorems?

One thing we can try to do is start from scratch and search for
non-combinatorial proofs of Theorem \ref{thm.binom.vanderRR} and Theorem
\ref{thm.binom.trin-revRR}. Such proofs indeed exist: An algebraic proof of
Theorem \ref{thm.binom.vanderRR} (completely unrelated to our above proof of
Proposition \ref{prop.binom.vanderNN}) can be found in \cite[first proof of
Theorem 3.29]{detnotes}\footnote{The main idea is to induct on $n$, using the
\textquotedblleft absorption identity\textquotedblright\ $\dbinom{y}{n}%
=\dfrac{y}{n}\dbinom{y-1}{n-1}$ (which is easily proved).}. It is not a
particularly enlightening or memorable proof, but it serves its purpose just
fine (i.e., it proves Theorem \ref{thm.binom.vanderRR} in full generality,
without requiring $x,y\in\mathbb{N}$), and it even has a slight advantage in
being easy to explain (as it requires little else besides standard
manipulations of sums and products). Theorem \ref{thm.binom.trin-revRR} can
also be proved by direct computation (using Definition \ref{def.binom.def});
this proof can be found in \cite[\S 2.2.1, proof of Proposition 1.3.35]{19fco}
(and is arguably even easier than the above combinatorial proof of Proposition
\ref{prop.binom.trin-revNN}).

However, this supplantation of combinatorial proofs by algebraic ones leaves a
bad aftertaste. Is double counting just a toy that only works in particular
cases (i.e., usually, when all variables lie in $\mathbb{N}$)? One of the
hallmarks of a good mathematical proof is that it can be adapted to many
natural generalizations of the result being proved; our double-counting proofs
of Proposition \ref{prop.binom.vanderNN} and Proposition
\ref{prop.binom.trin-revNN} fail this criterion. There is also a more
practical concern: Double counting can be used not just in proving these two
propositions; there are many other results which need it far more (sometimes,
the only known proofs use double counting). We cannot always expect to find an
alternative proof that avoids double counting and thus can be generalized immediately.

Good news: this is a solvable problem. You \textbf{can} have your cake and eat
it too! While our double-counting proofs cannot themselves be generalized to
non-integer values of $x,y$ or $n$, there is nevertheless a trick that allows
to easily deduce the general results (such as Theorem \ref{thm.binom.vanderRR}
and Theorem \ref{thm.binom.trin-revRR}) from their particular cases that can
be proved combinatorially (such as Proposition \ref{prop.binom.vanderNN} and
Proposition \ref{prop.binom.trin-revNN}). I call this trick the
\textit{polynomial identity trick}, and it has far more applications than
salvaging combinatorial proofs; but this is probably one of the simplest to
explain. My exposition of this trick follows \cite[\S 2.6.2]{19fco}.

The polynomial identity trick relies on the following well-known
theorem:\footnote{Recall that a \textit{root} of a univariate polynomial $P$
means a complex number $r$ that satisfies $P\left(  r\right)  =0$.
\par
Also, the \textit{degree} $\deg P$ of a nonzero polynomial $P$ is the exponent
in the largest power of the variable that appears in $P$ with a nonzero
coefficient. (That is, if we write $P$ in the form $P=a_{0}X^{0}+a_{1}%
X^{1}+\cdots+a_{n}X^{n}$, where $X$ is our variable and where $a_{n}\neq0$,
then the degree of $P$ is $n$.)}

\begin{theorem}
\label{thm.polidtrick-a-P}Let $P$ be a nonzero polynomial (with complex
coefficients, in a single variable $X$). Then, $P$ has at most $\deg P$ many roots.
\end{theorem}

For example:

\begin{itemize}
\item The degree-$3$ polynomial $3X^{3}-2X+1$ has $3$ roots, namely $-1$,
$\dfrac{1}{2}+\dfrac{1}{6}i\sqrt{3}$ and $\dfrac{1}{2}-\dfrac{1}{6}i\sqrt{3}$
(where $i=\sqrt{-1}$ is the imaginary unit).

\item The degree-$3$ polynomial $X^{3}-X^{2}-X+1$ has $2$ roots, namely $1$
and $-1$.
\end{itemize}

Theorem \ref{thm.polidtrick-a-P} is often called the \textquotedblleft easy
half of the Fundamental Theorem of Algebra\textquotedblright. We will not
prove it here, but the reader can find a proof of Theorem
\ref{thm.polidtrick-a-P} in any good textbook on abstract algebra (e.g., in
\cite[Corollary 1.8.24]{Goodman}, \cite[Theorem 1.58]{Joyce17},
\cite[Corollary 4.5.10]{Walker87}, \cite[Chapter 1, \S 5, Corollary
3]{CoLiOs15}, \cite[Theorem 7.6.11]{19s}, \cite[Corollary 33.8]{Elman20} and
\cite[Corollary 1.14]{Knapp1}).

We don't really need to use complex numbers in Theorem
\ref{thm.polidtrick-a-P}; the theorem remains true if we restrict ourselves to
real or rational numbers (since any real or rational number is a complex
number as well). Complex numbers are special in that they allow replacing the
words \textquotedblleft at most\textquotedblright\ in Theorem
\ref{thm.polidtrick-a-P} by \textquotedblleft exactly\textquotedblright, as
long as we count the roots with multiplicity (so, for example, the double root
$1$ of the polynomial $\left(  X-1\right)  ^{2}X$ counts as two roots $1,1$
rather than as a single root $1$). But this is a much deeper result (known as
\href{https://en.wikipedia.org/wiki/Fundamental_theorem_of_algebra}{the
\textit{Fundamental Theorem of Algebra}}), which we shall not need in our
combinatorial applications and thus don't bother stating here.

Theorem \ref{thm.polidtrick-a-P} has two corollaries, which are used
frequently in combinatorics:

\begin{corollary}
\label{cor.polidtrick-b}If a polynomial $P$ (with complex coefficients, in a
single variable $X$) has infinitely many roots, then $P$ is the zero polynomial.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.polidtrick-b} (sketched).]If $P$ was nonzero,
then Theorem \ref{thm.polidtrick-a-P} would yield that $P$ has at most $\deg
P$ many roots, which would contradict the assumption that $P$ has infinitely
many roots. Thus, $P$ is zero, so that Corollary \ref{cor.polidtrick-b}
follows. (See \cite[proof of Corollary 2.6.9]{19fco} for details.)
\end{proof}

\begin{corollary}
\label{cor.polidtrick-cS}Let $P$ and $Q$ be polynomials (with complex
coefficients, in a single variable $X$). Let $S$ be an infinite set of complex
numbers. Assume that%
\begin{equation}
P\left(  x\right)  =Q\left(  x\right)  \ \ \ \ \ \ \ \ \ \ \text{for all }x\in
S. \label{eq.cor.polidtrick-cS.ass}%
\end{equation}
Then, $P=Q$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.polidtrick-cS}.]We claim that the polynomial
$P-Q$ has infinitely many roots. Indeed, each $x\in S$ satisfies%
\[
\left(  P-Q\right)  \left(  x\right)  =P\left(  x\right)  -Q\left(  x\right)
=0\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.cor.polidtrick-cS.ass}%
)}\right)
\]
and therefore is a root of $P-Q$. Thus, the polynomial $P-Q$ has each $x\in S$
as a root; hence, it has infinitely many roots (since $S$ is an infinite set).
Corollary \ref{cor.polidtrick-b} (applied to $P-Q$ instead of $P$) thus shows
that $P-Q$ is the zero polynomial. In other words, $P-Q=0$. Hence, $P=Q$. This
proves Corollary \ref{cor.polidtrick-cS}.
\end{proof}

Corollary \ref{cor.polidtrick-cS} reveals that an equality $P=Q$ between two
(univariate) polynomials $P$ and $Q$ can be proved by showing that the
polynomials agree on each element of a (fixed) infinite set $S$ (i.e., that
$P\left(  x\right)  =Q\left(  x\right)  $ for all $x\in S$); it is not
necessary to check that they agree on each complex number (but, rather, this
result is obtained \textquotedblleft for free\textquotedblright). This is
called the \textit{polynomial identity trick}.

Before we use this trick to derive Theorem \ref{thm.binom.vanderRR} and
Theorem \ref{thm.binom.trin-revRR} from their particular cases, we illustrate
it on a toy problem:

\begin{exercise}
\label{exe.sums.plus-minus-geosum}Let $a\in\mathbb{C}$. Let $n\in\mathbb{N}$
be even. Prove that%
\begin{equation}
\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right)  =\sum_{i=0}^{n}a^{2i}.
\label{eq.exe.sums.plus-minus-geosum.eq}%
\end{equation}

\end{exercise}

For instance, for $n=4$, the equality (\ref{eq.exe.sums.plus-minus-geosum.eq})
says that%
\[
\left(  1-a+a^{2}-a^{3}+a^{4}\right)  \cdot\left(  1+a+a^{2}+a^{3}%
+a^{4}\right)  =1+a^{2}+a^{4}+a^{6}+a^{8}.
\]


There are many simple ways to solve Exercise \ref{exe.sums.plus-minus-geosum}
(for instance, induction on $n/2$ can be used); but let us give a solution
that saves on computation by using the polynomial identity trick:

\begin{proof}
[Solution to Exercise \ref{exe.sums.plus-minus-geosum}.]Note that $n+1$ is odd
(since $n$ is even).

Let us first assume that $a\notin\left\{  -1,1\right\}  $. Thus, $a\neq-1$ and
$a\neq1$. From $a\neq-1$, we obtain $-a\neq1$.

The number $a$ is distinct from $1$ (since $a\neq1$). Hence, applying the
equality (\ref{eq.exe.ind.geoser-b.eq2}) to $a$ and $n+1$ instead of $b$ and
$n$, we obtain\footnote{To be fully precise, the equality
(\ref{eq.exe.ind.geoser-b.eq2}) was only stated for real $b$, whereas here we
are applying it to the complex number $a$. But this does not really matter,
since the equality (\ref{eq.exe.ind.geoser-b.eq2}) holds for all complex
numbers $b$ (and the same proof that we gave for it applies in this
generality).}%
\[
a^{0}+a^{1}+\cdots+a^{\left(  n+1\right)  -1}=\dfrac{1-a^{n+1}}{1-a}.
\]
Comparing this with%
\begin{align*}
a^{0}+a^{1}+\cdots+a^{\left(  n+1\right)  -1}  &  =a^{0}+a^{1}+\cdots
+a^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  n+1\right)  -1=n\right)
\\
&  =\sum_{i=0}^{n}a^{i},
\end{align*}
we obtain%
\begin{equation}
\sum_{i=0}^{n}a^{i}=\dfrac{1-a^{n+1}}{1-a}.
\label{sol.sums.plus-minus-geosum.plussum}%
\end{equation}
The same argument (applied to $-a$ instead of $a$) yields%
\begin{equation}
\sum_{i=0}^{n}\left(  -a\right)  ^{i}=\dfrac{1-\left(  -a\right)  ^{n+1}%
}{1-\left(  -a\right)  } \label{sol.sums.plus-minus-geosum.minussum}%
\end{equation}
(since $-a\neq1$). Multiplying this equality by
(\ref{sol.sums.plus-minus-geosum.plussum}), we obtain%
\begin{align*}
&  \left(  \sum_{i=0}^{n}\left(  -a\right)  ^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right) \\
&  =\dfrac{1-\left(  -a\right)  ^{n+1}}{1-\left(  -a\right)  }\cdot
\dfrac{1-a^{n+1}}{1-a}\\
&  =\left(  1-\underbrace{\left(  -a\right)  ^{n+1}}_{\substack{=-a^{n+1}%
\\\text{(since }n+1\text{ is odd)}}}\right)  \cdot\left(  1-a^{n+1}\right)
/\left(  \left(  \underbrace{1-\left(  -a\right)  }_{=1+a}\right)
\cdot\left(  1-a\right)  \right) \\
&  =\underbrace{\left(  1-\left(  -a^{n+1}\right)  \right)  }_{=1+a^{n+1}%
}\cdot\left(  1-a^{n+1}\right)  /\underbrace{\left(  \left(  1+a\right)
\cdot\left(  1-a\right)  \right)  }_{=1-a^{2}}\\
&  =\underbrace{\left(  1+a^{n+1}\right)  \cdot\left(  1-a^{n+1}\right)
}_{\substack{=1-\left(  a^{n+1}\right)  ^{2}\\\text{(since }\left(
1+b\right)  \cdot\left(  1-b\right)  =1-b^{2}\\\text{for each }b\in
\mathbb{C}\text{)}}}/\left(  1-a^{2}\right)  =\left(  1-\underbrace{\left(
a^{n+1}\right)  ^{2}}_{=a^{\left(  n+1\right)  \cdot2}=a^{2\left(  n+1\right)
}=\left(  a^{2}\right)  ^{n+1}}\right)  /\left(  1-a^{2}\right) \\
&  =\left(  1-\left(  a^{2}\right)  ^{n+1}\right)  /\left(  1-a^{2}\right)
=\dfrac{1-\left(  a^{2}\right)  ^{n+1}}{1-a^{2}}.
\end{align*}
Comparing this with%
\[
\left(  \sum_{i=0}^{n}\underbrace{\left(  -a\right)  ^{i}}_{=\left(
-1\right)  ^{i}a^{i}}\right)  \cdot\left(  \sum_{i=0}^{n}a^{i}\right)
=\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right)  ,
\]
we obtain%
\begin{equation}
\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right)  =\dfrac{1-\left(  a^{2}\right)  ^{n+1}}{1-a^{2}}.
\label{sol.sums.plus-minus-geosum.LHS-as-frac}%
\end{equation}


On the other hand, $a^{2}$ is distinct from $1$ (since $a\notin\left\{
-1,1\right\}  $). Now,
\begin{align*}
\sum_{i=0}^{n}\underbrace{a^{2i}}_{=\left(  a^{2}\right)  ^{i}}  &
=\sum_{i=0}^{n}\left(  a^{2}\right)  ^{i}=\left(  a^{2}\right)  ^{0}+\left(
a^{2}\right)  ^{1}+\cdots+\left(  a^{2}\right)  ^{n}\\
&  =\left(  a^{2}\right)  ^{0}+\left(  a^{2}\right)  ^{1}+\cdots+\left(
a^{2}\right)  ^{\left(  n+1\right)  -1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}n=\left(  n+1\right)  -1\right) \\
&  =\dfrac{1-\left(  a^{2}\right)  ^{n+1}}{1-a^{2}}%
\end{align*}
(by (\ref{eq.exe.ind.geoser-b.eq2}), applied to $a^{2}$ and $n+1$ instead of
$b$ and $n$).\ \ \ \ \footnote{Again, we have applied
(\ref{eq.exe.ind.geoser-b.eq2}) to a complex number $b$; again, this is fine
because (\ref{eq.exe.ind.geoser-b.eq2}) could just as well have been stated
for a complex number $b$.} Comparing this equality with
(\ref{sol.sums.plus-minus-geosum.LHS-as-frac}), we obtain%
\[
\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right)  =\sum_{i=0}^{n}a^{2i}.
\]
Thus, we have proved (\ref{eq.exe.sums.plus-minus-geosum.eq}) under the
assumption that $a\notin\left\{  -1,1\right\}  $. How can we complete this
solution to a full (unconditional) proof of
(\ref{eq.exe.sums.plus-minus-geosum.eq})?

One way would be to check the remaining two cases ($a=1$ and $a=-1$) by hand.
This is easy and can easily be done by the reader. But I will instead show
another way, which requires no computation whatsoever. Namely, forget that we
fixed $a$. We thus have proved that the equality
(\ref{eq.exe.sums.plus-minus-geosum.eq}) holds for all complex numbers
$a\notin\left\{  -1,1\right\}  $. In other words, we have proved that
(\ref{eq.exe.sums.plus-minus-geosum.eq}) holds for all $a\in\mathbb{C}%
\setminus\left\{  -1,1\right\}  $. Now, define two polynomials $P$ and $Q$
(with complex coefficients, in a single variable $X$) by%
\[
P=\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}X^{i}\right)  \cdot\left(
\sum_{i=0}^{n}X^{i}\right)  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q=\sum_{i=0}^{n}X^{2i}.
\]
Then, for each $a\in\mathbb{C}$, we have%
\begin{equation}
P\left(  a\right)  =\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)
\cdot\left(  \sum_{i=0}^{n}a^{i}\right)
\label{sol.sums.plus-minus-geosum.Pa=}%
\end{equation}
(by the definition of $P$) and%
\begin{equation}
Q\left(  a\right)  =\sum_{i=0}^{n}a^{2i}
\label{sol.sums.plus-minus-geosum.Qa=}%
\end{equation}
(by the definition of $Q$). Now, each $a\in\mathbb{C}\setminus\left\{
-1,1\right\}  $ satisfies%
\begin{align*}
P\left(  a\right)   &  =\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}%
a^{i}\right)  \cdot\left(  \sum_{i=0}^{n}a^{i}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.sums.plus-minus-geosum.Pa=}%
)}\right) \\
&  =\sum_{i=0}^{n}a^{2i}\ \ \ \ \ \ \ \ \ \ \left(  \text{since we have proved
that (\ref{eq.exe.sums.plus-minus-geosum.eq}) holds for all }a\in
\mathbb{C}\setminus\left\{  -1,1\right\}  \right) \\
&  =Q\left(  a\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.sums.plus-minus-geosum.Qa=})}\right)  .
\end{align*}
In other words, we have $P\left(  a\right)  =Q\left(  a\right)  $ for all
$a\in\mathbb{C}\setminus\left\{  -1,1\right\}  $. Renaming the variable $a$ as
$x$ in this statement, we obtain the following: We have $P\left(  x\right)
=Q\left(  x\right)  $ for all $x\in\mathbb{C}\setminus\left\{  -1,1\right\}
$. Hence, Corollary \ref{cor.polidtrick-cS} (applied to $S=\mathbb{C}%
\setminus\left\{  -1,1\right\}  $) yields that $P=Q$ (since the set
$\mathbb{C}\setminus\left\{  -1,1\right\}  $ is infinite). Thus, each
$a\in\mathbb{C}$ satisfies $P\left(  a\right)  =Q\left(  a\right)  $. In view
of (\ref{sol.sums.plus-minus-geosum.Pa=}) and
(\ref{sol.sums.plus-minus-geosum.Qa=}), this rewrites as follows: Each
$a\in\mathbb{C}$ satisfies%
\[
\left(  \sum_{i=0}^{n}\left(  -1\right)  ^{i}a^{i}\right)  \cdot\left(
\sum_{i=0}^{n}a^{i}\right)  =\sum_{i=0}^{n}a^{2i}.
\]
This solves Exercise \ref{exe.sums.plus-minus-geosum}.
\end{proof}

Now, let us use the polynomial identity trick to derive Theorem
\ref{thm.binom.trin-revRR} from Proposition \ref{prop.binom.trin-revNN}:

\begin{proof}
[Proof of Theorem \ref{thm.binom.trin-revRR} (sketched).]We must prove the
equality
\begin{equation}
\dbinom{n}{a}\dbinom{a}{b}=\dbinom{n}{b}\dbinom{n-b}{a-b}.
\label{eq.thm.binom.trin-revRR.goal}%
\end{equation}


First of all, it is easy to see that (\ref{eq.thm.binom.trin-revRR.goal})
holds if $b\notin\mathbb{N}$. Indeed, if $b\notin\mathbb{N}$, then both
binomial coefficients $\dbinom{a}{b}$ and $\dbinom{n}{b}$ are $0$ (by
(\ref{eq.def.binom.def.b})). Thus, if $b\notin\mathbb{N}$, then the equality
(\ref{eq.thm.binom.trin-revRR.goal}) boils down to $0=0$ (since each of its
sides is a product with one factor equal to $0$), which is clearly true. Thus,
we WLOG assume that $b\in\mathbb{N}$ in the rest of this proof.

If we have $a\notin\mathbb{N}$, then we have $a-b\notin\mathbb{N}$ as well
(since otherwise, we would have $a-b\in\mathbb{N}$ and therefore
$a=\underbrace{a-b}_{\in\mathbb{N}}+\underbrace{b}_{\in\mathbb{N}}%
\in\mathbb{N}$, which would contradict $a\notin\mathbb{N}$), and therefore
both binomial coefficients $\dbinom{n}{a}$ and $\dbinom{n-b}{a-b}$ are $0$ (by
(\ref{eq.def.binom.def.b})). Hence, if we have $a\notin\mathbb{N}$, then the
equality (\ref{eq.thm.binom.trin-revRR.goal}) boils down to $0=0$, which is
clearly true. Thus, we WLOG assume that $a\in\mathbb{N}$ in the rest of this proof.

Now, we have $a,b\in\mathbb{N}$, but we don't necessarily have $n\in
\mathbb{N}$. If $n\in\mathbb{N}$, then (\ref{eq.thm.binom.trin-revRR.goal})
follows from Proposition \ref{prop.binom.trin-revNN}, but how can we prove it
for $n\notin\mathbb{N}$ ?

We take a broader view. We have defined the binomial coefficient $\dbinom
{n}{k}$ for any \textbf{number} $n$; but we can just as well extend this
definition by plugging a polynomial variable (or even a polynomial) for $n$.
That is, if $F$ is any \textbf{polynomial} and $k$ is a number, then we define
a \textbf{polynomial} $\dbinom{F}{k}$ as follows:

\begin{itemize}
\item If $k\in\mathbb{N}$, then we set%
\begin{equation}
\dbinom{F}{k}=\dfrac{F\left(  F-1\right)  \left(  F-2\right)  \cdots\left(
F-k+1\right)  }{k!}. \label{eq.def.binom.def.aP}%
\end{equation}


\item If $k\notin\mathbb{N}$, then we set%
\begin{equation}
\dbinom{F}{k}=0. \label{eq.def.binom.def.bP}%
\end{equation}

\end{itemize}

\noindent This definition is precisely Definition \ref{def.binom.def}, with
$n$ replaced by $F$. Thus, if $F$ is any polynomial, and if $x$ is any number,
then the result of substituting $x$ into the polynomial $\dbinom{F}{k}$ equals
the number $\dbinom{F\left(  x\right)  }{k}$. This will be used without saying.

With this all said, we can define two polynomials $P$ and $Q$ (with complex
coefficients, in a single variable $X$) by
\[
P\left(  X\right)  =\dbinom{X}{a}\dbinom{a}{b}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  X\right)  =\dbinom{X}{b}\dbinom{X-b}{a-b}.
\]
\footnote{Explicitly, these polynomials look as follows: We have%
\[
P\left(  X\right)  =\dfrac{X\left(  X-1\right)  \left(  X-2\right)
\cdots\left(  X-a+1\right)  }{a!}\dbinom{a}{b}.
\]
Furthermore, if $a-b\in\mathbb{N}$, then%
\[
Q\left(  X\right)  =\dfrac{X\left(  X-1\right)  \left(  X-2\right)
\cdots\left(  X-b+1\right)  }{b!}\cdot\dfrac{\left(  X-b\right)  \left(
X-b-1\right)  \left(  X-b-2\right)  \cdots\left(  X-b-\left(  a-b\right)
+1\right)  }{\left(  a-b\right)  !}.
\]
(On the other hand, if $a-b\notin\mathbb{N}$, then $Q\left(  X\right)
=\dfrac{X\left(  X-1\right)  \left(  X-2\right)  \cdots\left(  X-b+1\right)
}{b!}\cdot0=0$.)} Then, for all $x\in\mathbb{N}$, we have%
\begin{align*}
P\left(  x\right)   &  =\dbinom{x}{a}\dbinom{a}{b}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }P\left(  X\right)  =\dbinom{X}{a}\dbinom{a}{b}\right) \\
&  =\dbinom{x}{b}\dbinom{x-b}{a-b}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.binom.trin-revNN}, applied to }x\text{ instead of
}n\right) \\
&  =Q\left(  x\right)
\end{align*}
(since $Q\left(  X\right)  =\dbinom{X}{b}\dbinom{X-b}{a-b}$ and thus $Q\left(
x\right)  =\dbinom{x}{b}\dbinom{x-b}{a-b}$). Therefore, Corollary
\ref{cor.polidtrick-cS} (applied to $S=\mathbb{N}$) shows that $P=Q$ (since
the set $\mathbb{N}$ is infinite). Evaluating both sides of this equality at
the number $n$, we thus find $P\left(  n\right)  =Q\left(  n\right)  $ (no
matter whether $n\in\mathbb{N}$ or $n\notin\mathbb{N}$). But the definitions
of $P$ and $Q$ show that $P\left(  n\right)  =\dbinom{n}{a}\dbinom{a}{b}$ and
$Q\left(  n\right)  =\dbinom{n}{b}\dbinom{n-b}{a-b}$. Hence, $\dbinom{n}%
{a}\dbinom{a}{b}=P\left(  n\right)  =Q\left(  n\right)  =\dbinom{n}{b}%
\dbinom{n-b}{a-b}$. This proves (\ref{eq.thm.binom.trin-revRR.goal}), and thus
Theorem \ref{thm.binom.trin-revRR} is proven.
\end{proof}

Note that we have used the polynomial identity trick (in the shape of
Corollary \ref{cor.polidtrick-cS}) to generalize the equality
(\ref{eq.thm.binom.trin-revRR.goal}) from $n\in\mathbb{N}$ to $n\in\mathbb{C}%
$. However, we did \textbf{not} use this trick to generalize it from
$a\in\mathbb{N}$ to $a\in\mathbb{C}$ (or from $b\in\mathbb{N}$ to
$b\in\mathbb{C}$); instead, we have used ad-hoc arguments to prove that
(\ref{eq.thm.binom.trin-revRR.goal}) holds in the cases $a\notin\mathbb{N}$
and $b\notin\mathbb{N}$. In fact, the polynomial identity trick would not have
helped us here. The reason is that, while the binomial coefficient $\dbinom
{n}{k}$ is a polynomial function in $n$\ \ \ \ \footnote{This means that for
any fixed number $k$, there is a polynomial $P$ such that each number $n$
satisfies $\dbinom{n}{k}=P\left(  n\right)  $. (Namely, this $P$ is the
polynomial $\dbinom{X}{k}$.)}, it is \textbf{not} a polynomial function in $k$
(indeed, $\dbinom{n}{k}$ is zero for all negative $k$, but nonzero for $k=0$;
but this is not how a polynomial function in $k$ could behave). Thus we needed
a different argument to generalize from $a,b\in\mathbb{N}$ to $a,b\in
\mathbb{C}$.

Next, let us derive Theorem \ref{thm.binom.vanderRR} from Proposition
\ref{prop.binom.vanderNN}. This will use the polynomial identity trick
\textbf{twice} -- once to generalize from $x\in\mathbb{N}$ to $x\in\mathbb{C}%
$, and once again to generalize from $y\in\mathbb{N}$ to $y\in\mathbb{C}$.
(Alternatively, we could do it in sitting if we generalized Corollary
\ref{cor.polidtrick-cS} to polynomials in two variables; this is how it is
done in \cite[\S 3.3.3, Second proof of Theorem 3.30]{detnotes}.)

We begin by showing an \textquotedblleft intermediate stage\textquotedblright%
\ between Proposition \ref{prop.binom.vanderNN} and Theorem
\ref{thm.binom.vanderRR}:

\begin{lemma}
\label{lem.binom.vanderNR}Let $n\in\mathbb{N}$ and $x\in\mathbb{N}$ and
$y\in\mathbb{C}$. Then,%
\[
\dbinom{x+y}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom{y}{n-k}.
\]

\end{lemma}

Lemma \ref{lem.binom.vanderNR} is clearly more general than Proposition
\ref{prop.binom.vanderNN} but less than Theorem \ref{thm.binom.vanderRR}. We
shall first deduce this lemma from Proposition \ref{prop.binom.vanderNN}, and
then use this lemma to deduce Theorem \ref{thm.binom.vanderRR} in turn. Both
deductions will use the polynomial identity trick.

\begin{proof}
[Proof of Lemma \ref{lem.binom.vanderNR}.]It shall be convenient for us to
rename the variables $x$ and $y$ as $u$ and $v$. Thus, we let $n\in\mathbb{N}$
and $u\in\mathbb{N}$ and $v\in\mathbb{C}$. We must then prove that%
\begin{equation}
\dbinom{u+v}{n}=\sum_{k=0}^{n}\dbinom{u}{k}\dbinom{v}{n-k}.
\label{pf.lem.binom.vanderNR.goal}%
\end{equation}


Define two polynomials $P$ and $Q$ (with complex coefficients, in a single
variable $X$) by
\[
P\left(  X\right)  =\dbinom{u+X}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  X\right)  =\sum_{k=0}^{n}\dbinom{u}{k}\dbinom
{X}{n-k}.
\]
\footnote{Here we are using binomial coefficients $\dbinom{F}{k}$ in which $F$
is a polynomial. See our above proof of Theorem \ref{thm.binom.trin-revRR} for
the definition of this kind of binomial coefficients.} Thus, each
$x\in\mathbb{N}$ satisfies%
\[
P\left(  x\right)  =\dbinom{u+x}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  x\right)  =\sum_{k=0}^{n}\dbinom{u}{k}\dbinom
{x}{n-k}%
\]
and therefore%
\begin{align*}
P\left(  x\right)   &  =\dbinom{u+x}{n}=\sum_{k=0}^{n}\dbinom{u}{k}\dbinom
{x}{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.binom.vanderNN} (applied to }u\text{ and
}x\text{ instead of }x\text{ and }y\text{),}\\
\text{since }u\in\mathbb{N}\text{ and }x\in\mathbb{N}%
\end{array}
\right) \\
&  =Q\left(  x\right)  .
\end{align*}
That is, we have $P\left(  x\right)  =Q\left(  x\right)  $ for all
$x\in\mathbb{N}$. Hence, Corollary \ref{cor.polidtrick-cS} (applied to
$S=\mathbb{N}$) yields that $P=Q$ (since $\mathbb{N}$ is infinite). Thus,
$P\left(  v\right)  =Q\left(  v\right)  $. But the definitions of $P$ and $Q$
yield%
\[
P\left(  v\right)  =\dbinom{u+v}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  v\right)  =\sum_{k=0}^{n}\dbinom{u}{k}\dbinom
{v}{n-k}.
\]
Hence,%
\[
\dbinom{u+v}{n}=P\left(  v\right)  =Q\left(  v\right)  =\sum_{k=0}^{n}%
\dbinom{u}{k}\dbinom{v}{n-k}.
\]
This proves (\ref{pf.lem.binom.vanderNR.goal}). Thus, Lemma
\ref{lem.binom.vanderNR} is proven.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.binom.vanderRR}.]It shall again be convenient for
us to rename the variables $x$ and $y$ as $u$ and $v$. Thus, we let
$n\in\mathbb{N}$ and $u\in\mathbb{C}$ and $v\in\mathbb{C}$. We must then prove
that%
\begin{equation}
\dbinom{u+v}{n}=\sum_{k=0}^{n}\dbinom{u}{k}\dbinom{v}{n-k}.
\label{pf.thm.binom.vanderRR.goal}%
\end{equation}


Define two polynomials $P$ and $Q$ (with complex coefficients, in a single
variable $X$) by
\[
P\left(  X\right)  =\dbinom{X+v}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  X\right)  =\sum_{k=0}^{n}\dbinom{X}{k}\dbinom
{v}{n-k}.
\]
\footnote{Here we are using binomial coefficients $\dbinom{F}{k}$ in which $F$
is a polynomial. See our above proof of Theorem \ref{thm.binom.trin-revRR} for
the definition of this kind of binomial coefficients.} Thus, each
$x\in\mathbb{N}$ satisfies%
\[
P\left(  x\right)  =\dbinom{x+v}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  x\right)  =\sum_{k=0}^{n}\dbinom{x}{k}\dbinom
{v}{n-k}%
\]
and therefore%
\begin{align*}
P\left(  x\right)   &  =\dbinom{x+v}{n}=\sum_{k=0}^{n}\dbinom{x}{k}\dbinom
{v}{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Lemma \ref{lem.binom.vanderNR}
(applied to }y=v\text{), since }x\in\mathbb{N}\right) \\
&  =Q\left(  x\right)  .
\end{align*}
That is, we have $P\left(  x\right)  =Q\left(  x\right)  $ for all
$x\in\mathbb{N}$. Hence, Corollary \ref{cor.polidtrick-cS} (applied to
$S=\mathbb{N}$) yields that $P=Q$ (since $\mathbb{N}$ is infinite). Thus,
$P\left(  u\right)  =Q\left(  u\right)  $. But the definitions of $P$ and $Q$
yield%
\[
P\left(  u\right)  =\dbinom{u+v}{n}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Q\left(  u\right)  =\sum_{k=0}^{n}\dbinom{u}{k}\dbinom
{v}{n-k}.
\]
Hence,%
\[
\dbinom{u+v}{n}=P\left(  u\right)  =Q\left(  u\right)  =\sum_{k=0}^{n}%
\dbinom{u}{k}\dbinom{v}{n-k}.
\]
This proves (\ref{pf.thm.binom.vanderRR.goal}). Thus, Theorem
\ref{thm.binom.vanderRR} is proven.
\end{proof}

After these proofs, it might appear that the polynomial identity trick is
magic. In some ways, this is true, as it allowed us to extend combinatorial
proofs to situations in which combinatorics has no say (such as properties of
binomial coefficients $\dbinom{n}{k}$ with non-integer $n$). However, it has
its limitations. For example, we cannot use it to extend Exercise
\ref{exe.binom.hock-neg-hock} \textbf{(a)} to negative $n$ (since $\sum
_{i=0}^{n}\dbinom{i}{k}$ is not a polynomial function in $n$); nor can we use
it to extend Theorem \ref{thm.binom.sym} to negative $n$ (since $\dbinom
{n}{n-k}$ is not a polynomial function in $n$); nor can we use it to extend
Theorem \ref{thm.binom.fac} to negative $n$ (indeed, $\dfrac{n!}%
{k!\cdot\left(  n-k\right)  !}$ does not even make sense when $n$ is
negative). See \cite[\S 2.6.4]{19fco} for more examples of what can and what
cannot be done using the polynomial identity trick.

\subsubsection{A probabilistic proof}

The next exercise is a classical identity with binomial coefficients
(\cite[Chapter 5, Example E18]{Engel}, \cite[Exercise 8.4]{Engel},
\cite[(5.20)]{GKP}, \cite[Exercise 3.27 \textbf{(b)}]{detnotes}):

\begin{exercise}
\label{exe.enum.coin-sum-2k}Let $n\in\mathbb{N}$. Prove that%
\[
\sum_{k=0}^{n}\dbinom{n+k}{k}\dfrac{1}{2^{k}}=2^{n}.
\]

\end{exercise}

Several solutions to this exercise are known. In particular, \cite[Exercise
3.27 \textbf{(b)}]{detnotes} gives an algebraic proof by manipulating sums; an
elegant proof by induction on $n$ appears in
\url{https://math.stackexchange.com/a/1874857} and \cite[solution to Problem
1.1 (b)]{Tomesc85}. More proofs can be found at
\url{https://math.stackexchange.com/questions/1874816} and at
\url{https://math.stackexchange.com/questions/1928040} and at
\url{https://math.stackexchange.com/questions/1782432} and at
\url{https://math.stackexchange.com/questions/3392981} . An equivalent problem
is \cite[Problem 73b]{YagYag64}. We shall give a probabilistic proof -- i.e.,
in essence, a proof by double counting, except that we formulate it in terms
of probabilities rather than numbers. This proof is essentially the one given
in \cite[Chapter 5, Example E18]{Engel}.

\begin{proof}
[Solution to Exercise \ref{exe.enum.coin-sum-2k} (sketched).]Consider a fair
coin (i.e., a coin that is equally likely to come up heads as it is to come up
tails when it is tossed). We toss this coin $2n+1$ times\footnote{The tosses
are independent.}. Let $H$ be the event \textquotedblleft the coin comes up
heads at least $n+1$ times\textquotedblright, and let $T$ be the event
\textquotedblleft the coin comes up tails at least $n+1$
times\textquotedblright. What can we say about the probabilities $\Pr H$ and
$\Pr T$ of the events $H$ and $T$ ?

First of all, the events $H$ and $T$ cannot happen at the same time, because
this would require at least $\left(  n+1\right)  +\left(  n+1\right)  =2n+2$
tosses (but we are only tossing our coin $2n+1$ times). Furthermore, at least
one of the events $H$ and $T$ must happen (since otherwise, the coin comes up
heads at most $n$ times and comes up tails at most $n$ times, so that we must
have tossed it at most $n+n=2n$ times, which contradicts the fact that we are
tossing it $2n+1$ times). Thus, \textbf{exactly one} of the events $H$ and $T$
must happen. In other words, the events $H$ and $T$ are complements of each
other. Hence, their probabilities add up to $1$; that is, we have $\Pr H+\Pr
T=1$.

Now, let us compute $\Pr H$. For each $k\in\left\{  0,1,\ldots,n\right\}  $,
we define the event%
\begin{align*}
H_{k}  &  =\left(  \text{\textquotedblleft the coin comes up heads at least
}n+1\text{ times,}\right. \\
&  \ \ \ \ \ \ \ \ \ \ \left.  \text{and by the }\left(  n+1\right)  \text{-st
time it comes up heads,}\right. \\
&  \ \ \ \ \ \ \ \ \ \ \left.  \text{it has come up tails exactly }k\text{
times\textquotedblright}\right)  .
\end{align*}
For example, if $n=3$, and if the coin comes up tails first, then heads, then
tails again, then heads, then heads, then heads, then tails again, then the
event $H_{2}$ happens (because the coin has come up tails exactly twice by the
$4$-th time it comes up heads).

Now we claim that%
\begin{equation}
\Pr H=\Pr\left(  H_{0}\right)  +\Pr\left(  H_{1}\right)  +\cdots+\Pr\left(
H_{n}\right)  . \label{sol.enum.coin-sum-2k.PrH=sum}%
\end{equation}


[\textit{Proof:} If the event $H$ happens, then exactly one of the $n+1$
events $H_{0},H_{1},\ldots,H_{n}$ must be happening (because by the $\left(
n+1\right)  $-st time the coin comes up heads, it must have come up tails some
number of times between $0$ and $n$\ \ \ \ \footnote{It cannot have come up
tails more than $n$ times, since we are only tossing the coin $2n+1$ times.}).
Since the events $H_{0},H_{1},\ldots,H_{n}$ are disjoint, and since they are
subsets of $H$, we thus conclude that (\ref{sol.enum.coin-sum-2k.PrH=sum}) holds.]

Next, let us fix $k\in\left\{  0,1,\ldots,n\right\}  $. We want to compute
$\Pr\left(  H_{k}\right)  $. The event $H_{k}$ can be rewritten as follows:%
\begin{align}
H_{k}  &  =\left(  \text{\textquotedblleft the first }n+k\text{ times that we
toss the coin,}\right. \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up tails exactly }k\text{ times;
furthermore,}\right. \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up heads the }\left(
n+k+1\right)  \text{-st time we toss it\textquotedblright}\right)  .
\label{sol.enum.coin-sum-2k.Hk=2}%
\end{align}
Thus, its probability $\Pr\left(  H_{k}\right)  $ is easy to
compute:\footnote{Computing $\Pr\left(  H_{k}\right)  $ is known as
\textit{\href{https://en.wikipedia.org/wiki/Banach's_matchbox_problem}{\textit{Banach's
matchbox problem}}}.}%
\begin{equation}
\Pr\left(  H_{k}\right)  =\dbinom{n+k}{k}\cdot\dfrac{1}{2^{n+k}}\cdot\dfrac
{1}{2}. \label{sol.enum.coin-sum-2k.PrHk=prod}%
\end{equation}


[\textit{Proof:} Let us first find the probability of the event
\textquotedblleft the first $n+k$ times that we toss the coin, it comes up
tails exactly $k$ times\textquotedblright.

Indeed, the first $n+k$ tosses of the coin can give $2^{n+k}$ different
outcomes (where we treat an outcome as an $\left(  n+k\right)  $-tuple of
heads/tails events\footnote{For example, the outcome \textquotedblleft the
coin comes up heads, then tails, then heads\textquotedblright\ is encoded as
the $3$-tuple $\left(  \text{\textquotedblleft heads\textquotedblright%
},\text{\textquotedblleft tails\textquotedblright},\text{\textquotedblleft
heads\textquotedblright}\right)  $.}). All these $2^{n+k}$ outcomes are
equally probable (since the coin is fair), and thus have probability
$\dfrac{1}{2^{n+k}}$ each. How many of these $2^{n+k}$ outcomes have the
property that the coin comes up tails exactly $k$ times? An outcome $O$ of the
first $n+k$ tosses is uniquely determined by the set
\[
I_{O}:=\left\{  i\in\left\{  1,2,\ldots,n+k\right\}  \ \mid\ \text{the coin
comes up tails in the }i\text{-th toss}\right\}  .
\]
The coin comes up tails exactly $k$ times in this outcome $O$ if and only if
the set $I_{O}$ has size $k$. Thus, we are looking for the \# of $k$-element
subsets of $\left\{  1,2,\ldots,n+k\right\}  $; but Theorem
\ref{thm.binom.comb} shows that this \# is $\dbinom{n+k}{k}$. Thus, there are
precisely $\dbinom{n+k}{k}$ many outcomes (of the first $n+k$ tosses) that
have the property that the coin comes up tails exactly $k$ times. Since each
outcome has probability $\dfrac{1}{2^{n+k}}$, we thus conclude that
\begin{align}
&  \Pr\left(  \text{\textquotedblleft the first }n+k\text{ times that we toss
the coin,}\right. \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up tails exactly }k\text{
times\textquotedblright}\right) \nonumber\\
&  =\dbinom{n+k}{k}\cdot\dfrac{1}{2^{n+k}}.
\label{sol.enum.coin-sum-2k.PrHk=prod.pf.3}%
\end{align}


Also, since our coin is fair, we have%
\begin{align}
&  \Pr\left(  \text{\textquotedblleft the coin comes up heads the }\left(
n+k+1\right)  \text{-st time we toss it\textquotedblright}\right) \nonumber\\
&  =\dfrac{1}{2}. \label{sol.enum.coin-sum-2k.PrHk=prod.pf.4}%
\end{align}


But the different tosses of the coin are independent. Hence,
\begin{align*}
&  \Pr\left(  \text{\textquotedblleft the first }n+k\text{ times that we toss
the coin,}\right. \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up tails
exactly }k\text{ times; furthermore,}\right. \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up heads the
}\left(  n+k+1\right)  \text{-st time we toss it\textquotedblright}\right) \\
&  =\Pr\left(  \text{\textquotedblleft the first }n+k\text{ times that we toss
the coin,}\right. \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left.  \text{it comes up tails
exactly }k\text{ times\textquotedblright}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \cdot\Pr\left(  \text{\textquotedblleft the coin comes
up heads the }\left(  n+k+1\right)  \text{-st time we toss
it\textquotedblright}\right) \\
&  =\dbinom{n+k}{k}\cdot\dfrac{1}{2^{n+k}}\cdot\dfrac{1}{2}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.enum.coin-sum-2k.PrHk=prod.pf.3}) and
(\ref{sol.enum.coin-sum-2k.PrHk=prod.pf.4})}\right)  .
\end{align*}
Since the event on the left hand side of this equality is precisely $H_{k}$,
we can rewrite this equality as $\Pr\left(  H_{k}\right)  =\dbinom{n+k}%
{k}\cdot\dfrac{1}{2^{n+k}}\cdot\dfrac{1}{2}$. Thus,
(\ref{sol.enum.coin-sum-2k.PrHk=prod}) is proved.]

Now, (\ref{sol.enum.coin-sum-2k.PrH=sum}) becomes%
\begin{align*}
\Pr H  &  =\Pr\left(  H_{0}\right)  +\Pr\left(  H_{1}\right)  +\cdots
+\Pr\left(  H_{n}\right)  =\sum_{k=0}^{n}\underbrace{\Pr\left(  H_{k}\right)
}_{\substack{=\dbinom{n+k}{k}\cdot\dfrac{1}{2^{n+k}}\cdot\dfrac{1}%
{2}\\\text{(by (\ref{sol.enum.coin-sum-2k.PrHk=prod}))}}}\\
&  =\sum_{k=0}^{n}\dbinom{n+k}{k}\cdot\underbrace{\dfrac{1}{2^{n+k}}}%
_{=\dfrac{1}{2^{n}}\cdot\dfrac{1}{2^{k}}}\cdot\dfrac{1}{2}=\sum_{k=0}%
^{n}\dbinom{n+k}{k}\cdot\dfrac{1}{2^{n}}\cdot\dfrac{1}{2^{k}}\cdot\dfrac{1}%
{2}\\
&  =\dfrac{1}{2}\cdot\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n+k}{k}%
\dfrac{1}{2^{k}}.
\end{align*}
The same argument (with the roles of heads and tails interchanged) yields%
\[
\Pr T=\dfrac{1}{2}\cdot\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n+k}%
{k}\dfrac{1}{2^{k}}.
\]
Adding these two equalities together, we find%
\begin{align*}
\Pr H+\Pr T  &  =\dfrac{1}{2}\cdot\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}%
\dbinom{n+k}{k}\dfrac{1}{2^{k}}+\dfrac{1}{2}\cdot\dfrac{1}{2^{n}}\cdot
\sum_{k=0}^{n}\dbinom{n+k}{k}\dfrac{1}{2^{k}}\\
&  =2\cdot\dfrac{1}{2}\cdot\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n+k}%
{k}\dfrac{1}{2^{k}}=\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n+k}{k}%
\dfrac{1}{2^{k}}.
\end{align*}
Comparing this with $\Pr H+\Pr T=1$, we obtain%
\[
\dfrac{1}{2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n+k}{k}\dfrac{1}{2^{k}}=1.
\]
Hence,%
\[
\sum_{k=0}^{n}\dbinom{n+k}{k}\dfrac{1}{2^{k}}=2^{n}.
\]
This solves Exercise \ref{exe.enum.coin-sum-2k}.
\end{proof}

The solution we just gave for Exercise \ref{exe.enum.coin-sum-2k} suggests a
generalization, which can be obtained if we replace the fair coin by a biased
coin. (See \cite[Exercise 3.27 \textbf{(a)}]{detnotes} for this
generalization, which is known as the Daubechies identity.)

Results like Theorem \ref{thm.binom.vanderRR}, Theorem
\ref{thm.binom.trin-revRR}, Theorem \ref{thm.binom.sym}, Proposition
\ref{prop.binom.upneg}, Theorem \ref{thm.binom.rec}, Exercise
\ref{exe.binom.hock-neg-hock} and Exercise \ref{exe.enum.coin-sum-2k} are
commonly called \textit{binomial identities}, as they are identities involving
binomial coefficients. We shall see several more such identities in the coming
sections. Even more can be found in \cite[Chapter 5]{GKP}, \cite{Spivey19},
\cite{Riorda68} and \cite{BenQui03}. (The book \cite{BenQui03}, in particular,
is devoted to proving such identities by double counting.)

\subsection{Recitation \#7: More on counting and binomial coefficients}

Here are some more exercises on counting and binomial coefficients.

\subsubsection{More binomial identities}

The first of these exercises (\cite[Proposition 2.6.13]{19fco}) is a binomial
identity sometimes called the \textquotedblleft upside-down Chu--Vandermonde
identity\textquotedblright\ (since it looks like Proposition
\ref{prop.binom.vanderNN} with the binomial coefficients turned
\textquotedblleft upside down\textquotedblright):

\begin{exercise}
\label{exe.binom.ud-Vander}Let $n\in\mathbb{N}$ and $x,y\in\mathbb{N}$. Prove
that%
\[
\dbinom{n+1}{x+y+1}=\sum_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y}.
\]

\end{exercise}

Note that (unlike Proposition \ref{prop.binom.vanderNN}) this exercise
\textbf{cannot} be generalized to $x,y\in\mathbb{C}$. (For instance, $n=0$ and
$x=-1$ and $y=0$ would be a counterexample.)

\begin{proof}
[First solution to Exercise \ref{exe.binom.ud-Vander} (sketched).]The
following proof is the same as \cite[\S 2.6.5, second proof of Proposition
2.6.13]{19fco}.

We apply double counting. Specifically, we ask ourselves: How many $\left(
x+y+1\right)  $-element subsets does the set $\left[  n+1\right]  $ have? As
always, we shall answer this question in two ways:

\textit{First way:} The answer is $\dbinom{n+1}{x+y+1}$, since Theorem
\ref{thm.binom.comb} (applied to $n+1$, $\left[  n+1\right]  $ and $x+y+1$
instead of $n$, $S$ and $k$) shows that%
\begin{align}
&  \left(  \text{\# of }\left(  x+y+1\right)  \text{-element subsets of
}\left[  n+1\right]  \right) \nonumber\\
&  =\dbinom{n+1}{x+y+1}. \label{sol.binom.ud-Vander.1}%
\end{align}


\textit{Second way:} If $U$ is any set of integers, and $k\in\left\{
1,2,\ldots,\left\vert U\right\vert \right\}  $, then we let $\min
\nolimits_{k}U$ denote the $k$-th smallest element of $U$. For example,
$\min\nolimits_{2}\left\{  3,6,8,9\right\}  =6$ and $\min\nolimits_{4}\left\{
3,6,8,9\right\}  =9$.

If $U$ is an $\left(  x+y+1\right)  $-element subset of $\left[  n+1\right]
$, then $\min\nolimits_{x+1}U$ is well-defined (since $x+1\in\left\{
1,2,\ldots,x+y+1\right\}  =\left\{  1,2,\ldots,\left\vert U\right\vert
\right\}  $) and belongs to $U$ and therefore to $\left[  n+1\right]  $ (since
$U\subseteq\left[  n+1\right]  $). Hence, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of }\left(  x+y+1\right)  \text{-element subsets of
}\left[  n+1\right]  \right) \\
&  =\sum_{j\in\left[  n+1\right]  }\left(  \text{\# of }\left(  x+y+1\right)
\text{-element subsets }U\text{ of }\left[  n+1\right]  \text{ satisfying
}\min\nolimits_{x+1}U=j\right)  .
\end{align*}
(Some addends on the right hand side of this equality will be $0$, but as
usual we are OK with this.)

Now, fix $j\in\left[  n+1\right]  $. Let us compute
\[
\left(  \text{\# of }\left(  x+y+1\right)  \text{-element subsets }U\text{ of
}\left[  n+1\right]  \text{ satisfying }\min\nolimits_{x+1}U=j\right)  .
\]
If $U$ is an $\left(  x+y+1\right)  $-element subset of $\left[  n+1\right]  $
satisfying $\min\nolimits_{x+1}U=j$, then $U$ has precisely $x$ elements
smaller than $j$ (by the definition of $\min\nolimits_{x+1}U$) and therefore
precisely $\left(  x+y+1\right)  -\left(  x+1\right)  =y$ elements larger than
$j$. Hence, we can construct such a subset $U$ through the following procedure:

\begin{itemize}
\item First, we choose the $x$ elements of $U$ that are smaller than $j$. We
have $\dbinom{j-1}{x}$ options for this. (Indeed, the $x$ elements we are
choosing need to belong to $\left[  n+1\right]  $ and be smaller than $j$;
that is, they need to come from the set $\left\{  1,2,\ldots,j-1\right\}  $.
Thus, we are really choosing an $x$-element subset of the set $\left(
j-1\right)  $-element set $\left\{  1,2,\ldots,j-1\right\}  $. But Theorem
\ref{thm.binom.comb} says that there are precisely $\dbinom{j-1}{x}$ many such subsets.)

\item Then, we choose the $y$ elements of $U$ that are larger than $j$. We
have $\dbinom{n+1-j}{y}$ options for this. (Indeed, the $y$ elements we are
choosing need to belong to $\left[  n+1\right]  $ and be larger than $j$; that
is, they need to come from the set $\left\{  j+1,j+2,\ldots,n+1\right\}  $.
Thus, we are really choosing a $y$-element subset of the set $\left(
n+1-j\right)  $-element set $\left\{  j+1,j+2,\ldots,n+1\right\}  $. But
Theorem \ref{thm.binom.comb} says that there are precisely $\dbinom{n+1-j}{y}$
many such subsets.)

\item We don't need to decide whether $j$ will be an element of $U$, since
this is already predetermined: We must have $j\in U$ in order to have
$\min\nolimits_{x+1}U=j$.
\end{itemize}

\noindent According to the product rule, there are $\dbinom{j-1}{x}%
\dbinom{n+1-j}{y}$ possibilities for how these choices can be made. Thus,%
\begin{align}
&  \left(  \text{\# of }\left(  x+y+1\right)  \text{-element subsets }U\text{
of }\left[  n+1\right]  \text{ satisfying }\min\nolimits_{x+1}U=j\right)
\nonumber\\
&  =\dbinom{j-1}{x}\dbinom{n+1-j}{y}. \label{sol.binom.ud-Vander.3}%
\end{align}


Now, forget that we fixed $j$. Recall that%
\begin{align}
&  \left(  \text{\# of }\left(  x+y+1\right)  \text{-element subsets of
}\left[  n+1\right]  \right) \nonumber\\
&  =\sum_{j\in\left[  n+1\right]  }\underbrace{\left(  \text{\# of }\left(
x+y+1\right)  \text{-element subsets }U\text{ of }\left[  n+1\right]  \text{
satisfying }\min\nolimits_{x+1}U=j\right)  }_{\substack{=\dbinom{j-1}%
{x}\dbinom{n+1-j}{y}\\\text{(by (\ref{sol.binom.ud-Vander.3}))}}}\nonumber\\
&  =\underbrace{\sum_{j\in\left[  n+1\right]  }}_{=\sum_{j=1}^{n+1}}%
\dbinom{j-1}{x}\underbrace{\dbinom{n+1-j}{y}}_{\substack{=\dbinom{n-\left(
j-1\right)  }{y}\\\text{(since }n+1-j=n-\left(  j-1\right)  \text{)}}%
}=\sum_{j=1}^{n+1}\dbinom{j-1}{x}\dbinom{n-\left(  j-1\right)  }{y}\nonumber\\
&  =\sum_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y} \label{sol.binom.ud-Vander.6}%
\end{align}
(here, we have substituted $k$ for $j-1$ in the sum).

Comparing (\ref{sol.binom.ud-Vander.6}) with (\ref{sol.binom.ud-Vander.1}), we
obtain%
\[
\dbinom{n+1}{x+y+1}=\sum_{k=0}^{n}\dbinom{k}{x}\dbinom{n-k}{y}.
\]
This solves Exercise \ref{exe.binom.ud-Vander}.
\end{proof}

There is also an alternative, algebraic solution to Exercise
\ref{exe.binom.ud-Vander}, which proceeds by applying the Chu--Vandermonde
identity (Theorem \ref{thm.binom.vanderRR}) to $n-x-y$, $-x-1$ and $-y-1$
instead of $n$, $x$ and $y$ (this requires $n-x-y\in\mathbb{N}$, but the case
when this is not so can easily be boiled down to $0=0$) and rewriting the
result using symmetry (Theorem \ref{thm.binom.sym}) and upper negation
(Proposition \ref{prop.binom.upneg}). See \cite[first proof of Proposition
2.6.13]{19fco} for the details of this solution. This solution illustrates how
useful it can be to plug in \textquotedblleft combinatorially
meaningless\textquotedblright\ values (like, in our case, the negative numbers
$-x-1$ and $-y-1$) into binomial identities (presuming, of course, that said
identities do hold for these values; this is why we have bothered to
generalize the Chu--Vandermonde identity from $x,y\in\mathbb{N}$ to
$x,y\in\mathbb{C}$).

\begin{remark}
Exercise \ref{exe.binom.hock-neg-hock} \textbf{(a)} (which is commonly known
as the \textquotedblleft hockey-stick identity\textquotedblright) is a
particular case of Exercise \ref{exe.binom.ud-Vander}. Figure out why! (See
\cite[Exercise 2.6.4]{19fco} for the answer.)
\end{remark}

Here is another binomial identity:

\begin{exercise}
\label{exe.binom.polariz-cor-1}Let $a,b\in\mathbb{C}$ and $n,m\in\mathbb{N}$
satisfy $m<n$. Prove that
\[
\sum_{j=0}^{n}\left(  -1\right)  ^{j}\dbinom{n}{j}\dbinom{aj+b}{m}=0.
\]

\end{exercise}

Before we solve this exercise, let me quickly mention that Exercise
\ref{exe.binom.polariz-cor-1} is a generalization of Proposition
\ref{prop.binom.sum-alt-row}. Indeed, if $n$ is a positive integer, then
Exercise \ref{exe.binom.polariz-cor-1} (applied to $m=0$, $a=1$ and $b=0$)
yields%
\[
\sum_{j=0}^{n}\left(  -1\right)  ^{j}\dbinom{n}{j}\dbinom{1j+0}{0}=0=\left[
n=0\right]  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\neq0\right)
\]
and thus%
\[
\left[  n=0\right]  =\sum_{j=0}^{n}\left(  -1\right)  ^{j}\dbinom{n}%
{j}\underbrace{\dbinom{1j+0}{0}}_{\substack{=1\\\text{(by
(\ref{eq.exa.binom.small.nC0}))}}}=\sum_{j=0}^{n}\left(  -1\right)
^{j}\dbinom{n}{j}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k};
\]
but this is precisely the claim of Proposition \ref{prop.binom.sum-alt-row} in
the case when $n>0$. Thus, in the case when $n>0$, Proposition
\ref{prop.binom.sum-alt-row} follows from Exercise
\ref{exe.binom.polariz-cor-1}. (The case when $n=0$ is trivial.)

There are various ways to solve Exercise \ref{exe.binom.polariz-cor-1}, but
the following is perhaps the shortest (and has the advantage of illustrating
the usefulness of Exercise \ref{exe.findiff.poly1}):

\begin{proof}
[Solution to Exercise \ref{exe.binom.polariz-cor-1}.]Define a polynomial $P$
(with complex coefficients, in a single variable $X$) by
\[
P\left(  X\right)  =\dbinom{-aX+b}{m}.
\]
\footnote{Here we are using binomial coefficients $\dbinom{F}{k}$ in which $F$
is a polynomial. See our above proof of Theorem \ref{thm.binom.trin-revRR} for
the definition of this kind of binomial coefficients.} Thus,
\begin{align*}
P\left(  X\right)   &  =\dbinom{-aX+b}{m}\\
&  =\dfrac{\left(  -aX+b\right)  \left(  -aX+b-1\right)  \left(
-aX+b-2\right)  \cdots\left(  -aX+b-m+1\right)  }{m!}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.def.binom.def.aP}), since
}m\in\mathbb{N}\right)  .
\end{align*}
Hence, the polynomial $P$ has degree $\leq m$ (since each of the $m$ factors
$-aX+b$, $-aX+b-1$, $-aX+b-2$, $\ldots$, $-aX+b-m+1$ in the numerator has
degree $\leq1$\ \ \ \ \footnote{You may be tempted to say \textquotedblleft
degree $1$\textquotedblright, but this would not be quite correct: If $a=0$,
then all these factors are constants and thus have degree $0$.}, whereas the
denominator is just a constant). Thus, Exercise \ref{exe.findiff.poly1}
\textbf{(d)} yields that each $x\in\mathbb{N}$ satisfies%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(  x-k\right)  =0
\]
(since $n>m$ (because we assumed that $m<n$)). Applying this to $x=0$, we
obtain%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(  0-k\right)  =0.
\]
Thus,%
\begin{align*}
0  &  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(
\underbrace{0-k}_{=-k}\right)  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}%
\dbinom{n}{k}\underbrace{P\left(  -k\right)  }_{\substack{=\dbinom{-a\left(
-k\right)  +b}{m}\\\text{(since }P\left(  X\right)  =\dbinom{-aX+b}{m}%
\text{)}}}\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\underbrace{\dbinom
{-a\left(  -k\right)  +b}{m}}_{\substack{=\dbinom{ak+b}{m}\\\text{(since
}-a\left(  -k\right)  =ak\text{)}}}=\sum_{k=0}^{n}\left(  -1\right)
^{k}\dbinom{n}{k}\dbinom{ak+b}{m}\\
&  =\sum_{j=0}^{n}\left(  -1\right)  ^{j}\dbinom{n}{j}\dbinom{aj+b}{m}.
\end{align*}
This solves Exercise \ref{exe.binom.polariz-cor-1}.
\end{proof}

\subsubsection{Counting perfect matchings of a finite set}

Let us count something else: set partitions.

\begin{definition}
\label{def.enum.setpar}Let $S$ be a set.

\textbf{(a)} A \textit{set partition} of $S$ means a set $\left\{  E_{1}%
,E_{2},\ldots,E_{k}\right\}  $ of disjoint nonempty subsets of $S$ satisfying
$S=E_{1}\cup E_{2}\cup\cdots\cup E_{k}$.

\textbf{(b)} If $P=\left\{  E_{1},E_{2},\ldots,E_{k}\right\}  $ is a set
partition of $S$, then the sets $E_{1},E_{2},\ldots,E_{k}$ are called the
\textit{blocks} of $P$.
\end{definition}

\begin{example}
\label{exa.enum.setpar.1}\textbf{(a)} Here are three set partitions of the set
$\left[  6\right]  =\left\{  1,2,3,4,5,6\right\}  $:%
\begin{align*}
P_{1}  &  =\left\{  \left\{  1,3\right\}  ,\left\{  2,4,5\right\}  ,\left\{
6\right\}  \right\}  ;\\
P_{2}  &  =\left\{  \left\{  1\right\}  ,\left\{  2,4,5,6\right\}  ,\left\{
3\right\}  \right\}  ;\\
P_{3}  &  =\left\{  \left\{  1\right\}  ,\left\{  3\right\}  ,\left\{
2,5,6,4\right\}  \right\}  .
\end{align*}
Note that the set partitions $P_{2}$ and $P_{3}$ are actually identical (since
the order of elements in a set does not matter).

\textbf{(b)} 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 block of the set
partition is drawn as 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 (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] (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[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}

If $S$ is a set, and if $P$ is a set partition of $S$, then any element of $S$
belongs to exactly one block of $P$. Readers familiar with equivalence
relations will thus recognize the notion of a set partition as a different
language for the notion of an equivalence relation.\footnote{Namely:
\par
\begin{itemize}
\item If $\sim$ is an equivalence relation on a set $S$, then the set of all
equivalence classes of $\sim$ is a set partition of $S$.
\par
\item If $P$ is a set partition of a set $S$, then the binary relation
\textquotedblleft$a$ and $b$ belong to one and the same block of
$P$\textquotedblright\ (on two elements $a$ and $b$ of $S$) is an equivalence
relation on $S$.
\end{itemize}
\par
Thus, we can transform an equivalence relation into a set partition and vice
versa. These two transformations are mutually inverse, so they are bijections
between $\left\{  \text{equivalence relations on }S\right\}  $ and $\left\{
\text{set partitions on }S\right\}  $ (for a given set $S$). The proof of this
is completely straightforward axiom checking; you can find it spelled out in
\cite[Proposition 2.6.7]{Goodman}.}

\begin{remark}
\label{rmk.enum.setpar.bell}Let $n\in\mathbb{N}$. The \# of all set partitions
of $\left[  n\right]  $ is known as the $n$\textit{-th
\href{https://en.wikipedia.org/wiki/Bell_number}{\textit{Bell number}}}
$B_{n}$. The sequence $\left(  B_{0},B_{1},B_{2},\ldots\right)  =\left(
1,1,2,5,15,52,203,\ldots\right)  $ is \href{https://oeis.org/A000110}{Sequence
A000110} in the OEIS, and has the following nice recursive formula:%
\[
B_{n+1}=\sum_{k=0}^{n}\dbinom{n}{k}B_{k}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\in\mathbb{N}\text{.}%
\]
(It is a neat exercise on counting to prove this. A proof can be found in
\cite[Theorem 1.4.3]{Guicha20}.) No closed form expression for $B_{n}$ is
known. (See \cite[Chapter Two]{Gardne91} for a popular-science survey of Bell numbers.)
\end{remark}

We want to count a certain special type of set partitions:

\begin{definition}
\label{def.enum.perf-matchs}Let $S$ be a set. A \textit{perfect matching} of
$S$ shall mean a set partition $\left\{  E_{1},E_{2},\ldots,E_{k}\right\}  $
of $S$ such that $E_{1},E_{2},\ldots,E_{k}$ are $2$-element sets.
\end{definition}

\begin{example}
\textbf{(a)} Here are all perfect matchings of the set $\left[  4\right]
=\left\{  1,2,3,4\right\}  $:%
\[
\left\{  \left\{  1,2\right\}  ,\left\{  3,4\right\}  \right\}
,\ \ \ \ \ \ \ \ \ \ \left\{  \left\{  1,3\right\}  ,\left\{  2,4\right\}
\right\}  ,\ \ \ \ \ \ \ \ \ \ \left\{  \left\{  1,4\right\}  ,\left\{
2,3\right\}  \right\}  .
\]
And here are the same perfect matchings, drawn as pictures (each block of the
perfect matching is drawn as a blob):%
\[%
\begin{array}
[c]{c|c|c}%
\begin{tikzpicture} \draw (0, 1) ellipse (0.7 and 1.9); \draw (2, 1) ellipse (0.7 and 1.9); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at (0, 2) {2}; \node (c) at (2, 2) {3}; \node (d) at (2, 0) {4}; \end{tikzpicture} &
\begin{tikzpicture} \draw[rotate=45] (1.3, 0) ellipse (2.1 and 0.7); \draw[rotate=-45] (0, 1.3) ellipse (2.1 and 0.7); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at (0, 2) {2}; \node (c) at (2, 2) {3}; \node (d) at (2, 0) {4}; \end{tikzpicture} &
\begin{tikzpicture} \draw (1, 0) ellipse (1.9 and 0.7); \draw (1, 2) ellipse (1.9 and 0.7); \tikzstyle{every node} = [circle] \node (a) at (0, 0) {1}; \node (b) at (0, 2) {2}; \node (c) at (2, 2) {3}; \node (d) at (2, 0) {4}; \end{tikzpicture}
\end{array}
\]


\textbf{(b)} The set $\left[  6\right]  $ has $15$ perfect matchings; three of
them are%
\[
\left\{  \left\{  1,2\right\}  ,\left\{  3,4\right\}  ,\left\{  5,6\right\}
\right\}  ,\ \ \ \ \ \ \ \ \ \ \left\{  \left\{  1,4\right\}  ,\left\{
2,6\right\}  ,\left\{  3,5\right\}  \right\}  ,\ \ \ \ \ \ \ \ \ \ \left\{
\left\{  1,6\right\}  ,\left\{  2,5\right\}  ,\left\{  3,4\right\}  \right\}
.
\]


\textbf{(c)} The set $\left[  5\right]  $ has no perfect matchings.
\end{example}

One can think of a perfect matching of a set $S$ as a way to pair up the
elements of $S$ with each other in such a way that each element of $S$ ends up
in exactly one pair. (Here, the word \textquotedblleft pair\textquotedblright%
\ is to be understood in its common-language meaning, not in its mathematical
meaning; the correct mathematical word is \textquotedblleft two-element
set\textquotedblright.)

\begin{exercise}
\label{exe.enum.perf-matchs}Let $n\in\mathbb{N}$. Let $S$ be an $n$-element
set. Find the \# of all perfect matchings of $S$.
\end{exercise}

We shall sketch two solutions to Exercise \ref{exe.enum.perf-matchs}, without
ever going fully rigorous (which would be rather tedious in this particular
case). Our first solution will use a decision procedure to construct a perfect
matching of $S$ (which will allow counting the perfect matchings of $S$ via
the dependent product rule), while our second will exemplify a counting
strategy known as \textit{overcounting}.

\begin{proof}
[First solution to Exercise \ref{exe.enum.perf-matchs} (sketched).]Let us
first show the following:

\begin{statement}
\textit{Claim 1:} If $n$ is odd, then $\left(  \text{\# of perfect matchings
of }S\right)  =0$.
\end{statement}

[\textit{Proof of Claim 1:} Let $n$ be odd. We must prove that $\left(
\text{\# of perfect matchings of }S\right)  =0$.

Assume the contrary. Thus, there exists a perfect matching of $S$. Consider
this perfect matching, and denote it by $\left\{  E_{1},E_{2},\ldots
,E_{k}\right\}  $ (with $E_{1},E_{2},\ldots,E_{k}$ being distinct).

Now, $\left\{  E_{1},E_{2},\ldots,E_{k}\right\}  $ is a perfect matching of
$S$. In other words, $\left\{  E_{1},E_{2},\ldots,E_{k}\right\}  $ is a set
partition of $S$ such that $E_{1},E_{2},\ldots,E_{k}$ are $2$-element sets (by
the definition of \textquotedblleft perfect matching\textquotedblright). Since
$E_{1},E_{2},\ldots,E_{k}$ are $2$-element sets, we have $\left\vert
E_{1}\right\vert =2$, $\left\vert E_{2}\right\vert =2$, $\ldots$, $\left\vert
E_{k}\right\vert =2$.

We know that $\left\{  E_{1},E_{2},\ldots,E_{k}\right\}  $ is a set partition
of $S$. In other words, $E_{1},E_{2},\ldots,E_{k}$ are disjoint subsets of $S$
satisfying $S=E_{1}\cup E_{2}\cup\cdots\cup E_{k}$ (by the definition of
\textquotedblleft set partition\textquotedblright). Now, since $S$ is an
$n$-element set, we have%
\begin{align*}
n  &  =\left\vert S\right\vert =\left\vert E_{1}\cup E_{2}\cup\cdots\cup
E_{k}\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{since }S=E_{1}\cup
E_{2}\cup\cdots\cup E_{k}\right) \\
&  =\left\vert E_{1}\right\vert +\left\vert E_{2}\right\vert +\cdots
+\left\vert E_{k}\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
E_{1},E_{2},\ldots,E_{k}\text{ are disjoint}\right) \\
&  =\underbrace{2+2+\cdots+2}_{k\text{ times}}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }\left\vert E_{1}\right\vert =2\text{, }\left\vert E_{2}%
\right\vert =2\text{, }\ldots\text{, }\left\vert E_{k}\right\vert =2\right) \\
&  =k\cdot2=2k.
\end{align*}
This entails that $n$ is even. This contradicts the fact that $n$ is odd. This
contradiction shows that our assumption was false. Hence, Claim 1 is proven.]

Claim 1 solves Exercise \ref{exe.enum.perf-matchs} in the case when $n$ is
odd. Thus, for the rest of this solution, we WLOG assume that $n$ is even.
Thus, $n/2\in\mathbb{N}$.

We WLOG assume that $S=\left[  n\right]  $. Indeed, $S$ is an $n$-element set,
so we can relabel the elements of $S$ as $1,2,\ldots,n$; this clearly does not
change the \# of perfect matchings of $S$ (because, as we relabel the elements
of $S$, we can relabel the elements of the blocks in all perfect matchings of
$S$\ \ \ \ \footnote{What we are actually using here is the \textquotedblleft
isomorphism principle\textquotedblright. See \cite[\S 1.7.2]{19fco} for some
more discussion about this principle.}).

If $P$ is a perfect matching of $S$, then we shall say that two distinct
elements of $S$ are \textit{partners} of each other (in $P$) if and only if
they belong to one and the same block of $P$. Given a perfect matching $P$ of
$S$, it is clear that any element of $S$ has exactly one partner (in $P$),
since each block of $P$ is a $2$-element set (and since any element of $S$
belongs to exactly one block of $P$). For example, if $P$ is the perfect
matching $\left\{  \left\{  1,4\right\}  ,\left\{  2,3\right\}  \right\}  $ of
the set $\left\{  1,2,3,4\right\}  $, then the partner of $1$ (in $P$) is $4$.

Clearly, if $P$ is a perfect matching of $S$, then the partner of any $p\in S$
(in $P$) is an element $q\in S$ distinct from $p$, and the partner of this
latter element $q$ is $p$ again. Moreover, a perfect matching of $S$ is
uniquely determined if we know the partner of each element. This suggests the
following method for constructing a perfect matching $P$ of $S$:

\begin{itemize}
\item Choose the partner of $1$ (in $P$). There are $n-1$ options for this
(since the partner of $1$ must be distinct from $1$). We declare both $1$ and
its partner to be \textit{partnered}.

\item Take the smallest unpartnered\footnote{We call an element of $S$
\textit{unpartnered} if we have not declared it to be partnered yet. (Of
course, in the perfect matching we are constructing, it will eventually have a
partner.) The smallest unpartnered element of $S$ is $2$ if the partner we
have chosen for $1$ is distinct from $2$; otherwise, it is $3$.} element
$p_{2}$ of $S$, and choose its partner. There are $n-3$ options (since neither
$p_{2}$ nor the two partnered elements qualify as partners). We declare both
$p_{2}$ and its partner to be \textit{partnered}.

\item Take the smallest unpartnered element $p_{3}$ of $S$, and choose its
partner. There are $n-5$ options (since neither $p_{3}$ nor the four partnered
elements qualify as partners). We declare both $p_{3}$ and its partner to be
\textit{partnered}.

\item We go on like this until no more unpartnered elements of $S$ remain.
Since $n$ is even, this will happen after precisely $n/2$ choices of partners,
since every such choice removes exactly $2$ elements from the set of
unpartnered elements.
\end{itemize}

\noindent The dependent product rule shows that there are precisely
\[
\left(  n-1\right)  \left(  n-3\right)  \left(  n-5\right)  \cdots\left(
n-2\left(  n/2\right)  +1\right)
\]
possibilities for how these choices can be made. Each possibility leads to a
different perfect matching of $S$, and each perfect matching of $S$ can be
obtained in this way. Hence,%
\begin{align}
&  \left(  \text{\# of perfect matchings of }S\right) \nonumber\\
&  =\left(  n-1\right)  \left(  n-3\right)  \left(  n-5\right)  \cdots
\underbrace{\left(  n-2\left(  n/2\right)  +1\right)  }_{=1}\nonumber\\
&  =\left(  n-1\right)  \left(  n-3\right)  \left(  n-5\right)  \cdots
1\nonumber\\
&  =1\cdot3\cdot5\cdot\cdots\cdot\left(  \underbrace{n}_{=2\left(  n/2\right)
}-1\right) \label{sol.enum.perf-matchs.1st.even-case1}\\
&  =1\cdot3\cdot5\cdot\cdots\cdot\left(  2\left(  n/2\right)  -1\right)
\nonumber\\
&  =\dfrac{\left(  2\left(  n/2\right)  \right)  !}{2^{n/2}\left(  n/2\right)
!}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Exercise \ref{exe.odd-factorial},
applied to }n/2\text{ instead of }n\right) \nonumber\\
&  =\dfrac{n!}{2^{n/2}\cdot\left(  n/2\right)  !}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }2\left(  n/2\right)  =n\right)  .
\label{sol.enum.perf-matchs.1st.even-case2}%
\end{align}


Combining this with Claim 1, we thus conclude that%
\[
\left(  \text{\# of perfect matchings of }S\right)  =%
\begin{cases}
0, & \text{if }n\text{ is odd;}\\
\dfrac{n!}{2^{n/2}\cdot\left(  n/2\right)  !}, & \text{if }n\text{ is even.}%
\end{cases}
\]


[\textit{Remark:} Instead of proving Claim 1 the way we did above, we could
have used the same decision procedure that we used in the case when $n$ is
even. This would have given a different proof of Claim 1. Indeed, the last
decision in our decision procedure requires choosing a partner for the
smallest unpartnered element; if $n$ is odd, then there are $0$ options for
it, because the smallest unpartnered element at that point is the last
unpartnered element and thus cannot find a partner. This entails that (if $n$
is odd) the number of possibilities is $\left(  n-1\right)  \left(
n-3\right)  \left(  n-5\right)  \cdots0=0$. Thus, Claim 1 is proved again.]
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.enum.perf-matchs} (sketched).]As in the
first solution above, we can show that $\left(  \text{\# of perfect matchings
of }S\right)  =0$ when $n$ is odd. Thus, for the rest of this solution, we
WLOG assume that $n$ is even.

Again, as in the first solution above, we WLOG assume that $S=\left[
n\right]  $. Thus, we need to find the \# of perfect matchings of $\left[
n\right]  $.

To each permutation $\sigma$ of $\left[  n\right]  $, we assign the perfect
matching%
\[
M\left(  \sigma\right)  :=\left\{  \left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  \right\}  ,\ \ \left\{  \sigma\left(  3\right)
,\sigma\left(  4\right)  \right\}  ,\ \ \ldots,\ \ \left\{  \sigma\left(
n-1\right)  ,\sigma\left(  n\right)  \right\}  \right\}  \text{ of }\left[
n\right]  .
\]
(Note that this is well-defined because $n$ is even, and is a perfect matching
because $\sigma$ is bijective.) Thus, we have found a map%
\[
M:\left\{  \text{permutations of }\left[  n\right]  \right\}  \rightarrow
\left\{  \text{perfect matchings of }\left[  n\right]  \right\}  .
\]


We know that there are $n!$ permutations of $\left[  n\right]  $. What does
this mean about the \# of perfect matchings of $\left[  n\right]  $ ?

The map $M$ is not a bijection (unless $n=0$), since different permutations
$\sigma$ can lead to the same perfect matching $M\left(  \sigma\right)  $.
Thus, we cannot apply the bijection principle. However, we might be able to
salvage the idea if we can compute \textbf{how many} different permutations
$\sigma$ lead to a single perfect matching.

Thus, let us fix a perfect matching $P$ of $\left[  n\right]  $. How many
permutations $\sigma$ of $\left[  n\right]  $ satisfy $M\left(  \sigma\right)
=P$ ?

Each block of $P$ is a $2$-element set (since $P$ is a perfect matching), and
the sum of the sizes of these $2$-element sets is $\left\vert \left[
n\right]  \right\vert $ (since $P$ is a set partition of $\left[  n\right]
$). Thus, the \# of blocks of $P$ is $\underbrace{\left\vert \left[  n\right]
\right\vert }_{=n}/2=n/2$. In other words, $P$ has exactly $n/2$ blocks.
Hence, we can write $P$ in the form
\[
P=\left\{  \left\{  i_{1},i_{2}\right\}  ,\ \ \left\{  i_{3},i_{4}\right\}
,\ \ \ldots,\ \ \left\{  i_{n-1},i_{n}\right\}  \right\}  ,
\]
where $i_{1},i_{2},\ldots,i_{n}$ are the elements of $\left[  n\right]  $ in
some order. If $\sigma$ is a permutation of $\left[  n\right]  $ that
satisfies $M\left(  \sigma\right)  =P$, then we must thus have%
\begin{align*}
&  \left\{  \left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
\right\}  ,\ \ \left\{  \sigma\left(  3\right)  ,\sigma\left(  4\right)
\right\}  ,\ \ \ldots,\ \ \left\{  \sigma\left(  n-1\right)  ,\sigma\left(
n\right)  \right\}  \right\} \\
&  =M\left(  \sigma\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the
definition of }M\left(  \sigma\right)  \right) \\
&  =P=\left\{  \left\{  i_{1},i_{2}\right\}  ,\ \ \left\{  i_{3}%
,i_{4}\right\}  ,\ \ \ldots,\ \ \left\{  i_{n-1},i_{n}\right\}  \right\}  .
\end{align*}
This means that the $n/2$ two-element sets%
\[
\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  \right\}
,\ \ \left\{  \sigma\left(  3\right)  ,\sigma\left(  4\right)  \right\}
,\ \ \ldots,\ \ \left\{  \sigma\left(  n-1\right)  ,\sigma\left(  n\right)
\right\}
\]
must be precisely the $n/2$ two-element sets $\left\{  i_{1},i_{2}\right\}
,\ \ \left\{  i_{3},i_{4}\right\}  ,\ \ \ldots,\ \ \left\{  i_{n-1}%
,i_{n}\right\}  $ in some order.

This suggests the following method for constructing a permutation $\sigma$ of
$\left[  n\right]  $ satisfying $M\left(  \sigma\right)  =P$:

\begin{itemize}
\item First, we decide which of the $2$-element sets\newline$\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  \right\}  ,\ \ \left\{
\sigma\left(  3\right)  ,\sigma\left(  4\right)  \right\}  ,\ \ \ldots
,\ \ \left\{  \sigma\left(  n-1\right)  ,\sigma\left(  n\right)  \right\}  $
is which of the $2$-element sets $\left\{  i_{1},i_{2}\right\}  ,\ \ \left\{
i_{3},i_{4}\right\}  ,\ \ \ldots,\ \ \left\{  i_{n-1},i_{n}\right\}  $. There
are $\left(  n/2\right)  !$ options for this decision, since we are (in
effect) choosing a bijection from the set $\left\{  1,2,\ldots,n/2\right\}  $
to the set $\left\{  \left\{  i_{1},i_{2}\right\}  ,\ \ \left\{  i_{3}%
,i_{4}\right\}  ,\ \ \ldots,\ \ \left\{  i_{n-1},i_{n}\right\}  \right\}  $
(and Theorem \ref{thm.enum.bijs} shows that the \# of such bijections is
$\left(  n/2\right)  !$).

After this decision, each of the $2$-element sets%
\[
\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  \right\}
,\ \ \left\{  \sigma\left(  3\right)  ,\sigma\left(  4\right)  \right\}
,\ \ \ldots,\ \ \left\{  \sigma\left(  n-1\right)  ,\sigma\left(  n\right)
\right\}
\]
is determined.

\item Then, we decide which of the two elements of the $2$-element set
$\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  \right\}  $ will be
$\sigma\left(  1\right)  $. There are $2$ options for this. The other
(unchosen) element will then be $\sigma\left(  2\right)  $.

\item Then, we decide which of the two elements of the $2$-element set
$\left\{  \sigma\left(  3\right)  ,\sigma\left(  4\right)  \right\}  $ will be
$\sigma\left(  3\right)  $. There are $2$ options for this. The other
(unchosen) element will then be $\sigma\left(  4\right)  $.

\item And so on, until all values $\sigma\left(  1\right)  ,\sigma\left(
2\right)  ,\ldots,\sigma\left(  n\right)  $ have been chosen.
\end{itemize}

\noindent The dependent product rule shows that the total \# of possibilities
for how these choices can be made is
\[
\left(  n/2\right)  !\cdot\underbrace{2\cdot2\cdot\cdots\cdot2}_{n/2\text{
times}}=\left(  n/2\right)  !\cdot2^{n/2}.
\]
Hence,
\begin{align}
&  \left(  \text{\# of permutations }\sigma\text{ of }\left[  n\right]  \text{
satisfying }M\left(  \sigma\right)  =P\right) \nonumber\\
&  =\left(  n/2\right)  !\cdot2^{n/2}.
\label{sol.enum.perf-matchs.2nd.fibercard}%
\end{align}


Now, forget that we fixed $P$. We thus have proved
(\ref{sol.enum.perf-matchs.2nd.fibercard}) for each perfect matching $P$ of
$\left[  n\right]  $. Note that the right hand side of
(\ref{sol.enum.perf-matchs.2nd.fibercard}) does not depend on $P$; it is the
same for all $P$. This is what will now allow us to compute the \# of perfect
matchings of $\left[  n\right]  $.

For each permutation $\sigma$ of $\left[  n\right]  $, we know that $M\left(
\sigma\right)  $ is a perfect matching of $\left[  n\right]  $. Hence, by the
sum rule\footnote{more precisely, by the slightly more flexible version of the
sum rule we will state below (as Theorem \ref{thm.sumrule2})}, we have%
\begin{align*}
&  \left(  \text{\# of permutations }\sigma\text{ of }\left[  n\right]
\right) \\
&  =\sum_{\substack{P\text{ is a perfect}\\\text{matching of }\left[
n\right]  }}\underbrace{\left(  \text{\# of permutations }\sigma\text{ of
}\left[  n\right]  \text{ satisfying }M\left(  \sigma\right)  =P\right)
}_{\substack{=\left(  n/2\right)  !\cdot2^{n/2}\\\text{(by
(\ref{sol.enum.perf-matchs.2nd.fibercard}))}}}\\
&  =\sum_{\substack{P\text{ is a perfect}\\\text{matching of }\left[
n\right]  }}\left(  n/2\right)  !\cdot2^{n/2}\\
&  =\left(  \text{\# of perfect matchings of }\left[  n\right]  \right)
\cdot\left(  n/2\right)  !\cdot2^{n/2}.
\end{align*}
Therefore,
\begin{align*}
\left(  \text{\# of perfect matchings of }\left[  n\right]  \right)   &
=\dfrac{1}{\left(  n/2\right)  !\cdot2^{n/2}}\cdot\underbrace{\left(  \text{\#
of permutations }\sigma\text{ of }\left[  n\right]  \right)  }%
_{\substack{=n!\\\text{(by Theorem \ref{thm.enum.perms})}}}\\
&  =\dfrac{1}{\left(  n/2\right)  !\cdot2^{n/2}}\cdot n!=\dfrac{n!}%
{2^{n/2}\cdot\left(  n/2\right)  !}.
\end{align*}
This recovers (\ref{sol.enum.perf-matchs.1st.even-case2}) and solves Exercise
\ref{exe.enum.perf-matchs} again.
\end{proof}

Here is the \textquotedblleft sum rule\textquotedblright\ we used in this solution:

\begin{theorem}
[Sum rule in map form]\label{thm.sumrule2}Let $S$ and $W$ be two 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{
satisfying }f\left(  s\right)  =w\right)  .
\]

\end{theorem}

Theorem \ref{thm.sumrule2} is a more flexible restatement of Theorem
\ref{thm.enum.sum} (which is why we also call it the \textquotedblleft sum
rule\textquotedblright). Indeed, both theorems are formalizing the same
underlying principle: namely, that if a set is split into several disjoint
subsets, then the size of the set is the sum of the sizes of these subsets.
They differ only in how the subsets are encoded (namely, in Theorem
\ref{thm.enum.sum}, the subsets are $S_{1},S_{2},\ldots,S_{k}$; in Theorem
\ref{thm.sumrule2}, the subsets are $\left\{  s\in S\ \mid\ f\left(  s\right)
=w\right\}  $ for various $w\in W$).

The trick we used in our second solution to Exercise
\ref{exe.enum.perf-matchs} deserves some more comment. We found a map%
\[
M:\left\{  \text{permutations of }\left[  n\right]  \right\}  \rightarrow
\left\{  \text{perfect matchings of }\left[  n\right]  \right\}
\]
that is not (in general) a bijection, but nevertheless has the property that
it takes all possible values the same number of times. (That is, the \# of
permutations $\sigma$ of $\left[  n\right]  $ satisfying $M\left(
\sigma\right)  =P$ is the same for all perfect matchings $P$.) This allowed us
to relate the \# of perfect matchings of $\left[  n\right]  $ with the \# of
permutations of $\left[  n\right]  $. This strategy is known as the
\textit{shepherd's principle}: \textquotedblleft If you want to count a flock
of sheep, count the legs and divide by $4$\textquotedblright. In our case, the
sheep were the perfect matchings of $\left[  n\right]  $, and the legs were
the permutations of $\left[  n\right]  $. (So each sheep had $2^{n/2}%
\cdot\left(  n/2\right)  !$ legs, and the map $M$ sent each leg to its sheep.)
Uses of this principle abound in combinatorics; in particular, Theorem
\ref{thm.binom.comb} can be proved using it (see \cite[\S 15.5.1]{LeLeMe16} or
\cite[\S 2.7]{19fco} for this proof). The shepherd's principle is also known
as the \textit{division rule} or
\textit{\href{https://en.wikipedia.org/wiki/Rule_of_division_(combinatorics)}{\textit{rule
of division}}}, although (as we have seen) it is a simple consequence of the
sum rule and there is usually nothing gained by stating it as a separate theorem.

A different variant of our second solution to Exercise
\ref{exe.enum.perf-matchs} appears in \cite[solution to Exercise 3
\textbf{(c)}]{18f-hw3s}. We also note that the case of Exercise
\ref{exe.enum.perf-matchs} for $n$ even appears in \cite[Chapter 5, Example
E8]{Engel} (our $n$ is denoted by $2n$ there).

\subsection{\label{sect.hw7}Homework set \#7}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers the above parts of Chapter \ref{chp.enum}. Some of
the problems may be unrelated. Keep in mind that identities between binomial
coefficients can be proved in many ways (not just combinatorially)!

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

Recall Definition \ref{def.enum.fixed} for the following exercise:

\begin{exercise}
\label{exe.enum.Fixfg}Let $U$ and $V$ be two finite sets. Let $f:U\rightarrow
V$ and $g:V\rightarrow U$ be two maps. Prove that $\left\vert
\operatorname*{Fix}\left(  f\circ g\right)  \right\vert =\left\vert
\operatorname*{Fix}\left(  g\circ f\right)  \right\vert $.
\end{exercise}

Our next exercise is an analogue of Exercise \ref{exe.ent.num-of-divs-even}:

\begin{exercise}
\label{exe.ent.num-of-even-divs-even}Let $n$ be a positive integer. Prove that
the number of \textbf{even} positive divisors of $n$ is even if and only if
$n/2$ is not a perfect square.
\end{exercise}

The next exercise relies on Convention \ref{conv.enum.nots.bra-n}:

\begin{exercise}
\label{exe.enum.IMO1981-2-ca}Let $n$ and $r$ be positive integers. Prove that
\[
\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S=\dbinom{n+1}{r+1}.
\]
(Recall that the summation sign \textquotedblleft$\sum
\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}$\textquotedblright\ means \textquotedblleft sum over all subsets $S$ of
$\left[  n\right]  $ satisfying $\left\vert S\right\vert =r$\textquotedblright%
, that is, \textquotedblleft sum over all $r$-element subsets $S$ of $\left[
n\right]  $\textquotedblright.)
\end{exercise}

\begin{exercise}
\label{exe.enum.comps.no-1}Let $n$ be a positive integer. Find the \# of
compositions of $n$ that don't contain $1$ as an entry.

(For example, if $n=7$, then the compositions of $n$ that don't contain $1$ as
an entry are $\left(  7\right)  $, $\left(  5,2\right)  $, $\left(
4,3\right)  $, $\left(  3,4\right)  $, $\left(  2,5\right)  $, $\left(
3,2,2\right)  $, $\left(  2,3,2\right)  $ and $\left(  2,2,3\right)  $.)
\end{exercise}

\begin{exercise}
\label{exe.enum.comps.parts}Let $n$ be a positive integer. Let $k\in
\mathbb{N}$.

\textbf{(a)} A \textit{composition of }$n$ \textit{into }$k$ \textit{parts}
means a composition of $n$ that has exactly $k$ entries (i.e., is a
$k$-tuple). Find the \# of compositions of $n$ into $k$ parts.

\textbf{(b)} A \textit{weak composition of }$n$ \textit{into }$k$
\textit{parts} means a $k$-tuple of \textbf{nonnegative} integers whose sum is
$n$. (So it is like a composition of $n$ into $k$ parts, but its entries are
allowed to be $0$.) Find the \# of weak compositions of $n$ into $k$ parts.
\end{exercise}

\begin{exercise}
\label{exe.enum.rior-gkp}Let $n\in\mathbb{N}$. Prove that%
\[
\sum_{k=0}^{n-1}\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  !}{n^{k}}=n.
\]

\end{exercise}

\begin{exercise}
\label{exe.enum.shapiro}Let $n\in\mathbb{N}$. Prove that%
\[
\sum_{k=0}^{n}k\dbinom{2n}{n-k}=n\dbinom{2n-1}{n}.
\]

\end{exercise}

\begin{exercise}
\label{exe.enum.bin-inv}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ and
$\left(  g_{0},g_{1},g_{2},\ldots\right)  $ be two sequences of numbers.
Assume that%
\[
g_{n}=\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}f_{i}%
\ \ \ \ \ \ \ \ \ \ \text{for every }n\in\mathbb{N}.
\]
Prove that%
\[
f_{n}=\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}g_{i}%
\ \ \ \ \ \ \ \ \ \ \text{for every }n\in\mathbb{N}.
\]

\end{exercise}

\begin{exercise}
\label{exe.enum.-1/2trick}Let $n\in\mathbb{N}$.

\textbf{(a)} Prove that
\[
\dbinom{-1/2}{n}=\left(  \dfrac{-1}{4}\right)  ^{n}\dbinom{2n}{n}.
\]


\textbf{(b)} Prove that
\[
\sum_{k=0}^{n}\dbinom{2k}{k}\dbinom{2\left(  n-k\right)  }{n-k}=4^{n}.
\]

\end{exercise}

\begin{exercise}
\label{exe.enum.ILL83exe30}Prove that there is a \textbf{unique} sequence
$\left(  u_{0},u_{1},u_{2},\ldots\right)  $ of positive integers such that%
\[
u_{n}^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}u_{n-r}\ \ \ \ \ \ \ \ \ \ \text{for
all }n\in\mathbb{N}.
\]

\end{exercise}

\subsection{\label{sect.enum.sylv}Alternating sums and Inclusion/Exclusion}

\subsubsection{\label{subsect.enum.sylv.sylv}The Principle of Inclusion and
Exclusion}

Consider the following:

\begin{itemize}
\item If $U$ is a finite set, and if $A$ is a subset of $U$, then%
\begin{equation}
\left\vert U\setminus A\right\vert =\left\vert U\right\vert -\left\vert
A\right\vert . \label{eq.thm.pie.1.exa.1}%
\end{equation}
In fact, this is just Theorem \ref{thm.enum.diff} (applied to $U$ and $A$
instead of $A$ and $B$).

\item If $U$ is a finite set, and if $A$ and $B$ are two subsets of $U$, then%
\begin{equation}
\left\vert U\setminus\left(  A\cup B\right)  \right\vert =\left\vert
U\right\vert -\left\vert A\right\vert -\left\vert B\right\vert +\left\vert
A\cap B\right\vert . \label{eq.thm.pie.1.exa.2}%
\end{equation}
Indeed, this is not hard to see by applying (\ref{eq.thm.pie.1.exa.1}) three
times\footnote{Here are the details: Let $U$ be a finite set, and let $A$ and
$B$ be two subsets of $U$. Then, it is known from set theory (or easy to
verify by drawing Venn diagrams) that $U\setminus\left(  A\cup B\right)
=\left(  U\setminus A\right)  \setminus\left(  B\setminus\left(  A\cap
B\right)  \right)  $. Hence,%
\begin{align*}
\left\vert U\setminus\left(  A\cup B\right)  \right\vert  &  =\left\vert
\left(  U\setminus A\right)  \setminus\left(  B\setminus\left(  A\cap
B\right)  \right)  \right\vert =\underbrace{\left\vert U\setminus A\right\vert
}_{\substack{=\left\vert U\right\vert -\left\vert A\right\vert \\\text{(by
(\ref{eq.thm.pie.1.exa.1}))}}}-\underbrace{\left\vert B\setminus\left(  A\cap
B\right)  \right\vert }_{\substack{=\left\vert B\right\vert -\left\vert A\cap
B\right\vert \\\text{(by (\ref{eq.thm.pie.1.exa.1})}\\\text{(applied to
}B\text{ and }A\cap B\\\text{instead of }U\text{ and }A\text{),}\\\text{since
}A\cap B\text{ is a subset of }B\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by (\ref{eq.thm.pie.1.exa.1}) (applied to }U\setminus A\text{ and
}B\setminus\left(  A\cap B\right) \\
\text{instead of }U\text{ and }A\text{), since }B\setminus\left(  A\cap
B\right)  \text{ is a subset of }U\setminus A
\end{array}
\right) \\
&  =\left(  \left\vert U\right\vert -\left\vert A\right\vert \right)  -\left(
\left\vert B\right\vert -\left\vert A\cap B\right\vert \right)  =\left\vert
U\right\vert -\left\vert A\right\vert -\left\vert B\right\vert +\left\vert
A\cap B\right\vert .
\end{align*}
Thus, (\ref{eq.thm.pie.1.exa.2}) is proved.}. Alternatively, there is a simple
intuitive way to convince yourself of (\ref{eq.thm.pie.1.exa.2}): If $A$ and
$B$ are two subsets of a finite set $U$, then you can try to count the
elements of $U\setminus\left(  A\cup B\right)  $ by starting with $\left\vert
U\right\vert $ and subtracting $\left\vert A\right\vert $ and $\left\vert
B\right\vert $. However, this will leave the elements of $A\cap B$ subtracted
twice instead of once; this flaw can be corrected by adding $\left\vert A\cap
B\right\vert $ back in. This leads to the equality (\ref{eq.thm.pie.1.exa.2}).

\item If $U$ is a finite set, and if $A$, $B$ and $C$ are three subsets of
$U$, then%
\begin{align}
\left\vert U\setminus\left(  A\cup B\cup C\right)  \right\vert  &  =\left\vert
U\right\vert -\left\vert A\right\vert -\left\vert B\right\vert -\left\vert
C\right\vert +\left\vert A\cap B\right\vert +\left\vert A\cap C\right\vert
+\left\vert B\cap C\right\vert \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ -\left\vert A\cap B\cap C\right\vert .
\label{eq.thm.pie.1.exa.3}%
\end{align}
This, too, can be proved by applying (\ref{eq.thm.pie.1.exa.1}) several times
(or, more easily, by applying (\ref{eq.thm.pie.1.exa.1}) once and
(\ref{eq.thm.pie.1.exa.2}) twice, using $U\setminus\left(  A\cup B\cup
C\right)  =\left(  U\setminus\left(  A\cup B\right)  \right)  \setminus\left(
C\setminus\left(  \left(  A\cap C\right)  \cup\left(  B\cap C\right)  \right)
\right)  $). We leave the proof to the interested reader. Again, there also is
a way to convince yourself of (\ref{eq.thm.pie.1.exa.3}) by a counting
argument\footnote{Best done with a Venn diagram at hand (courtesy of
\href{https://tex.stackexchange.com/a/26161/}{Alain Matthes on
tex.stackexchange}):%
\[
\fbox{$U$
%TCIMACRO{\TeXButton{tikz venn diagram}{\begin{tikzpicture}
%\tikzset
%{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4}}
%\node[venn circle = red] (A) at (0,0) {$A$};
%\node[venn circle = blue] (B) at (60:4cm) {$B$};
%\node[venn circle = green] (C) at (0:4cm) {$C$};
%\node[left] at (barycentric cs:A=1/2,B=1/2 ) {$A \cap B$};
%\node[below] at (barycentric cs:A=1/2,C=1/2 ) {$A \cap C$};
%\node[right] at (barycentric cs:B=1/2,C=1/2 ) {$B \cap C$};
%\node[below] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$A \cap B \cap C$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\tikzset
{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4}}
\node[venn circle = red] (A) at (0,0) {$A$};
\node[venn circle = blue] (B) at (60:4cm) {$B$};
\node[venn circle = green] (C) at (0:4cm) {$C$};
\node[left] at (barycentric cs:A=1/2,B=1/2 ) {$A \cap B$};
\node[below] at (barycentric cs:A=1/2,C=1/2 ) {$A \cap C$};
\node[right] at (barycentric cs:B=1/2,C=1/2 ) {$B \cap C$};
\node[below] at (barycentric cs:A=1/3,B=1/3,C=1/3 ){$A \cap B \cap C$};
\end{tikzpicture}%
%EndExpansion
}
\]
}: If $A$, $B$ and $C$ are three subsets of a finite set $U$, then you can
count the elements of $U\setminus\left(  A\cup B\cup C\right)  $ by starting
with $\left\vert U\right\vert $, then subtracting $\left\vert A\right\vert $,
$\left\vert B\right\vert $ and $\left\vert C\right\vert $, then correcting for
the doubly subtracted common elements by adding $\left\vert A\cap B\right\vert
$, $\left\vert A\cap C\right\vert $ and $\left\vert B\cap C\right\vert $, and
finally correcting for the elements of $A\cap B\cap C$ (which have been added
once, subtracted thrice and added back in thrice, but should not be counted)
by subtracting $\left\vert A\cap B\cap C\right\vert $.
\end{itemize}

The three identities (\ref{eq.thm.pie.1.exa.1}), (\ref{eq.thm.pie.1.exa.2})
and (\ref{eq.thm.pie.1.exa.3}) appear to be parts of a pattern: The left hand
sides have the form $\left\vert U\setminus\left(  A_{1}\cup A_{2}\cup
\cdots\cup A_{n}\right)  \right\vert $ for some subsets $A_{1},A_{2}%
,\ldots,A_{n}$ of a finite set $U$, and the right hand sides are signed sums
of the sizes of intersections of some of these subsets (including $\left\vert
U\right\vert $, which we consider to be the \textquotedblleft trivial
intersection\textquotedblright). This pattern indeed persists; let us state it
in its general form:

\begin{theorem}
[Principle of Inclusion and Exclusion (complement form)]%
\label{thm.enum.pie.comp}Let $n\in\mathbb{N}$. Let $U$ be a finite set. Let
$A_{1},A_{2},\ldots,A_{n}$ be $n$ subsets of $U$. Then,%
\begin{align*}
&  \left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert \\
&  =\left\vert U\right\vert \\
&  \ \ \ \ \ \ \ \ \ \ \underbrace{-\left\vert A_{1}\right\vert -\left\vert
A_{2}\right\vert -\cdots-\left\vert A_{n}\right\vert }_{\text{all sizes
}\left\vert A_{i}\right\vert }\\
&  \ \ \ \ \ \ \ \ \ \ \underbrace{+\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 }_{\text{all sizes }\left\vert A_{i}\cap A_{j}\right\vert
\text{ with }i<j}\\
&  \ \ \ \ \ \ \ \ \ \ \underbrace{-\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 }_{\text{all sizes
}\left\vert A_{i}\cap A_{j}\cap A_{k}\right\vert \text{ with }i<j<k}\\
&  \ \ \ \ \ \ \ \ \ \ \pm\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  -1\right)  ^{n}\left\vert A_{1}\cap A_{2}%
\cap\cdots\cap A_{n}\right\vert \\
&  =\sum_{m=0}^{n}\left(  -1\right)  ^{m}\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 .
\end{align*}
Here, the \textquotedblleft empty\textquotedblright\ intersection $A_{i_{1}%
}\cap A_{i_{2}}\cap\cdots\cap A_{i_{m}}$ for $m=0$ is understood to mean the
set $U$.
\end{theorem}

The right hand side of the equality in Theorem \ref{thm.enum.pie.comp} is
rather unwieldy, and the \textquotedblleft middle hand side\textquotedblright%
\ (which is just a rewritten version of the right hand side without using the
$\sum$ sign) is even worse. Thus, let us introduce a notation that will allow
us to restate Theorem \ref{thm.enum.pie.comp} in a simpler way:

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

It is easy to see that if $I=\left\{  i_{1},i_{2},\ldots,i_{m}\right\}  $ is a
finite set, and if $A_{i}$ is a set for each $i\in I$, then%
\begin{equation}
\bigcap_{i\in I}A_{i}=A_{i_{1}}\cap A_{i_{2}}\cap\cdots\cap A_{i_{m}}.
\label{eq.bigcap.simple}%
\end{equation}


The notation $\bigcap_{i\in I}A_{i}$ (for the intersection of a family of
sets) is similar to the notation $\sum_{i\in I}a_{i}$ (for the sum of a finite
family of numbers). However, in the notation $\bigcap_{i\in I}A_{i}$, the set
$I$ must be nonempty (unlike in $\sum_{i\in I}a_{i}$) but can be infinite
(unlike in $\sum_{i\in I}a_{i}$, which is usually undefined when $I$ is infinite).

Now, we can restate Theorem \ref{thm.enum.pie.comp} as follows:

\begin{theorem}
[Principle of Inclusion and Exclusion (complement form)]\label{thm.enum.pie.b}%
Let $n\in\mathbb{N}$. Let $U$ be a finite set. Let $A_{1},A_{2},\ldots,A_{n}$
be $n$ subsets of $U$. Then,%
\begin{equation}
\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 .
\label{eq.thm.enum.pie.b.eq}%
\end{equation}
Here, the \textquotedblleft empty\textquotedblright\ intersection
$\bigcap_{i\in\varnothing}A_{i}$ is understood to mean the set $U$.
\end{theorem}

\begin{remark}
We have defined the \textquotedblleft empty\textquotedblright\ intersection
$\bigcap_{i\in\varnothing}A_{i}$ in Theorem \ref{thm.enum.pie.b}; why didn't
we already do this back in Definition \ref{def.bigcap}?

The reason is that we have had $U$ available in Theorem \ref{thm.enum.pie.b},
and, in a sense, were treating $A_{1},A_{2},\ldots,A_{n}$ as subsets of $U$
rather than just as arbitrary sets. Had we tried to extend Definition
\ref{def.bigcap} to the case when $I=\varnothing$, we would have obtained
\[
\bigcap_{i\in\varnothing}A_{i}=\left\{  x\ \mid\ x\in A_{i}\text{ for each
}i\in\varnothing\right\}  =\left\{  \text{all }x\right\}
\]
(since the condition \textquotedblleft$x\in A_{i}$ for each $i\in\varnothing
$\textquotedblright\ is vacuously true, whatever $x$ is), which is not a
well-defined set (it would be a so-called
\href{https://en.wikipedia.org/wiki/Universal_set}{\textquotedblleft universal
set\textquotedblright}, which does not exist in set theory as it would lead to
Russell's paradox). (And even if it was a well-defined set, its size would
certainly be infinite.) However, in Theorem \ref{thm.enum.pie.b}, we defined
$\bigcap_{i\in\varnothing}A_{i}$ to mean $U$, which is a reasonable
interpretation of the (otherwise ill-defined) set \textquotedblleft$\left\{
\text{all }x\right\}  $\textquotedblright\ if we consider $x$ to be implicitly
required to be an element of $U$.

(Note that defining $\bigcap_{i\in\varnothing}A_{i}$ to mean $U$ is slightly
slippery, since it entails that $\bigcap_{i\in\varnothing}A_{i}$ depends not
just on the $n$ sets $A_{1},A_{2},\ldots,A_{n}$ but also on $U$, even though
$U$ is not part of the notation. In practice, this causes no real confusion
unless one works with two different $U$'s at the same time -- which one rarely does.)
\end{remark}

Combining Theorem \ref{thm.enum.pie.b} with the difference rule, we also
obtain the following:

\begin{theorem}
[Principle of Inclusion and Exclusion (union form)]\label{thm.enum.pie.a}Let
$n\in\mathbb{N}$. Let $A_{1},A_{2},\ldots,A_{n}$ be $n$ finite sets. Then,%
\begin{equation}
\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 . \label{eq.thm.enum.pie.a.eq}%
\end{equation}

\end{theorem}

Theorem \ref{thm.enum.pie.b} and Theorem \ref{thm.enum.pie.a} are known as the
\textit{principle(s) of inclusion and exclusion} or as the \textit{Sylvester
sieve formulas}. (The word \textquotedblleft sieve\textquotedblright\ refers
to the metaphorical view that the sums on the right hand sides of
(\ref{eq.thm.enum.pie.b.eq}) and (\ref{eq.thm.enum.pie.a.eq}) are
\textquotedblleft sieving\textquotedblright\ the elements of $U$, leaving only
those in $U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  $
(resp. $A_{1}\cup A_{2}\cup\cdots\cup A_{n}$) behind.)

We won't prove Theorem \ref{thm.enum.pie.comp}, Theorem \ref{thm.enum.pie.b}
and Theorem \ref{thm.enum.pie.a} right now; the impatient reader can find
their proofs all over the literature:

\begin{itemize}
\item Theorem \ref{thm.enum.pie.b} is \cite[Theorem 2.9.7]{19fco} (where it is
proved using manipulation of finite sums and Iverson brackets). It also
appears in \cite{Smid09} (with a proof by induction), in \cite[Theorem
16.1]{Galvin17} (with two proofs) and in \cite[Theorem 3.42]{detnotes} (in a
slightly more general form).

\item Theorem \ref{thm.enum.pie.a} is \cite[Theorem 2.9.6]{19fco} (where it is
derived from Theorem \ref{thm.enum.pie.b} by setting $U=A_{1}\cup A_{2}%
\cup\cdots\cup A_{n}$ and using the difference rule). It also appears in
\cite{White10}, in \cite[(12)]{Galvin17} and in \cite[Theorem 3.43]{detnotes}.

\item Theorem \ref{thm.enum.pie.comp} is a restatement of Theorem
\ref{thm.enum.pie.a}. Indeed, the awkward double sum
\[
\sum_{m=0}^{n}\left(  -1\right)  ^{m}\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
\]
(when expanded) has the same addends as the sum $\sum_{I\subseteq\left[
n\right]  }\left(  -1\right)  ^{\left\vert I\right\vert }\left\vert
\bigcap_{i\in I}A_{i}\right\vert $; only the indexing of these addends is
different. (See \cite[proof of Proposition 2.9.4]{19fco} for the details of
this argument, although our sums have a $\left\vert U\right\vert $ addend
whereas the sums in \cite[proof of Proposition 2.9.4]{19fco} do not.)
\end{itemize}

Several generalizations of the Principles of Inclusion and Exclusion can be
found in \cite[Theorems 3.44, 3.45 and 3.46]{detnotes}, in \cite[\S 5.1 and
\S 5.2]{Aigner07} and in \cite[Chapter IV]{Comtet74}.

In practice, the following restatement of Theorem \ref{thm.enum.pie.b} tends
to be most convenient to apply:

\begin{theorem}
[Principle of Inclusion and Exclusion (complement form)]%
\label{thm.enum.pie.b.props}Let $n\in\mathbb{N}$. Let $U$ be a finite set. Let
$A_{1},A_{2},\ldots,A_{n}$ be $n$ subsets of $U$. Then,%
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right)  . \label{eq.thm.enum.pie.b.props.eq}%
\end{align}

\end{theorem}

Theorem \ref{thm.enum.pie.b.props} is equivalent to Theorem
\ref{thm.enum.pie.b} because each side of the equality
(\ref{eq.thm.enum.pie.b.props.eq}) equals to the corresponding side of
(\ref{eq.thm.enum.pie.b.eq}). (We shall explain this in more detail in
Subsection \ref{subsect.enum.sylv.wt} below.)

\subsubsection{\label{subsect.enum.sylv.surj}An example: counting surjections}

The principle of inclusion and exclusion can be used to count many kinds of
objects. See \cite[\S 2.9]{19fco}, \cite[\S 5.1]{Aigner07}, \cite[Chapter
6]{AndFen04}, \cite[Chapter 2]{Tomesc85}, \cite[\S 16--\S 17]{Galvin17} or
\cite[\S 2.2]{Guicha20} for various examples. We shall show just one
application here (which may be one of the most famous): We shall count the
surjective maps between two given finite sets. Note that we have already
counted all maps (Theorem \ref{thm.enum.maps.maps}), all injective maps
(Theorem \ref{thm.enum.maps.inj}) and all bijective maps (Theorem
\ref{thm.enum.bijs} when the two sets have equal sizes; otherwise there are
none). Counting the surjective maps is the hardest of these questions; here is
the answer:

\begin{theorem}
\label{thm.enum.maps.surj}Let $m,n\in\mathbb{N}$. Let $A$ be an $m$-element
set. Let $B$ be an $n$-element set. Then,%
\[
\left(  \text{\# of all surjective maps from }A\text{ to }B\right)
=\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{m}.
\]

\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.enum.maps.surj} (sketched).](See \cite[\S 2.4.5,
proof of Proposition 2.4.11, and \S 2.9.4, proof of Theorem 2.4.17]{19fco} for
more details.\footnote{See also \cite[Exercise 595]{Gunder10} or
\cite[solution to Exercise 2.4.4]{19fco} for alternative proofs.}) We WLOG
assume that $B=\left[  n\right]  $ (since otherwise, we can just relabel the
$n$ elements of $B$ as $1,2,\ldots,n$, without changing the \# of all
surjective maps from $A$ to $B$).

We say that a map $f:A\rightarrow B$ \textit{misses} an element $i\in B$ if
$f$ does not take $i$ as a value (i.e., if there exists no $a\in A$ such that
$i=f\left(  a\right)  $). (The terminology is motivated by the standard
illustrations in which maps are drawn as collections of arrows.)

We let $U=B^{A}=\left\{  \text{all maps from }A\text{ to }B\right\}  $. For
each $i\in\left[  n\right]  $, we define a subset $A_{i}$ of $U$ by%
\begin{align*}
A_{i}  &  =\left\{  \text{all maps }f:A\rightarrow B\text{ that miss
}i\right\} \\
&  =\left\{  \text{all maps }f:A\rightarrow B\text{ that do not take }i\text{
as a value}\right\}  .
\end{align*}
Thus, we have defined $n$ subsets $A_{1},A_{2},\ldots,A_{n}$ of $U$. Hence,
Theorem \ref{thm.enum.pie.b.props} yields that
(\ref{eq.thm.enum.pie.b.props.eq}) holds.

However, the left hand side of (\ref{eq.thm.enum.pie.b.props.eq}) is%
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\left(  \text{\# of }f\in U\text{ satisfying }f\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ satisfying }f\notin
A_{i}\text{ for all }i\in\left[  n\right]  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }U=\left\{
\text{all maps from }A\text{ to }B\right\}  \right) \nonumber\\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ such that }f\text{
takes }i\text{ as a value for all }i\in\left[  n\right]  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the statement \textquotedblleft}f\notin A_{i}%
\text{\textquotedblright\ is equivalent}\\
\text{to \textquotedblleft}f\text{ takes }i\text{ as a value\textquotedblright%
\ (by the definition of }A_{i}\text{)}%
\end{array}
\right) \nonumber\\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ that take each }%
i\in\left[  n\right]  \text{ as a value}\right) \nonumber\\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ that take each }i\in
B\text{ as a value}\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left[
n\right]  =B\right) \nonumber\\
&  =\left(  \text{\# of all surjective maps from }A\text{ to }B\right)  .
\label{pf.thm.enum.maps.surj.1}%
\end{align}
Meanwhile, we can also rewrite the numbers on the right hand side of
(\ref{eq.thm.enum.pie.b.props.eq}): Let $I$ be any subset of $\left[
n\right]  $. Then,%
\begin{align*}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{ for all
}i\in I\right) \\
&  =\left(  \text{\# of }f\in U\text{ satisfying }f\in A_{i}\text{ for all
}i\in I\right) \\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ satisfying }f\in
A_{i}\text{ for all }i\in I\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }U=\left\{
\text{all maps from }A\text{ to }B\right\}  \right) \\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ such that }f\text{
misses }i\text{ for all }i\in I\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the statement \textquotedblleft}f\in A_{i}\text{\textquotedblright%
\ is equivalent}\\
\text{to \textquotedblleft}f\text{ misses }i\text{\textquotedblright\ (by the
definition of }A_{i}\text{)}%
\end{array}
\right) \\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ such that }f\text{
misses all elements of }I\right) \\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ such that no value of
}f\text{ belongs to }I\right) \\
&  =\left(  \text{\# of all maps }f:A\rightarrow B\text{ such that all values
of }f\text{ belong to }B\setminus I\right) \\
&  =\left(  \text{\# of all maps from }A\text{ to }B\setminus I\right)  .
\end{align*}
Here, the last equality sign is due to the fact that the maps $f:A\rightarrow
B$ such that all values of $f$ belong to $B\setminus I$ are \textquotedblleft
essentially the same as\textquotedblright\ the maps from $A$ to $B\setminus I$
(or, to be more precise, there is a bijection from the set of the former maps
to the set of the latter maps; but all this bijection does is change the
target of the map, without changing any of its values). Hence,
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{ for all
}i\in I\right) \nonumber\\
&  =\left(  \text{\# of all maps from }A\text{ to }B\setminus I\right)
=\left\vert \left(  B\setminus I\right)  ^{A}\right\vert =\left\vert
B\setminus I\right\vert ^{\left\vert A\right\vert }\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.enum.maps.maps},
applied to }B\setminus I\text{ instead of }B\right) \nonumber\\
&  =\left(  \left\vert B\right\vert -\left\vert I\right\vert \right)
^{\left\vert A\right\vert }\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert
B\setminus I\right\vert =\left\vert B\right\vert -\left\vert I\right\vert
\text{ (because }I\subseteq\left[  n\right]  =B\text{)}\right) \nonumber\\
&  =\left(  n-\left\vert I\right\vert \right)  ^{m}
\label{pf.thm.enum.maps.surj.3}%
\end{align}
(since $\left\vert B\right\vert =n$ and $\left\vert A\right\vert =m$).

Forget that we fixed $I$. We thus have proved (\ref{pf.thm.enum.maps.surj.3})
for each subset $I$ of $\left[  n\right]  $. Now,
(\ref{pf.thm.enum.maps.surj.1}) entails%
\begin{align*}
&  \left(  \text{\# of all surjective maps from }A\text{ to }B\right) \\
&  =\left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left(  \text{\# of }x\in U\text{ satisfying }x\in
A_{i}\text{ for all }i\in I\right)  }_{\substack{=\left(  n-\left\vert
I\right\vert \right)  ^{m}\\\text{(by (\ref{pf.thm.enum.maps.surj.3}))}%
}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.thm.enum.pie.b.props.eq}%
)}\right) \\
&  =\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}}_{\substack{=\left(  -1\right)
^{k}\left(  n-k\right)  ^{m}\\\text{(since }\left\vert I\right\vert
=k\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split the sum according to the value of }\left\vert
I\right\vert \text{,}\\
\text{since }\left\vert I\right\vert \in\left\{  0,1,\ldots,n\right\}  \text{
for each subset }I\text{ of }\left[  n\right]
\end{array}
\right) \\
&  =\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}}_{=\left(  \text{\# of subsets }I\text{ of }\left[  n\right]  \text{
satisfying }\left\vert I\right\vert =k\right)  \cdot\left(  -1\right)
^{k}\left(  n-k\right)  ^{m}}\\
&  =\sum_{k=0}^{n}\underbrace{\left(  \text{\# of subsets }I\text{ of }\left[
n\right]  \text{ satisfying }\left\vert I\right\vert =k\right)  }%
_{\substack{=\left(  \text{\# of }k\text{-element subsets of }\left[
n\right]  \right)  \\=\dbinom{n}{k}\\\text{(by Theorem \ref{thm.binom.comb})}%
}}\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}\underbrace{\dbinom{n}{k}%
}_{\substack{=\dbinom{n}{n-k}\\\text{(by Theorem \ref{thm.binom.sym})}%
}}\left(  n-k\right)  ^{m}\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{n-k}\left(  n-k\right)
^{m}=\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{m}%
\end{align*}
(here, we have substituted $n-i$ for $k$ in the sum). This proves Theorem
\ref{thm.enum.maps.surj}.
\end{proof}

As a welcome byproduct of Theorem \ref{thm.enum.maps.surj}, we obtain two
binomial identities:

\begin{corollary}
\label{cor.enum.maps.surj-cor}\textbf{(a)} If $n,m\in\mathbb{N}$ satisfy
$m<n$, then%
\[
\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{m}=0.
\]


\textbf{(b)} For any $n\in\mathbb{N}$, we have%
\[
\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{n}=n!.
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.enum.maps.surj-cor}.]\textbf{(a)} We could easily
obtain Corollary \ref{cor.enum.maps.surj-cor} \textbf{(a)} by applying
Exercise \ref{exe.findiff.poly1} \textbf{(d)} to the polynomial $P\left(
x\right)  =x^{m}$; however, let us instead derive it from Theorem
\ref{thm.enum.maps.surj}.

Indeed, let $n,m\in\mathbb{N}$ satisfy $m<n$. Then, $\left\vert \left[
m\right]  \right\vert =m$ and $\left\vert \left[  n\right]  \right\vert =n$.
Thus, $\left\vert \left[  m\right]  \right\vert =m<n=\left\vert \left[
n\right]  \right\vert $; therefore, Theorem \ref{thm.php.php-surj-1c} (applied
to $U=\left[  m\right]  $ and $V=\left[  n\right]  $) shows that a map
$f:\left[  m\right]  \rightarrow\left[  n\right]  $ cannot be surjective. In
other words, there exists no surjective map $f:\left[  m\right]
\rightarrow\left[  n\right]  $. In other words,
\[
\left(  \text{\# of all surjective maps from }\left[  m\right]  \text{ to
}\left[  n\right]  \right)  =0.
\]
However, Theorem \ref{thm.enum.maps.surj} (applied to $A=\left[  m\right]  $
and $B=\left[  n\right]  $) yields
\[
\left(  \text{\# of all surjective maps from }\left[  m\right]  \text{ to
}\left[  n\right]  \right)  =\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom
{n}{i}i^{m}%
\]
(since $\left[  m\right]  $ is an $m$-element set, whereas $\left[  n\right]
$ is an $n$-element set). Comparing these two equalities, we obtain
$\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{m}=0$. This proves
Corollary \ref{cor.enum.maps.surj-cor} \textbf{(a)}.

\textbf{(b)} Let $n\in\mathbb{N}$. Corollary \ref{cor.php.endofunc.perm}
\textbf{(b)} (applied to $X=\left[  n\right]  $) shows that any surjective map
$f:\left[  n\right]  \rightarrow\left[  n\right]  $ is a permutation of
$\left[  n\right]  $. In other words, any surjective map from $\left[
n\right]  $ to $\left[  n\right]  $ is a permutation of $\left[  n\right]  $.
Conversely, any permutation of $\left[  n\right]  $ is a surjective map from
$\left[  n\right]  $ to $\left[  n\right]  $ (because any permutation is
bijective and thus surjective). Combining the results of the previous two
sentences, we conclude that the permutations of $\left[  n\right]  $ are
precisely the surjective maps from $\left[  n\right]  $ to $\left[  n\right]
$. Hence,%
\begin{align*}
&  \left(  \text{\# of all permutations of }\left[  n\right]  \right) \\
&  =\left(  \text{\# of all surjective maps from }\left[  n\right]  \text{ to
}\left[  n\right]  \right)  =\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom
{n}{i}i^{n}%
\end{align*}
(by Theorem \ref{thm.enum.maps.surj}, applied to $m=n$, $A=\left[  n\right]  $
and $B=\left[  n\right]  $). Comparing this with%
\[
\left(  \text{\# of all permutations of }\left[  n\right]  \right)
=n!\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.enum.perms}, applied
to }X=\left[  n\right]  \right)  ,
\]
we obtain $\sum_{i=0}^{n}\left(  -1\right)  ^{n-i}\dbinom{n}{i}i^{n}=n!$. This
proves Corollary \ref{cor.enum.maps.surj-cor} \textbf{(b)}.
\end{proof}

\subsubsection{\label{subsect.enum.sylv.wt}A weighted version and a proof}

The principle of inclusion and exclusion in all its forms we have seen above
is far from being the pinnacle of generality. One of its most useful
generalizations is obtained by assigning \textit{weights} (i.e., arbitrary
numbers) to the elements of $U$. Then, the size $\left\vert T\right\vert $ of
a subset $T$ of $U$ can be replaced by its \textquotedblleft total
weight\textquotedblright\ $\sum_{x\in T}w\left(  x\right)  $ (where $w\left(
x\right)  $ is the weight assigned to an $x\in U$). This suggests the
following generalization of Theorem \ref{thm.enum.pie.b.props}:

\begin{theorem}
[Weighted Principle of Inclusion and Exclusion (complement form)]%
\label{thm.enum.pie.b.wt}Let $n\in\mathbb{N}$. Let $U$ be a finite set. For
each $x\in U$, let $w\left(  x\right)  $ be a number. Let $A_{1},A_{2}%
,\ldots,A_{n}$ be $n$ subsets of $U$. Then,%
\[
\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[  n\right]
}}w\left(  x\right)  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)
^{\left\vert I\right\vert }\sum_{\substack{x\in U;\\x\in A_{i}\text{ for all
}i\in I}}w\left(  x\right)  .
\]

\end{theorem}

We shall prove Theorem \ref{thm.enum.pie.b.wt} and then derive Theorem
\ref{thm.enum.pie.b.props} and Theorem \ref{thm.enum.pie.b} from it. The proof
will rely on an innocent little proposition which I occasionally call the
\textit{cancellation lemma}, as it is about a sum of $+1$s and $-1$s that
cancel each other out\footnote{\textbf{Aside:} This is far from the only
\textquotedblleft cancellation lemma\textquotedblright\ in mathematics! There
are various others, such as $\sum_{k=0}^{n-1}\cos\dfrac{2kg\pi}{n}%
=n\cdot\left[  n\mid g\right]  $ for any positive integer $n$ and any
$g\in\mathbb{Z}$. Here, it is no longer $+1$s and $-1$s cancelling each other,
but rather different phases of the cosine wave. With complex numbers
available, this can be improved even further to
\[
\sum_{k=0}^{n-1}e^{2kg\pi i/n}=n\cdot\left[  n\mid g\right]  ,
\]
which is the driving force behind the discrete Fourier transform.
\par
There are philosophical similarities between the cancellation lemma (and its
combinatorial uses to \textquotedblleft extract\textquotedblright\ certain
kinds of addends from sums) and the Fourier inversion formula (and its
Fourier-analytic uses to extract certain frequencies from waves).}:

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

\end{proposition}

Once again, we are using the Iverson bracket notation here (see Definition
\ref{def.iverson}).

\begin{example}
The subsets of $\left\{  1,2\right\}  $ are $\varnothing$, $\left\{
1\right\}  $, $\left\{  2\right\}  $ and $\left\{  1,2\right\}  $. Thus,
applying Proposition \ref{prop.DIE.destruct1} to $S=\left\{  1,2\right\}  $,
we find
\[
\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}=\left[  \left\{  1,2\right\}
=\varnothing\right]  .
\]
Indeed, both sides of this equality are $0$ (the left hand side because the
addends cancel; the right hand side because $\left\{  1,2\right\}
\neq\varnothing$).
\end{example}

\begin{proof}
[Proof of Proposition \ref{prop.DIE.destruct1} (sketched).]Proposition
\ref{prop.DIE.destruct1} appears in \cite[Proposition 2.9.10]{19fco} with two
detailed proofs; we shall only outline one here.

First of all, we observe that $\left[  \left\vert S\right\vert =0\right]
=\left[  S=\varnothing\right]  $. Indeed, if $S=\varnothing$, then both truth
values $\left[  S=\varnothing\right]  $ and $\left[  \left\vert S\right\vert
=0\right]  $ equal $1$; otherwise, they both equal $0$.

Let $n=\left\vert S\right\vert $. Hence, $S$ is an $n$-element set. Thus, if
$I$ is any subset of $S$, then $\left\vert I\right\vert \in\left\{
0,1,\ldots,n\right\}  $. Hence, we can split the sum $\sum_{I\subseteq
S}\left(  -1\right)  ^{\left\vert I\right\vert }$ according to the value of
$\left\vert I\right\vert $ as follows:
\begin{align*}
&  \sum_{I\subseteq S}\left(  -1\right)  ^{\left\vert I\right\vert }\\
&  =\sum_{k\in\left\{  0,1,\ldots,n\right\}  }\ \ \sum_{\substack{I\subseteq
S;\\\left\vert I\right\vert =k}}\underbrace{\left(  -1\right)  ^{\left\vert
I\right\vert }}_{\substack{=\left(  -1\right)  ^{k}\\\text{(since }\left\vert
I\right\vert =k\text{)}}}=\sum_{k\in\left\{  0,1,\ldots,n\right\}
}\underbrace{\sum_{\substack{I\subseteq S;\\\left\vert I\right\vert
=k}}\left(  -1\right)  ^{k}}_{=\left(  \text{\# of subsets }I\text{ of
}S\text{ satisfying }\left\vert I\right\vert =k\right)  \cdot\left(
-1\right)  ^{k}}\\
&  =\underbrace{\sum_{k\in\left\{  0,1,\ldots,n\right\}  }}_{=\sum_{k=0}^{n}%
}\underbrace{\left(  \text{\# of subsets }I\text{ of }S\text{ satisfying
}\left\vert I\right\vert =k\right)  }_{\substack{=\left(  \text{\# of
}k\text{-element subsets of }S\right)  \\=\dbinom{n}{k}\\\text{(by Theorem
\ref{thm.binom.comb})}}}\cdot\left(  -1\right)  ^{k}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\left(  -1\right)  ^{k}=\sum_{k=0}^{n}\left(
-1\right)  ^{k}\dbinom{n}{k}=\left[  n=0\right]  \ \ \ \ \ \ \ \ \ \ \left(
\text{by Proposition \ref{prop.binom.sum-alt-row}}\right) \\
&  =\left[  \left\vert S\right\vert =0\right]  \ \ \ \ \ \ \ \ \ \ \left(
\text{since }n=\left\vert S\right\vert \right) \\
&  =\left[  S=\varnothing\right]  .
\end{align*}
This proves Proposition \ref{prop.DIE.destruct1}.
\end{proof}

It is now easy to prove Theorems \ref{thm.enum.pie.b.wt},
\ref{thm.enum.pie.b.props} and \ref{thm.enum.pie.b}:

\begin{proof}
[Proof of Theorem \ref{thm.enum.pie.b.wt}.]We have%
\begin{align}
\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\sum_{\substack{x\in U;\\x\in A_{i}\text{ for all }i\in
I}}w\left(  x\right)   &  =\sum_{I\subseteq\left[  n\right]  }\ \ \sum
_{\substack{x\in U;\\x\in A_{i}\text{ for all }i\in I}}\left(  -1\right)
^{\left\vert I\right\vert }w\left(  x\right) \nonumber\\
&  =\sum_{x\in U}\ \ \sum_{\substack{I\subseteq\left[  n\right]  ;\\x\in
A_{i}\text{ for all }i\in I}}\left(  -1\right)  ^{\left\vert I\right\vert
}w\left(  x\right)  . \label{pf.thm.enum.pie.b.wt.1}%
\end{align}
(Here, for the last equality sign, we have interchanged the two summation
signs; as usual, the \textquotedblleft$x\in A_{i}$ for all $i\in
I$\textquotedblright\ condition moved under the inner summation sign. This
relied on Theorem \ref{thm.seqsum.sums.fubini-pred}.)

Now, fix $x\in U$. We shall compute the sum $\sum_{\substack{I\subseteq\left[
n\right]  ;\\x\in A_{i}\text{ for all }i\in I}}\left(  -1\right)  ^{\left\vert
I\right\vert }$.

Indeed, define a subset $S$ of $\left[  n\right]  $ by%
\[
S=\left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}  .
\]
Then, for any subset $I$ of $\left[  n\right]  $, we have the logical
equivalence%
\[
\left(  x\in A_{i}\text{ for all }i\in I\right)  \ \Longleftrightarrow
\ \left(  I\subseteq S\right)
\]
(that is, the statement \textquotedblleft$x\in A_{i}$ for all $i\in
I$\textquotedblright\ holds if and only if the statement \textquotedblleft%
$I\subseteq S$\textquotedblright\ holds)\footnote{\textit{Proof.} Let $I$ be a
subset of $\left[  n\right]  $. For any $i\in\left[  n\right]  $, we have the
logical equivalence
\begin{equation}
\left(  i\in S\right)  \Longleftrightarrow\left(  x\in A_{i}\right)
\label{pf.thm.enum.pie.b.wt.fn1.2}%
\end{equation}
(because $S=\left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}  $).
Now, we have the following chain of equivalences:%
\[
\left(  I\subseteq S\right)  \ \Longleftrightarrow\ \left(  \underbrace{i\in
S}_{\substack{\Longleftrightarrow\left(  x\in A_{i}\right)  \\\text{(by
(\ref{pf.thm.enum.pie.b.wt.fn1.2}))}}}\text{ for all }i\in I\right)
\ \Longleftrightarrow\ \left(  x\in A_{i}\text{ for all }i\in I\right)  .
\]
Thus, we have the equivalence $\left(  x\in A_{i}\text{ for all }i\in
I\right)  \ \Longleftrightarrow\ \left(  I\subseteq S\right)  $, qed.}. Hence,
the condition \textquotedblleft$x\in A_{i}$ for all $i\in I$\textquotedblright%
\ under the summation sign $\sum_{\substack{I\subseteq\left[  n\right]
;\\x\in A_{i}\text{ for all }i\in I}}$ can be replaced by \textquotedblleft%
$I\subseteq S$\textquotedblright. We thus obtain%
\begin{align}
\sum_{\substack{I\subseteq\left[  n\right]  ;\\x\in A_{i}\text{ for all }i\in
I}}\left(  -1\right)  ^{\left\vert I\right\vert }  &  =\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 }\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the subsets }I\text{ of }\left[  n\right]  \text{ satisfying
}I\subseteq S\\
\text{are just the subsets of }S\text{ (because }S\subseteq\left[  n\right]
\text{)}%
\end{array}
\right) \nonumber\\
&  =\left[  S=\varnothing\right]  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.DIE.destruct1}}\right) \nonumber\\
&  =\left[  \left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}
=\varnothing\right]  \label{pf.thm.enum.pie.b.wt.3}%
\end{align}
(since $S=\left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}  $).

On the other hand, we have the following chain of logical equivalences:%
\begin{align}
&  \ \left(  \left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}
=\varnothing\right) \nonumber\\
\Longleftrightarrow &  \ \left(  \text{there exists no }i\in\left[  n\right]
\text{ such that }x\in A_{i}\right) \nonumber\\
\Longleftrightarrow &  \ \left(  x\notin A_{i}\text{ for all }i\in\left[
n\right]  \right)  . \label{pf.thm.enum.pie.b.wt.4}%
\end{align}
However, equivalent logical statements have equal truth values: i.e., if
$\mathcal{A}$ and $\mathcal{B}$ are two equivalent logical statements, then
$\left[  \mathcal{A}\right]  =\left[  \mathcal{B}\right]  $. Therefore, from
the equivalence (\ref{pf.thm.enum.pie.b.wt.4}), we obtain the equality%
\[
\left[  \left\{  i\in\left[  n\right]  \ \mid\ x\in A_{i}\right\}
=\varnothing\right]  =\left[  x\notin A_{i}\text{ for all }i\in\left[
n\right]  \right]  .
\]
Thus, (\ref{pf.thm.enum.pie.b.wt.3}) rewrites as%
\begin{equation}
\sum_{\substack{I\subseteq\left[  n\right]  ;\\x\in A_{i}\text{ for all }i\in
I}}\left(  -1\right)  ^{\left\vert I\right\vert }=\left[  x\notin A_{i}\text{
for all }i\in\left[  n\right]  \right]  . \label{pf.thm.enum.pie.b.wt.5}%
\end{equation}


Now, forget that we fixed $x$. We thus have proved
(\ref{pf.thm.enum.pie.b.wt.5}) for each $x\in U$.

Now, (\ref{pf.thm.enum.pie.b.wt.1}) becomes%
\begin{align*}
&  \sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\sum_{\substack{x\in U;\\x\in A_{i}\text{ for all }i\in
I}}w\left(  x\right) \\
&  =\sum_{x\in U}\ \ \sum_{\substack{I\subseteq\left[  n\right]  ;\\x\in
A_{i}\text{ for all }i\in I}}\left(  -1\right)  ^{\left\vert I\right\vert
}w\left(  x\right) \\
&  =\sum_{x\in U}\underbrace{\left(  \sum_{\substack{I\subseteq\left[
n\right]  ;\\x\in A_{i}\text{ for all }i\in I}}\left(  -1\right)  ^{\left\vert
I\right\vert }\right)  }_{\substack{=\left[  x\notin A_{i}\text{ for all }%
i\in\left[  n\right]  \right]  \\\text{(by (\ref{pf.thm.enum.pie.b.wt.5}))}%
}}w\left(  x\right) \\
&  =\sum_{x\in U}\left[  x\notin A_{i}\text{ for all }i\in\left[  n\right]
\right]  w\left(  x\right) \\
&  =\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[
n\right]  }}\underbrace{\left[  x\notin A_{i}\text{ for all }i\in\left[
n\right]  \right]  }_{\substack{=1\\\text{(since we have }\left(  x\notin
A_{i}\text{ for all }i\in\left[  n\right]  \right)  \text{)}}}w\left(
x\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\sum_{\substack{x\in U;\\\text{not }\left(  x\notin
A_{i}\text{ for all }i\in\left[  n\right]  \right)  }}\underbrace{\left[
x\notin A_{i}\text{ for all }i\in\left[  n\right]  \right]  }%
_{\substack{=0\\\text{(since we don't have }\left(  x\notin A_{i}\text{ for
all }i\in\left[  n\right]  \right)  \text{)}}}w\left(  x\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since each }x\in U\text{ either satisfies }\left(  x\notin A_{i}\text{
for all }i\in\left[  n\right]  \right) \\
\text{or does not}%
\end{array}
\right) \\
&  =\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[
n\right]  }}\underbrace{1w\left(  x\right)  }_{=w\left(  x\right)
}+\underbrace{\sum_{\substack{x\in U;\\\text{not }\left(  x\notin A_{i}\text{
for all }i\in\left[  n\right]  \right)  }}0w\left(  x\right)  }_{=0}%
=\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[  n\right]
}}w\left(  x\right)  .
\end{align*}
This proves Theorem \ref{thm.enum.pie.b.wt}.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.enum.pie.b.props}.]For each $x\in U$, set $w\left(
x\right)  =1$. Then, Theorem \ref{thm.enum.pie.b.wt} yields%
\begin{equation}
\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[  n\right]
}}w\left(  x\right)  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)
^{\left\vert I\right\vert }\sum_{\substack{x\in U;\\x\in A_{i}\text{ for all
}i\in I}}w\left(  x\right)  . \label{pf.thm.enum.pie.b.props.1}%
\end{equation}
However,
\begin{align}
&  \sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[  n\right]
}}\underbrace{w\left(  x\right)  }_{\substack{=1\\\text{(by the definition of
}w\left(  x\right)  \text{)}}}\nonumber\\
&  =\sum_{\substack{x\in U;\\x\notin A_{i}\text{ for all }i\in\left[
n\right]  }}1=\left(  \text{\# of }x\in U\text{ satisfying }x\notin
A_{i}\text{ for all }i\in\left[  n\right]  \right)  \cdot1\nonumber\\
&  =\left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right)  . \label{pf.thm.enum.pie.b.props.2}%
\end{align}
Moreover, each subset $I$ of $\left[  n\right]  $ satisfies
\begin{align}
&  \sum_{\substack{x\in U;\\x\in A_{i}\text{ for all }i\in I}%
}\underbrace{w\left(  x\right)  }_{\substack{=1\\\text{(by the definition of
}w\left(  x\right)  \text{)}}}\nonumber\\
&  =\sum_{\substack{x\in U;\\x\in A_{i}\text{ for all }i\in I}}1=\left(
\text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{ for all }i\in I\right)
\cdot1\nonumber\\
&  =\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{ for all
}i\in I\right)  . \label{pf.thm.enum.pie.b.props.3}%
\end{align}


In light of (\ref{pf.thm.enum.pie.b.props.2}) and
(\ref{pf.thm.enum.pie.b.props.3}), we can rewrite the equality
(\ref{pf.thm.enum.pie.b.props.1}) as%
\begin{align*}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right)  .
\end{align*}
This proves Theorem \ref{thm.enum.pie.b.props}.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.enum.pie.b}.]The set $U\setminus\left(  A_{1}\cup
A_{2}\cup\cdots\cup A_{n}\right)  $ consists of all $x\in U$ satisfying
$x\notin A_{1}\cup A_{2}\cup\cdots\cup A_{n}$ (by the definition of a set
difference). In other words, this set consists of all $x\in U$ satisfying
$x\notin A_{i}$ for all $i\in\left[  n\right]  $ (because the condition
\textquotedblleft$x\notin A_{1}\cup A_{2}\cup\cdots\cup A_{n}$%
\textquotedblright\ is equivalent to \textquotedblleft$x\notin A_{i}$ for all
$i\in\left[  n\right]  $\textquotedblright). Hence,%
\begin{align}
&  \left\vert U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)
\right\vert \nonumber\\
&  =\left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right)  \label{pf.thm.enum.pie.b.1}%
\end{align}
(by Theorem \ref{thm.enum.pie.b.props}).

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Let $I$ be a subset of $\left[  n\right]  $. Then,
\[
\bigcap_{i\in I}A_{i}=\left\{  x\in U\ \mid\ x\in A_{i}\text{ for all }i\in
I\right\}  .
\]

\end{statement}

[\textit{Proof of Claim 1:} Let us warm up by studying the empty set. We have
\begin{equation}
\left\{  x\in U\ \mid\ x\in A_{i}\text{ for all }i\in\varnothing\right\}  =U,
\label{pf.thm.enum.pie.b.c1.pf.1}%
\end{equation}
since the condition \textquotedblleft$x\in A_{i}$ for all $i\in\varnothing
$\textquotedblright\ is vacuously true for all $x\in U$. On the other hand,%
\[
\bigcap_{i\in\varnothing}A_{i}=U,
\]
since we defined the \textquotedblleft empty intersection\textquotedblright%
\ $\bigcap_{i\in\varnothing}A_{i}$ to be $U$. Comparing this with
(\ref{pf.thm.enum.pie.b.c1.pf.1}), we obtain%
\[
\bigcap_{i\in\varnothing}A_{i}=\left\{  x\in U\ \mid\ x\in A_{i}\text{ for all
}i\in\varnothing\right\}  .
\]
In other words, Claim 1 holds for $I=\varnothing$. Thus, for the rest of this
proof, we WLOG assume that $I\neq\varnothing$. This assumption is helpful,
since we defined $\bigcap_{i\in\varnothing}A_{i}$ differently than we defined
$\bigcap_{i\in I}A_{i}$ for nonempty $I$.

Now we know that $I$ is nonempty (since $I\neq\varnothing$). Hence,
$\bigcap_{i\in I}A_{i}$ is literally the intersection of the sets $A_{i}$ for
$i\in I$. Since the latter sets $A_{i}$ are subsets of $U$, we thus conclude
that their intersection $\bigcap_{i\in I}A_{i}$ is also a subset of $U$ (since
any intersection of subsets of $U$ is a subset of $U$). Therefore,%
\begin{align*}
\bigcap_{i\in I}A_{i}  &  =U\cap\left(  \bigcap_{i\in I}A_{i}\right) \\
&  =U\cap\left\{  x\ \mid\ x\in A_{i}\text{ for each }i\in I\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the definition of }\bigcap_{i\in I}A_{i}\\
\text{yields }\bigcap_{i\in I}A_{i}=\left\{  x\ \mid\ x\in A_{i}\text{ for
each }i\in I\right\}
\end{array}
\right) \\
&  =\left\{  x\in U\ \mid\ x\in A_{i}\text{ for each }i\in I\right\} \\
&  =\left\{  x\in U\ \mid\ x\in A_{i}\text{ for all }i\in I\right\}  .
\end{align*}
This proves Claim 1.]

Now,
\begin{align*}
&  \sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left\vert \underbrace{\bigcap_{i\in I}A_{i}}%
_{\substack{=\left\{  x\in U\ \mid\ x\in A_{i}\text{ for all }i\in I\right\}
\\\text{(by Claim 1)}}}\right\vert \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left\vert \left\{  x\in U\ \mid\ x\in A_{i}\text{
for all }i\in I\right\}  \right\vert }_{=\left(  \text{\# of }x\in U\text{
satisfying }x\in A_{i}\text{ for all }i\in I\right)  }\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right)  .
\end{align*}
Comparing this with (\ref{pf.thm.enum.pie.b.1}), we obtain%
\[
\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 .
\]
This proves Theorem \ref{thm.enum.pie.b}.
\end{proof}

Finally, Theorem \ref{thm.enum.pie.a} follows easily from Theorem
\ref{thm.enum.pie.b}.\footnote{Here is the main idea: Let $A_{1},A_{2}%
,\ldots,A_{n}$ be $n$ finite sets. Then, define $U=A_{1}\cup A_{2}\cup
\cdots\cup A_{n}$. This set $U$ is finite again, and the sets $A_{1}%
,A_{2},\ldots,A_{n}$ are subsets of $U$. Thus, Theorem \ref{thm.enum.pie.b}
shows that (\ref{eq.thm.enum.pie.b.eq}) holds. Subtract this equality
(\ref{eq.thm.enum.pie.b.eq}) from the tautological equality $\left\vert
U\right\vert =\left\vert U\right\vert $. The result is%
\[
\left\vert U\right\vert -\left\vert U\setminus\left(  A_{1}\cup A_{2}%
\cup\cdots\cup A_{n}\right)  \right\vert =\left\vert U\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 .
\]
But the left hand side of this equality is easily seen to be $\left\vert
A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right\vert $, whereas the right hand side
is $\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 $ (since the $\left\vert U\right\vert $ term cancels the
$I=\varnothing$ addend in the sum). Thus, we obtain
(\ref{eq.thm.enum.pie.a.eq}), and thus Theorem \ref{thm.enum.pie.a} is
proved.}

As many other properties of sums, Theorem \ref{thm.enum.pie.b.wt} has an
analogue for integrals over measurable sets. It says that a (Lebesgue)
measurable function $w$ defined on a measurable subset $U\in\mathcal{A}$ of a
measure space $\left(  X,\mathcal{A},\mu\right)  $ satisfies%
\[
\int_{U\setminus\left(  A_{1}\cup A_{2}\cup\cdots\cup A_{n}\right)  }%
wd\mu=\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\int_{\bigcap_{i\in I}A_{i}}wd\mu
\]
whenever $A_{1},A_{2},\ldots,A_{n}$ are $n$ measurable subsets of $U$. As a
particular case, if $E_{1},E_{2},\ldots,E_{n}$ are $n$ events in a probability
space, then%
\[
\Pr\left(  \text{neither }E_{1}\text{ nor }E_{2}\text{ nor }E_{3}\text{ nor
}\cdots\text{ nor }E_{n}\right)  =\sum_{I\subseteq\left[  n\right]  }\left(
-1\right)  ^{\left\vert I\right\vert }\Pr\left(  E_{i}\text{ for all }i\in
I\right)  .
\]


\subsubsection{\label{subsect.enum.sylv.rec8}Recitation \#8: More subtractive
counting}

We have already seen (e.g., in our solution to Exercise
\ref{exe.enum.smirnov.count} \textbf{(c)}) how the difference rule can help in
solving enumerative problems. In essence, the idea is that in order to count
some objects that satisfy a certain property, it can be better to first count
the objects that \textbf{don't} satisfy it. The Principle of Inclusion and
Exclusion can be viewed as an extension of this to several properties. Let us
now see some other uses of negativity (differences and powers of $-1$) in
enumerative combinatorics.

Recall our convention $\left[  d\right]  =\left\{  1,2,\ldots,d\right\}  $ for
each $d\in\mathbb{N}$. (This was Convention \ref{conv.enum.nots.bra-n}.)

\begin{exercise}
\label{exe.enum.1-even}Let $n\in\mathbb{N}$. Let $d$ be a positive integer.

An $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]
^{n}$ will be called $1$\textit{-even} if the number $1$ occurs in it an even
number of times (i.e., the number of $i\in\left[  n\right]  $ satisfying
$x_{i}=1$ is even). (For example, the $3$-tuples $\left(  5,1,1\right)  $ and
$\left(  2,2,3\right)  $ are $1$-even, while the $3$-tuple $\left(
4,2,1\right)  $ is not.)

Compute the \# of $1$-even $n$-tuples in $\left[  d\right]  ^{n}$.

[\textbf{Example:} If $d=3$ and $n=2$, then the $1$-even $n$-tuples in
$\left[  d\right]  ^{n}$ are $\left(  1,1\right)  $, $\left(  2,2\right)  $,
$\left(  2,3\right)  $ and $\left(  3,2\right)  $.]
\end{exercise}

This exercise is \cite[Exercise 5]{18s-hw3s}, but we shall give two solutions
different from the one given in \cite{18s-hw3s} (although the second one is related).

\begin{proof}
[First solution of Exercise \ref{exe.enum.1-even} (sketched).]Forget that we
fixed $n$. For each $n\in\mathbb{N}$, we let $e_{n}$ denote the \# of $1$-even
$n$-tuples in $\left[  d\right]  ^{n}$. We thus must compute $e_{n}$ for each
$n\in\mathbb{N}$.

We shall do this similarly to how we solved Exercise
\ref{exe.enum.smirnov.count} \textbf{(c)}: We will first establish a recursive
equation for $e_{n}$ in terms of $e_{n-1}$, and then solve this equation to
obtain an explicit formula.

We first notice that $e_{0}=1$. Indeed, there is only one $0$-tuple in
$\left[  d\right]  ^{0}$ (namely, the empty list $\left(  {}\right)  $), and
this $0$-tuple is $1$-even (since the number $1$ occurs $0$ times in it).

Now, let $n$ be a positive integer. Then, the definition of $e_{n}$
yields\footnote{In the following argument, the word \textquotedblleft%
$n$-tuple\textquotedblright\ will always mean \textquotedblleft$n$-tuple in
$\left[  d\right]  ^{n}$\textquotedblright, and similarly the word
\textquotedblleft$\left(  n-1\right)  $-tuple\textquotedblright\ will always
mean \textquotedblleft$\left(  n-1\right)  $-tuple in $\left[  d\right]
^{n-1}$\textquotedblright. We will not need tuples of elements of sets other
than $\left[  d\right]  $.}%
\begin{align*}
e_{n}  &  =\left(  \text{\# of }1\text{-even }n\text{-tuples}\right) \\
&  =\sum_{k=1}^{d}\left(  \text{\# of }1\text{-even }n\text{-tuples }\left(
x_{1},x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=k\right)
\end{align*}
(by the sum rule, since $x_{n}\in\left[  d\right]  $ for each $n$-tuple
$\left(  x_{1},x_{2},\ldots,x_{n}\right)  $).

We now want to compute the \# of $1$-even $n$-tuples $\left(  x_{1}%
,x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}$ satisfying $x_{n}=k$
for a given $k\in\left[  d\right]  $. The answer will depend on whether $k$ is
$1$ or not.

First, we can find the answer if $k$ is not $1$: For each $k\in\left[
d\right]  $ satisfying $k\neq1$, we have%
\begin{align}
&  \left(  \text{\# of }1\text{-even }n\text{-tuples }\left(  x_{1}%
,x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=k\right) \nonumber\\
&  =e_{n-1}. \label{sol.enum.1-even.knot1}%
\end{align}


[\textit{Proof of (\ref{sol.enum.1-even.knot1}):} Let $k\in\left[  d\right]  $
satisfy $k\neq1$. If an $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $
satisfies $x_{n}=k$, then the number $1$ occurs as often in the $\left(
n-1\right)  $-tuple $\left(  x_{1},x_{2},\ldots,x_{n-1}\right)  $ as it does
in the $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ (since we have
$x_{n}=k\neq1$, and thus the removal of the last entry $x_{n}$ from the
$n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ does not affect the
occurrences of $1$ in this $n$-tuple). Thus, in particular, if an $n$-tuple
$\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ satisfying $x_{n}=k$ is $1$-even,
then the $\left(  n-1\right)  $-tuple $\left(  x_{1},x_{2},\ldots
,x_{n-1}\right)  $ is $1$-even. Hence, we obtain a map%
\begin{align*}
\left\{  1\text{-even }n\text{-tuples }\left(  x_{1},x_{2},\ldots
,x_{n}\right)  \text{ satisfying }x_{n}=k\right\}   &  \rightarrow\left\{
1\text{-even }\left(  n-1\right)  \text{-tuples}\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{n}\right)   &  \mapsto\left(  x_{1},x_{2}%
,\ldots,x_{n-1}\right)  .
\end{align*}
This map is easily seen to be a bijection\footnote{Indeed, the map
\begin{align*}
\left\{  1\text{-even }\left(  n-1\right)  \text{-tuples}\right\}   &
\rightarrow\left\{  1\text{-even }n\text{-tuples }\left(  x_{1},x_{2}%
,\ldots,x_{n}\right)  \text{ satisfying }x_{n}=k\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{n-1}\right)   &  \mapsto\left(  x_{1}%
,x_{2},\ldots,x_{n-1},k\right)
\end{align*}
is easily seen to be well-defined and inverse to it.}. Thus, the bijection
principle yields%
\begin{align*}
&  \left\vert \left\{  1\text{-even }n\text{-tuples }\left(  x_{1}%
,x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=k\right\}  \right\vert \\
&  =\left\vert \left\{  1\text{-even }\left(  n-1\right)  \text{-tuples}%
\right\}  \right\vert =\left(  \text{\# of }1\text{-even }\left(  n-1\right)
\text{-tuples}\right)  =e_{n-1}%
\end{align*}
(since $e_{n-1}$ was defined as the \# of $1$-even $\left(  n-1\right)
$-tuples). But this is clearly equivalent to (\ref{sol.enum.1-even.knot1}).
This proves (\ref{sol.enum.1-even.knot1}).]

Next, let us answer our question for $k=1$: We have%
\begin{align}
&  \left(  \text{\# of }1\text{-even }n\text{-tuples }\left(  x_{1}%
,x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=1\right) \nonumber\\
&  =d^{n-1}-e_{n-1}. \label{sol.enum.1-even.k1}%
\end{align}


[\textit{Proof of (\ref{sol.enum.1-even.k1}):} The set of all $\left(
n-1\right)  $-tuples is $\left[  d\right]  ^{n-1}$. Thus, $\left(  \text{\# of
}\left(  n-1\right)  \text{-tuples}\right)  =\left\vert \left[  d\right]
^{n-1}\right\vert =\left\vert \left[  d\right]  \right\vert ^{n-1}=d^{n-1}$
(since $\left\vert \left[  d\right]  \right\vert =d$).

We need one more notion: An $\left(  n-1\right)  $-tuple will be called
$1$\textit{-odd} if the number $1$ occurs in it an odd number of times. Thus,
any $\left(  n-1\right)  $-tuple is either $1$-even or $1$-odd (but not both
at the same time). Thus, the sum rule yields%
\[
\left(  \text{\# of }\left(  n-1\right)  \text{-tuples}\right)  =\left(
\text{\# of }1\text{-even }\left(  n-1\right)  \text{-tuples}\right)  +\left(
\text{\# of }1\text{-odd }\left(  n-1\right)  \text{-tuples}\right)  ,
\]
so that%
\begin{align*}
\left(  \text{\# of }1\text{-odd }\left(  n-1\right)  \text{-tuples}\right)
&  =\underbrace{\left(  \text{\# of }\left(  n-1\right)  \text{-tuples}%
\right)  }_{=d^{n-1}}-\underbrace{\left(  \text{\# of }1\text{-even }\left(
n-1\right)  \text{-tuples}\right)  }_{\substack{=e_{n-1}\\\text{(by the
definition of }e_{n-1}\text{)}}}\\
&  =d^{n-1}-e_{n-1}.
\end{align*}


Now, what does this have to do with the $1$-even $n$-tuples $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ satisfying $x_{n}=1$ ?

If an $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ satisfies
$x_{n}=1$, then the number $1$ occurs one less time in the $\left(
n-1\right)  $-tuple $\left(  x_{1},x_{2},\ldots,x_{n-1}\right)  $ than it does
in the $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ (since we have
$x_{n}=1$, and thus the removal of the last entry $x_{n}$ from the $n$-tuple
$\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ removes exactly one occurrence of
$1$ from this $n$-tuple). Thus, in particular, if an $n$-tuple $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ satisfies $x_{n}=1$, and if the number $1$
occurs an even number of times in this $n$-tuple, then the number $1$ will
occur an odd number of times in the $\left(  n-1\right)  $-tuple $\left(
x_{1},x_{2},\ldots,x_{n-1}\right)  $. In other words, if an $n$-tuple $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ satisfying $x_{n}=1$ is $1$-even, then the
$\left(  n-1\right)  $-tuple $\left(  x_{1},x_{2},\ldots,x_{n-1}\right)  $ is
$1$-odd. Hence, we obtain a map%
\begin{align*}
\left\{  1\text{-even }n\text{-tuples }\left(  x_{1},x_{2},\ldots
,x_{n}\right)  \text{ satisfying }x_{n}=1\right\}   &  \rightarrow\left\{
1\text{-odd }\left(  n-1\right)  \text{-tuples}\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{n}\right)   &  \mapsto\left(  x_{1},x_{2}%
,\ldots,x_{n-1}\right)  .
\end{align*}
This map is easily seen to be a bijection\footnote{Indeed, the map
\begin{align*}
\left\{  1\text{-odd }\left(  n-1\right)  \text{-tuples}\right\}   &
\rightarrow\left\{  1\text{-even }n\text{-tuples }\left(  x_{1},x_{2}%
,\ldots,x_{n}\right)  \text{ satisfying }x_{n}=1\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{n-1}\right)   &  \mapsto\left(  x_{1}%
,x_{2},\ldots,x_{n-1},1\right)
\end{align*}
is easily seen to be well-defined and inverse to it.}. Thus, the bijection
principle yields%
\begin{align*}
&  \left\vert \left\{  1\text{-even }n\text{-tuples }\left(  x_{1}%
,x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=1\right\}  \right\vert \\
&  =\left\vert \left\{  1\text{-odd }\left(  n-1\right)  \text{-tuples}%
\right\}  \right\vert =\left(  \text{\# of }1\text{-odd }\left(  n-1\right)
\text{-tuples}\right)  =d^{n-1}-e_{n-1}.
\end{align*}
But this is clearly equivalent to (\ref{sol.enum.1-even.k1}). This proves
(\ref{sol.enum.1-even.k1}).]

Now, recall that%
\begin{align*}
e_{n}  &  =\sum_{k=1}^{d}\left(  \text{\# of }1\text{-even }n\text{-tuples
}\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=k\right) \\
&  =\underbrace{\left(  \text{\# of }1\text{-even }n\text{-tuples }\left(
x_{1},x_{2},\ldots,x_{n}\right)  \text{ satisfying }x_{n}=1\right)
}_{\substack{=d^{n-1}-e_{n-1}\\\text{(by (\ref{sol.enum.1-even.k1}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ +\sum_{k=2}^{d}\underbrace{\left(  \text{\# of
}1\text{-even }n\text{-tuples }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{
satisfying }x_{n}=k\right)  }_{\substack{=e_{n-1}\\\text{(by
(\ref{sol.enum.1-even.knot1}) (since }k\geq2>1\text{ and thus }k\neq
1\text{))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split off the addend for }k=1\\
\text{from the sum}%
\end{array}
\right) \\
&  =d^{n-1}-e_{n-1}+\underbrace{\sum_{k=2}^{d}e_{n-1}}_{=\left(  d-1\right)
e_{n-1}}=d^{n-1}-e_{n-1}+\left(  d-1\right)  e_{n-1}\\
&  =d^{n-1}+\left(  d-2\right)  e_{n-1}.
\end{align*}


Forget that we fixed $n$. We thus have shown that%
\begin{equation}
e_{n}=d^{n-1}+\left(  d-2\right)  e_{n-1} \label{sol.enum.1-even.1st.rec}%
\end{equation}
for every positive integer $n$. Set $u=d-2$. Then,
(\ref{sol.enum.1-even.1st.rec}) rewrites as%
\begin{equation}
e_{n}=d^{n-1}+ue_{n-1}. \label{sol.enum.1-even.1st.recf}%
\end{equation}
We can attempt to solve this recurrence by substituting this equality back
into itself:%
\begin{align*}
e_{n}  &  =d^{n-1}+u\underbrace{e_{n-1}}_{\substack{=d^{n-2}+ue_{n-2}%
\\\text{(by (\ref{sol.enum.1-even.1st.recf}))}}}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.enum.1-even.1st.recf})}\right) \\
&  =d^{n-1}+u\left(  d^{n-2}+u\underbrace{e_{n-2}}_{\substack{=d^{n-3}%
+ue_{n-3}\\\text{(by (\ref{sol.enum.1-even.1st.recf}))}}}\right) \\
&  =d^{n-1}+u\left(  d^{n-2}+u\left(  d^{n-3}+u\underbrace{e_{n-3}}_{=\cdots
}\right)  \right) \\
&  =\cdots\\
&  =d^{n-1}+u\left(  d^{n-2}+u\left(  d^{n-3}+u\left(  \cdots+u\left(
d^{0}+u\underbrace{e_{0}}_{=1}\right)  \right)  \right)  \right) \\
&  =d^{n-1}+u\left(  d^{n-2}+u\left(  d^{n-3}+u\left(  \cdots+u\left(
d^{0}+u\right)  \right)  \right)  \right) \\
&  =\underbrace{d^{n-1}+ud^{n-2}+u^{2}d^{n-3}+u^{3}d^{n-4}+\cdots+u^{n-1}%
d^{0}}_{\substack{=\sum_{i=0}^{n-1}u^{i}d^{n-1-i}\\=\dfrac{u^{n}-d^{n}}%
{u-d}\\\text{(since (\ref{eq.sum.geometric-sum}) (applied to }m=n\text{ and
}a=u\text{ and }b=d\text{)}\\\text{yields }\left(  u-d\right)  \sum
_{i=0}^{n-1}u^{i}d^{n-1-i}=u^{n}-d^{n}\text{)}}}+u^{n}\\
&  =\dfrac{u^{n}-d^{n}}{u-d}+u^{n}=\dfrac{u^{n}-d^{n}}{-2}+u^{n}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\underbrace{u}_{=d-2}%
-d=d-2-d=-2\right) \\
&  =\dfrac{1}{2}\left(  d^{n}+u^{n}\right)  =\dfrac{1}{2}\left(  d^{n}+\left(
d-2\right)  ^{n}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since
}u=d-2\right)  .
\end{align*}
Thus we have obtained the explicit formula%
\begin{equation}
e_{n}=\dfrac{1}{2}\left(  d^{n}+\left(  d-2\right)  ^{n}\right)
\label{sol.enum.1-even.1st.ans}%
\end{equation}
for each $n\in\mathbb{N}$.

\begin{fineprint}
As with most such formulas, once they are known, they are easy to prove by
induction. For example, here is a quick inductive proof of
(\ref{sol.enum.1-even.1st.ans}):

[\textit{Alternative proof of (\ref{sol.enum.1-even.1st.ans}):} We shall prove
(\ref{sol.enum.1-even.1st.ans}) by induction on $n$:

\textit{Induction base:} Comparing $e_{0}=1$ with $\dfrac{1}{2}\left(
\underbrace{d^{0}}_{=1}+\underbrace{\left(  d-2\right)  ^{0}}_{=1}\right)
=\dfrac{1}{2}\left(  1+1\right)  =1$, we obtain $e_{0}=\dfrac{1}{2}\left(
d^{0}+\left(  d-2\right)  ^{0}\right)  $. In other words,
(\ref{sol.enum.1-even.1st.ans}) holds for $n=0$.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{sol.enum.1-even.1st.ans}) holds for $n=m-1$.
We must show that (\ref{sol.enum.1-even.1st.ans}) holds for $n=m$.

We have assumed that (\ref{sol.enum.1-even.1st.ans}) holds for $n=m-1$. In
other words, we have $e_{m-1}=\dfrac{1}{2}\left(  d^{m-1}+\left(  d-2\right)
^{m-1}\right)  $. Now, (\ref{sol.enum.1-even.1st.rec}) (applied to $n=m$)
yields%
\begin{align*}
e_{m}  &  =d^{m-1}+\left(  d-2\right)  \underbrace{e_{m-1}}_{=\dfrac{1}%
{2}\left(  d^{m-1}+\left(  d-2\right)  ^{m-1}\right)  }\\
&  =d^{m-1}+\left(  d-2\right)  \cdot\dfrac{1}{2}\left(  d^{m-1}+\left(
d-2\right)  ^{m-1}\right) \\
&  =d^{m-1}+d\cdot\dfrac{1}{2}\left(  d^{m-1}+\left(  d-2\right)
^{m-1}\right)  -\left(  d^{m-1}+\left(  d-2\right)  ^{m-1}\right) \\
&  =d\cdot\dfrac{1}{2}\left(  d^{m-1}+\left(  d-2\right)  ^{m-1}\right)
-\left(  d-2\right)  ^{m-1}\\
&  =\dfrac{1}{2}\left(  \underbrace{d\cdot\left(  d^{m-1}+\left(  d-2\right)
^{m-1}\right)  }_{=dd^{m-1}+d\left(  d-2\right)  ^{m-1}}-2\left(  d-2\right)
^{m-1}\right) \\
&  =\dfrac{1}{2}\left(  \underbrace{dd^{m-1}}_{=d^{m}}+\underbrace{d\left(
d-2\right)  ^{m-1}-2\left(  d-2\right)  ^{m-1}}_{=\left(  d-2\right)  \left(
d-2\right)  ^{m-1}=\left(  d-2\right)  ^{m}}\right) \\
&  =\dfrac{1}{2}\left(  d^{m}+\left(  d-2\right)  ^{m}\right)  .
\end{align*}
In other words, (\ref{sol.enum.1-even.1st.ans}) holds for $n=m$. This
completes the induction step. Thus, (\ref{sol.enum.1-even.1st.ans}) is proved.]
\end{fineprint}

Exercise \ref{exe.enum.1-even} is answered by (\ref{sol.enum.1-even.1st.ans}).
\end{proof}

\begin{proof}
[Second solution of Exercise \ref{exe.enum.1-even} (sketched).]Here is a more
elegant argument.

Having introduced the notion of \textquotedblleft$1$-even\textquotedblright%
\ tuples, let us also introduce the opposite notion: An $n$-tuple $\left(
x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}$ will be called
$1$\textit{-odd} if the number $1$ occurs in it an odd number of times. Thus,
any $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]
^{n}$ is either $1$-even or $1$-odd (but not both at the same time).

Let $e_{n}$ denote the \# of $1$-even $n$-tuples in $\left[  d\right]  ^{n}$.
Let $o_{n}$ denote the \# of $1$-odd $n$-tuples in $\left[  d\right]  ^{n}$.
Thus, we must compute $e_{n}$.

We notice that $\left\vert \left[  d\right]  ^{n}\right\vert =\left\vert
\left[  d\right]  \right\vert ^{n}=d^{n}$ (since $\left\vert \left[  d\right]
\right\vert =d$), and thus%
\begin{align*}
d^{n}  &  =\left\vert \left[  d\right]  ^{n}\right\vert =\left(  \text{\# of
all }n\text{-tuples in }\left[  d\right]  ^{n}\right) \\
&  =\underbrace{\left(  \text{\# of }1\text{-even }n\text{-tuples in }\left[
d\right]  ^{n}\right)  }_{\substack{=e_{n}\\\text{(by the definition of }%
e_{n}\text{)}}}+\underbrace{\left(  \text{\# of }1\text{-odd }n\text{-tuples
in }\left[  d\right]  ^{n}\right)  }_{\substack{=o_{n}\\\text{(by the
definition of }o_{n}\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the sum rule, since any }n\text{-tuple }\left(  x_{1},x_{2}%
,\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}\\
\text{is either }1\text{-even or }1\text{-odd (but not both at the same time)}%
\end{array}
\right) \\
&  =e_{n}+o_{n}.
\end{align*}
In other words,%
\begin{equation}
e_{n}+o_{n}=d^{n}. \label{sol.enum.1-even.2nd.sum}%
\end{equation}


Now, we shall compute $e_{n}-o_{n}$. Indeed, for each $k\in\left[  d\right]
$, let us define a number%
\begin{equation}
s\left(  k\right)  =%
\begin{cases}
-1, & \text{if }k=1;\\
1, & \text{if }k>1.
\end{cases}
\label{sol.enum.1-even.2nd.sk=}%
\end{equation}
Thus, $s\left(  1\right)  =-1$ and $s\left(  2\right)  =s\left(  3\right)
=\cdots=s\left(  d\right)  =1$. Why are we defining these strange numbers? We
will soon see.

If $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}$ is an
$n$-tuple, then%
\begin{equation}
s\left(  x_{1}\right)  s\left(  x_{2}\right)  \cdots s\left(  x_{n}\right)  =%
\begin{cases}
1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-even;}\\
-1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-odd.}%
\end{cases}
\label{sol.enum.1-even.2nd.sprod=}%
\end{equation}


[\textit{Proof of (\ref{sol.enum.1-even.2nd.sprod=}):} Let $\left(
x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}$ be an $n$-tuple.
Each of the $n$ factors $s\left(  x_{1}\right)  ,s\left(  x_{2}\right)
,\ldots,s\left(  x_{n}\right)  $ in the product $s\left(  x_{1}\right)
s\left(  x_{2}\right)  \cdots s\left(  x_{n}\right)  $ is either $-1$ or $1$
(according to (\ref{sol.enum.1-even.2nd.sk=})). Thus, the entire product
$s\left(  x_{1}\right)  s\left(  x_{2}\right)  \cdots s\left(  x_{n}\right)  $
is a product of $1$'s and $\left(  -1\right)  $'s. Therefore, this product
equals $1$ if an even number of its factors are $\left(  -1\right)  $'s, and
equals $-1$ if an odd number of its factors are $\left(  -1\right)  $'s. But
the number of factors of the product $s\left(  x_{1}\right)  s\left(
x_{2}\right)  \cdots s\left(  x_{n}\right)  $ that are $\left(  -1\right)  $'s
is precisely the number of occurrences of the number $1$ in the $n$-tuple
$\left(  x_{1},x_{2},\ldots,x_{n}\right)  $, since each such occurrence
contributes a factor that is $-1$ (because (\ref{sol.enum.1-even.2nd.sk=})
says that $s\left(  x_{i}\right)  =-1$ if and only if $x_{i}=1$). Thus, this
number of factors that are $\left(  -1\right)  $'s is even if $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ is $1$-even, and is odd if $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ is $1$-odd. Combining these observations,
we obtain (\ref{sol.enum.1-even.2nd.sprod=}).]

Now, consider the sum%
\begin{align*}
&  \sum_{\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}%
}\underbrace{s\left(  x_{1}\right)  s\left(  x_{2}\right)  \cdots s\left(
x_{n}\right)  }_{=%
\begin{cases}
1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-even;}\\
-1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-odd}%
\end{cases}
}\\
&  =\sum_{\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}}%
\begin{cases}
1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-even;}\\
-1, & \text{if }\left(  x_{1},x_{2},\ldots,x_{n}\right)  \text{ is
}1\text{-odd.}%
\end{cases}
\end{align*}
This sum has $e_{n}$ many addends equal to $1$ (since there are $e_{n}$ many
$1$-even $n$-tuples $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[
d\right]  ^{n}$) and $o_{n}$ many addends equal to $-1$ (since there are
$o_{n}$ many $1$-odd $n$-tuples $\left(  x_{1},x_{2},\ldots,x_{n}\right)
\in\left[  d\right]  ^{n}$). Hence, this sum simplifies to%
\[
e_{n}\cdot1+o_{n}\cdot\left(  -1\right)  =e_{n}-o_{n}.
\]
Thus, we obtain%
\[
\sum_{\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}%
}s\left(  x_{1}\right)  s\left(  x_{2}\right)  \cdots s\left(  x_{n}\right)
=e_{n}-o_{n}.
\]
Hence,%
\[
e_{n}-o_{n}=\sum_{\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[
d\right]  ^{n}}s\left(  x_{1}\right)  s\left(  x_{2}\right)  \cdots s\left(
x_{n}\right)  =\sum_{\left(  k_{1},k_{2},\ldots,k_{n}\right)  \in\left[
d\right]  ^{n}}s\left(  k_{1}\right)  s\left(  k_{2}\right)  \cdots s\left(
k_{n}\right)
\]
(here, we have renamed the summation index). On the other hand, Theorem
\ref{thm.seqsum.prods.prodrule} (applied to $m_{i}=d$ and $p_{i,k}=s\left(
k\right)  $) yields%
\[
\prod_{i=1}^{n}\sum_{k=1}^{d}s\left(  k\right)  =\sum_{\left(  k_{1}%
,k_{2},\ldots,k_{n}\right)  \in\left[  d\right]  ^{n}}\ \ \underbrace{\prod
_{i=1}^{n}s\left(  k_{i}\right)  }_{=s\left(  k_{1}\right)  s\left(
k_{2}\right)  \cdots s\left(  k_{n}\right)  }=\sum_{\left(  k_{1},k_{2}%
,\ldots,k_{n}\right)  \in\left[  d\right]  ^{n}}s\left(  k_{1}\right)
s\left(  k_{2}\right)  \cdots s\left(  k_{n}\right)  .
\]
Comparing these two equalities, we obtain%
\[
e_{n}-o_{n}=\prod_{i=1}^{n}\sum_{k=1}^{d}s\left(  k\right)  =\left(
\sum_{k=1}^{d}s\left(  k\right)  \right)  ^{n}.
\]
In view of%
\begin{align*}
\sum_{k=1}^{d}s\left(  k\right)   &  =\underbrace{s\left(  1\right)  }%
_{=-1}+\underbrace{s\left(  2\right)  }_{=1}+\underbrace{s\left(  3\right)
}_{=1}+\cdots+\underbrace{s\left(  d\right)  }_{=1}\\
&  =\left(  -1\right)  +\underbrace{1+1+\cdots+1}_{d-1\text{ times}}=\left(
-1\right)  +\left(  d-1\right)  \cdot1=d-2,
\end{align*}
this rewrites as
\begin{equation}
e_{n}-o_{n}=\left(  d-2\right)  ^{n}. \label{sol.enum.1-even.2nd.diff}%
\end{equation}
Adding this equality to (\ref{sol.enum.1-even.2nd.sum}), we obtain%
\[
\left(  e_{n}+o_{n}\right)  +\left(  e_{n}-o_{n}\right)  =d^{n}+\left(
d-2\right)  ^{n}.
\]
In view of $\left(  e_{n}+o_{n}\right)  +\left(  e_{n}-o_{n}\right)  =2e_{n}$,
this rewrites as $2e_{n}=d^{n}+\left(  d-2\right)  ^{n}$. Dividing this
equality by $2$, we obtain $e_{n}=\dfrac{1}{2}\left(  d^{n}+\left(
d-2\right)  ^{n}\right)  $. Hence, we have solved Exercise
\ref{exe.enum.1-even} again (and, reassuringly, obtained the same answer as
the first time).
\end{proof}

The trick used in the second solution above is not just slick; it has further
applications. Superficially, what we did was finding $e_{n}$ by first
computing $e_{n}+o_{n}$ and $e_{n}-o_{n}$ and then adding up and dividing by
$2$. But the \textquotedblleft reason\textquotedblright\ why $e_{n}-o_{n}$ was
so much easier to find than $e_{n}$ alone is that $e_{n}-o_{n}$ was a sum (of
$1$'s and $\left(  -1\right)  $'s) over \textbf{all} (not just the $1$-even)
$n$-tuples $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]
^{n}$, and the addends could be decomposed as products $s\left(  x_{1}\right)
s\left(  x_{2}\right)  \cdots s\left(  x_{n}\right)  $.

A more sophisticated use of this strategy can be used to solve the following
exercise (\cite[Exercise 7]{18f-hw4s}):

\begin{exercise}
\label{exe.enum.all-even}Let $n\in\mathbb{N}$ and $d\in\mathbb{N}$.

An $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]
^{n}$ will be called \textit{all-even} if each number occurs in it an even
number of times (i.e., for each $j\in\left[  d\right]  $, the number of
$i\in\left[  n\right]  $ satisfying $x_{i}=j$ is even). (For example, the
$4$-tuples $\left(  1,5,1,5\right)  $ and $\left(  2,2,3,3\right)  $ are
all-even, while the $4$-tuple $\left(  4,1,1,1\right)  $ is not.)

Prove that the \# of all-even $n$-tuples in $\left[  d\right]  ^{n}$ is
\[
\dfrac{1}{2^{d}}\sum_{k=0}^{d}\dbinom{d}{k}\left(  d-2k\right)  ^{n}.
\]

\end{exercise}

We omit the solution for now (see \cite[Exercise 7]{18f-hw4s}). (TODO: Insert it.)

\subsection{\label{sect.extcomb}A bit of extremal combinatorics}

So far in this chapter, we have been doing enumerative combinatorics, which is
mostly about questions of the form \textquotedblleft how many things exist
with this or that property\textquotedblright. \textit{Extremal combinatorics},
on the other hand, is the science of questions like \textquotedblleft how big
or small can things get while satisfying this or that
property?\textquotedblright. Here are some examples:

\begin{itemize}
\item Given $n\in\mathbb{N}$, how many distinct subsets of $\left[  n\right]
$ can you pick so that every two subsets you have picked have a nonempty
intersection? (We shall answer this below.)

\item Given $n,k\in\mathbb{N}$, how many distinct $k$-element subsets of
$\left[  n\right]  $ can you pick so that every two subsets you have picked
have a nonempty intersection? (We shall answer this below. Note that the case
$2k>n$ is trivial -- make sure you see why!)

\item Given $n\in\mathbb{N}$, how many distinct subsets of $\left[  n\right]
$ can you pick so that no subset you have picked is a subset of another? (We
shall answer this below.)

\item Given $n\in\mathbb{N}$, how many distinct $n$-tuples $\left(
i_{1},i_{2},\ldots,i_{n}\right)  \in\left\{  0,1\right\}  ^{n}$ can you pick
so that no two $n$-tuples you have picked differ in just a single entry? (Such
a pick is known as a \textit{single-error-detecting code}. But this makes the
question sound harder than it is!)

\item Given $n,k\in\mathbb{N}$, how many distinct numbers can you pick from
the set $\left[  n\right]  $ so that any two distinct numbers $a,b$ you have
picked satisfy $\left\vert a-b\right\vert \geq k$ ? (Using the terminology of
Exercise \ref{exe.lac.size}, this is just asking for the largest size of a
$k$-lacunar subset of $\left\{  1,2,\ldots,n\right\}  $.) It is easy to see
that the answer is $\left\lfloor \dfrac{n+k-1}{k}\right\rfloor $. (Indeed, you
can certainly pick $\left\lfloor \dfrac{n+k-1}{k}\right\rfloor $ distinct
numbers with this property\footnote{Namely, you can pick the numbers
\[
0k+1,1k+1,2k+1,\ldots,\left(  q-1\right)  k+1,
\]
where $q=\left\lfloor \dfrac{n+k-1}{k}\right\rfloor $. An easy computation
shows that they all belong to $\left[  n\right]  $ and have the property
required.}, and Exercise \ref{exe.lac.size} shows that you cannot pick
more\footnote{More precisely, Exercise \ref{exe.lac.size} shows that you
cannot pick more than $\dfrac{n+k-1}{k}$ distinct numbers with this property.
But you can only pick an integer number of numbers; thus, \textquotedblleft no
more than $\dfrac{n+k-1}{k}$\textquotedblright\ is tantamount to
\textquotedblleft no more than $\left\lfloor \dfrac{n+k-1}{k}\right\rfloor
$\textquotedblright.}.)
\end{itemize}

The attentive reader will notice that the pigeonhole principles also belong to
extremal combinatorics, as they answer questions like \textquotedblleft how
many distinct elements can you pick from a given $n$-element
set?\textquotedblright\ or \textquotedblleft how few elements can you pick
from a given $n$-element set so that every element has been picked at least
once?\textquotedblright. Our point here is not to dwell on fundamentals like
this, but to put them into a new context.

I shall not give a proper introduction to extremal combinatorics, but I shall
solve three of the above questions to give an idea of how the subject (or at
least a small part of it) feels like. The reader can find a lot more in
\cite[Chapter 43 onward]{Galvin17}, \cite{Jukna11}, \cite{Engel97} and other places.

\begin{convention}
The word \textquotedblleft\textit{collection}\textquotedblright\ is a synonym
for \textquotedblleft set\textquotedblright. For reasons of clarity, we shall
speak of \textquotedblleft collections of sets\textquotedblright\ instead of
\textquotedblleft sets of sets\textquotedblright. For example, $\left\{
\left\{  1,2\right\}  ,\left\{  1,3\right\}  ,\left\{  5\right\}  \right\}  $
is a collection of subsets of $\left[  5\right]  $.
\end{convention}

\subsubsection{Sperner's theorem}

We begin with answering the question \textquotedblleft Given $n\in\mathbb{N}$,
how many distinct subsets of $\left[  n\right]  $ can you pick so that no
subset you have picked is a subset of another?\textquotedblright:

\begin{definition}
Let $S$ be a set. A \textit{set antichain} of $S$ means a collection
$\mathbf{J}$ of subsets of $S$ such that no two distinct sets $A,B\in
\mathbf{A}$ satisfy $A\subseteq B$.
\end{definition}

\begin{example}
\textbf{(a)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,3\right\}  ,\left\{  5\right\}  \right\}  $ is a set antichain of $\left[
5\right]  $.

\textbf{(b)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,3\right\}  ,\left\{  2\right\}  \right\}  $ is not a set antichain of
$\left[  5\right]  $, since $\left\{  2\right\}  \subseteq\left\{
1,2\right\}  $.
\end{example}

\begin{theorem}
[Sperner's theorem]\label{thm.extcomb.sperner}Let $n\in\mathbb{N}$. Let $S$ be
an $n$-element set. Then, the maximum possible size of a set antichain of $S$
is $\dbinom{n}{\left\lfloor n/2\right\rfloor }$.
\end{theorem}

Before we prove this theorem, let us do two things. First, as a warmup, we
shall prove a similar (but much simpler) result about \textit{set chains} -- a
dual notion to set antichains. Then, we shall show an inequality saying that
$\dbinom{n}{\left\lfloor n/2\right\rfloor }$ is the largest of all binomial
coefficients $\dbinom{n}{k}$ (for a fixed $n\in\mathbb{N}$).

\begin{definition}
Let $S$ be a set. A \textit{set chain} of $S$ means a collection $\mathbf{C}$
of subsets of $S$ such that any two distinct sets $A,B\in\mathbf{C}$ satisfy
$A\subseteq B$ or $B\subseteq A$.
\end{definition}

\begin{example}
\textbf{(a)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,2,5\right\}  ,\left\{  1,2,3,4,5\right\}  \right\}  $ is a set chain of
$\left[  5\right]  $.

\textbf{(b)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,3\right\}  ,\left\{  1,2,3\right\}  \right\}  $ is not a set chain of
$\left[  5\right]  $, since $\left\{  1,2\right\}  $ and $\left\{
1,3\right\}  $ satisfy neither $\left\{  1,2\right\}  \subseteq\left\{
1,3\right\}  $ nor $\left\{  1,3\right\}  \subseteq\left\{  1,2\right\}  $.
\end{example}

\begin{theorem}
\label{thm.extcomb.cosperner}Let $n\in\mathbb{N}$. Let $S$ be an $n$-element
set. Then, the maximum possible size of a set chain of $S$ is $n+1$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.extcomb.cosperner} (sketched).]Let $s_{1}%
,s_{2},\ldots,s_{n}$ be the $n$ elements of $S$. The collection%
\begin{align*}
&  \left\{  \left\{  s_{1},s_{2},\ldots,s_{n}\right\}  \ \mid\ i\in\left\{
0,1,\ldots,n\right\}  \right\} \\
&  =\{\left\{  {}\right\}  ,\\
&  \ \ \ \ \ \ \left\{  s_{1}\right\}  ,\\
&  \ \ \ \ \ \ \left\{  s_{1},s_{2}\right\}  ,\\
&  \ \ \ \ \ \ \left\{  s_{1},s_{2},s_{3}\right\}  ,\\
&  \ \ \ \ \ \ \ldots,\\
&  \ \ \ \ \ \ \left\{  s_{1},s_{2},\ldots,s_{n}\right\}  \}
\end{align*}
is clearly a set chain of $S$, and has size $n+1$. Thus, it remains to prove
that any set chain of $S$ has size $\leq n+1$.

Indeed, let $\mathbf{C}$ be a set chain of $S$. We must thus prove that
$\left\vert \mathbf{C}\right\vert \leq n+1$.

Each set $I\in\mathbf{C}$ is a subset of $S$, and thus satisfies $\left\vert
I\right\vert \in\left\{  0,1,\ldots,n\right\}  $ (since $S$ is an $n$-element
set). Hence, we can define a map%
\begin{align*}
f:\mathbf{C}  &  \rightarrow\left\{  0,1,\ldots,n\right\}  ,\\
I  &  \mapsto\left\vert I\right\vert .
\end{align*}
This map $f$ simply sends each set $I\in\mathbf{C}$ to its size. Now, we claim
that this map $f$ is injective. Indeed, if $A$ and $B$ are two distinct
elements of $\mathbf{C}$, then we have $A\subseteq B$ or $B\subseteq A$ (since
$\mathbf{C}$ is a set chain), and therefore we must have $\left\vert
A\right\vert \neq\left\vert B\right\vert $ (because if we had $\left\vert
A\right\vert =\left\vert B\right\vert $, then either of the two relations
$A\subseteq B$ and $B\subseteq A$ would imply that $A=B$%
\ \ \ \ \footnote{Here, we are using the fact that if $X$ and $Y$ are two
finite sets satisfying $X\subseteq Y$ and $\left\vert X\right\vert =\left\vert
Y\right\vert $, then $X=Y$.}, which would contradict the fact that $A$ and $B$
are distinct); but this rewrites as $f\left(  A\right)  \neq f\left(
B\right)  $ (since the definition of $f$ yields $f\left(  A\right)
=\left\vert A\right\vert $ and $f\left(  B\right)  =\left\vert B\right\vert
$). Thus, the map $f$ is injective. Hence, Theorem \ref{thm.php.php-inj-1}
(applied to $U=\mathbf{C}$ and $V=\left\{  0,1,\ldots,n\right\}  $) yields
$\left\vert \mathbf{C}\right\vert \leq\left\vert \left\{  0,1,\ldots
,n\right\}  \right\vert =n+1$. This is precisely what we had to show. Thus,
the proof of Theorem \ref{thm.extcomb.cosperner} is complete.
\end{proof}

Next, as we promised, comes an inequality for binomial coefficients:

\begin{lemma}
\label{lem.extcomb.binom-ineq}Let $n\in\mathbb{N}$ and $k\in\mathbb{R}$. Then,
$\dbinom{n}{k}\leq\dbinom{n}{\left\lfloor n/2\right\rfloor }$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.extcomb.binom-ineq} (sketched).]There are many proofs
for this; here is an outline of what might be the simplest one.

Theorem \ref{thm.binom.sym} yields $\dbinom{n}{k}=\dbinom{n}{n-k}$. Thus, if
$k>n-k$, then we can replace $k$ by $n-k$ without changing $\dbinom{n}{k}$.
Hence, for the rest of this proof, we WLOG assume that $k\leq n-k$. Hence,
$2k\leq n$, so that $k\leq n/2$ and therefore $k\leq\left\lfloor
n/2\right\rfloor $ (since $k$ is an integer).

If $k\notin\mathbb{N}$, then $\dbinom{n}{k}=0\leq\dbinom{n}{\left\lfloor
n/2\right\rfloor }$ (since $\dbinom{n}{\left\lfloor n/2\right\rfloor }\geq0$).
Thus, if $k\notin\mathbb{N}$, then Lemma \ref{lem.extcomb.binom-ineq} holds.
Hence, for the rest of this proof, we WLOG assume that $k\in\mathbb{N}$.
Combining $k\in\mathbb{N}$ with $k\leq\left\lfloor n/2\right\rfloor $, we find
$k\in\left\{  0,1,\ldots,\left\lfloor n/2\right\rfloor \right\}  $.

Now, we claim the following chain of inequalities:%
\begin{equation}
\dbinom{n}{0}<\dbinom{n}{1}<\dbinom{n}{2}<\cdots<\dbinom{n}{\left\lfloor
n/2\right\rfloor }. \label{pf.lem.extcomb.binom-ineq.chain}%
\end{equation}
(In terms of Pascal's triangle, this is simply saying that the binomial
coefficients in the $n$-th row of Pascal's triangle strictly increase until
the middle of the row. For example, for $n=4$, this is saying that $1<4<6$.)
Clearly, if we can prove (\ref{pf.lem.extcomb.binom-ineq.chain}), then
$\dbinom{n}{k}\leq\dbinom{n}{\left\lfloor n/2\right\rfloor }$ will follow,
since $\dbinom{n}{k}$ is one of the binomial coefficients in the chain
(\ref{pf.lem.extcomb.binom-ineq.chain}) (because $k\in\left\{  0,1,\ldots
,\left\lfloor n/2\right\rfloor \right\}  $). Thus, we only need to prove
(\ref{pf.lem.extcomb.binom-ineq.chain}).

In order to prove (\ref{pf.lem.extcomb.binom-ineq.chain}), we need to show
that $\dbinom{n}{i}<\dbinom{n}{i+1}$ for each $i\in\left\{  0,1,\ldots
,\left\lfloor n/2\right\rfloor -1\right\}  $. Let us do this: Let
$i\in\left\{  0,1,\ldots,\left\lfloor n/2\right\rfloor -1\right\}  $. Thus,
$i\geq0$ and $i\leq\underbrace{\left\lfloor n/2\right\rfloor }_{\leq
n/2}-1\leq n/2-1$. Hence, $i+1\leq n/2$, so that $2\left(  i+1\right)  \leq n$
and thus $i+1\leq n-\underbrace{\left(  i+1\right)  }_{>i}<n-i$, so that
$n-i>i+1$. Also, $i\in\left\{  0,1,\ldots,n\right\}  $ (since $i\geq0$ and
$i\leq n/2-1<n/2\leq n$); hence, Theorem \ref{thm.binom.fac} (applied to
$k=i$) yields $\dbinom{n}{i}=\dfrac{n!}{i!\left(  n-i\right)  !}>0$ (since
factorials are positive).

It is not hard to prove that%
\begin{equation}
\left(  i+1\right)  \dbinom{n}{i+1}=\left(  n-i\right)  \dbinom{n}{i}.
\label{pf.lem.extcomb.binom-ineq.ident}%
\end{equation}
(In fact, this is Lemma \ref{lem.binom.neighbors} \textbf{(b)}, applied to
$k=i$.) Thus,%
\[
\left(  i+1\right)  \dbinom{n}{i+1}=\underbrace{\left(  n-i\right)  }%
_{>i+1}\dbinom{n}{i}>\left(  i+1\right)  \dbinom{n}{i}%
\]
(here, we have used $\dbinom{n}{i}>0$). We can divide this inequality by $i+1$
(since $\underbrace{i}_{\geq0}+\underbrace{1}_{>0}>0$), and thus obtain
$\dbinom{n}{i+1}>\dbinom{n}{i}$. In other words, $\dbinom{n}{i}<\dbinom
{n}{i+1}$. Thus, we have shown that $\dbinom{n}{i}<\dbinom{n}{i+1}$ for each
$i\in\left\{  0,1,\ldots,\left\lfloor n/2\right\rfloor -1\right\}
$.\ \ \ \ \footnote{Another proof of this can be found in \cite[Theorem
1.3.4]{Guicha20}.} As we explained above, this proves the chain
(\ref{pf.lem.extcomb.binom-ineq.chain}) and thus completes the proof of Lemma
\ref{lem.extcomb.binom-ineq}.
\end{proof}

\begin{proof}
[Proof of Theorem \ref{thm.extcomb.sperner} (sketched).](We are following
\cite[second proof of Theorem 53.2]{Galvin17} here.)

For each $k\in\left\{  0,1,\ldots,n\right\}  $, the collection
\[
\left\{  \text{all }k\text{-element subsets of }S\right\}
\]
is a set antichain of $S$ (because a $k$-element subset of $S$ cannot be a
subset of a different $k$-element subset of $S$). This collection has size
$\dbinom{n}{k}$ (by Theorem \ref{thm.binom.comb}). Thus, for each
$k\in\left\{  0,1,\ldots,n\right\}  $, we have found a set antichain of $S$
that has size $\dbinom{n}{k}$. In particular, taking $k=\left\lfloor
n/2\right\rfloor $, we thus have found a set antichain of $S$ that has size
$\dbinom{n}{\left\lfloor n/2\right\rfloor }$.

It thus remains to show that any set antichain of $S$ has size $\leq\dbinom
{n}{\left\lfloor n/2\right\rfloor }$.

Indeed, let $\mathbf{A}$ be a set antichain of $S$. We must thus show that
$\left\vert \mathbf{A}\right\vert \leq\dbinom{n}{\left\lfloor n/2\right\rfloor
}$.

We WLOG assume that $S=\left[  n\right]  $ (as we can always relabel the $n$
elements of $S$ by $1,2,\ldots,n$). Recall the set $S_{n}$ from Definition
\ref{def.enum.perms.Sn}. (Permutations appear nowhere in Theorem
\ref{thm.extcomb.sperner}, but as we will soon see, they are the key to its
proof.) For each permutation $\sigma\in S_{n}$, we let $\mathbf{C}_{\sigma}$
be the collection%
\begin{align*}
&  \left\{  \left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\ldots,\sigma\left(  i\right)  \right\}  \ \mid\ i\in\left\{  0,1,\ldots
,n\right\}  \right\} \\
&  =\{\ \left\{  {}\right\}  ,\\
&  \ \ \ \ \ \ \ \left\{  \sigma\left(  1\right)  \right\}  ,\\
&  \ \ \ \ \ \ \ \left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
\right\}  ,\\
&  \ \ \ \ \ \ \ \left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\sigma\left(  3\right)  \right\}  ,\\
&  \ \ \ \ \ \ \ \ldots,\\
&  \ \ \ \ \ \ \ \left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\ldots,\sigma\left(  n\right)  \right\}  \ \}.
\end{align*}
This collection $\mathbf{C}_{\sigma}$ is a set chain of $\left[  n\right]
=S$, and has size $\left\vert \mathbf{C}_{\sigma}\right\vert =n+1$.

We now set \footnote{We use the Iverson bracket notation (Definition
\ref{def.iverson}).}%
\[
s:=\sum_{I\in\mathbf{A}}\ \ \sum_{\sigma\in S_{n}}\left[  I\in\mathbf{C}%
_{\sigma}\right]  .
\]
We shall find an upper bound and a lower bound for $s$, and use them to obtain
an inequality. (This is a variant of the double counting technique.)

To obtain an upper bound, we observe the following:

\begin{statement}
\textit{Claim 1:} For any $\sigma\in S_{n}$, we have $\sum_{I\in\mathbf{A}%
}\left[  I\in\mathbf{C}_{\sigma}\right]  \leq1$.
\end{statement}

[\textit{Proof of Claim 1:} Let $\sigma\in S_{n}$. Recall that $\mathbf{C}%
_{\sigma}$ is a set chain; thus, any two distinct sets $A,B\in\mathbf{C}%
_{\sigma}$ satisfy%
\begin{equation}
A\subseteq B\text{ or }B\subseteq A \label{pf.thm.extcomb.sperner.c1.pf.1}%
\end{equation}
(by the definition of \textquotedblleft set chain\textquotedblright). On the
other hand, $\mathbf{A}$ is a set antichain; thus, no two distinct sets
$A,B\in\mathbf{A}$ satisfy $A\subseteq B$. In other words, any two distinct
sets $A,B\in\mathbf{A}$ satisfy%
\begin{equation}
A\not \subseteq B. \label{pf.thm.extcomb.sperner.c1.pf.2}%
\end{equation}


Now, each addend of the sum $\sum_{I\in\mathbf{A}}\left[  I\in\mathbf{C}%
_{\sigma}\right]  $ is a truth value and thus equals either $0$ or $1$;
moreover, the \# of addends that equal $1$ is precisely the \# of all
$I\in\mathbf{A}$ satisfying $I\in\mathbf{C}_{\sigma}$. Hence,
\begin{align}
\sum_{I\in\mathbf{A}}\left[  I\in\mathbf{C}_{\sigma}\right]   &  =\left(
\text{\# of all }I\in\mathbf{A}\text{ satisfying }I\in\mathbf{C}_{\sigma
}\right)  \cdot1+\left(  \text{some number of }0\text{'s}\right) \nonumber\\
&  =\left(  \text{\# of all }I\in\mathbf{A}\text{ satisfying }I\in
\mathbf{C}_{\sigma}\right)  \cdot1\nonumber\\
&  =\left(  \text{\# of all }I\in\mathbf{A}\text{ satisfying }I\in
\mathbf{C}_{\sigma}\right)  . \label{pf.thm.extcomb.sperner.c1.pf.3}%
\end{align}


In order to prove Claim 1, we need to show that $\sum_{I\in\mathbf{A}}\left[
I\in\mathbf{C}_{\sigma}\right]  \leq1$. In view of
(\ref{pf.thm.extcomb.sperner.c1.pf.3}), this boils down to showing that
\begin{equation}
\left(  \text{\# of all }I\in\mathbf{A}\text{ satisfying }I\in\mathbf{C}%
_{\sigma}\right)  \leq1. \label{pf.thm.extcomb.sperner.c1.pf.4}%
\end{equation}
In other words, we need to show that there is \textbf{at most one} set
$I\in\mathbf{A}$ satisfying $I\in\mathbf{C}_{\sigma}$.

Assume the contrary. Thus, there exist two such sets $I$. In other words,
there exist two \textbf{distinct} sets $A,B\in\mathbf{A}$ satisfying
$A,B\in\mathbf{C}_{\sigma}$. Consider these $A,B$. From
(\ref{pf.thm.extcomb.sperner.c1.pf.1}), we obtain $A\subseteq B$ or
$B\subseteq A$. However, from (\ref{pf.thm.extcomb.sperner.c1.pf.2}), we
obtain $A\not \subseteq B$. Hence, $B\subseteq A$ (since $A\subseteq B$ or
$B\subseteq A$). However, we can also apply
(\ref{pf.thm.extcomb.sperner.c1.pf.2}) to $B$ and $A$ instead of $A$ and $B$.
Thus, we obtain $B\not \subseteq A$. This contradicts $B\subseteq A$. This
contradiction shows that our assumption was wrong, so we are done proving that
there is \textbf{at most one} set $I\in\mathbf{A}$ satisfying $I\in
\mathbf{C}_{\sigma}$. Hence, we have proved
(\ref{pf.thm.extcomb.sperner.c1.pf.4}). As explained above, this yields Claim 1.]

Now,%
\begin{align}
s  &  =\underbrace{\sum_{I\in\mathbf{A}}\ \ \sum_{\sigma\in S_{n}}}%
_{=\sum_{\sigma\in S_{n}}\ \ \sum_{I\in\mathbf{A}}}\left[  I\in\mathbf{C}%
_{\sigma}\right]  =\sum_{\sigma\in S_{n}}\ \ \underbrace{\sum_{I\in\mathbf{A}%
}\left[  I\in\mathbf{C}_{\sigma}\right]  }_{\substack{\leq1\\\text{(by Claim
1)}}}\nonumber\\
&  \leq\sum_{\sigma\in S_{n}}1=\left\vert S_{n}\right\vert \cdot1=\left\vert
S_{n}\right\vert =\left(  \text{\# of permutations of }\left[  n\right]
\right) \nonumber\\
&  =n! \label{pf.thm.extcomb.sperner.ub}%
\end{align}
(by Theorem \ref{thm.enum.perms}, applied to $X=\left[  n\right]  $). Thus we
have obtained an upper bound for $s$.

In order to find a lower bound, we will need the following:

\begin{statement}
\textit{Claim 2:} For any $I\in\mathbf{A}$, we have $\sum_{\sigma\in S_{n}%
}\left[  I\in\mathbf{C}_{\sigma}\right]  \geq\dfrac{n!}{\dbinom{n}%
{\left\lfloor n/2\right\rfloor }}$.
\end{statement}

[\textit{Proof of Claim 2:} Let $I\in\mathbf{A}$. Let $k=\left\vert
I\right\vert $; thus, $k=\left\vert I\right\vert \in\left\{  0,1,\ldots
,n\right\}  $ (since $I$ is a subset of the $n$-element set $S$).

Now, each addend of the sum $\sum_{\sigma\in S_{n}}\left[  I\in\mathbf{C}%
_{\sigma}\right]  $ is a truth value and thus equals either $0$ or $1$;
moreover, the \# of addends that equal $1$ is precisely the \# of all
$\sigma\in S_{n}$ satisfying $I\in\mathbf{C}_{\sigma}$. Hence,
\begin{align}
\sum_{\sigma\in S_{n}}\left[  I\in\mathbf{C}_{\sigma}\right]   &  =\left(
\text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in\mathbf{C}_{\sigma
}\right)  \cdot1+\left(  \text{some number of }0\text{'s}\right) \nonumber\\
&  =\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in
\mathbf{C}_{\sigma}\right)  \cdot1\nonumber\\
&  =\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in
\mathbf{C}_{\sigma}\right)  . \label{pf.thm.extcomb.sperner.c2.pf.1}%
\end{align}


Now, how many permutations $\sigma\in S_{n}$ satisfy $I\in\mathbf{C}_{\sigma}$ ?

Let $\sigma\in S_{n}$ be a permutation. We know that $I$ is a $k$-element set
(since $k=\left\vert I\right\vert $); but the only $k$-element set in the set
chain $\mathbf{C}_{\sigma}$ is $\left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  k\right)  \right\}  $ (by the
definition of $\mathbf{C}_{\sigma}$). Hence, we have $I\in\mathbf{C}_{\sigma}$
if and only if $I=\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\ldots,\sigma\left(  k\right)  \right\}  $.

\begin{noncompile}
In order for $I=\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\ldots,\sigma\left(  k\right)  \right\}  $ to hold, the first $k$ values
$\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  $ of the permutation $\sigma$ need to be precisely the $k$ elements
of $I$. This is a necessary and sufficient condition.
\end{noncompile}

Forget that we fixed $\sigma$. We thus have shown that a permutation
$\sigma\in S_{n}$ satisfies $I\in\mathbf{C}_{\sigma}$ if and only if
$I=\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  k\right)  \right\}  $. Hence,%
\begin{align}
&  \left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in
\mathbf{C}_{\sigma}\right) \nonumber\\
&  =\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  \right)  . \label{pf.thm.extcomb.sperner.c2.pf.2}%
\end{align}
But a permutation $\sigma\in S_{n}$ satisfying $I=\left\{  \sigma\left(
1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(  k\right)  \right\}  $
can be constructed using the following decision procedure:

\begin{itemize}
\item First, we choose the value $\sigma\left(  1\right)  $ (provided that
$1\leq k$). There are $k$ options for it, since $\sigma\left(  1\right)  $
needs to belong to the $k$-element set $I$ (because we want $I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  $).

\item Next, we choose the value $\sigma\left(  2\right)  $ (provided that
$2\leq k$). There are $k-1$ options for it, since $\sigma\left(  2\right)  $
needs to belong to the $k$-element set $I$ (because we want $I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  $) and be distinct from $\sigma\left(  1\right)  $.

\item Next, we choose the value $\sigma\left(  3\right)  $ (provided that
$3\leq k$). There are $k-2$ options for it, since $\sigma\left(  3\right)  $
needs to belong to the $k$-element set $I$ (because we want $I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  $) and be distinct from $\sigma\left(  1\right)  $ and
$\sigma\left(  2\right)  $.

\item And so on, until the first $k$ values $\sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  k\right)  $ of $\sigma$ have
been chosen. At this point, we have assigned $k$ distinct elements of the set
$I$ as values $\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  k\right)  $. Thus, by the pigeonhole principle for injections,
each of the $k$ elements of $I$ has been assigned as one of the $k$ values
$\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  $ (since $I$ is a $k$-element set). We have therefore ensured that
$I=\left\{  \sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  k\right)  \right\}  $. We still need to choose the remaining
values $\sigma\left(  k+1\right)  ,\sigma\left(  k+2\right)  ,\ldots
,\sigma\left(  n\right)  $ of $\sigma$, though.

\item Next, we choose the value $\sigma\left(  k+1\right)  $. There are $n-k$
options for it, since $\sigma\left(  k+1\right)  $ needs to belong to the
$n$-element set $\left[  n\right]  $ and be distinct from the $k$ numbers
$\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  $.

\item Next, we choose the value $\sigma\left(  k+2\right)  $. There are
$n-k-1$ options for it, since $\sigma\left(  k+2\right)  $ needs to belong to
the $n$-element set $\left[  n\right]  $ and be distinct from the $k+1$
numbers $\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots
,\sigma\left(  k+1\right)  $.

\item And so on, until all $n$ values $\sigma\left(  1\right)  ,\sigma\left(
2\right)  ,\ldots,\sigma\left(  n\right)  $ have been chosen.
\end{itemize}

\noindent According to the dependent product rule, the total \# of
possibilities for making these choices is%
\[
\underbrace{k\left(  k-1\right)  \left(  k-2\right)  \cdots1}%
_{\substack{=1\cdot2\cdot\cdots\cdot k\\=k!}}\cdot\underbrace{\left(
n-k\right)  \left(  n-k-1\right)  \cdots1}_{\substack{=1\cdot2\cdot\cdots
\cdot\left(  n-k\right)  \\=\left(  n-k\right)  !}}=k!\cdot\left(  n-k\right)
!=\dfrac{n!}{\dbinom{n}{k}}%
\]
(since Theorem \ref{thm.binom.fac} yields $\dbinom{n}{k}=\dfrac{n!}%
{k!\cdot\left(  n-k\right)  !}$). Hence,%
\begin{align}
&  \left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  \right) \nonumber\\
&  =\dfrac{n!}{\dbinom{n}{k}}. \label{pf.thm.extcomb.sperner.c2.pf.3}%
\end{align}


Now, (\ref{pf.thm.extcomb.sperner.c2.pf.1}) becomes%
\begin{align*}
\sum_{\sigma\in S_{n}}\left[  I\in\mathbf{C}_{\sigma}\right]   &  =\left(
\text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in\mathbf{C}_{\sigma
}\right) \\
&  =\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I=\left\{
\sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\ldots,\sigma\left(
k\right)  \right\}  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.thm.extcomb.sperner.c2.pf.2}%
)}\right) \\
&  =\dfrac{n!}{\dbinom{n}{k}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.extcomb.sperner.c2.pf.3})}\right) \\
&  \geq\dfrac{n!}{\dbinom{n}{\left\lfloor n/2\right\rfloor }}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since Lemma \ref{lem.extcomb.binom-ineq}
yields }\dbinom{n}{k}\leq\dbinom{n}{\left\lfloor n/2\right\rfloor }\right)  .
\end{align*}
This proves Claim 2.]

Now,%
\begin{equation}
s=\sum_{I\in\mathbf{A}}\ \ \underbrace{\sum_{\sigma\in S_{n}}\left[
I\in\mathbf{C}_{\sigma}\right]  }_{\substack{\geq\dfrac{n!}{\dbinom
{n}{\left\lfloor n/2\right\rfloor }}\\\text{(by Claim 2)}}}\geq\sum
_{I\in\mathbf{A}}\dfrac{n!}{\dbinom{n}{\left\lfloor n/2\right\rfloor }%
}=\left\vert \mathbf{A}\right\vert \cdot\dfrac{n!}{\dbinom{n}{\left\lfloor
n/2\right\rfloor }}. \label{pf.thm.extcomb.sperner.lb}%
\end{equation}
Thus we have obtained a lower bound for $s$. From
(\ref{pf.thm.extcomb.sperner.lb}), we obtain%
\[
\left\vert \mathbf{A}\right\vert \cdot\dfrac{n!}{\dbinom{n}{\left\lfloor
n/2\right\rfloor }}\leq s\leq n!\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.extcomb.sperner.ub})}\right)  .
\]
Dividing this inequality by $n!$ and multiplying it by $\dbinom{n}%
{\left\lfloor n/2\right\rfloor }$, we obtain $\left\vert \mathbf{A}\right\vert
\leq\dbinom{n}{\left\lfloor n/2\right\rfloor }$ (since $n!$ and $\dbinom
{n}{\left\lfloor n/2\right\rfloor }$ are nonnegative). This is precisely what
we needed to show. Thus, Theorem \ref{thm.extcomb.sperner} is proven.
\end{proof}

\begin{remark}
Theorem \ref{thm.extcomb.sperner} (applied to $n=5$ and $S=\left[  5\right]
$) yields that the maximum possible size of a set antichain of $\left[
5\right]  $ is $\dbinom{5}{\left\lfloor 5/2\right\rfloor }=\dbinom{5}{2}=10$.
As we have seen in the proof, an example of a set antichain of $\left[
5\right]  $ having this maximum size is%
\begin{align*}
&  \left\{  \text{all }2\text{-element subsets of }\left[  5\right]  \right\}
\\
&  =\{\left\{  1,2\right\}  ,\ \ \left\{  1,3\right\}  ,\ \ \left\{
1,4\right\}  ,\ \ \left\{  1,5\right\}  ,\ \ \left\{  2,3\right\}
,\ \ \left\{  2,4\right\}  ,\\
&  \ \ \ \ \ \ \ \ \ \ \left\{  2,5\right\}  ,\ \ \left\{  3,4\right\}
,\ \ \left\{  3,5\right\}  ,\ \ \left\{  4,5\right\}  \}.
\end{align*}
Another example of such an antichain is $\left\{  \text{all }3\text{-element
subsets of }\left[  5\right]  \right\}  $. It can be shown that these two
examples are the only set antichains of $\left[  5\right]  $ having maximum
size. More generally: If $n\in\mathbb{N}$, and if $S$ is an $n$-element set,
then the only set antichains of $S$ having maximum size (that is, size
$\dbinom{n}{\left\lfloor n/2\right\rfloor }$) are%
\begin{align*}
&  \left\{  \text{all }\left\lfloor n/2\right\rfloor \text{-element subsets of
}S\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}\\
&  \left\{  \text{all }\left(  n-\left\lfloor n/2\right\rfloor \right)
\text{-element subsets of }S\right\}  .
\end{align*}
(When $n$ is even, these two antichains are identical.) See \cite[Theorem
1.1.1 (b)]{Engel97} for a proof of this.
\end{remark}

\subsubsection{Intersecting collections}

Next, let us answer the question \textquotedblleft Given $n\in\mathbb{N}$, how
many distinct subsets of $\left[  n\right]  $ can you pick so that every two
subsets you have picked have a nonempty intersection?\textquotedblright. Such
a pick will be called an \textit{intersecting collection}:

\begin{definition}
Let $S$ be a set. An \textit{intersecting collection} of $S$ means a
collection $\mathbf{J}$ of subsets of $S$ such that any $A,B\in\mathbf{J}$
satisfy $A\cap B\neq\varnothing$.
\end{definition}

\begin{example}
\textbf{(a)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,3\right\}  ,\left\{  2,3\right\}  \right\}  $ is an intersecting collection
of $\left[  4\right]  $.

\textbf{(b)} The collection $\left\{  \left\{  1,2\right\}  ,\left\{
1,3\right\}  ,\left\{  2\right\}  \right\}  $ is not an intersecting
collection of $\left[  4\right]  $, since $\left\{  1,3\right\}  \cap\left\{
2\right\}  =\varnothing$.
\end{example}

Now we can answer our question (\cite[Theorem 44.2]{Galvin17}):

\begin{theorem}
\label{thm.extcomb.intersect}Let $n$ be a positive integer. Let $S$ be an
$n$-element set. Then, the maximum possible size of an intersecting collection
of $S$ is $2^{n-1}$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.extcomb.intersect} (sketched).]The set $S$ is
nonempty (since it is an $n$-element set, but $n$ is positive). Thus, there
exists some $t\in S$. Pick such a $t$.

The collection%
\[
\left\{  \text{all subsets of }S\text{ that contain }t\right\}
\]
is an intersecting collection of $S$ (indeed, any two sets $A,B$ in this
collection have at least the element $t$ in common and therefore satisfy
$A\cap B\neq\varnothing$). This collection has size $2^{n-1}$ (check this!).
Thus, we have found an intersecting collection of $S$ that has size $2^{n-1}$.

It now remains to show that any intersecting collection of $S$ has size
$\leq2^{n-1}$.

So let $\mathbf{J}$ be an intersecting collection of $S$. We must show that
$\left\vert \mathbf{J}\right\vert \leq2^{n-1}$.

If $T$ is any subset of $S$, then the complement $S\setminus T$ of $T$ will be
denoted by $\overline{T}$. This complement $\overline{T}$ is disjoint from $T$
(this is a general property of complements) and also distinct from $T$ (since
$S$ is nonempty).

If $T$ is any subset of $S$, then we shall refer to the collection $\left\{
T,\overline{T}\right\}  $ (which consists of just two sets: $T$ and its
complement $\overline{T}$) as the \textit{pigeonhole} of $T$. Note that a
subset $T$ of $S$ and its complement $\overline{T}$ have the same pigeonhole,
since%
\[
\left(  \text{the pigeonhole of }\overline{T}\right)  =\left\{  \overline
{T},\underbrace{\overline{\overline{T}}}_{=T}\right\}  =\left\{  \overline
{T},T\right\}  =\left\{  T,\overline{T}\right\}  =\left(  \text{the pigeonhole
of }T\right)  .
\]
There are $2^{n}$ subsets of $S$ in total, and each of them lies in a unique
pigeonhole (namely, each subset $T$ lies in the pigeonhole of $T$). Since each
pigeonhole contains precisely two subsets of $S$ (this is where we are using
our observation that the complement $\overline{T}$ of a set $T$ is distinct
from $T$), we thus conclude that there are precisely $2^{n-1}$ pigeonholes.

Now, the crucial observation is the following: The two sets in any given
pigeonhole are disjoint (because they are complements of one another). Hence,
$\mathbf{J}$ cannot contain more than one set from any given pigeonhole (since
$\mathbf{J}$ is an intersecting collection, so that no two sets in
$\mathbf{J}$ are disjoint). Thus, by the pigeonhole principle for injections,
the size of $\mathbf{J}$ is $\leq$ to the \# of pigeonholes. In other words,
$\left\vert \mathbf{J}\right\vert \leq2^{n-1}$ (since there are precisely
$2^{n-1}$ pigeonholes). This is precisely what we needed to show. Thus,
Theorem \ref{thm.extcomb.intersect} is proved.
\end{proof}

\begin{remark}
The maximum size ($2^{n-1}$) in Theorem \ref{thm.extcomb.intersect} is
achieved not just for collections of the form $\left\{  \text{all subsets of
}S\text{ that contain }t\right\}  $ for some $t\in S$. For example, if $n=3$
and $S=\left[  3\right]  $, then the collection%
\[
\left\{  \left\{  1,2\right\}  ,\ \ \left\{  1,3\right\}  ,\ \ \left\{
2,3\right\}  ,\ \ \left\{  1,2,3\right\}  \right\}
\]
also is an intersecting collection of $S$ having maximum size (that is, in
this case, $2^{n-1}=2^{3-1}=4$). This illustrates that the sets in an
intersecting collection need not all have an element in common.
\end{remark}

The last extremal combinatorics question we shall answer is \textquotedblleft
Given $n,k\in\mathbb{N}$, how many distinct $k$-element subsets of $\left[
n\right]  $ can you pick so that every two subsets you have picked have a
nonempty intersection?\textquotedblright. In our language, this is asking for
the maximum size of an intersecting collection that consists entirely of
$k$-element sets. We are lazy and give these collections a new name:

\begin{definition}
Let $S$ be a set. Let $k\in\mathbb{N}$. An \textit{intersecting }%
$k$\textit{-collection} of $S$ means a collection $\mathbf{J}$ of $k$-element
subsets of $S$ such that any $A,B\in\mathbf{J}$ satisfy $A\cap B\neq
\varnothing$.
\end{definition}

\begin{example}
The collection $\left\{  \left\{  1,2\right\}  ,\left\{  1,3\right\}
,\left\{  2,3\right\}  \right\}  $ is an intersecting $2$-collection of
$\left[  4\right]  $.
\end{example}

\begin{theorem}
[Erd\"{o}s--Ko--Rado theorem]\label{thm.extcomb.ekr}Let $n$ and $k$ be
positive integers. Let $S$ be an $n$-element set. Then:

\textbf{(a)} If $n\geq2k$, then the maximum possible size of an intersecting
$k$-collection of $S$ is $\dbinom{n-1}{k-1}$.

\textbf{(b)} If $n<2k$, then the maximum possible size of an intersecting
$k$-collection of $S$ is $\dbinom{n}{k}$.
\end{theorem}

It may appear strange that the answers in the cases $n\geq2k$ and $n<2k$ are
so different, but the proof will reveal the reason for this.

\begin{proof}
[Proof of Theorem \ref{thm.extcomb.ekr} (sketched).]We start with part
\textbf{(b)}, which is more of a joke than a theorem.

\textbf{(b)} Assume that $n<2k$. Then, \textbf{any} two $k$-element subsets
$A,B$ of $S$ satisfy $A\cap B\neq\varnothing$ (because otherwise, $A$ and $B$
would be disjoint, and thus the sum rule would yield $\left\vert A\cup
B\right\vert =\underbrace{\left\vert A\right\vert }_{=k}%
+\underbrace{\left\vert B\right\vert }_{=k}=k+k=2k$, which would contradict
\begin{align*}
\left\vert A\cup B\right\vert  &  \leq\left\vert S\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }A\cup B\subseteq S\right) \\
&  =n<2k
\end{align*}
). Therefore, the collection $\left\{  \text{all }k\text{-element subsets of
}S\right\}  $ is an intersecting $k$-collection of $S$. The size of this
collection is $\dbinom{n}{k}$, and clearly there is no intersecting
$k$-collection of $S$ having higher size (since there are only $\dbinom{n}{k}$
many $k$-element subsets of $S$). Thus, the maximum possible size of an
intersecting $k$-collection of $S$ is $\dbinom{n}{k}$. This proves Theorem
\ref{thm.extcomb.ekr} \textbf{(b)}.

\textbf{(a)} Assume that $n\geq2k$. Thus, $n\geq2k>k$ (since $k$ is positive),
so that $k<n$.

The set $S$ is nonempty (since it is an $n$-element set, but $n$ is positive).
Thus, there exists some $t\in S$. Pick such a $t$.

The collection%
\[
\left\{  \text{all }k\text{-element subsets of }S\text{ that contain
}t\right\}
\]
is an intersecting $k$-collection of $S$ (check this!), and has size
$\dbinom{n-1}{k-1}$ (check this!). Thus, we have found an intersecting
$k$-collection of $S$ that has size $\dbinom{n-1}{k-1}$.

It now remains to show that any intersecting $k$-collection of $S$ has size
$\leq\dbinom{n-1}{k-1}$.

So let $\mathbf{J}$ be an intersecting $k$-collection of $S$. We must show
that $\left\vert \mathbf{J}\right\vert \leq\dbinom{n-1}{k-1}$.

The following elegant argument (which I have taken from \cite[first proof of
Theorem 49.1]{Galvin17} with only expositional changes) is known as
\textquotedblleft Katona's cycle proof\textquotedblright, and has seen uses in
various settings (see \cite{BorMea16} and \cite{Frankl20} for two surveys).
Again (as already in the proof of Sperner's theorem above) we involve
permutations for no obvious reason.

We WLOG assume that $S=\left[  n\right]  $ (since we can otherwise just
relabel the elements of $S$). Recall that $S_{n}$ denotes the set of all
permutations of $\left[  n\right]  $. We recall that $\left\vert
S_{n}\right\vert =n!$ (which we have seen, e.g., in the proof of Theorem
\ref{thm.extcomb.sperner}).

We extend any permutation $\sigma\in S_{n}$ of $\left[  n\right]  $ to an
$n$-periodic map $\sigma:\left\{  1,2,3,\ldots\right\}  \rightarrow\left[
n\right]  $. That is, if $\sigma\in S_{n}$ is a permutation, then we
recursively define the extra values $\sigma\left(  n+1\right)  ,\sigma\left(
n+2\right)  ,\sigma\left(  n+3\right)  ,\ldots$ by setting%
\begin{align*}
\sigma\left(  n+1\right)   &  :=\sigma\left(  1\right)  ,\\
\sigma\left(  n+2\right)   &  :=\sigma\left(  2\right)  ,\\
\sigma\left(  n+3\right)   &  :=\sigma\left(  3\right)  ,\\
&  \ldots.
\end{align*}
(Thus, explicitly, if $i$ is a positive integer, then $\sigma\left(  i\right)
=\sigma\left(  j\right)  $, where $j$ is the unique element of $\left[
n\right]  $ satisfying $i\equiv j\operatorname{mod}n$.) Thus, for each
permutation $\sigma\in S_{n}$, the sequence $\left(  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\sigma\left(  3\right)  ,\ldots\right)  $ begins
with the $n$ \textquotedblleft original\textquotedblright\ values of $\sigma$
and then continues by repeating these $n$ values over and over. Hence, this
sequence $\left(  \sigma\left(  1\right)  ,\sigma\left(  2\right)
,\sigma\left(  3\right)  ,\ldots\right)  $ is $n$-periodic. Let us also notice
that if $\sigma\in S_{n}$ is a permutation, and if $p\in\left\{
0,1,\ldots,n\right\}  $, then any $p$ consecutive elements of this sequence
$\left(  \sigma\left(  1\right)  ,\sigma\left(  2\right)  ,\sigma\left(
3\right)  ,\ldots\right)  $ (that is, any $p$ elements of the form
$\sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)  ,\ldots,\sigma\left(
i+p\right)  $, where $i\in\mathbb{N}$) are distinct.

Fix a permutation $\sigma\in S_{n}$. For each $i\in\mathbb{N}$, we define a
subset%
\[
W_{i}\left(  \sigma\right)  =\left\{  \sigma\left(  i+1\right)  ,\sigma\left(
i+2\right)  ,\ldots,\sigma\left(  i+k\right)  \right\}
\]
of $\left[  n\right]  $. Thus,%
\begin{align*}
W_{0}\left(  \sigma\right)   &  =\left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  k\right)  \right\}  ,\\
W_{1}\left(  \sigma\right)   &  =\left\{  \sigma\left(  2\right)
,\sigma\left(  3\right)  ,\ldots,\sigma\left(  k+1\right)  \right\}  ,\\
W_{2}\left(  \sigma\right)   &  =\left\{  \sigma\left(  3\right)
,\sigma\left(  4\right)  ,\ldots,\sigma\left(  k+2\right)  \right\}  ,\\
&  \ldots.
\end{align*}
These sets $W_{0}\left(  \sigma\right)  ,W_{1}\left(  \sigma\right)
,W_{2}\left(  \sigma\right)  ,\ldots$ (that is, the sets $W_{i}\left(
\sigma\right)  $ for all $i\in\mathbb{N}$) will be called the \textit{windows}
of $\sigma$.\ \ \ \ \footnote{The following way of visualizing the windows of
$\sigma$ might be useful: Imagine the values $\sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  n\right)  $ written on the
circumference on a circle (in clockwise order); then, a window of $\sigma$ is
just a set of $k$ values appearing consecutively on the circle. For example,
if $n=8$ and $k=3$, and if $\sigma\in S_{8}$ is the permutation that sends
$1,2,3,4,5,6,7,8$ to $3,1,7,4,5,6,8,2$, respectively, then the windows of
$\sigma$ are%
\begin{align*}
W_{0}\left(  \sigma\right)   &  =\left\{  3,1,7\right\}  ,\\
W_{1}\left(  \sigma\right)   &  =\left\{  1,7,4\right\}  ,\\
W_{2}\left(  \sigma\right)   &  =\left\{  7,4,5\right\}  ,\\
W_{3}\left(  \sigma\right)   &  =\left\{  4,5,6\right\}  ,\\
W_{4}\left(  \sigma\right)   &  =\left\{  5,6,8\right\}  ,\\
W_{5}\left(  \sigma\right)   &  =\left\{  6,8,2\right\}  ,\\
W_{6}\left(  \sigma\right)   &  =\left\{  8,2,3\right\}  ,\\
W_{7}\left(  \sigma\right)   &  =\left\{  2,3,1\right\}  .
\end{align*}
Two of these windows (namely, $W_{2}\left(  \sigma\right)  $ in green, and
$W_{7}\left(  \sigma\right)  $ in yellow) are shown on the following picture:%
\[%
%TCIMACRO{\TeXButton{tikz telephone}{\begin{tikzpicture}[scale=2.5]
%\filldraw
%[draw=yellow, fill=yellow!80] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\filldraw
%[draw=green, fill=green!50, cm={cos(3*360/8), -sin(3*360/8), sin(3*360/8), cos(3*360/8), (0, 0)}%
%] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
%\draw(0,0) circle [radius=1];
%\node(a) at ({cos(0)}, {sin(0)}) [circle, fill=white] {$3$};
%\node(b) at ({cos(360/8)}, {sin(360/8)}) [circle, fill=white] {$2$};
%\node(b) at ({cos(2*360/8)}, {sin(2*360/8)}) [circle, fill=white] {$8$};
%\node(b) at ({cos(3*360/8)}, {sin(3*360/8)}) [circle, fill=white] {$6$};
%\node(b) at ({cos(4*360/8)}, {sin(4*360/8)}) [circle, fill=white] {$5$};
%\node(b) at ({cos(5*360/8)}, {sin(5*360/8)}) [circle, fill=white] {$4$};
%\node(b) at ({cos(6*360/8)}, {sin(6*360/8)}) [circle, fill=white] {$7$};
%\node(b) at ({cos(7*360/8)}, {sin(7*360/8)}) [circle, fill=white] {$1$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\filldraw
[draw=yellow, fill=yellow!80] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\filldraw
[draw=green, fill=green!50, cm={cos(3*360/8), -sin(3*360/8), sin(3*360/8), cos(3*360/8), (0, 0)}%
] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
\draw(0,0) circle [radius=1];
\node(a) at ({cos(0)}, {sin(0)}) [circle, fill=white] {$3$};
\node(b) at ({cos(360/8)}, {sin(360/8)}) [circle, fill=white] {$2$};
\node(b) at ({cos(2*360/8)}, {sin(2*360/8)}) [circle, fill=white] {$8$};
\node(b) at ({cos(3*360/8)}, {sin(3*360/8)}) [circle, fill=white] {$6$};
\node(b) at ({cos(4*360/8)}, {sin(4*360/8)}) [circle, fill=white] {$5$};
\node(b) at ({cos(5*360/8)}, {sin(5*360/8)}) [circle, fill=white] {$4$};
\node(b) at ({cos(6*360/8)}, {sin(6*360/8)}) [circle, fill=white] {$7$};
\node(b) at ({cos(7*360/8)}, {sin(7*360/8)}) [circle, fill=white] {$1$};
\end{tikzpicture}%
%EndExpansion
\]
} It is easy to see that these windows $W_{i}\left(  \sigma\right)  $ are
$k$-element subsets of $\left[  n\right]  $ (indeed, for any $i\in\mathbb{N}$,
the $k$ elements \newline$\sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)
,\ldots,\sigma\left(  i+k\right)  $ of $W_{i}\left(  \sigma\right)  $ are
distinct, since $\sigma$ is a permutation). Moreover, the first $n$ windows%
\begin{align*}
W_{0}\left(  \sigma\right)   &  =\left\{  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\ldots,\sigma\left(  k\right)  \right\}  ,\\
W_{1}\left(  \sigma\right)   &  =\left\{  \sigma\left(  2\right)
,\sigma\left(  3\right)  ,\ldots,\sigma\left(  k+1\right)  \right\}  ,\\
&  \ldots,\\
W_{n-1}\left(  \sigma\right)   &  =\left\{  \sigma\left(  n\right)
,\sigma\left(  n+1\right)  ,\ldots,\sigma\left(  n+k-1\right)  \right\}
\end{align*}
of $\sigma$ are distinct\footnote{Check this! (Here, we need to recall that
$0<k<n$ and that $\sigma$ is injective.)}, whereas all other windows of
$\sigma$ are repetitions of these $n$ windows\footnote{That is,
\begin{align*}
W_{n}\left(  \sigma\right)   &  =W_{0}\left(  \sigma\right)  ,\\
W_{n+1}\left(  \sigma\right)   &  =W_{1}\left(  \sigma\right)  ,\\
W_{n+2}\left(  \sigma\right)   &  =W_{2}\left(  \sigma\right)  ,\\
&  \ldots.
\end{align*}
This follows from the fact that the sequence $\left(  \sigma\left(  1\right)
,\sigma\left(  2\right)  ,\sigma\left(  3\right)  ,\ldots\right)  $ is
$n$-periodic.}. Hence, there are $n$ windows of $\sigma$ in total. We let
$\mathbf{B}_{\sigma}$ denote the collection $\left\{  W_{0}\left(
\sigma\right)  ,W_{1}\left(  \sigma\right)  ,W_{2}\left(  \sigma\right)
,\ldots\right\}  $ of all windows of $\sigma$. Thus, $\left\vert
\mathbf{B}_{\sigma}\right\vert =n$ (since there are $n$ windows of $\sigma$ in total).

Forget that we fixed $\sigma$. Thus, for each permutation $\sigma\in S_{n}$,
we have defined a collection%
\begin{equation}
\mathbf{B}_{\sigma}=\left\{  W_{0}\left(  \sigma\right)  ,W_{1}\left(
\sigma\right)  ,W_{2}\left(  \sigma\right)  ,\ldots\right\}
\label{pf.thm.extcomb.ekr.b.Bsig=}%
\end{equation}
of \textquotedblleft windows of $\sigma$\textquotedblright.

We now set \footnote{We use the Iverson bracket notation (Definition
\ref{def.iverson}).}%
\[
s:=\sum_{I\in\mathbf{J}}\ \ \sum_{\sigma\in S_{n}}\left[  I\in\mathbf{B}%
_{\sigma}\right]  .
\]
We shall find an upper bound and a lower bound for $s$, and use them to obtain
an inequality. (If you are feeling a deja-vu here: yes, we are mimicking the
above proof of Theorem \ref{thm.extcomb.sperner}.)

To obtain an upper bound, we observe the following:

\begin{statement}
\textit{Claim 1:} For any $\sigma\in S_{n}$, we have $\sum_{I\in\mathbf{J}%
}\left[  I\in\mathbf{B}_{\sigma}\right]  \leq k$.
\end{statement}

[\textit{Proof of Claim 1:} Let $\sigma\in S_{n}$. Then,%
\begin{equation}
\sum_{I\in\mathbf{J}}\left[  I\in\mathbf{B}_{\sigma}\right]  =\left(  \text{\#
of all }I\in\mathbf{J}\text{ satisfying }I\in\mathbf{B}_{\sigma}\right)  .
\label{pf.thm.extcomb.ekr.c1.pf.3}%
\end{equation}
(Indeed, this can be proved in the same way as we proved
(\ref{pf.thm.extcomb.sperner.c1.pf.3}) above, except that we are now using the
collection $\mathbf{B}_{\sigma}$ instead of $\mathbf{C}_{\sigma}$.) Thus,%
\begin{align}
\sum_{I\in\mathbf{J}}\left[  I\in\mathbf{B}_{\sigma}\right]   &  =\left(
\text{\# of all }I\in\mathbf{J}\text{ satisfying }I\in\mathbf{B}_{\sigma
}\right) \nonumber\\
&  =\left\vert \mathbf{J}\cap\mathbf{B}_{\sigma}\right\vert .
\label{pf.thm.extcomb.ekr.c1.pf.3b}%
\end{align}


In order to prove Claim 1, we need to show that $\sum_{I\in\mathbf{J}}\left[
I\in\mathbf{B}_{\sigma}\right]  \leq k$. In view of
(\ref{pf.thm.extcomb.ekr.c1.pf.3b}), this boils down to showing that%
\begin{equation}
\left\vert \mathbf{J}\cap\mathbf{B}_{\sigma}\right\vert \leq k.
\label{pf.thm.extcomb.ekr.c1.pf.goal4}%
\end{equation}
If $\left\vert \mathbf{J}\cap\mathbf{B}_{\sigma}\right\vert =0$, then this is
obvious (since $0\leq k$). Hence, we WLOG assume that we don't have
$\left\vert \mathbf{J}\cap\mathbf{B}_{\sigma}\right\vert =0$. Thus, the set
$\mathbf{J}\cap\mathbf{B}_{\sigma}$ is nonempty. Hence, there exists some
$W\in\mathbf{J}\cap\mathbf{B}_{\sigma}$. Consider this $W$. Note that
$W\in\mathbf{J}\cap\mathbf{B}_{\sigma}\subseteq\mathbf{B}_{\sigma}=\left\{
\text{all windows of }\sigma\right\}  $; in other words, $W$ is a window of
$\sigma$. Hence, $W$ is a $k$-element set (since any window of $\sigma$ is a
$k$-element set). In other words, $\left\vert W\right\vert =k$, so that
$W\neq\varnothing$ (since $k$ is positive).

We shall say that two sets $A$ and $B$ \textit{intersect} if $A\cap
B\neq\varnothing$. We shall also use the verb \textquotedblleft
intersect\textquotedblright\ transitively -- i.e., we shall say
\textquotedblleft$A$ intersects $B$\textquotedblright\ (or \textquotedblleft%
$B$ intersects $A$\textquotedblright) for \textquotedblleft$A$ and $B$
intersect\textquotedblright.

If $A\in\mathbf{J}$ and $B\in\mathbf{J}$ are two distinct sets, then $A\cap
B\neq\varnothing$ (since $\mathbf{J}$ is an intersecting $k$-collection). In
other words, if $A\in\mathbf{J}$ and $B\in\mathbf{J}$ are two distinct sets,
then $A$ and $B$ intersect. In other words, any two distinct sets belonging to
$\mathbf{J}$ intersect. Thus, it is easy to see that%
\begin{equation}
\mathbf{J}\cap\mathbf{B}_{\sigma}\subseteq\left\{  \text{windows of }%
\sigma\text{ that intersect }W\right\}  . \label{pf.thm.extcomb.ekr.c1.pf.5}%
\end{equation}


[\textit{Proof of (\ref{pf.thm.extcomb.ekr.c1.pf.5}):} We must show that
$W^{\prime}\in\left\{  \text{windows of }\sigma\text{ that intersect
}W\right\}  $ for each $W^{\prime}\in\mathbf{J}\cap\mathbf{B}_{\sigma}$. So
let $W^{\prime}\in\mathbf{J}\cap\mathbf{B}_{\sigma}$. We must show that
\newline$W^{\prime}\in\left\{  \text{windows of }\sigma\text{ that intersect
}W\right\}  $. In other words, we must show that $W^{\prime}$ is a window of
$\sigma$ that intersects $W$. It is clear that $W^{\prime}$ is a window of
$\sigma$ (since $W^{\prime}\in\mathbf{J}\cap\mathbf{B}_{\sigma}\subseteq
\mathbf{B}_{\sigma}=\left\{  \text{all windows of }\sigma\right\}  $); hence,
it only remains to show that $W^{\prime}$ intersects $W$. If $W^{\prime}=W$,
then this is obvious (because in this case, we have $W^{\prime}\cap
W=W\neq\varnothing$). Thus, we WLOG assume that $W^{\prime}\neq W$. We have
$W\in\mathbf{J}\cap\mathbf{B}_{\sigma}\subseteq\mathbf{J}$ and $W^{\prime}%
\in\mathbf{J}\cap\mathbf{B}_{\sigma}\subseteq\mathbf{J}$ and $W^{\prime}\neq
W$; thus, $W$ and $W^{\prime}$ are two distinct sets belonging to $\mathbf{J}%
$. Hence, $W$ and $W^{\prime}$ intersect (since any two distinct sets
belonging to $\mathbf{J}$ intersect). In other words, $W^{\prime}$ intersects
$W$. This completes our proof of (\ref{pf.thm.extcomb.ekr.c1.pf.5}).]

So we have proved (\ref{pf.thm.extcomb.ekr.c1.pf.5}). In order to prove
(\ref{pf.thm.extcomb.ekr.c1.pf.goal4}), it thus looks reasonable to ask: How
many windows of $\sigma$ intersect $W$ ?

The answer is $2k-1$ (which is not hard to check, but too large to be useful),
but it pays off to be more precise.

We have $W\in\mathbf{B}_{\sigma}=\left\{  W_{0}\left(  \sigma\right)
,W_{1}\left(  \sigma\right)  ,W_{2}\left(  \sigma\right)  ,\ldots\right\}  $
(by the definition of $\mathbf{B}_{\sigma}$). In other words, there exists
some $i\in\mathbb{N}$ satisfying $W=W_{i}\left(  \sigma\right)  $. Consider
such an $i$. We note that if we replace $i$ by $i+n$, then $W_{i}\left(
\sigma\right)  $ does not change\footnote{because the definition of
$W_{i+n}\left(  \sigma\right)  $ yields%
\begin{align*}
W_{i+n}\left(  \sigma\right)   &  =\left\{  \sigma\left(  i+n+1\right)
,\sigma\left(  i+n+2\right)  ,\ldots,\sigma\left(  i+n+k\right)  \right\} \\
&  =\left\{  \sigma\left(  i+1+n\right)  ,\sigma\left(  i+2+n\right)
,\ldots,\sigma\left(  i+k+n\right)  \right\} \\
&  =\left\{  \sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)
,\ldots,\sigma\left(  i+k\right)  \right\} \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the sequence }\left(  \sigma\left(  1\right)  ,\sigma\left(
2\right)  ,\sigma\left(  3\right)  ,\ldots\right)  \text{ is }%
n\text{-periodic,}\\
\text{and thus }\sigma\left(  u+n\right)  =\sigma\left(  u\right)  \text{ for
each }u\geq1
\end{array}
\right) \\
&  =W_{i}\left(  \sigma\right)
\end{align*}
}. Thus, we can WLOG assume that $i\geq n$ (since otherwise, we can replace
$i$ by $i+n$). We have%
\[
W=W_{i}\left(  \sigma\right)  =\left\{  \sigma\left(  i+1\right)
,\sigma\left(  i+2\right)  ,\ldots,\sigma\left(  i+k\right)  \right\}
\]
(by the definition of $W_{i}\left(  \sigma\right)  $). Now, we define the
$k-1$ windows%
\[
L_{1}=W_{i-k+1}\left(  \sigma\right)  ,\ \ \ L_{2}=W_{i-k+2}\left(
\sigma\right)  ,\ \ \ \ldots,\ \ \ L_{k-1}=W_{i-1}\left(  \sigma\right)
\]
(that is, $L_{j}=W_{i-k+j}\left(  \sigma\right)  $ for each $j\in\left\{
1,2,\ldots,k-1\right\}  $) as well as the $k-1$ windows%
\[
R_{1}=W_{i+1}\left(  \sigma\right)  ,\ \ \ R_{2}=W_{i+2}\left(  \sigma\right)
,\ \ \ \ldots,\ \ \ R_{k-1}=W_{i+k-1}\left(  \sigma\right)
\]
(that is, $R_{j}=W_{i+j}\left(  \sigma\right)  $ for each $j\in\left\{
1,2,\ldots,k-1\right\}  $).\ \ \ \ \footnote{Let us visualize these $2\left(
k-1\right)  $ windows on an example:
\par
Let $n=8$ and $k=3$, and let $\sigma\in S_{8}$ be the permutation that sends
$1,2,3,4,5,6,7,8$ to $3,1,7,4,5,6,8,2$, respectively. Let $W=W_{7}\left(
\sigma\right)  =\left\{  2,3,1\right\}  $. Then, the following picture shows
the $2$ windows $L_{1}$ and $L_{2}$ (in blue) and the $2$ windows $R_{1}$ and
$R_{2}$ (in red) as transparent blobs:%
\[%
%TCIMACRO{\TeXButton{tikz left and right windows}{\begin{tikzpicture}%
%[scale=2.5]
%\filldraw
%[fill=yellow, draw=yellow] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw
%[very thick, red, cm={cos(2*360/8), -sin(2*360/8), sin(2*360/8), cos(2*360/8), (0, 0)}%
%] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw
%[very thick, red, cm={cos(1*360/8), -sin(1*360/8), sin(1*360/8), cos(1*360/8), (0, 0)}%
%] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw
%[very thick, blue, cm={cos(2*360/8), sin(2*360/8), -sin(2*360/8), cos(2*360/8), (0, 0)}%
%] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw
%[very thick, blue, cm={cos(1*360/8), sin(1*360/8), -sin(1*360/8), cos(1*360/8), (0, 0)}%
%] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
%;
%\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
%\draw(0,0) circle [radius=1];
%\node(a) at ({cos(0)}, {sin(0)}) [circle, fill=white] {$3$};
%\node(b) at ({cos(360/8)}, {sin(360/8)}) [circle, fill=white] {$2$};
%\node(b) at ({cos(2*360/8)}, {sin(2*360/8)}) [circle, fill=white] {$8$};
%\node(b) at ({cos(3*360/8)}, {sin(3*360/8)}) [circle, fill=white] {$6$};
%\node(b) at ({cos(4*360/8)}, {sin(4*360/8)}) [circle, fill=white] {$5$};
%\node(b) at ({cos(5*360/8)}, {sin(5*360/8)}) [circle, fill=white] {$4$};
%\node(b) at ({cos(6*360/8)}, {sin(6*360/8)}) [circle, fill=white] {$7$};
%\node(b) at ({cos(7*360/8)}, {sin(7*360/8)}) [circle, fill=white] {$1$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\filldraw
[fill=yellow, draw=yellow] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw
[very thick, red, cm={cos(2*360/8), -sin(2*360/8), sin(2*360/8), cos(2*360/8), (0, 0)}%
] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw
[very thick, red, cm={cos(1*360/8), -sin(1*360/8), sin(1*360/8), cos(1*360/8), (0, 0)}%
] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw
[very thick, blue, cm={cos(2*360/8), sin(2*360/8), -sin(2*360/8), cos(2*360/8), (0, 0)}%
] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw
[very thick, blue, cm={cos(1*360/8), sin(1*360/8), -sin(1*360/8), cos(1*360/8), (0, 0)}%
] plot [smooth cycle] coordinates {(0.3, 0.8) (0.7, 1) (1.2, 0.4) (1.3, 0) (1.2, -0.4) (0.7, -1) (0.3, -0.8) (0.6, -0.3) (0.7, 0) (0.6, 0.3)}%
;
\draw[red, <<-, very thick] (2,0) arc[radius=2, start angle=0, end angle=20];
\draw(0,0) circle [radius=1];
\node(a) at ({cos(0)}, {sin(0)}) [circle, fill=white] {$3$};
\node(b) at ({cos(360/8)}, {sin(360/8)}) [circle, fill=white] {$2$};
\node(b) at ({cos(2*360/8)}, {sin(2*360/8)}) [circle, fill=white] {$8$};
\node(b) at ({cos(3*360/8)}, {sin(3*360/8)}) [circle, fill=white] {$6$};
\node(b) at ({cos(4*360/8)}, {sin(4*360/8)}) [circle, fill=white] {$5$};
\node(b) at ({cos(5*360/8)}, {sin(5*360/8)}) [circle, fill=white] {$4$};
\node(b) at ({cos(6*360/8)}, {sin(6*360/8)}) [circle, fill=white] {$7$};
\node(b) at ({cos(7*360/8)}, {sin(7*360/8)}) [circle, fill=white] {$1$};
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
(The numbers on the circumference of the circle are the values of $\sigma$
written in clockwise order. The yellow blob is the window $W$.) Note that the
letter \textquotedblleft$L$\textquotedblright\ has been chosen because the
windows $L_{1}$ and $L_{2}$ are \textquotedblleft left\textquotedblright\ (in
the sense of \textquotedblleft counterclockwise from\textquotedblright, on the
circle) of the window $W$; likewise the letter \textquotedblleft%
$R$\textquotedblright\ stands for \textquotedblleft right\textquotedblright.
(Furthermore, the colors b\textbf{l}ue and \textbf{r}ed have been chosen to
hint at the letters $L$ and $R$.)} It is easy to see that the only windows of
$\sigma$ that intersect $W$ are the $2\left(  k-1\right)  +1$ windows%
\[
L_{1},L_{2},\ldots,L_{k-1},W,R_{1},R_{2},\ldots,R_{k-1}.
\]
In other words,
\[
\left\{  \text{windows of }\sigma\text{ that intersect }W\right\}
\subseteq\left\{  L_{1},L_{2},\ldots,L_{k-1},W,R_{1},R_{2},\ldots
,R_{k-1}\right\}  .
\]
Now, (\ref{pf.thm.extcomb.ekr.c1.pf.5}) becomes
\begin{align}
\mathbf{J}\cap\mathbf{B}_{\sigma}  &  \subseteq\left\{  \text{windows of
}\sigma\text{ that intersect }W\right\} \nonumber\\
&  \subseteq\left\{  L_{1},L_{2},\ldots,L_{k-1},W,R_{1},R_{2},\ldots
,R_{k-1}\right\}  . \label{pf.thm.extcomb.ekr.c1.pf.7}%
\end{align}


Now, in order to profit from this observation, let us see how many of the
$2\left(  k-1\right)  +1$ windows $L_{1},L_{2},\ldots,L_{k-1},W,R_{1}%
,R_{2},\ldots,R_{k-1}$ can actually belong to $\mathbf{J}\cap\mathbf{B}%
_{\sigma}$.

If $j\in\left\{  1,2,\ldots,k-1\right\}  $ is arbitrary, then the windows
$L_{j}$ and $R_{j}$ are distinct and do not intersect\footnote{\textit{Proof.}
Let $j\in\left\{  1,2,\ldots,k-1\right\}  $. The definitions of $L_{j}$ and
$R_{j}$ yield
\begin{align*}
L_{j}  &  =W_{i-k+j}\left(  \sigma\right)  =\left\{  \sigma\left(
i-k+j+1\right)  ,\sigma\left(  i-k+j+2\right)  ,\ldots,\sigma\left(
i+j\right)  \right\}  \ \ \ \ \ \ \ \ \ \ \text{and}\\
R_{j}  &  =W_{i+j}\left(  \sigma\right)  =\left\{  \sigma\left(  i+j+1\right)
,\sigma\left(  i+j+2\right)  ,\ldots,\sigma\left(  i+j+k\right)  \right\}  .
\end{align*}
But the $2k$ \textquotedblleft consecutive\textquotedblright\ values
\[
\sigma\left(  i-k+j+1\right)  ,\sigma\left(  i-k+j+2\right)  ,\ldots
,\sigma\left(  i+j+k\right)
\]
of $\sigma$ are distinct (since $n\geq2k$); thus, the above equalities show
that the sets $L_{j}$ and $R_{j}$ are disjoint. In other words, the sets
$L_{j}$ and $R_{j}$ do not intersect. Qed.}, and thus cannot both belong to
$\mathbf{J}$ at the same time (since any two distinct sets belonging to
$\mathbf{J}$ intersect), and thus cannot both belong to $\mathbf{J}%
\cap\mathbf{B}_{\sigma}$ at the same time (since $\mathbf{J}\cap
\mathbf{B}_{\sigma}\subseteq\mathbf{J}$). In other words, if $j\in\left\{
1,2,\ldots,k-1\right\}  $ is arbitrary, then the collection $\mathbf{J}%
\cap\mathbf{B}_{\sigma}$ contains \textbf{at most one} of the two windows
$L_{j}$ and $R_{j}$. In other words:

\begin{itemize}
\item The collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$ contains \textbf{at
most one} of the two windows $L_{1}$ and $R_{1}$.

\item The collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$ contains \textbf{at
most one} of the two windows $L_{2}$ and $R_{2}$.

\item $\ldots$

\item The collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$ contains \textbf{at
most one} of the two windows $L_{k-1}$ and $R_{k-1}$.
\end{itemize}

Altogether, this shows that the collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$
contains \textbf{at most} $k-1$ of the $2\left(  k-1\right)  $ windows
$L_{1},R_{1},L_{2},R_{2},\ldots,L_{k-1},R_{k-1}$. Since we further know that
the collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$ contains the window $W$, we
thus conclude that the collection $\mathbf{J}\cap\mathbf{B}_{\sigma}$ contains
\textbf{at most} $\left(  k-1\right)  +1$ of the $2\left(  k-1\right)  +1$
windows $L_{1},R_{1},L_{2},R_{2},\ldots,L_{k-1},R_{k-1},W$. In other words,%
\[
\left\vert \left(  \mathbf{J}\cap\mathbf{B}_{\sigma}\right)  \cap\left\{
L_{1},R_{1},L_{2},R_{2},\ldots,L_{k-1},R_{k-1},W\right\}  \right\vert
\leq\left(  k-1\right)  +1=k.
\]
In view of%
\begin{align*}
&  \left(  \mathbf{J}\cap\mathbf{B}_{\sigma}\right)  \cap\underbrace{\left\{
L_{1},R_{1},L_{2},R_{2},\ldots,L_{k-1},R_{k-1},W\right\}  }_{=\left\{
L_{1},L_{2},\ldots,L_{k-1},W,R_{1},R_{2},\ldots,R_{k-1}\right\}  }\\
&  =\left(  \mathbf{J}\cap\mathbf{B}_{\sigma}\right)  \cap\left\{  L_{1}%
,L_{2},\ldots,L_{k-1},W,R_{1},R_{2},\ldots,R_{k-1}\right\} \\
&  =\mathbf{J}\cap\mathbf{B}_{\sigma}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.extcomb.ekr.c1.pf.7})}\right)  ,
\end{align*}
this rewrites as $\left\vert \mathbf{J}\cap\mathbf{B}_{\sigma}\right\vert \leq
k$. This proves (\ref{pf.thm.extcomb.ekr.c1.pf.goal4}). As we explained above,
this proves Claim 1.]

Now,%
\begin{align}
s  &  =\underbrace{\sum_{I\in\mathbf{J}}\ \ \sum_{\sigma\in S_{n}}}%
_{=\sum_{\sigma\in S_{n}}\ \ \sum_{I\in\mathbf{J}}}\left[  I\in\mathbf{B}%
_{\sigma}\right]  =\sum_{\sigma\in S_{n}}\ \ \underbrace{\sum_{I\in\mathbf{J}%
}\left[  I\in\mathbf{B}_{\sigma}\right]  }_{\substack{\leq k\\\text{(by Claim
1)}}}\nonumber\\
&  \leq\sum_{\sigma\in S_{n}}k=\underbrace{\left\vert S_{n}\right\vert }%
_{=n!}\cdot k=n!\cdot k. \label{pf.thm.extcomb.ekr.b.ub}%
\end{align}
Thus we have obtained an upper bound for $s$.

In order to find a lower bound (better yet: actually a precise value) for $s$,
we will need the following:

\begin{statement}
\textit{Claim 2:} For any $I\in\mathbf{J}$, we have $\sum_{\sigma\in S_{n}%
}\left[  I\in\mathbf{B}_{\sigma}\right]  =n\cdot k!\cdot\left(  n-k\right)  !$.
\end{statement}

[\textit{Proof of Claim 2:} Let $I\in\mathbf{J}$. Thus, $I$ is a $k$-element
subset of $S$ (since $\mathbf{J}$ is a collection of $k$-element subsets of
$S$). In other words, $I$ is a $k$-element subset of $\left[  n\right]  $
(since $S=\left[  n\right]  $). We have%
\begin{equation}
\sum_{\sigma\in S_{n}}\left[  I\in\mathbf{B}_{\sigma}\right]  =\left(
\text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in\mathbf{B}_{\sigma
}\right)  . \label{pf.thm.extcomb.ekr.c2.pf.1}%
\end{equation}
(Indeed, this can be proved in the same way as we proved
(\ref{pf.thm.extcomb.sperner.c2.pf.1}) above, except that we are now using the
collection $\mathbf{B}_{\sigma}$ instead of $\mathbf{C}_{\sigma}$.) Now, how
many permutations $\sigma\in S_{n}$ satisfy $I\in\mathbf{B}_{\sigma}$ ?

Let $\sigma\in S_{n}$ be a permutation. Then, $\mathbf{B}_{\sigma}$ is the
collection of all windows of $\sigma$; thus,
\[
\mathbf{B}_{\sigma}=\left\{  W_{0}\left(  \sigma\right)  ,W_{1}\left(
\sigma\right)  ,\ldots,W_{n-1}\left(  \sigma\right)  \right\}
\]
(since there are $n$ windows of $\sigma$ in total, and these $n$ windows are
precisely \newline$W_{0}\left(  \sigma\right)  ,W_{1}\left(  \sigma\right)
,\ldots,W_{n-1}\left(  \sigma\right)  $). Thus, we have $I\in\mathbf{B}%
_{\sigma}$ if and only if we have $I=W_{i}\left(  \sigma\right)  $ for some
$i\in\left\{  0,1,\ldots,n-1\right\}  $.

Forget that we fixed $\sigma$. We thus have shown that a permutation
$\sigma\in S_{n}$ satisfies $I\in\mathbf{B}_{\sigma}$ if and only if it
satisfies $I=W_{i}\left(  \sigma\right)  $ for some $i\in\left\{
0,1,\ldots,n-1\right\}  $. Hence,%
\begin{align}
&  \left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in
\mathbf{B}_{\sigma}\right) \nonumber\\
&  =\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I=W_{i}\left(
\sigma\right)  \text{ for some }i\in\left\{  0,1,\ldots,n-1\right\}  \right)
\nonumber\\
&  =\sum_{i=0}^{n-1}\left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying
}I=W_{i}\left(  \sigma\right)  \right)  . \label{pf.thm.extcomb.ekr.c2.pf.2}%
\end{align}
(Here, the last equality sign is a consequence of the sum rule, because the
sets $\left\{  \sigma\in S_{n}\ \mid\ I=W_{i}\left(  \sigma\right)  \right\}
$ for $i\in\left\{  0,1,\ldots,n-1\right\}  $ are
disjoint\footnote{\textit{Proof.} Assume the contrary. Thus, these sets are
not disjoint. In other words, there exists a permutation $\sigma\in S_{n}$
that satisfies $I=W_{i}\left(  \sigma\right)  $ for two different values of
$i\in\left\{  0,1,\ldots,n-1\right\}  $. Consider this $\sigma$. We have seen
above that the first $n$ windows $W_{0}\left(  \sigma\right)  ,W_{1}\left(
\sigma\right)  ,\ldots,W_{n-1}\left(  \sigma\right)  $ of $\sigma$ are
distinct. However, two of these $n$ windows equal $I$ (since $\sigma$
satisfies $I=W_{i}\left(  \sigma\right)  $ for two different values of
$i\in\left\{  0,1,\ldots,n-1\right\}  $). Therefore, two of these $n$ windows
are equal. This contradicts the fact that these $n$ windows are distinct. This
contradiction shows that our assumption was false, qed.}.)

Now, let us fix $i\in\left\{  0,1,\ldots,n-1\right\}  $. Then, a permutation
$\sigma\in S_{n}$ satisfying $I=W_{i}\left(  \sigma\right)  $ can be
constructed using the following decision procedure:

\begin{itemize}
\item First, we choose the $k$ values $\sigma\left(  i+1\right)
,\sigma\left(  i+2\right)  ,\ldots,\sigma\left(  i+k\right)  $ of $\sigma$ (in
this order). These $k$ values must belong to the $k$-element subset $I$ of
$\left[  n\right]  $ (since we want to have $I=W_{i}\left(  \sigma\right)
=\left\{  \sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)  ,\ldots
,\sigma\left(  i+k\right)  \right\}  $) and be distinct (since $\sigma$ needs
to be injective). Thus, we have $k$ options for the first of these values,
$k-1$ options for the second, $k-2$ for the third, and so on.

Once these choices are made, we have assigned $k$ distinct elements of the set
$I$ as values $\sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)
,\ldots,\sigma\left(  i+k\right)  $. Thus, by the pigeonhole principle for
injections, each of the $k$ elements of $I$ has been assigned as one of the
$k$ values $\sigma\left(  i+1\right)  ,\sigma\left(  i+2\right)
,\ldots,\sigma\left(  i+k\right)  $ (since $I$ is a $k$-element set). We have
therefore ensured that $I=\left\{  \sigma\left(  i+1\right)  ,\sigma\left(
i+2\right)  ,\ldots,\sigma\left(  i+k\right)  \right\}  =W_{i}\left(
\sigma\right)  $. We still need to choose the remaining $n-k$ values of
$\sigma$, though.

\item Next, we choose the remaining $n-k$ values $\sigma\left(  i+k+1\right)
,\sigma\left(  i+k+2\right)  ,\ldots,\sigma\left(  i+n\right)  $ of $\sigma$
(in this order). These $n-k$ values must be elements of $\left[  n\right]  $
that are distinct from each other and from the already chosen $k$ values;
thus, we have $n-k$ options for the first of them, $n-k-1$ options for the
second, $n-k-2$ options for the third, and so on.
\end{itemize}

\noindent According to the dependent product rule, the total \# of
possibilities for making these choices is%
\[
\underbrace{k\left(  k-1\right)  \left(  k-2\right)  \cdots1}%
_{\substack{=1\cdot2\cdot\cdots\cdot k\\=k!}}\cdot\underbrace{\left(
n-k\right)  \left(  n-k-1\right)  \cdots1}_{\substack{=1\cdot2\cdot\cdots
\cdot\left(  n-k\right)  \\=\left(  n-k\right)  !}}=k!\cdot\left(  n-k\right)
!.
\]
Hence,%
\begin{align}
&  \left(  \text{\# of all }\sigma\in S_{n}\text{ satisfying }I=W_{i}\left(
\sigma\right)  \right) \nonumber\\
&  =k!\cdot\left(  n-k\right)  !. \label{pf.thm.extcomb.ekr.c2.pf.3}%
\end{align}


Now, forget that we fixed $i$. We thus have proved
(\ref{pf.thm.extcomb.ekr.c2.pf.3}) for each $i\in\left\{  0,1,\ldots
,n-1\right\}  $. Now, (\ref{pf.thm.extcomb.ekr.c2.pf.1}) becomes%
\begin{align*}
\sum_{\sigma\in S_{n}}\left[  I\in\mathbf{B}_{\sigma}\right]   &  =\left(
\text{\# of all }\sigma\in S_{n}\text{ satisfying }I\in\mathbf{B}_{\sigma
}\right) \\
&  =\sum_{i=0}^{n-1}\underbrace{\left(  \text{\# of all }\sigma\in S_{n}\text{
satisfying }I=W_{i}\left(  \sigma\right)  \right)  }_{\substack{=k!\cdot
\left(  n-k\right)  !\\\text{(by (\ref{pf.thm.extcomb.ekr.c2.pf.3}))}%
}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.thm.extcomb.ekr.c2.pf.2}%
)}\right) \\
&  =\sum_{i=0}^{n-1}k!\cdot\left(  n-k\right)  !=n\cdot k!\cdot\left(
n-k\right)  !.
\end{align*}
This proves Claim 2.]

Now,%
\[
s=\sum_{I\in\mathbf{J}}\ \ \underbrace{\sum_{\sigma\in S_{n}}\left[
I\in\mathbf{B}_{\sigma}\right]  }_{\substack{=n\cdot k!\cdot\left(
n-k\right)  !\\\text{(by Claim 2)}}}=\sum_{I\in\mathbf{J}}n\cdot
k!\cdot\left(  n-k\right)  !=\left\vert \mathbf{J}\right\vert \cdot n\cdot
k!\cdot\left(  n-k\right)  !.
\]
Hence,%
\[
\left\vert \mathbf{J}\right\vert \cdot n\cdot k!\cdot\left(  n-k\right)
!=s\leq n!\cdot k\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.extcomb.ekr.b.ub})}\right)  .
\]
Dividing this inequality by $n\cdot k!\cdot\left(  n-k\right)  !$, we obtain%
\[
\left\vert \mathbf{J}\right\vert \leq\dfrac{n!\cdot k}{n\cdot k!\cdot\left(
n-k\right)  !}=\dfrac{k}{n}\cdot\underbrace{\dfrac{n!}{k!\cdot\left(
n-k\right)  !}}_{\substack{=\dbinom{n}{k}\\\text{(by Theorem
\ref{thm.binom.fac})}}}=\dfrac{k}{n}\dbinom{n}{k}=\dbinom{n-1}{k-1}%
\]
(by Exercise \ref{exe.binom.gcd-integrality} \textbf{(a)}, applied to $m=k$).
This proves Theorem \ref{thm.extcomb.ekr} \textbf{(a)}.
\end{proof}

\newpage

\section{\label{chp.inv}Invariants and Monovariants}

Mathematicians frequently study \textquotedblleft dynamical\textquotedblright%
\ objects, i.e., objects that change with time: games, algorithms, recursively
defined sequences\footnote{or their continuous analogues: functions defined as
solutions to differential equations}. We shall refer to such things as
\textit{processes}. A process is called \textit{deterministic} if its state at
a given time is uniquely determined by its states at the previous times;
otherwise it is called \textit{nondeterministic}. For example, computing the
Fibonacci numbers $f_{0},f_{1},f_{2},\ldots$ one by one using their recursive
definition is a deterministic process, whereas casting a die multiple times
and summing the scores is a nondeterministic process. We shall restrict our
attention to processes with precisely defined \textit{states} (which the
object can have at any given time) and precisely defined \textit{moves} (i.e.,
ways in which the object can change from one moment to the other; i.e.,
allowable transitions between states). For example, let us formalize
\textquotedblleft the process of computing the Fibonacci numbers $f_{0}%
,f_{1},f_{2},\ldots$ one by one using their recursive
definition\textquotedblright\ as a precise process:

\begin{itemize}
\item Its states are finite tuples $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $
of integers with at least $2$ entries (i.e., with $k\geq2$).

\item Its moves are to insert a new entry $a_{k}+a_{k-1}$ at the end of a
given tuple $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $.
\end{itemize}

\noindent Thus, if we start this process with the state $\left(  0,1\right)
$, then we will arrive at the state $\left(  0,1,1\right)  $ after one move,
then at the state $\left(  0,1,1,2\right)  $ after another move, then at the
state $\left(  0,1,1,2,3\right)  $ after a third move, and so on. After $n$
moves, our state will be the $\left(  n+2\right)  $-tuple $\left(  f_{0}%
,f_{1},\ldots,f_{n+1}\right)  $. Note that the state will never be the entire
Fibonacci sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $, since a state
is always a \textbf{finite} tuple; but each Fibonacci number will eventually
appear in the state. Of course, the same process (with a different starting
state) can be used to compute not just the Fibonacci sequence, but any
$\left(  1,1\right)  $-recurrent sequence.

Given a process, we can ask several questions about it:

\begin{itemize}
\item Can a certain state ever be reached by the process from a given starting state?

\item What states can be reached at all?

\item Does the process exhibit periodic behavior (i.e., do its states form a
periodic sequence)?

\item Is the process reversible? That is, is there a way to reconstruct a
state from the next state?

\item What things stay unchanged throughout the process?

\item What things change only in one direction (i.e., only get smaller or only
get larger) throughout the process?
\end{itemize}

The last two questions in this list are sufficiently important that they have
names. Things that stay unchanged during a process are called
\textit{invariants} (or \textit{conserved quantities}) of this process; things
that change only in one direction (e.g., only get smaller, or only get larger)
are called \textit{monovariants}. In many cases, finding invariants or
monovariants (or both) is not just interesting in itself, but also helps
answering some of the other questions (for example, knowing that some quantity
decreases at each step of the process immediately guarantees that the process
does not return to any previous state). Here are some examples that you may
have seen:

\begin{itemize}
\item The Euclidean algorithm for computing the gcd of two nonnegative
integers rests on the fact that if we subtract an integer from another (i.e.,
replace a pair $\left(  a,b\right)  $ of integers by $\left(  a-b,b\right)  $
or by $\left(  a,b-a\right)  $), then the gcd of the two integers does not
change. In other words, the gcd is an invariant of the subtraction operation
that keeps getting used in the algorithm.\footnote{There are actually two
versions of the Euclidean algorithm: In one version, the smaller integer keeps
getting subtracted from the larger integer; in the other version, the larger
integer keeps getting divided with remainder by the smaller integer. The gcd
is an invariant for both of these versions.} More generally, almost all
nontrivial algorithms in mathematics are analyzed with the help of
\textit{loop invariants}, which are things (e.g., quantities or statements)
that never change when the algorithm is performed.

\item Proposition \ref{prop.ind.dc} can be restated as follows: If a positive
integer can only change by $1$ (upwards or downwards) but is not allowed to
ever become $0$, then it always remains positive. Thus, its sign is an invariant.

\item In the Euclidean algorithm, the sum of the two nonnegative integers
decreases at each step. Thus, it is a monovariant. (This is why the Euclidean
algorithm terminates.)

\item In Exercise \ref{exe.lemmings}, lemmings can fall off the cliff but
never come back. Thus, the number of lemmings on the cliff is a monovariant:
it can only decrease.

\item
\href{https://en.wikipedia.org/wiki/Monotone_convergence_theorem#Convergence_of_a_monotone_sequence_of_real_numbers}{The
monotone convergence theorem} says that a sequence of real numbers that is
increasing and bounded from above converges to its supremum. The
\textquotedblleft increasing\textquotedblright\ condition here can be viewed
as a monovariant (viz., the entries of the sequence increase as we move along
the sequence), whereas the \textquotedblleft bounded\textquotedblright%
\ condition can be viewed as an invariant (viz., the entries remain $\leq$ to
the bound, no matter where we stand in the sequence). Thus, the monotone
convergence theorem is one way in which monovariants and invariants can be useful.

\item Our solutions to Exercise \ref{exe.ind.01-100} illustrate various uses
of invariants and monovariants. (For example, in the first solution, the comb
number is a monovariant, whereas the number of $1$s in the bitstring is an
invariant. In the second solution, $\operatorname*{load}a$ is a monovariant,
and $\operatorname*{ones}a$ is an invariant.)
\end{itemize}

Physics has its share of invariants and monovariants, too (e.g., energy and
momentum are famous invariants, while entropy is a monovariant).

There is no general theory of how to construct invariants and monovariants,
let alone find specific ones that are useful for a given problem. Doing so
often requires ingenuity, experience and luck. The best we can do is show some
examples and discuss some common threads. More can be found in \cite[Chapter
1]{Engel}, \cite[\S 1.5]{GelAnd}, \cite[Kapitel 4]{ngrin}, \cite[Kapitel
5]{Carl17} and \cite[\S 3.4]{Zeitz17}.\footnote{Many of the following examples
are taken from \cite[Chapter 1]{Engel}, \cite[Kapitel 4]{ngrin} and from the
Russian problem database \url{http://www.problems.ru/} .}

\subsection{\label{sect.inv.inv}Invariants}

We begin by illustrating the use of invariants on some examples. See
\cite[\S 6.1]{LeLeMe16} for a brief but rigorous introduction.

\subsubsection{Simple examples}

We begin with a classical simple exercise (\cite[Aufgabe 4.1]{ngrin}):

\begin{exercise}
\label{exe.inv.rip-paper}A chunk of ice is floating in the sea. At each
moment, a chunk can break into $3$ or into $5$ smaller chunks. Assuming that
no chunks can ever melt, is it possible that there are precisely $100$ chunks
left after some time has passed?
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.rip-paper} (sketched).]No.

\textit{Proof.} At the beginning, there is only $1$ chunk of ice; thus, the
total number of chunks is odd. Each time a chunk breaks apart, the number of
chunks increases by $2$ or by $4$ (since the chunk breaks into $3$ or into $5$
smaller chunks); thus, the total number of chunks remains odd (because
increasing an odd number by $2$ or by $4$ preserves its oddness). Thus, the
total number of chunk can never become $100$. This proves our negative answer.
\end{proof}

The next exercise is \cite[Aufgabe 4.2]{ngrin}:

\begin{exercise}
\label{exe.inv.ab+a+b}Fix a positive integer $n$.

\textbf{(a)} You have the $n$ numbers $1,2,\ldots,n$ written on a blackboard.
In one move, you can erase two numbers $a$ and $b$ and write the number $a+b$ instead.

You keep making these moves until only one number is left on the blackboard.
Prove that this will happen after precisely $n-1$ moves. Will the remaining
number depend on the specific moves you have taken? If not, what is this number?

\textbf{(b)} Answer the same questions if $a+b$ is replaced by $a-b$.

\textbf{(c)} Answer the same questions if $a+b$ is replaced by $ab$.

\textbf{(d) }Answer the same questions if $a+b$ is replaced by $a+b+5$.

\textbf{(e) }Answer the same questions if $a+b$ is replaced by $ab+a+b$.

\textbf{(f) }Answer the same questions if $a+b$ is replaced by $a^{2}+b^{2}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.ab+a+b} (sketched).]\textbf{(a)} Every move
decreases the number of numbers written on the table by $1$. Since this number
was $n$ at the onset, it is thus clear that it will take precisely $n-1$ moves
to reduce it down to $1$. Thus, after precisely $n-1$ moves, only one number
will be left on the blackboard.

Now, we claim that this number is $1+2+\cdots+n$. In fact, each of our moves
leaves the sum of all numbers on the blackboard unchanged (because it removes
two addends $a$ and $b$ and inserts the addend $a+b$ instead). Since this sum
was $1+2+\cdots+n$ at the onset, it will therefore remain $1+2+\cdots+n$
throughout the procedure, and thus will still be $1+2+\cdots+n$ at the end.
But since there is only one number left on the blackboard at the end, this
means that this number will have to be $1+2+\cdots+n$. Thus, in particular,
this number will not depend on the specific moves taken. Thus, Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)} is solved.

\textbf{(b)} Again, we can show (as in our above solution to Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)}) that after precisely $n-1$ moves, only one
number will be left on the blackboard. However, this time, this number may
well depend on the specific moves taken. This does in fact happen already for
$n=2$, since the two numbers $1$ and $2$ can be replaced by any of $1-2=-1$
and $2-1=+1$ (depending on which of them we take to be $a$ and which we take
to be $b$). Thus, Exercise \ref{exe.inv.ab+a+b} \textbf{(b)} is solved.

\textbf{(c)} This can be solved in the exact same way as Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)}, except that all sums need to be replaced by
products. Thus, the number that remains on the blackboard after $n-1$ moves
are made is not $1+2+\cdots+n$ but $1\cdot2\cdot\cdots\cdot n=n!$. (But it
still does not depend on the specific moves taken.) Thus, Exercise
\ref{exe.inv.ab+a+b} \textbf{(c)} is solved.

\textbf{(d)} Again, we can show (as in our above solution to Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)}) that after precisely $n-1$ moves, only one
number will be left on the blackboard. Again, this remaining number does not
depend on the specific moves taken; but this time, this is a bit trickier to
prove. Namely: We define the \textit{weird-sum} of $k$ numbers $a_{1}%
,a_{2},\ldots,a_{k}$ to be the number $\left(  a_{1}+5\right)  +\left(
a_{2}+5\right)  +\cdots+\left(  a_{k}+5\right)  $. Then, each of our moves
leaves the weird-sum of the numbers on the blackboard unchanged (indeed, the
move removes two addends of the form $a+5$ and $b+5$ from this weird-sum, and
replaces them with the addend $\left(  a+b+5\right)  +5$; but this new addend
clearly has the same effect as the two addends that were removed, because
$\left(  a+5\right)  +\left(  b+5\right)  =a+b+10=\left(  a+b+5\right)  +5$).
Since this weird-sum was
\[
\left(  1+5\right)  +\left(  2+5\right)  +\cdots+\left(  n+5\right)  =\left(
1+2+\cdots+n\right)  +5n
\]
at the onset, it will therefore remain $\left(  1+2+\cdots+n\right)  +5n$
throughout the procedure, and thus will still be $\left(  1+2+\cdots+n\right)
+5n$ at the end. But since there is only one number left on the blackboard at
the end, this means that this number will have to be $\left(  1+2+\cdots
+n\right)  +5n-5$ (because the weird-sum of a single number $a$ is $a+5$).
Thus, in particular, this number will not depend on the specific moves taken.
Thus, Exercise \ref{exe.inv.ab+a+b} \textbf{(d)} is solved.

\textbf{(e)} Again, we can show (as in our above solution to Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)}) that after precisely $n-1$ moves, only one
number will be left on the blackboard. Again, this remaining number does not
depend on the specific moves taken; but this time, this is a bit trickier to
prove. Namely: We define the \textit{weird-product} of $k$ numbers
$a_{1},a_{2},\ldots,a_{k}$ to be the number $\left(  a_{1}+1\right)  \left(
a_{2}+1\right)  \cdots\left(  a_{k}+1\right)  $. Then, each of our moves
leaves the weird-product of the numbers on the blackboard unchanged (indeed,
the move removes two factors of the form $a+1$ and $b+1$ from this
weird-product, and replaces them with the factor $\left(  ab+a+b\right)  +1$;
but this new factor clearly has the same effect as the two factors that were
removed, because $\left(  a+1\right)  \left(  b+1\right)  =ab+a+b+1=\left(
ab+a+b\right)  +1$). Since this weird-product was
\begin{align*}
\left(  1+1\right)  \left(  2+1\right)  \cdots\left(  n+1\right)   &
=2\cdot3\cdot\cdots\cdot\left(  n+1\right)  =\dfrac{1\cdot2\cdot\cdots
\cdot\left(  n+1\right)  }{1}\\
&  =1\cdot2\cdot\cdots\cdot\left(  n+1\right)  =\left(  n+1\right)  !
\end{align*}
at the onset, it will therefore remain $\left(  n+1\right)  !$ throughout the
procedure, and thus will still be $\left(  n+1\right)  !$ at the end. But
since there is only one number left on the blackboard at the end, this means
that this number will have to be $\left(  n+1\right)  !-1$ (because the
weird-product of a single number $a$ is $a+1$). Thus, in particular, this
number will not depend on the specific moves taken. Thus, Exercise
\ref{exe.inv.ab+a+b} \textbf{(e)} is solved.

\textbf{(f)} Again, we can show (as in our above solution to Exercise
\ref{exe.inv.ab+a+b} \textbf{(a)}) that after precisely $n-1$ moves, only one
number will be left on the blackboard. However, this time, this number may
well depend on the specific moves taken. For example, if $n=3$, then we can
get either $\left(  1^{2}+2^{2}\right)  ^{2}+3^{2}=34$ or $1^{2}+\left(
2^{2}+3^{2}\right)  ^{2}=170$ depending on what move we do first. Thus,
Exercise \ref{exe.inv.ab+a+b} \textbf{(f)} is solved.
\end{proof}

Parity-related invariants are particularly common in contest problems. Here is
an example:

\begin{exercise}
\label{exe.inv.swap-dist-2.100}The numbers $1,2,\ldots,100$ are written in a
row (in this order, from left to right). In a move, you can swap any two
numbers at a distance of $2$ (i.e., any two numbers that have exactly one
number written between them). Can you end up with the numbers $100,99,\ldots
,1$ (in this order, from left to right) by a sequence of such moves?

[\textbf{Example:} The analogous question for $5$ instead of $100$ has a
positive answer:%
\begin{align*}
&  \left(  1,2,3,4,5\right)  \overset{%
\begin{array}
[c]{c}%
\text{swap first and}\\
\text{third numbers}%
\end{array}
}{\longrightarrow}\left(  3,2,1,4,5\right)  \overset{%
\begin{array}
[c]{c}%
\text{swap third and}\\
\text{fifth numbers}%
\end{array}
}{\longrightarrow}\left(  3,2,5,4,1\right) \\
& \\
&  \overset{%
\begin{array}
[c]{c}%
\text{swap second and}\\
\text{fourth numbers}%
\end{array}
}{\longrightarrow}\left(  3,4,5,2,1\right)  \overset{%
\begin{array}
[c]{c}%
\text{swap first and}\\
\text{third numbers}%
\end{array}
}{\longrightarrow}\left(  5,4,3,2,1\right)  .
\end{align*}
]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.swap-dist-2.100} (sketched).]No, you cannot.

\textit{Proof.} We define the \textit{position} of a number $i\in\left[
100\right]  $ to be the (unique) $j\in\left[  100\right]  $ with the property
that $i$ is the $j$-th number from the left on our row. Thus, at the
beginning, each number $i\in\left[  100\right]  $ stands in position $i$.
Hence, in particular, the number $1$ is in an odd position (namely, in
position $1$) at the beginning.

Of course, the positions of our numbers can change when you make moves.
Namely, when you make a move, each number moves precisely $2$ positions to the
right or $2$ positions to the left or not at all.\footnote{For example, the
move that transforms $\left(  1,2,3,4,5\right)  $ into $\left(
3,2,1,4,5\right)  $ causes the number $1$ to move precisely $2$ positions to
the right and causes the number $3$ to move precisely $2$ positions to the
left, and leaves all remaining numbers unmoved.} Hence, when you make a move,
the position of each number does not change its parity (i.e., it stays even if
it was even, and it stays odd if it was odd). Thus, in particular, the
position of $1$ does not change its parity under any move. Thus, after any
sequence of moves, the number $1$ will still be in an odd position (since $1$
was in an odd position at the beginning). Hence, in particular, the number $1$
will never be in position $100$ (since $100$ is not odd). Therefore, you will
never end up with the numbers $100,99,\ldots,1$ (in this order, from left to
right), because this would entail the number $1$ being in position $100$. This
concludes our proof.
\end{proof}

\subsubsection{More examples}

Here are some trickier problems that can be solved with invariants. The
following exercise (\cite[Aufgabe 4.6]{ngrin}, somewhat generalized) is a
Russian olympiad classic:

\begin{exercise}
\label{exe.inv.sparrows}Let $n\geq2$ be an integer. Consider $n$ trees
arranged in a circle. Initially, there is one sparrow sitting on each tree.
Every minute, two of the $n$ sparrows move: Namely, one sparrow moves to the
next tree in clockwise order, whereas the other sparrow moves to the next tree
in counterclockwise order. (The two moves are simultaneous. Any tree can fit
an arbitrary number of sparrows, including $0$.)

Is it possible that, after some time, all sparrows end up on the same tree?
Answer this question depending on $n$.

[\textbf{Example:} For $n=5$, the answer is \textquotedblleft
yes\textquotedblright. Indeed, here is a way how the sparrows can end up on
the same tree after $3$ minutes:%
\[%
\begin{array}
[c]{ccc}%
%TCIMACRO{\TeXButton{tikz sparrows 0}{\begin{tikzpicture}[scale=1.5]
%\draw(0,0) circle [radius=1];
%\coordinate(a) at (0:1) {};
%\coordinate(b) at ({360/5}:1) {};
%\coordinate(c) at ({2*360/5}:1) {};
%\coordinate(d) at ({3*360/5}:1) {};
%\coordinate(e) at ({4*360/5}:1) {};
%\coordinate(ap) at (0:1.6) {};
%\coordinate(bp) at ({360/5}:1.6) {};
%\coordinate(cp) at ({2*360/5}:1.6) {};
%\coordinate(dp) at ({3*360/5}:1.6) {};
%\coordinate(ep) at ({4*360/5}:1.6) {};
%\fill(a) circle (1pt) node[right] {$1$};
%\fill(b) circle (1pt) node[above right] {$1$};
%\fill(c) circle (1pt) node[above left] {$1$};
%\fill(d) circle (1pt) node[left] {$1$};
%\fill(e) circle (1pt) node[below] {$1$};
%\draw
%[red, ->>, very thick] (ap) arc[radius=1.5, start angle=0, end angle=-20];
%\draw[red, ->>, very thick] (bp) arc[radius=1.5, start angle={360/5}%
%, end angle={360/5+20}];
%\node at (2.5, 0) {$\to$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\draw(0,0) circle [radius=1];
\coordinate(a) at (0:1) {};
\coordinate(b) at ({360/5}:1) {};
\coordinate(c) at ({2*360/5}:1) {};
\coordinate(d) at ({3*360/5}:1) {};
\coordinate(e) at ({4*360/5}:1) {};
\coordinate(ap) at (0:1.6) {};
\coordinate(bp) at ({360/5}:1.6) {};
\coordinate(cp) at ({2*360/5}:1.6) {};
\coordinate(dp) at ({3*360/5}:1.6) {};
\coordinate(ep) at ({4*360/5}:1.6) {};
\fill(a) circle (1pt) node[right] {$1$};
\fill(b) circle (1pt) node[above right] {$1$};
\fill(c) circle (1pt) node[above left] {$1$};
\fill(d) circle (1pt) node[left] {$1$};
\fill(e) circle (1pt) node[below] {$1$};
\draw
[red, ->>, very thick] (ap) arc[radius=1.5, start angle=0, end angle=-20];
\draw[red, ->>, very thick] (bp) arc[radius=1.5, start angle={360/5}%
, end angle={360/5+20}];
\node at (2.5, 0) {$\to$};
\end{tikzpicture}%
%EndExpansion
&  &
%TCIMACRO{\TeXButton{tikz sparrows 1}{\begin{tikzpicture}[scale=1.5]
%\draw(0,0) circle [radius=1];
%\coordinate(a) at (0:1) {};
%\coordinate(b) at ({360/5}:1) {};
%\coordinate(c) at ({2*360/5}:1) {};
%\coordinate(d) at ({3*360/5}:1) {};
%\coordinate(e) at ({4*360/5}:1) {};
%\coordinate(ap) at (0:1.6) {};
%\coordinate(bp) at ({360/5}:1.6) {};
%\coordinate(cp) at ({2*360/5}:1.6) {};
%\coordinate(dp) at ({3*360/5}:1.6) {};
%\coordinate(ep) at ({4*360/5}:1.6) {};
%\fill(a) circle (1pt) node[right] {$0$};
%\fill(b) circle (1pt) node[above right] {$0$};
%\fill(c) circle (1pt) node[above left] {$2$};
%\fill(d) circle (1pt) node[left] {$1$};
%\fill(e) circle (1pt) node[below] {$2$};
%\draw[red, ->>, very thick] (ep) arc[radius=1.5, start angle={-360/5}%
%, end angle={-360/5-20}];
%\draw[red, ->>, very thick] (cp) arc[radius=1.5, start angle={2*360/5}%
%, end angle={2*360/5+20}];
%\node at (2.5, 0) {$\to$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\draw(0,0) circle [radius=1];
\coordinate(a) at (0:1) {};
\coordinate(b) at ({360/5}:1) {};
\coordinate(c) at ({2*360/5}:1) {};
\coordinate(d) at ({3*360/5}:1) {};
\coordinate(e) at ({4*360/5}:1) {};
\coordinate(ap) at (0:1.6) {};
\coordinate(bp) at ({360/5}:1.6) {};
\coordinate(cp) at ({2*360/5}:1.6) {};
\coordinate(dp) at ({3*360/5}:1.6) {};
\coordinate(ep) at ({4*360/5}:1.6) {};
\fill(a) circle (1pt) node[right] {$0$};
\fill(b) circle (1pt) node[above right] {$0$};
\fill(c) circle (1pt) node[above left] {$2$};
\fill(d) circle (1pt) node[left] {$1$};
\fill(e) circle (1pt) node[below] {$2$};
\draw[red, ->>, very thick] (ep) arc[radius=1.5, start angle={-360/5}%
, end angle={-360/5-20}];
\draw[red, ->>, very thick] (cp) arc[radius=1.5, start angle={2*360/5}%
, end angle={2*360/5+20}];
\node at (2.5, 0) {$\to$};
\end{tikzpicture}%
%EndExpansion
\\
&  & \\
&  & \\%
%TCIMACRO{\TeXButton{tikz sparrows 2}{\begin{tikzpicture}[scale=1.5]
%\draw(0,0) circle [radius=1];
%\coordinate(a) at (0:1) {};
%\coordinate(b) at ({360/5}:1) {};
%\coordinate(c) at ({2*360/5}:1) {};
%\coordinate(d) at ({3*360/5}:1) {};
%\coordinate(e) at ({4*360/5}:1) {};
%\coordinate(ap) at (0:1.6) {};
%\coordinate(bp) at ({360/5}:1.6) {};
%\coordinate(cp) at ({2*360/5}:1.6) {};
%\coordinate(dp) at ({3*360/5}:1.6) {};
%\coordinate(ep) at ({4*360/5}:1.6) {};
%\fill(a) circle (1pt) node[right] {$0$};
%\fill(b) circle (1pt) node[above right] {$0$};
%\fill(c) circle (1pt) node[above left] {$1$};
%\fill(d) circle (1pt) node[left] {$3$};
%\fill(e) circle (1pt) node[below] {$1$};
%\draw[red, ->>, very thick] (ep) arc[radius=1.5, start angle={-360/5}%
%, end angle={-360/5-20}];
%\draw[red, ->>, very thick] (cp) arc[radius=1.5, start angle={2*360/5}%
%, end angle={2*360/5+20}];
%\node at (2.5, 0) {$\to$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\draw(0,0) circle [radius=1];
\coordinate(a) at (0:1) {};
\coordinate(b) at ({360/5}:1) {};
\coordinate(c) at ({2*360/5}:1) {};
\coordinate(d) at ({3*360/5}:1) {};
\coordinate(e) at ({4*360/5}:1) {};
\coordinate(ap) at (0:1.6) {};
\coordinate(bp) at ({360/5}:1.6) {};
\coordinate(cp) at ({2*360/5}:1.6) {};
\coordinate(dp) at ({3*360/5}:1.6) {};
\coordinate(ep) at ({4*360/5}:1.6) {};
\fill(a) circle (1pt) node[right] {$0$};
\fill(b) circle (1pt) node[above right] {$0$};
\fill(c) circle (1pt) node[above left] {$1$};
\fill(d) circle (1pt) node[left] {$3$};
\fill(e) circle (1pt) node[below] {$1$};
\draw[red, ->>, very thick] (ep) arc[radius=1.5, start angle={-360/5}%
, end angle={-360/5-20}];
\draw[red, ->>, very thick] (cp) arc[radius=1.5, start angle={2*360/5}%
, end angle={2*360/5+20}];
\node at (2.5, 0) {$\to$};
\end{tikzpicture}%
%EndExpansion
&  &
%TCIMACRO{\TeXButton{tikz sparrows 3}{\begin{tikzpicture}[scale=1.5]
%\draw(0,0) circle [radius=1];
%\coordinate(a) at (0:1) {};
%\coordinate(b) at ({360/5}:1) {};
%\coordinate(c) at ({2*360/5}:1) {};
%\coordinate(d) at ({3*360/5}:1) {};
%\coordinate(e) at ({4*360/5}:1) {};
%\coordinate(ap) at (0:1.6) {};
%\coordinate(bp) at ({360/5}:1.6) {};
%\coordinate(cp) at ({2*360/5}:1.6) {};
%\coordinate(dp) at ({3*360/5}:1.6) {};
%\coordinate(ep) at ({4*360/5}:1.6) {};
%\fill(a) circle (1pt) node[right] {$0$};
%\fill(b) circle (1pt) node[above right] {$0$};
%\fill(c) circle (1pt) node[above left] {$0$};
%\fill(d) circle (1pt) node[left] {$5$};
%\fill(e) circle (1pt) node[below] {$0$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\draw(0,0) circle [radius=1];
\coordinate(a) at (0:1) {};
\coordinate(b) at ({360/5}:1) {};
\coordinate(c) at ({2*360/5}:1) {};
\coordinate(d) at ({3*360/5}:1) {};
\coordinate(e) at ({4*360/5}:1) {};
\coordinate(ap) at (0:1.6) {};
\coordinate(bp) at ({360/5}:1.6) {};
\coordinate(cp) at ({2*360/5}:1.6) {};
\coordinate(dp) at ({3*360/5}:1.6) {};
\coordinate(ep) at ({4*360/5}:1.6) {};
\fill(a) circle (1pt) node[right] {$0$};
\fill(b) circle (1pt) node[above right] {$0$};
\fill(c) circle (1pt) node[above left] {$0$};
\fill(d) circle (1pt) node[left] {$5$};
\fill(e) circle (1pt) node[below] {$0$};
\end{tikzpicture}%
%EndExpansion
\end{array}
\]
(where the five points are the five trees, and the number at each point is
counting the sparrows on that tree; furthermore, the red arrows are showing
where the sparrows will move in the next step).]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.sparrows} (sketched).]Yes if $n$ is odd; no
if $n$ is even.

\textit{Proof.} The pair of simultaneous moves that happens every minute
(i.e., one sparrow moving one tree clockwise, and another sparrow moving one
tree counterclockwise) will be called a \textit{bimove}. Thus, we must prove
the following two claims:

\begin{statement}
\textit{Claim 1:} Assume that $n$ is odd. Then, there is a sequence of bimoves
that results in all sparrows sitting on the same tree.
\end{statement}

\begin{statement}
\textit{Claim 2:} Assume that $n$ is even. Then, there is no sequence of
bimoves that results in all sparrows sitting on the same tree.
\end{statement}

[\textit{Proof of Claim 1:} The following is a generalization of the movements
shown in the example in the statement of the exercise.

We write $n$ in the form $n=2m+1$ for some $m\in\mathbb{N}$. (Such an $m$ can
be found, since $n$ is an odd positive integer.) Thus, we have $2m+1$ trees.
We label these trees with the numbers $-m,-m+1,\ldots,m-1,m$ in clockwise
order (starting at some randomly chosen tree). Initially, each tree has one
sparrow sitting in it.

Now, the sparrows make the following bimoves:

\begin{itemize}
\item First, the sparrow on tree $-m$ and the sparrow on tree $m$ move to the
trees $-m+1$ and $m-1$, respectively\footnote{These movements can be achieved
by a single bimove, since tree $-m+1$ is the next tree from tree $-m$ in
clockwise order, whereas tree $m-1$ is the next tree from tree $m$ in
counterclockwise order.}. Now, trees $-m$ and $m$ are empty.

\item Now, we have two sparrows on tree $-m+1$ and two sparrows on tree $m-1$.
These four sparrows move to the trees $-m+2$ and $m-2$ (first one pair, then
the other)\footnote{These movements can be achieved by two bimoves, since tree
$-m+2$ is the next tree from tree $-m+1$ in clockwise order, whereas tree
$m-2$ is the next tree from tree $m-1$ in counterclockwise order.}. Now, trees
$-m+1$ and $m-1$ are empty.

\item Now, we have three sparrows on tree $-m+2$ and three sparrows on tree
$m-2$. These six sparrows move to the trees $-m+3$ and $m-3$ (first one pair,
then another, then the last remaining pair). Now, trees $-m+2$ and $m-2$ are empty.

\item Now, we have four sparrows on tree $-m+3$ and four sparrows on tree
$m-3$. These eight sparrows move to the trees $-m+4$ and $m-4$ (in pairs of
two). Now, trees $-m+3$ and $m-3$ are empty.

\item And so on, until all trees other than tree $0$ are empty. At this point,
all sparrows have arrived on tree $0$.
\end{itemize}

Thus, Claim 1 is proven.]

[\textit{Proof of Claim 2:} Let us label the $n$ trees with the numbers
$1,2,\ldots,n$ in clockwise order (starting at some randomly chosen tree). A
placement of sparrows on trees (with each sparrow being on one tree) will be
called a \textit{state}. Thus, our initial state has one sparrow on each of
the trees $1,2,\ldots,n$.

If $S$ is a state, then we define the \textit{charge} $c\left(  S\right)  $ of
$S$ to be the sum%
\[
\sum_{s\text{ is a sparrow}}t_{S}\left(  s\right)  ,
\]
where $t_{S}\left(  s\right)  $ is the number of the tree on which the sparrow
$s$ sits in the state $S$. Thus, the charge of the initial state is
$1+2+\cdots+n$ (since the sparrows in the initial state sit on the trees
$1,2,\ldots,n$).

Clearly, a bimove transforms a state into another state. Now, the crucial
observation is the following: When a state is transformed by a bimove, the
charge of the state either does not change or changes by $n$ (in one or the
other direction). In order to convince ourselves of this, we let $\alpha$ and
$\beta$ be the two sparrows that move in the bimove (where $\alpha$ is the
sparrow that moves clockwise, and $\beta$ is the sparrow that moves
counterclockwise), and we let $i$ and $j$ be the two trees on which they were
sitting before the bimove. Now, we analyze four possible cases:

\begin{itemize}
\item If $i<n$ and $j>1$, then the sparrows $\alpha$ and $\beta$ are sitting
on trees $i+1$ and $j-1$ after the bimove. Thus, in this case, the charge of
the state increases by $\left(  i+1\right)  +\left(  j-1\right)  -i-j=0$. In
other words, the charge does not change.

\item If $i=n$ and $j>1$, then the sparrows $\alpha$ and $\beta$ are sitting
on trees $1$ and $j-1$ after the bimove. Thus, in this case, the charge of the
state increases by\footnote{The word \textquotedblleft
increase\textquotedblright\ is being understood in the wide sense here: To
increase a number by $k$ means to add $k$ to the number, whether or not $k$ is
positive. Thus, \textquotedblleft increase by $-5$\textquotedblright\ is
simply another way to say \textquotedblleft decrease by $5$\textquotedblright%
.} $1+\left(  j-1\right)  -i-j=-i=-n$ (since $i=n$). In other words, the
charge decreases by $n$.

\item If $i<n$ and $j=1$, then the sparrows $\alpha$ and $\beta$ are sitting
on trees $i+1$ and $n$ after the bimove. Thus, in this case, the charge of the
state increases by $\left(  i+1\right)  +n-i-j=n+1-\underbrace{j}%
_{=1}=n+1-1=n$. In other words, the charge increases by $n$.

\item If $i=n$ and $j=1$, then the sparrows $\alpha$ and $\beta$ are sitting
on trees $1$ and $n$ after the bimove. Thus, in this case, the charge of the
state increases by $1+n-\underbrace{i}_{=n}-\underbrace{j}_{=1}=1+n-n-1=0$. In
other words, the charge does not change.
\end{itemize}

\noindent Thus, in each of the four cases, the charge either does not change
or changes by $n$. Therefore, the charge after the bimove is congruent to the
charge before the bimove modulo $n$. In other words, the two charges leave the
same remainder when divided by $n$.

Thus we have shown that a bimove does not change the remainder that the charge
of the state leaves when divided by $n$. Since the charge of the initial state
is $1+2+\cdots+n$, we thus conclude that the charge of any state that can be
achieved by a sequence of bimoves will still leave the same remainder when
divided by $n$ as $1+2+\cdots+n$ does.

Now, let us look at a state where all sparrows sit on the same tree. If this
tree is tree $i$, then the charge of the state is $\sum_{s\text{ is a
sparrow}}i=ni$ (since there are $n$ sparrows). Thus, if we can achieve this
state by a sequence of bimoves, then $ni$ must leave the same remainder when
divided by $n$ as $1+2+\cdots+n$ does (according to the previous paragraph).
In other words, if we can achieve this state by a sequence of bimoves, then we
must have $ni\equiv1+2+\cdots+n\operatorname{mod}n$. Therefore, if we can
achieve this state by a sequence of bimoves, then we must have $1+2+\cdots
+n\equiv ni\equiv0\operatorname{mod}n$ (since $n\mid ni$).

However, we do \textbf{not} have $1+2+\cdots+n\equiv0\operatorname{mod}n$.
Indeed, we have%
\begin{align*}
1+2+\cdots+n  &  =\dfrac{n\left(  n+1\right)  }{2}=\underbrace{\dfrac{n}{2}%
}_{\substack{\text{This is an integer}\\\text{(since }n\text{ is even)}}%
}\cdot\left(  \underbrace{n}_{\equiv0\operatorname{mod}n}+1\right)
\equiv\dfrac{n}{2}\cdot\underbrace{\left(  0+1\right)  }_{=1}\\
&  =\dfrac{n}{2}\not \equiv 0\operatorname{mod}n.
\end{align*}
Thus, the previous paragraph lets us conclude that we \textbf{cannot} achieve
a state where all sparrows sit on the same tree. This proves Claim 2.]

Thus, Exercise \ref{exe.inv.sparrows} is solved.
\end{proof}

Here is another classical exercise:

\begin{exercise}
\label{exe.inv.lamps1}Let $n\geq3$ and $m\geq3$ be two integers. You have a
rectangular $n\times m$-grid of lamps (i.e., a table with $n$ rows and $m$
columns, with a lamp in each of its $nm$ cells). Initially, all $nm$ lamps are
off. In a move, you can choose a row or a column of the grid, and flip all
lamps in this row or column. (To \textquotedblleft flip\textquotedblright\ a
lamp means to turn it on if it was off, and to turn it off if it was on.) Can
you, by some sequence of moves, obtain a state in which the four corner lamps
(i.e., the lamps in the four corner cells of the grid) are on whereas all
remaining lamps are off?

[\textbf{Example:} Let us represent a lamp turned off by the number $0$, and a
lamp turned on by the number $1$. Then, for $n=3$ and $m=4$, here is the
starting state:%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$0$ & $0$ & $0$ & $0$\\\hline
$0$ & $0$ & $0$ & $0$\\\hline
$0$ & $0$ & $0$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
One possible move is to flip all lamps in the third column (from the left).
This results in%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$0$ & $0$ & $1$ & $0$\\\hline
$0$ & $0$ & $1$ & $0$\\\hline
$0$ & $0$ & $1$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
From this state, one possible further move is to flip all lamps in the second
row. This results in%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$0$ & $0$ & $1$ & $0$\\\hline
$1$ & $1$ & $0$ & $1$\\\hline
$0$ & $0$ & $1$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ .
\]
(Note that the third lamp in the second row is now turned off again, since it
has been flipped twice.)]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.lamps1} (sketched).]No, you cannot.

\textit{Proof.} Consider the four lamps in the upper-left corner (i.e., at the
intersection of the topmost two rows with the leftmost two columns). Call
these four lamps the \textit{special lamps}. For example, in the case when
$n=3$ and $m=4$, here are the four special lamps (marked with asterisks):%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$\ast$ & $\ast$ & $\phantom{*}$ & $\phantom{*}$\\\hline
$\ast$ & $\ast$ &  & \\\hline
&  &  & \\\hline
\end{tabular}
\ \
\]
Each move either leaves the states of the four special lamps unchanged, or
flips exactly two of them\footnote{Indeed, this can be verified case by case:
\par
\begin{itemize}
\item If the move flips one of the topmost two rows, then exactly two special
lamps get flipped.
\par
\item If the move flips any other row, then none of the special lamps get
flipped, so the states of the four special lamps remain unchanged.
\par
\item If the move flips one of the leftmost two columns, then exactly two
special lamps get flipped.
\par
\item If the move flips any other column, then none of the special lamps get
flipped, so the states of the four special lamps remain unchanged.
\end{itemize}
}. Thus, the number of special lamps that are on either remains unchanged or
changes by $2$ (in one or the other direction) when a move is
made\footnote{\textit{Proof:} Consider a move. As we have just seen, this move
either leaves the states of the four special lamps unchanged, or flips exactly
two of them. If it leaves the states of the four special lamps unchanged, then
the number of special lamps that are on clearly remains unchanged. On the
other hand, if the move flips exactly two of the four special lamps, then the
number of special lamps that are on increases by $2$ (if the two special lamps
it flips were both off) or decreases by $2$ (if the two special lamps it flips
were both on) or remains unchanged (if the two special lamps it flips were in
different states -- i.e., one of them was on and the other was off).}.
Therefore, the parity of this number never changes (i.e., if it was even, then
it stays even; if it was odd, then it stays odd). But at the onset, this
number was even (because at the onset, all four special lamps were off).
Hence, after any sequence of moves, the number of special lamps that are on
will remain even. Thus, in particular, it is impossible to achieve a state in
which the four corner lamps are on whereas all remaining lamps are off
(because such a state would have exactly $1$ special lamp that is
on\footnote{Here we are using the assumptions $n\geq3$ and $m\geq3$. If you
don't see why, ask yourself why only one of the four corner lamps is
special!}). This solves Exercise \ref{exe.inv.lamps1}.
\end{proof}

\begin{remark}
Let us consider the lamp-flipping \textquotedblleft game\textquotedblright%
\ from Exercise \ref{exe.inv.lamps1} a bit further. What is the total number
of possible states that can be achieved by a sequence of moves (starting with
the initial state in which all lamps are turned off)?

Here is an outline of a solution to this question. We shall refer to rows and
columns of our grid as \textit{lines}. Thus, the grid has $n+m$ lines in total
(viz., its $n$ rows and its $m$ columns). It is easy to see that the order of
moves does not matter: If we are flipping two lines, it does not matter which
of them we are flipping first. (Here, \textquotedblleft flipping a
line\textquotedblright\ means flipping every lamp on this line.) Furthermore,
if we flip a line twice, we return to the state we had before the flipping
(because every lamp on the line has been flipped twice). Thus, any state that
can be achieved by a sequence of moves can also be achieved by a sequence of
moves in which each line is flipped at most once. Moreover, the order of the
moves does not matter. The total number of such sequences (without accounting
for the order of moves) is $2^{n+m}$, since we just need to decide which of
the $n+m$ lines we flip. However, not all of the $2^{n+m}$ such sequences
result in different states; for example, if we flip \textbf{every} line, the
result is the original state (as if we hadn't flipped anything). It turns out
that flipping the last column is unnecessary: The effect of flipping the last
column is identical with the effect of flipping all remaining lines. Hence, we
only need to consider sequences of moves in which each line is flipped at most
once, and the last column is not flipped at all. There are $2^{n+m-1}$ such
sequences, and moreover it can be shown that they all produce different
states. (Why? Hint: Look at the effect on the last column.)

Hence, the total number of states that can be achieved by a sequence of moves
is $2^{n+m-1}$. This is a far cry from the total number of possible states
(which is $2^{nm}$, since each of the $nm$ lamps can be either on or off).
\end{remark}

The next exercise is \cite[Chapter 1, Example E2]{Engel}:

\begin{exercise}
\label{exe.inv.engel-1E2}Let $n$ be an odd positive integer. You have the $2n$
numbers $1,2,\ldots,2n$ written on a blackboard. In one move, you can erase
two numbers $a$ and $b$ and write the number $\left\vert a-b\right\vert $
instead. You keep doing this until only one number remains. Prove that this
remaining number will be odd.
\end{exercise}

\begin{proof}
[First solution to Exercise \ref{exe.inv.engel-1E2} (sketched).]In the initial
state of the blackboard (i.e., before you make any moves), all numbers on the
blackboard are integers (in fact, they are $1,2,\ldots,2n$ in the initial
state). Thus, even after you start making moves, all numbers on the blackboard
remain integers (because any move applied to integers only produces integers).

We define the \textit{board sum} to be the sum of all numbers on the
blackboard. In the initial state of the blackboard, this board sum is
\begin{align*}
1+2+\cdots+2n  &  =\dfrac{2n\left(  2n+1\right)  }{2}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.ind.little-gauss}), applied to
}2n\text{ instead of }n\right) \\
&  =\underbrace{n}_{\substack{\equiv1\operatorname{mod}2\\\text{(since
}n\text{ is odd)}}}\left(  \underbrace{2n}_{\equiv0\operatorname{mod}%
2}+1\right)  \equiv1\left(  0+1\right)  =1\operatorname{mod}2.
\end{align*}
In other words, in the initial state, the board sum is odd.

Now, it is not hard to see that (in general) a move will change the board sum.
However, the \textbf{parity} of the board sum will remain unchanged. In order
to see this, we need a few auxiliary observations: We first notice that every
integer $x$ satisfies%
\begin{equation}
\left\vert x\right\vert \equiv x\operatorname{mod}2.
\label{sol.inv.engel-1E2.absx}%
\end{equation}
(Indeed, if $x$ is an integer, then $\left\vert x\right\vert $ is always
either $x$ or $-x$; however, both $x$ and $-x$ are congruent to $x$ modulo
$2$. Thus, (\ref{sol.inv.engel-1E2.absx}) follows.) Now, if $a$ and $b$ are
any two integers, then we have%
\[
-a-b+\underbrace{\left\vert a-b\right\vert }_{\substack{\equiv
a-b\operatorname{mod}2\\\text{(by (\ref{sol.inv.engel-1E2.absx})}%
\\\text{(applied to }x=a-b\text{))}}}\equiv-a-b+\left(  a-b\right)
=-2b\equiv0\operatorname{mod}2,
\]
and thus%
\begin{equation}
\text{the integer }-a-b+\left\vert a-b\right\vert \text{ is even.}
\label{sol.inv.engel-1E2.-a-b}%
\end{equation}
Now, if you apply a move, then you erase two numbers $a$ and $b$ from the
blackboard and write the number $\left\vert a-b\right\vert $ instead; as a
result, the board sum increases\footnote{The word \textquotedblleft
increase\textquotedblright\ is being understood in the wide sense here: To
increase a number by $k$ means to add $k$ to the number, whether or not $k$ is
positive. Thus, \textquotedblleft increase by $-5$\textquotedblright\ is
simply another way to say \textquotedblleft decrease by $5$\textquotedblright%
.} by $-a-b+\left\vert a-b\right\vert $. Since $-a-b+\left\vert a-b\right\vert
$ is even (by (\ref{sol.inv.engel-1E2.-a-b}), because $a$ and $b$ are
integers), this entails that the board sum increases by an even integer.
Hence, the parity of the board sum does not change.

Now, we have seen two things:

\begin{itemize}
\item In the initial state, the board sum is odd.

\item The parity of the board sum does not change when we make a move.
\end{itemize}

Hence, after any number of moves, the board sum remains odd. Thus, the board
sum will still be odd at the very end of the process, when there is only one
number left on the blackboard. But this means that the number left on the
blackboard is odd (because the board sum at that point will be that single
number). Thus, Exercise \ref{exe.inv.engel-1E2} is solved.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.inv.engel-1E2} (sketched).]Just as in
the first solution above, we can see that all the numbers on the blackboard
remain integers (even after you start making moves).

The \textit{odd-count} will mean the number of odd numbers on the blackboard.
In the initial state of the blackboard, this odd-count is $n$, since exactly
$n$ of the $2n$ numbers $1,2,\ldots,2n$ are odd. Now, how does the odd-count
change when a move is applied?

\begin{itemize}
\item If you apply a move that erases an \textbf{even} number $a$ and an
\textbf{even} number $b$, then the new number $\left\vert a-b\right\vert $
written on the board in this move is even (since $a$ and $b$ are even, so that
$a-b$ is even), and thus the odd-count remains the same (since no odd numbers
were erased and no odd numbers were written).

\item If you apply a move that erases an \textbf{even} number $a$ and an
\textbf{odd} number $b$, then the new number $\left\vert a-b\right\vert $
written on the board in this move is odd (since $a$ is even and $b$ is odd, so
that $a-b$ is odd), and thus the odd-count remains the same (since one odd
number was erased and one odd number was written).

\item If you apply a move that erases an \textbf{odd} number $a$ and an
\textbf{even} number $b$, then the odd-count also remains the same (this is
proved just as the preceding claim).

\item If you apply a move that erases an \textbf{odd} number $a$ and an
\textbf{odd} number $b$, then the new number $\left\vert a-b\right\vert $
written on the board in this move is even (since $a$ and $b$ are odd, so that
$a-b$ is even), and thus the odd-count decreases by $2$ (since two odd numbers
were erased but no odd numbers were written).
\end{itemize}

Combining these four observations, we see that if you apply a move, then the
odd-count either remains the same or decreases by $2$. Thus, the parity of the
odd-count never changes. But we know that the odd-count was odd in the initial
state (in fact, the odd-count was $n$ in the initial state, but $n$ is odd).
Hence, the odd-count must remain odd throughout the process (since its parity
never changes). Hence, at the end of the process, when there is only one
number left on the blackboard, the odd-count will still be odd. But this means
that the number left on the blackboard is odd (because if it was even, then
there would be no odd number left on the blackboard; but this would cause the
odd-count to be $0$, which would contradict the fact that it is odd). This
solves Exercise \ref{exe.inv.engel-1E2} again.
\end{proof}

Finally, here is a quickie problem (a popular puzzle in Russia,
\href{https://problems.ru/view_problem_details_new.php?id=35045}{commonly
ascribed to I. M. Gelfand}) which shows that even the simplest processes can
have useful invariants:

\begin{exercise}
\label{exe.inf.tea-milk}A milk cup contains $200\operatorname*{ml}$ of milk; a
tea cup contains $200\operatorname*{ml}$ of tea. You take a full spoon of milk
from the milk cup and pour it into the tea cup; then you stir the latter cup.
Then you take a full spoon of milk-tea mixture from the tea cup and pour it
back into the milk cup. What is larger now: the amount of milk in the tea cup,
or the amount of tea in the milk cup?
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inf.tea-milk} (sketched).]The two amounts are
the same.

\textit{Proof.} Let us introduce some notations:

\begin{itemize}
\item Let $m$ be the amount of milk in the milk cup (after the pourings have
been done).

\item Let $m^{\prime}$ be the amount of milk in the tea cup (after the
pourings have been done).

\item Let $t$ be the amount of tea in the tea cup (after the pourings have
been done).

\item Let $t^{\prime}$ be the amount of tea in the milk cup (after the
pourings have been done).
\end{itemize}

We thus need to show that $m^{\prime}=t^{\prime}$.

Invariants come to our help here: The total quantity of milk does not change;
thus, $m+m^{\prime}=200\operatorname*{ml}$ (since the total quantity of milk
was $200\operatorname*{ml}$ before the pourings, and is now $m+m^{\prime}$
after the pourings). Similarly, $t+t^{\prime}=200\operatorname*{ml}$. Hence,
$m+m^{\prime}=200\operatorname*{ml}=t+t^{\prime}$. Also, the two cups have the
same quantity of fluid (after the pourings have been done), because one full
spoon was transferred from one to the other and then one full spoon was
transferred backwards (so each cup has lost as much fluid as it has gained).
Hence, $m+t^{\prime}=t+m^{\prime}$ (since $m+t^{\prime}$ is the quantity of
fluid in the milk cup, and $t+m^{\prime}$ is the quantity of fluid in the tea
cup). In other words, $m-m^{\prime}=t-t^{\prime}$. Subtracting this equality
from $m+m^{\prime}=t+t^{\prime}$, we obtain $\left(  m+m^{\prime}\right)
-\left(  m-m^{\prime}\right)  =\left(  t+t^{\prime}\right)  -\left(
t-t^{\prime}\right)  $. This simplifies to $2m^{\prime}=2t^{\prime}$. In other
words, $m^{\prime}=t^{\prime}$. This proves our claim.

[\textit{Remark:} Note that it doesn't matter whether the tea and the milk in
the tea cup have mixed properly when we stirred them! Even if the spoon we
have taken back from the tea cup was mostly milk, the argument still remains
valid, and the answer is the same.]
\end{proof}

\subsubsection{\label{subsect.inv.inv.intseq}Applications to sequence
integrality}

Let us now briefly return to a topic we have already discussed before
(particularly in Section \ref{sect.seqsum.more-int}): the phenomenon in which
a sequence defined recursively turns out to consist of integers even though
its recursive definition involves division. We shall now see a few more
instances of this phenomenon; it turns out that invariants can be quite useful
in proving these.

We begin with the following (\cite[Chapter 4, (2)]{Gale98}):

\begin{exercise}
\label{exe.inv.intseq.gale1}Fix a positive integer $k\geq2$. Define a sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of positive rational numbers
recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale1.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{a_{n-1}^{2}+a_{n-2}^{2}+\cdots+a_{n-k+1}^{2}}{a_{n-k}%
}\label{eq.exe.inv.intseq.gale1.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}
(For example, $a_{k}=\dfrac{a_{k-1}^{2}+a_{k-2}^{2}+\cdots+a_{1}^{2}}{a_{0}%
}=\dfrac{1^{2}+1^{2}+\cdots+1^{2}}{1}=k-1$.)

Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.intseq.gale1}.]Let us first play around
with the recursive equation (\ref{eq.exe.inv.intseq.gale1.rec}).

Let $n$ be an integer such that $n\geq k+1$. Thus, $n\geq n-1\geq k$ (since
$n\geq k+1$). Hence, the equality (\ref{eq.exe.inv.intseq.gale1.rec}) holds.
Multiplying both sides of this equality by $a_{n-k}$, we obtain%
\begin{equation}
a_{n}a_{n-k}=a_{n-1}^{2}+a_{n-2}^{2}+\cdots+a_{n-k+1}^{2}.
\label{sol.inv.intseq.gale1.rec1}%
\end{equation}
The same argument (applied to $n-1$ instead of $n$) yields%
\begin{align*}
a_{n-1}a_{\left(  n-1\right)  -k}  &  =\underbrace{a_{\left(  n-1\right)
-1}^{2}}_{=a_{n-2}^{2}}+\underbrace{a_{\left(  n-1\right)  -2}^{2}}%
_{=a_{n-3}^{2}}+\cdots+\underbrace{a_{\left(  n-1\right)  -k+1}^{2}}%
_{=a_{n-k}^{2}}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n-1\geq k\right) \\
&  =a_{n-2}^{2}+a_{n-3}^{2}+\cdots+a_{n-k}^{2}.
\end{align*}
In view of $\left(  n-1\right)  -k=n-k-1$, this rewrites as%
\[
a_{n-1}a_{n-k-1}=a_{n-2}^{2}+a_{n-3}^{2}+\cdots+a_{n-k}^{2}.
\]
Subtracting this equality from (\ref{sol.inv.intseq.gale1.rec1}), we obtain%
\begin{align*}
a_{n}a_{n-k}-a_{n-1}a_{n-k-1}  &  =\underbrace{\left(  a_{n-1}^{2}+a_{n-2}%
^{2}+\cdots+a_{n-k+1}^{2}\right)  }_{=a_{n-1}^{2}+\left(  a_{n-2}^{2}%
+a_{n-3}^{2}+\cdots+a_{n-k+1}^{2}\right)  }-\underbrace{\left(  a_{n-2}%
^{2}+a_{n-3}^{2}+\cdots+a_{n-k}^{2}\right)  }_{=\left(  a_{n-2}^{2}%
+a_{n-3}^{2}+\cdots+a_{n-k+1}^{2}\right)  +a_{n-k}^{2}}\\
&  =\left(  a_{n-1}^{2}+\left(  a_{n-2}^{2}+a_{n-3}^{2}+\cdots+a_{n-k+1}%
^{2}\right)  \right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  \left(  a_{n-2}^{2}+a_{n-3}^{2}+\cdots
+a_{n-k+1}^{2}\right)  +a_{n-k}^{2}\right) \\
&  =a_{n-1}^{2}-a_{n-k}^{2}.
\end{align*}
Adding $a_{n-1}a_{n-k-1}+a_{n-k}^{2}$ to both sides of this equality, we
obtain%
\[
a_{n}a_{n-k}+a_{n-k}^{2}=a_{n-1}^{2}+a_{n-1}a_{n-k-1}.
\]
Thus,%
\[
a_{n-k}\left(  a_{n}+a_{n-k}\right)  =a_{n}a_{n-k}+a_{n-k}^{2}=a_{n-1}%
^{2}+a_{n-1}a_{n-k-1}=a_{n-1}\left(  a_{n-1}+a_{n-k-1}\right)  .
\]
Dividing both sides of this equality by $a_{n-1}a_{n-2}\cdots a_{n-k}$, we
obtain%
\[
\dfrac{a_{n-k}\left(  a_{n}+a_{n-k}\right)  }{a_{n-1}a_{n-2}\cdots a_{n-k}%
}=\dfrac{a_{n-1}\left(  a_{n-1}+a_{n-k-1}\right)  }{a_{n-1}a_{n-2}\cdots
a_{n-k}}.
\]
This rewrites as%
\begin{equation}
\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}=\dfrac{a_{n-1}%
+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k}} \label{sol.inv.intseq.gale1.rec4}%
\end{equation}
\footnote{because
\begin{align*}
\dfrac{a_{n-k}\left(  a_{n}+a_{n-k}\right)  }{a_{n-1}a_{n-2}\cdots a_{n-k}}
&  =\dfrac{a_{n-k}\left(  a_{n}+a_{n-k}\right)  }{\left(  a_{n-1}a_{n-2}\cdots
a_{n-k-1}\right)  a_{n-k}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{n-1}a_{n-2}\cdots
a_{n-k}=\left(  a_{n-1}a_{n-2}\cdots a_{n-k-1}\right)  a_{n-k}\right) \\
&  =\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}%
\end{align*}
and%
\begin{align*}
\dfrac{a_{n-1}\left(  a_{n-1}+a_{n-k-1}\right)  }{a_{n-1}a_{n-2}\cdots
a_{n-k}}  &  =\dfrac{a_{n-1}\left(  a_{n-1}+a_{n-k-1}\right)  }{a_{n-1}\left(
a_{n-2}a_{n-3}\cdots a_{n-k}\right)  }\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{n-1}a_{n-2}\cdots
a_{n-k}=a_{n-1}\left(  a_{n-2}a_{n-3}\cdots a_{n-k}\right)  \right) \\
&  =\dfrac{a_{n-1}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k}}%
\end{align*}
}.

Now, the equality (\ref{sol.inv.intseq.gale1.rec4}) has a rather nice
property: The subscripts on the right hand side are precisely by $1$ lower
than the corresponding subscripts on the left hand side! In other words, if we
denote the left hand side by $b_{n}$, then the right hand side will be
$b_{n-1}$. Thus, the equality (\ref{sol.inv.intseq.gale1.rec4}) is, in a way,
saying that the ratio $\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}$
is an \textquotedblleft invariant\textquotedblright\ of the sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $: it does not change as we \textquotedblleft
move up\textquotedblright\ the sequence (i.e., it does not change from $n-1$
to $n$).

Let us now formalize this. Forget that we fixed $n$. We thus have proved the
equality (\ref{sol.inv.intseq.gale1.rec4}) for each integer $n\geq k+1$.

Now, let us define a number%
\[
b_{n}=\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}%
\]
for each integer $n\geq k$. Thus, we have defined a sequence $\left(
b_{k},b_{k+1},b_{k+2},\ldots\right)  $ of rational numbers. It is easy to see
that
\begin{equation}
b_{k}=k \label{sol.inv.intseq.gale1.bk}%
\end{equation}
\footnote{\textit{Proof of (\ref{sol.inv.intseq.gale1.bk}):} For each
$i\in\left\{  1,2,\ldots,k-1\right\}  $, we have $i\leq k-1<k$ and therefore%
\begin{equation}
a_{i}=1 \label{sol.inv.intseq.gale1.bk.pf.1}%
\end{equation}
(by (\ref{eq.exe.inv.intseq.gale1.start}), applied to $n=i$). Hence,
$\prod_{i=1}^{k-1}\underbrace{a_{i}}_{\substack{=1\\\text{(by
(\ref{sol.inv.intseq.gale1.bk.pf.1}))}}}=\prod_{i=1}^{k-1}1=1$. Moreover,
$0<k$ (since $k\geq2>0$); thus, $a_{0}=1$ (by
(\ref{eq.exe.inv.intseq.gale1.start}), applied to $n=0$). Finally,
(\ref{eq.exe.inv.intseq.gale1.rec}) (applied to $n=k$) yields%
\begin{align*}
a_{k}  &  =\dfrac{a_{k-1}^{2}+a_{k-2}^{2}+\cdots+a_{k-k+1}^{2}}{a_{k-k}%
}=\dfrac{a_{k-1}^{2}+a_{k-2}^{2}+\cdots+a_{k-k+1}^{2}}{1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{k-k}=a_{0}=1\right) \\
&  =a_{k-1}^{2}+a_{k-2}^{2}+\cdots+a_{k-k+1}^{2}=a_{k-1}^{2}+a_{k-2}%
^{2}+\cdots+a_{1}^{2}=a_{1}^{2}+a_{2}^{2}+\cdots+a_{k-1}^{2}\\
&  =\sum_{i=1}^{k-1}\underbrace{a_{i}^{2}}_{\substack{=1^{2}\\\text{(since
(\ref{sol.inv.intseq.gale1.bk.pf.1}) yields }a_{i}=1\text{)}}}=\sum
_{i=1}^{k-1}\underbrace{1^{2}}_{=1}=\sum_{i=1}^{k-1}1=\left(  k-1\right)
\cdot1=k-1.
\end{align*}
\par
Now, the definition of $b_{k}$ yields%
\begin{align*}
b_{k}  &  =\dfrac{a_{k}+a_{k-k}}{a_{k-1}a_{k-2}\cdots a_{k-k+1}}=\left(
a_{k}+\underbrace{a_{k-k}}_{=a_{0}=1}\right)  /\underbrace{\left(
a_{k-1}a_{k-2}\cdots a_{k-k+1}\right)  }_{\substack{=a_{k-1}a_{k-2}\cdots
a_{1}\\=a_{1}a_{2}\cdots a_{k-1}=\prod_{i=1}^{k-1}a_{i}=1}}=\left(
a_{k}+1\right)  /1\\
&  =a_{k}+1=k\ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{k}=k-1\right)  .
\end{align*}
This proves (\ref{sol.inv.intseq.gale1.bk}).}.

Now, the equality (\ref{sol.inv.intseq.gale1.rec4}) entails that%
\begin{equation}
b_{n}=b_{n-1} \label{sol.inv.intseq.gale1.bn-1}%
\end{equation}
for every integer $n\geq k+1$\ \ \ \ \footnote{\textit{Proof.} Let $n$ be an
integer such that $n\geq k+1$. The definition of $b_{n}$ yields $b_{n}%
=\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}$. The definition of
$b_{n-1}$ yields%
\begin{equation}
b_{n-1}=\dfrac{a_{n-1}+a_{\left(  n-1\right)  -k}}{a_{\left(  n-1\right)
-1}a_{\left(  n-1\right)  -2}\cdots a_{\left(  n-1\right)  -k+1}}%
=\dfrac{a_{n-1}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k}}
\label{sol.inv.intseq.gale1.bn-1.pf.1}%
\end{equation}
(since $a_{\left(  n-1\right)  -k}=a_{n-k-1}$ and $\underbrace{a_{\left(
n-1\right)  -1}}_{=a_{n-2}}\underbrace{a_{\left(  n-1\right)  -2}}_{=a_{n-3}%
}\cdots\underbrace{a_{\left(  n-1\right)  -k+1}}_{=a_{n-k}}=a_{n-2}%
a_{n-3}\cdots a_{n-k}$). Hence,%
\begin{align*}
b_{n}  &  =\dfrac{a_{n}+a_{n-k}}{a_{n-1}a_{n-2}\cdots a_{n-k+1}}%
=\dfrac{a_{n-1}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k}}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.inv.intseq.gale1.rec4})}\right)
\\
&  =b_{n-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.inv.intseq.gale1.bn-1.pf.1})}\right)  .
\end{align*}
This proves (\ref{sol.inv.intseq.gale1.bn-1}).}. In other words, we have%
\[
b_{n-1}=b_{n}\ \ \ \ \ \ \ \ \ \ \text{for every integer }n\geq k+1.
\]
Thus, we get a chain of equalities $b_{k}=b_{k+1}=b_{k+2}=b_{k+3}=\cdots$.
Therefore, $b_{n}=b_{k}$ for each integer $n\geq k$. Hence, for each integer
$n\geq k$, we have%
\begin{equation}
b_{n}=b_{k}=k \label{sol.inv.intseq.gale1.bnbk}%
\end{equation}
(by (\ref{sol.inv.intseq.gale1.bk})).

Now, if $n$ is an integer satisfying $n\geq k$, then%
\begin{align*}
a_{n}+a_{n-k}  &  =\underbrace{b_{n}}_{\substack{=k\\\text{(by
(\ref{sol.inv.intseq.gale1.bnbk}))}}}a_{n-1}a_{n-2}\cdots a_{n-k+1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b_{n}=\dfrac{a_{n}+a_{n-k}}%
{a_{n-1}a_{n-2}\cdots a_{n-k+1}}\right) \\
&  =ka_{n-1}a_{n-2}\cdots a_{n-k+1}%
\end{align*}
and thus%
\begin{equation}
a_{n}=ka_{n-1}a_{n-2}\cdots a_{n-k+1}-a_{n-k}.
\label{sol.inv.intseq.gale1.an2rec}%
\end{equation}


We are now almost there. The equality (\ref{sol.inv.intseq.gale1.an2rec}) that
we just proved is a new recurrence equation for our sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ that can be used to prove by a
straightforward strong induction on $n$ that all entries $a_{n}$ of the
sequence are integers. This is the same kind of argument that we have made in
the solution to Exercise \ref{exe.laurent.t} \textbf{(b)}. But for the sake of
completeness, let me give the details of this argument:

We claim that%
\begin{equation}
a_{m}\in\mathbb{Z}\text{ for each }m\in\mathbb{N}.
\label{sol.inv.intseq.gale1.anZ}%
\end{equation}


[\textit{Proof of (\ref{sol.inv.intseq.gale1.anZ}):} We proceed by strong
induction on $m$:

\textit{Induction step:} Let $n\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.inv.intseq.gale1.anZ}) holds for $m<n$. We must
show that (\ref{sol.inv.intseq.gale1.anZ}) holds for $m=n$. In other words, we
must prove that $a_{n}\in\mathbb{Z}$.

If $n<k$, then this is clearly true (since
(\ref{eq.exe.inv.intseq.gale1.start}) yields $a_{n}=1\in\mathbb{Z}$ in this
case). Hence, we WLOG assume that $n\geq k$ for the rest of this proof.

Thus, (\ref{sol.inv.intseq.gale1.an2rec}) yields $a_{n}=ka_{n-1}a_{n-2}\cdots
a_{n-k+1}-a_{n-k}$. But we have assumed that (\ref{sol.inv.intseq.gale1.anZ})
holds for $m<n$. In other words, $a_{m}\in\mathbb{Z}$ holds for each
$m\in\mathbb{N}$ satisfying $m<n$. In other words, $a_{m}\in\mathbb{Z}$ holds
for each $m\in\left\{  0,1,\ldots,n-1\right\}  $. In other words, the $n$
elements $a_{0},a_{1},\ldots,a_{n-1}$ all belong to $\mathbb{Z}$. In other
words, the $n$ elements $a_{0},a_{1},\ldots,a_{n-1}$ are integers.

Hence, in particular, the $k-1$ elements $a_{n-1},a_{n-2},\ldots,a_{n-k+1}$
are integers (since these $k-1$ elements $a_{n-1},a_{n-2},\ldots,a_{n-k+1}$
are among the $n$ elements $a_{0},a_{1},\ldots,a_{n-1}$), and the element
$a_{n-k}$ is an integer (since this element is, too, among the $n$ elements
$a_{0},a_{1},\ldots,a_{n-1}$). Therefore, the difference $ka_{n-1}%
a_{n-2}\cdots a_{n-k+1}-a_{n-k}$ is an integer as well (since it is formed by
multiplying and subtracting the integers $k$, $a_{n-1},a_{n-2},\ldots
,a_{n-k+1}$ and $a_{n-k}$). In other words, $ka_{n-1}a_{n-2}\cdots
a_{n-k+1}-a_{n-k}\in\mathbb{Z}$. Hence, $a_{n}=ka_{n-1}a_{n-2}\cdots
a_{n-k+1}-a_{n-k}\in\mathbb{Z}$. This completes the induction step. Thus, the
proof of (\ref{sol.inv.intseq.gale1.anZ}) is complete.]

Now, let $n\geq0$ be an integer. Thus, $n\in\mathbb{N}$, so that $a_{n}%
\in\mathbb{Z}$ (by (\ref{sol.inv.intseq.gale1.anZ}), applied to $m=n$). In
other words, $a_{n}$ is an integer. Furthermore, $a_{n}$ is positive (since
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is a sequence of positive rational
numbers). Hence, $a_{n}$ is a positive integer. This solves Exercise
\ref{exe.inv.intseq.gale1}.
\end{proof}

Here is another example (\cite[Chapter 4, (4)]{Gale98}):\footnote{We note that
Exercise \ref{exe.inv.intseq.gale2} generalizes Exercise
\ref{exe.laurent.mse3586309c} \textbf{(a)}, because if we take $k=4$, then the
sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ defined in Exercise
\ref{exe.inv.intseq.gale2} will be precisely the sequence $\left(  b_{0}%
,b_{1},b_{2},\ldots\right)  $ in Exercise \ref{exe.laurent.mse3586309c}
\textbf{(a)}.}

\begin{exercise}
\label{exe.inv.intseq.gale2}Fix a positive integer $k\geq2$. Define a sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of positive rational numbers
recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale2.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{a_{n-1}a_{n-2}+a_{n-2}a_{n-3}+\cdots+a_{n-k+2}a_{n-k+1}%
}{a_{n-k}}\label{eq.exe.inv.intseq.gale2.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}
(The sum in the numerator on the right hand side of
(\ref{eq.exe.inv.intseq.gale2.rec}) is $a_{n-1}a_{n-2}+a_{n-2}a_{n-3}%
+\cdots+a_{n-k+2}a_{n-k+1}=\sum_{i=1}^{k-2}a_{n-i}a_{n-i-1}$.)

Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.intseq.gale2} (sketched).]This is similar
to the above solution to Exercise \ref{exe.inv.intseq.gale1}, so we restrict
ourselves to an outline.

Again, we begin by playing around with the recursive equation.

Let $n$ be an integer satisfying $n\geq k+2$. Thus, $n\geq n-2\geq k$ (since
$n\geq k+2$); hence, (\ref{eq.exe.inv.intseq.gale2.rec}) holds. Multiplying
both sides of (\ref{eq.exe.inv.intseq.gale2.rec}) by $a_{n-k}$, we obtain%
\begin{equation}
a_{n}a_{n-k}=a_{n-1}a_{n-2}+a_{n-2}a_{n-3}+\cdots+a_{n-k+2}a_{n-k+1}.
\label{sol.inv.intseq.gale2.rec1}%
\end{equation}
The same argument (applied to $n-2$ instead of $n$) yields%
\[
a_{n-2}a_{n-k-2}=a_{n-3}a_{n-4}+a_{n-4}a_{n-5}+\cdots+a_{n-k}a_{n-k-1}.
\]
\footnote{You might wonder why we used $n-2$ instead of $n-1$ here (unlike in
the above solution to Exercise \ref{exe.inv.intseq.gale1}). The best answer I
have is \textquotedblleft I have tried using $n-1$, and it didn't lead me
anywhere\textquotedblright.} Subtracting this equality from
(\ref{sol.inv.intseq.gale2.rec1}), we find
\begin{align*}
a_{n}a_{n-k}-a_{n-2}a_{n-k-2}  &  =\left(  a_{n-1}a_{n-2}+a_{n-2}%
a_{n-3}+\cdots+a_{n-k+2}a_{n-k+1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  a_{n-3}a_{n-4}+a_{n-4}a_{n-5}+\cdots
+a_{n-k}a_{n-k-1}\right) \\
&  =a_{n-1}a_{n-2}+a_{n-2}a_{n-3}-a_{n-k+1}a_{n-k}-a_{n-k}a_{n-k-1}.
\end{align*}
Adding $a_{n-2}a_{n-k-2}+a_{n-k+1}a_{n-k}+a_{n-k}a_{n-k-1}$ to both sides of
this equality, we obtain%
\[
a_{n}a_{n-k}+a_{n-k+1}a_{n-k}+a_{n-k}a_{n-k-1}=a_{n-1}a_{n-2}+a_{n-2}%
a_{n-3}+a_{n-2}a_{n-k-2}.
\]
Adding $a_{n-k}a_{n-2}$ to both sides of this equality\footnote{This is
somewhat unmotivated, but will serve to make the pattern below symmetric.}, we
obtain%
\begin{align*}
&  a_{n}a_{n-k}+a_{n-k+1}a_{n-k}+a_{n-k}a_{n-k-1}+a_{n-k}a_{n-2}\\
&  =a_{n-1}a_{n-2}+a_{n-2}a_{n-3}+a_{n-2}a_{n-k-2}+a_{n-k}a_{n-2}.
\end{align*}
In other words,%
\[
a_{n-k}\left(  a_{n}+a_{n-2}+a_{n-k+1}+a_{n-k-1}\right)  =a_{n-2}\left(
a_{n-1}+a_{n-3}+a_{n-k}+a_{n-k-2}\right)  .
\]
Dividing both sides of this equality by $a_{n-2}a_{n-3}\cdots a_{n-k}$, we
obtain%
\begin{equation}
\dfrac{a_{n}+a_{n-2}+a_{n-k+1}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k+1}%
}=\dfrac{a_{n-1}+a_{n-3}+a_{n-k}+a_{n-k-2}}{a_{n-3}a_{n-4}\cdots a_{n-k}}.
\label{sol.inv.intseq.gale2.rec4}%
\end{equation}


Now, forget that we fixed $n$. We thus have proved the equality
(\ref{sol.inv.intseq.gale2.rec4}) for each integer $n\geq k+2$.

Now, let us define a number%
\[
b_{n}=\dfrac{a_{n}+a_{n-2}+a_{n-k+1}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots
a_{n-k+1}}%
\]
for each integer $n\geq k+1$. Thus, we have defined a sequence $\left(
b_{k+1},b_{k+2},b_{k+3},\ldots\right)  $ of rational numbers. It is easy to
see that $b_{k+1}$ is an integer (since $a_{k-1},a_{k-2},\ldots,a_{0}$ are all
equal to $1$, and thus all denominators involved in computing $b_{k+1}$ are
$1$s).

Now, the equality (\ref{sol.inv.intseq.gale2.rec4}) entails that%
\[
b_{n}=b_{n-1}%
\]
for each integer $n\geq k+2$ (because its left hand side is $b_{n}$, while its
right hand side is $b_{n-1}$). In other words, we have $b_{n-1}=b_{n}$ for
every integer $n\geq k+2$. Thus, we get a chain of equalities $b_{k+1}%
=b_{k+2}=b_{k+3}=b_{k+4}=\cdots$. From here, we can finish as in the above
solution to Exercise \ref{exe.inv.intseq.gale1}.
\end{proof}

\begin{noncompile}
TODO: Perhaps expand the above to a detailed proof.

See also
https://mathoverflow.net/questions/378121/is-this-laurent-phenomenon-explained-by-invariance-periodicity
for this problem.
\end{noncompile}

Here is a third example (\cite[Chapter 4, (3)]{Gale98}):

\begin{exercise}
\label{exe.inv.intseq.gale3}Fix an odd positive integer $k\geq2$. Define a
sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of positive rational
numbers recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale3.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{a_{n-1}a_{n-2}+a_{n-3}a_{n-4}+\cdots+a_{n-k+2}a_{n-k+1}%
}{a_{n-k}}\label{eq.exe.inv.intseq.gale3.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}
(The sum in the numerator on the right hand side of
(\ref{eq.exe.inv.intseq.gale3.rec}) is $a_{n-1}a_{n-2}+a_{n-3}a_{n-4}%
+\cdots+a_{n-k+2}a_{n-k+1}=\sum_{i=1}^{\left(  k-1\right)  /2}a_{n-2i+1}%
a_{n-2i}$.)

Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.intseq.gale3} (sketched).]This is similar
to the above solution to Exercise \ref{exe.inv.intseq.gale1}, so we restrict
ourselves to an outline.

Again, we begin by playing around with the recursive equation.

Let $n$ be an integer satisfying $n\geq k+2$. Thus, $n\geq n-2\geq k$ (since
$n\geq k+2$); hence, (\ref{eq.exe.inv.intseq.gale3.rec}) holds. Multiplying
both sides of (\ref{eq.exe.inv.intseq.gale3.rec}) by $a_{n-k}$, we obtain%
\begin{equation}
a_{n}a_{n-k}=a_{n-1}a_{n-2}+a_{n-3}a_{n-4}+\cdots+a_{n-k+2}a_{n-k+1}.
\label{sol.inv.intseq.gale3.rec1}%
\end{equation}
The same argument (applied to $n-2$ instead of $n$) yields%
\[
a_{n-2}a_{n-k-2}=a_{n-3}a_{n-4}+a_{n-5}a_{n-6}+\cdots+a_{n-k}a_{n-k-1}.
\]
Subtracting this equality from (\ref{sol.inv.intseq.gale3.rec1}), we find
\begin{align*}
a_{n}a_{n-k}-a_{n-2}a_{n-k-2}  &  =\left(  a_{n-1}a_{n-2}+a_{n-3}%
a_{n-4}+\cdots+a_{n-k+2}a_{n-k+1}\right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  a_{n-3}a_{n-4}+a_{n-5}a_{n-6}+\cdots
+a_{n-k}a_{n-k-1}\right) \\
&  =a_{n-1}a_{n-2}-a_{n-k}a_{n-k-1}.
\end{align*}
Adding $a_{n-2}a_{n-k-2}+a_{n-k}a_{n-k-1}$ to both sides of this equality, we
obtain%
\[
a_{n}a_{n-k}+a_{n-k}a_{n-k-1}=a_{n-1}a_{n-2}+a_{n-2}a_{n-k-2}.
\]
In other words,%
\[
a_{n-k}\left(  a_{n}+a_{n-k-1}\right)  =a_{n-2}\left(  a_{n-1}+a_{n-k-2}%
\right)  .
\]
Dividing both sides of this equality by $a_{n-2}a_{n-3}\cdots a_{n-k}$, we
obtain%
\begin{equation}
\dfrac{a_{n}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k+1}}=\dfrac{a_{n-1}%
+a_{n-k-2}}{a_{n-3}a_{n-4}\cdots a_{n-k}}. \label{sol.inv.intseq.gale3.rec4}%
\end{equation}


Now, forget that we fixed $n$. We thus have proved the equality
(\ref{sol.inv.intseq.gale3.rec4}) for each integer $n\geq k+2$.

Now, let us define a number%
\[
b_{n}=\dfrac{a_{n}+a_{n-k-1}}{a_{n-2}a_{n-3}\cdots a_{n-k+1}}%
\]
for each integer $n\geq k+1$. Thus, we have defined a sequence $\left(
b_{k+1},b_{k+2},b_{k+3},\ldots\right)  $ of rational numbers. It is easy to
see that $b_{k+1}$ is an integer (since $a_{k-1},a_{k-2},\ldots,a_{0}$ are all
equal to $1$, and thus all denominators involved in computing $b_{k+1}$ are
$1$s).

Now, the equality (\ref{sol.inv.intseq.gale3.rec4}) entails that%
\[
b_{n}=b_{n-1}%
\]
for each integer $n\geq k+2$ (because its left hand side is $b_{n}$, while its
right hand side is $b_{n-1}$). In other words, we have $b_{n-1}=b_{n}$ for
every integer $n\geq k+2$. Thus, we get a chain of equalities $b_{k+1}%
=b_{k+2}=b_{k+3}=b_{k+4}=\cdots$. From here, we can finish as in the above
solution to Exercise \ref{exe.inv.intseq.gale1}.
\end{proof}

\begin{noncompile}
TODO: Perhaps expand the above to a detailed proof.
\end{noncompile}

\subsection{\label{sect.inv.monv}Monovariants}

Next we shall see some exercises illustrating the use of monovariants (i.e.,
quantities that change only in one direction). We begin with a basic fact
about sorting sequences. First, a definition:

\begin{definition}
\textbf{(a)} We say that an $n$-tuple $\left(  b_{1},b_{2},\ldots
,b_{n}\right)  $ of real numbers is \textit{weakly increasing} if $b_{1}\leq
b_{2}\leq\cdots\leq b_{n}$. (For example, the $5$-tuple $\left(
1,4,4,7,9\right)  $ is weakly increasing.)

\textbf{(b)} Let $\left(  b_{1},b_{2},\ldots,b_{n}\right)  $ be an $n$-tuple
of real numbers. We say that two entries $b_{i}$ and $b_{j}$ (with $i<j$) of
this $n$-tuple are \textit{out of order} if $b_{i}>b_{j}$. (For example, the
entries $4$ and $2$ in the $5$-tuple $\left(  1,4,3,2,5\right)  $ are out of
order; thus, this $5$-tuple is not weakly increasing.)
\end{definition}

It is clear that an $n$-tuple of real numbers is weakly increasing if and only
if it has no two entries that are out of order. Now, the following exercise
shows that we can sort any $n$-tuple of real numbers into weakly increasing
order by repeatedly swapping out-of-order pairs of adjacent
entries\footnote{This is the idea underlying the sorting algorithm called
\textit{bubble sort} (\cite[\S 5.2.2]{TAoCP3}).}:

\begin{exercise}
\label{exe.monv.sort.1}Let $n\in\mathbb{N}$. You start with an $n$-tuple
$\left(  a_{1},a_{2},\ldots,a_{n}\right)  $ of real numbers. In one move, you
are allowed to pick two adjacent entries $a_{i}$ and $a_{i+1}$ of this
$n$-tuple that are out of order\ (i.e., satisfy $a_{i}>a_{i+1}$), and swap
these two entries. Prove that after at most $\dbinom{n}{2}$ such moves, the
$n$-tuple will become weakly increasing.

[\textbf{Example:} If $n=5$ and if you start with the $5$-tuple $\left(
2,5,4,1,3\right)  $, then one possible sequence of moves you can take is the
following one:%
\begin{align*}
&  \left(  2,5,4,1,3\right)  \overset{\text{swap }5\text{ and }%
4}{\longrightarrow}\left(  2,4,5,1,3\right)  \overset{\text{swap }5\text{ and
}1}{\longrightarrow}\left(  2,4,1,5,3\right)  \overset{\text{swap }5\text{ and
}3}{\longrightarrow}\left(  2,4,1,3,5\right) \\
& \\
&  \overset{\text{swap }4\text{ and }1}{\longrightarrow}\left(
2,1,4,3,5\right)  \overset{\text{swap }2\text{ and }1}{\longrightarrow}\left(
1,2,4,3,5\right)  \overset{\text{swap }4\text{ and }3}{\longrightarrow}\left(
1,2,3,4,5\right)  .
\end{align*}
The $5$-tuple has become weakly increasing after these moves. Other sequences
of moves are also possible, but they all lead to the same final result.]
\end{exercise}

\begin{noncompile}
This exercise generalizes \cite[Aufgabe 4.4]{ngrin}. It is also implicit in
\cite[\S 7.80, Proof of Proposition 6.40 \textbf{(a)}]{detnotes}.
\end{noncompile}

\begin{proof}
[Solution to Exercise \ref{exe.monv.sort.1} (sketched).]In this solution, the
word \textquotedblleft$n$-tuple\textquotedblright\ shall always mean
\textquotedblleft$n$-tuple of real numbers\textquotedblright.

An \textit{inversion} of an $n$-tuple $\left(  a_{1},a_{2},\ldots
,a_{n}\right)  $ shall mean a pair $\left(  i,j\right)  $ of elements of
$\left[  n\right]  $ satisfying $i<j$ and $a_{i}>a_{j}$. Thus, the inversions
of an $n$-tuple correspond to the pairs of entries of this $n$-tuple that are
out of order. (However, an inversion is not the pair of these \textbf{entries}%
, but rather the pair of their \textbf{positions}.) For example, the
inversions of the $4$-tuple $\left(  3,1,4,2\right)  $ are $\left(
1,2\right)  $, $\left(  1,4\right)  $ and $\left(  3,4\right)  $. For another
example, the inversions of the $3$-tuple $\left(  2,2,1\right)  $ are $\left(
1,3\right)  $ and $\left(  2,3\right)  $. (Note that the pairs of entries
corresponding to these inversions are both $\left(  2,1\right)  $.)

The \textit{inversion number} of an $n$-tuple shall be defined as the number
of inversions of this $n$-tuple. For example, the inversion number of the
$4$-tuple $\left(  3,1,4,2\right)  $ is $3$, since it has $3$ inversions. We
notice that the inversion number of an $n$-tuple is always a nonnegative
integer (by its definition).

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Every move decreases the inversion number of our $n$-tuple
precisely by $1$.
\end{statement}

[\textit{Proof of Claim 1:} I shall illustrate the argument visually before
discussing it in more technical detail.

Let us visually represent the inversions of the $7$-tuple $\left(
4,1,7,3,2,5,6\right)  $.%
\begin{equation}%
%TCIMACRO{\TeXButton{tikz inversions before the move}{\begin{tikzpicture}
%\node at (-0.5, 0) {$\Big($};
%\node at (6.5, 0) {$\Big)$};
%\node at (6.7, -0.2) {$.$};
%\node(4) at (0, 0) {$\ 4,$};
%\node(1) at (1, 0) {$\ 1,$};
%\node(7) at (2, 0) {$\ 7,$};
%\node(3) at (3, 0) {$\ 3,$};
%\node(2) at (4, 0) {$\ 2,$};
%\node(5) at (5, 0) {$\ 5,$};
%\node(6) at (6, 0) {$6$};
%\draw(1, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
%\draw
%[blue, thick] (3, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
%\draw[red] (4, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
%\draw[red] (3, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
%\draw
%[green!50!black] (5, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
%\draw
%[green!50!black] (6, 0.25) arc[radius = 2, start angle=0, delta angle=180];
%\draw(4, 0.25) arc[radius = 2, start angle=0, delta angle=180];
%\draw
%[green!50!black] (4, 0.25) arc[radius = 1, start angle=0, delta angle=180];
%\end{tikzpicture}} }%
%BeginExpansion
\begin{tikzpicture}
\node at (-0.5, 0) {$\Big($};
\node at (6.5, 0) {$\Big)$};
\node at (6.7, -0.2) {$.$};
\node(4) at (0, 0) {$\ 4,$};
\node(1) at (1, 0) {$\ 1,$};
\node(7) at (2, 0) {$\ 7,$};
\node(3) at (3, 0) {$\ 3,$};
\node(2) at (4, 0) {$\ 2,$};
\node(5) at (5, 0) {$\ 5,$};
\node(6) at (6, 0) {$6$};
\draw(1, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
\draw
[blue, thick] (3, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
\draw[red] (4, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
\draw[red] (3, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
\draw
[green!50!black] (5, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
\draw
[green!50!black] (6, 0.25) arc[radius = 2, start angle=0, delta angle=180];
\draw(4, 0.25) arc[radius = 2, start angle=0, delta angle=180];
\draw
[green!50!black] (4, 0.25) arc[radius = 1, start angle=0, delta angle=180];
\end{tikzpicture}
%EndExpansion
\label{sol.monv.sort1.pf.C1.pf.pic1}%
\end{equation}
The arcs here illustrate the inversions; more precisely, there is an arc
between the $i$-th entry and the $j$-th entry whenever $\left(  i,j\right)  $
is an inversion of the $7$-tuple. (The colors will be explained later.) The
two adjacent entries $7$ and $3$ (in positions $3$ and $4$) are out of order.
The move that swaps these two entries transforms the $7$-tuple into the
following $7$-tuple:%
\begin{equation}%
%TCIMACRO{\TeXButton{tikz inversion after the move}{\begin{tikzpicture}
%\node at (-0.5, 0) {$\Big($};
%\node at (6.5, 0) {$\Big)$};
%\node at (6.7, -0.2) {$.$};
%\node(4) at (0, 0) {$\ 4,$};
%\node(1) at (1, 0) {$\ 1,$};
%\node(7) at (3, 0) {$\ 7,$};
%\node(3) at (2, 0) {$\ 3,$};
%\node(2) at (4, 0) {$\ 2,$};
%\node(5) at (5, 0) {$\ 5,$};
%\node(6) at (6, 0) {$6$};
%\draw(1, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
%\draw[red] (4, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
%\draw
%[green!50!black] (2, 0.25) arc[radius = 1, start angle=0, delta angle=180];
%\draw[red] (5, 0.25) arc[radius = 1, start angle=0, delta angle=180];
%\draw[red] (6, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
%\draw(4, 0.25) arc[radius = 2, start angle=0, delta angle=180];
%\draw
%[green!50!black] (4, 0.25) arc[radius = 1, start angle=0, delta angle=180];
%\end{tikzpicture}
%} }%
%BeginExpansion
\begin{tikzpicture}
\node at (-0.5, 0) {$\Big($};
\node at (6.5, 0) {$\Big)$};
\node at (6.7, -0.2) {$.$};
\node(4) at (0, 0) {$\ 4,$};
\node(1) at (1, 0) {$\ 1,$};
\node(7) at (3, 0) {$\ 7,$};
\node(3) at (2, 0) {$\ 3,$};
\node(2) at (4, 0) {$\ 2,$};
\node(5) at (5, 0) {$\ 5,$};
\node(6) at (6, 0) {$6$};
\draw(1, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
\draw[red] (4, 0.25) arc[radius = 0.5, start angle=0, delta angle=180];
\draw
[green!50!black] (2, 0.25) arc[radius = 1, start angle=0, delta angle=180];
\draw[red] (5, 0.25) arc[radius = 1, start angle=0, delta angle=180];
\draw[red] (6, 0.25) arc[radius = 1.5, start angle=0, delta angle=180];
\draw(4, 0.25) arc[radius = 2, start angle=0, delta angle=180];
\draw
[green!50!black] (4, 0.25) arc[radius = 1, start angle=0, delta angle=180];
\end{tikzpicture}
%EndExpansion
\label{sol.monv.sort1.pf.C1.pf.pic2}%
\end{equation}
Again, we have represented the inversions as arcs. What do we see? The two
black arcs have stayed in their positions; the red and the green arcs have
slightly moved and changed their colors (from red to green, and from green to
red); the blue arc has disappeared. The logic behind the colors is the
following: The swap involved the $3$-rd and the $4$-th entry of our $7$-tuple.
The arc that connects these two entries was colored blue; the arcs that
contain the $3$-rd but not the $4$-th entry were colored green; the arcs that
contain the $4$-th but not the $3$-rd entry were colored red; all remaining
arcs were colored black. The behavior is no longer strange:

\begin{itemize}
\item The black arcs from (\ref{sol.monv.sort1.pf.C1.pf.pic1}) remain arcs in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}), because the relevant entries do not change.

\item The green arcs from (\ref{sol.monv.sort1.pf.C1.pf.pic1}) appear
(slightly stretched or compressed) as red arcs in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}), since one of the relevant entries is
moved (but not far enough to jump past the other entry and therefore destroy
the inversion).

\item The red arcs from (\ref{sol.monv.sort1.pf.C1.pf.pic1}) appear (slightly
stretched or compressed) as green arcs in (\ref{sol.monv.sort1.pf.C1.pf.pic2})
(for the same reason).

\item The blue arc from (\ref{sol.monv.sort1.pf.C1.pf.pic1}) disappears in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}) (since the two relevant entries are no
longer out of order in (\ref{sol.monv.sort1.pf.C1.pf.pic2})).
\end{itemize}

\noindent This analysis accounts for all arcs in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}). Thus, we see that there is precisely one
less arc in (\ref{sol.monv.sort1.pf.C1.pf.pic2}) than in
(\ref{sol.monv.sort1.pf.C1.pf.pic1}). In other words, the $7$-tuple in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}) has precisely one less inversion than
that in (\ref{sol.monv.sort1.pf.C1.pf.pic1}). In other words, our move has
decreased the inversion number by $1$, exactly as Claim 1 predicted.

It is not hard (although somewhat laborious) to formalize this argument in
full generality. Instead of assigning colors to arcs, let me assign colors to
the inversions themselves. Consider a move that transforms an $n$-tuple
$\mathbf{a}=\left(  a_{1},a_{2},\ldots,a_{n}\right)  $ into an $n$-tuple
$\mathbf{b}=\left(  b_{1},b_{2},\ldots,b_{n}\right)  $ by swapping two
adjacent entries $a_{i}$ and $a_{i+1}$ that are out of order. (Thus,
$b_{i}=a_{i+1}$ and $b_{i+1}=a_{i}$ and $b_{j}=a_{j}$ for each $j\in\left[
n\right]  \setminus\left\{  i,i+1\right\}  $.) An inversion $\left(
u,v\right)  $ of $\mathbf{a}$ or $\mathbf{b}$ will be called

\begin{itemize}
\item \textit{blue} if both $i$ and $i+1$ belong to $\left\{  u,v\right\}  $;

\item \textit{green} if $i\in\left\{  u,v\right\}  $ but $i+1\notin\left\{
u,v\right\}  $;

\item \textit{red} if $i+1\in\left\{  u,v\right\}  $ but $i\notin\left\{
u,v\right\}  $;

\item \textit{black} if neither $i$ nor $i+1$ belongs to $\left\{
u,v\right\}  $.
\end{itemize}

\noindent(These are precisely the colors of the corresponding arcs in
(\ref{sol.monv.sort1.pf.C1.pf.pic1}) and in
(\ref{sol.monv.sort1.pf.C1.pf.pic2}).) It is clear that each inversion of
$\mathbf{a}$ or $\mathbf{b}$ has exactly one of these four colors (blue,
green, red and black). Moreover:

\begin{itemize}
\item The $n$-tuple $\mathbf{a}$ has exactly one blue inversion (namely,
$\left(  i,i+1\right)  $), whereas the $n$-tuple $\mathbf{b}$ has no blue
inversions (since its $i$-th and $\left(  i+1\right)  $-st entries are not out
of order).

\item The $n$-tuple $\mathbf{a}$ has as many green inversions as the $n$-tuple
$\mathbf{b}$ has red inversions. Indeed, there is a bijection%
\[
\left\{  \text{green inversions of }\mathbf{a}\right\}  \rightarrow\left\{
\text{red inversions of }\mathbf{b}\right\}
\]
that sends each green inversion $\left(  u,i\right)  $ of $\mathbf{a}$ to the
red inversion $\left(  u,i+1\right)  $ of $\mathbf{b}$ and sends each green
inversion $\left(  i,v\right)  $ of $\mathbf{a}$ to the red inversion $\left(
i+1,v\right)  $ of $\mathbf{b}$. (Obviously, any green inversion of
$\mathbf{a}$ has one of the forms $\left(  u,i\right)  $ and $\left(
i,v\right)  $.)

\item The $n$-tuple $\mathbf{a}$ has as many red inversions as the $n$-tuple
$\mathbf{b}$ has green inversions. Indeed, there is a bijection%
\[
\left\{  \text{red inversions of }\mathbf{a}\right\}  \rightarrow\left\{
\text{green inversions of }\mathbf{b}\right\}
\]
that sends each red inversion $\left(  u,i+1\right)  $ of $\mathbf{a}$ to the
green inversion $\left(  u,i\right)  $ of $\mathbf{b}$ and sends each red
inversion $\left(  i+1,v\right)  $ of $\mathbf{a}$ to the green inversion
$\left(  i,v\right)  $ of $\mathbf{b}$. (Obviously, any red inversion of
$\mathbf{a}$ has one of the forms $\left(  u,i+1\right)  $ and $\left(
i+1,v\right)  $.)

\item The $n$-tuple $\mathbf{a}$ has as many black inversions as the $n$-tuple
$\mathbf{b}$ has black inversions. Indeed, the black inversions of
$\mathbf{a}$ are identical with the black inversions of $\mathbf{b}$.
\end{itemize}

\noindent This accounting shows that the $n$-tuple $\mathbf{a}$ has exactly
one more inversion than the $n$-tuple $\mathbf{b}$ has. In other words, the
inversion number of $\mathbf{a}$ equals the inversion number of $\mathbf{b}$
plus $1$. Thus, the move that transformed $\mathbf{a}$ into $\mathbf{b}$ had
the effect of decreasing the inversion number by $1$. This proves Claim
1.\footnote{A more formal exposition of this proof can be found in
\cite[\S 7.80, proof of (1072)]{detnotes}. (Note that the notation
$\ell\left(  \mathbf{a}\right)  $ used in \cite[\S 7.80, (1072)]{detnotes} is
exactly what we call the inversion number of $\mathbf{a}$ here, whereas the
notation $\mathbf{a}\circ s_{k}$ used in \cite[\S 7.80, (1072)]{detnotes} is
the result of swapping the $k$-th and $\left(  k+1\right)  $-st entries of the
$n$-tuple $\mathbf{a}$. Thus, \cite[(1072)]{detnotes} says precisely that a
move (in our sense) decreases the inversion number of an $n$-tuple by $1$. The
fact that we are working with $n$-tuples of real numbers whereas
\cite[\S 7.80, (1072)]{detnotes} is stated for $n$-tuples of integers is
immaterial; this makes no difference for the proof.)}]

Now, Claim 1 shows that the inversion number of our $n$-tuple is a
monovariant: it keeps decreasing. Let us make this more precise:

At the onset, the inversion number of our $n$-tuple is at most $\dbinom{n}{2}$
(since every inversion of the $n$-tuple is a pair $\left(  i,j\right)  $ of
elements of $\left[  n\right]  $ satisfying $i<j$; but there are only
$\dbinom{n}{2}$ such pairs\footnote{\textit{Proof.} There is a bijection
\begin{align*}
\left\{  \text{pairs }\left(  i,j\right)  \text{ of elements of }\left[
n\right]  \text{ satisfying }i<j\right\}   &  \rightarrow\left\{
2\text{-element subsets of }\left[  n\right]  \right\}  ,\\
\left(  i,j\right)   &  \mapsto\left\{  i,j\right\}  .
\end{align*}
Hence, the bijection principle yields%
\begin{align*}
&  \left\vert \left\{  \text{pairs }\left(  i,j\right)  \text{ of elements of
}\left[  n\right]  \text{ satisfying }i<j\right\}  \right\vert \\
&  =\left\vert \left\{  2\text{-element subsets of }\left[  n\right]
\right\}  \right\vert =\left(  \text{\# of }2\text{-element subsets of
}\left[  n\right]  \right)  =\dbinom{n}{2}%
\end{align*}
(by Theorem \ref{thm.binom.comb}). In other words, the number of pairs
$\left(  i,j\right)  $ of elements of $\left[  n\right]  $ satisfying $i<j$ is
$\dbinom{n}{2}$.}). Claim 1 shows that this inversion number decreases by $1$
every time you make a move. Hence, after $k$ moves, this inversion number will
be $\dbinom{n}{2}-k$. Therefore, if you make more than $\dbinom{n}{2}$
successive moves, then the inversion number becomes smaller than $\dbinom
{n}{2}-\dbinom{n}{2}=0$, which is clearly impossible (since the inversion
number of an $n$-tuple is always a nonnegative integer). Thus, you cannot make
more than $\dbinom{n}{2}$ successive moves. Hence, after at most $\dbinom
{n}{2}$ moves, you will obtain an $n$-tuple that does not allow for any
further moves. But such an $n$-tuple must necessarily be weakly increasing
(because it does not allow for any further moves, so it has no two adjacent
entries that are out of order\footnote{because any two adjacent entries that
are out of order would create an opportunity for a move}; but this means that
its entries weakly increase from left to right). Thus, after at most
$\dbinom{n}{2}$ moves, you will obtain a weakly increasing $n$-tuple. This
solves Exercise \ref{exe.monv.sort.1}.
\end{proof}

Our next exercise (\cite[Aufgabe 4.16]{ngrin}) is again about lamps in a
rectangular grid (just like Exercise \ref{exe.inv.lamps1}):

\begin{exercise}
\label{exe.inv.lamps3}Let $n$ and $m$ be two positive integers. You have a
rectangular $n\times m$-grid of lamps (i.e., a table with $n$ rows and $m$
columns, with a lamp in each of its $nm$ cells). A \textit{line} shall mean a
row or a column of the grid; thus, there are $n+m$ lines in total (namely, $n$
rows and $m$ columns). You say that a line is \textit{bright} if at least half
of all lamps in this line are turned on.

In a move, you can choose a line, and flip all lamps in this line. (To
\textquotedblleft flip\textquotedblright\ a lamp means to turn it on if it was
off, and to turn it off if it was on. Note that our definition of a move is
exactly the same as in Exercise \ref{exe.inv.lamps1}.)

Prove that (starting with an arbitrary state of the lamps -- not necessarily
all turned off) you can always find a sequence of moves after which every line
is bright.

[\textbf{Example:} Let us represent a lamp turned off by the number $0$, and a
lamp turned on by the number $1$. Consider the following starting state (for
$n=3$ and $m=4$):%
\begin{equation}%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$0$ & $0$ & $1$ & $1$\\\hline
$1$ & $1$ & $0$ & $0$\\\hline
$0$ & $0$ & $1$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ \ . \label{eq.exe.inv.lamps3.exa1}%
\end{equation}
In this state, the first two rows (from the top) are bright, and so is the
third column (from the left); but the remaining lines are not bright. However,
we can make all lines bright by the following sequence of moves: First, we
flip all lamps in the first and second columns; then, we flip all lamps in the
second row. The resulting state is%
\[%
\begin{tabular}
[c]{|c|c|c|c|}\hline
$1$ & $1$ & $1$ & $1$\\\hline
$1$ & $1$ & $1$ & $1$\\\hline
$1$ & $1$ & $1$ & $0$\\\hline
\end{tabular}
\ \ \ \ \ \ ,
\]
and this does have the property that all lines are bright.]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.lamps3} (sketched).]We define the
\textit{total brightness} of a state to be the \# of all lamps that are turned
on in this state. For example, the state shown in
(\ref{eq.exe.inv.lamps3.exa1}) has total brightness $5$. Note that the total
brightness of any state is a nonnegative integer that is $\leq nm$ (since
there are only $nm$ lamps in total).

Let me recall that any move consists in picking a line and flipping all lamps
in this line. We shall call a move \textit{lightbringing} if the line getting
picked was not bright before the move. For example, if we start from the state
(\ref{eq.exe.inv.lamps3.exa1}), then flipping all lamps in the topmost row is
not a lightbringing move (since the topmost row was already bright before the
move), but flipping all lamps in the bottommost row is a lightbringing move
(since the bottommost row was not bright before the move).

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Any lightbringing move increases the total brightness of a
state by at least $1$.
\end{statement}

[\textit{Proof of Claim 1:} Consider any lightbringing move. Let $\ell$ be the
line that is picked in this move. Thus, the move consists in flipping all
lamps in this line $\ell$. Since this move is lightbringing, we thus conclude
that the line $\ell$ is not bright before this move (by the definition of
\textquotedblleft lightbringing\textquotedblright). In other words, less than
half of the lamps in line $\ell$ are turned on before the move (by the
definition of a \textquotedblleft bright\textquotedblright\ line). In other
words, before the move, the line $\ell$ has fewer turned-on lamps than it has
turned-off lamps. But the move turns all the former lamps off and turns all
the latter lamps on (because the move flips all lamps in $\ell$). Hence, the
move turns fewer lamps off than it turns on (since the line $\ell$ has fewer
turned-on lamps than it has turned-off lamps before the move). Hence, the move
increases the total \# of lamps that are turned on. In other words, the move
increases the total brightness of the state (since the total brightness of a
state was defined as the total \# of lamps that are turned on). Therefore, the
move increases the total brightness of the state by at least $1$ (since the
total brightness is an integer, and thus, if it is increased, it must
necessarily be increased by at least $1$). This proves Claim 1.]

Now, let us start with an arbitrary state, and keep making lightbringing moves
until this is no longer possible. (That is, we keep making lightbringing moves
as long as there is any line that is not bright; we stop when there are no
such lines left any more.) I claim that this process will end after at most
$nm$ moves. Indeed, Claim 1 shows that any lightbringing move increases the
total brightness of a state by at least $1$. Hence, if we manage to make
$nm+1$ moves, then the total brightness will be at least $nm+1$ (since the
total brightness was nonnegative in the initial state, and has been increased
by $1$ in each of our $nm+1$ moves); but this would contradict the fact that
the total brightness of any state is $\leq nm$ (and thus $<nm+1$). Thus, we
cannot make $nm+1$ moves. Hence, our process will stop after at most $nm$
moves. The resulting state (at the end of our process) will have the property
that every line is bright (since otherwise, it would have a line that is not
bright, and therefore we could apply one more lightbringing move to it). Thus,
we have found a sequence of moves after which every line is bright. This
solves Exercise \ref{exe.inv.lamps3}.
\end{proof}

Here is yet another lamp puzzle (\cite[Aufgabe 4.20]{ngrin}), albeit stated in
terms of flags rather than lamps:

\begin{exercise}
\label{exe.inv.revols1}A country has finitely many towns, some of which are
connected by roads. We say that two towns are each others' \textit{neighbors}
if they are connected by a direct road (not passing through any other town).
(No town counts as its own neighbor.)

Each town flies a flag, which has a certain color. We shall briefly say
\textquotedblleft A town $T$ flies a color $c$\textquotedblright\ for
\textquotedblleft A town $T$ flies a flag of color $c$\textquotedblright.

Every once in a while, a revolution happens in a town: The town's flag is
repainted in the color of the plurality of its neighbors. That is, if $T$ is a
town, and if a plurality of $T$'s neighbors are flying a certain color $c$,
then the revolution causes the flag of $T$ to be repainted in color $c$.
(\textquotedblleft Plurality\textquotedblright\ means \textquotedblleft
relative majority\textquotedblright, i.e., more neighbors than any other
color. That is, \textquotedblleft a plurality of $T$'s neighbors are flying
color $c$\textquotedblright\ means \textquotedblleft for each color $d\neq c$,
the number of $T$'s neighbors flying color $c$ is larger than the number of
$T$'s neighbors flying color $d$\textquotedblright. If $T$ was already flying
color $c$ right before the change, then nothing changes, and this does not
count as a revolution.)

Assume that revolutions cannot happen simultaneously in several towns. Prove
that the revolutions will eventually end -- i.e., after sufficiently many
revolutions, no more revolutions will happen.

[\textbf{Example:} Here is an example of a country with $7$ towns (with direct
roads represented by line segments):
\[%
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node[fill=yellow!50, main node] (0) at (-30:3) {$Y$};
%\node[fill=blue!30, main node] (1) at (30:2) {$B$};
%\node[fill=blue!30, main node] (2) at (90:3) {$B$};
%\node[fill=red!50, main node] (3) at (150:2) {$R$};
%\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
%\node[fill=blue!30, main node] (5) at (270:2) {$B$};
%\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
%\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
%\draw(6) -- (1) (6) -- (3) (6) -- (5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node[fill=yellow!50, main node] (0) at (-30:3) {$Y$};
\node[fill=blue!30, main node] (1) at (30:2) {$B$};
\node[fill=blue!30, main node] (2) at (90:3) {$B$};
\node[fill=red!50, main node] (3) at (150:2) {$R$};
\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
\node[fill=blue!30, main node] (5) at (270:2) {$B$};
\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
\draw(6) -- (1) (6) -- (3) (6) -- (5);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Here, the colors of the nodes represent the colors of the flags hoisted by the
respective towns, and the letters inside the nodes represent them as well (for
the convenience of anyone reading this in black-and-white). (\textquotedblleft
Y\textquotedblright\ means \textquotedblleft yellow\textquotedblright;
\textquotedblleft R\textquotedblright\ means \textquotedblleft
red\textquotedblright; \textquotedblleft B\textquotedblright\ means
\textquotedblleft blue\textquotedblright.) Now, a revolution can happen (e.g.)
in the yellow-flagged town at the bottom right of the country. The plurality
of this town's neighbors are flying blue flags (in fact, both of its neighbors
are), so the revolution causes this town to fly a blue flag, too:%
\[%
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
%\node[fill=blue!30, main node] (1) at (30:2) {$B$};
%\node[fill=blue!30, main node] (2) at (90:3) {$B$};
%\node[fill=red!50, main node] (3) at (150:2) {$R$};
%\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
%\node[fill=blue!30, main node] (5) at (270:2) {$B$};
%\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
%\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
%\draw(6) -- (1) (6) -- (3) (6) -- (5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
\node[fill=blue!30, main node] (1) at (30:2) {$B$};
\node[fill=blue!30, main node] (2) at (90:3) {$B$};
\node[fill=red!50, main node] (3) at (150:2) {$R$};
\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
\node[fill=blue!30, main node] (5) at (270:2) {$B$};
\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
\draw(6) -- (1) (6) -- (3) (6) -- (5);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Next, a revolution can happen (e.g.) in the blue-flagged town at the bottom of
the country. The plurality of this town's neighbors (namely, two of its three
neighbors) are flying yellow flags; thus, this town becomes yellow too:
\begin{equation}%
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
%\node[fill=blue!30, main node] (1) at (30:2) {$B$};
%\node[fill=blue!30, main node] (2) at (90:3) {$B$};
%\node[fill=red!50, main node] (3) at (150:2) {$R$};
%\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
%\node[fill=yellow!50, main node] (5) at (270:2) {$Y$};
%\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
%\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
%\draw(6) -- (1) (6) -- (3) (6) -- (5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
\node[fill=blue!30, main node] (1) at (30:2) {$B$};
\node[fill=blue!30, main node] (2) at (90:3) {$B$};
\node[fill=red!50, main node] (3) at (150:2) {$R$};
\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
\node[fill=yellow!50, main node] (5) at (270:2) {$Y$};
\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
\draw(6) -- (1) (6) -- (3) (6) -- (5);
\end{tikzpicture}%
%EndExpansion
\ \ . \label{eq.exe.inv.revols1.exa3}%
\end{equation}
Next, a revolution can happen in the red town, resulting in%
\[%
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
%\node[fill=blue!30, main node] (1) at (30:2) {$B$};
%\node[fill=blue!30, main node] (2) at (90:3) {$B$};
%\node[fill=yellow!50, main node] (3) at (150:2) {$Y$};
%\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
%\node[fill=yellow!50, main node] (5) at (270:2) {$Y$};
%\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
%\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
%\draw(6) -- (1) (6) -- (3) (6) -- (5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node[fill=blue!30, main node] (0) at (-30:3) {$B$};
\node[fill=blue!30, main node] (1) at (30:2) {$B$};
\node[fill=blue!30, main node] (2) at (90:3) {$B$};
\node[fill=yellow!50, main node] (3) at (150:2) {$Y$};
\node[fill=yellow!50, main node] (4) at (210:3) {$Y$};
\node[fill=yellow!50, main node] (5) at (270:2) {$Y$};
\node[fill=yellow!50, main node] (6) at (0, 0) {$Y$};
\draw(0) -- (1) -- (2) -- (3) -- (4) -- (5) -- (0);
\draw(6) -- (1) (6) -- (3) (6) -- (5);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
The country is now stable: No further revolutions can happen. (This does not
mean that each town has the same flag color as a plurality of its neighbors;
it only means that no other color has a plurality among its neighbors.)]
\end{exercise}

\begin{remark}
If revolutions were allowed to happen simultaneously in Exercise
\ref{exe.inv.revols1}, then the claim of the exercise would not be true. For
instance, here is an example where revolutions all happen simultaneously in
all towns, causing every town to switch colors every time (and never
stabilizing):
\begin{align*}
&
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node at (3, 0) {$\to$};
%\node[fill=yellow!50, main node] (0) at (0:2) {$Y$};
%\node[fill=blue!30, main node] (1) at (90:2) {$B$};
%\node[fill=yellow!50, main node] (2) at (180:2) {$Y$};
%\node[fill=blue!30, main node] (3) at (270:2) {$B$};
%\draw(0) -- (1) -- (2) -- (3) -- (0);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node at (3, 0) {$\to$};
\node[fill=yellow!50, main node] (0) at (0:2) {$Y$};
\node[fill=blue!30, main node] (1) at (90:2) {$B$};
\node[fill=yellow!50, main node] (2) at (180:2) {$Y$};
\node[fill=blue!30, main node] (3) at (270:2) {$B$};
\draw(0) -- (1) -- (2) -- (3) -- (0);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node at (3, 0) {$\to$};
%\node[fill=blue!30, main node] (0) at (0:2) {$B$};
%\node[fill=yellow!50, main node] (1) at (90:2) {$Y$};
%\node[fill=blue!30, main node] (2) at (180:2) {$B$};
%\node[fill=yellow!50, main node] (3) at (270:2) {$Y$};
%\draw(0) -- (1) -- (2) -- (3) -- (0);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node at (3, 0) {$\to$};
\node[fill=blue!30, main node] (0) at (0:2) {$B$};
\node[fill=yellow!50, main node] (1) at (90:2) {$Y$};
\node[fill=blue!30, main node] (2) at (180:2) {$B$};
\node[fill=yellow!50, main node] (3) at (270:2) {$Y$};
\draw(0) -- (1) -- (2) -- (3) -- (0);
\end{tikzpicture}%
%EndExpansion
\\
& \\
&
%TCIMACRO{\TeXButton{tikz country}{\begin{tikzpicture}%
%[main node/.style={circle,draw}]
%\node at (3.5, 0) {$\to\cdots.$};
%\node[fill=yellow!50, main node] (0) at (0:2) {$Y$};
%\node[fill=blue!30, main node] (1) at (90:2) {$B$};
%\node[fill=yellow!50, main node] (2) at (180:2) {$Y$};
%\node[fill=blue!30, main node] (3) at (270:2) {$B$};
%\draw(0) -- (1) -- (2) -- (3) -- (0);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[main node/.style={circle,draw}]
\node at (3.5, 0) {$\to\cdots.$};
\node[fill=yellow!50, main node] (0) at (0:2) {$Y$};
\node[fill=blue!30, main node] (1) at (90:2) {$B$};
\node[fill=yellow!50, main node] (2) at (180:2) {$Y$};
\node[fill=blue!30, main node] (3) at (270:2) {$B$};
\draw(0) -- (1) -- (2) -- (3) -- (0);
\end{tikzpicture}%
%EndExpansion
\end{align*}


Some things can be said about the variant of the exercise in which \textbf{all
possible} revolutions are happening simultaneously (e.g., each night, at
midnight, every town whose flag color differs from that of a plurality of its
neighbors undergoes a revolution). In this case, I suspect that the country
will either become stable, or will end up oscillating between two states from
a certain day on. A similar result (albeit not quite the same, as it includes
a rule for tiebreaking between equinumerous pluralities) appears in
\cite[Theorem 2.1]{GolTch83}.
\end{remark}

\begin{proof}
[Solution to Exercise \ref{exe.inv.revols1} (sketched).]A \textit{couple}
shall mean a set $\left\{  a,b\right\}  $ of two towns $a$ and $b$ that are
connected by a (direct) road. A couple $\left\{  a,b\right\}  $ shall be
called \textit{discordant} if the towns $a$ and $b$ fly different colors;
otherwise, it shall be called \textit{non-discordant}. (Of course, these
concepts depend on the state of the country; a discordant couple can become
non-discordant after a revolution, and vice versa.)

Define the \textit{discord} of a state to be the \# of all discordant couples
in this state. (For example, the discord of the state shown in
(\ref{eq.exe.inv.revols1.exa3}) is $5$. The discord of a state can be read off
its pictorial representation, as it is simply the \# of segments whose two
endpoints have different colors -- at least if we don't have two towns
connected by more than one direct road.)

The discord of a state is thus a nonnegative integer.

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Each revolution decreases the discord of the state.
\end{statement}

[\textit{Proof of Claim 1:} Let us consider a revolution happening in a town
$t$. We notice that the only flag that gets recolored during this revolution
is the flag in town $t$. Let $d$ be the color that $t$ flies before the
revolution, and let $c$ be the color that $t$ flies after the revolution. Due
to the way revolutions work, the color $c$ must be the flag color of a
plurality of $t$'s neighbors. Thus, in particular, more of $t$'s neighbors are
flying the color $c$ than are flying the color $d$. (Here we are using the
fact that $c\neq d$, which is because otherwise our \textquotedblleft
revolution\textquotedblright\ would not count as a revolution.) Let $\gamma$
be the \# of $t$'s neighbors that are flying the color $c$, and let $\delta$
be the \# of $t$'s neighbors that are flying the color $d$. (We don't need to
specify whether we are talking of \textquotedblleft before the
revolution\textquotedblright\ or \textquotedblleft after the
revolution\textquotedblright, since the revolution only changes the color of
$t$, not the color of $t$'s neighbors.) Thus, $\gamma>\delta$ (since more of
$t$'s neighbors are flying the color $c$ than are flying the color $d$).
Hence, $\gamma-\delta>0$.

Now, we consider the effect of the revolution on couples:

\begin{itemize}
\item If a couple does not include $t$, then the revolution does not change
the discordant/non-discordant status of the couple (i.e., if the couple was
discordant before the revolution, then it stays discordant; if it was
non-discordant, then it stays non-discordant).

\item If a couple has the form $\left\{  t,x\right\}  $, where $x$ is a
neighbor of $t$ flying the color $d$, then this couple $\left\{  t,x\right\}
$ was non-discordant before the revolution (since $t$ also had the color $d$
before the revolution) but becomes discordant after the revolution (because
the color of $t$ changes). Note that there are exactly $\delta$ such couples
(since $\delta$ is the \# of $t$'s neighbors that are flying the color $d$).

\item If a couple has the form $\left\{  t,y\right\}  $, where $y$ is a
neighbor of $t$ flying the color $c$, then this couple $\left\{  t,y\right\}
$ was discordant before the revolution (since $t$ had the color $d$, and since
$c\neq d$) but becomes non-discordant after the revolution (because the color
of $t$ changes to $c$). Note that there are exactly $\gamma$ such couples
(since $\gamma$ is the \# of $t$'s neighbors that are flying the color $c$).

\item If a couple has the form $\left\{  t,z\right\}  $, where $z$ is a
neighbor of $t$ flying a color distinct from $d$ and $c$, then this couple
$\left\{  t,z\right\}  $ was discordant before the revolution and remains so
after the revolution.
\end{itemize}

\noindent This accounts for all couples. Thus, the revolution causes exactly
$\delta$ non-discordant couples to become discordant, and causes exactly
$\gamma$ discordant couples to become non-discordant. The total \# of
discordant couples thus decreases by $\gamma-\delta$. Since $\gamma-\delta>0$,
this shows that the total \# of discordant couples decreases. Thus, Claim 1 is proven.]

The rest of the solution is now essentially a repetition of the
\textquotedblleft infinite descent\textquotedblright\ argument we have seen in
the discussion of Exercise \ref{exe.infdesc.sqrt3}. Namely, Claim 1 shows that
each revolution decreases the discord of the state. But the discord of any
state is a nonnegative integer, and thus cannot decrease indefinitely. More
concretely: If the discord of the original state was $N$, then the discord
cannot decrease more than $N$ times without becoming negative. Thus, we cannot
have more than $N$ successive revolutions. This solves Exercise
\ref{exe.inv.revols1}.
\end{proof}

The following exercise is a variation on Exercise
\ref{exe.inv.swap-dist-2.100} -- with a different answer, however:

\begin{exercise}
\label{exe.inv.swap-dist-2.99}The numbers $1,2,\ldots,99$ are written in a row
(in this order, from left to right). In a move, you can swap any two numbers
at a distance of $2$ (i.e., any two numbers that have exactly one number
written between them). Can you end up with the numbers $99,98,\ldots,1$ (in
this order, from left to right) by a sequence of such moves?

[See the Example in Exercise \ref{exe.inv.swap-dist-2.100} for how such moves
look like.]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.swap-dist-2.99} (sketched).]Yes, you can.

\textit{Proof.} The number $99$ is odd, so we cannot proceed as in Exercise
\ref{exe.inv.swap-dist-2.100}. However, we can argue as follows:\footnote{Note
that we are not going to use any \textquotedblleft new\textquotedblright%
\ monovariants in this argument; instead, we shall use Exercise
\ref{exe.monv.sort.1}, thus in a way reusing the monovariant we already used
to solve Exercise \ref{exe.monv.sort.1}.}

We identify each state with the $99$-tuple consisting of the numbers written
on the row, in the order in which they appear (from left to right). Thus, the
initial state is the $99$-tuple $\left(  1,2,\ldots,99\right)  $, whereas the
state we are trying to reach is $\left(  99,98,\ldots,1\right)  $.

First of all, we observe that our moves are reversible: More precisely, we can
undo each move by making the same move (since swapping the same two numbers
twice in a row is tantamount to doing nothing). Thus, if there is a sequence
of moves that transforms a certain state $A$ into a certain state $B$, then
there also is a sequence of moves that transforms the state $B$ into the state
$A$ (namely, the original sequence of moves, but made in backwards order).
Hence, in particular, if there is a sequence of moves that transforms the
state $\left(  99,98,\ldots,1\right)  $ into the state $\left(  1,2,\ldots
,99\right)  $, then there also is a sequence of moves that transforms the
state $\left(  1,2,\ldots,99\right)  $ into the state $\left(  99,98,\ldots
,1\right)  $.

Hence, instead of solving the exercise as it is posed, let us solve the
\textquotedblleft inverse\textquotedblright\ exercise (i.e., the exercise with
initial state and desired state interchanged): Let us find a sequence of moves
that transforms the state $\left(  99,98,\ldots,1\right)  $ into the state
$\left(  1,2,\ldots,99\right)  $. As we have just said, this is equivalent to
the exercise as it is posed.

We define the \textit{position} of a number $i\in\left[  99\right]  $ in a
given state to be the (unique) $j\in\left[  99\right]  $ with the property
that $i$ is the $j$-th number from the left on our row.

In any state, we shall call a number $i\in\left[  99\right]  $
\textit{odd-positioned} if its position is odd\footnote{i.e., if it has an
even \# of numbers to its left}, and we shall call a number
\textit{even-positioned} if its position is even. In the initial state of our
\textquotedblleft inverse\textquotedblright\ exercise (which, as we recall, is
the $99$-tuple $\left(  99,98,\ldots,1\right)  $), the odd-positioned numbers
are $99,97,95,\ldots,1$ (indeed, their positions are $1,3,5,\ldots,99$,
respectively), and the even-positioned numbers are $98,96,94,\ldots,2$
(indeed, their positions are $2,4,6,\ldots,98$, respectively). A move can
change the position of a number, but it does not change the \textbf{parity} of
this position (as we have already seen in the solution to Exercise
\ref{exe.inv.swap-dist-2.100}). Thus, odd-positioned numbers remain
odd-positioned after any number of moves. Hence, the numbers $99,97,95,\ldots
,1$ are not just odd-positioned at the onset, but remain odd-positioned after
any number of moves. Likewise, the numbers $98,96,94,\ldots,2$ remain even-positioned.

Now, let us focus entirely on the odd-positioned numbers (while forgetting
about the even-positioned numbers). Using our moves, we can swap any two
adjacent odd-positioned numbers\footnote{Here, \textquotedblleft
adjacent\textquotedblright\ means \textquotedblleft adjacent, if we ignore the
even-positioned numbers\textquotedblright. That is, two odd-positioned numbers
are said to be \textit{adjacent} if there are no odd-positioned numbers
between them. In terms of the original row of $99$ numbers, this means that
they have exactly one number between them.}. From Exercise
\ref{exe.monv.sort.1}, we know that there is a sequence of such swaps that
rearranges these odd-positioned numbers in weakly increasing order. Each of
these swaps corresponds to a move in the sense of Exercise
\ref{exe.inv.swap-dist-2.99}; moreover, these moves do not affect the
even-positioned numbers. Hence, after we perform all these moves, our
odd-positioned numbers have been rearranged in increasing order (so that they
are now $1,3,5,\ldots,97,99$ from left to right), whereas the even-positioned
numbers are still as they were at the onset (i.e., they are still
$98,96,94,\ldots,2$ from left to right).

Next, let us perform the analogous operations with the even-positioned
numbers: Our moves allow us to swap any two adjacent even-positioned numbers,
and (with the help of Exercise \ref{exe.monv.sort.1}) we can find a sequence
of such swaps that rearranges these even-positioned numbers in weakly
increasing order without affecting the odd-positioned numbers. Thus, after we
perform all these moves, our even-positioned numbers have been rearranged in
increasing order (so that they are now $2,4,6,\ldots,96,98$ from left to
right), whereas the odd-positioned numbers are still as they were before this
second set of moves (i.e., they are still $1,3,5,\ldots,97,99$ from left to right).

Thus, in the state we have now obtained after all these moves, the
odd-positioned numbers are $1,3,5,\ldots,97,99$ from left to right, and the
even-positioned numbers are $2,4,6,\ldots,96,98$ from left to right. Hence,
this state is $\left(  1,2,\ldots,99\right)  $. Thus, we have found a sequence
of moves that transforms the state $\left(  99,98,\ldots,1\right)  $ into the
state $\left(  1,2,\ldots,99\right)  $. This solves the \textquotedblleft
inverse\textquotedblright\ exercise, and thus (as we have already explained)
also solves the original Exercise \ref{exe.inv.swap-dist-2.99}.
\end{proof}

We note that our above solution illustrates yet another useful tool in problem
solving: the tactic of \textit{inverting} a problem. In our case, this meant
interchanging the starting state and the desired goal. This is a useful tactic
in its own right (and can be useful even when the moves are not reversible; in
such cases one will have to define a new kind of moves, which undo the
original moves). It is known as \textquotedblleft\textit{working
backwards}\textquotedblright\ and is briefly discussed in \cite[\S 14.3]%
{Engel}.

The next exercise is another quasi-geometric puzzle:

\begin{exercise}
\label{exe.inv.move-far-away}Let $n\geq2$ be an integer. A country has $n$
towns, the distances between which are distinct.

\textbf{(a)} You start in a town $A_{1}$. From there you travel to the town
$A_{2}$ that is farthest away from $A_{1}$. From there you travel to the town
$A_{3}$ that is farthest away from $A_{2}$. You continue travelling in the
same pattern. Prove the following: If $A_{3}\neq A_{1}$, then you never come
back to the town $A_{1}$.

\textbf{(b)} Prove the same claim if the words \textquotedblleft farthest away
from\textquotedblright\ are replaced by \textquotedblleft closest
to\textquotedblright. (Of course, a town does not count as the closest town to itself.)

[\textbf{Example:} Assume that $n=4$ and that the towns are the four points
$A=\left(  0,0\right)  $, $B=\left(  1,1\right)  $, $C=\left(  3,0\right)  $
and $D=\left(  0,-2\right)  $ in the Euclidean plane. This is illustrated in
the following picture:%
\[%
%TCIMACRO{\TeXButton{tikz four towns}{\begin{tikzpicture}[scale=1.5]
%\node(A) at (0, 0) {};
%\node(B) at (1, 1) {};
%\node(C) at (3, 0) {};
%\node(D) at (0, -2) {};
%\fill(A) circle (2pt) node[left] {$A$};
%\fill(B) circle (2pt) node[above right] {$B$};
%\fill(C) circle (2pt) node[right] {$C$};
%\fill(D) circle (2pt) node[below right] {$D$};
%\draw[thick, blue] (A) -- (B) node [midway, fill=white] {$1.4$};
%\draw[thick, blue] (B) -- (C) node [midway, fill=white] {$2.2$};
%\draw[thick, blue] (C) -- (D) node [midway, fill=white] {$3.6$};
%\draw[thick, blue] (A) -- (D) node [midway, fill=white] {$2$};
%\draw[thick, blue] (A) -- (C) node [midway, fill=white] {$3$};
%\draw[thick, blue] (B) -- (D) node [midway, fill=white] {$3.1$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1.5]
\node(A) at (0, 0) {};
\node(B) at (1, 1) {};
\node(C) at (3, 0) {};
\node(D) at (0, -2) {};
\fill(A) circle (2pt) node[left] {$A$};
\fill(B) circle (2pt) node[above right] {$B$};
\fill(C) circle (2pt) node[right] {$C$};
\fill(D) circle (2pt) node[below right] {$D$};
\draw[thick, blue] (A) -- (B) node [midway, fill=white] {$1.4$};
\draw[thick, blue] (B) -- (C) node [midway, fill=white] {$2.2$};
\draw[thick, blue] (C) -- (D) node [midway, fill=white] {$3.6$};
\draw[thick, blue] (A) -- (D) node [midway, fill=white] {$2$};
\draw[thick, blue] (A) -- (C) node [midway, fill=white] {$3$};
\draw[thick, blue] (B) -- (D) node [midway, fill=white] {$3.1$};
\end{tikzpicture}%
%EndExpansion
\]
(with the edges labeled by their respective lengths). Now, in Exercise
\ref{exe.inv.move-far-away} \textbf{(a)}, if you start in the town $A$, then
you travel to the town $C$, then to $D$, then to $C$, and afterwards just keep
moving around between $C$ and $D$. In Exercise \ref{exe.inv.move-far-away}
\textbf{(b)}, if you start in the town $D$, then you travel to the town $A$,
then to $B$, then to $A$, and afterwards just keep moving around between $B$
and $A$.]
\end{exercise}

We notice that Exercise \ref{exe.inv.move-far-away} \textbf{(b)} can be
restated in terms of the cowboys from Exercise \ref{exe.ext.cowboys-a}.
Indeed, in the latter language, it says that the paths of the bullets do not
form any closed polygonal path (other than \textquotedblleft$2$%
-gons\textquotedblright) whenever $n\geq2$ (not necessarily odd).

\begin{proof}
[Solution to Exercise \ref{exe.inv.move-far-away} (sketched).]\textbf{(a)} The
trick is to realize that each leg of your journey is longer than the previous
one, unless it leads you straight back to the town you just came from. Here
are the details: We claim the following:

\begin{statement}
\textit{Claim 1:} We have $\left\vert A_{1}A_{2}\right\vert \leq\left\vert
A_{2}A_{3}\right\vert \leq\left\vert A_{3}A_{4}\right\vert \leq\cdots$.
\end{statement}

\begin{statement}
\textit{Claim 2:} If $A_{3}\neq A_{1}$, then $\left\vert A_{1}A_{2}\right\vert
<\left\vert A_{2}A_{3}\right\vert $.
\end{statement}

[\textit{Proof of Claim 1:} We must show that $\left\vert A_{i-1}%
A_{i}\right\vert \leq\left\vert A_{i}A_{i+1}\right\vert $ for each integer
$i\geq2$. So let $i\geq2$ be an integer. We have $A_{i-1}\neq A_{i}$ (since
you don't ever travel from a town directly to itself). From the way the
journey $A_{1}A_{2}A_{3}\cdots$ was defined, we know that $A_{i+1}$ is the
town that is farthest away from $A_{i}$. Hence, $\left\vert A_{i}%
A_{i+1}\right\vert \geq\left\vert A_{i}X\right\vert $ for every town $X\neq
A_{i}$. We can apply this to $X=A_{i-1}$ (since $A_{i-1}\neq A_{i}$), and
conclude that $\left\vert A_{i}A_{i+1}\right\vert \geq\left\vert A_{i}%
A_{i-1}\right\vert =\left\vert A_{i-1}A_{i}\right\vert $. In other words,
$\left\vert A_{i-1}A_{i}\right\vert \leq\left\vert A_{i}A_{i+1}\right\vert $.
This is precisely what we needed to show. Thus, Claim 1 is proven.]

[\textit{Proof of Claim 2:} Assume that $A_{3}\neq A_{1}$. Then, the line
segments $A_{1}A_{2}$ and $A_{2}A_{3}$ are distinct. Hence, $\left\vert
A_{1}A_{2}\right\vert \neq\left\vert A_{2}A_{3}\right\vert $ (since we assumed
that the distances between the towns are distinct). However, Claim 1 yields
$\left\vert A_{1}A_{2}\right\vert \leq\left\vert A_{2}A_{3}\right\vert $.
Combining this with $\left\vert A_{1}A_{2}\right\vert \neq\left\vert
A_{2}A_{3}\right\vert $, we obtain $\left\vert A_{1}A_{2}\right\vert
<\left\vert A_{2}A_{3}\right\vert $. Thus, Claim 2 follows.]

Now, assume that $A_{3}\neq A_{1}$. We must prove that you never come back to
the town $A_{1}$. Indeed, assume the contrary. Thus, you do come back to the
town $A_{1}$ at some point. In other words, there exists an integer $i\geq2$
such that $A_{i}=A_{1}$. Consider this $i$. Note that $A_{i}=A_{1}\neq A_{2}$
(since you don't ever travel from a town directly to itself), and thus
$i\neq2$. Hence, $i\geq3$ (since $i\geq2$).

Now, Claim 1 yields $\left\vert A_{1}A_{2}\right\vert \leq\left\vert
A_{2}A_{3}\right\vert \leq\left\vert A_{3}A_{4}\right\vert \leq\cdots$, so
that $\left\vert A_{2}A_{3}\right\vert \leq\left\vert A_{3}A_{4}\right\vert
\leq\cdots\leq\left\vert A_{i-1}A_{i}\right\vert $\ \ \ \ \footnote{If $i=3$,
then this chain of inequalities is a trivial chain with only one number and no
inequality signs. But as you can easily see, this does not invalidate the
argument that we are now going to make.}. Hence, $\left\vert A_{2}%
A_{3}\right\vert \leq\left\vert A_{i-1}A_{i}\right\vert $. But Claim 2 yields
$\left\vert A_{1}A_{2}\right\vert <\left\vert A_{2}A_{3}\right\vert $. Thus,
\begin{equation}
\left\vert A_{1}A_{2}\right\vert <\left\vert A_{2}A_{3}\right\vert
\leq\left\vert A_{i-1}A_{i}\right\vert =\left\vert A_{i}A_{i-1}\right\vert
=\left\vert A_{1}A_{i-1}\right\vert \label{sol.inv.move-far-away.a.4}%
\end{equation}
(since $A_{i}=A_{1}$). Also, $A_{i-1}\neq A_{i}$ (since you don't ever travel
from a town directly to itself), and thus $A_{i-1}\neq A_{i}=A_{1}$.

However, from the way the journey $A_{1}A_{2}A_{3}\cdots$ was defined, we know
that $A_{2}$ is the town that is farthest away from $A_{1}$. Hence,
$\left\vert A_{1}A_{2}\right\vert \geq\left\vert A_{1}X\right\vert $ for every
town $X\neq A_{1}$. Applying this to $X=A_{i-1}$, we obtain $\left\vert
A_{1}A_{2}\right\vert \geq\left\vert A_{1}A_{i-1}\right\vert $ (since
$A_{i-1}\neq A_{1}$). This contradicts (\ref{sol.inv.move-far-away.a.4}). This
contradiction shows that our assumption was wrong. Hence, Exercise
\ref{exe.inv.move-far-away} \textbf{(a)} is solved.

\textbf{(b)} Exercise \ref{exe.inv.move-far-away} \textbf{(b)} can be solved
by the exact same argument as Exercise \ref{exe.inv.move-far-away}
\textbf{(a)}, just with all inequality signs reversed (i.e., we have to
replace every \textquotedblleft$\leq$\textquotedblright\ by an
\textquotedblleft$\geq$\textquotedblright\ and likewise).
\end{proof}

The next exercise (which is similar in many ways to Exercise
\ref{exe.inv.revols1}) models the typical failure of breakout rooms at a Zoom conference:

\begin{exercise}
\label{exe.inv.building-rooms1}Several people are in a building with several
rooms. Each minute, one person leaves a room and moves to another that has
more people (not counting the person who is moving). (That is: If a person was
in a room with $m$ other people, he moves to a room with more than $m$ other
people.) Prove that eventually, all of the people will end up in the same room.

[\textbf{Example:} Let us assume that the starting state is $\left(
4,2,2\right)  $, by which we mean that there are $4$ people in one room, $2$
in another, and $2$ in a third room. Now, one of the two people from the
second room may move into the third, resulting in the state $\left(
4,1,3\right)  $. Then, one person from the third room may move into the first,
resulting in $\left(  5,1,2\right)  $. Then, the single inhabitant from the
second room may move into the first, resulting in $\left(  6,0,2\right)  $.
Two more moves later, we obtain the state $\left(  8,0,0\right)  $, which
means that everybody is in the first room.]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.building-rooms1} (sketched).]A
\textit{dispersed couple} shall mean a $2$-element set $\left\{  u,v\right\}
$ consisting of two people $u$ and $v$ that are in different rooms. (Of
course, this notion depends on the state.) Define the \textit{dispersion} of a
state to be the \# of dispersed couples in that state. (For example, the state
$\left(  4,2,2\right)  $ in the above example has dispersion $4\cdot
2+4\cdot2+2\cdot2=20$.) Clearly, the dispersion of a state is a nonnegative integer.

Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Each minute, the dispersion of the state decreases.
\end{statement}

[\textit{Proof of Claim 1:} Consider what happens in a given minute. Namely,
one person leaves a room and moves to another that has more people (not
counting the person who is moving). Let $p$ be this person; let $M$ be the
room that $p$ is leaving; let $N$ be the room that $p$ is entering. Then, room
$N$ has more people than room $M$ (not counting $p$), because $p$ is moving to
a room with more people.

Let $m$ be the \# of people in room $M$ (not counting $p$), and let $n$ be the
\# of people in room $N$ (not counting $p$). Then, $n>m$ (since room $N$ has
more people than room $M$), so that $n-m>0$. It is now easy to see that this
move decreases the dispersion of the state by $n-m$ (since $n$ dispersed
couples disappear\footnote{Namely, the $n$ couples of the form $\left\{
p,x\right\}  $ with $x\in N$ were dispersed before the move but are no longer
dispersed after the move.}, and $m$ new dispersed couples
appear\footnote{Namely, the $m$ couples of the form $\left\{  p,x\right\}  $
with $x\in M$ were not dispersed before the move but become dispersed after
the move.}). Since $n-m>0$, this entails that the dispersion of the state
decreases. Thus, Claim 1 is proven.]

The rest of the solution is now essentially a repetition of the
\textquotedblleft infinite descent\textquotedblright\ argument we have seen in
the discussion of Exercise \ref{exe.infdesc.sqrt3} (and again in the solution
to Exercise \ref{exe.inv.revols1}). Namely, Claim 1 shows that the dispersion
of the state decreases each minute. But the dispersion of any state is a
nonnegative integer, and thus cannot decrease indefinitely. More concretely:
If the dispersion of the original state was $N$, then the dispersion cannot
decrease more than $N$ times without becoming negative. Thus, the moves cannot
go on for more than $N$ minutes.

Hence, after at most $N$ moves, we must arrive at a state where no person can
move any more. But what does it mean that no person can move? If there is any
dispersed couple $\left\{  p,q\right\}  $, then at least one of the two people
$p$ and $q$ can move\footnote{\textit{Proof:} Assume that there is a dispersed
couple $\left\{  p,q\right\}  $. We claim that at least one of the two people
$p$ and $q$ can move. Indeed, we WLOG assume that the room containing $p$ has
at least as many people in it as the room containing $q$ (otherwise, we can
just interchange $p$ with $q$). Then, the room containing $p$ has (strictly)
more people than the room containing $q$ \textbf{if we don't count }$q$
(because not counting $q$ decreases the head count of the latter room by $1$).
Therefore, $q$ can move from the latter room into the former room (according
to the rules of the game). Thus, at least one of the two people $p$ and $q$
can move (in this case, $q$). Qed.}. Hence, if no person can move, then there
is no dispersed couple, and therefore all of the people must be in the same
room. Thus, after at most $N$ moves, we must arrive at a state where all of
the people are in the same room (because we know that after at most $N$ moves,
we must arrive at a state where no person can move any more). This solves
Exercise \ref{exe.inv.building-rooms1}.
\end{proof}

Next, a more advanced monovariant problem:

\begin{exercise}
\label{exe.inv.sandpileZZ-2}Consider a hotel with an infinite number of rooms,
arranged sequentially on the ground floor. The rooms are labelled (from left
to right) by integers $i\in\mathbb{Z}$, with room $i$ being adjacent to rooms
$i-1$ and $i+1$. (To be specific, room $i-1$ is left of room $i$, while room
$i+1$ is right of room $i$.) Thus, the hotel looks as follows:%
\[%
\begin{tabular}
[c]{cccccccc}\cline{2-7}%
$\cdots$ & \multicolumn{1}{|c}{$\phantom{2}$} &
\multicolumn{1}{|c}{$\phantom{2}$} & \multicolumn{1}{|c}{$\phantom{2}$} &
\multicolumn{1}{|c}{$\phantom{2}$} & \multicolumn{1}{|c}{$\phantom{2}$} &
\multicolumn{1}{|c}{$\phantom{2}$} & \multicolumn{1}{|c}{$\cdots$%
}\\\cline{2-7}
& $\uparrow$ & $\uparrow$ & $\uparrow$ & $\uparrow$ & $\uparrow$ & $\uparrow$
& \\
& room $-2$ & room $-1$ & room $0$ & room $1$ & room $2$ & room $3$ &
\end{tabular}
\]
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel).

A finite number of violinists are staying in the hotel; each room has at most
one violinist in it. Each night, some two violinists staying in adjacent rooms
(if two such violinists exist) decide they cannot stand each other's noise,
and move apart: One of them moves to the nearest unoccupied room to the left,
while the other moves to the nearest unoccupied room to the right. (The two
violinists move simultaneously, so one moving away does not prevent the other
from moving. Only two violinists move in any given night.) This keeps
happening for as long as there are two violinists in adjacent rooms.

Prove that this moving will stop after a finite number of days (i.e., there
will be a day when no two violinists are in adjacent rooms any more).

[\textbf{Example:} Let us assume that initially, there are $5$ violinists
(named $a,b,c,d,e$), arranged as follows:%
\begin{equation}
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $\phantom{2}$ & $a$ & $b$ & $\phantom{2}$ & $c$ & $d$ &
$\phantom{2}$ & $e$ & $\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots\label{eq.exe.inv.sandpileZZ-2.exa1}%
\end{equation}
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel). On the first night,
let's say the violinists $a$ and $b$ tire of each other's presence and move
apart; this results in the following state:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $\phantom{2}$ & $\phantom{2}$ & $b$ & $c$ & $d$ &
$\phantom{2}$ & $e$ & $\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
Now, let's say that violinists $b$ and $c$ move apart on the next night,
resulting in%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $\phantom{2}$ & $b$ & $\phantom{2}$ & $\phantom{2}$ &
$d$ & $c$ & $e$ & $\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
On the next night, violinists $c$ and $e$ decide to move apart:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $\phantom{2}$ & $b$ & $\phantom{2}$ & $c$ & $d$ &
$\phantom{2}$ & $\phantom{2}$ & $e$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
On the next night, violinists $c$ and $d$ decide to move apart:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $\phantom{2}$ & $b$ & $c$ & $\phantom{2}$ &
$\phantom{2}$ & $d$ & $\phantom{2}$ & $e$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
On the next night, violinists $b$ and $c$ decide to move apart:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $b$ & $\phantom{2}$ & $\phantom{2}$ & $c$ &
$\phantom{2}$ & $d$ & $\phantom{2}$ & $e$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
On the next night, violinists $a$ and $b$ decide to move apart:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$a$ & $\phantom{2}$ & $\phantom{2}$ & $b$ & $\phantom{2}$ & $c$ &
$\phantom{2}$ & $d$ & $\phantom{2}$ & $e$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots
\]
Now, there are no more neighbors -- so no further moves can happen.

(Of course, there were choices involved in this process; we have only shown
one possibility. Other pairs of neighbors may have moved apart instead, and
the resulting state could well be different. But the exercise claims that
whatever way the violinists move, the moving will come to an end eventually.)]
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.sandpileZZ-2} (sketched).]Note that each
room has at most one violinist staying in it in the initial state. This
property remains valid in all later states as well, since violinists can only
move into unoccupied rooms.

Let us regard the violinists as indistinguishable (i.e., we don't care which
violinist is in which room, but only care about which rooms are
occupied).\footnote{Indeed, the identities of the violinists are clearly
immaterial to the problem at hand.}

Thus, we can identify any state with the finite subset $\left\{
i\in\mathbb{Z}\ \mid\ \text{room }i\text{ is occupied}\right\}  $ of
$\mathbb{Z}$ (since each room has at most one violinist staying in it). Let us
make this identification; thus, states are finite subsets of $\mathbb{Z}$. For
example, the state shown in (\ref{eq.exe.inv.sandpileZZ-2.exa1}) is the subset
$\left\{  3,4,6,7,9\right\}  $, provided that the rooms shown in
(\ref{eq.exe.inv.sandpileZZ-2.exa1}) are the rooms $1,2,\ldots,11$.

Thus, any move removes two consecutive integers $j$ and $j+1$ from the state
and inserts two new integers into the state (one of which is $<j$ while the
other is $>j+1$). More precisely: If $S$ is a state and $j$ is an integer such
that both $j$ and $j+1$ belong to $S$, then there is a move that transforms
$S$ into the state
\begin{align*}
&  \left(  S\setminus\left\{  j,j+1\right\}  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \cup\left\{  \text{the largest integer }<j\text{ that
does not belong to }S\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \cup\left\{  \text{the smallest integer }>j+1\text{
that does not belong to }S\right\}  .
\end{align*}


We define the \textit{entropy} of a state $S$ to be the sum $\sum_{i\in
S}2^{i}$ (recalling that $S$ is a finite subset of $\mathbb{Z}$). This is a
rational number (since the sum is finite).

It is easy to see that this entropy increases each night. In other words:

\begin{statement}
\textit{Claim 1:} Whenever two violinists move apart, the entropy of the state increases.
\end{statement}

[\textit{Proof of Claim 1:} Consider two violinists moving apart. Let $j$ and
$j+1$ be the rooms where they live before the move, and let $p$ and $q$ be the
rooms where they live after the move, labelled in such a way that $p<j$ and
$q>j+1$. Then, $q>j+1$, so that $q\geq j+2$ (since $q$ and $j+1$ are integers)
and thus%
\[
2^{q}\geq2^{j+2}=2\cdot2^{j+1}=\underbrace{2^{j+1}}_{>2^{j}}+2^{j+1}%
>2^{j}+2^{j+1}%
\]
and therefore $2^{p}+2^{q}>2^{q}>2^{j}+2^{j+1}$. In other words, $2^{p}%
+2^{q}-2^{j}-2^{j+1}>0$.

Now, recall that the entropy of a state $S$ was defined as the sum $\sum_{i\in
S}2^{i}$. The move that we are currently considering removes the two addends
$2^{j}$ and $2^{j+1}$ from this sum, and inserts the two addends $2^{p}$ and
$2^{q}$ in their stead. Thus, this move increases this sum by $2^{p}%
+2^{q}-2^{j}-2^{j+1}$. Since $2^{p}+2^{q}-2^{j}-2^{j+1}>0$, this shows that
this move increases this sum. In other words, this move increases the entropy.
In other words, the entropy after the move is greater than the entropy before
the move. This proves Claim 1.]

\medskip This was a good step towards the solution, but we have still a long
way to go. In theory, there are infinitely many states possible (after all, a
state is just a finite subset of $\mathbb{Z}$, and there are infinitely many
of those), so the entropy could keep increasing indefinitely without the moves
ever coming to an end. If we could somehow show that only finitely many
possible states can be reached, then Claim 1 would show that the moving must
come to an end (because the set of possible entropies would then also be
finite, and thus the entropy could not keep increasing forever).

Fortunately, we can indeed prove this. To do so, we let $N$ be the \# of
violinists in the hotel. (Clearly, this \# does not change during the
process.) We shall show that the violinists never move \textquotedblleft too
far\textquotedblright\ away from their original rooms; more precisely, they
will always stay within $3N$ rooms of the interval between the leftmost and
the rightmost room occupied in the initial state. We shall now make this precise.

Let $S_{0}$ be the initial state. Consider a sequence of $g$ (successive)
moves, starting from state $S_{0}$ and leading to states $S_{1},S_{2}%
,S_{3},\ldots,S_{g}$ in this order (i.e., the first move transforms state
$S_{0}$ into state $S_{1}$; the next move transforms state $S_{1}$ into state
$S_{2}$; and so on). Thus, in any one of the states $S_{0},S_{1},\ldots,S_{g}%
$, there are exactly $N$ violinists in the hotel (since the \# of violinists
in the hotel never changes, and always equals $N$), and thus exactly $N$
occupied rooms (since each occupied room has exactly one violinist in it). In
other words, we have%
\begin{equation}
N=\left\vert S_{0}\right\vert =\left\vert S_{1}\right\vert =\cdots=\left\vert
S_{g}\right\vert . \label{sol.inv.sandpileZZ-2.N=}%
\end{equation}


We WLOG assume that $N>0$ (since otherwise, there are no violinists at all in
the hotel, and the exercise becomes trivial). Thus, the sets $S_{0}%
,S_{1},\ldots,S_{g}$ are nonempty finite sets (because
(\ref{sol.inv.sandpileZZ-2.N=}) shows that each of them has $N$ elements);
therefore, their minima and maxima are well-defined. Let $\alpha=\min\left(
S_{0}\right)  $ and $\omega=\max\left(  S_{0}\right)  $.

Now, we shall see that the violinists don't spread \textquotedblleft too
fast\textquotedblright\ through the hotel. To be more specific, we claim the following:

\begin{statement}
\textit{Claim 2:} We have $\min\left(  S_{i+1}\right)  \geq\min\left(
S_{i}\right)  -1$ for each $i\in\left\{  0,1,\ldots,g-1\right\}  $.
\end{statement}

[\textit{Proof of Claim 2:} Let $i\in\left\{  0,1,\ldots,g-1\right\}  $. We
must show that $\min\left(  S_{i+1}\right)  \geq\min\left(  S_{i}\right)  -1$.

Indeed, assume the contrary. Thus, $\min\left(  S_{i+1}\right)  <\min\left(
S_{i}\right)  -1$. Hence, $\min\left(  S_{i+1}\right)  +1<\min\left(
S_{i}\right)  $, so that $\min\left(  S_{i}\right)  >\min\left(
S_{i+1}\right)  +1$.

The room $\min\left(  S_{i+1}\right)  $ is occupied in state $S_{i+1}$ (since
$\min\left(  S_{i+1}\right)  \in S_{i+1}$). However, all rooms\footnote{We are
identifying each integer with the corresponding room of our hotel. Thus,
\textquotedblleft rooms $k<\min\left(  S_{i}\right)  $\textquotedblright%
\ means \textquotedblleft rooms $k$ to the left of room $\min\left(
S_{i}\right)  $\textquotedblright.} $k<\min\left(  S_{i}\right)  $ are
unoccupied in state $S_{i}$ (since $\min\left(  S_{i}\right)  $ is the
\textbf{smallest} element of $S_{i}$). Thus, in particular, the room
$\min\left(  S_{i+1}\right)  $ is unoccupied in state $S_{i}$ (since
$\min\left(  S_{i+1}\right)  <\min\left(  S_{i}\right)  -1<\min\left(
S_{i}\right)  $). Thus, we have shown that the room $\min\left(
S_{i+1}\right)  $ is occupied in state $S_{i+1}$ but not in state $S_{i}$.
Therefore, the move that transforms state $S_{i}$ into state $S_{i+1}$ must
place a violinist in room $\min\left(  S_{i+1}\right)  $. Let us denote this
violinist by $p$, and let us refer to this move as \textquotedblleft the move
$S_{i}\rightarrow S_{i+1}$\textquotedblright. Let $r$ be the room which
violinist $p$ occupies in state $S_{i}$ (that is, before this move). Then,
$r\geq\min\left(  S_{i}\right)  $ (since all rooms $k<\min\left(
S_{i}\right)  $ are unoccupied in state $S_{i}$), so that $r\geq\min\left(
S_{i}\right)  >\min\left(  S_{i}\right)  -1>\min\left(  S_{i+1}\right)  $.
Hence, in the move $S_{i}\rightarrow S_{i+1}$, the violinist $p$ moves left
(since $p$ moves from room $r$ to room $\min\left(  S_{i+1}\right)  $).

Recall again that all rooms $k<\min\left(  S_{i}\right)  $ are unoccupied in
state $S_{i}$. Hence, the room $\min\left(  S_{i+1}\right)  +1$ is unoccupied
in state $S_{i}$ (because $\min\left(  S_{i+1}\right)  +1<\min\left(
S_{i}\right)  $). Moreover, $\min\left(  S_{i+1}\right)  <\min\left(
S_{i+1}\right)  +1<r$ (since $r\geq\min\left(  S_{i}\right)  >\min\left(
S_{i+1}\right)  +1$). In other words, the room $\min\left(  S_{i+1}\right)
+1$ lies strictly between the two rooms $\min\left(  S_{i+1}\right)  $ and $r$.

Now, recall the nature of moves: When two violinists move apart, only one of
them moves left, and this violinist moves to the nearest unoccupied room to
its left. Thus, in the move $S_{i}\rightarrow S_{i+1}$, the violinist $p$
moves to the \textbf{nearest} unoccupied room to the left of room $r$ (since
he moves left, and since he is originally in room $r$). This \textbf{nearest}
unoccupied room, however, cannot be the room $\min\left(  S_{i+1}\right)  $,
because the room $\min\left(  S_{i+1}\right)  +1$ is also unoccupied in state
$S_{i}$ and lies strictly between the two rooms $\min\left(  S_{i+1}\right)  $
and $r$ (so that it is also to the left of room $r$ but is nearer to $r$ than
$\min\left(  S_{i+1}\right)  $). Hence, in the move $S_{i}\rightarrow S_{i+1}%
$, the violinist $p$ cannot move to the room $\min\left(  S_{i+1}\right)  $.
But this contradicts the fact that (as we have seen above) the move
$S_{i}\rightarrow S_{i+1}$ does place the violinist $p$ in room $\min\left(
S_{i+1}\right)  $. This contradiction shows that our assumption was wrong.
Hence, $\min\left(  S_{i+1}\right)  \geq\min\left(  S_{i}\right)  -1$ is
proved. This proves Claim 2.]

\medskip We next introduce another notation. If $S$ is any state (i.e., any
finite subset of $\mathbb{Z}$), then we define the subset $S^{-0+}$ of
$\mathbb{Z}$ by%
\begin{align*}
S^{-0+}  &  =S\cup\left\{  s+1\ \mid\ s\in S\right\}  \cup\left\{
s-1\ \mid\ s\in S\right\} \\
&  =\left\{  i\in\mathbb{Z}\ \mid\ i\in S\text{ or }i-1\in S\text{ or }i+1\in
S\right\}  .
\end{align*}
In other words, $S^{-0+}$ is the set of all integers $i$ that belong to $S$
themselves or have a neighbor (that is, $i-1$ or $i+1$) belong to $S$. If we
identify each integer with the corresponding room in our hotel, then we can
restate this as follows: $S^{-0+}$ is the set of all rooms that are occupied
or adjacent to an occupied room (assuming that $S$ is the set of all occupied
rooms)\footnote{For example, if $S=\left\{  2,4,8,9\right\}  $, then
$S^{-0+}=\left\{  2,4,8,9\right\}  \cup\left\{  3,5,9,10\right\}  \cup\left\{
1,3,7,8\right\}  =\left\{  1,2,3,4,5,7,8,9,10\right\}  $.}. Clearly, for any
state $S$, we have
\begin{equation}
\left\vert S^{-0+}\right\vert \leq3\cdot\left\vert S\right\vert
\label{sol.inv.sandpileZZ-2.S-0+.size}%
\end{equation}
(this follows easily from (\ref{eq.rmk.enum.sum-nondj.eq})) and%
\begin{equation}
S\subseteq S^{-0+}. \label{sol.inv.sandpileZZ-2.S-0+.cts}%
\end{equation}


Our next claim shows that if at least one of three consecutive rooms is
occupied at some point, then this property will remain valid in all future
states (even though it will not always be the same room that is occupied, or
even the same \# of rooms):

\begin{statement}
\textit{Claim 3:} We have $S_{i}^{-0+}\subseteq S_{i+1}^{-0+}$ for each
$i\in\left\{  0,1,\ldots,g-1\right\}  $.
\end{statement}

[\textit{Proof of Claim 3:} Let $i\in\left\{  0,1,\ldots,g-1\right\}  $. We
must show that $S_{i}^{-0+}\subseteq S_{i+1}^{-0+}$. In other words, we must
show that every $k\in S_{i}^{-0+}$ satisfies $k\in S_{i+1}^{-0+}$. So, let us
consider any $k\in S_{i}^{-0+}$. We shall show that $k\in S_{i+1}^{-0+}$.

We have $k\in S_{i}^{-0+}$. In other words, at least one of the three numbers
$k-1$, $k$ and $k+1$ belongs to $S_{i}$. In other words, at least one of the
three rooms $k-1$, $k$ and $k+1$ is occupied in state $S_{i}$.

We must show that $k\in S_{i+1}^{-0+}$. In other words, we must show that at
least one of the three numbers $k-1$, $k$ and $k+1$ belongs to $S_{i+1}$. In
other words, we must show that at least one of the three rooms $k-1$, $k$ and
$k+1$ is occupied in state $S_{i+1}$.

The state $S_{i+1}$ is obtained from the state $S_{i}$ by a move. Let us
consider all possibilities for how this move can affect rooms $k-1$, $k$ and
$k+1$ (recalling that at least one of these three rooms must be occupied in
state $S_{i}$):

\begin{itemize}
\item If there is a violinist in room $k$ before the move but no violinist in
room $k-1$, then there will be a violinist in (at least) one of the rooms
$k-1$ and $k$ after the move. (Indeed, the move will either leave the
violinist in room $k$ in place, or (if it does displace this violinist) it
will cause a violinist to appear in room $k-1$.)

\item If there is a violinist in room $k$ before the move but no violinist in
room $k+1$, then there will be a violinist in (at least) one of the rooms
$k+1$ and $k$ after the move. (Indeed, the move will either leave the
violinist in room $k$ in place, or (if it does displace this violinist) it
will cause a violinist to appear in room $k+1$.)

\item If there are violinists in all three rooms $k-1$, $k$ and $k+1$ before
the move, then at least one of these three violinists will remain in his room
after the move (since a move only displaces two violinists).

\item If there is a violinist in room $k-1$ before the move but no violinist
in room $k$, then there will be a violinist in (at least) one of the rooms
$k-1$ and $k$ after the move. (Indeed, the move will either leave the
violinist in room $k-1$ in place, or (if it does displace this violinist) it
will cause a violinist to appear in room $k$.)

\item If there is a violinist in room $k+1$ before the move but no violinist
in room $k$, then there will be a violinist in (at least) one of the rooms
$k+1$ and $k$ after the move. (Indeed, the move will either leave the
violinist in room $k+1$ in place, or (if it does displace this violinist) it
will cause a violinist to appear in room $k$.)
\end{itemize}

These five possibilities cover all the possible cases (since we know that at
least one of the three rooms $k-1$, $k$ and $k+1$ is occupied in state $S_{i}%
$). Thus, in each possible case, we have shown that there is a violinist in at
least one of the three rooms $k-1$, $k$ and $k+1$ after the move. In other
words, at least one of the three rooms $k-1$, $k$ and $k+1$ is occupied in
state $S_{i+1}$. As we explained above, this completes the proof of Claim 3.]

\medskip Let us draw some conclusions from Claim 3. It is \textbf{not} true
that $S_{0}\subseteq S_{1}\subseteq\cdots\subseteq S_{g}$, since an occupied
room can become unoccupied after a move. However, Claim 3 shows that we have%
\begin{equation}
S_{0}^{-0+}\subseteq S_{1}^{-0+}\subseteq\cdots\subseteq S_{g}^{-0+}.
\label{sol.inv.sandpileZZ-2.c3cor}%
\end{equation}
In words, this is saying that if a room is occupied or adjacent to an occupied
room, then it will always remain occupied or adjacent to an occupied room.

In the rest of this solution, we shall use the notation $\left[  p,q\right]  $
for an \textbf{integer} interval. That is, if $p$ and $q$ are two integers,
then the notation $\left[  p,q\right]  $ shall denote the set $\left\{
p,p+1,\ldots,q\right\}  =\left\{  i\in\mathbb{Z}\ \mid\ p\leq i\leq q\right\}
$ (rather than, as it commonly does, the real interval $\left\{
i\in\mathbb{R}\ \mid\ p\leq i\leq q\right\}  $). This will be convenient,
since we will have to deal with integer intervals rather than real intervals
in this solution.

Our next claim will show that the leftmost occupied room will always remain to
the right of the room $\alpha-3N$ (so it cannot \textquotedblleft wander
off\textquotedblright\ to the left too far):

\begin{statement}
\textit{Claim 4:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$\min\left(  S_{m}\right)  >\alpha-3N$.
\end{statement}

[\textit{Proof of Claim 4:} Before I prove this formally, let me sketch what
is going on (as the formal proof does a good job of obscuring this). Consider
how the state evolves from $S_{0}$ to $S_{m}$. With every move $S_{i}%
\rightarrow S_{i+1}$, the smallest element of the state (i.e., the leftmost
occupied room) shifts to the left by at most $1$ (because of Claim 2). For the
initial state $S_{0}$, this smallest element is $\alpha$ (since $\alpha
=\min\left(  S_{0}\right)  $). Hence, if the smallest element of $S_{m}$ is
some integer $\beta\leq\alpha$ (that is, we have $\beta=\min\left(
S_{m}\right)  \leq\alpha$), then each integer $j\in\left[  \beta
,\alpha\right]  $ must be the smallest element of some intermediate state
between $S_{0}$ and $S_{m}$ (since otherwise, the smallest element would have
\textquotedblleft jumped over\textquotedblright\ $j$, which is impossible
given that it only shifts to the left by at most $1$ at each step). Hence,
each integer $j\in\left[  \beta,\alpha\right]  $ must be occupied in one of
these intermediate states. In other words, each integer $j\in\left[
\beta,\alpha\right]  $ belongs to some $S_{k}$ (with $k\in\left\{
0,1,\ldots,m\right\}  $), and therefore also to $S_{k}^{-0+}$ (since
$S_{k}\subseteq S_{k}^{-0+}$), and therefore also to $S_{m}^{-0+}$ (since
(\ref{sol.inv.sandpileZZ-2.c3cor}) yields $S_{k}^{-0+}\subseteq S_{m}^{-0+}$).
This yields a lower bound on the size of $S_{m}^{-0+}$: Namely, it yields
$\left\vert S_{m}^{-0+}\right\vert \geq\alpha-\beta+1$. If $\beta\leq
\alpha-3N$, then this lower bound entails $\left\vert S_{m}^{-0+}\right\vert
\geq3N+1>3N$, which contradicts the easily established fact that $\left\vert
S_{m}^{-0+}\right\vert \leq3\cdot\underbrace{\left\vert S_{m}\right\vert
}_{=N}=3N$. Hence, we must have $\beta>\alpha-3N$, and this is precisely what
Claim 4 claims.

Here is the proof in all its boring detail. We must show that $\min\left(
S_{m}\right)  >\alpha-3N$.

Assume the contrary. Thus, $\min\left(  S_{m}\right)  \leq\alpha
-3\underbrace{N}_{>0}<\alpha=\min\left(  S_{0}\right)  $.

Now, let $j\in\left[  \min\left(  S_{m}\right)  ,\min\left(  S_{0}\right)
\right]  $ be arbitrary. We shall show that $j\in S_{m}^{-0+}$.

Indeed, we have $j\in\left[  \min\left(  S_{m}\right)  ,\min\left(
S_{0}\right)  \right]  $. In other words, $j\in\mathbb{Z}$ and $\min\left(
S_{m}\right)  \leq j\leq\min\left(  S_{0}\right)  $.

There exists some $k\in\left\{  0,1,\ldots,m\right\}  $ satisfying
$\min\left(  S_{k}\right)  \leq j$ (for example, $k=m$ will work, since
$\min\left(  S_{m}\right)  \leq j$). Consider the \textbf{smallest} such $k$.
Then, $\min\left(  S_{k}\right)  \leq j$; however, if $k\neq0$, then
$\min\left(  S_{k-1}\right)  >j$ (since otherwise, $k$ would not be the
\textbf{smallest} element of $\left\{  0,1,\ldots,m\right\}  $ to satisfy
$\min\left(  S_{k}\right)  \leq j$). From this, it is easy to see that
$\min\left(  S_{k}\right)  =j$. Indeed, assume the contrary. Thus,
$\min\left(  S_{k}\right)  \neq j$, so that $\min\left(  S_{k}\right)  <j$
(since $\min\left(  S_{k}\right)  \leq j$) and therefore $k\neq0$ (since
otherwise, we would have $k=0$, so that $\min\left(  S_{k}\right)
=\min\left(  S_{0}\right)  \geq j$, which would contradict $\min\left(
S_{k}\right)  <j$). Hence, $\min\left(  S_{k-1}\right)  >j$ (because we said
that if $k\neq0$, then $\min\left(  S_{k-1}\right)  >j$), so that $\min\left(
S_{k-1}\right)  \geq j+1$ (since $\min\left(  S_{k-1}\right)  $ and $j$ are
integers). But $k\in\left\{  1,2,\ldots,m\right\}  $ (since $k\in\left\{
0,1,\ldots,m\right\}  $ and $k\neq0$), so that $k-1\in\left\{  0,1,\ldots
,m-1\right\}  $. Hence, Claim 2 (applied to $i=k-1$) yields $\min\left(
S_{k}\right)  \geq\min\left(  S_{k-1}\right)  -1\geq j$ (since $\min\left(
S_{k-1}\right)  \geq j+1$). This contradicts $\min\left(  S_{k}\right)  <j$.
This contradiction shows that our assumption was false. Hence, we obtain
$\min\left(  S_{k}\right)  =j$. Thus, $j=\min\left(  S_{k}\right)  \in
S_{k}\subseteq S_{k}^{-0+}$ (by (\ref{sol.inv.sandpileZZ-2.S-0+.cts})).

However, (\ref{sol.inv.sandpileZZ-2.c3cor}) yields $S_{k}^{-0+}\subseteq
S_{m}^{-0+}$ (since $k\in\left\{  0,1,\ldots,m\right\}  $). Hence, $j\in
S_{k}^{-0+}\subseteq S_{m}^{-0+}$.

Now, forget that we fixed $j$. We thus have proved that $j\in S_{m}^{-0+}$ for
each $j\in\left[  \min\left(  S_{m}\right)  ,\min\left(  S_{0}\right)
\right]  $. In other words, $\left[  \min\left(  S_{m}\right)  ,\min\left(
S_{0}\right)  \right]  \subseteq S_{m}^{-0+}$. Hence,%
\begin{align*}
\left\vert \left[  \min\left(  S_{m}\right)  ,\min\left(  S_{0}\right)
\right]  \right\vert  &  \leq\left\vert S_{m}^{-0+}\right\vert \leq
3\cdot\underbrace{\left\vert S_{m}\right\vert }_{\substack{=N\\\text{(by
(\ref{sol.inv.sandpileZZ-2.N=}))}}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.inv.sandpileZZ-2.S-0+.size})}\right) \\
&  =3N,
\end{align*}
so that
\begin{align*}
3N  &  \geq\left\vert \left[  \min\left(  S_{m}\right)  ,\underbrace{\min
\left(  S_{0}\right)  }_{=\alpha}\right]  \right\vert =\left\vert \left[
\min\left(  S_{m}\right)  ,\alpha\right]  \right\vert \\
&  =\alpha-\min\left(  S_{m}\right)  +1\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\min\left(  S_{m}\right)  \leq\alpha\right) \\
&  >\alpha-\min\left(  S_{m}\right)  .
\end{align*}
In other words, $\min\left(  S_{m}\right)  >\alpha-3N$. This proves Claim 4.]

\begin{statement}
\textit{Claim 5:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$\max\left(  S_{m}\right)  <\omega+3N$.
\end{statement}

[\textit{Proof of Claim 5:} Claim 5 is an analogue of Claim 4: While Claim 4
says that $\min\left(  S_{m}\right)  $ cannot stray too far leftwards from
$\min\left(  S_{0}\right)  $, Claim 5 says that $\max\left(  S_{m}\right)  $
cannot stray too far rightwards from $\max\left(  S_{0}\right)  $. The proofs
are analogous, too; our above proof of Claim 4 thus can be easily transformed
into a proof of Claim 5 (mutatis mutandis -- e.g., all the signs need to be
reversed, and similar changes).]

\medskip Now, Claim 4 and Claim 5 can be combined to the following:

\begin{statement}
\textit{Claim 6:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$S_{m}\subseteq\left[  \alpha-3N+1,\omega+3N-1\right]  $.
\end{statement}

[\textit{Proof of Claim 6:} Let $j\in S_{m}$. Thus, $j\geq\min\left(
S_{m}\right)  >\alpha-3N$ (by Claim 4) and $j\leq\max\left(  S_{m}\right)
<\omega+3N$ (by Claim 5). Combining these two inequalities, we obtain
$j\in\left[  \alpha-3N+1,\omega+3N-1\right]  $ (since $j$ is an integer).

Forget that we fixed $j$. We thus have shown that $j\in\left[  \alpha
-3N+1,\omega+3N-1\right]  $ for each $j\in S_{m}$. In other words,
$S_{m}\subseteq\left[  \alpha-3N+1,\omega+3N-1\right]  $. This proves Claim 6.]

\medskip We note that $\omega=\max\left(  S_{0}\right)  \geq\min\left(
S_{0}\right)  =\alpha$ and thus $\underbrace{\omega}_{\geq\alpha
}+\underbrace{3N-1}_{\substack{>-3N+1\\\text{(since }N>0\text{)}}%
}>\alpha-3N+1$. Hence, the interval $\left[  \alpha-3N+1,\omega+3N-1\right]  $
is nonempty, and its size is%
\[
\left\vert \left[  \alpha-3N+1,\omega+3N-1\right]  \right\vert =\left(
\omega+3N-1\right)  -\left(  \alpha-3N+1\right)  +1=\omega-\alpha+6N-1.
\]


Now, we can use (e.g.) the pigeonhole principle: Claim 1 entails that the
entropy of the state increases with every move. Thus,%
\[
\left(  \text{the entropy of }S_{0}\right)  <\left(  \text{the entropy of
}S_{1}\right)  <\cdots<\left(  \text{the entropy of }S_{g}\right)  .
\]
Hence, the entropies of the $g+1$ states $S_{0},S_{1},\ldots,S_{g}$ are
distinct. Therefore, these $g+1$ states $S_{0},S_{1},\ldots,S_{g}$ must
themselves be distinct. However, all these $g+1$ states $S_{0},S_{1}%
,\ldots,S_{g}$ are subsets of the set $\left[  \alpha-3N+1,\omega+3N-1\right]
$ (by Claim 6). Hence, we have found $g+1$ distinct subsets of the set
$\left[  \alpha-3N+1,\omega+3N-1\right]  $. By the pigeonhole principle, this
entails that%
\begin{align*}
g+1  &  \leq\left(  \text{\# of all subsets of }\left[  \alpha-3N+1,\omega
+3N-1\right]  \right) \\
&  =2^{\left\vert \left[  \alpha-3N+1,\omega+3N-1\right]  \right\vert
}=2^{\omega-\alpha+6N-1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert \left[  \alpha
-3N+1,\omega+3N-1\right]  \right\vert =\omega-\alpha+6N-1\right)  .
\end{align*}
In other words, $g\leq2^{\omega-\alpha+6N-1}-1$.

Now, forget that we fixed $g$ and $S_{1},S_{2},\ldots,S_{g}$. We thus have
shown that any sequence of $g$ (successive) moves, starting from state $S_{0}%
$, must satisfy $g\leq2^{\omega-\alpha+6N-1}-1$. In other words, there is no
sequence of (successive) moves, starting from state $S_{0}$, that has more
than $2^{\omega-\alpha+6N-1}-1$ moves. In other words, the moves cannot go on
for more than $2^{\omega-\alpha+6N-1}$ nights (if the initial state is $S_{0}%
$). Hence, the moving will stop after a finite number of days. This solves
Exercise \ref{exe.inv.sandpileZZ-2}.
\end{proof}

The next exercise (a slight generalization of \cite[Chapter 1, Example
E4]{Engel}) can be solved using a monovariant, even though no process or
movement is inherently present in the exercise. The trick here is to find a
process first:

\begin{exercise}
\label{exe.inv.engel-1E4}Let $m\in\mathbb{N}$. Each member of a parliament has
\textbf{at most }$m$ enemies. (The notion of an \textquotedblleft
enemy\textquotedblright\ is mutual: If $A$ is an enemy of $B$, then $B$ is an
enemy of $A$.) Prove that it is possible to subdivide the parliament into two
houses (with each member going into exactly one house)\footnotemark\ such that
each member has \textbf{at most }$\dfrac{m}{2}$ enemies in his own house.
\end{exercise}

\footnotetext{For the pedants: A house can be empty.}

\begin{proof}
[Solution to Exercise \ref{exe.inv.engel-1E4} (sketched).]We construct a
desired subdivision algorithmically: Start with \textbf{some} arbitrary
subdivision of the parliament into two houses. A member of the parliament will
be called \textit{unhappy} if he has more than $\dfrac{m}{2}$ enemies in his
own house. As long as an unhappy member exists, we can pick an unhappy member
and move him into the other house. We keep doing these moves until no more
unhappy members exist. (We make these moves sequentially; we don't move
several unhappy members simultaneously.)

I claim that these moves cannot go on forever (and thus, at some point, we
will end up with no more unhappy members). Indeed, I define a
\textit{discordant couple} to be a two-element set $\left\{  u,v\right\}  $ of
two parliament members that are mutual enemies but are in the same house. (Of
course, this concept depends on the state.) I define the \textit{discord} of a
state to be the \# of discordant couples in that state. Now, the discord of a
state is always a nonnegative integer. Moreover, each of our moves decreases
the discord (this is easy to check: if a member is unhappy, then he has more
than $\dfrac{m}{2}$ enemies in his own house, and thus fewer than $\dfrac
{m}{2}$ enemies in the other house\footnote{since he has at most $m$ enemies
in total}; the move thus decreases his contribution to the discord\footnote{In
more detail: The member that is being moved belongs to more than $\dfrac{m}%
{2}$ discordant couples before the move, but belongs to fewer than $\dfrac
{m}{2}$ discordant couples after the move. Thus, the total number of
discordant couples that contain this member decreases when we make the move.
Since the move does not change the discordant couples that don't contain this
member, we can thus conclude that the move decreases the total number of
discordant couples, i.e., the discord.}). Hence, by the same kind of argument
as in the above solution to Exercise \ref{exe.inv.revols1}, we see that the
moves cannot go on forever (since the discord is a nonnegative integer and
thus cannot keep decreasing forever). Hence, eventually, the moves will have
stopped. In the resulting subdivision of the parliament, no member will be
unhappy (since an unhappy member would enable a further move), which means
that each member has \textbf{at most }$\dfrac{m}{2}$ enemies in his own house.
Thus, Exercise \ref{exe.inv.engel-1E4} is solved.
\end{proof}

\begin{remark}
Exercise \ref{exe.inv.engel-1E4} would be false if the notion of an
\textquotedblleft enemy\textquotedblright\ was not mutual. For instance, if we
take $m=3$, and if $0,1,2,3,4$ are five parliament members with each
$i\in\left\{  0,1,2,3,4\right\}  $ having enemies $\left(  i+1\right)  \%5$,
$\left(  i+2\right)  \%5$ and $\left(  i+3\right)  \%5$, then there is no way
to prevent one of them from having more than $\dfrac{3}{2}$ enemies in his own
house, no matter how the parliament is subdivided into two houses.
\end{remark}

\begin{noncompile}
Prendergast: The Four Numbers Game $\left(  a,b,c,d\right)  \mapsto\left(
\left\vert a-b\right\vert ,\left\vert b-c\right\vert ,\left\vert
c-d\right\vert ,\left\vert d-a\right\vert \right)  $.

With integer input:

\textbf{(a)} After $4$ steps, all numbers will be even.

\textbf{(b)} After $4k$ steps, all numbers will be divisible by $2^{k}$.

\textbf{(c)} The largest of the $4$ numbers will never increase except perhaps
in the first step.

\textbf{(d)} After finitely many steps, the numbers will be $0$.

\textbf{(e)} Not true for $3$-numbers game $\left(  a,b,c\right)
\mapsto\left(  \left\vert a-b\right\vert ,\left\vert b-c\right\vert
,\left\vert c-a\right\vert \right)  $.

\textbf{(f)} Not true with non-integer input.

See also Lotan doi:10.1080/00029890.1949.11999436
\end{noncompile}

\subsection{\label{sect.hw8}Homework set \#8}

This problem set is \textbf{not to be handed in}.

This homework set covers the above parts of Chapter \ref{chp.inv} as well as
other chapters and unrelated ideas.\footnote{Recall Definition
\ref{def.ent.coprime.perp}, Convention \ref{conv.enum.nots.bra-n} and
Convention \ref{conv.enum.nots.hash}.}

\begin{exercise}
\label{exe.ent.sum1xy-eng}Let $n$ be a positive integer. Let $Z$ be the set of
all pairs $\left(  x,y\right)  \in\left[  n\right]  ^{2}$ satisfying $x\perp
y$ and $x+y>n$. (For example, if $n=5$, then%
\[
Z=\left\{  \left(  1,5\right)  ,\left(  2,5\right)  ,\left(  3,4\right)
,\left(  3,5\right)  ,\left(  4,3\right)  ,\left(  4,5\right)  ,\left(
5,1\right)  ,\left(  5,2\right)  ,\left(  5,3\right)  ,\left(  5,4\right)
\right\}  \text{. )}%
\]
Find $\sum\limits_{\left(  x,y\right)  \in Z}\ \ \dfrac{1}{xy}$.
\end{exercise}

\begin{exercise}
\label{exe.enum.lunes-and-perms}\textbf{(a)} Consider the following picture:%
\[%
%TCIMACRO{\TeXButton{tikz lunes}{\begin{tikzpicture}[scale=2]
%\node(A) at (0, 0) {};
%\node(B) at (2, 0) {};
%\node(C) at (0, 2) {};
%\fill(A) circle (1pt) node[left] {$A$};
%\fill(B) circle (1pt) node[right] {$B$};
%\fill(C) circle (1pt) node[left] {$C$};
%\draw
%[fill=red] (2, 0) arc[radius=2, start angle=0, end angle=90] (0, 2) arc[radius=1, start angle=90, end angle=0] (1, 1) arc[radius=1, start angle=90, end angle=0];
%\draw
%[fill=blue] (1, 1) arc[radius=1, start angle=0, end angle=-90] (0, 0) arc[radius=1, start angle=180, end angle=90] ;
%\draw(2, 0) -- (0, 0) -- (0, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\node(A) at (0, 0) {};
\node(B) at (2, 0) {};
\node(C) at (0, 2) {};
\fill(A) circle (1pt) node[left] {$A$};
\fill(B) circle (1pt) node[right] {$B$};
\fill(C) circle (1pt) node[left] {$C$};
\draw
[fill=red] (2, 0) arc[radius=2, start angle=0, end angle=90] (0, 2) arc[radius=1, start angle=90, end angle=0] (1, 1) arc[radius=1, start angle=90, end angle=0];
\draw
[fill=blue] (1, 1) arc[radius=1, start angle=0, end angle=-90] (0, 0) arc[radius=1, start angle=180, end angle=90] ;
\draw(2, 0) -- (0, 0) -- (0, 2);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Compare the area of the red region with that of the blue region.

(Here, $ABC$ is an isosceles right-angled triangle with right angle at $A$. We
have erected semicircles with diameters $AB$ and $AC$, both pointing into the
inside of triangle $ABC$. We have also drawn a quarter-circle with center $A$
and radius $AB=AC$ bordered by the points $B$ and $C$. The red region is
formed by removing the two semicircles from the quarter-circle. The blue
region is the (set-theoretical) intersection of the two semicircles.)

\textbf{(b)} Let $n\in\mathbb{N}$. Let $\sigma$ be a permutation of $\left[
n\right]  $. Let $j\in\left\{  0,1,\ldots,n\right\}  $. Prove that%
\begin{align*}
&  \left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j>\sigma\left(  i\right)  \right) \\
&  =\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }%
\sigma\left(  i\right)  \geq j>i\right)  .
\end{align*}

\end{exercise}

The next exercise uses a bit of analysis:

\begin{exercise}
\label{exe.ana.e-to-pi}What number is larger: $e^{\pi}$ or $\pi^{e}$ ? Here,
$\pi$ is \href{https://en.wikipedia.org/wiki/Pi}{the number pi} (approximately
$3.142$), while $e$ is
\href{https://en.wikipedia.org/wiki/E_(mathematical_constant)}{Euler's number}
(approximately $2.718$).

(You don't need a calculator.)
\end{exercise}

\begin{exercise}
\label{exe.inv.infected-rectangle}Consider an $n\times m$-rectangle subdivided
into $1\times1$-squares in the usual way (like a chessboard). Originally,
fewer than $\dfrac{n+m}{2}$ of its $nm$ squares are \textit{infected}. Every
minute, each square that has at least $2$ infected neighbors becomes infected.
(A \textit{neighbor} of a square is a square that has an edge in common with
it. A corner in common does not suffice.) Show that at least one square
remains uninfected no matter how long you wait.

[\textbf{Example:} If $n=3$ and $m=5$, then we may have the following initial
state (where \textquotedblleft X\textquotedblright\ stands for an infected
square):%
\[%
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
& X &  & \phantom{X} & \phantom{X}\\\hline
&  & X &  & \\\hline
X &  &  &  & \\\hline
\end{tabular}
\ \ \ .
\]
Then, after one minute, we will have%
\[%
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
& X & X & \phantom{X} & \phantom{X}\\\hline
& X & X &  & \\\hline
X &  &  &  & \\\hline
\end{tabular}
\ \ \ .
\]
After one more minute, we will have%
\[%
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
& X & X & \phantom{X} & \phantom{X}\\\hline
X & X & X &  & \\\hline
X & X &  &  & \\\hline
\end{tabular}
\ \ \ .
\]
After one more minute, we will have%
\[%
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
X & X & X & \phantom{X} & \phantom{X}\\\hline
X & X & X &  & \\\hline
X & X & X &  & \\\hline
\end{tabular}
\ \ \ .
\]
There will be no more new infections after that.]
\end{exercise}

For the next exercise, imagine $n$ students coming to a party; each student,
on arrival, leaves his coat on the coatrack. When the party ends, the students
leave one by one, each taking a (uniformly) random coat back from the
coatrack. (We assume that no student leaves before all students have entered.)
The probability that each student gets his original coat back is $\dfrac
{1}{n!}$. What is the probability that \textbf{no} student gets his original
coat back? The somewhat surprising answer is \textquotedblleft approximately
$\dfrac{1}{e}$, where $e$ is Euler's number\textquotedblright\ (and the
approximation becomes the better the larger $n$ is). The following exercise
makes this precise:

\begin{exercise}
\label{exe.enum.derange-e}Let $n\in\mathbb{N}$. A \textit{derangement} of
$\left[  n\right]  $ means a permutation of $\left[  n\right]  $ that has no
fixed points (i.e., a permutation $\sigma\in S_{n}$ that satisfies
$\sigma\left(  i\right)  \neq i$ for each $i\in\left[  n\right]  $). Let
$D_{n}$ denote the \# of derangements of $\left[  n\right]  $.

\textbf{(a)} Prove that $D_{n}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dfrac
{n!}{k!}$ for each $n\in\mathbb{N}$.

\textbf{(b)} Set $\operatorname*{round}\left(  x\right)  =\left\lfloor
x+\dfrac{1}{2}\right\rfloor $ for each $x\in\mathbb{R}$. Prove that%
\[
D_{n}=\operatorname*{round}\left(  \dfrac{n!}{e}\right)
\ \ \ \ \ \ \ \ \ \ \text{for all }n\geq1.
\]

\end{exercise}

The next exercise is about the \textquotedblleft four-numbers
game\textquotedblright. Assume you have four integers $a,b,c,d$ written (in
counterclockwise order) on the circumference of a circle:%
\[%
%TCIMACRO{\TeXButton{tikz 4-numbers game}{\begin{tikzpicture}[scale=2]
%\draw(0,0) circle [radius=1cm];
%\node(0a) at ({cos(0)}, {sin(0)}) {};
%\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
%\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
%\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
%\fill(0a) node[right] {$a$};
%\fill(1a) node[below right] {$b$};
%\fill(2a) node[below left] {$c$};
%\fill(3a) node[above] {$d$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\draw(0,0) circle [radius=1cm];
\node(0a) at ({cos(0)}, {sin(0)}) {};
\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
\fill(0a) node[right] {$a$};
\fill(1a) node[below right] {$b$};
\fill(2a) node[below left] {$c$};
\fill(3a) node[above] {$d$};
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
These four integers subdivide the circle into four arcs. To make a
\textit{difference move} means to replace these four integers by their
consecutive (absolute-value) differences (i.e., on each of the four arcs of
the circle, we write the absolute value of the difference between the two
integers placed on the endpoints of the arc; then, we erase the original
integers). In other words, here is what a difference move does:%
\[%
\begin{array}
[c]{ccc}%
%TCIMACRO{\TeXButton{tikz 4-numbers game}{\begin{tikzpicture}[scale=2]
%\draw(0,0) circle [radius=1cm];
%\node(0a) at ({cos(0)}, {sin(0)}) {};
%\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
%\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
%\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
%\fill(0a) node[right] {$a$};
%\fill(1a) node[below right] {$b$};
%\fill(2a) node[below left] {$c$};
%\fill(3a) node[above] {$d$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\draw(0,0) circle [radius=1cm];
\node(0a) at ({cos(0)}, {sin(0)}) {};
\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
\fill(0a) node[right] {$a$};
\fill(1a) node[below right] {$b$};
\fill(2a) node[below left] {$c$};
\fill(3a) node[above] {$d$};
\end{tikzpicture}%
%EndExpansion
&  &
%TCIMACRO{\TeXButton{tikz 4-numbers game}{\begin{tikzpicture}[scale=2]
%\draw(0,0) circle [radius=1cm];
%\node(arrow) at (-2, 0) {$\to$};
%\node(0a) at ({cos(0)}, {sin(0)}) {};
%\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
%\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
%\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
%\node(0b) at ({cos(-0.125*360)}, {sin(-0.125*360)}) {};
%\node(1b) at ({cos(-0.375*360)}, {sin(-0.375*360)}) {};
%\node(2b) at ({cos(-0.625*360)}, {sin(-0.625*360)}) {};
%\node(3b) at ({cos(-0.875*360)}, {sin(-0.875*360)}) {};
%\fill(0a) node[right] {$a$};
%\fill(1a) node[below right] {$b$};
%\fill(2a) node[below left] {$c$};
%\fill(3a) node[above] {$d$};
%\fill(0b) node[below right] {$\left|a-b\right|$};
%\fill(1b) node[below left] {$\left|b-c\right|$};
%\fill(2b) node[above left] {$\left|c-d\right|$};
%\fill(3b) node[above right] {$\left|d-a\right|$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\draw(0,0) circle [radius=1cm];
\node(arrow) at (-2, 0) {$\to$};
\node(0a) at ({cos(0)}, {sin(0)}) {};
\node(1a) at ({cos(-0.25*360)}, {sin(-0.25*360)}) {};
\node(2a) at ({cos(-0.5*360)}, {sin(-0.5*360)}) {};
\node(3a) at ({cos(-0.75*360)}, {sin(-0.75*360)}) {};
\node(0b) at ({cos(-0.125*360)}, {sin(-0.125*360)}) {};
\node(1b) at ({cos(-0.375*360)}, {sin(-0.375*360)}) {};
\node(2b) at ({cos(-0.625*360)}, {sin(-0.625*360)}) {};
\node(3b) at ({cos(-0.875*360)}, {sin(-0.875*360)}) {};
\fill(0a) node[right] {$a$};
\fill(1a) node[below right] {$b$};
\fill(2a) node[below left] {$c$};
\fill(3a) node[above] {$d$};
\fill(0b) node[below right] {$\left|a-b\right|$};
\fill(1b) node[below left] {$\left|b-c\right|$};
\fill(2b) node[above left] {$\left|c-d\right|$};
\fill(3b) node[above right] {$\left|d-a\right|$};
\end{tikzpicture}%
%EndExpansion
\ \ \ \\
&  & \\
&  &
%TCIMACRO{\TeXButton{tikz 4-numbers game}{\begin{tikzpicture}[scale=2]
%\draw(0,0) circle [radius=1cm];
%\node(arrow) at (-2, 0) {$\to$};
%\node(0b) at ({cos(-0.125*360)}, {sin(-0.125*360)}) {};
%\node(1b) at ({cos(-0.375*360)}, {sin(-0.375*360)}) {};
%\node(2b) at ({cos(-0.625*360)}, {sin(-0.625*360)}) {};
%\node(3b) at ({cos(-0.875*360)}, {sin(-0.875*360)}) {};
%\fill(0b) node[below right] {$\left|a-b\right|$};
%\fill(1b) node[below left] {$\left|b-c\right|$};
%\fill(2b) node[above left] {$\left|c-d\right|$};
%\fill(3b) node[above right] {$\left|d-a\right|$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\draw(0,0) circle [radius=1cm];
\node(arrow) at (-2, 0) {$\to$};
\node(0b) at ({cos(-0.125*360)}, {sin(-0.125*360)}) {};
\node(1b) at ({cos(-0.375*360)}, {sin(-0.375*360)}) {};
\node(2b) at ({cos(-0.625*360)}, {sin(-0.625*360)}) {};
\node(3b) at ({cos(-0.875*360)}, {sin(-0.875*360)}) {};
\fill(0b) node[below right] {$\left|a-b\right|$};
\fill(1b) node[below left] {$\left|b-c\right|$};
\fill(2b) node[above left] {$\left|c-d\right|$};
\fill(3b) node[above right] {$\left|d-a\right|$};
\end{tikzpicture}%
%EndExpansion
\ \ .
\end{array}
\]
The result of a difference move is again a placement of four integers on a
circle; thus, we can iterate difference moves again and again. Some
experimenting suggests the following conjectures:

\begin{itemize}
\item After four difference moves, all four integers on the circle will be even.

\item After $4k$ difference moves (where $k\in\mathbb{N}$), all four integers
on the circle will be divisible by $2^{k}$.

\item If the four integers on the circle are nonnegative, then a difference
move cannot increase the largest of them.

\item No matter what four integers we start with, we will always end up with
$0,0,0,0$ if we make sufficiently many difference moves.
\end{itemize}

The following exercise (which redefines a difference move as a map $D$ on the
set of $4$-tuples of integers) states these conjectures in a rigorous fashion
and asks you to prove them:

\begin{exercise}
\label{exe.inv.4numgame.1}Consider the set $\mathbb{Z}^{4}$ of all $4$-tuples
of integers. Let $D:\mathbb{Z}^{4}\rightarrow\mathbb{Z}^{4}$ be the map that
sends each $4$-tuple $\left(  a,b,c,d\right)  \in\mathbb{Z}^{4}$ to the
$4$-tuple%
\[
\left(  \left\vert a-b\right\vert ,\left\vert b-c\right\vert ,\left\vert
c-d\right\vert ,\left\vert d-a\right\vert \right)  \in\mathbb{Z}^{4}.
\]
Prove the following:

\textbf{(a)} If $\mathbf{a}\in\mathbb{Z}^{4}$ is any $4$-tuple, then all
entries of the $4$-tuple $D^{4}\left(  \mathbf{a}\right)  $ are even.

\textbf{(b)} If $\mathbf{a}\in\mathbb{Z}^{4}$ is any $4$-tuple, and if
$k\in\mathbb{N}$, then all entries of the $4$-tuple $D^{4k}\left(
\mathbf{a}\right)  $ are divisible by $2^{k}$.

\textbf{(c)} If $\mathbf{a}\in\mathbb{Z}^{4}$ is any $4$-tuple whose all four
entries are nonnegative, then
\[
\max\left(  D^{0}\left(  \mathbf{a}\right)  \right)  \geq\max\left(
D^{1}\left(  \mathbf{a}\right)  \right)  \geq\max\left(  D^{2}\left(
\mathbf{a}\right)  \right)  \geq\cdots.
\]
Here, $\max\mathbf{b}$ denotes the largest entry of a $4$-tuple $\mathbf{b}%
\in\mathbb{Z}^{4}$.

\textbf{(d)} If $\mathbf{a}\in\mathbb{Z}^{4}$ is any $4$-tuple, then there
exists some $k\in\mathbb{N}$ such that $D^{k}\left(  \mathbf{a}\right)
=\left(  0,0,0,0\right)  $.
\end{exercise}

The claim of Exercise \ref{exe.inv.4numgame.1} \textbf{(d)} cries out for
generalization; the next exercise shows that this is not as easy as it may seem:

\begin{exercise}
\label{exe.inv.4numgame.2}\textbf{(a)} Prove that Exercise
\ref{exe.inv.4numgame.1} \textbf{(d)} may fail if we replace $\mathbb{Z}$ by
$\mathbb{R}$. That is, if we define a map $D:\mathbb{R}^{4}\rightarrow
\mathbb{R}^{4}$ in the same way as in Exercise \ref{exe.inv.4numgame.1} but
using $\mathbb{R}$ instead of $\mathbb{Z}$, then there exists a $4$-tuple
$\mathbf{a}\in\mathbb{R}^{4}$ such that no $k\in\mathbb{N}$ satisfies
$D^{k}\left(  \mathbf{a}\right)  =\left(  0,0,0,0\right)  $.

\textbf{(b)} Prove that the analogue of Exercise \ref{exe.inv.4numgame.1}
\textbf{(d)} for $3$-tuples instead of $4$-tuples (with the map $D$ sending
the $3$-tuple $\left(  a,b,c\right)  $ to $\left(  \left\vert a-b\right\vert
,\left\vert b-c\right\vert ,\left\vert c-a\right\vert \right)  $) also fails:
i.e., there exists a $3$-tuple $\mathbf{a}\in\mathbb{Z}^{3}$ such that no
$k\in\mathbb{N}$ satisfies $D^{k}\left(  \mathbf{a}\right)  =\left(
0,0,0\right)  $. Better yet, prove that if $\mathbf{a}\in\mathbb{Z}^{3}$ is a
$3$-tuple whose entries are not all equal, then there is \textbf{no}
$k\in\mathbb{N}$ such that $D^{k}\left(  \mathbf{a}\right)  =\left(
0,0,0\right)  $.

[\textbf{Hint:} For part \textbf{(a)}, find two nonzero reals $x,y$ such that
$D\left(  1,x,x^{2},x^{3}\right)  =\left(  y,yx,yx^{2},yx^{3}\right)  $.]
\end{exercise}

\Needspace{15pc}

\begin{exercise}
\label{exe.binom.leibniz}The \textit{Leibniz triangle} is a distant relative
of Pascal's triangle. Here are its first few rows:%
\[
\hspace{-0.3cm}%
\begin{tabular}
[c]{ll|cccccccccccccc}%
\vphantom{$\overset{k=0}{\swarrow}$} &  & $\phantom{20}$ & $\phantom{20}$ &
$\phantom{20}$ & $\phantom{20}$ &  &  &  & $\overset{k=0}{\swarrow}$ &
$\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ & $\phantom{20}$ &
$\phantom{20}$ & $\phantom{20}$\\
\vphantom{$\overset{k=0}{\swarrow}$}$n=0$ & $\rightarrow$ &  &  &  &  &  &  &
$\dfrac{1}{1}$ &  & $\overset{k=1}{\swarrow}$ &  &  &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=1$ & $\rightarrow$ &  &  &  &  &  &
$\dfrac{1}{2}$ &  & $\dfrac{1}{2}$ &  & $\overset{k=2}{\swarrow}$ &  &  &  &
\\
\vphantom{$\overset{k=0}{\swarrow}$}$n=2$ & $\rightarrow$ &  &  &  &  &
$\dfrac{1}{3}$ &  & $\dfrac{1}{6}$ &  & $\dfrac{1}{3}$ &  &
$\overset{k=3}{\swarrow}$ &  &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=3$ & $\rightarrow$ &  &  &  &
$\dfrac{1}{4}$ &  & $\dfrac{1}{12}$ &  & $\dfrac{1}{12}$ &  & $\dfrac{1}{4}$ &
& $\overset{k=4}{\swarrow}$ &  & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=4$ & $\rightarrow$ &  &  & $\dfrac
{1}{5}$ &  & $\dfrac{1}{20}$ &  & $\dfrac{1}{30}$ &  & $\dfrac{1}{20}$ &  &
$\dfrac{1}{5}$ &  & $\overset{k=5}{\swarrow}$ & \\
\vphantom{$\overset{k=0}{\swarrow}$}$n=5$ & $\rightarrow$ &  & $\dfrac{1}{6}$
&  & $\dfrac{1}{30}$ &  & $\dfrac{1}{60}$ &  & $\dfrac{1}{60}$ &  & $\dfrac
{1}{30}$ &  & $\dfrac{1}{6}$ &  & $\overset{k=6}{\swarrow}$\\
\vphantom{$\overset{k=0}{\swarrow}$}$n=6$ & $\rightarrow$ & $\dfrac{1}{7}$ &
& $\dfrac{1}{42}$ &  & $\dfrac{1}{105}$ &  & $\dfrac{1}{140}$ &  & $\dfrac
{1}{105}$ &  & $\dfrac{1}{42}$ &  & $\dfrac{1}{7}$ &
\end{tabular}
\ \ \ \ \ \ \ \ \
\]
It is defined as a family of rational numbers $T\left(  n,k\right)  $ defined
for all pairs of nonnegative integers $n,k$ satisfying $k\leq n$ and
satisfying the following two properties:

\begin{enumerate}
\item We have $T\left(  n,0\right)  =T\left(  n,n\right)  =\dfrac{1}{n+1}$ for
each $n\in\mathbb{N}$. (That is, the entries on two sides of the triangle are
$\dfrac{1}{1},\dfrac{1}{2},\dfrac{1}{3},\ldots$.)

\item We have $T\left(  n,k\right)  =T\left(  n+1,k\right)  +T\left(
n+1,k+1\right)  $ for each $n\in\mathbb{N}$ and $k\in\left\{  0,1,\ldots
,n\right\}  $. (That is, each entry is the sum of its two neighbors below.)
\end{enumerate}

\textbf{(a)} Prove that the numbers $T\left(  n,k\right)  $ are uniquely
determined by this.

\textbf{(b)} Find an explicit formula for $T\left(  n,k\right)  $.
\end{exercise}

\begin{exercise}
\label{exe.inv.coins-balancing}Let $n$ and $k$ be two positive integers. You
have $nk$ identical coins distributed in $n$ piles. Whenever two piles have an
even number of coins in total, you are allowed to move coins between these
piles in such a way that the numbers of coins on these two piles become equal.
Such a move will be called a \textit{balancing move}. (For example, if you
have a pile with $3$ coins and a pile with $9$ coins, then a balancing move
will change these two piles into two piles with $6$ coins each. Each balancing
move only changes two piles.) The distribution of coins is said to be
\textit{level} if all piles have the same number of coins.

Prove the following:

\textbf{(a)} If $n$ is a power of $2$, then any distribution of $nk$ coins in
$n$ piles can be made level by a sequence of balancing moves.

\textbf{(b)} If $n$ is not a power of $2$, then there is a distribution of
$nk$ coins in $n$ piles (for an appropriate $k$) that cannot be made level by
any sequence of balancing moves.

[\textbf{Example:} If $n=5$ and $k=3$, and if the original distribution is
$\left(  2,4,1,4,4\right)  $ (that is, the first pile has $2$ coins, the
second has $4$ coins, the third has $1$ coin, etc.), then here is one sequence
of balancing moves that can be applied to this distribution (where we are
underlining the piles that are being balanced in the next step):%
\[
\left(  \underline{2},\underline{4},1,4,4\right)  \rightarrow\left(
\underline{3},3,\underline{1},4,4\right)  \rightarrow\left(  \underline{2}%
,3,2,\underline{4},4\right)  \rightarrow\left(  3,3,\underline{2}%
,3,\underline{4}\right)  \rightarrow\left(  3,3,3,3,3\right)  .
\]
The distribution at the end of this sequence is level.]
\end{exercise}

\begin{exercise}
\label{exe.extcomb.2n+1-fruits}Let $n\in\mathbb{N}$. A silo contains $2n+1$
boxes; each box contains an integer amount of apples and an integer amount of pears.

\textbf{(a)} Prove that you can select $n+1$ boxes that altogether contain at
least half of all the apples in the silo and also at least half of all the
pears in the silo.

\textbf{(b)} Now assume that the boxes can also contain peaches. Is it always
possible to select $n+1$ boxes that altogether contain at least half of all
the apples in the silo, at least half of all the pears in the silo, and at
least half of all the peaches in the silo?
\end{exercise}

\begin{exercise}
\label{exe.inv.toads-and-frogs}Let $a,b\in\mathbb{N}$. The \textquotedblleft
toads and frogs\textquotedblright\ puzzle is a one-player game played on a
$1\times\left(  a+b+1\right)  $ horizontal strip of squares. Initially, the
leftmost $a$ squares are occupied by toads (one toad per square); the
rightmost $b$ squares are occupied by frogs (one frog per square); the one
remaining square is empty. Thus, for example, for $a=3$ and $b=5$, the strip
of squares looks as follows:%
\[%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|}\hline
$T$ & $T$ & $T$ & $\phantom{T}$ & $F$ & $F$ & $F$ & $F$ & $F$\\\hline
\end{tabular}
\ \
\]
(where \textquotedblleft$T$\textquotedblright\ stands for a toad, and where
\textquotedblleft$F$\textquotedblright\ stands for a frog). A move in this
game is one of the following four operations:

\begin{itemize}
\item A \textbf{toad} moves one square to the \textbf{right}, assuming that
the square it moves to is empty. This is called a \textit{toad slide}.

\item A \textbf{toad} moves two squares to the \textbf{right}, assuming that
the square it moves to is empty and the square inbetween is occupied by a
frog. (That is, a toad jumps over a single frog into an empty square to its
right.) This is called a \textit{toad jump}.

\item A \textbf{frog} moves one square to the \textbf{left}, assuming that the
square it moves to is empty. This is called a \textit{frog slide}.

\item A \textbf{frog} moves two squares to the \textbf{left}, assuming that
the square it moves to is empty and the square inbetween is occupied by a
toad. (That is, a frog jumps over a single toad into an empty square to its
left.) This is called a \textit{frog jump}.
\end{itemize}

The objective of the game is to achieve (by a sequence of moves, starting with
the initial state described above) the state in which the leftmost $b$ squares
are occupied by frogs, the rightmost $a$ squares are occupied by toads, and
the one remaining square is empty. For example, here is a way to achieve this
objective when $a=2$ and $b=2$:%
\begin{align*}
&  \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$T$ & $T$ & $\phantom{T}$ & $F$ & $F$\\\hline
\end{tabular}
\ \ \ \overset{\text{toad slide}}{\longrightarrow}\ \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$T$ & $\phantom{T}$ & $T$ & $F$ & $F$\\\hline
\end{tabular}
\\
\overset{\text{frog jump}}{\longrightarrow}\  &  \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$T$ & $F$ & $T$ & $\phantom{T}$ & $F$\\\hline
\end{tabular}
\ \ \ \overset{\text{frog slide}}{\longrightarrow}\ \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$T$ & $F$ & $T$ & $F$ & $\phantom{T}$\\\hline
\end{tabular}
\\
\overset{\text{toad jump}}{\longrightarrow}\  &  \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$T$ & $F$ & $\phantom{T}$ & $F$ & $T$\\\hline
\end{tabular}
\ \ \ \overset{\text{toad jump}}{\longrightarrow}\ \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$\phantom{T}$ & $F$ & $T$ & $F$ & $T$\\\hline
\end{tabular}
\\
\overset{\text{frog slide}}{\longrightarrow}\  &  \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$F$ & $\phantom{T}$ & $T$ & $F$ & $T$\\\hline
\end{tabular}
\ \ \ \overset{\text{frog jump}}{\longrightarrow}\ \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$F$ & $F$ & $T$ & $\phantom{T}$ & $T$\\\hline
\end{tabular}
\\
\overset{\text{toad slide}}{\longrightarrow}\  &  \
\begin{tabular}
[c]{|c|c|c|c|c|}\hline
$F$ & $F$ & $\phantom{T}$ & $T$ & $T$\\\hline
\end{tabular}
\ \ \ .
\end{align*}


Prove that this objective can always be achieved in $ab+a+b$ (strategically
chosen) moves.
\end{exercise}

\subsection{\label{sect.hw9}Homework set \#9}

This is a \textbf{regular} problem set. See Section \ref{sect.hw1} for details
on grading.

This homework set covers Chapter \ref{chp.enum} and Chapter \ref{chp.inv}.
Some of the problems may be unrelated.

Please solve \textbf{at most 5} problems. (No points will be given for further solutions.)

The following exercise is a variation on Exercise \ref{exe.enum.1-even}:

\begin{exercise}
\label{exe.enum.first-even}Let $n$ and $d$ be two positive integers.

An $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]
^{n}$ will be called \textit{first-even} if its first entry $x_{1}$ occurs in
it an even number of times (i.e., the number of $i\in\left[  n\right]  $
satisfying $x_{i}=x_{1}$ is even). (For example, the $3$-tuples $\left(
1,5,1\right)  $ and $\left(  2,2,3\right)  $ are first-even, while the
$3$-tuple $\left(  4,1,1\right)  $ is not.)

Compute the \# of first-even $n$-tuples in $\left[  d\right]  ^{n}$.
\end{exercise}

Next come two binomial identities:

\begin{exercise}
\label{exe.enum.2n-2kchoosen+p}Let $n\in\mathbb{N}$ and $p\in\mathbb{Z}$.
Prove that%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}%
=2^{n-p}\dbinom{n}{p}.
\]

\end{exercise}

\begin{exercise}
\label{exe.enum.ISL1991pbm11}Let $n$ be a positive integer. Prove that%
\[
\sum_{i=0}^{n-1}\dfrac{\left(  -1\right)  ^{i}}{n-i}\dbinom{n-i}{i}=\dfrac
{1}{n}\left(  -1\right)  ^{\left(  n+1\right)  //3}\left(  1+\left[  3\mid
n\right]  \right)  .
\]

\end{exercise}

(See Definition \ref{def.ent.quorem} and Definition \ref{def.iverson} for the
notations used in Exercise \ref{exe.enum.ISL1991pbm11}.)

The next few exercises are about single-player games (aka nondeterministic processes):

\begin{exercise}
\label{exe.inv.chocbar}A chocolate bar has the shape of an $m\times
n$-rectangle (subdivided into little $1\times1$-squares by horizontal and
vertical lines, in case your eating habits are too healthy). For example, if
$m=3$ and $n=2$, then it looks like this:%
\[%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (2, 3);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (2, 3);
\end{tikzpicture}%
%EndExpansion
\]
In one move, you can break a chocolate bar into two by splitting it along one
of the (horizontal or vertical) lines that divide it (unless it is already a
$1\times1$-square). For example:%
\begin{align*}%
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (2, 3);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (2, 3);
\end{tikzpicture}%
%EndExpansion
\end{array}
\ \  &  \overset{\text{move}}{\longrightarrow}\ \
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (2, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (2, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (2, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (2, 2);
\end{tikzpicture}%
%EndExpansion
\end{array}
\ \ \overset{\text{move}}{\longrightarrow}\ \
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (2, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (2, 2);
\end{tikzpicture}%
%EndExpansion
\end{array}
\ \ \overset{\text{move}}{\longrightarrow}\ \
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 2);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 2);
\end{tikzpicture}%
%EndExpansion
\end{array}
\\
& \\
& \\
&  \overset{\text{move}}{\longrightarrow}\ \
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) rectangle (1, 1);
%\draw[step=1cm,thick] (0, 1.5) rectangle (1, 2.5);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) rectangle (1, 1);
\draw[step=1cm,thick] (0, 1.5) rectangle (1, 2.5);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 2);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 2);
\end{tikzpicture}%
%EndExpansion
\end{array}
\ \ \overset{\text{move}}{\longrightarrow}\ \
\begin{array}
[c]{c}%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\\%
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\ \
%TCIMACRO{\TeXButton{tikz grid}{\begin{tikzpicture}[scale=0.5]
%\draw[step=1cm,thick] (0, 0) grid (1, 1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=0.5]
\draw[step=1cm,thick] (0, 0) grid (1, 1);
\end{tikzpicture}%
%EndExpansion
\end{array}
\ \ .
\end{align*}


\textbf{(a)} What is the smallest number of moves necessary to break up the
entire bar into $1\times1$-squares?

\textbf{(b)} What is the largest number of moves necessary to break up the
entire bar into $1\times1$-squares?
\end{exercise}

\begin{exercise}
\label{exe.inv.circle-6-sectors}A circle is split into $6$ sectors, and a
number has been written in each sector. These numbers are $1,0,1,0,0,0$ in
clockwise order, as shown in the following picture:%
\[%
%TCIMACRO{\TeXButton{tikz circle with sectors}{\begin{tikzpicture}[scale=2.5]
%\coordinate(a) at ({cos(0)}, {sin(0)}) {};
%\coordinate(b) at ({cos(360/6)}, {sin(360/6)}) {};
%\coordinate(c) at ({cos(2*360/6)}, {sin(2*360/6)}) {};
%\coordinate(d) at ({cos(3*360/6)}, {sin(3*360/6)}) {};
%\coordinate(e) at ({cos(4*360/6)}, {sin(4*360/6)}) {};
%\coordinate(f) at ({cos(5*360/6)}, {sin(5*360/6)}) {};
%\draw(d) -- (a);
%\draw(e) -- (b);
%\draw(f) -- (c);
%\node at (-0.5, 0.3) {$1$};
%\node at (0, 0.6) {$0$};
%\node at (0.5, 0.3) {$1$};
%\node at (0.5, -0.3) {$0$};
%\node at (0, -0.6) {$0$};
%\node at (-0.5, -0.3) {$0$};
%\draw(0,0) circle [radius=1];
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\coordinate(a) at ({cos(0)}, {sin(0)}) {};
\coordinate(b) at ({cos(360/6)}, {sin(360/6)}) {};
\coordinate(c) at ({cos(2*360/6)}, {sin(2*360/6)}) {};
\coordinate(d) at ({cos(3*360/6)}, {sin(3*360/6)}) {};
\coordinate(e) at ({cos(4*360/6)}, {sin(4*360/6)}) {};
\coordinate(f) at ({cos(5*360/6)}, {sin(5*360/6)}) {};
\draw(d) -- (a);
\draw(e) -- (b);
\draw(f) -- (c);
\node at (-0.5, 0.3) {$1$};
\node at (0, 0.6) {$0$};
\node at (0.5, 0.3) {$1$};
\node at (0.5, -0.3) {$0$};
\node at (0, -0.6) {$0$};
\node at (-0.5, -0.3) {$0$};
\draw(0,0) circle [radius=1];
\end{tikzpicture}%
%EndExpansion
\]
In one move, you can add $1$ to any two numbers written in adjacent sectors.

Can you ever ensure that all six sectors have the same number written in them?
\end{exercise}

\begin{exercise}
\label{exe.inv.chips-and-cents}Fix a positive integer $n$. Consider $n$ chips
placed in a heap. In a move, you are allowed to split a heap $H$ of chips into
two smaller heaps $H_{1}$ and $H_{2}$; when doing so, you gain $\left\vert
H_{1}\right\vert \cdot\left\vert H_{2}\right\vert $ cents. (We treat heaps as
sets of chips; thus, $\left\vert H_{1}\right\vert $ is the \# of chips in heap
$H_{1}$.) After sufficiently many moves, you are left with $n$ heaps, each
containing exactly one chip. What is the maximum number of cents you can have
made by that moment?
\end{exercise}

\begin{exercise}
\label{exe.inv.j19-1}Fix two positive integers $a$ and $b$. Consider $a+b$
bowls, numbered $1,2,\ldots,a+b$. Initially, each of the bowls $1,2,\ldots,a$
contains an apple, and each of the bowls $a+1,a+2,\ldots,a+b$ contains a pear.
A \textit{move} consists of picking two numbers $i,j\in\left[  a+b\right]  $
satisfying $i<a+b$ and $j>1$ and $i\equiv j\operatorname{mod}2$, and moving an
apple from bowl $i$ to bowl $i+1$ and a pear from bowl $j$ to bowl $j-1$. (We
assume that these fruits do exist in these bowls; otherwise, the move cannot
be made. It is allowed for several fruits to lie in one bowl at the same time.)

The goal is to end up with each of the bowls $1,2,\ldots,b$ containing a pear
and each of the bowls $b+1,b+2,\ldots,b+a$ containing an apple. Show that this
goal can be reached if and only if the product $ab$ is even.
\end{exercise}

\begin{exercise}
\label{exe.inv.sandpileZZ-1}Consider a hotel with an infinite number of rooms,
arranged sequentially on the ground floor. The rooms are labelled by integers
$i\in\mathbb{Z}$, with room $i$ being adjacent to rooms $i-1$ and $i+1$. A
finite number of violinists are staying in the hotel (it is possible for two
violinists to be staying in the same room). Each night, two violinists staying
in the same room decide they cannot stand each other's noise, and move to the
two adjacent rooms (i.e., if they were in room $i$, they move to rooms $i-1$
and $i+1$). (Only two violinists move in any given night.) This keeps
happening for as long as there are two violinists staying in the same room.

Prove that this moving will stop after a finite number of days (i.e., there
will be a day when no two violinists share a room any more).

[\textbf{Example:} Let us assume that initially, there are $5$ violinists
(named $a,b,c,d,e$), arranged as follows:%
\begin{equation}
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $\phantom{2}$ & $%
\begin{array}
[c]{c}%
a\\
b
\end{array}
$ & $c$ & $%
\begin{array}
[c]{c}%
d\\
e
\end{array}
$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ &
$\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots\label{eq.exe.inv.sandpileZZ-1.exa1}%
\end{equation}
(where the boxes of the table correspond to the rooms; of course, we are only
showing a small part of the actually infinite hotel). On the first night,
let's say the violinists $a$ and $b$ tire of each other's presence and move
apart; this results in the following state:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $\phantom{2}$ & $%
\begin{array}
[c]{c}%
b\\
c
\end{array}
$ & $%
\begin{array}
[c]{c}%
d\\
e
\end{array}
$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ &
$\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots.
\]
On the next night, the violinists $b$ and $c$ decide to move apart, and we
obtain the following state:%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $b$ & $\phantom{2}$ & $%
\begin{array}
[c]{c}%
c\\
d\\
e
\end{array}
$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$ &
$\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots.
\]
On the next night, the violinists $c$ and $e$ decide to move apart, and we
obtain the state%
\[
\cdots\ \text{%
\begin{tabular}
[c]{|c|c|c|c|c|c|c|c|c|c|c|}\hline
$\phantom{2}$ & $a$ & $b$ & $c$ & $d$ & $e$ & $\phantom{2}$ & $\phantom{2}$ &
$\phantom{2}$ & $\phantom{2}$ & $\phantom{2}$\\\hline
\end{tabular}
\ }\cdots.
\]
Now, no two violinists occupy the same room any more, so no further moves can happen.]
\end{exercise}

Our last two exercises on this homework set are about sequences of rational
numbers that turn out to be integer sequences (not unlike the ones in Section
\ref{sect.seqsum.more-int} and Subsection \ref{subsect.inv.inv.intseq}):

\begin{exercise}
\label{exe.seqs.tn-3tn-4-int}Define a sequence $\left(  t_{0},t_{1}%
,t_{2},\ldots\right)  $ of positive rational numbers recursively by setting%
\[
t_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<4
\]
and%
\[
t_{n}=\dfrac{1+t_{n-1}t_{n-3}}{t_{n-4}}\ \ \ \ \ \ \ \ \ \ \text{for each
}n\geq4.
\]
(This is \href{https://oeis.org/A217787}{Sequence A217787 on the OEIS}.
Compare Example \ref{exa.laurent.tk2.cex1}, which is similar but not the same.)

Prove that $t_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{noncompile}
more generally: $t_{n}=\dfrac{t_{n-1}t_{n-k+1}+a\left(  t_{n-1}+t_{n-2}%
+\cdots+t_{n-k+1}\right)  +b}{t_{n-k}}$. (\textquotedblleft extreme
polynomial\textquotedblright\ from \cite[Theorem 3.10]{AlCuHu16}.)
\end{noncompile}

\begin{exercise}
\label{exe.seqs.q-t-3-int}Let $q\in\mathbb{N}$. Define a sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $ of positive rational numbers recursively by
setting%
\[
t_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<3
\]
and%
\[
t_{n}=\dfrac{t_{n-1}^{2}+qt_{n-1}t_{n-2}+t_{n-2}^{2}}{t_{n-3}}%
\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq3.
\]
Prove that $t_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\newpage

\section{\label{chp.nt2}Number Theory II: Primes}

We covered some of the basics of number theory in Chapter \ref{chp.nt1}; now
we shall go deeper. The heroes of this chapter shall be the \textit{prime
numbers} (also known as \textit{primes}); we will see both some of their
intrinsic properties and their applications.

As with all other chapters, this one will be just an introduction; the primes
are among the most well-studied and yet the most mysterious objects in
mathematics, and the results that have been proved about them wouldn't fit
into a book, let alone a chapter. Some books about primes are \cite{Neale17}
(a semi-popular survey with historical discussions and the occasional proof
sketch), \cite{CraPom05} (a \textquotedblleft computational
perspective\textquotedblright, with special focus on algorithms and
cryptographic applications), \cite{FinRos16} (a somewhat advanced introduction
aimed at graduate students) and \cite{Narkie00} (a historical account with
various classical proofs).

\subsection{\label{sect.nt1.primes}Primes}

\subsubsection{\label{subsect.nt1.primes.def}Definition and examples}

We begin with the definition of a prime:

\begin{definition}
\label{def.ent.prime}Let $p$ be an integer greater than $1$. We say that $p$
is \textit{prime} if the only positive divisors of $p$ are $1$ and $p$. A
prime integer is often just called \textit{a prime}.
\end{definition}

Note that we required $p$ to be greater than $1$ here. Thus, $1$ does not
count as prime even though its only positive divisor is $1$ itself.

\begin{example}
\label{exa.ent.prime.1}\textbf{(a)} The integer $5$ is a prime, since its only
positive divisors are $1$ and $5$.

\textbf{(b)} The integer $6$ is not a prime, since it has positive divisors
beyond just $1$ and $6$. (For example, $2$ is one of its positive divisors.)

\textbf{(c)} None of the integers $4,6,8,10,12,14,16,\ldots$ (that is, the
multiples of $2$ that are larger than $2$) is a prime. Indeed, if $p$ is any
of these numbers, then $p$ has a positive divisor other than $1$ and $p$
(namely, $2$), and therefore does not meet the definition of \textquotedblleft
prime\textquotedblright.

\textbf{(d)} None of the integers $6,9,12,15,18,\ldots$ (that is, the
multiples of $3$ that are larger than $3$) is a prime. The reason for this is
similar to that in Example \ref{exa.ent.prime.1} \textbf{(c)}.
\end{example}

\begin{noncompile}
There is a reasonably fast method (known as the \textit{Sieve of
Eratosthenes}) to make a list of all primes among the first $n$ positive
integers for a given $n\in\mathbb{N}$. We refer the reader (e.g.) to
\cite[Example 2.13.3]{19s} for this method.
\end{noncompile}

\subsubsection{\label{subsect.nt1.primes.infin}The infinitude of the primes}

The first (i.e., smallest) $15$ primes are%
\[
2,\ \ 3,\ \ 5,\ \ 7,\ \ 11,\ \ 13,\ \ 17,\ \ 19,\ \ 23,\ \ 29,\ \ 31,\ \ 37,\ \ 41,\ \ 43,\ \ 47.
\]
One of the oldest famous theorems in mathematics is Euclid's result that there
are infinitely many primes:

\begin{theorem}
\label{thm.ent.primes.infin}There are infinitely many primes.
\end{theorem}

Many proofs of this theorem are known; for example, six proofs can be found in
\cite[Chapter 1]{AigZie}. We shall give two proofs here; but first, let us
show that every integer $n>1$ is divisible by at least one prime:

\begin{proposition}
\label{prop.ent.prime.ex-pri-div}Let $n>1$ be an integer. Then, there exists
at least one prime $p$ such that $p\mid n$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.ex-pri-div} (sketched).](See
\cite[proof of Proposition 2.13.8]{19s} for details.) This is another
application of the extremal principle: There exists a divisor of $n$ that is
larger than $1$ (for example, $n$ itself is such a divisor). Let $q$ be the
\textbf{smallest} such divisor. Then, $q\mid n$ and $q>1$.

We now claim that $q$ is a prime. Indeed, assume the contrary. Thus, $q$ is
not a prime; in other words, $1$ and $q$ are \textbf{not} the only positive
divisors of $q$ (by Definition \ref{def.ent.prime}). In other words, $q$ has a
positive divisor $d$ distinct from $1$ and $q$. Consider this $d$. We have
$d\mid q\mid n$ and $d>1$ (since $d$ is a positive integer distinct from $1$).
Thus, $d$ is a divisor of $n$ that is larger than $1$. Hence, $d\geq q$ (since
$q$ is the \textbf{smallest} such divisor). However, $d\mid q$ entails $d\leq
q$ (since $d$ and $q$ are both positive). Combining this with $d\geq q$, we
obtain $d=q$, which contradicts the fact that $d$ is distinct from $q$. This
contradiction shows that our assumption was wrong. Hence, $q$ is a prime.
Thus, there exists at least one prime $p$ such that $p\mid n$ (namely, $p=q$).
This proves Proposition \ref{prop.ent.prime.ex-pri-div}.
\end{proof}

We can now step to the proofs of Theorem \ref{thm.ent.primes.infin}:

\begin{proof}
[First proof of Theorem \ref{thm.ent.primes.infin} (sketched).](See
\cite[proof of Theorem 2.13.43]{19s} for details.) The following classical
argument goes back to Euclid's \textit{Elements}: Let $\left(  p_{1}%
,p_{2},\ldots,p_{k}\right)  $ be any finite list of primes. We shall find a
new prime $p$ that is distinct from $p_{1},p_{2},\ldots,p_{k}$.

Indeed, set $n=p_{1}p_{2}\cdots p_{k}+1$. It is easy to see that $n>1$. Hence,
Proposition \ref{prop.ent.prime.ex-pri-div} shows that there exists at least
one prime $p$ such that $p\mid n$. Consider this $p$. For each $i\in\left\{
1,2,\ldots,k\right\}  $, we have $p_{i}\nmid1$ (since $p_{i}$ is a prime, so
that $p_{i}>1$) and thus%
\[
n=\underbrace{p_{1}p_{2}\cdots p_{k}}_{\substack{\equiv0\operatorname{mod}%
p_{i}\\\text{(since }p_{i}\mid p_{1}p_{2}\cdots p_{k}\text{)}}}+1\equiv
0+1=1\not \equiv 0\operatorname{mod}p_{i}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }p_{i}\nmid1=1-0\right)  .
\]
In other words, for each $i\in\left\{  1,2,\ldots,k\right\}  $, we have
$p_{i}\nmid n$ and thus $p\neq p_{i}$ (since $p=p_{i}$ would yield
$p=p_{i}\nmid n$, which would contradict $p\mid n$). In other words, $p$ is
distinct from $p_{1},p_{2},\ldots,p_{k}$.

Forget that we fixed $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $. Thus, for
any finite list $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ of primes, we have
found a new prime $p$ that is distinct from $p_{1},p_{2},\ldots,p_{k}$. In
other words, for any finite list of primes, we have found a prime that is not
in this list. Thus, there are infinitely many primes. This proves Theorem
\ref{thm.ent.primes.infin}.
\end{proof}

\begin{proof}
[Second proof of Theorem \ref{thm.ent.primes.infin}.]Let $\left(  F_{0}%
,F_{1},F_{2},\ldots\right)  $ be the Fermat sequence, defined as in Exercise
\ref{exe.ent.fermat-num.1}. Let $n\in\mathbb{N}$. Then, $F_{n}%
=\underbrace{2^{2^{n}}}_{>0}+1>1$. Hence, Proposition
\ref{prop.ent.prime.ex-pri-div} (applied to $F_{n}$ instead of $n$) shows that
there exists at least one prime $p$ such that $p\mid F_{n}$. Consider this
prime $p$, and denote it by $p_{n}$. Thus, $p_{n}$ is a prime satisfying
$p_{n}\mid F_{n}$.

Now, forget that we fixed $n$. Thus, for each $n\in\mathbb{N}$, we have
constructed a prime $p_{n}$ satisfying $p_{n}\mid F_{n}$. Consider all these
primes $p_{0},p_{1},p_{2},\ldots$.

We now claim that these primes $p_{0},p_{1},p_{2},\ldots$ are distinct.

[\textit{Proof:} Let $n$ and $m$ be two distinct nonnegative integers. We
shall show that $p_{n}\neq p_{m}$.

Indeed, assume the contrary. Thus, $p_{n}=p_{m}$. Note that $p_{n}$ is a
prime; thus, $p_{n}>1>0$, so that $\left\vert p_{n}\right\vert =p_{n}$. From
$p_{n}=p_{m}$, we obtain $p_{n}\mid p_{m}$. Hence, Proposition
\ref{prop.ent.gcd.props1} \textbf{(i)} (applied to $a=p_{n}$ and $b=p_{m}$)
yields $\gcd\left(  p_{n},p_{m}\right)  =\left\vert p_{n}\right\vert =p_{n}>1$.

Now, Exercise \ref{exe.ent.fermat-num.1} \textbf{(b)} yields $\gcd\left(
F_{n},F_{m}\right)  =1$. In other words, $F_{n}\perp F_{m}$ (by the definition
of \textquotedblleft coprime\textquotedblright)\footnote{Here, we are using
the notation from Definition \ref{def.ent.coprime.perp}.}. But we have
$p_{n}\mid F_{n}$ (by the construction of $p_{n}$) and $p_{m}\mid F_{m}$
(similarly). Thus, $p_{n}\perp p_{m}$ (by Proposition
\ref{prop.ent.coprime.div}, applied to $a_{1}=p_{n}$, $a_{2}=p_{m}$,
$b_{1}=F_{n}$ and $b_{2}=F_{m}$). In other words, $\gcd\left(  p_{n}%
,p_{m}\right)  =1$ (by the definition of \textquotedblleft
coprime\textquotedblright). This contradicts $\gcd\left(  p_{n},p_{m}\right)
>1$. This contradiction shows that our assumption was wrong. Hence, $p_{n}\neq
p_{m}$.

Forget that we fixed $n$ and $m$. We thus have shown that $p_{n}\neq p_{m}$
whenever $n$ and $m$ are two distinct nonnegative integers. In other words,
the primes $p_{0},p_{1},p_{2},\ldots$ are distinct.]

We now know that the primes $p_{0},p_{1},p_{2},\ldots$ are distinct. Hence,
there are infinitely many primes (namely, these primes $p_{0},p_{1}%
,p_{2},\ldots$, and possibly others as well). This proves Theorem
\ref{thm.ent.primes.infin} again.
\end{proof}

\subsubsection{\label{subsect.nt1.primes.basics}Basic properties}

We next review some of the most basic properties of primes. Their proofs are
almost trivial, as we have already done the hard work in Chapter \ref{chp.nt1}.

\begin{proposition}
\label{prop.ent.prime.each-i-coprime}Let $p$ be a prime. Then, each
$i\in\left\{  1,2,\ldots,p-1\right\}  $ is coprime to $p$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.each-i-coprime} (sketched).](See
\cite[proof of Proposition 2.13.4]{19s} for details.) Let $i\in\left\{
1,2,\ldots,p-1\right\}  $. We must prove that $i$ is coprime to $p$. In other
words, we must prove that $\gcd\left(  i,p\right)  =1$.

From $i\in\left\{  1,2,\ldots,p-1\right\}  $, we see that $i$ is positive and
satisfies $i\leq p-1<p$. Proposition \ref{prop.ent.gcd.props1} \textbf{(f)}
yields $\gcd\left(  i,p\right)  \mid i$ and $\gcd\left(  i,p\right)  \mid p$.
From $\gcd\left(  i,p\right)  \mid i$, we obtain $\left\vert \gcd\left(
i,p\right)  \right\vert \leq\left\vert i\right\vert $ (by Proposition
\ref{prop.ent.div.1} \textbf{(b)}). This rewrites as $\gcd\left(  i,p\right)
\leq i$ (since $\gcd\left(  i,p\right)  $ and $i$ are positive). Hence,
$\gcd\left(  i,p\right)  \leq i<p$.

But $p$ is prime; thus, the only positive divisors of $p$ are $1$ and $p$.
However, $\gcd\left(  i,p\right)  $ is a positive divisor of $p$ (since
$\gcd\left(  i,p\right)  \mid p$). Thus, $\gcd\left(  i,p\right)  $ must be
either $1$ or $p$. Since $\gcd\left(  i,p\right)  <p$, we thus conclude
$\gcd\left(  i,p\right)  =1$. Proposition \ref{prop.ent.prime.each-i-coprime}
is proven.
\end{proof}

\begin{proposition}
\label{prop.ent.prime.div-or-coprime}Let $p$ be a prime. Let $a\in\mathbb{Z}$.
Then, either $p\mid a$ or $p\perp a$.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.div-or-coprime} (sketched).](See
\cite[proof of Proposition 2.13.5]{19s} for a different proof.) We are in one
of the following two cases:

\textit{Case 1:} We have $a\%p=0$.

\textit{Case 2:} We have $a\%p\neq0$.

Let us first consider Case 1. In this case, we have $a\%p=0$. However,
Proposition \ref{prop.ent.quorem.props} \textbf{(b)} (applied to $n=p$ and
$u=a$) yields that we have $p\mid a$ if and only if $a\%p=0$. Thus, $p\mid a$
(since $a\%p=0$). Hence, Proposition \ref{prop.ent.prime.div-or-coprime} is
proved in Case 1.

Let us now consider Case 2. In this case, we have $a\%p\neq0$. But Proposition
\ref{prop.ent.quorem.props} \textbf{(a)} (applied to $n=p$ and $u=a$) yields
that $a\%p\in\left\{  0,1,\ldots,p-1\right\}  $ and $a\%p\equiv
a\operatorname{mod}p$. Combining $a\%p\in\left\{  0,1,\ldots,p-1\right\}  $
with $a\%p\neq0$, we find $a\%p\in\left\{  0,1,\ldots,p-1\right\}
\setminus\left\{  0\right\}  =\left\{  1,2,\ldots,p-1\right\}  $. Hence,
Proposition \ref{prop.ent.prime.each-i-coprime} (applied to $i=a\%p$) yields
that $a\%p$ is coprime to $p$. In other words, $\gcd\left(  a\%p,p\right)
=1$. But Proposition \ref{prop.ent.gcd.props1} \textbf{(e)} (applied to $p$
and $a$ instead of $a$ and $b$) yields
\begin{align*}
\gcd\left(  p,a\right)   &  =\gcd\left(  p,a\%p\right)  =\gcd\left(
a\%p,p\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition
\ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =1.
\end{align*}
In other words, $p\perp a$. Hence, Proposition
\ref{prop.ent.prime.div-or-coprime} is proved in Case 2.

We have now proved Proposition \ref{prop.ent.prime.div-or-coprime} in both
Cases 1 and 2. Hence, Proposition \ref{prop.ent.prime.div-or-coprime} always holds.
\end{proof}

Any two distinct primes are coprime:

\begin{proposition}
\label{prop.ent.prime.dist=cop}Let $p$ and $q$ be two distinct primes. Then,
$p\perp q$.
\end{proposition}

This is easy to prove using the above propositions (see \cite[solution to
Exercise 2.13.1]{19s} for a detailed proof).

The following property of primes (\cite[Theorem 2.13.6]{19s}) is probably one
of the most important ones:

\begin{theorem}
\label{thm.ent.prime.pab}Let $p$ be a prime. Let $a,b\in\mathbb{Z}$ such that
$p\mid ab$. Then, $p\mid a$ or $p\mid b$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.ent.prime.pab}.]Clearly, Theorem
\ref{thm.ent.prime.pab} is true if $p\mid a$. Hence, for the rest of this
proof, we WLOG assume that we don't have $p\mid a$.

However, Proposition \ref{prop.ent.prime.div-or-coprime} shows that we have
either $p\mid a$ or $p\perp a$. Thus, $p\perp a$ (since we don't have $p\mid
a$). However, $p\mid ab$. Hence, Theorem \ref{thm.ent.coprime.cancel} (applied
to $p$, $a$ and $b$ instead of $a$, $b$ and $c$) yields $p\mid b$. Thus,
$p\mid a$ or $p\mid b$. This proves Theorem \ref{thm.ent.prime.pab}.
\end{proof}

Theorem \ref{thm.ent.prime.pab} can be generalized to products of multiple factors:

\begin{proposition}
\label{prop.ent.prime.pabk}Let $p$ be a prime. Let $a_{1},a_{2},\ldots,a_{k}$
be integers such that $p\mid a_{1}a_{2}\cdots a_{k}$. Then, $p\mid a_{i}$ for
some $i\in\left\{  1,2,\ldots,k\right\}  $.
\end{proposition}

\begin{proof}
[Hint to the proof of Proposition \ref{prop.ent.prime.pabk}.]This is easy to
prove by induction on $k$ (with the induction step relying on Theorem
\ref{thm.ent.prime.pab}). Alternatively, this can be derived from Exercise
\ref{exe.ent.coprime.ab-to-ck} and Proposition
\ref{prop.ent.prime.div-or-coprime}. (See \cite[proof of Proposition
2.13.7]{19s} for the latter proof.)
\end{proof}

We notice that Proposition \ref{prop.ent.prime.pabk} is, in some way, saying
that primes \textquotedblleft act like $0$\textquotedblright\ in the following
sense: It is well-known that a product of numbers is $0$ if and only if one of
the factors is $0$. Proposition \ref{prop.ent.prime.pabk} says something
similar: It says that a product of integers is divisible by a prime $p$ if and
only if one of its factors is divisible by $p$. (To be more precise, the
proposition only claims the \textquotedblleft only if\textquotedblright\ part
of this sentence; but the \textquotedblleft if\textquotedblright\ part is
obvious.) This analogy becomes even more vivid if we replace the wording
\textquotedblleft divisible by $p$\textquotedblright\ by the (equivalent)
wording \textquotedblleft congruent to $0$ modulo $p$\textquotedblright. This
foreshadows the existence of the \textit{finite field} $\mathbb{F}_{p}$, which
we will later get to define.

\subsubsection{\label{subsect.ent.prime.mich12}A few exercises}

A number of contest problems about primes can be solved using just the basic
properties above. As an example, let us prove what is perhaps one of the first
properties one will notice when writing down a list of primes:

\begin{exercise}
\label{exe.ent.prime.mod6}\textbf{(a)} Prove that every prime $p>2$ is odd.

\textbf{(b)} Prove that every prime $p>3$ satisfies either $p\equiv
1\operatorname{mod}6$ or $p\equiv5\operatorname{mod}6$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.mod6}.]\textbf{(a)} Let $p>2$ be a
prime. We must show that $p$ is odd.

Indeed, assume (for the sake of contradiction) that $p$ is even. Hence, $2\mid
p$. Thus, $2$ is a positive divisor of $p$. However, $p$ is prime. In other
words, the only positive divisors of $p$ are $1$ and $p$ (by the definition of
\textquotedblleft prime\textquotedblright). Thus, $2$ must be either $1$ or
$p$ (since $2$ is a positive divisor of $p$). Since $2$ is not $1$, we thus
conclude that $2$ is $p$. In other words, $2=p$. This contradicts $p>2$. This
contradiction shows that our assumption was false.

Hence, $p$ is not even. In other words, $p$ is odd. This proves Exercise
\ref{exe.ent.prime.mod6} \textbf{(a)}.

\textbf{(b)} Let $p>3$ be a prime. We must prove that $p\equiv
1\operatorname{mod}6$ or $p\equiv5\operatorname{mod}6$.

Indeed, $p>3>2$. Hence, Exercise \ref{exe.ent.prime.mod6} \textbf{(a)} shows
that $p$ is odd. In other words, $p\equiv1\operatorname{mod}2$ (by Exercise
\ref{exe.ent.even-odd.1} \textbf{(d)}, applied to $u=p$). In other words,
$2\mid p-1$. In other words, there exists an integer $c$ such that $p-1=2c$.
Consider this $c$. From $p-1=2c$, we obtain $p=2c+1$.

In the above solution to Exercise \ref{exe.ent.prime.mod6} \textbf{(a)}, we
have showed that $p$ is not even. A similar argument can be used to show that
we don't have $p\equiv0\operatorname{mod}3$\ \ \ \ \footnote{Here are the
details:
\par
Assume (for the sake of contradiction) that $p\equiv0\operatorname{mod}3$.
Hence, $3\mid p$. Thus, $3$ is a positive divisor of $p$. However, $p$ is
prime. In other words, the only positive divisors of $p$ are $1$ and $p$ (by
the definition of \textquotedblleft prime\textquotedblright). Thus, $3$ must
be either $1$ or $p$ (since $3$ is a positive divisor of $p$). Since $3$ is
not $1$, we thus conclude that $3$ is $p$. In other words, $3=p$. This
contradicts $p>3$. This contradiction shows that our assumption was false. In
other words, we don't have $p\equiv0\operatorname{mod}3$.}.

Now, Proposition \ref{prop.ent.quorem.props} \textbf{(a)} (applied to $n=3$
and $u=c$) yields that $c\%3\in\left\{  0,1,\ldots,3-1\right\}  $ and
$c\%3\equiv c\operatorname{mod}3$. From $c\%3\equiv c\operatorname{mod}3$, we
obtain $c\equiv c\%3\operatorname{mod}3$. Also, Proposition
\ref{prop.ent.quorem.props} \textbf{(d)} (applied to $n=3$ and $u=c$) yields
that $c=\left(  c//3\right)  3+\left(  c\%3\right)  $. Hence,%
\begin{align}
p  &  =2\underbrace{c}_{=\left(  c//3\right)  3+\left(  c\%3\right)
}+1=2\left(  \left(  c//3\right)  3+\left(  c\%3\right)  \right)
+1=\underbrace{6\left(  c//3\right)  }_{\substack{\equiv0\operatorname{mod}%
6\\\text{(since }c//3\text{ is an integer)}}}+2\left(  c\%3\right)
+1\nonumber\\
&  \equiv2\left(  c\%3\right)  +1\operatorname{mod}6.
\label{sol.ent.prime.mod6.pmod6}%
\end{align}


We have $c\%3\in\left\{  0,1,\ldots,3-1\right\}  =\left\{  0,1,2\right\}  $.
If we had $c\%3=1$, then we would have%
\[
p=2\underbrace{c}_{\equiv c\%3=1\operatorname{mod}3}+1\equiv2\cdot
1+1=3\equiv0\operatorname{mod}3,
\]
which would contradict the fact that we don't have $p\equiv0\operatorname{mod}%
3$. Hence, we cannot have $c\%3=1$. In other words, we have $c\%3\neq1$.

Combining $c\%3\in\left\{  0,1,2\right\}  $ with $c\%3\neq1$, we obtain
$c\%3\in\left\{  0,1,2\right\}  \setminus\left\{  1\right\}  =\left\{
0,2\right\}  $. In other words, we have $c\%3=0$ or $c\%3=2$. Hence, we must
be in one of the following two cases:

\textit{Case 1:} We have $c\%3=0$.

\textit{Case 2:} We have $c\%3=2$.

Let us first consider Case 1. In this case, we have $c\%3=0$. Now,
(\ref{sol.ent.prime.mod6.pmod6}) becomes $p\equiv2\underbrace{\left(
c\%3\right)  }_{=0}+1=1\operatorname{mod}6$. Hence, $p\equiv
1\operatorname{mod}6$ or $p\equiv5\operatorname{mod}6$. Thus, Exercise
\ref{exe.ent.prime.mod6} \textbf{(b)} is solved in Case 1.

Let us now consider Case 2. In this case, we have $c\%3=2$. Now,
(\ref{sol.ent.prime.mod6.pmod6}) becomes $p\equiv2\underbrace{\left(
c\%3\right)  }_{=2}+1=2\cdot2+1=5\operatorname{mod}6$. Hence, $p\equiv
1\operatorname{mod}6$ or $p\equiv5\operatorname{mod}6$. Thus, Exercise
\ref{exe.ent.prime.mod6} \textbf{(b)} is solved in Case 2.

We have now solved Exercise \ref{exe.ent.prime.mod6} \textbf{(b)} in both
Cases 1 and 2. Thus, Exercise \ref{exe.ent.prime.mod6} \textbf{(b)} always holds.
\end{proof}

Exercise \ref{exe.ent.prime.mod6} \textbf{(a)} shows that the primes larger
than $2$ are precisely the odd primes.

Our next exercise is, in a certain sense, an analogue of Exercise
\ref{prop.ent.mod.k-power}. Recall that Exercise \ref{prop.ent.mod.k-power}
allows taking a congruence to the $k$-th power: If $n,a,b$ are integers
satisfying $a\equiv b\operatorname{mod}n$, then $a^{k}\equiv b^{k}%
\operatorname{mod}n$ for each $k\in\mathbb{N}$. One might hope for something
similar to hold when the powers are replaced by binomial coefficients (i.e.,
when $a^{k}$ and $b^{k}$ are replaced by $\dbinom{a}{k}$ and $\dbinom{b}{k}$);
but this is not generally the case (for example, $2\equiv0\operatorname{mod}2$
is true, but $\dbinom{2}{2}\equiv\dbinom{0}{2}\operatorname{mod}2$ is false).
Nevertheless, it holds if $n$ is prime and $k<n$, as the following exercise
shows:\footnote{Exercise \ref{exe.ent.prime.achoosek} is \cite[Proposition
5.5]{fleck} (with $u$ and $v$ renamed as $a$ and $b$).}

\begin{exercise}
\label{exe.ent.prime.achoosek}Let $p$ be a prime. Let $a$ and $b$ be two
integers such that $a\equiv b\operatorname{mod}p$. Let $k\in\left\{
0,1,\ldots,p-1\right\}  $. Prove that $\dbinom{a}{k}\equiv\dbinom{b}%
{k}\operatorname{mod}p$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.achoosek}.]Our plan is the following:
First, we shall prove the congruence $k!\dbinom{a}{k}\equiv k!\dbinom{b}%
{k}\operatorname{mod}p$; then, we will argue that $k!\perp p$, and thus (using
Lemma \ref{lem.ent.coprime.cancel}) we will be able to cancel the $k!$ from
this congruence.

We begin by proving $k!\dbinom{a}{k}\equiv k!\dbinom{b}{k}\operatorname{mod}%
p$. Indeed, (\ref{eq.def.binom.def.a}) (applied to $n=a$) yields%
\[
\dbinom{a}{k}=\dfrac{a\left(  a-1\right)  \left(  a-2\right)  \cdots\left(
a-k+1\right)  }{k!}.
\]
Multiplying this equality by $k!$, we find%
\begin{align}
k!\dbinom{a}{k}  &  =a\left(  a-1\right)  \left(  a-2\right)  \cdots\left(
a-k+1\right) \nonumber\\
&  =\prod_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(  a-s\right)  .
\label{sol.ent.prime.achoosek.1}%
\end{align}
The same argument (applied to $b$ instead of $a$) yields%
\begin{equation}
k!\dbinom{b}{k}=\prod_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(
b-s\right)  . \label{sol.ent.prime.achoosek.2}%
\end{equation}
However, $\underbrace{a}_{\equiv b\operatorname{mod}p}-s\equiv
b-s\operatorname{mod}p$ for each $s\in\left\{  0,1,\ldots,k-1\right\}  $.
Hence, (\ref{eq.exe.ent.mod.k-sum.b}) (applied to $S=\left\{  0,1,\ldots
,k-1\right\}  $ and $a_{s}=a-s$ and $b_{s}=b-s$ and $n=p$) yields $\prod
_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(  a-s\right)  \equiv\prod
_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(  b-s\right)  \operatorname{mod}%
p$. Hence,%
\[
k!\dbinom{a}{k}=\prod_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(
a-s\right)  \equiv\prod_{s\in\left\{  0,1,\ldots,k-1\right\}  }\left(
b-s\right)  =k!\dbinom{b}{k}\operatorname{mod}p
\]
(by (\ref{sol.ent.prime.achoosek.2})).

Now, $k\leq p-1$ (since $k\in\left\{  0,1,\ldots,p-1\right\}  $) and
$k!=1\cdot2\cdot\cdots\cdot k$. We shall next show that $k!\perp p$.

Let $i\in\left\{  1,2,\ldots,k\right\}  $. Then, $i\in\left\{  1,2,\ldots
,k\right\}  \subseteq\left\{  1,2,\ldots,p-1\right\}  $ (since $k\leq p-1$).
Thus, $i$ is coprime to $p$ (by Proposition
\ref{prop.ent.prime.each-i-coprime}). In other words, $i\perp p$.

Forget that we fixed $i$. We thus have shown that each $i\in\left\{
1,2,\ldots,k\right\}  $ satisfies $i\perp p$. Thus, Exercise
\ref{exe.ent.coprime.ab-to-ck} (applied to $c=p$ and $a_{i}=i$) yields
$1\cdot2\cdot\cdots\cdot k\perp p$. In other words, $k!\perp p$ (since
$k!=1\cdot2\cdot\cdots\cdot k$). Therefore, Lemma \ref{lem.ent.coprime.cancel}
(applied to $k!$, $\dbinom{a}{k}$, $\dbinom{b}{k}$ and $p$ instead of $a$,
$b$, $c$ and $n$) yields $\dbinom{a}{k}\equiv\dbinom{b}{k}\operatorname{mod}p$
(since $k!\dbinom{a}{k}\equiv k!\dbinom{b}{k}\operatorname{mod}p$). This
proves Exercise \ref{exe.ent.prime.achoosek}.
\end{proof}

As a further example, here is a problem from the 12th University of Michigan
Undergraduate Mathematics Competition in 1995 (\cite[Problem 28]{VelWag20}):

\begin{exercise}
\label{exe.ent.prime.mich12}Let $n$ be a positive integer. Prove that $n$ is
prime if and only if there is a \textbf{unique} pair $\left(  j,k\right)  $ of
positive integers satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.mich12} (sketched).]We shall prove
the following four claims:

\begin{statement}
\textit{Claim 1:} If $n>1$, then there is \textbf{at least one} pair $\left(
j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac{1}%
{k}=\dfrac{1}{n}$.
\end{statement}

\begin{statement}
\textit{Claim 2:} If $n$ is prime, then there is \textbf{a unique} pair
$\left(  j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac
{1}{k}=\dfrac{1}{n}$.
\end{statement}

\begin{statement}
\textit{Claim 3:} If there is \textbf{at least one} pair $\left(  j,k\right)
$ of positive integers satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$,
then $n>1$.
\end{statement}

\begin{statement}
\textit{Claim 4:} If there is a \textbf{unique} pair $\left(  j,k\right)  $ of
positive integers satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$, then
$n$ is prime.
\end{statement}

Once these four claims are proved, Exercise \ref{exe.ent.prime.mich12} will
follow by combining Claim 2 with Claim 4. (Claims 1 and 3 serve ancillary
roles in proving other claims.) So let us prove these four claims:

[\textit{Proof of Claim 1:} Assume that $n>1$. Then, $n-1$ and $\left(
n-1\right)  n$ are positive integers, and an easy computation reveals that
$\dfrac{1}{n-1}-\dfrac{1}{\left(  n-1\right)  n}=\dfrac{1}{n}$. Hence, there
is \textbf{at least one} pair $\left(  j,k\right)  $ of positive integers
satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$ (namely, $\left(
j,k\right)  =\left(  n-1,\left(  n-1\right)  n\right)  $). This proves Claim 1.]

[\textit{Proof of Claim 2:} Assume that $n$ is prime. Thus, $n>1$. Now, let
$\left(  j,k\right)  $ be a pair of positive integers satisfying $\dfrac{1}%
{j}-\dfrac{1}{k}=\dfrac{1}{n}$. We shall show that $\left(  j,k\right)
=\left(  n-1,\left(  n-1\right)  n\right)  $.

Indeed, we have $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$, so that $\dfrac
{1}{n}=\dfrac{1}{j}-\underbrace{\dfrac{1}{k}}_{>0}<\dfrac{1}{j}$ and thus
$j<n$. Hence, we cannot have $n\mid j$\ \ \ \ \footnote{\textit{Proof.} Assume
the contrary. Thus, $n\mid j$. Hence, from Proposition \ref{prop.ent.div.1}
\textbf{(b)}, we obtain $\left\vert n\right\vert \leq\left\vert j\right\vert $
(since $j\neq0$). But $j$ and $n$ are positive integers; thus, $\left\vert
j\right\vert =j$ and $\left\vert n\right\vert =n$. Hence, $n=\left\vert
n\right\vert \leq\left\vert j\right\vert =j<n$, which is absurd. This
contradiction shows that our assumption was false, qed.}. Also, from $j<n$, we
see that $n-j$ is a positive integer. Also, $n-j$ cannot be $n$ (since
$n-\underbrace{j}_{>0}<n$).

Also, $\dfrac{1}{n}=\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{k-j}{jk}$, so that
$jk=n\left(  k-j\right)  $. Now, $n\mid n\left(  k-j\right)  =jk$. Hence,
Theorem \ref{thm.ent.prime.pab} (applied to $p=n$, $a=j$ and $b=k$) yields
that $n\mid j$ or $n\mid k$. Thus, we have $n\mid k$ (since we cannot have
$n\mid j$). In other words, $k=na$ for some $a\in\mathbb{Z}$. Consider this
$a$.

Now, recall that $jk=n\left(  k-j\right)  $. In view of $k=na$, this rewrites
as $jna=n\left(  na-j\right)  $. We can cancel $n$ from this equality (since
$n>0$), and thus obtain $ja=na-j$. Hence,%
\[
\left(  n-j\right)  \left(  a+1\right)  =na-\underbrace{ja}_{=na-j}%
+n-j=na-\left(  na-j\right)  +n-j=n.
\]
Thus, $n-j\mid\left(  n-j\right)  \left(  a+1\right)  =n$. Hence, $n-j$ is a
positive divisor of $n$ (since $n-j$ is a positive integer).

But $n$ is prime. Hence, the only positive divisors of are $1$ and $n$ (by the
definition of a \textquotedblleft prime\textquotedblright). Thus, $n-j$ must
be $1$ or $n$ (since $n-j$ is a positive divisor of $n$). Since $n-j$ cannot
be $n$, we thus conclude that $n-j$ must be $1$. Hence, $n-j=1$, so that
$j=n-1$. Now, recall that $\left(  n-j\right)  \left(  a+1\right)  =n$. Hence,
$n=\underbrace{\left(  n-j\right)  }_{=1}\left(  a+1\right)  =a+1$, so that
$a=n-1$ and therefore $k=n\underbrace{a}_{=n-1}=n\left(  n-1\right)  $.

From $j=n-1$ and $k=n\left(  n-1\right)  $, we obtain $\left(  j,k\right)
=\left(  n-1,n\left(  n-1\right)  \right)  $.

Forget that we fixed $\left(  j,k\right)  $. Thus, we have proved that every
pair $\left(  j,k\right)  $ of positive integers satisfying $\dfrac{1}%
{j}-\dfrac{1}{k}=\dfrac{1}{n}$ satisfies $\left(  j,k\right)  =\left(
n-1,n\left(  n-1\right)  \right)  $. Hence, there is \textbf{at most one} such
pair $\left(  j,k\right)  $. Since we also know (from Claim 1) that there is
\textbf{at least one} such pair $\left(  j,k\right)  $, we can thus conclude
that there is a \textbf{unique} such pair $\left(  j,k\right)  $. This proves
Claim 2.]

[\textit{Proof of Claim 3:} Assume that there is \textbf{at least one} pair
$\left(  j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac
{1}{k}=\dfrac{1}{n}$. Consider this pair $\left(  j,k\right)  $. Thus,
$\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$, so that $\dfrac{1}{n}=\dfrac{1}%
{j}-\underbrace{\dfrac{1}{k}}_{>0}<\dfrac{1}{j}$. Thus, $n>j\geq1$. This
proves Claim 3.]

[\textit{Proof of Claim 4:} Assume that there is a \textbf{unique} pair
$\left(  j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac
{1}{k}=\dfrac{1}{n}$. Thus, in particular, there is \textbf{at least one} such
pair $\left(  j,k\right)  $. Hence, Claim 3 yields that $n>1$.

However, we must prove that $n$ is prime.

Assume the contrary. Thus, $n$ is not a prime. Since $n>1$, we thus conclude
that $1$ and $n$ are \textbf{not} the only positive divisors of $n$ (by the
definition of a \textquotedblleft prime\textquotedblright). In other words,
there exists a positive divisor $d$ of $n$ that is distinct from $1$ and $n$.
Consider this $d$.

Set $e=n/d$. Then, $e=n/d\in\mathbb{Z}$ (since $d$ is a divisor of $n$) and
$e=n/d>0$ (since $n$ and $d$ are positive). Hence, $e$ is a positive integer.
Moreover, from $e=n/d$, we obtain $ed=n$. We have $d>1$ (since $d$ is a
positive integer distinct from $1$) and thus $d-1>0$. Hence, $e\left(
d-1\right)  $ and $ed\left(  d-1\right)  $ are positive integers. Thus,
$\left(  e\left(  d-1\right)  ,ed\left(  d-1\right)  \right)  $ is a pair
$\left(  j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac
{1}{k}=\dfrac{1}{n}$ (indeed, it is easy to see that $\dfrac{1}{e\left(
d-1\right)  }-\dfrac{1}{ed\left(  d-1\right)  }=\dfrac{1}{ed}=\dfrac{1}{n}$
(since $ed=n$)). However, we also know (from the proof of Claim 1) that
$\left(  n-1,\left(  n-1\right)  n\right)  $ is a pair $\left(  j,k\right)  $
of positive integers satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$.

Thus, we have found two pairs $\left(  j,k\right)  $ of positive integers
satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$: namely, $\left(  e\left(
d-1\right)  ,ed\left(  d-1\right)  \right)  $ and $\left(  n-1,\left(
n-1\right)  n\right)  $. Since we have assumed that there is a \textbf{unique}
such pair $\left(  j,k\right)  $, we thus conclude that these two pairs must
be equal. In other words, we have $\left(  e\left(  d-1\right)  ,ed\left(
d-1\right)  \right)  =\left(  n-1,\left(  n-1\right)  n\right)  $. Hence,
$e\left(  d-1\right)  =n-1$ and $ed\left(  d-1\right)  =\left(  n-1\right)
n$. Now, comparing $e\left(  d-1\right)  =n-1$ with $e\left(  d-1\right)
=\underbrace{ed}_{=n}-e=n-e$, we obtain $n-1=n-e$. Thus, $1=e=n/d$, so that
$d=n$. This contradicts the fact that $d$ is distinct from $n$. This
contradiction shows that our assumption was false. Hence, Claim 4 is proved.]

Combining Claim 2 with Claim 4, we conclude the claim of Exercise
\ref{exe.ent.prime.mich12}.
\end{proof}

\subsubsection{\label{subsect.hw10a}Homework set \#10A: Elementary properties
of primes}

This homework set is optional. I will grade your solutions if you choose to
write them up, but there won't be any points to gain.

\begin{exercise}
\label{exe.ent.prime.uu-vv}Let $n$ be an integer. Prove that $n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}$ if and
only if $n\not \equiv 2\operatorname{mod}4$.
\end{exercise}

\begin{exercise}
\label{exe.ent.prime.uv-u2}Let $n$ be a positive integer. Prove that $n$ can
be represented in the form $n=uv-\dbinom{u}{2}$ for some $u,v\in\mathbb{Z}$
satisfying $v\geq u\geq3$ if and only if $n$ is neither a prime nor a power of
$2$.
\end{exercise}

The following exercise is among the first results in the deep topic of
interplays between primes and Pascal's triangle:

\begin{exercise}
\label{exe.ent.prime.pchoosek}Let $p$ be a prime.

\textbf{(a)} Prove that $p\mid\dbinom{p}{k}$ for each $k\in\left\{
1,2,\ldots,p-1\right\}  $.

\textbf{(b)} Prove that $\dbinom{p-1}{k}\equiv\left(  -1\right)
^{k}\operatorname{mod}p$ for each $k\in\left\{  0,1,\ldots,p-1\right\}  $.
\end{exercise}

\begin{noncompile}
\textbf{(a)} Use Exercise \ref{exe.binom.gcd-integrality} or Exercise
\ref{exe.ent.prime.achoosek}.

\textbf{(b)} Use Exercise \ref{exe.ent.prime.achoosek}. Or absorption and part
\textbf{(a)} (sketch?).
\end{noncompile}

\begin{exercise}
\label{exe.ent.prime.sum-ik-1}Let $p$ be a prime. Let $k\in\left\{
0,1,\ldots,p-2\right\}  $. Prove that $\sum_{i=0}^{p-1}i^{k}\equiv
0\operatorname{mod}p$.

[\textbf{Hint:} Exercise \ref{exe.ent.prime.pchoosek} \textbf{(b)} might help.]
\end{exercise}

The next exercise extends Exercise \ref{exe.ent.prime.mich12}:

\begin{exercise}
\label{exe.ent.prime.mich12plus}Let $n$ be a positive integer. Let $u$ be the
\# of pairs $\left(  j,k\right)  $ of positive integers satisfying $\dfrac
{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$.

Prove that $u$ is the \# of all integers $i\in\left[  n-1\right]  $ satisfying
$i\mid n^{2}$.
\end{exercise}

\begin{noncompile}
This is https://oeis.org/A063647 .
\end{noncompile}

\subsubsection{\label{subsect.ent.prime.flt}Fermat's little theorem}

The following theorem (\cite[Theorem 2.15.1]{19s}) is known as
\textit{Fermat's Little Theorem} (often abbreviated as \textquotedblleft
FLT\textquotedblright):

\begin{theorem}
[Fermat's Little Theorem]\label{thm.ent.fermat}Let $p$ be a prime. Let
$a\in\mathbb{Z}$.

\textbf{(a)} If $p\nmid a$, then $a^{p-1}\equiv1\operatorname{mod}p$.

\textbf{(b)} We always have $a^{p}\equiv a\operatorname{mod}p$.
\end{theorem}

Theorem \ref{thm.ent.fermat} is often abbreviated \textquotedblleft
FLT\textquotedblright\ or \textquotedblleft Little Fermat\textquotedblright.
The word \textquotedblleft little\textquotedblright\ in the name of this
theorem is to distinguish it from \textquotedblleft%
\href{https://en.wikipedia.org/wiki/Fermat's_Last_Theorem}{Fermat's Last
Theorem}\textquotedblright, a much more difficult result only proven in the 1990s.

Note that Exercise \ref{exe.ent.squares-mod-3} is the particular case of
Theorem \ref{thm.ent.fermat} \textbf{(a)} for $p=3$ (and $a=n$).

We will outline two proofs of Theorem \ref{thm.ent.fermat}. The first relies
on the following lemma:

\begin{lemma}
\label{lem.ent.idiotbin}Let $p$ be a prime. Then:

\textbf{(a)} We have $\left(  a+b\right)  ^{p}\equiv a^{p}+b^{p}%
\operatorname{mod}p$ for any $a,b\in\mathbb{Z}$.

\textbf{(b)} We have $\left(  -a\right)  ^{p}\equiv-a^{p}\operatorname{mod}p$
for any $a\in\mathbb{Z}$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.idiotbin}.]\textbf{(a)} Let $a,b\in\mathbb{Z}$.
Theorem \ref{thm.binom.binom} (applied to $x=a$, $y=b$ and $n=p$) yields%
\begin{align*}
\left(  a+b\right)  ^{p}  &  =\sum_{k=0}^{p}\dbinom{p}{k}a^{k}b^{p-k}\\
&  =\underbrace{\dbinom{p}{0}}_{\substack{=1\\\text{(by
(\ref{eq.exa.binom.small.nC0}))}}}\underbrace{a^{0}}_{=1}\underbrace{b^{p-0}%
}_{=b^{p}}+\sum_{k=1}^{p-1}\underbrace{\dbinom{p}{k}}_{\substack{\equiv
0\operatorname{mod}p\\\text{(since Exercise \ref{exe.ent.prime.pchoosek}
\textbf{(a)}}\\\text{yields }p\mid\dbinom{p}{k}\text{)}}}a^{k}b^{p-k}%
+\underbrace{\dbinom{p}{p}}_{\substack{=1\\\text{(by
(\ref{eq.thm.binom.sym.nn}))}}}a^{p}\underbrace{b^{p-p}}_{=b^{0}=1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split off the addends for }k=0\text{ and}\\
\text{for }k=p\text{ from the sum}%
\end{array}
\right) \\
&  \equiv b^{p}+\underbrace{\sum_{k=1}^{p-1}0a^{k}b^{p-k}}_{=0}+a^{p}%
=b^{p}+a^{p}=a^{p}+b^{p}\operatorname{mod}p.
\end{align*}
This proves Lemma \ref{lem.ent.idiotbin} \textbf{(a)}.

\textbf{(b)} Let $a\in\mathbb{Z}$. Applying Lemma \ref{lem.ent.idiotbin}
\textbf{(a)} to $b=-a$, we obtain $\left(  a+\left(  -a\right)  \right)
^{p}\equiv a^{p}+\left(  -a\right)  ^{p}\operatorname{mod}p$. Hence,%
\[
a^{p}+\left(  -a\right)  ^{p}\equiv\left(  \underbrace{a+\left(  -a\right)
}_{=0}\right)  ^{p}=0^{p}=0\operatorname{mod}p\ \ \ \ \ \ \ \ \ \ \left(
\text{since }p>0\right)  .
\]
Thus, $\left(  -a\right)  ^{p}\equiv0-a^{p}=-a^{p}\operatorname{mod}p$. This
proves Lemma \ref{lem.ent.idiotbin} \textbf{(b)}.
\end{proof}

\begin{proof}
[First proof of Theorem \ref{thm.ent.fermat}.]\textbf{(b)} Forget that we
fixed $a$. We shall first show that Theorem \ref{thm.ent.fermat} \textbf{(b)}
holds for $a\geq0$. That is, we shall prove the following claim:

\begin{statement}
\textit{Claim 1:} We have $a^{p}\equiv a\operatorname{mod}p$ for each
$a\in\mathbb{N}$.
\end{statement}

[\textit{Proof of Claim 1:} We proceed by induction on $a$:

\textit{Induction base:} We have $0^{p}=0$ (since $p$ is positive) and thus
$0^{p}\equiv0\operatorname{mod}p$. In other words, Claim 1 holds for $a=0$.

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 1 holds for $a=k$. We must prove that Claim 1 holds for
$a=k+1$.

We have assumed that Claim 1 holds for $a=k$. In other words, we have
$k^{p}\equiv k\operatorname{mod}p$.

Now, Lemma \ref{lem.ent.idiotbin} \textbf{(a)} (applied to $a=k$ and $b=1$)
yields $\left(  k+1\right)  ^{p}\equiv\underbrace{k^{p}}_{\equiv
k\operatorname{mod}p}+\underbrace{1^{p}}_{=1}\equiv k+1\operatorname{mod}p$.
In other words, Claim 1 holds for $a=k+1$. This completes the induction step.
Thus, Claim 1 is proved by induction.]

We can now prove Theorem \ref{thm.ent.fermat} \textbf{(b)} in full generality:

Let $a\in\mathbb{Z}$. We must show that $a^{p}\equiv a\operatorname{mod}p$. If
$a\in\mathbb{N}$, then this follows from Claim 1. Hence, for the rest of this
proof, we WLOG assume that $a\notin\mathbb{N}$. Combining $a\in\mathbb{Z}$
with $a\notin\mathbb{N}$, we find $a\in\mathbb{Z}\setminus\mathbb{N}=\left\{
-1,-2,-3,\ldots\right\}  $. Hence, $-a\in\left\{  1,2,3,\ldots\right\}
\subseteq\mathbb{N}$. Thus, we can apply Claim 1 to $-a$ instead of $a$. As a
result, we obtain $\left(  -a\right)  ^{p}\equiv-a\operatorname{mod}p$.
However, Lemma \ref{lem.ent.idiotbin} \textbf{(b)} yields $\left(  -a\right)
^{p}\equiv-a^{p}\operatorname{mod}p$. Thus, $-a^{p}\equiv\left(  -a\right)
^{p}\equiv-a\operatorname{mod}p$. Hence,%
\[
a^{p}=\left(  -1\right)  \underbrace{\left(  -a^{p}\right)  }_{\equiv
-a\operatorname{mod}p}\equiv\left(  -1\right)  \left(  -a\right)
=a\operatorname{mod}p.
\]
This proves Theorem \ref{thm.ent.fermat} \textbf{(b)}.

\textbf{(a)} Assume that $p\nmid a$. Theorem \ref{thm.ent.fermat} \textbf{(b)}
yields $a^{p}\equiv a\operatorname{mod}p$. In other words, $p\mid a^{p}-a$. In
view of $a^{p}-a=a\left(  a^{p-1}-1\right)  $, this rewrites as $p\mid
a\left(  a^{p-1}-1\right)  $. Hence, Theorem \ref{thm.ent.prime.pab} (applied
to $b=a^{p-1}-1$) yields that $p\mid a$ or $p\mid a^{p-1}-1$. Since we don't
have $p\mid a$ (because we have assumed that $p\nmid a$), we thus obtain
$p\mid a^{p-1}-1$. In other words, $a^{p-1}\equiv1\operatorname{mod}p$. Thus,
Theorem \ref{thm.ent.fermat} \textbf{(a)} is proved.
\end{proof}

\begin{remark}
We have used Lemma \ref{lem.ent.idiotbin} to prove Theorem
\ref{thm.ent.fermat} \textbf{(b)} above; conversely, Lemma
\ref{lem.ent.idiotbin} can easily be derived from Theorem \ref{thm.ent.fermat}
\textbf{(b)}. This might suggest that Lemma \ref{lem.ent.idiotbin} is just a
one-trick tool for the proof of Theorem \ref{thm.ent.fermat} \textbf{(b)}.
However, when properly generalized, Lemma \ref{lem.ent.idiotbin} becomes much
stronger and more useful than Theorem \ref{thm.ent.fermat} \textbf{(b)} can
ever get! Indeed, there is a \textquotedblleft grown-up\textquotedblright%
\ version of Lemma \ref{lem.ent.idiotbin}, which no longer requires $a$ and
$b$ to be integers but rather allows them to be any two commuting elements of
a ring (see any course on abstract algebra for the meanings of these words). A
down-to-earth example of this is when $a$ and $b$ are two $n\times n$-matrices
with integer entries satisfying $ab=ba$; the \textquotedblleft
grown-up\textquotedblright\ version of Lemma \ref{lem.ent.idiotbin}
\textbf{(a)} then says that $\left(  a+b\right)  ^{p}\equiv a^{p}%
+b^{p}\operatorname{mod}p$, in the sense that each entry of the matrix
$\left(  a+b\right)  ^{p}$ is congruent to the corresponding entry of
$a^{p}+b^{p}$ modulo $p$.

Thus, Lemma \ref{lem.ent.idiotbin} in the form we stated it above is merely
the tip of an iceberg. Fortunately, the proof we gave for it applies almost
verbatim to the generalization (which is known as \textquotedblleft Idiot's
Binomial Formula\textquotedblright\ or \textquotedblleft Freshman's
Dream\textquotedblright, as it allows replacing the $p$-th power of a sum by a
sum of $p$-th powers in certain situations).
\end{remark}

\subsubsection{\label{subsect.ent.prime.euler}Euler's totient function}

Our second proof of Theorem \ref{thm.ent.fermat} will derive it from a more
general result, known as \textit{Euler's theorem} (\cite[Theorem 2.15.3]{19s}):

\begin{theorem}
[Euler's theorem]\label{thm.ent.euler}Let $n$ be a positive integer. We let
$\phi\left(  n\right)  $ denote the number of all $i\in\left\{  1,2,\ldots
,n\right\}  $ satisfying $i\perp n$. (This notation was already used in
Exercise \ref{exe.ent.coprime.sum-of-coprime}.)

Let $a\in\mathbb{Z}$ be coprime to $n$. Then, $a^{\phi\left(  n\right)
}\equiv1\operatorname{mod}n$.
\end{theorem}

Theorem \ref{thm.ent.euler} yields Theorem \ref{thm.ent.fermat} \textbf{(a)},
since $\phi\left(  p\right)  =p-1$ when $p$ is prime (check this!). Theorem
\ref{thm.ent.fermat} \textbf{(b)} follows from Theorem \ref{thm.ent.fermat}
\textbf{(a)} easily (one just needs to handle the cases $p\mid a$ and $p\nmid
a$ separately). Thus, in order to obtain a second proof of Theorem
\ref{thm.ent.fermat}, we only need to establish Theorem \ref{thm.ent.euler}.
Before we do so, let us first illustrate how it can be used on a typical
contest problem:

\begin{exercise}
\label{exe.ent.euler777}What is the last digit of $7^{7^{7}}$?

\textit{Notational remark:} An expression of the form \textquotedblleft%
$a^{b^{c}}$\textquotedblright\ always means $a^{\left(  b^{c}\right)  }$, not
$\left(  a^{b}\right)  ^{c}$.
\end{exercise}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.euler777}.]The last digit of a positive
integer $n$ is $n\%10$ (that is, the remainder of $n$ upon division by $10$).
So we need to compute $7^{7^{7}}\%10$.

Since $7$ is coprime to $10$, we can apply Theorem \ref{thm.ent.euler} to
$n=10$ and $a=7$. We thus get $7^{\phi\left(  10\right)  }\equiv
1\operatorname{mod}10$. Since $\phi\left(  10\right)  =4$, this rewrites as
$7^{4}\equiv1\operatorname{mod}10$. (This is also not hard to check directly,
using $7^{2}=49\equiv-1\operatorname{mod}10$.) Hence, if we write $7^{7}$ in
the form $7^{7}=4a+b$ for some $a,b\in\mathbb{N}$, then%
\[
7^{7^{7}}=7^{4a+b}=\underbrace{7^{4a}}_{=\left(  7^{4}\right)  ^{a}}\cdot
7^{b}=\left(  \underbrace{7^{4}}_{\equiv1\operatorname{mod}10}\right)
^{a}\cdot7^{b}\equiv\underbrace{1^{a}}_{=1}\cdot7^{b}=7^{b}\operatorname{mod}%
10
\]
and therefore $7^{7^{7}}\%10=7^{b}\%10$. This gives us an easy way to compute
$7^{7^{7}}\%10$ provided that $b$ is small enough (so we can compute
$7^{b}\%10$).

Now, how do we write $7^{7}$ in the form $7^{7}=4a+b$ for some $a,b\in
\mathbb{N}$, with smallest possible $b$ ? The answer is, of course, that we
take $a=7^{7}//4$ and $b=7^{7}\%4$ (because Proposition
\ref{prop.ent.quorem.props} \textbf{(d)} yields $7^{7}=\left(  7^{7}%
//4\right)  \cdot4+\left(  7^{7}\%4\right)  =4\left(  7^{7}//4\right)
+\left(  7^{7}\%4\right)  $). Thus, let us set $a=7^{7}//4$ and $b=7^{7}\%4$.
As we have seen, we have $7^{7^{7}}\%10=7^{b}\%10$. It remains to compute
$7^{b}\%10$.

We first compute $b$: We have $7\equiv-1\operatorname{mod}4$ and thus
$7^{7}\equiv\left(  -1\right)  ^{7}=-1\operatorname{mod}4$, so that
$7^{7}\%4=\left(  -1\right)  \%4=3$. (Of course, we could also have used
Theorem \ref{thm.ent.euler} to obtain this, in the same way as we used it to
show $7^{7^{7}}\%10=7^{b}\%10$. But powers of $-1$ are easy enough to take by
hand!) Hence, $b=7^{7}\%4=3$ and thus%
\[
7^{b}=7^{3}=\underbrace{7^{2}}_{=49\equiv-1\operatorname{mod}10}\cdot
7\equiv\left(  -1\right)  \cdot7\equiv3\operatorname{mod}10,
\]
so that $7^{b}\%10=3\%10=3$. Hence,
\[
7^{7^{7}}\%10=7^{b}\%10=3.
\]
In other words, the last digit of $7^{7^{7}}$ is $3$.
\end{proof}

See \cite[Exercise 2.15.1]{19s} for another similar application of Euler's theorem.

Theorem \ref{thm.ent.euler} can also be used to explain why certain rational
numbers (such as $\dfrac{2}{7}=0.\overline{285714}$\ \ \ \ \footnote{The bar
($\ \overline{\ \ \text{\vphantom{5}}\ \ }\ $) over the \textquotedblleft%
$285714$\textquotedblright\ means that we are repeating $285714$ over and
over. So $0.\overline{285714}=0.285714285714285714\ldots$.}) have purely
periodic decimal expansions, while others (such as $\dfrac{1}{12}%
=0.08\overline{3}=0.0833333\ldots$ or $\dfrac{1}{2}=0.5\overline
{0}=0.50000\ldots$) have their periods start only after some initial
nonrepeating block. We refer \cite[\S 4]{Conrad-Euler} to the details of
this.\footnote{Here is the rule, in a nutshell: A fraction $\dfrac{a}{b}$
(where $a$ and $b$ are two integers with $b\neq0$) has a purely periodic
decimal expansion if and only if $b\perp10$ (in other words, $2\nmid b$ and
$5\nmid b$); otherwise, it has an eventually periodic decimal expansion (which
may be a finite decimal expansion, such as $\dfrac{1}{2}=0.5=0.5\overline{0}%
$). This can be proven using Theorem \ref{thm.ent.euler}.}

Let us now outline a proof of Theorem \ref{thm.ent.euler}:

\begin{proof}
[Proof of Theorem \ref{thm.ent.euler} (sketched).](See \cite[proof of Theorem
2.15.3]{19s} for details.) It is easy to see (using Proposition
\ref{prop.ent.gcd.props1}) that $\gcd\left(  0,n\right)  =\gcd\left(
n,n\right)  $. Hence, $0\perp n$ holds if and only if $n\perp n$.

Set%
\[
C=\left\{  i\in\left\{  0,1,\ldots,n-1\right\}  \ \mid\ i\perp n\right\}  .
\]
A moment's thought reveals that $\left\vert C\right\vert =\phi\left(
n\right)  $\ \ \ \ \footnote{\textit{Proof.} The definition of $C$ yields%
\begin{align*}
\left\vert C\right\vert  &  =\left(  \text{\# of all }i\in\left\{
0,1,\ldots,n-1\right\}  \text{ satisfying }i\perp n\right) \\
&  =\underbrace{\left(  \text{\# of all }i\in\left\{  0\right\}  \text{
satisfying }i\perp n\right)  }_{\substack{=%
\begin{cases}
1, & \text{if }0\perp n;\\
0, & \text{else}%
\end{cases}
\\=%
\begin{cases}
1, & \text{if }n\perp n;\\
0, & \text{else}%
\end{cases}
\\\text{(since }0\perp n\text{ holds if and only if }n\perp n\text{)}%
}}+\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n-1\right\}  \text{
satisfying }i\perp n\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the sum rule, since each }i\in\left\{  0,1,\ldots,n-1\right\} \\
\text{satisfies either }i\in\left\{  0\right\}  \text{ or }i\in\left\{
1,2,\ldots,n-1\right\}  \text{ (but not both)}%
\end{array}
\right) \\
&  =%
\begin{cases}
1, & \text{if }n\perp n;\\
0, & \text{else}%
\end{cases}
\ \ +\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n-1\right\}  \text{
satisfying }i\perp n\right) \\
&  =\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n-1\right\}  \text{
satisfying }i\perp n\right)  +%
\begin{cases}
1, & \text{if }n\perp n;\\
0, & \text{else.}%
\end{cases}
\end{align*}
Comparing this with%
\begin{align*}
\phi\left(  n\right)   &  =\left(  \text{\# of all }i\in\left\{
1,2,\ldots,n\right\}  \text{ satisfying }i\perp n\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }\phi\left(  n\right)
\right) \\
&  =\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n-1\right\}  \text{
satisfying }i\perp n\right)  +\underbrace{\left(  \text{\# of all }%
i\in\left\{  n\right\}  \text{ satisfying }i\perp n\right)  }_{=%
\begin{cases}
1, & \text{if }n\perp n;\\
0, & \text{else}%
\end{cases}
}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the sum
rule}\right) \\
&  =\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n-1\right\}  \text{
satisfying }i\perp n\right)  +%
\begin{cases}
1, & \text{if }n\perp n;\\
0, & \text{else}%
\end{cases}
,
\end{align*}
we obtain%
\[
\left\vert C\right\vert =\phi\left(  n\right)  .
\]
}.

Now, define the integer%
\begin{equation}
z=\prod_{i\in C}i. \label{pf.thm.ent.z=}%
\end{equation}
All factors $i$ in the product $\prod_{i\in C}i$ are coprime to $n$ (by the
definition of $C$); thus, the product itself is also coprime to $n$ (by
Exercise \ref{exe.ent.coprime.ab-to-ck}). In other words, $z\perp n$.

Our plan is to prove the congruence $za^{\phi\left(  n\right)  }\equiv
z\operatorname{mod}n$. Once it is shown, we will be able to cancel $z$ from
this congruence (by Lemma \ref{lem.ent.coprime.cancel}, since $z\perp n$),
thus obtaining $a^{\phi\left(  n\right)  }\equiv1\operatorname{mod}n$.

In order to implement this plan, we will compute the product $\prod_{i\in
C}\left(  ai\right)  $ in two ways.

On one hand, we have%
\begin{equation}
\prod_{i\in C}\left(  ai\right)  =a^{\left\vert C\right\vert }%
\underbrace{\prod_{i\in C}i}_{=z}=a^{\left\vert C\right\vert }z=za^{\left\vert
C\right\vert }=za^{\phi\left(  n\right)  } \label{pf.thm.ent.prod1}%
\end{equation}
(since $\left\vert C\right\vert =\phi\left(  n\right)  $).

On the other hand, every $i\in C$ satisfies $ai\equiv\left(  ai\right)
\%n\operatorname{mod}n$ (since Proposition \ref{prop.ent.quorem.props}
\textbf{(a)} (applied to $u=ai$) yields $\left(  ai\right)  \%n\equiv
ai\operatorname{mod}n$). Multiplying these congruences over all $i\in C$, we
obtain%
\begin{equation}
\prod_{i\in C}\left(  ai\right)  \equiv\prod_{i\in C}\left(  \left(
ai\right)  \%n\right)  \operatorname{mod}n. \label{pf.thm.ent.prod2}%
\end{equation}


Now, we claim that the product $\prod_{i\in C}\left(  \left(  ai\right)
\%n\right)  $ on the right hand side of this equality has the same factors as
the product $\prod_{i\in C}i$, just in a different order. In other words, the
map%
\begin{align*}
C  &  \rightarrow C,\\
i  &  \mapsto\left(  ai\right)  \%n
\end{align*}
is bijective. In order to prove this, we must first show that this map is well-defined:

\begin{statement}
\textit{Claim 1:} We have $\left(  ai\right)  \%n\in C$ for each $i\in C$.
\end{statement}

[\textit{Proof of Claim 1:} Let $i\in C$. Proposition
\ref{prop.ent.quorem.props} \textbf{(a)} (applied to $u=ai$) yields that
$\left(  ai\right)  \%n\in\left\{  0,1,\ldots,n-1\right\}  $.

From $a\perp n$ and $i\perp n$, we obtain $ai\perp n$ (by Theorem
\ref{thm.ent.coprime.ab-to-c}). In other words, $n\perp ai$. However,
Proposition \ref{prop.ent.gcd.props1} \textbf{(e)} yields $\gcd\left(
n,ai\right)  =\gcd\left(  n,\left(  ai\right)  \%n\right)  $, so that
$\gcd\left(  n,\left(  ai\right)  \%n\right)  =\gcd\left(  n,ai\right)  =1$
(since $n\perp ai$) and thus $n\perp\left(  ai\right)  \%n$. In other words,
$\left(  ai\right)  \%n\perp n$. Combining this with $\left(  ai\right)
\%n\in\left\{  0,1,\ldots,n-1\right\}  $, we obtain $\left(  ai\right)  \%n\in
C$ (by the definition of $C$). This proves Claim 1.]

Thus, we can define a map%
\begin{align*}
f:C  &  \rightarrow C,\\
i  &  \mapsto\left(  ai\right)  \%n.
\end{align*}
Consider this map $f$.

\begin{statement}
\textit{Claim 2:} The map $f$ is injective.
\end{statement}

[\textit{Proof of Claim 2:} Let $i$ and $j$ be two elements of $C$ such that
$f\left(  i\right)  =f\left(  j\right)  $. We must prove that $i=j$.

We have $f\left(  i\right)  =f\left(  j\right)  $. In view of $f\left(
i\right)  =\left(  ai\right)  \%n$ (by the definition of $f$) and $f\left(
j\right)  =\left(  aj\right)  \%n$, this rewrites as $\left(  ai\right)
\%n=\left(  aj\right)  \%n$. Because of Proposition
\ref{prop.ent.quo-rem.mod=rem} (applied to $u=ai$ and $v=aj$), this entails
that $ai\equiv aj\operatorname{mod}n$. By Lemma \ref{lem.ent.coprime.cancel},
we can \textquotedblleft cancel\textquotedblright\ $a$ from this congruence
(since $a\perp n$), and obtain $i\equiv j\operatorname{mod}n$. However, both
$i$ and $j$ belong to $C$ and thus belong to $\left\{  0,1,\ldots,n-1\right\}
$ (by the definition of $C$). Hence, from $i\equiv j\operatorname{mod}n$, we
can easily obtain that $i=j$\ \ \ \ \footnote{\textit{Proof.} Proposition
\ref{prop.ent.quorem.props} \textbf{(c)} (applied to $u=j$ and $c=i$) yields
$i=j\%n$ (since $i\equiv j\operatorname{mod}n$ and $i\in\left\{
0,1,\ldots,n-1\right\}  $). Also, Proposition \ref{prop.ent.quorem.props}
\textbf{(c)} (applied to $u=j$ and $c=j$) yields $j=j\%n$ (since $j\equiv
j\operatorname{mod}n$ and $j\in\left\{  0,1,\ldots,n-1\right\}  $). Hence,
$i=j\%n=j$.}.

Now, forget that we fixed $i$ and $j$. We thus have proven that if $i$ and $j$
are two elements of $C$ such that $f\left(  i\right)  =f\left(  j\right)  $,
then $i=j$. In other words, $f$ is injective.]

\begin{statement}
\textit{Claim 3:} The map $f$ is a bijection.
\end{statement}

[\textit{Proof:} Claim 2 shows that $f$ is injective. Hence, Corollary
\ref{cor.php.endofunc.perm} \textbf{(a)} (applied to $X=C$) shows that $f$ is
a permutation of $C$. Thus, $f$ is bijective. This proves Claim 3.]

Now, we know that $f$ is a bijection from $C$ to $C$. Thus, we can substitute
$f\left(  i\right)  $ for $i$ in the product $\prod\limits_{i\in C}i$. So we
obtain%
\begin{equation}
\prod_{i\in C}i=\prod_{i\in C}\underbrace{f\left(  i\right)  }%
_{\substack{=\left(  ai\right)  \%n\\\text{(by the definition of }f\text{)}%
}}=\prod_{i\in C}\left(  \left(  ai\right)  \%n\right)  .
\label{pf.thm.ent.prod3}%
\end{equation}
Hence, (\ref{pf.thm.ent.prod2}) becomes%
\begin{align*}
\prod_{i\in C}\left(  ai\right)   &  \equiv\prod_{i\in C}\left(  \left(
ai\right)  \%n\right)  =\prod_{i\in C}i\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.ent.prod3})}\right) \\
&  =z\operatorname{mod}n.
\end{align*}
Now, (\ref{pf.thm.ent.prod1}) leads to%
\[
za^{\phi\left(  n\right)  }=\prod_{i\in C}\left(  ai\right)  \equiv
z=z\cdot1\operatorname{mod}n.
\]
We can cancel $z$ from this congruence (by Lemma \ref{lem.ent.coprime.cancel},
since $z\perp n$); thus, we obtain $a^{\phi\left(  n\right)  }\equiv
1\operatorname{mod}n$. This proves Theorem \ref{thm.ent.euler}.
\end{proof}

Having proved Euler's theorem, we can now derive Fermat's Little Theorem from it:

\begin{proof}
[Second proof of Theorem \ref{thm.ent.fermat} (sketched).](See
\cite[\S 2.15.2, Proof of Theorem 2.15.1]{19s} for details.)

\textbf{(a)} Let $\phi\left(  p\right)  $ denote the number of all
$i\in\left\{  1,2,\ldots,p\right\}  $ satisfying $i\perp p$. Then,
$\phi\left(  p\right)  =p-1$.

[\textit{Proof.} We must show that there are precisely $p-1$ numbers
$i\in\left\{  1,2,\ldots,p\right\}  $ satisfying $i\perp p$. In other words,
we must show that exactly $p-1$ of the $p$ numbers $1,2,\ldots,p$ are coprime
to $p$. But this is easy: The $p-1$ numbers $1,2,\ldots,p-1$ are coprime to
$p$ (by Proposition \ref{prop.ent.prime.each-i-coprime}), whereas the
remaining number $p$ is not coprime to $p$ (since $\gcd\left(  p,p\right)
=p>1$). Thus, $\phi\left(  p\right)  =p-1$ is proven.]

Now, assume that $p\nmid a$. Thus, $p\perp a$ (by Proposition
\ref{prop.ent.prime.div-or-coprime}). In other words, $a\perp p$. Hence,
Theorem \ref{thm.ent.euler} (applied to $n=p$) yields $a^{\phi\left(
p\right)  }\equiv1\operatorname{mod}p$. In other words, $a^{p-1}%
\equiv1\operatorname{mod}p$ (since $\phi\left(  p\right)  =p-1$). This proves
Theorem \ref{thm.ent.fermat} \textbf{(a)}.

\textbf{(b)} We must prove that $a^{p}\equiv a\operatorname{mod}p$. In other
words, we must prove that $p\mid a^{p}-a$. In other words, we must prove that
$p\mid a\left(  a^{p-1}-1\right)  $ (since $a^{p}-a=a\left(  a^{p-1}-1\right)
$). If $p\mid a$, then this is obvious (since $p\mid a$ entails $p\mid a\mid
a\left(  a^{p-1}-1\right)  $). Hence, for the rest of this proof, we WLOG
assume that $p\nmid a$. Thus, Theorem \ref{thm.ent.fermat} \textbf{(a)} yields
$a^{p-1}\equiv1\operatorname{mod}p$. In other words, $p\mid a^{p-1}-1$. Hence,
$p\mid a^{p-1}-1\mid a\left(  a^{p-1}-1\right)  $. But as we have explained,
this completes the proof of Theorem \ref{thm.ent.fermat} \textbf{(b)}.
\end{proof}

The number $\phi\left(  n\right)  $ defined in Theorem \ref{thm.ent.euler} has
further properties; thus, let us introduce a name for it:

\begin{definition}
\label{def.ent.phi.phi}We define a function $\phi:\left\{  1,2,3,\ldots
\right\}  \rightarrow\mathbb{N}$ as follows: For each $n\in\left\{
1,2,3,\ldots\right\}  $, we let $\phi\left(  n\right)  $ be the number of all
$i\in\left\{  1,2,\ldots,n\right\}  $ that are coprime to $n$. (This is
precisely how $\phi\left(  n\right)  $ was defined in Theorem
\ref{thm.ent.euler} and in Exercise \ref{exe.ent.coprime.sum-of-coprime}.)

This function $\phi$ is called \textit{Euler's totient function} or just
$\phi$\textit{-function}.
\end{definition}

\begin{example}
\textbf{(a)} We have $\phi\left(  12\right)  =4$, since the number of all
$i\in\left\{  1,2,\ldots,12\right\}  $ that are coprime to $12$ is $4$
(indeed, these $i$ are $1$, $5$, $7$ and $11$).

\textbf{(b)} We have $\phi\left(  13\right)  =12$, since the number of all
$i\in\left\{  1,2,\ldots,13\right\}  $ that are coprime to $13$ is $12$
(indeed, these $i$ are $1,2,\ldots,12$).

\textbf{(c)} We have $\phi\left(  14\right)  =6$, since the number of all
$i\in\left\{  1,2,\ldots,14\right\}  $ that are coprime to $14$ is $6$
(indeed, these $i$ are $1,3,5,9,11,13$).

\textbf{(d)} We have $\phi\left(  1\right)  =1$, since the number of all
$i\in\left\{  1,2,\ldots,1\right\}  $ that are coprime to $1$ is $1$ (indeed,
the only such $i$ is $1$).
\end{example}

We will later come back to Euler's totient function $\phi$, to give an
\textquotedblleft explicit\textquotedblright\ formula for it (using the prime
factorization). For now, we observe that the sequence $\left(  \phi\left(
1\right)  ,\phi\left(  2\right)  ,\phi\left(  3\right)  ,\ldots\right)  $ is
\href{https://oeis.org/A000010}{Sequence A000010 in the OEIS} (where, as
usual, lots of its properties and references can be found).

\subsection{\label{sect.ent.primefac}The Fundamental Theorem of Arithmetic}

One of the leitmotifs in mathematics is the study of decompositions of objects
into smaller, simpler objects. For example, here are a few ways to decompose
the positive integer $14$ into a sum of smaller positive integers:%
\[
14=1+13=7+7=3+5+6=2+3+4+5.
\]
Almost all such decompositions can be decomposed further (\textquotedblleft
refined\textquotedblright) by breaking up some of their addends into even
smaller numbers: For example, $14=7+7$ can be \textquotedblleft
refined\textquotedblright\ by breaking up the first $7$ as $2+5$, thus
obtaining the decomposition $14=2+5+7$. The only decomposition of $14$ that
cannot be decomposed further is $14=\underbrace{1+1+\cdots+1}_{14\text{
times}}$, since $1$ cannot be written as a sum of more than one positive
integer. This phenomenon clearly holds not just for $14$, but for any other
positive integer $n$: If we decompose $n$ into a sum of positive integers,
then we can \textquotedblleft refine\textquotedblright\ this decomposition
until we arrive at $n=\underbrace{1+1+\cdots+1}_{n\text{ times}}$.

Things become more interesting if we instead try to decompose a positive
integer $n$ into a \textbf{product} of positive integers. For example, for
$n=2020$, we have the decompositions%
\[
2020=20\cdot101=4\cdot505=2\cdot2\cdot505=1\cdot2\cdot2\cdot505
\]
and many others. In particular, we can always insert a factor equal to $1$
into any such decomposition (since $1a=a$ for each $a\in\mathbb{Z}$), so we
can find infinitely many such decompositions. Thus, let us restrict ourselves
to considering only the decompositions with no factor equal to $1$. By trial
and error, we eventually find the decomposition%
\[
2020=2\cdot2\cdot5\cdot101,
\]
which cannot be \textquotedblleft refined\textquotedblright\ since the numbers
$2,2,5,101$ are prime and thus cannot be further decomposed. Recall that a
prime number is precisely an integer $p>1$ that cannot be decomposed into a
product of two integers $>1$. Thus, a decomposition of $n$ into a product of
positive integers $>1$ cannot be further decomposed if and only if all its
factors are primes. Such a decomposition (or, to be pedantic, the list of its
factors) is called a \textit{prime factorization} of $n$. Thus, for example,
the decomposition $2020=2\cdot2\cdot5\cdot101$ (or, to be pedantic, the list
$\left(  2,2,5,101\right)  $) is a prime factorization of $2020$. Likewise,
$2021=43\cdot47$ is a prime factorization of $2021$.

\begin{fineprint}
It is worth memorizing these prime factorizations if you plan on participating
in any mathematical contests in the years $2020$ and $2021$, as there is a
tradition in contests to involve the current year as a number in problems. For
example, problem B6 on the Putnam contest 2017 asked for the \# of all
$64$-tuples $\left(  x_{0},x_{1},\ldots,x_{63}\right)  $ with $x_{0}%
,x_{1},\ldots,x_{63}$ being distinct elements of the set $\left[  2017\right]
$ and satisfying $2017\mid x_{0}+x_{1}+2x_{2}+3x_{3}+\cdots+63x_{63}$. The
solution relied heavily on the fact that $2017$ is prime. Problem A3 on the
Putnam contest 2015 relied on the fact that $2015=5\cdot13\cdot31$ is a prime
factorization of $2015$. Problem B1 on the Putnam contest 2013 involved the
number $2013$, but only used the fact that it is odd. While there are many
problems in which the year number could be replaced by any positive integer,
my experience suggests that whenever some specific property of the number is
used, it is usually easy to read off that property from the prime
factorization of the number.
\end{fineprint}

Now, it is natural to ask two questions: Does any positive integer $n$ have a
prime factorization, and is it unique? It is easy to see that the answer to
the first question is \textquotedblleft yes\textquotedblright\ (essentially
because you can start with the trivial decomposition $n=n$ and then keep
\textquotedblleft refining\textquotedblright\ it until it is no longer
possible; all you need to show is that this cannot go on forever, but this can
easily be done using a monovariant). If you are pedantic, then the answer to
the second question is \textquotedblleft no\textquotedblright: For example,
the number $12$ has the three prime factorizations $2\cdot2\cdot3$,
$2\cdot3\cdot2$ and $3\cdot2\cdot2$. But these three prime factorizations only
differ in the order of their factors; they are not distinct in any useful
sense. Formally speaking, these factorizations (written as lists $\left(
2,2,3\right)  $, $\left(  2,3,2\right)  $ and $\left(  3,2,2\right)  $) are
\textit{permutations} of each other. Let us define this notion
formally:\footnote{We will use the notation from Definition
\ref{conv.enum.nots.bra-n}; thus, $\left[  k\right]  $ means the set $\left\{
1,2,\ldots,k\right\}  $.}

\begin{definition}
\label{def.ent.tuples.perm-tup}Let $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $
be a $k$-tuple. A \textit{permutation} of $\left(  p_{1},p_{2},\ldots
,p_{k}\right)  $ means a $k$-tuple of the form $\left(  p_{\sigma\left(
1\right)  },p_{\sigma\left(  2\right)  },\ldots,p_{\sigma\left(  k\right)
}\right)  $ where $\sigma$ is a permutation of the set $\left[  k\right]  $. A
permutation of $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ is also known as a
\textit{rearrangement} of $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $.
\end{definition}

Informally speaking, a permutation of a $k$-tuple $\mathbf{p}$ means a
$k$-tuple obtained from $\mathbf{p}$ by rearranging its entries. Thus, two
$k$-tuples $\mathbf{p}$ and $\mathbf{q}$ are permutations of each other if and
only if they are \textquotedblleft equal up to order\textquotedblright, i.e.,
if they differ only in the order of their entries.

\begin{example}
\label{exa.ent.tuples.perm-tup.1}\textbf{(a)} The $4$-tuple $\left(
2,1,1,3\right)  $ is a permutation of the $4$-tuple $\left(  3,1,2,1\right)
$. In fact, if we denote the $4$-tuple $\left(  3,1,2,1\right)  $ by $\left(
p_{1},p_{2},p_{3},p_{4}\right)  $, then there exists a permutation $\sigma$ of
the set $\left[  4\right]  $ such that $\left(  2,1,1,3\right)  =\left(
p_{\sigma\left(  1\right)  },p_{\sigma\left(  2\right)  },p_{\sigma\left(
3\right)  },p_{\sigma\left(  4\right)  }\right)  $. (Actually, there exist two
such permutations $\sigma$: One of them sends $1,2,3,4$ to $3,2,4,1$, while
the other sends $1,2,3,4$ to $3,4,2,1$.)

\textbf{(b)} Any $k$-tuple is a permutation of itself. Indeed, if $\left(
p_{1},p_{2},\ldots,p_{k}\right)  $ is any $k$-tuple, then $\left(  p_{1}%
,p_{2},\ldots,p_{k}\right)  =\left(  p_{\sigma\left(  1\right)  }%
,p_{\sigma\left(  2\right)  },\ldots,p_{\sigma\left(  k\right)  }\right)  $ if
we let $\sigma$ be the identity map $\operatorname*{id}:\left[  k\right]
\rightarrow\left[  k\right]  $.

\textbf{(c)} Let $\mathbf{p}$ and $\mathbf{q}$ be two $k$-tuples. Then,
$\mathbf{p}$ is a permutation of $\mathbf{q}$ if and only if $\mathbf{q}$ is a
permutation of $\mathbf{p}$. (This follows easily from the fact that the
inverse of a permutation of $\left[  k\right]  $ is again a permutation of
$\left[  k\right]  $.)
\end{example}

Next, for the sake of consistency, let us formally repeat our above definition
of a prime factorization:

\begin{definition}
\label{def.ent.prime.primefac}Let $n$ be a positive integer. A \textit{prime
factorization} of $n$ means a tuple $\left(  p_{1},p_{2},\ldots,p_{k}\right)
$ of primes such that $n=p_{1}p_{2}\cdots p_{k}$.
\end{definition}

\begin{example}
\textbf{(a)} The prime factorizations of $12$ are%
\[
\left(  2,2,3\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,3,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  3,2,2\right)  .
\]


\textbf{(b)} If $p$ is a prime, then the only prime factorization of $p$ is
the $1$-tuple $\left(  p\right)  $.

\textbf{(c)} If $p$ is a prime and $i\in\mathbb{N}$, then the only prime
factorization of $p^{i}$ is the $i$-tuple $\left(  \underbrace{p,p,\ldots
,p}_{i\text{ times}}\right)  $. Indeed, this $i$-tuple clearly is a prime
factorization of $p^{i}$; the fact that it is the only such factorization
follows readily from Theorem \ref{thm.ent.prime.fac-uni} \textbf{(b)} below.

\textbf{(d)} The only prime factorization of $1$ is the $0$-tuple $\left(
{}\right)  $.
\end{example}

We are finally ready to state and prove the so-called \textit{Fundamental
Theorem of Arithmetic}:

\begin{theorem}
\label{thm.ent.prime.fac-uni}Let $n$ be a positive integer.

\textbf{(a)} There exists a prime factorization of $n$.

\textbf{(b)} Any two prime factorizations of $n$ are permutations of each other.
\end{theorem}

We shall soon sketch a proof of this theorem; first, let us introduce a
notation (which will only be used in this section):

\begin{definition}
\label{def.ent.tuples.perm-tup.rel}Let $L$ be the set of all finite lists of
positive integers. We define a binary relation $\sim$ on $L$ as follows: Given
two lists $\mathbf{p}$ and $\mathbf{q}$ of positive integers, we set
$\mathbf{p}\sim\mathbf{q}$ if and only if the list $\mathbf{p}$ is a
permutation of $\mathbf{q}$.
\end{definition}

Thus, Example \ref{exa.ent.tuples.perm-tup.1} \textbf{(a)} yields $\left(
2,1,1,3\right)  \sim\left(  3,1,2,1\right)  $.

The following is easy to see:

\begin{proposition}
\label{prop.ent.tuples.perm-tup.basics}\textbf{(a)} The relation $\sim$
defined in Definition \ref{def.ent.tuples.perm-tup.rel} is an equivalence
relation (i.e., it is transitive, reflexive and symmetric).

\textbf{(b)} Let $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ and $\left(
b_{1},b_{2},\ldots,b_{\ell}\right)  $ be two lists of positive integers. If
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  \sim\left(  b_{1},b_{2}%
,\ldots,b_{\ell}\right)  $, then $k=\ell$.

\textbf{(c)} Let $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ and $\left(
b_{1},b_{2},\ldots,b_{\ell}\right)  $ be two lists of positive integers
satisfying $\left(  a_{1},a_{2},\ldots,a_{k}\right)  \sim\left(  b_{1}%
,b_{2},\ldots,b_{\ell}\right)  $. Then, $\left(  a_{1},a_{2},\ldots
,a_{k},c\right)  \sim\left(  b_{1},b_{2},\ldots,b_{\ell},c\right)  $ for each
positive integer $c$.
\end{proposition}

Of course, nothing in Proposition \ref{prop.ent.tuples.perm-tup.basics} is
specific to lists of positive integers; all claims here are general properties
of lists of any objects (and follow from general properties of permutations,
such as the fact that the composition of two permutations is a permutation).

We can now prove Theorem \ref{thm.ent.prime.fac-uni}:

\begin{proof}
[Proof of Theorem \ref{thm.ent.prime.fac-uni} (sketched).]\textbf{(a)} We
already outlined one way to prove Theorem \ref{thm.ent.prime.fac-uni}
\textbf{(a)} above (viz., we start with the decomposition $n=n$ and keep
\textquotedblleft refining\textquotedblright\ it by decomposing factors into
products, until this is no longer possible). Let me now show a slicker proof
(taken from \cite[proof of Proposition 2.13.10]{19s}). We proceed by strong
induction on $n$:

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that there exists a prime factorization of $n$ for each
positive integer $n<m$. We must prove that there exists a prime factorization
of $m$.

If $m=1$, then this is obvious (indeed, the $0$-tuple $\left(  {}\right)  $ is
a prime factorization of $m$ in this case, because $m=1=\left(  \text{empty
product}\right)  $). Thus, for the rest of this proof, we WLOG assume that
$m\neq1$. Hence, $m>1$. Thus, Proposition \ref{prop.ent.prime.ex-pri-div}
(applied to $n=m$) shows that there exists at least one prime $p$ such that
$p\mid m$. Consider this $p$. Now, $p>1$ (since $p$ is prime), so that
$m/p<m/1=m$. Furthermore, $m/p$ is an integer (since $p\mid m$) and positive
(since $m>1>0$ and $p>1>0$). Thus, $m/p$ is a positive integer satisfying
$m/p<m$. Hence, our induction hypothesis yields that there exists a prime
factorization of $m/p$. Let $\left(  q_{1},q_{2},\ldots,q_{k}\right)  $ be
this prime factorization. Thus, $q_{1},q_{2},\ldots,q_{k}$ are primes
satisfying $m/p=q_{1}q_{2}\cdots q_{k}$. Multiplying both sides of the latter
equality by $p$, we obtain $m=pq_{1}q_{2}\cdots q_{k}$. Hence, $\left(
p,q_{1},q_{2},\ldots,q_{k}\right)  $ is a prime factorization of $m$ (since
$p$ is a prime, and since $q_{1},q_{2},\ldots,q_{k}$ are primes). Thus, there
exists a prime factorization of $m$. This completes the induction step; thus,
Theorem \ref{thm.ent.prime.fac-uni} \textbf{(a)} is proved.

\textbf{(b)} We proceed by strong induction on $n$:

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Theorem \ref{thm.ent.prime.fac-uni} \textbf{(b)}
holds for each positive integer $n<m$. We must prove that Theorem
\ref{thm.ent.prime.fac-uni} \textbf{(b)} holds for $n=m$.

Let $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ and $\left(  q_{1}%
,q_{2},\ldots,q_{\ell}\right)  $ be two prime factorizations of $m$. We shall
show that $\left(  p_{1},p_{2},\ldots,p_{k}\right)  \sim\left(  q_{1}%
,q_{2},\ldots,q_{\ell}\right)  $ (using the notation of Definition
\ref{def.ent.tuples.perm-tup.rel}).

The two lists $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ and $\left(
q_{1},q_{2},\ldots,q_{\ell}\right)  $ are playing symmetric roles in this
claim (since the relation $\sim$ is symmetric). Hence, we can WLOG assume that
$k\leq\ell$ (since we can otherwise swap these two lists). Assume this.

We must prove that $\left(  p_{1},p_{2},\ldots,p_{k}\right)  \sim\left(
q_{1},q_{2},\ldots,q_{\ell}\right)  $. If $\ell=0$, then this is obviously
true\footnote{\textit{Proof.} Assume that $\ell=0$. Then, $\left(  q_{1}%
,q_{2},\ldots,q_{\ell}\right)  =\left(  q_{1},q_{2},\ldots,q_{0}\right)
=\left(  {}\right)  $. Also, $k\leq\ell=0$ and thus $k=0$. Hence, $\left(
p_{1},p_{2},\ldots,p_{k}\right)  =\left(  p_{1},p_{2},\ldots,p_{0}\right)
=\left(  {}\right)  $. But obviously, $\left(  {}\right)  \sim\left(
{}\right)  $. In other words, $\left(  p_{1},p_{2},\ldots,p_{k}\right)
\sim\left(  q_{1},q_{2},\ldots,q_{\ell}\right)  $ (since $\left(  p_{1}%
,p_{2},\ldots,p_{k}\right)  =\left(  {}\right)  $ and $\left(  q_{1}%
,q_{2},\ldots,q_{\ell}\right)  =\left(  {}\right)  $). Hence, we have proved
that $\left(  p_{1},p_{2},\ldots,p_{k}\right)  \sim\left(  q_{1},q_{2}%
,\ldots,q_{\ell}\right)  $ under the assumption that $\ell=0$.}. Hence, for
the rest of this proof, we WLOG assume that $\ell\neq0$. Therefore, $\ell$ is
a positive integer. Thus, $q_{\ell}$ is well-defined.

We know that $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ is a prime
factorization of $m$. In other words, $\left(  p_{1},p_{2},\ldots
,p_{k}\right)  $ is a $k$-tuple of primes such that $p_{1}p_{2}\cdots p_{k}%
=m$. In other words, $p_{1},p_{2},\ldots,p_{k}$ are primes and satisfy
$p_{1}p_{2}\cdots p_{k}=m$. Similarly, $q_{1},q_{2},\ldots,q_{\ell}$ are
primes and satisfy $q_{1}q_{2}\cdots q_{\ell}=m$.

The number $q_{\ell}$ is a prime (since $q_{1},q_{2},\ldots,q_{\ell}$ are
primes). Thus, $q_{\ell}>1$, so that $q_{\ell}\neq1$. Moreover, $q_{\ell}$ is
a factor of the product $q_{1}q_{2}\cdots q_{\ell}$. Thus, $q_{\ell}\mid
q_{1}q_{2}\cdots q_{\ell}=m=p_{1}p_{2}\cdots p_{k}$ (since $p_{1}p_{2}\cdots
p_{k}=m$). Hence, Proposition \ref{prop.ent.prime.pabk} (applied to
$p=q_{\ell}$ and $a_{i}=p_{i}$) yields that $q_{\ell}\mid p_{i}$ for some
$i\in\left\{  1,2,\ldots,k\right\}  $. Consider this $i$. It is easy to see
that $q_{\ell}=p_{i}$\ \ \ \ \footnote{\textit{Proof.} We know that $q_{\ell}$
is positive (since $q_{\ell}>1>0$) and divides $p_{i}$ (since $q_{\ell}\mid
p_{i}$). Hence, $q_{\ell}$ is a positive divisor of $p_{i}$.
\par
The number $p_{i}$ is a prime (since $p_{1},p_{2},\ldots,p_{k}$ are primes).
Hence, the only positive divisors of $p_{i}$ are $1$ and $p_{i}$ (by the
definition of a prime). Thus, $q_{\ell}$ must be either $1$ or $p_{i}$ (since
$q_{\ell}$ is a positive divisor of $p_{i}$). Since we know that $q_{\ell}%
\neq1$, we thus conclude that $q_{\ell}=p_{i}$.}.

Now, consider the $k$-tuple $\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1}%
,p_{i+2},\ldots,p_{k},p_{i}\right)  $ (that is, the $k$-tuple obtained from
$\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ by moving the $i$-th entry to the
very end). This $k$-tuple is a permutation of the $k$-tuple $\left(
p_{1},p_{2},\ldots,p_{k}\right)  $ (since it is obtained by rearranging
entries of the latter $k$-tuple). In other words,%
\[
\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k},p_{i}\right)
\sim\left(  p_{1},p_{2},\ldots,p_{k}\right)  .
\]
Since the relation $\sim$ is symmetric, this entails%
\begin{equation}
\left(  p_{1},p_{2},\ldots,p_{k}\right)  \sim\left(  p_{1},p_{2}%
,\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k},p_{i}\right)  .
\label{pf.thm.ent.prime.fac-uni.b.3}%
\end{equation}


On the other hand, $m/q_{\ell}$ is an integer (since $q_{\ell}\mid m$) and is
positive (since $m$ and $q_{\ell}$ are positive) and satisfies
$m/\underbrace{q_{\ell}}_{>1}<m/1=m$. Thus, our induction hypothesis shows
that Theorem \ref{thm.ent.prime.fac-uni} \textbf{(b)} holds for $n=m/q_{\ell}%
$. In other words, any two prime factorizations of $m/q_{\ell}$ are
permutations of each other.

Let us now find two such prime factorizations to apply this fact to. We notice
the following:

\begin{itemize}
\item The $\left(  k-1\right)  $-tuple $\left(  p_{1},p_{2},\ldots
,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k}\right)  $ (that is, the $\left(
k-1\right)  $-tuple obtained from $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $
by removing the $i$-th entry) is a $\left(  k-1\right)  $-tuple of primes
(since $p_{1},p_{2},\ldots,p_{k}$ are primes) and satisfies
\[
p_{1}p_{2}\cdots p_{i-1}p_{i+1}p_{i+2}\cdots p_{k}=m/q_{\ell}%
\]
(since
\begin{align*}
m  &  =p_{1}p_{2}\cdots p_{k}=\underbrace{p_{i}}_{=q_{\ell}}\left(  p_{1}%
p_{2}\cdots p_{i-1}p_{i+1}p_{i+2}\cdots p_{k}\right) \\
&  =q_{\ell}\left(  p_{1}p_{2}\cdots p_{i-1}p_{i+1}p_{i+2}\cdots p_{k}\right)
\end{align*}
). In other words, this $\left(  k-1\right)  $-tuple $\left(  p_{1}%
,p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k}\right)  $ is a prime
factorization of $m/q_{\ell}$.

\item The $\left(  \ell-1\right)  $-tuple $\left(  q_{1},q_{2},\ldots
,q_{\ell-1}\right)  $ is an $\left(  \ell-1\right)  $-tuple of primes (since
$q_{1},q_{2},\ldots,q_{\ell}$ are primes) and satisfies%
\[
q_{1}q_{2}\cdots q_{\ell-1}=m/q_{\ell}%
\]
(since $m=q_{1}q_{2}\cdots q_{\ell}=q_{\ell}\left(  q_{1}q_{2}\cdots
q_{\ell-1}\right)  $). In other words, this $\left(  \ell-1\right)  $-tuple
$\left(  q_{1},q_{2},\ldots,q_{\ell-1}\right)  $ is a prime factorization of
$m/q_{\ell}$.
\end{itemize}

\noindent Thus, we have found two prime factorizations of $m/q_{\ell}$:
namely,%
\[
\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k}\right)
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left(  q_{1},q_{2}%
,\ldots,q_{\ell-1}\right)  .
\]
Hence, we conclude that these two prime factorizations must be permutations of
each other (since any two prime factorizations of $m/q_{\ell}$ are
permutations of each other). In other words,%
\[
\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k}\right)
\sim\left(  q_{1},q_{2},\ldots,q_{\ell-1}\right)  .
\]
Hence, Proposition \ref{prop.ent.tuples.perm-tup.basics} \textbf{(c)} (applied
to $\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k}\right)  $,
$\left(  q_{1},q_{2},\ldots,q_{\ell-1}\right)  $ and $p_{i}$ instead of
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  $, $\left(  b_{1},b_{2}%
,\ldots,b_{\ell}\right)  $ and $c$) yields that
\[
\left(  p_{1},p_{2},\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k},p_{i}\right)
\sim\left(  q_{1},q_{2},\ldots,q_{\ell-1},p_{i}\right)  .
\]


Now, (\ref{pf.thm.ent.prime.fac-uni.b.3}) becomes\footnote{The following
manipulations tacitly use the fact that the relation $\sim$ is an equivalence
relation.}%
\begin{align*}
\left(  p_{1},p_{2},\ldots,p_{k}\right)   &  \sim\left(  p_{1},p_{2}%
,\ldots,p_{i-1},p_{i+1},p_{i+2},\ldots,p_{k},p_{i}\right) \\
&  \sim\left(  q_{1},q_{2},\ldots,q_{\ell-1},p_{i}\right) \\
&  =\left(  q_{1},q_{2},\ldots,q_{\ell-1},q_{\ell}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }p_{i}=q_{\ell}\right) \\
&  =\left(  q_{1},q_{2},\ldots,q_{\ell}\right)  .
\end{align*}
In other words, the two prime factorizations $\left(  p_{1},p_{2},\ldots
,p_{k}\right)  $ and $\left(  q_{1},q_{2},\ldots,q_{\ell}\right)  $ are
permutations of each other.

Forget that we fixed $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ and $\left(
q_{1},q_{2},\ldots,q_{\ell}\right)  $. We thus have shown that any two prime
factorizations $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ and $\left(
q_{1},q_{2},\ldots,q_{\ell}\right)  $ of $m$ are permutations of each other.
In other words, Theorem \ref{thm.ent.prime.fac-uni} \textbf{(b)} holds for
$n=m$. This completes the induction proof of Theorem
\ref{thm.ent.prime.fac-uni} \textbf{(b)}.
\end{proof}

In Section \ref{sect.ent.pval}, we will introduce $p$-valuations, which will
allow us to get real mileage out of Theorem \ref{thm.ent.prime.fac-uni}. For
now, let us show a simple application of Theorem \ref{thm.ent.prime.fac-uni}
\textbf{(a)}:

\begin{exercise}
\label{exe.ent.prime.dirichlet.easy2}Prove that there are infinitely many
primes $p$ that satisfy $p\equiv2\operatorname{mod}3$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.dirichlet.easy2} (sketched).]The
following solution is rather similar to our first proof of Theorem
\ref{thm.ent.primes.infin} above, but is somewhat complicated by the need to
keep track of the $p\equiv2\operatorname{mod}3$ condition.

We define a $2\operatorname{mod}3$\textit{-prime} to mean a prime $p$ that
satisfies $p\equiv2\operatorname{mod}3$. Thus, we need to show that there are
infinitely many $2\operatorname{mod}3$-primes.

Let $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ be any finite list of
$2\operatorname{mod}3$-primes. We shall find a new $2\operatorname{mod}%
3$-prime $p$ that is distinct from $p_{1},p_{2},\ldots,p_{k}$.

Indeed, set $n=3p_{1}p_{2}\cdots p_{k}-1$. It is easy to see that $n>0$.
Hence, Theorem \ref{thm.ent.prime.fac-uni} \textbf{(a)} shows that there
exists a prime factorization of $n$. Let $\left(  q_{1},q_{2},\ldots,q_{\ell
}\right)  $ be this prime factorization. Thus, $\left(  q_{1},q_{2}%
,\ldots,q_{\ell}\right)  $ is an $\ell$-tuple of primes such that
$n=q_{1}q_{2}\cdots q_{\ell}$. In other words, $q_{1},q_{2},\ldots,q_{\ell}$
are primes and satisfy $n=q_{1}q_{2}\cdots q_{\ell}$.

We now claim that at least one of the primes $q_{1},q_{2},\ldots,q_{\ell}$
must be a $2\operatorname{mod}3$-prime.

[\textit{Proof:} Assume the contrary. Thus, none of the primes $q_{1}%
,q_{2},\ldots,q_{\ell}$ is a $2\operatorname{mod}3$-prime.

Note that $n=\underbrace{3p_{1}p_{2}\cdots p_{k}}_{\equiv0\operatorname{mod}%
3}-1\equiv0-1=-1\equiv2\operatorname{mod}3$. Hence, $n\equiv2\not \equiv
0\operatorname{mod}3$, so that $3\nmid n$.

Let $i\in\left\{  1,2,\ldots,\ell\right\}  $. Then, $q_{i}$ is not a
$2\operatorname{mod}3$-prime (since none of the primes $q_{1},q_{2}%
,\ldots,q_{\ell}$ is a $2\operatorname{mod}3$-prime). In other words,
$q_{i}\not \equiv 2\operatorname{mod}3$ (since $q_{i}$ is a prime). Moreover,
$q_{i}\mid n$ (since $n=q_{1}q_{2}\cdots q_{\ell}$) and thus $q_{i}%
\not \equiv 0\operatorname{mod}3$ (because if we had $q_{i}\equiv
0\operatorname{mod}3$, then we would have $3\mid q_{i}\mid n$, which would
contradict $3\nmid n$).

However, the remainder $q_{i}\%3$ is either $0$, $1$ or $2$ (since
$q_{i}\%3\in\left\{  0,1,2\right\}  $). Thus, $q_{i}$ must be congruent to one
of the three numbers $0$, $1$ and $2$ modulo $3$ (by Proposition
\ref{prop.ent.quo-rem.mod=rem}, because $0\%3=0$ and $1\%3=1$ and $2\%3=2$).
In other words, we have $q_{i}\equiv0\operatorname{mod}3$ or $q_{i}%
\equiv1\operatorname{mod}3$ or $q_{i}\equiv2\operatorname{mod}3$. Since we
know that $q_{i}\not \equiv 0\operatorname{mod}3$ and $q_{i}\not \equiv
2\operatorname{mod}3$, we thus conclude that $q_{i}\equiv1\operatorname{mod}3$.

Now, forget that we fixed $i$. We thus have shown that $q_{i}\equiv
1\operatorname{mod}3$ for each $i\in\left\{  1,2,\ldots,\ell\right\}  $.
Hence, $\prod_{i=1}^{\ell}\underbrace{q_{i}}_{\equiv1\operatorname{mod}%
3}\equiv\prod_{i=1}^{\ell}1=1\operatorname{mod}3$. Therefore, $n=q_{1}%
q_{2}\cdots q_{\ell}=\prod_{i=1}^{\ell}q_{i}\equiv1\operatorname{mod}3$. This
contradicts $n\equiv2\not \equiv 1\operatorname{mod}3$. This contradiction
shows that our assumption was false. Hence, at least one of the primes
$q_{1},q_{2},\ldots,q_{\ell}$ must be a $2\operatorname{mod}3$-prime.]

Now we have shown that at least one of the primes $q_{1},q_{2},\ldots,q_{\ell
}$ must be a $2\operatorname{mod}3$-prime. In other words, there exists some
$j\in\left\{  1,2,\ldots,\ell\right\}  $ such that $q_{j}$ is a
$2\operatorname{mod}3$-prime. Consider this $j$. Clearly, $q_{j}\mid n$ (since
$n=q_{1}q_{2}\cdots q_{\ell}$).

Set $p=q_{j}$. Thus, $p$ is a $2\operatorname{mod}3$-prime (since $q_{j}$ is a
$2\operatorname{mod}3$-prime) and satisfies $p=q_{j}\mid n$.

For each $i\in\left\{  1,2,\ldots,k\right\}  $, we have $p_{i}\nmid-1$ (since
$p_{i}$ is a prime, so that $p_{i}>1$) and thus%
\[
n=3\underbrace{p_{1}p_{2}\cdots p_{k}}_{\substack{\equiv0\operatorname{mod}%
p_{i}\\\text{(since }p_{i}\mid p_{1}p_{2}\cdots p_{k}\text{)}}}-1\equiv
0-1=-1\not \equiv 0\operatorname{mod}p_{i}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }p_{i}\nmid-1=\left(  -1\right)  -0\right)  .
\]
In other words, for each $i\in\left\{  1,2,\ldots,k\right\}  $, we have
$p_{i}\nmid n$ and thus $p\neq p_{i}$ (since $p=p_{i}$ would yield
$p=p_{i}\nmid n$, which would contradict $p\mid n$). In other words, $p$ is
distinct from $p_{1},p_{2},\ldots,p_{k}$.

Forget that we fixed $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $. Thus, for
any finite list $\left(  p_{1},p_{2},\ldots,p_{k}\right)  $ of
$2\operatorname{mod}3$-primes, we have found a new $2\operatorname{mod}%
3$-prime $p$ that is distinct from $p_{1},p_{2},\ldots,p_{k}$. In other words,
for any finite list of $2\operatorname{mod}3$-primes, we have found a
$2\operatorname{mod}3$-prime that is not in this list. Thus, there are
infinitely many $2\operatorname{mod}3$-primes. This solves Exercise
\ref{exe.ent.prime.dirichlet.easy2}.
\end{proof}

\subsection{\label{sect.ent.pval}$p$-valuations}

\subsubsection{The $p$-valuation of an integer}

The prime factorization of a positive integer $n$ provides an easy way to tell
how often $n$ can be divided by $p$ without remainder (i.e., how high a power
of $p$ divides $n$): namely, as often as $p$ appears in this prime
factorization. This number is commonly known as the $p$\textit{-valuation} of
$n$. Let us define it in slightly greater generality (for any integer $n$, not
just positive integers) and in more detail (\cite[Definition 2.13.23]{19s}):

\begin{definition}
\label{def.ent.prime.vp}Let $p$ be a prime.

\textbf{(a)} Let $n$ be a nonzero integer. Then, $v_{p}\left(  n\right)  $
shall denote the largest $m\in\mathbb{N}$ such that $p^{m}\mid n$. This is
well-defined (see \cite[Lemma 2.13.22]{19s} for a detailed proof). This
nonnegative integer $v_{p}\left(  n\right)  $ will be called the
$p$\textit{-valuation} (or the $p$\textit{-adic valuation}) of $n$.

\textbf{(b)} We extend this definition of $v_{p}\left(  n\right)  $ to the
case of $n=0$ as follows: Set $v_{p}\left(  0\right)  =\infty$, where $\infty$
is a new symbol. This symbol $\infty$ is supposed to model the concept of
\textquotedblleft positive infinity\textquotedblright; in particular, we
extend some of the standard arithmetic operations to $\infty$ according to the
following rules:

\begin{itemize}
\item We set $k+\infty=\infty+k=\infty$ for all integers $k$.

\item We set $\infty+\infty=\infty$.

\item For each integer $k$, we declare the inequalities $k<\infty$ and
$\infty>k$ and $k\leq\infty$ and $\infty\geq k$ to be true, and the
inequalities $k\geq\infty$ and $\infty\leq k$ and $k>\infty$ and $\infty<k$ to
be false.

\item If $S$ is a nonempty set of integers, then we set $\min\left(
S\cup\left\{  \infty\right\}  \right)  =\min S$ (provided that $\min S$ exists).

\item We set $\min\left\{  \infty\right\}  =\infty$.

\item If $S$ is any set of integers, then we set $\max\left(  S\cup\left\{
\infty\right\}  \right)  =\infty$.
\end{itemize}

(This being said, $\infty$ is not supposed to be a \textquotedblleft first
class citizen\textquotedblright\ of the number system. In particular,
differences of the form $k-\infty$ are not defined, since any definition of
$k-\infty$ would break some of the familiar rules of arithmetic. The only
operations that we shall subject $\infty$ to are addition, minimum and maximum.)
\end{definition}

Note that the rules for the symbol $\infty$ yield that%
\[
k+\infty=\infty+k=\max\left\{  k,\infty\right\}  =\infty
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \min\left\{  k,\infty
\right\}  =k
\]
for each $k\in\mathbb{Z}\cup\left\{  \infty\right\}  $. It is not hard to see
that basic properties of inequalities (such as \textquotedblleft if $a\leq b$
and $b\leq c$, then $a\leq c$\textquotedblright) and of addition (such as
\textquotedblleft$\left(  a+b\right)  +c=a+\left(  b+c\right)  $%
\textquotedblright) and of the interaction between inequalities and addition
(such as \textquotedblleft if $a\leq b$, then $a+c\leq b+c$\textquotedblright)
are still valid in $\mathbb{Z}\cup\left\{  \infty\right\}  $ (that is, they
still hold if we plug $\infty$ for one or more of the variables).\footnote{For
algebraists: The set $\mathbb{Z}\cup\left\{  \infty\right\}  $ equipped with
the operations $\max$ and $+$ as \textquotedblleft addition\textquotedblright%
\ and \textquotedblleft multiplication\textquotedblright\ and with the
relation $\leq$ is a totally ordered commutative semiring. The same is true if
$\max$ is replaced by $\min$. These two semirings are known as the
\textit{\href{https://en.wikipedia.org/wiki/Tropical_semiring}{\textit{tropical
semirings}}} over $\mathbb{Z}$. See \cite{SpeStu09} for more about them.}
However, of course, we cannot \textquotedblleft cancel\textquotedblright%
\ $\infty$ from equalities (i.e., we cannot cancel $\infty$ from
$a+\infty=b+\infty$ to obtain $a=b$) or inequalities.

\begin{example}
\label{exa.ent.prime.vp}\textbf{(a)} We have $v_{3}\left(  18\right)  =2$.
Indeed, $2$ is the largest $m\in\mathbb{N}$ such that $3^{m}\mid18$ (because
$3^{2}=9\mid18$ but $3^{3}=27\nmid18$).

\textbf{(b)} We have $v_{3}\left(  14\right)  =0$. Indeed, $0$ is the largest
$m\in\mathbb{N}$ such that $3^{m}\mid14$ (because $3^{0}=1\mid14$ but
$3^{1}=3\nmid14$).

\textbf{(c)} We have $v_{3}\left(  51\right)  =1$. Indeed, $1$ is the largest
$m\in\mathbb{N}$ such that $3^{m}\mid51$ (because $3^{1}=3\mid51$ but
$3^{2}=9\nmid51$).

\textbf{(d)} We have $v_{3}\left(  0\right)  =\infty$ (by Definition
\ref{def.ent.prime.vp} \textbf{(b)}).
\end{example}

Definition \ref{def.ent.prime.vp} \textbf{(a)} can be restated in the
following more intuitive way: Given a prime $p$ and a nonzero integer $n$, we
let $v_{p}\left(  n\right)  $ be the number of times we can divide $n$ by $p$
without leaving $\mathbb{Z}$. Definition \ref{def.ent.prime.vp} \textbf{(b)}
is consistent with this restatement, because we can clearly divide $0$ by $p$
infinitely often without leaving $\mathbb{Z}$. From this point of view, the
following lemma should be obvious:

\begin{lemma}
\label{lem.ent.prime.vp-def}Let $p$ be a prime. Let $i\in\mathbb{N}$. Let
$n\in\mathbb{Z}$. Then, $p^{i}\mid n$ if and only if $v_{p}\left(  n\right)
\geq i$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.vp-def} (sketched).](See \cite[Lemma
2.13.25]{19s} for a detailed proof.) In the $n=0$ case, we have both
$p^{i}\mid n$ and $v_{p}\left(  n\right)  \geq i$ (since $v_{p}\left(
n\right)  =v_{p}\left(  0\right)  =\infty\geq i$). Thus, WLOG assume that
$n\neq0$. Hence, $v_{p}\left(  n\right)  $ is defined as the largest
$m\in\mathbb{N}$ such that $p^{m}\mid n$. Therefore, $p^{v_{p}\left(
n\right)  }\mid n$ holds, but $p^{v_{p}\left(  n\right)  +1}\mid n$ does not.
From this, it is easy to see that $p^{i}\mid n$ holds if $v_{p}\left(
n\right)  \geq i$, but not if $v_{p}\left(  n\right)  <i$. But this is
precisely the claim of Lemma \ref{lem.ent.prime.vp-def}.
\end{proof}

\begin{corollary}
\label{cor.ent.prime.vp-0}Let $p$ be a prime. Let $n\in\mathbb{Z}$. Then,
$v_{p}\left(  n\right)  =0$ if and only if $p\nmid n$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.prime.vp-0} (sketched).](See \cite[Corollary
2.13.26]{19s} for a detailed proof.) Lemma \ref{lem.ent.prime.vp-def} (applied
to $i=0$) shows that $p\mid n$ if and only if $v_{p}\left(  n\right)  \geq1$.
In other words, $p\mid n$ if and only if $v_{p}\left(  n\right)  \neq0$ (since
$v_{p}\left(  n\right)  \geq1$ is equivalent to $v_{p}\left(  n\right)  \neq
0$). Taking the contrapositive of this claim, we obtain precisely Corollary
\ref{cor.ent.prime.vp-0}.
\end{proof}

Using the $p$-valuation, we can decompose a nonzero integer into the product
of a power of $p$ and an integer coprime to $p$:

\begin{lemma}
\label{lem.ent.prime.vp-copr}Let $p$ be a prime. Let $n\in\mathbb{Z}$ be
nonzero. Then:

\textbf{(a)} There exists a nonzero integer $u$ such that $u\perp p$ and
$n=up^{v_{p}\left(  n\right)  }$.

\textbf{(b)} If $i\in\mathbb{N}$ and $w\in\mathbb{Z}$ are such that $w\perp p$
and $n=wp^{i}$, then $v_{p}\left(  n\right)  =i$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.vp-copr} (sketched).](See \cite[Lemma
2.13.27]{19s} for a detailed proof.) The definition of $v_{p}\left(  n\right)
$ yields $v_{p}\left(  n\right)  \in\mathbb{N}$ and $p^{v_{p}\left(  n\right)
}\mid n$ and $p^{v_{p}\left(  n\right)  +1}\nmid n$.

\textbf{(a)} Set $u=n/p^{v_{p}\left(  n\right)  }$; thus, $u$ is nonzero
(since $n$ is nonzero) and satisfies $n=up^{v_{p}\left(  n\right)  }$. It
remains to show that $u\perp p$. But we have $pp^{v_{p}\left(  n\right)
}=p^{v_{p}\left(  n\right)  +1}\nmid n=up^{v_{p}\left(  n\right)  }$.
Cancelling the (nonzero) factor $p^{v_{p}\left(  n\right)  }$ from this
non-divisibility, we find $p\nmid u$, and thus $p\perp u$ (by Proposition
\ref{prop.ent.prime.div-or-coprime}, applied to $a=u$). In other words,
$u\perp p$. This proves Lemma \ref{lem.ent.prime.vp-copr} \textbf{(a)}.

\textbf{(b)} Let $i\in\mathbb{N}$ and $w\in\mathbb{Z}$ be such that $w\perp p$
and $n=wp^{i}$. We must prove that $v_{p}\left(  n\right)  =i$.

Assume the contrary. Thus, $v_{p}\left(  n\right)  \neq i$. But $p^{i}\mid n$
(since $n=wp^{i}$) and thus $v_{p}\left(  n\right)  \geq i$ (by Lemma
\ref{lem.ent.prime.vp-def}). Hence, $v_{p}\left(  n\right)  >i$ (since
$v_{p}\left(  n\right)  \neq i$) and therefore $v_{p}\left(  n\right)  \geq
i+1$. Equivalently, we have $p^{i+1}\mid n$ (by Lemma
\ref{lem.ent.prime.vp-def}, applied to $i+1$ instead of $i$). In other words,
$pp^{i}\mid wp^{i}$ (since $p^{i+1}=pp^{i}$ and $n=wp^{i}$). Cancelling the
(nonzero) factor $p^{i}$ from this divisibility, we find $p\mid w$. Hence,
$\gcd\left(  p,w\right)  =\left\vert p\right\vert =p>1$. On the other hand,
$\gcd\left(  p,w\right)  =\gcd\left(  w,p\right)  =1$ (since $w\perp p$).
These two facts clearly contradict each other.

This contradiction shows that our assumption was false. Hence, $v_{p}\left(
n\right)  =i$ must hold. This proves Lemma \ref{lem.ent.prime.vp-copr}
\textbf{(b)}.
\end{proof}

The next theorem is crucial for computing and bounding $p$-valuations:

\begin{theorem}
\label{thm.ent.prime.vp-ring}Let $p$ be a prime.

\textbf{(a)} We have $v_{p}\left(  ab\right)  =v_{p}\left(  a\right)
+v_{p}\left(  b\right)  $ for any two integers $a$ and $b$.

\textbf{(b)} We have $v_{p}\left(  a+b\right)  \geq\min\left\{  v_{p}\left(
a\right)  ,v_{p}\left(  b\right)  \right\}  $ for any two integers $a$ and $b$.

\textbf{(c)} We have $v_{p}\left(  1\right)  =0$.

\textbf{(d)} We have $v_{p}\left(  q\right)  =%
\begin{cases}
1, & \text{if }q=p;\\
0, & \text{if }q\neq p
\end{cases}
$ for any prime $q$.
\end{theorem}

Note that Theorem \ref{thm.ent.prime.vp-ring} \textbf{(a)} determines
$v_{p}\left(  ab\right)  $ exactly (in terms of $v_{p}\left(  a\right)  $ and
$v_{p}\left(  b\right)  $), but Theorem \ref{thm.ent.prime.vp-ring}
\textbf{(b)} merely gives a lower bound on $v_{p}\left(  a+b\right)  $. There
is no way to improve on this, since $v_{p}\left(  a\right)  $ and
$v_{p}\left(  b\right)  $ do not uniquely determine $v_{p}\left(  a+b\right)
$.

\begin{proof}
[Proof of Theorem \ref{thm.ent.prime.vp-ring} (sketched).](See \cite[Theorem
2.13.28]{19s} for a more detailed proof.)

\textbf{(a)} Let $a$ and $b$ be two integers. We must prove that $v_{p}\left(
ab\right)  =v_{p}\left(  a\right)  +v_{p}\left(  b\right)  $.

If $a=0$, then this boils down to $\infty=\infty$, which is obvious. Thus, we
WLOG assume that $a\neq0$. Likewise, we WLOG assume that $b\neq0$. Hence,
$ab\neq0$.

Lemma \ref{lem.ent.prime.vp-copr} \textbf{(a)} (applied to $n=a$) shows that
there exists a nonzero integer $x$ such that $x\perp p$ and $a=xp^{v_{p}%
\left(  a\right)  }$. Likewise, there exists a nonzero integer $y$ such that
$y\perp p$ and $b=yp^{v_{p}\left(  b\right)  }$. Consider these $x$ and $y$.
From $x\perp p$ and $y\perp p$, we obtain $xy\perp p$ (by Theorem
\ref{thm.ent.coprime.ab-to-c}). Furthermore, multiplying the equalities
$a=xp^{v_{p}\left(  a\right)  }$ and $b=yp^{v_{p}\left(  b\right)  }$, we
obtain%
\[
ab=\left(  xp^{v_{p}\left(  a\right)  }\right)  \left(  yp^{v_{p}\left(
b\right)  }\right)  =\left(  xy\right)  p^{v_{p}\left(  a\right)
+v_{p}\left(  b\right)  }.
\]
Thus, Lemma \ref{lem.ent.prime.vp-copr} \textbf{(b)} (applied to $n=ab$,
$i=v_{p}\left(  a\right)  +v_{p}\left(  b\right)  $ and $w=xy$) shows that
$v_{p}\left(  ab\right)  =v_{p}\left(  a\right)  +v_{p}\left(  b\right)  $.
This proves Theorem \ref{thm.ent.prime.vp-ring} \textbf{(a)}.

\textbf{(b)} Let $a$ and $b$ be two integers. We must prove that $v_{p}\left(
a+b\right)  \geq\min\left\{  v_{p}\left(  a\right)  ,v_{p}\left(  b\right)
\right\}  $.

We WLOG assume that $a\neq0$ and $b\neq0$ (as the other cases are easy). Thus,
$v_{p}\left(  a\right)  \in\mathbb{N}$ and $v_{p}\left(  b\right)
\in\mathbb{N}$.

Let $m=\min\left\{  v_{p}\left(  a\right)  ,v_{p}\left(  b\right)  \right\}
$. Thus, $m\in\mathbb{N}$ and $v_{p}\left(  a\right)  \geq m$. Hence, Lemma
\ref{lem.ent.prime.vp-def} (applied to $n=a$ and $i=m$) yields $p^{m}\mid a$.
In other words, $a\equiv0\operatorname{mod}p^{m}$. Similarly, $b\equiv
0\operatorname{mod}p^{m}$. Adding these two congruences together, we obtain
$a+b\equiv0+0=0\operatorname{mod}p^{m}$. In other words, $p^{m}\mid a+b$.
This, in turn, leads to $v_{p}\left(  a+b\right)  \geq m$ (by Lemma
\ref{lem.ent.prime.vp-def}, applied to $n=a+b$ and $i=m$). That is,
$v_{p}\left(  a+b\right)  \geq m=\min\left\{  v_{p}\left(  a\right)
,v_{p}\left(  b\right)  \right\}  $. This proves Theorem
\ref{thm.ent.prime.vp-ring} \textbf{(b)}.

\textbf{(c)} This follows from Lemma \ref{cor.ent.prime.vp-0} (applied to
$n=1$), since $p\nmid1$ (because $\left\vert p\right\vert =p>1=\left\vert
1\right\vert $).

\textbf{(d)} Let $q$ be a prime. We must prove that $v_{p}\left(  q\right)  =%
\begin{cases}
1, & \text{if }q=p;\\
0, & \text{if }q\neq p.
\end{cases}
$

This requires us to prove two things: First, we must show that $v_{p}\left(
p\right)  =1$; second, we must show that $v_{p}\left(  q\right)  =0$ if $q\neq
p$.

Let us prove $v_{p}\left(  p\right)  =1$ first. Indeed, $1\perp p$ (by
Exercise \ref{exe.ent.coprime.01} \textbf{(a)}) and $p=1\cdot p^{1}$. Thus,
Lemma \ref{lem.ent.prime.vp-copr} \textbf{(b)} (applied to $n=p$, $i=1$ and
$w=1$) yields $v_{p}\left(  p\right)  =1$.

It remains to show that $v_{p}\left(  q\right)  =0$ if $q\neq p$. Thus, let us
assume that $q\neq p$. Hence, Proposition \ref{prop.ent.prime.dist=cop}
(applied to $q$ and $p$ instead of $p$ and $q$) yields $q\perp p$. Also,
$q=q\cdot p^{0}$ (since $p^{0}=1$). Therefore, Lemma
\ref{lem.ent.prime.vp-copr} \textbf{(b)} (applied to $n=q$, $i=0$ and $w=q$)
yields $v_{p}\left(  q\right)  =0$. This completes our proof of Theorem
\ref{thm.ent.prime.vp-ring} \textbf{(d)}.
\end{proof}

\begin{corollary}
\label{cor.ent.prime.vp-ringk}Let $p$ be a prime. Let $a_{1},a_{2}%
,\ldots,a_{k}$ be $k$ integers. Then, $v_{p}\left(  a_{1}a_{2}\cdots
a_{k}\right)  =v_{p}\left(  a_{1}\right)  +v_{p}\left(  a_{2}\right)
+\cdots+v_{p}\left(  a_{k}\right)  $.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.prime.vp-ringk} (sketched).](See
\cite[Corollary 2.13.29]{19s} for details.) This follows straightforwardly by
induction on $k$, using Theorem \ref{thm.ent.prime.vp-ring} \textbf{(a)} (as
well as Theorem \ref{thm.ent.prime.vp-ring} \textbf{(c)} for the induction base).
\end{proof}

The following simple properties of $p$-valuations are left to the reader to
prove:\footnote{Proposition \ref{prop.ent.prime.vp-abs} is \cite[Exercise
2.13.5]{19s}. Corollary \ref{cor.ent.prime.vp-pow} is \cite[Exercise
2.13.6]{19s}. Corollary \ref{cor.ent.prime.p1a1puau} is \cite[Exercise
2.13.7]{19s}.}

\begin{proposition}
\label{prop.ent.prime.vp-abs}Let $p$ be a prime. Let $n\in\mathbb{Z}$. Then,
$v_{p}\left(  \left\vert n\right\vert \right)  =v_{p}\left(  n\right)  $.
\end{proposition}

\begin{corollary}
\label{cor.ent.prime.vp-pow}Let $p$ be a prime. Let $a\in\mathbb{Z}$ and
$k\in\mathbb{N}$. Then, $v_{p}\left(  a^{k}\right)  =kv_{p}\left(  a\right)  $.
\end{corollary}

\begin{corollary}
\label{cor.ent.prime.p1a1puau}Let $p_{1},p_{2},\ldots,p_{u}$ be finitely many
distinct primes. Let $a_{1},a_{2},\ldots,a_{u}$ be nonnegative integers.

\textbf{(a)} We have $v_{p_{i}}\left(  p_{1}^{a_{1}}p_{2}^{a_{2}}\cdots
p_{u}^{a_{u}}\right)  =a_{i}$ for each $i\in\left\{  1,2,\ldots,u\right\}  $.

\textbf{(b)} We have $v_{p}\left(  p_{1}^{a_{1}}p_{2}^{a_{2}}\cdots
p_{u}^{a_{u}}\right)  =0$ for each prime $p$ satisfying $p\notin\left\{
p_{1},p_{2},\ldots,p_{u}\right\}  $.
\end{corollary}

Another useful property of $p$-valuations is how they transform gcds into minima:

\begin{proposition}
\label{prop.ent.prime.vp-gcd}Let $p$ be a prime. Let $k$ be a positive
integer. Let $n_{1},n_{2},\ldots,n_{k}$ be $k$ integers. Then,%
\[
v_{p}\left(  \gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  \right)
=\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  .
\]

\end{proposition}

We shall prove this proposition using the following innocent-looking lemma:

\begin{lemma}
\label{lem.ent.prime.vp-gcd.yoneda}Let $a$ and $b$ be two elements of
$\mathbb{N}\cup\left\{  \infty\right\}  $. Assume that the logical
equivalence
\begin{equation}
\left(  a\geq j\right)  \ \Longleftrightarrow\ \left(  b\geq j\right)
\label{eq.lem.ent.prime.vp-gcd.yoneda.ass}%
\end{equation}
holds for each $j\in\mathbb{N}$. Then, $a=b$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.vp-gcd.yoneda}.]Assume the contrary. Thus,
$a\neq b$.

Clearly, $a$ and $b$ play symmetric roles in our setting (indeed, they play
symmetric roles in (\ref{eq.lem.ent.prime.vp-gcd.yoneda.ass}), since logical
equivalence is a symmetric relation). Thus, we WLOG assume that $a\geq b$
(since otherwise, we can swap $a$ with $b$). Combining $a\geq b$ with $a\neq
b$, we obtain $a>b$.

Hence, $b<a\leq\infty$, so that $b\neq\infty$. Hence, $b\in\mathbb{N}$ and
thus $b+1>b$. Hence, the statement \textquotedblleft$b\geq b+1$%
\textquotedblright\ is false. However, we have $b+1\in\mathbb{N}$ (since
$b\in\mathbb{N}$), and thus (\ref{eq.lem.ent.prime.vp-gcd.yoneda.ass})
(applied to $j=b+1$) yields the logical equivalence $\left(  a\geq b+1\right)
\ \Longleftrightarrow\ \left(  b\geq b+1\right)  $. Therefore, the statement
\textquotedblleft$a\geq b+1$\textquotedblright\ is false (since the statement
\textquotedblleft$b\geq b+1$\textquotedblright\ is false). In other words, we
have $a<b+1$. This entails that $a\in\mathbb{N}$ (since $b+1\in\mathbb{N}$).
Thus, $a$ and $b$ are integers. Hence, from $a>b$, we obtain $a\geq b+1$.
However, this contradicts $a<b+1$. This contradiction shows that our
assumption was false; this proves Lemma \ref{lem.ent.prime.vp-gcd.yoneda}.
\end{proof}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.vp-gcd}.]Set%
\[
g=\gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ s=\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(
n_{2}\right)  ,\ldots,v_{p}\left(  n_{k}\right)  \right\}  .
\]
Note that $v_{p}\left(  g\right)  \in\mathbb{N}\cup\left\{  \infty\right\}  $
(since the $p$-valuation of any integer is an element of $\mathbb{N}%
\cup\left\{  \infty\right\}  $) and $s\in\mathbb{N}\cup\left\{  \infty
\right\}  $ (for the same reason). Our end goal is to show that $v_{p}\left(
g\right)  =s$. First, we shall show the following:

\begin{statement}
\textit{Claim 1:} Let $j\in\mathbb{N}$. Then, we have the logical equivalence%
\[
\left(  v_{p}\left(  g\right)  \geq j\right)  \ \Longleftrightarrow\ \left(
s\geq j\right)  .
\]

\end{statement}

[\textit{Proof of Claim 1:} Lemma \ref{lem.ent.prime.vp-def} (applied to $n=g$
and $i=j$) yields that $p^{j}\mid g$ if and only if $v_{p}\left(  g\right)
\geq j$. In other words, we have the logical equivalence%
\begin{equation}
\left(  p^{j}\mid g\right)  \ \Longleftrightarrow\ \left(  v_{p}\left(
g\right)  \geq j\right)  . \label{pf.prop.ent.prime.vp-gcd.1}%
\end{equation}
On the other hand, Theorem \ref{thm.ent.gcd.uniprop-mul} (applied to
$b_{i}=n_{i}$ and $m=p^{j}$) yields that we have the following logical
equivalence:%
\begin{align}
&  \ \left(  p^{j}\mid n_{i}\text{ for all }i\in\left\{  1,2,\ldots,k\right\}
\right) \nonumber\\
&  \Longleftrightarrow\ \left(  p^{j}\mid\gcd\left(  n_{1},n_{2},\ldots
,n_{k}\right)  \right)  . \label{pf.prop.ent.prime.vp-gcd.2}%
\end{align}
Hence, we have the following chain of logical equivalences:%
\begin{align}
\left(  v_{p}\left(  g\right)  \geq j\right)  \  &  \Longleftrightarrow
\ \left(  p^{j}\mid g\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.prop.ent.prime.vp-gcd.1})}\right) \nonumber\\
&  \Longleftrightarrow\ \left(  p^{j}\mid\gcd\left(  n_{1},n_{2},\ldots
,n_{k}\right)  \right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }g=\gcd\left(
n_{1},n_{2},\ldots,n_{k}\right)  \right) \nonumber\\
&  \Longleftrightarrow\ \left(  p^{j}\mid n_{i}\text{ for all }i\in\left\{
1,2,\ldots,k\right\}  \right)  \label{pf.prop.ent.prime.vp-gcd.12}%
\end{align}
(by (\ref{pf.prop.ent.prime.vp-gcd.2})).

Now, let $i\in\left\{  1,2,\ldots,k\right\}  $. Then, Lemma
\ref{lem.ent.prime.vp-def} (applied to $n_{i}$ and $j$ instead of $n$ and $i$)
yields that $p^{j}\mid n_{i}$ if and only if $v_{p}\left(  n_{i}\right)  \geq
j$. In other words, we have the logical equivalence%
\begin{equation}
\left(  p^{j}\mid n_{i}\right)  \ \Longleftrightarrow\ \left(  v_{p}\left(
n_{i}\right)  \geq j\right)  . \label{pf.prop.ent.prime.vp-gcd.3}%
\end{equation}


Forget that we fixed $i$. We thus have proved the equivalence
(\ref{pf.prop.ent.prime.vp-gcd.3}) for each $i\in\left\{  1,2,\ldots
,k\right\}  $.

Now, from (\ref{pf.prop.ent.prime.vp-gcd.12}), we obtain the following chain
of logical equivalences:%
\begin{align*}
&  \ \left(  v_{p}\left(  g\right)  \geq j\right) \\
&  \Longleftrightarrow\ \left(  \underbrace{p^{j}\mid n_{i}}%
_{\substack{\Longleftrightarrow\ \left(  v_{p}\left(  n_{i}\right)  \geq
j\right)  \\\text{(by (\ref{pf.prop.ent.prime.vp-gcd.3}))}}}\text{ for all
}i\in\left\{  1,2,\ldots,k\right\}  \right) \\
&  \Longleftrightarrow\ \left(  v_{p}\left(  n_{i}\right)  \geq j\text{ for
all }i\in\left\{  1,2,\ldots,k\right\}  \right) \\
&  \Longleftrightarrow\ \left(  \text{each of the }k\text{ elements }%
v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)  ,\ldots,v_{p}\left(
n_{k}\right)  \text{ is }\geq j\right) \\
&  \Longleftrightarrow\ \left(  \text{the \textbf{smallest} of the }k\text{
elements }v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)  ,\ldots
,v_{p}\left(  n_{k}\right)  \text{ is }\geq j\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{because for any }k\text{ elements }a_{1},a_{2},\ldots,a_{k}\text{ of
}\mathbb{N}\cup\left\{  \infty\right\}  \text{,}\\
\text{the statement \textquotedblleft each of the }k\text{ elements }%
a_{1},a_{2},\ldots,a_{k}\text{ is }\geq j\text{\textquotedblright}\\
\text{is equivalent to}\\
\text{\textquotedblleft the \textbf{smallest} of the }k\text{ elements }%
a_{1},a_{2},\ldots,a_{k}\text{ is }\geq j\text{\textquotedblright}%
\end{array}
\right) \\
&  \Longleftrightarrow\ \left(  \underbrace{\min\left\{  v_{p}\left(
n_{1}\right)  ,v_{p}\left(  n_{2}\right)  ,\ldots,v_{p}\left(  n_{k}\right)
\right\}  }_{\substack{=s\\\text{(by the definition of }s\text{)}}}\geq
j\right) \\
&  \Longleftrightarrow\ \left(  s\geq j\right)  .
\end{align*}
This proves Claim 1.]

Now, we are almost there. Claim 1 shows that the logical equivalence
\[
\left(  v_{p}\left(  g\right)  \geq j\right)  \ \Longleftrightarrow\ \left(
s\geq j\right)
\]
holds for each $j\in\mathbb{N}$. Thus, Lemma \ref{lem.ent.prime.vp-gcd.yoneda}
(applied to $a=v_{p}\left(  g\right)  $ and $b=s$) yields $v_{p}\left(
g\right)  =s$. In view of $g=\gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  $
and $s=\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  $, this rewrites as
\[
v_{p}\left(  \gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  \right)
=\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  .
\]
This proves Proposition \ref{prop.ent.prime.vp-gcd}.
\end{proof}

The technique we just used in our proof of Proposition
\ref{prop.ent.prime.vp-gcd} is worth crystallizing out, as it is often helpful
in proving properties of $p$-valuations: In order to show that $v_{p}\left(
g\right)  =s$, we proved that any $j\in\mathbb{N}$ satisfies the equivalence
$\left(  v_{p}\left(  g\right)  \geq j\right)  \ \Longleftrightarrow\ \left(
s\geq j\right)  $ (this was our Claim 1). In other words, in order to show
that the \textquotedblleft numbers\textquotedblright\ $v_{p}\left(  g\right)
$ and $s$ are equal\footnote{We are putting the word \textquotedblleft
numbers\textquotedblright\ in quotation marks, since $v_{p}\left(  g\right)  $
and $s$ can be $\infty$.}, we showed that the $j\in\mathbb{N}$ that don't
exceed one of them are the same $j\in\mathbb{N}$ that don't exceed the other.
Thus, instead of reasoning about these \textquotedblleft
numbers\textquotedblright\ $v_{p}\left(  g\right)  $ and $s$ themselves, we
have argued about what it means for a $j\in\mathbb{N}$ to satisfy
$v_{p}\left(  g\right)  \geq j$ or $s\geq j$.

\subsubsection{$p$-valuations and prime factorizations}

As already mentioned, the $p$-valuation of a positive integer $n$ tells us how
often the prime $p$ appears in a prime factorization of $n$. Let us state this
as a proposition:

\begin{proposition}
\label{prop.ent.prime.mult-in-pf}Let $n$ be a positive integer. Let $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $ be a prime factorization of $n$. Let $p$ be
a prime. Then,%
\begin{align*}
&  \left(  \text{the number of times }p\text{ appears in the tuple }\left(
a_{1},a_{2},\ldots,a_{k}\right)  \right) \\
&  =\left(  \text{the number of }i\in\left\{  1,2,\ldots,k\right\}  \text{
such that }a_{i}=p\right) \\
&  =v_{p}\left(  n\right)  .
\end{align*}

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.mult-in-pf} (sketched).](See
\cite[Proposition 2.13.30]{19s} for details.)

From the definition of a prime factorization, we know that $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $ is a tuple of primes such that
$n=a_{1}a_{2}\cdots a_{k}$. Now, from $n=a_{1}a_{2}\cdots a_{k}$, we obtain%
\begin{align*}
v_{p}\left(  n\right)   &  =v_{p}\left(  a_{1}a_{2}\cdots a_{k}\right)
=v_{p}\left(  a_{1}\right)  +v_{p}\left(  a_{2}\right)  +\cdots+v_{p}\left(
a_{k}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Corollary
\ref{cor.ent.prime.vp-ringk}}\right) \\
&  =\sum_{i\in\left\{  1,2,\ldots,k\right\}  }\underbrace{v_{p}\left(
a_{i}\right)  }_{\substack{=%
\begin{cases}
1, & \text{if }a_{i}=p;\\
0, & \text{if }a_{i}\neq p
\end{cases}
\\\text{(by Theorem \ref{thm.ent.prime.vp-ring} \textbf{(d)},}\\\text{applied
to }q=a_{i}\text{ (since }a_{i}\text{ is a prime))}}}=\sum_{i\in\left\{
1,2,\ldots,k\right\}  }%
\begin{cases}
1, & \text{if }a_{i}=p;\\
0, & \text{if }a_{i}\neq p
\end{cases}
\\
&  =\left(  \text{the number of }i\in\left\{  1,2,\ldots,k\right\}  \text{
such that }a_{i}=p\right)  \cdot1\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of }i\in\left\{
1,2,\ldots,k\right\}  \text{ such that }a_{i}\neq p\right)  \cdot0\\
&  =\left(  \text{the number of }i\in\left\{  1,2,\ldots,k\right\}  \text{
such that }a_{i}=p\right) \\
&  =\left(  \text{the number of times }p\text{ appears in the tuple }\left(
a_{1},a_{2},\ldots,a_{k}\right)  \right)  .
\end{align*}
This proves Proposition \ref{prop.ent.prime.mult-in-pf}.
\end{proof}

\subsubsection{The canonical factorization}

Proposition \ref{prop.ent.prime.mult-in-pf} allows us to expand each positive
integer $n$ \textquotedblleft explicitly\textquotedblright\ as a product of
primes:%
\begin{equation}
n=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }
\label{eq.cor.ent.prime.can-fac.pre-eq}%
\end{equation}
(where the product sign \textquotedblleft$\prod_{p\text{ prime}}%
$\textquotedblright\ means a product over all primes $p$). But first, let me
explain why the product in this equality makes sense. This product is infinite
(as there are infinitely many primes), so this is not a priori obvious.
Fortunately, it is the simplest possible kind of an infinite product -- one
that has only finitely many factors different from $1$. Let me quickly explain
the meaning of such products. I begin by defining their additive analogues --
i.e., sums that have only finitely many addends different from $0$:

\begin{definition}
\label{def.seqsum.sums.inf0}Let $S$ be a set. Let $a_{s}$ be a number for each
$s\in S$. Assume that only finitely many $s\in S$ satisfy $a_{s}\neq0$. (In
other words, assume that the set $\left\{  s\in S\ \mid\ a_{s}\neq0\right\}  $
is finite.) Then, the sum $\sum_{s\in S}a_{s}$ is defined to be the finite sum
$\sum_{\substack{s\in S;\\a_{s}\neq0}}a_{s}$. (The latter sum is already
defined according to Definition \ref{def.seqsum.sums.finset}, since it is a
finite sum.)
\end{definition}

For example, the infinite sum $\sum_{s\in\left\{  1,2,3,\ldots\right\}
}\left\lfloor 4/s\right\rfloor $ is well-defined by this definition, because
only finitely many $s\in\left\{  1,2,3,\ldots\right\}  $ satisfy $\left\lfloor
4/s\right\rfloor \neq0$ (indeed, $\left\lfloor 4/s\right\rfloor \neq0$ holds
only for $s\in\left\{  1,2,3,4\right\}  $); its value is%
\begin{align*}
\sum_{s\in\left\{  1,2,3,\ldots\right\}  }\left\lfloor 4/s\right\rfloor  &
=\sum_{\substack{s\in\left\{  1,2,3,\ldots\right\}  ;\\\left\lfloor
4/s\right\rfloor \neq0}}\left\lfloor 4/s\right\rfloor =\sum_{s\in\left\{
1,2,3,4\right\}  }\left\lfloor 4/s\right\rfloor \\
&  =\left\lfloor 4/1\right\rfloor +\left\lfloor 4/2\right\rfloor +\left\lfloor
4/3\right\rfloor +\left\lfloor 4/4\right\rfloor =8.
\end{align*}


A pedantic reader may observe that Definition \ref{def.seqsum.sums.inf0} above
might possibly clash with our old definition of finite sums (Definition
\ref{def.seqsum.sums.finset}), since it applies both to finite and infinite
sets $S$. However, this clash is harmless, because when $S$ is finite,
Definition \ref{def.seqsum.sums.inf0} agrees with Definition
\ref{def.seqsum.sums.finset} (since a sum does not change when vanishing
addends are removed from it).

Definition \ref{def.seqsum.sums.finset} allows us to make sense of infinite
sums when all but finitely many of their addends are zero. Such sums are
called \textit{finitely supported sums}, and satisfy many of the nice
properties of finite sums (see \cite[Subsection 2.14.15]{detnotes} for
details). They are, in many ways, much simpler than the convergent infinite
sums of analysis; in particular, they can be computed in finite time (simply
by throwing away all the zero addends and summing the finitely many addends
that remain).

Let us now state the multiplicative analogue of Definition
\ref{def.seqsum.sums.inf0}:

\begin{definition}
\label{def.seqsum.prods.inf1}Let $S$ be a set. Let $a_{s}$ be a number for
each $s\in S$. Assume that only finitely many $s\in S$ satisfy $a_{s}\neq1$.
(In other words, assume that the set $\left\{  s\in S\ \mid\ a_{s}%
\neq1\right\}  $ is finite.) Then, the product $\prod_{s\in S}a_{s}$ is
defined to be the finite product $\prod_{\substack{s\in S;\\a_{s}\neq1}}a_{s}%
$. (The latter product is already defined according to Definition
\ref{def.seqsum.prods.finset}, since it is a finite product.)
\end{definition}

For example,%
\[
2\cdot9\cdot3\cdot\underbrace{1\cdot1\cdot1\cdot1\cdot\cdots}%
_{\text{infinitely many }1\text{'s}}=2\cdot9\cdot3=54
\]
(where, of course, we are using the notation $a_{1}a_{2}a_{3}\cdots$ for an
infinite product $\prod_{s\in\left\{  1,2,3,\ldots\right\}  }a_{s}$).

\begin{convention}
Here and in the following, the symbol \textquotedblleft$\prod_{p\text{ prime}%
}$\textquotedblright\ means a product ranging over all primes $p$. This is an
infinite product, but can sometimes make sense (according to Definition
\ref{def.seqsum.prods.inf1}).
\end{convention}

Now, we can make sense of the equality (\ref{eq.cor.ent.prime.can-fac.pre-eq}):

\begin{theorem}
\label{thm.ent.prime.can-fac}Let $n$ be a nonzero integer.

\textbf{(a)} We have $v_{p}\left(  n\right)  =0$ for every prime $p>\left\vert
n\right\vert $. (Note that \textquotedblleft for every prime $p>\left\vert
n\right\vert $\textquotedblright\ is shorthand for \textquotedblleft for every
prime $p$ satisfying $p>\left\vert n\right\vert $\textquotedblright.)

\textbf{(b)} The product $\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$
has only finitely many factors different from $1$, and thus is well-defined.

\textbf{(c)} We have%
\[
\left\vert n\right\vert =\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }.
\]


\textbf{(d)} If $n$ is positive, then%
\[
n=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }.
\]

\end{theorem}

This expression $n=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$ is
called the \textit{canonical factorization} of $n$.

\begin{proof}
[Proof of Theorem \ref{thm.ent.prime.can-fac} (sketched).]\textbf{(a)} (See
\cite[Lemma 2.13.32 \textbf{(a)}]{19s} for details.) Let $p$ be a prime such
that $p>\left\vert n\right\vert $. Then, Proposition \ref{prop.ent.div.1}
\textbf{(b)} yields $p\nmid n$ (since $\left\vert p\right\vert =p>\left\vert
n\right\vert $), and thus Corollary \ref{cor.ent.prime.vp-0} yields
$v_{p}\left(  n\right)  =0$. This proves Theorem \ref{thm.ent.prime.can-fac}
\textbf{(a)}.

\textbf{(b)} (See \cite[Lemma 2.13.32 \textbf{(b)}]{19s} for details.) For
every prime $p>\left\vert n\right\vert $, we have $v_{p}\left(  n\right)  =0$
(by Theorem \ref{thm.ent.prime.can-fac} \textbf{(a)}) and thus $p^{v_{p}%
\left(  n\right)  }=p^{0}=1$. Thus, a prime $p$ can satisfy $v_{p}\left(
n\right)  \neq0$ only if $p\leq\left\vert n\right\vert $. Therefore, only
finitely many primes $p$ satisfy $v_{p}\left(  n\right)  \neq0$ (since only
finitely many primes $p$ satisfy $p\leq\left\vert n\right\vert $). In other
words, the product $\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$ has
only finitely many factors different from $1$. This proves Theorem
\ref{thm.ent.prime.can-fac} \textbf{(b)}.

\textbf{(d)} (See \cite[Corollary 2.13.33]{19s} for details.) Assume that $n$
is positive. Theorem \ref{thm.ent.prime.fac-uni} \textbf{(a)} shows that there
exists a prime factorization $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ of
$n$. Consider this $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $. Thus,
$a_{1},a_{2},\ldots,a_{k}$ are primes satisfying $n=a_{1}a_{2}\cdots a_{k}$.
For each prime $p$, we have%
\begin{equation}
\left(  \text{the number of }i\in\left\{  1,2,\ldots,k\right\}  \text{ such
that }a_{i}=p\right)  =v_{p}\left(  n\right)
\label{pf.cor.ent.prime.can-fac.1}%
\end{equation}
(by Proposition \ref{prop.ent.prime.mult-in-pf}). Now, consider the product
$a_{1}a_{2}\cdots a_{k}$. This product $a_{1}a_{2}\cdots a_{k}$ is a product
of primes, and each prime $p$ appears in it precisely $v_{p}\left(  n\right)
$ times (by (\ref{pf.cor.ent.prime.can-fac.1})). Hence, this product equals
$\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$. Thus, $a_{1}a_{2}\cdots
a_{k}=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$, so that
$n=a_{1}a_{2}\cdots a_{k}=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }$.
This proves Theorem \ref{thm.ent.prime.can-fac} \textbf{(d)}.

\textbf{(c)} (See \cite[Corollary 2.13.34]{19s} for details.) Apply Theorem
\ref{thm.ent.prime.can-fac} \textbf{(d)} to $\left\vert n\right\vert $ instead
of $n$, and use Proposition \ref{prop.ent.prime.vp-abs} to simplify the result.
\end{proof}

Theorem \ref{thm.ent.prime.can-fac} \textbf{(c)} greatly demystifies the
\textquotedblleft multiplicative structure\textquotedblright\ of the positive
integers (i.e., the way positive integers behave under multiplication), as
long as one is not interested in addition and subtraction. A rule of thumb is
that, if an exercise about integers involves no $+$ and $-$ signs, then
Theorem \ref{thm.ent.prime.can-fac} \textbf{(c)} and the properties of
$p$-valuations might simplify it significantly. We will see several examples
of this below. One of the basic tools here is that divisibility relations can
be reduced to inequalities between $p$-valuations:

\begin{proposition}
\label{prop.ent.prime.n|m}Let $n$ and $m$ be integers. Then, $n\mid m$ if and
only if each prime $p$ satisfies $v_{p}\left(  n\right)  \leq v_{p}\left(
m\right)  $.
\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.n|m} (sketched).](See
\cite[Proposition 2.13.35]{19s} for details.) We must prove the following two claims:

\begin{statement}
\textit{Claim 1:} If $n\mid m$, then each prime $p$ satisfies $v_{p}\left(
n\right)  \leq v_{p}\left(  m\right)  $.
\end{statement}

\begin{statement}
\textit{Claim 2:} If each prime $p$ satisfies $v_{p}\left(  n\right)  \leq
v_{p}\left(  m\right)  $, then $n\mid m$.
\end{statement}

[\textit{Proof of Claim 1:} Assume that $n\mid m$. In other words, there
exists some integer $b$ such that $m=nb$. Consider this $b$. Now, each prime
$p$ satisfies%
\begin{align*}
v_{p}\left(  m\right)   &  =v_{p}\left(  nb\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }m=nb\right) \\
&  =v_{p}\left(  n\right)  +\underbrace{v_{p}\left(  b\right)  }_{\geq
0}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.ent.prime.vp-ring}
\textbf{(a)}, applied to }a=n\right) \\
&  \geq v_{p}\left(  n\right)  ,
\end{align*}
so that $v_{p}\left(  n\right)  \leq v_{p}\left(  m\right)  $. This proves
Claim 1.]

[\textit{Proof of Claim 2:} Assume that each prime $p$ satisfies $v_{p}\left(
n\right)  \leq v_{p}\left(  m\right)  $. We must prove that $n\mid m$.

If $m=0$, then this is obvious. Thus, we WLOG assume that $m\neq0$. Hence, for
each prime $p$, we have $v_{p}\left(  m\right)  \in\mathbb{N}$ and thus
$v_{p}\left(  m\right)  <\infty$. In particular, $v_{2}\left(  m\right)
<\infty$.

We assumed that each prime $p$ satisfies $v_{p}\left(  n\right)  \leq
v_{p}\left(  m\right)  $. Thus, in particular, $v_{2}\left(  n\right)  \leq
v_{2}\left(  m\right)  <\infty$, so that $n\neq0$.

The statement of Claim 2 does not change if we replace $n$ and $m$ by
$\left\vert n\right\vert $ and $\left\vert m\right\vert $, respectively
(because of Proposition \ref{prop.ent.div.1} \textbf{(a)} and Proposition
\ref{prop.ent.prime.vp-abs}). Hence, we WLOG assume that $n$ and $m$ are
nonnegative. Assume this. Then, $n$ and $m$ are positive (since $n\neq0$ and
$m\neq0$). Thus, Theorem \ref{thm.ent.prime.can-fac} \textbf{(d)} yields%
\begin{equation}
n=\prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }.
\label{pf.prop.ent.prime.n|m.n=}%
\end{equation}
Similarly,%
\begin{equation}
m=\prod_{p\text{ prime}}p^{v_{p}\left(  m\right)  }.
\label{pf.prop.ent.prime.n|m.m=}%
\end{equation}


We have assumed that each prime $p$ satisfies $v_{p}\left(  n\right)  \leq
v_{p}\left(  m\right)  $. In other words, each prime $p$ satisfies
$v_{p}\left(  m\right)  -v_{p}\left(  n\right)  \geq0$ and therefore
$p^{v_{p}\left(  m\right)  -v_{p}\left(  n\right)  }\in\mathbb{Z}$. Now, set%
\begin{equation}
c=\prod_{p\text{ prime}}p^{v_{p}\left(  m\right)  -v_{p}\left(  n\right)  }.
\label{pf.prop.ent.prime.n|m.c=}%
\end{equation}
The infinite product in this equality has only finitely many factors different
from $1$ (for essentially the same reason as in Theorem
\ref{thm.ent.prime.can-fac} \textbf{(b)}), and thus is well-defined. Moreover,
this product is an integer (since we have shown that each prime $p$ satisfies
$p^{v_{p}\left(  m\right)  -v_{p}\left(  n\right)  }\in\mathbb{Z}$; but this
is saying that all factors of this product are integers). Thus, $c$ is an
integer. Multiplying the equalities (\ref{pf.prop.ent.prime.n|m.n=}) and
(\ref{pf.prop.ent.prime.n|m.c=}), we obtain%
\[
nc=\left(  \prod_{p\text{ prime}}p^{v_{p}\left(  n\right)  }\right)  \left(
\prod_{p\text{ prime}}p^{v_{p}\left(  m\right)  -v_{p}\left(  n\right)
}\right)  =\prod_{p\text{ prime}}p^{v_{p}\left(  m\right)  }%
=m\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.prop.ent.prime.n|m.m=}%
)}\right)  .
\]
In other words, $m=nc$. Hence, $n\mid m$. This completes the proof of Claim 2.]

Now, Claim 1 and Claim 2 are both proved; hence, Proposition
\ref{prop.ent.prime.n|m} follows.
\end{proof}

The next corollary says that an integer $n$ is determined up to sign by the
family $\left(  v_{p}\left(  n\right)  \right)  _{p\text{ prime}}$ of its
$p$-valuations for all primes $p$:

\begin{corollary}
\label{cor.ent.prime.vp=vp}Let $n$ and $m$ be two integers. Assume that
\begin{equation}
v_{p}\left(  n\right)  =v_{p}\left(  m\right)  \ \ \ \ \ \ \ \ \ \ \text{for
every prime }p. \label{eq.exe.ent.prime.vp=vp.ass}%
\end{equation}


\textbf{(a)} Then, $\left\vert n\right\vert =\left\vert m\right\vert $.

\textbf{(b)} If $n$ and $m$ are nonnegative, then $n=m$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.prime.vp=vp}.]\textbf{(a)} Each prime $p$
satisfies $v_{p}\left(  n\right)  \leq v_{p}\left(  m\right)  $ (since
(\ref{eq.exe.ent.prime.vp=vp.ass}) yields $v_{p}\left(  n\right)
=v_{p}\left(  m\right)  $). Hence, Proposition \ref{prop.ent.prime.n|m} shows
that $n\mid m$. However, the same argument (with the roles of $n$ and $m$
interchanged) shows that $m\mid n$ (since $n$ and $m$ play symmetric roles in
Corollary \ref{cor.ent.prime.vp=vp} \textbf{(a)}). Thus, Proposition
\ref{prop.ent.div.1} \textbf{(c)} (applied to $a=n$ and $b=m$) yields
$\left\vert n\right\vert =\left\vert m\right\vert $. This proves Corollary
\ref{cor.ent.prime.vp=vp} \textbf{(a)}.

\textbf{(b)} Assume that $n$ and $m$ are nonnegative. Thus, $\left\vert
n\right\vert =n$ and $\left\vert m\right\vert =m$. However, Corollary
\ref{cor.ent.prime.vp=vp} \textbf{(a)} yields $\left\vert n\right\vert
=\left\vert m\right\vert $. Hence, $n=\left\vert n\right\vert =\left\vert
m\right\vert =m$. This proves Corollary \ref{cor.ent.prime.vp=vp} \textbf{(b)}.
\end{proof}

We can also describe the gcd of several integers via $p$-valuations:

\begin{proposition}
\label{prop.ent.prime.gcd-k}Let $n_{1},n_{2},\ldots,n_{k}$ be finitely many
integers. Assume that not all of $n_{1},n_{2},\ldots,n_{k}$ are zero. Then,%
\begin{equation}
\gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  =\prod_{p\text{ prime}}%
p^{\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  }.
\label{eq.prop.ent.prime.gcd-k.gcd}%
\end{equation}

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.prime.gcd-k}.]We know (from Proposition
\ref{prop.ent.gcd.pos} \textbf{(b)}, applied to $b_{i}=n_{i}$) that
$\gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  $ is a positive integer. Hence,
Theorem \ref{thm.ent.prime.can-fac} \textbf{(d)} (applied to $n=\gcd\left(
n_{1},n_{2},\ldots,n_{k}\right)  $) yields%
\begin{align*}
\gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)   &  =\prod_{p\text{ prime}%
}\underbrace{p^{v_{p}\left(  \gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)
\right)  }}_{\substack{=p^{\min\left\{  v_{p}\left(  n_{1}\right)
,v_{p}\left(  n_{2}\right)  ,\ldots,v_{p}\left(  n_{k}\right)  \right\}
}\\\text{(since Proposition \ref{prop.ent.prime.vp-gcd}}\\\text{yields }%
v_{p}\left(  \gcd\left(  n_{1},n_{2},\ldots,n_{k}\right)  \right)
=\min\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  \text{)}}}\\
&  =\prod_{p\text{ prime}}p^{\min\left\{  v_{p}\left(  n_{1}\right)
,v_{p}\left(  n_{2}\right)  ,\ldots,v_{p}\left(  n_{k}\right)  \right\}  }.
\end{align*}
This proves Proposition \ref{prop.ent.prime.gcd-k}.

(See \cite[Proposition 2.13.40]{19s} for a different proof in the case when
$n_{1},n_{2},\ldots,n_{k}$ are all nonzero.)
\end{proof}

Another consequence of the above is saying that a congruence modulo a nonzero
integer $n$ can be reduced to the corresponding congruences modulo all prime
powers $p^{v_{p}\left(  n\right)  }$:

\begin{corollary}
\label{cor.ent.prime.modpvp}Let $n$ be a nonzero integer. Let $a$ and $b$ be
two integers. Assume that%
\begin{equation}
a\equiv b\operatorname{mod}p^{v_{p}\left(  n\right)  }%
\ \ \ \ \ \ \ \ \ \ \text{for every prime }p.
\label{eq.exe.ent.prime.modpvp.ass}%
\end{equation}
Then, $a\equiv b\operatorname{mod}n$.
\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.prime.modpvp} (sketched).](See \cite[Exercise
2.13.9]{19s} for details and for an alternative proof.) We must prove that
$a\equiv b\operatorname{mod}n$. If $a=b$, then this is obvious. Thus, we WLOG
assume that $a\neq b$. Hence, $a-b\neq0$, so that $v_{p}\left(  a-b\right)
\in\mathbb{N}$ for every prime $p$.

Let $p$ be any prime. Then, (\ref{eq.exe.ent.prime.modpvp.ass}) yields
$a\equiv b\operatorname{mod}p^{v_{p}\left(  n\right)  }$. In other words,
$p^{v_{p}\left(  n\right)  }\mid a-b$. In view of Lemma
\ref{lem.ent.prime.vp-def} (applied to $v_{p}\left(  n\right)  $ and $a-b$
instead of $i$ and $n$), this entails that $v_{p}\left(  a-b\right)  \geq
v_{p}\left(  n\right)  $. In other words, $v_{p}\left(  n\right)  \leq
v_{p}\left(  a-b\right)  $.

Now, forget that we fixed $p$. We thus have proven that each prime $p$
satisfies $v_{p}\left(  n\right)  \leq v_{p}\left(  a-b\right)  $. In view of
Proposition \ref{prop.ent.prime.n|m} (applied to $m=a-b$), this entails that
$n\mid a-b$. In other words, $a\equiv b\operatorname{mod}n$. This proves
Corollary \ref{cor.ent.prime.modpvp}.
\end{proof}

The $p$-valuation of a positive integer $n$ is easily read off its canonical factorization:

\begin{corollary}
\label{cor.ent.prime.vp-of-can}For each prime $p$, let $b_{p}$ be a
nonnegative integer. Assume that only finitely many primes $p$ satisfy
$b_{p}\neq0$. Let $n=\prod_{p\text{ prime}}p^{b_{p}}$. Then,%
\[
v_{q}\left(  n\right)  =b_{q}\ \ \ \ \ \ \ \ \ \ \text{for each prime }q.
\]

\end{corollary}

\begin{proof}
[Proof of Corollary \ref{cor.ent.prime.vp-of-can} (sketched).](See
\cite[Corollary 2.13.37]{19s} for the details.) We have $n=\prod_{p\text{
prime}}p^{b_{p}}$; thus, the number $n$ has a prime factorization
\[
\left(  \underbrace{2,2,\ldots,2}_{b_{2}\text{ times}},\underbrace{3,3,\ldots
,3}_{b_{3}\text{ times}},\underbrace{5,5,\ldots,5}_{b_{5}\text{ times}}%
,\ldots\right)
\]
in which each prime $p$ appears $b_{p}$ times. (This is a finite list, since
only finitely many primes $p$ satisfy $b_{p}\neq0$.) Hence, Corollary
\ref{cor.ent.prime.vp-of-can} follows from Proposition
\ref{prop.ent.prime.mult-in-pf} (applied to $p=q$).
\end{proof}

\subsubsection{Some applications}

As mentioned above, Theorem \ref{thm.ent.prime.can-fac} reduces multiplicative
questions about integers to additive questions about their $p$-valuations. The
following exercise (which is in itself an important result) illustrates this:

\begin{exercise}
\label{exe.ent.ab=cn.pos}Let $n\in\mathbb{N}$. Let $a$ and $b$ be positive
integers satisfying $a\perp b$. Assume that $ab$ is the $n$-th power of a
positive integer. Prove that $a$ and $b$ are $n$-th powers of positive integers.
\end{exercise}

Note that the word \textquotedblleft positive\textquotedblright\ in Exercise
\ref{exe.ent.ab=cn.pos} cannot be dispensed with (for a counterexample, set
$a=-1$ and $b=-1$ and $n=2$).

\begin{proof}
[Solution to Exercise \ref{exe.ent.ab=cn.pos}.]If $n=0$, then Exercise
\ref{exe.ent.ab=cn.pos} is easy to solve\footnote{\textit{Proof.} Assume that
$n=0$. We have assumed that $ab$ is the $n$-th power of a positive integer. In
other words, there exists a positive integer $c$ such that $ab=c^{n}$.
Consider this $c$. Thus, $ab=c^{n}=c^{0}$ (since $n=0$), so that $ab=c^{0}=1$
and thus $a\mid ab=1$. Hence, Proposition \ref{prop.ent.div.1} \textbf{(b)}
(applied to $1$ instead of $b$) yields $\left\vert a\right\vert \leq\left\vert
1\right\vert =1$. Since $a$ is positive, we have $\left\vert a\right\vert =a$,
so that $a=\left\vert a\right\vert \leq1$. Thus, $a=1$ (since $a$ is a
positive integer), so that $a=1=1^{0}$. Hence, $a$ is the $n$-th power of a
positive integer (namely, of $1$). Similarly, $b$ is the $n$-th power of a
positive integer. Thus, $a$ and $b$ are $n$-th powers of positive integers.
Hence, we have solved Exercise \ref{exe.ent.ab=cn.pos} under the assumption
that $n=0$.}. Thus, for the rest of this solution, we WLOG assume that
$n\neq0$. Hence, $n>0$.

We shall first show the following:

\begin{statement}
\textit{Claim 1:} Let $p$ be a prime. Then, $v_{p}\left(  a\right)  /n$ and
$v_{p}\left(  b\right)  /n$ are nonnegative integers.
\end{statement}

[\textit{Proof of Claim 1:} We have $a\perp b$; in other words, $\gcd\left(
a,b\right)  =1$ (by the definition of \textquotedblleft
coprime\textquotedblright). Thus, $v_{p}\left(  \gcd\left(  a,b\right)
\right)  =v_{p}\left(  1\right)  =0$ (by Theorem \ref{thm.ent.prime.vp-ring}
\textbf{(c)}). However, Proposition \ref{prop.ent.prime.vp-gcd} (applied to
$k=2$ and $n_{1}=a$ and $n_{2}=b$) yields%
\[
v_{p}\left(  \gcd\left(  a,b\right)  \right)  =\min\left\{  v_{p}\left(
a\right)  ,v_{p}\left(  b\right)  \right\}  .
\]
Hence, $\min\left\{  v_{p}\left(  a\right)  ,v_{p}\left(  b\right)  \right\}
=v_{p}\left(  \gcd\left(  a,b\right)  \right)  =0$. Thus, one of the two
numbers $v_{p}\left(  a\right)  $ and $v_{p}\left(  b\right)  $ is $0$ (since
$\min\left\{  v_{p}\left(  a\right)  ,v_{p}\left(  b\right)  \right\}  $ is
one of the two numbers $v_{p}\left(  a\right)  $ and $v_{p}\left(  b\right)
$). In other words, we have $v_{p}\left(  a\right)  =0$ or $v_{p}\left(
b\right)  =0$. Thus, we WLOG assume that $v_{p}\left(  a\right)  =0$ (since we
can otherwise achieve this by swapping $a$ with $b$).

However, we assumed that $ab$ is the $n$-th power of a positive integer. In
other words, there exists a positive integer $c$ such that $ab=c^{n}$.
Consider this $c$. From $ab=c^{n}$, we obtain $v_{p}\left(  ab\right)
=v_{p}\left(  c^{n}\right)  =nv_{p}\left(  c\right)  $ (by Corollary
\ref{cor.ent.prime.vp-0}, applied to $c$ and $n$ instead of $a$ and $k$).
Also, $v_{p}\left(  c\right)  \in\mathbb{N}$ (since $c$ is a positive integer,
thus a nonzero integer). However, Theorem \ref{thm.ent.prime.vp-ring}
\textbf{(a)} yields $v_{p}\left(  ab\right)  =\underbrace{v_{p}\left(
a\right)  }_{=0}+v_{p}\left(  b\right)  =v_{p}\left(  b\right)  $, so that
$v_{p}\left(  b\right)  =v_{p}\left(  ab\right)  =nv_{p}\left(  c\right)  $
and therefore $v_{p}\left(  b\right)  /n=v_{p}\left(  c\right)  \in\mathbb{N}%
$. Also, $\underbrace{v_{p}\left(  a\right)  }_{=0}/n=0/n=0\in\mathbb{N}$.

Now, we see that $v_{p}\left(  a\right)  /n$ and $v_{p}\left(  b\right)  /n$
are nonnegative integers (since $v_{p}\left(  a\right)  /n\in\mathbb{N}$ and
$v_{p}\left(  b\right)  /n\in\mathbb{N}$). This proves Claim 1.]

Now, recall that the integer $a$ is positive and thus nonzero. Hence, Theorem
\ref{thm.ent.prime.can-fac} \textbf{(d)} (applied to $a$ instead of $n$)
yields%
\begin{equation}
a=\prod_{p\text{ prime}}p^{v_{p}\left(  a\right)  }.
\label{sol.ent.ab=cn.pos.canfac-a}%
\end{equation}


However, if $p$ is any prime, then $v_{p}\left(  a\right)  /n$ is a
nonnegative integer (by Claim 1), and therefore $p^{v_{p}\left(  a\right)
/n}$ is a well-defined positive integer (since $p$ is a positive integer).
Moreover, if $p$ is any prime satisfying $p>\left\vert a\right\vert $, then
$v_{p}\left(  a\right)  =0$ (by Theorem \ref{thm.ent.prime.can-fac}
\textbf{(a)}, applied to $a$ instead of $n$) and thus $\underbrace{v_{p}%
\left(  a\right)  }_{=0}/n=0/n=0$ and therefore $p^{v_{p}\left(  a\right)
/n}=p^{0}=1$. Hence, the product $\prod_{p\text{ prime}}p^{v_{p}\left(
a\right)  /n}$ has only finitely many factors different from $1$ (since only
finitely many primes $p$ do not satisfy $p>\left\vert a\right\vert $). Thus,
this product is well-defined. Moreover, all factors of this product are
positive integers (because we have shown that if $p$ is any prime, then
$p^{v_{p}\left(  a\right)  /n}$ is a positive integer). Thus, this product
itself is a positive integer. In other words, $\prod_{p\text{ prime}}%
p^{v_{p}\left(  a\right)  /n}$ is a positive integer. However,%
\[
\left(  \prod_{p\text{ prime}}p^{v_{p}\left(  a\right)  /n}\right)  ^{n}%
=\prod_{p\text{ prime}}\underbrace{\left(  p^{v_{p}\left(  a\right)
/n}\right)  ^{n}}_{=p^{v_{p}\left(  a\right)  }}=\prod_{p\text{ prime}%
}p^{v_{p}\left(  a\right)  }.
\]
Comparing this with (\ref{sol.ent.ab=cn.pos.canfac-a}), we obtain $a=\left(
\prod_{p\text{ prime}}p^{v_{p}\left(  a\right)  /n}\right)  ^{n}$. This shows
that $a$ is the $n$-th power of a positive integer (since $\prod_{p\text{
prime}}p^{v_{p}\left(  a\right)  /n}$ is a positive integer). Similarly, $b$
is the $n$-th power of a positive integer. This solves Exercise
\ref{exe.ent.ab=cn.pos}.
\end{proof}

Another application of $p$-valuations is the following simple but useful fact:

\begin{exercise}
\label{exe.ent.k-th-root-of-int}Let $k$ be a positive integer. Let $w$ be a
rational number such that $w^{k}$ is an integer. Prove that $w$ is an integer.
\end{exercise}

Exercise \ref{exe.ent.k-th-root-of-int} can be restated as follows: If the
$k$-th root of an integer is rational, then this root is an integer. In other
words, if an integer is not a $k$-th power of an integer, then its $k$-th root
is irrational. This makes it completely straightforward to check (e.g.) that
the numbers $\sqrt{2}$ and $\sqrt[3]{5}$ and $\sqrt[97]{35}$ are irrational.

\begin{proof}
[Solution to Exercise \ref{exe.ent.k-th-root-of-int}.]If $w=0$, then this is
obvious. Thus, for the rest of this solution, we WLOG assume that $w\neq0$.

The number $w$ is rational. Thus, we can write $w$ in the form $w=m/n$ for
some integers $m$ and $n$ with $n\neq0$. Consider these $m$ and $n$. Note that
$m=nw$ (since $w=m/n$) and thus $m\neq0$ (since $n\neq0$ and $w\neq0$).

From $w=m/n$, we obtain $w^{k}=\left(  m/n\right)  ^{k}=m^{k}/n^{k}$. Hence,
$m^{k}/n^{k}$ is an integer (since $w^{k}$ is an integer). Thus, $n^{k}\mid
m^{k}$.

However, Proposition \ref{prop.ent.prime.n|m} (applied to $n^{k}$ and $m^{k}$
instead of $n$ and $m$) shows that $n^{k}\mid m^{k}$ if and only if each prime
$p$ satisfies $v_{p}\left(  n^{k}\right)  \leq v_{p}\left(  m^{k}\right)  $.
Hence,
\begin{equation}
\text{each prime }p\text{ satisfies }v_{p}\left(  n^{k}\right)  \leq
v_{p}\left(  m^{k}\right)  \label{sol.ent.k-th-root-of-int.1}%
\end{equation}
(since we have $n^{k}\mid m^{k}$).

Now, let $p$ be a prime. Then, $v_{p}\left(  n\right)  $ and $v_{p}\left(
m\right)  $ are integers (since $n\neq0$ and $m\neq0$). We have $v_{p}\left(
n^{k}\right)  =kv_{p}\left(  n\right)  $ (by Corollary
\ref{cor.ent.prime.vp-pow}, applied to $a=n$) and $v_{p}\left(  m^{k}\right)
=kv_{p}\left(  m\right)  $ (similarly). Hence,%
\begin{align*}
kv_{p}\left(  n\right)   &  =v_{p}\left(  n^{k}\right)  \leq v_{p}\left(
m^{k}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.k-th-root-of-int.1})}\right) \\
&  =kv_{p}\left(  m\right)  .
\end{align*}
Dividing this inequality by $k$, we obtain $v_{p}\left(  n\right)  \leq
v_{p}\left(  m\right)  $ (since $k$ is positive).

Forget that we fixed $p$. Thus, we have shown that each prime $p$ satisfies
$v_{p}\left(  n\right)  \leq v_{p}\left(  m\right)  $. According to
Proposition \ref{prop.ent.prime.n|m}, this entails that $n\mid m$. Hence,
$m/n$ is an integer (since $n$ is nonzero). In other words, $w$ is an integer
(since $w=m/n$). This solves Exercise \ref{exe.ent.k-th-root-of-int}.
\end{proof}

Another solution to Exercise \ref{exe.ent.k-th-root-of-int} can be given using
Corollary \ref{cor.ent.int-root-test-monic} (hint: $w$ is a root of the
polynomial $x^{k}-w^{k}$). We leave the details to the reader.

Here is another, slightly goofy, application of Theorem
\ref{thm.ent.prime.can-fac} (based on
\href{https://en.wikipedia.org/wiki/Godel_numbering#Godel's_encoding}{an idea
of Kurt G\"{o}del}):

\begin{exercise}
\label{exe.ent.prime.finitary-seq-countable}A sequence $\left(  a_{1}%
,a_{2},a_{3},\ldots\right)  \in\mathbb{N}^{\infty}$ of nonnegative integers
will be called \textit{finitary} if only finitely many positive integers $n$
satisfy $a_{n}\neq0$. (For example, the sequence $\left(
1,3,0,2,\underbrace{0,0,0,\ldots}_{\text{infinitely many zeroes}}\right)  $ is
finitary, whereas the sequence $\left(  1,0,1,0,1,0,\ldots\right)  $ (which
alternates between $1$s and $0$s) is not.)

Prove that the set of all finitary sequences of nonnegative integers is countable.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.finitary-seq-countable}
(sketched).]There are various ways of solving Exercise
\ref{exe.ent.prime.finitary-seq-countable}, but a particularly short one can
be obtained using prime factorization:

Let $\mathbb{P}=\left\{  1,2,3,\ldots\right\}  $ be the set of all positive
integers. Let $F$ be the set of all finitary sequences of nonnegative
integers. We must prove that $F$ is countable. We shall achieve this by
constructing a bijection from $F$ to $\mathbb{P}$.

Let $\left(  p_{1},p_{2},p_{3},\ldots\right)  =\left(  2,3,5,7,11,\ldots
\right)  $ be the sequence of all primes, listed in increasing order with no
repetitions. (This is indeed a well-defined infinite sequence, because Theorem
\ref{thm.ent.primes.infin} shows that there are infinitely many primes.) Now,
define a map%
\begin{align*}
\alpha:F  &  \rightarrow\mathbb{P},\\
\left(  a_{1},a_{2},a_{3},\ldots\right)   &  \mapsto p_{1}^{a_{1}}p_{2}%
^{a_{2}}p_{3}^{a_{3}}\cdots.
\end{align*}
(Note that the product $p_{1}^{a_{1}}p_{2}^{a_{2}}p_{3}^{a_{3}}\cdots$ in this
definition is a well-defined positive integer, since only finitely many of its
factors are different from $1$ (because only finitely many positive integers
$n$ satisfy $a_{n}\neq0$).) Conversely, define a map
\begin{align*}
\beta:\mathbb{P}  &  \rightarrow F,\\
n  &  \mapsto\left(  v_{p_{1}}\left(  n\right)  ,v_{p_{2}}\left(  n\right)
,v_{p_{3}}\left(  n\right)  ,\ldots\right)  .
\end{align*}
(Note that the sequence $\left(  v_{p_{1}}\left(  n\right)  ,v_{p_{2}}\left(
n\right)  ,v_{p_{3}}\left(  n\right)  ,\ldots\right)  $ in this definition is
indeed finitary, because Theorem \ref{thm.ent.prime.can-fac} \textbf{(a)}
entails that $v_{p_{i}}\left(  n\right)  =0$ for all primes $p_{i}>\left\vert
n\right\vert $.)

Now, the maps $\alpha$ and $\beta$ are mutually inverse. (Indeed, $\alpha
\circ\beta=\operatorname*{id}$ follows easily from Theorem
\ref{thm.ent.prime.can-fac} \textbf{(d)}, whereas $\beta\circ\alpha
=\operatorname*{id}$ follows easily from Corollary
\ref{cor.ent.prime.vp-of-can}.) Thus, the map $\alpha$ is invertible, i.e., a
bijection. Hence, we have found a bijection from $F$ to $\mathbb{P}$. Since
the set $\mathbb{P}$ is countable, we thus conclude that $F$ is also
countable. This solves Exercise \ref{exe.ent.prime.finitary-seq-countable}.
\end{proof}

Here is another exercise in which primes do not appear, yet are crucial for
its solution:

\begin{exercise}
\label{exe.ent.prime.coprime-lift}Let $a$, $b$ and $c$ be three integers such
that $\gcd\left(  a,b,c\right)  =1$ and $c\neq0$. Prove that there is a
positive integer $x$ such that $a+bx\perp c$.
\end{exercise}

Note that the claim of Exercise \ref{exe.ent.prime.coprime-lift} can also be
restated as \textquotedblleft there exists an entry of the arithmetic
progression $\left(  a+b,a+2b,a+3b,\ldots\right)  $ that is coprime to
$c$\textquotedblright. This stands to reason, since the assumption
$\gcd\left(  a,b,c\right)  =1$ rules out the existence of a nontrivial divisor
shared by all entries of this arithmetic progression and $c$ (where
\textquotedblleft nontrivial\textquotedblright\ means \textquotedblleft larger
than $1$\textquotedblright). However, this heuristic argument is not a proof,
since it is not hard to imagine that each entry of this arithmetic progression
could have some nontrivial divisor in common with $c$, but a different divisor
depending on the entry. Nevertheless, this theoretical possibility does not
actually happen, and Exercise \ref{exe.ent.prime.coprime-lift} is true.
However, the reasons for this are subtler than it may appear. Before we solve
this exercise, let us prove two simple but useful lemmas:

\begin{lemma}
\label{lem.ent.prime.copri}Let $n$ and $m$ be two integers that don't satisfy
$n\perp m$. Then, there exists a prime $q$ that divides both $n$ and $m$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.copri}.]Proposition \ref{prop.ent.gcd.pos}
\textbf{(a)} shows that the number $\gcd\left(  n,m\right)  $ is a nonnegative
integer. Proposition \ref{prop.ent.gcd.props1} \textbf{(f)} (applied to $a=n$
and $b=m$) yields $\gcd\left(  n,m\right)  \mid n$ and $\gcd\left(
n,m\right)  \mid m$.

We are in one of the following two cases:

\textit{Case 1:} We have $\gcd\left(  n,m\right)  \leq1$.

\textit{Case 2:} We have $\gcd\left(  n,m\right)  >1$.

Let us first consider Case 1. In this case, we have $\gcd\left(  n,m\right)
\leq1$. However, if we had $\gcd\left(  n,m\right)  =1$, then we would have
$n\perp m$ (by the definition of \textquotedblleft coprime\textquotedblright),
which would contradict the assumption that we don't have $n\perp m$. Hence, we
cannot have $\gcd\left(  n,m\right)  =1$. Thus, $\gcd\left(  n,m\right)
\neq1$. Combining this with $\gcd\left(  n,m\right)  \leq1$, we obtain
$\gcd\left(  n,m\right)  <1$. Therefore, $\gcd\left(  n,m\right)  =0$ (since
$\gcd\left(  n,m\right)  $ is a nonnegative integer). Thus, $0=\gcd\left(
n,m\right)  $, so that $2\mid0=\gcd\left(  n,m\right)  \mid n$ and
$2\mid0=\gcd\left(  n,m\right)  \mid m$. In other words, $2$ divides both $n$
and $m$. Hence, there exists a prime $q$ that divides both $n$ and $m$
(namely, $q=2$). This proves Lemma \ref{lem.ent.prime.copri} in Case 1.

Let us now consider Case 2. In this case, we have $\gcd\left(  n,m\right)
>1$. Hence, Proposition \ref{prop.ent.prime.ex-pri-div} (applied to
$\gcd\left(  n,m\right)  $ instead of $n$) yields that there exists at least
one prime $p$ such that $p\mid\gcd\left(  n,m\right)  $. Consider this $p$.
Thus, $p\mid\gcd\left(  n,m\right)  \mid n$ and $p\mid\gcd\left(  n,m\right)
\mid m$. In other words, $p$ divides both $n$ and $m$. Hence, there exists a
prime $q$ that divides both $n$ and $m$ (namely, $q=p$). This proves Lemma
\ref{lem.ent.prime.copri} in Case 2.

We have now proved Lemma \ref{lem.ent.prime.copri} in both Cases 1 and 2. This
shows that Lemma \ref{lem.ent.prime.copri} always holds.
\end{proof}

We note that the converse of Lemma \ref{lem.ent.prime.copri} is also true: If
there exists a prime $q$ that divides both $n$ and $m$, then $n$ and $m$ don't
satisfy $n\perp m$. (This is pretty easy to show; do it!)

Our next lemma is no less simple:

\begin{lemma}
\label{lem.ent.prime.qcoprimeprods}Let $S$ be a finite set of primes. Let $q$
be a prime such that $q\notin S$. Then, $q\perp\prod_{p\in S}p$.
\end{lemma}

For example, Lemma \ref{lem.ent.prime.qcoprimeprods} (applied to $S=\left\{
2,7,11\right\}  $ and $q=3$) yields that $3\perp2\cdot7\cdot11$.

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.qcoprimeprods}.]Write the finite set $S$ in
the form $S=\left\{  p_{1},p_{2},\ldots,p_{k}\right\}  $ (where $p_{1}%
,p_{2},\ldots,p_{k}$ are distinct). Thus, $\prod_{p\in S}p=p_{1}p_{2}\cdots
p_{k}$.

Now, let $i\in\left\{  1,2,\ldots,k\right\}  $. Then, $p_{i}\in\left\{
p_{1},p_{2},\ldots,p_{k}\right\}  =S$. Hence, $p_{i}$ is a prime (since $S$ is
a set of primes). Moreover, we cannot have $p_{i}=q$ (since $p_{i}=q$ would
yield $p_{i}=q\notin S$, which would contradict $p_{i}\in S$). Thus, the
primes $p_{i}$ and $q$ are distinct. Hence, Proposition
\ref{prop.ent.prime.dist=cop} (applied to $p=p_{i}$) yields $p_{i}\perp q$.

Forget that we fixed $i$. We thus have shown that each $i\in\left\{
1,2,\ldots,k\right\}  $ satisfies $p_{i}\perp q$. Hence, Exercise
\ref{exe.ent.coprime.ab-to-ck} (applied to $a_{i}=p_{i}$ and $c=q$) yields
$p_{1}p_{2}\cdots p_{k}\perp q$. In other words, $q\perp p_{1}p_{2}\cdots
p_{k}$ (by Proposition \ref{prop.ent.coprime.perp-symm}). In other words,
$q\perp\prod_{p\in S}p$ (since $\prod_{p\in S}p=p_{1}p_{2}\cdots p_{k}$). This
proves Lemma \ref{lem.ent.prime.qcoprimeprods}.
\end{proof}

We are now ready to solve Exercise \ref{exe.ent.prime.coprime-lift}:

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.coprime-lift}.](The following
solution is the second solution to Problem 2 in
\url{https://math.stackexchange.com/a/3128111/} ; I learnt it from a student.)

Let $C$ be the set of all primes that divide $c$. This is a finite
set\footnote{\textit{Proof.} Let $p\in C$. Then, $p$ is a prime that divides
$c$ (by the definition of $C$). Hence, $p\mid c$. Thus, Proposition
\ref{prop.ent.div.1} \textbf{(b)} (applied to $p$ and $c$ instead of $a$ and
$b$) yields $\left\vert p\right\vert \leq\left\vert c\right\vert $ (since
$c\neq0$). However, $p$ is prime; thus, $p>1>0$ and therefore $\left\vert
p\right\vert =p$. Hence, $p=\left\vert p\right\vert \leq\left\vert
c\right\vert $ and thus $p\in\left\{  1,2,\ldots,\left\vert c\right\vert
\right\}  $ (since $p$ is a positive integer).
\par
Forget that we fixed $p$. We thus have shown that $p\in\left\{  1,2,\ldots
,\left\vert c\right\vert \right\}  $ for each $p\in C$. In other words,
$C\subseteq\left\{  1,2,\ldots,\left\vert c\right\vert \right\}  $. Hence, the
set $C$ is finite (since the set $\left\{  1,2,\ldots,\left\vert c\right\vert
\right\}  $ is finite).}. Moreover, $C$ is a set of primes (by the definition
of $C$). Hence, $C$ is a finite set of primes.

Let $A$ be the set of all primes that divide $a$. The set $C\setminus A$ is a
subset of $C$, and thus is a finite set of primes (since $C$ is a finite set
of primes).

Now, let
\[
x=\prod\limits_{p\in C\setminus A}p.
\]
Clearly, $x$ is a positive integer. Now, I claim that $a+bx\perp c$.
Obviously, once this is proven, Exercise \ref{exe.ent.prime.coprime-lift} will
be solved.

So we must prove that $a+bx\perp c$.

Indeed, assume the contrary. Thus, we don't have $a+bx\perp c$. Hence, Lemma
\ref{lem.ent.prime.copri} (applied to $n=a+bx$ and $m=c$) shows that there
exists a prime $q$ that divides both $a+bx$ and $c$. Consider this $q$.

We know that $q$ is a prime that divides $c$. In other words, $q\in C$ (by the
definition of $C$). Moreover, $q$ divides $a+bx$; in other words, $q\mid
a+bx$. Furthermore, $q>1$ (since $q$ is a prime).

Now, we must be in one of the following two cases:

\textit{Case 1:} We have $q\in A$.

\textit{Case 2:} We have $q\notin A$.

Let us consider Case 1 first. In this case, we have $q\in A$. Thus, $q$ is a
prime that divides $a$ (by the definition of $A$). In particular, $q\mid a$.
Now,%
\[
xb=bx=\underbrace{\left(  a+bx\right)  }_{\substack{\equiv0\operatorname{mod}%
q\\\text{(since }q\mid a+bx\text{)}}}-\underbrace{a}_{\substack{\equiv
0\operatorname{mod}q\\\text{(since }q\mid a\text{)}}}\equiv
0-0=0\operatorname{mod}q.
\]
In other words, $q\mid xb$.

We cannot have $q\in C\setminus A$ (since this would entail $q\notin A$, which
would contradict $q\in A$). In other words, we have $q\notin C\setminus A$.
Hence, Lemma \ref{lem.ent.prime.qcoprimeprods} (applied to $S=C\setminus A$)
yields $q\perp\prod_{p\in C\setminus A}p$. This rewrites as $q\perp x$ (since
$x=\prod_{p\in C\setminus A}p$). Hence, Theorem \ref{thm.ent.coprime.cancel}
(applied to $q$, $x$ and $b$ instead of $a$, $b$ and $c$) yields $q\mid b$
(since $q\mid xb$). Note that we also have $q\mid a$ and $q\mid c$ (since $q$
divides $c$).

Now, for any $b_{1},b_{2},b_{3}\in\mathbb{Z}$ and $m\in\mathbb{Z}$, we have
the logical equivalence%
\[
\left(  m\mid b_{1}\text{ and }m\mid b_{2}\text{ and }m\mid b_{3}\right)
\ \Longleftrightarrow\ \left(  m\mid\gcd\left(  b_{1},b_{2},b_{3}\right)
\right)
\]
\footnote{\textit{Proof.} Let $b_{1},b_{2},b_{3}\in\mathbb{Z}$ and
$m\in\mathbb{Z}$ be arbitrary. Then, we have the following chain of logical
equivalences:%
\begin{align*}
&  \ \left(  m\mid b_{1}\text{ and }m\mid b_{2}\text{ and }m\mid b_{3}\right)
\\
\Longleftrightarrow &  \ \left(  m\mid b_{i}\text{ for all }i\in\left\{
1,2,3\right\}  \right) \\
\Longleftrightarrow &  \ \left(  m\mid b_{i}\text{ for all }i\in\left\{
1,2,\ldots,3\right\}  \right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\left\{  1,2,3\right\}  =\left\{  1,2,\ldots,3\right\}  \right) \\
\ \Longleftrightarrow &  \ \left(  m\mid\gcd\left(  b_{1},b_{2},\ldots
,b_{3}\right)  \right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem
\ref{thm.ent.gcd.uniprop-mul} (applied to }k=3\text{)}\right) \\
\Longleftrightarrow &  \ \left(  m\mid\gcd\left(  b_{1},b_{2},b_{3}\right)
\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\gcd\left(  b_{1}%
,b_{2},\ldots,b_{3}\right)  =\gcd\left(  b_{1},b_{2},b_{3}\right)  \right)  .
\end{align*}
Thus, we have proved the equivalence $\left(  m\mid b_{1}\text{ and }m\mid
b_{2}\text{ and }m\mid b_{3}\right)  \ \Longleftrightarrow\ \left(  m\mid
\gcd\left(  b_{1},b_{2},b_{3}\right)  \right)  $.}. Applying this to $b_{1}=a$
and $b_{2}=b$ and $b_{3}=c$ and $m=q$, we obtain the logical equivalence%
\[
\left(  q\mid a\text{ and }q\mid b\text{ and }q\mid c\right)
\ \Longleftrightarrow\ \left(  q\mid\gcd\left(  a,b,c\right)  \right)  .
\]
Hence, we have $q\mid\gcd\left(  a,b,c\right)  $ (since we have $q\mid a$ and
$q\mid b$ and $q\mid c$). In other words, $q\mid1$ (since $\gcd\left(
a,b,c\right)  =1$). Thus, $q$ is a divisor of $1$. This shows that $q$ is
either $1$ or $-1$ (since the only divisors of $1$ are $1$ and $-1$). But this
contradicts the fact that $q>1$. Thus, we have obtained a contradiction in
Case 1.

Let us now consider Case 2. In this case, we have $q\notin A$. Combining this
with $q\in C$, we obtain $q\in C\setminus A$. Hence, $q$ is a factor in the
product $\prod\limits_{p\in C\setminus A}p$. Therefore, $q$ divides this
product. Thus, $q\mid\prod\limits_{p\in C\setminus A}p=x$. Now,%
\[
a=\underbrace{\left(  a+bx\right)  }_{\substack{\equiv0\operatorname{mod}%
q\\\text{(since }q\mid a+bx\text{)}}}-b\underbrace{x}_{\substack{\equiv
0\operatorname{mod}q\\\text{(since }q\mid x\text{)}}}\equiv0-b\cdot
0=0\operatorname{mod}q.
\]
In other words, $q\mid a$. Hence, $q$ divides $a$. Therefore, $q$ is a prime
that divides $a$ (since $q$ is a prime). In other words, $q\in A$ (by the
definition of $A$). But this contradicts $q\notin A$. Thus, we have obtained a
contradiction in Case 2.

We have now found contradictions in both Cases 1 and 2. Since these two cases
cover all possibilities, this shows that we always get a contradiction. Thus,
our assumption was wrong, and therefore $a+bx\perp c$ is proven. This solves
Exercise \ref{exe.ent.prime.coprime-lift}.
\end{proof}

Next, let us illustrate the use of Corollary \ref{cor.ent.prime.modpvp} by
proving a variant of Theorem \ref{thm.ent.euler} (Euler's theorem):

\begin{exercise}
\label{exe.ent.euler.non-coprime}Let $a$ be an integer, and let $n$ be a
positive integer. Let $\phi\left(  n\right)  $ be defined as in Theorem
\ref{thm.ent.euler}. Prove that $a^{n}\equiv a^{n-\phi\left(  n\right)
}\operatorname{mod}n$.
\end{exercise}

Note that Exercise \ref{exe.ent.euler.non-coprime} competes with Theorem
\ref{thm.ent.euler} over the claim of being the natural generalization of
Fermat's Little Theorem: Indeed, Exercise \ref{exe.ent.euler.non-coprime}
generalizes Theorem \ref{thm.ent.fermat} \textbf{(b)} just like Theorem
\ref{thm.ent.euler} generalizes Theorem \ref{thm.ent.fermat} \textbf{(a)}.

\begin{proof}
[Solution to Exercise \ref{exe.ent.euler.non-coprime} (sketched).]We shall
only give the main steps; see \cite[Exercise 2.16.3]{19s} for a similar
solution written out in full detail.

First, let us show that $a^{n-\phi\left(  n\right)  }$ is an integer (in order
to be sure that the congruence $a^{n}\equiv a^{n-\phi\left(  n\right)
}\operatorname{mod}n$ makes sense in the first place!). Indeed, in Theorem
\ref{thm.ent.euler}, we have defined $\phi\left(  n\right)  $ to be the \# of
all $i\in\left\{  1,2,\ldots,n\right\}  $ that satisfy $i\perp n$. Hence,
\begin{align}
\phi\left(  n\right)   &  =\left(  \text{\# of all }i\in\left\{
1,2,\ldots,n\right\}  \text{ that satisfy }i\perp n\right)
\label{sol.ent.euler.non-coprime.phin=}\\
&  \leq\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n\right\}  \right)
=\left\vert \left\{  1,2,\ldots,n\right\}  \right\vert =n.\nonumber
\end{align}
Thus, $n-\phi\left(  n\right)  \in\mathbb{N}$. This shows that $a^{n-\phi
\left(  n\right)  }$ is an integer.

We must prove the congruence $a^{n}\equiv a^{n-\phi\left(  n\right)
}\operatorname{mod}n$. According to Corollary \ref{cor.ent.prime.modpvp}
(applied to $a^{n}$ and $a^{n-\phi\left(  n\right)  }$ instead of $a$ and
$b$), it suffices therefor to show that $a^{n}\equiv a^{n-\phi\left(
n\right)  }\operatorname{mod}p^{v_{p}\left(  n\right)  }$ for every prime $p$.

So let us fix a prime $p$. Our goal is thus to show that%
\begin{equation}
a^{n}\equiv a^{n-\phi\left(  n\right)  }\operatorname{mod}p^{v_{p}\left(
n\right)  }. \label{sol.ent.euler.non-coprime.p-goal}%
\end{equation}


Proposition \ref{prop.ent.prime.div-or-coprime} yields that we have either
$p\mid a$ or $p\perp a$. Hence, we are in one of the following two cases:

\textit{Case 1:} We have $p\mid a$.

\textit{Case 2:} We have $p\perp a$.

Let us first consider Case 1. In this case, we have $p\mid a$. Our goal, as we
remember, is to prove (\ref{sol.ent.euler.non-coprime.p-goal}). We shall
achieve this by showing that both $a^{n}$ and $a^{n-\phi\left(  n\right)  }$
are congruent to $0$ modulo $p^{v_{p}\left(  n\right)  }$.

Indeed, the difference rule (Theorem \ref{thm.enum.diff}) yields%
\begin{align}
&  \left(  \text{\# of all }i\in\left\{  1,2,\ldots,n\right\}  \text{ that
\textbf{don't} satisfy }i\perp n\right) \nonumber\\
&  =\underbrace{\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n\right\}
\right)  }_{=\left\vert \left\{  1,2,\ldots,n\right\}  \right\vert
=n}-\underbrace{\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n\right\}
\text{ that satisfy }i\perp n\right)  }_{\substack{=\phi\left(  n\right)
\\\text{(by (\ref{sol.ent.euler.non-coprime.phin=}))}}}\nonumber\\
&  =n-\phi\left(  n\right)  . \label{sol.ent.euler.non-coprime.c1.1}%
\end{align}


However, let us set $j=v_{p}\left(  n\right)  $. Then, $v_{p}\left(  n\right)
\geq j$, so that $p^{j}\mid n$ (by Lemma \ref{lem.ent.prime.vp-def}, applied
to $i=j$). Hence, Proposition \ref{prop.ent.div.1} \textbf{(b)} readily yields
$\left\vert p^{j}\right\vert \leq\left\vert n\right\vert $. In other words,
$p^{j}\leq n$ (since $p^{j}$ and $n$ are positive). Thus,
\[
1\leq p^{1}\leq p^{2}\leq\cdots\leq p^{j}\leq n.
\]
This shows that the $j$ numbers $p^{1},p^{2},\ldots,p^{j}$ all belong to the
set $\left\{  1,2,\ldots,n\right\}  $. Moreover, none of these $j$ numbers is
coprime to $n$ (since they are all divisible by $p$, and thus have the divisor
$p$ in common with $n$, which shows that their gcd with $n$ is $\geq p$).
Hence, these $j$ numbers $p^{1},p^{2},\ldots,p^{j}$ all belong to the set of
all $i\in\left\{  1,2,\ldots,n\right\}  $ that \textbf{don't} satisfy $i\perp
n$. Hence, this set has at least $j$ many elements (because the $j$ numbers
$p^{1},p^{2},\ldots,p^{j}$ are distinct). In other words,%
\[
\left(  \text{\# of all }i\in\left\{  1,2,\ldots,n\right\}  \text{ that
\textbf{don't} satisfy }i\perp n\right)  \geq j.
\]
In view of (\ref{sol.ent.euler.non-coprime.c1.1}), this rewrites as
$n-\phi\left(  n\right)  \geq j$.

Now, $p^{1}=p\mid a$, so that $v_{p}\left(  a\right)  \geq1$ (by Lemma
\ref{lem.ent.prime.vp-def}, applied to $1$ and $a$ instead of $i$ and $n$).
Corollary \ref{cor.ent.prime.vp-pow} (applied to $k=n-\phi\left(  n\right)  $)
yields
\[
v_{p}\left(  a^{n-\phi\left(  n\right)  }\right)  =\left(  n-\phi\left(
n\right)  \right)  \underbrace{v_{p}\left(  a\right)  }_{\geq1}\geq
n-\phi\left(  n\right)  \geq j.
\]
In view of Lemma \ref{lem.ent.prime.vp-def} (applied to $j$ and $a^{n-\phi
\left(  n\right)  }$ instead of $i$ and $n$), this entails that $p^{j}\mid
a^{n-\phi\left(  n\right)  }$. In other words, $a^{n-\phi\left(  n\right)
}\equiv0\operatorname{mod}p^{j}$. Hence,%
\[
a^{n}=\underbrace{a^{n-\phi\left(  n\right)  }}_{\equiv0\operatorname{mod}%
p^{j}}\cdot a^{\phi\left(  n\right)  }\equiv0\cdot a^{\phi\left(  n\right)
}=0\equiv a^{n-\phi\left(  n\right)  }\operatorname{mod}p^{j}.
\]
In other words, $a^{n}\equiv a^{n-\phi\left(  n\right)  }\operatorname{mod}%
p^{v_{p}\left(  n\right)  }$ (since $j=v_{p}\left(  n\right)  $). Thus,
(\ref{sol.ent.euler.non-coprime.p-goal}) is proved in Case 1.

Let us now consider Case 2. In this case, we have $p\perp a$. In other words,
$a\perp p$.

We shall now show that $a^{\phi\left(  n\right)  }\equiv1\operatorname{mod}%
p^{v_{p}\left(  n\right)  }$. Once this is proved, the claim
(\ref{sol.ent.euler.non-coprime.p-goal}) will quickly follow.

It is tempting to obtain $a^{\phi\left(  n\right)  }\equiv1\operatorname{mod}%
p^{v_{p}\left(  n\right)  }$ by applying Theorem \ref{thm.ent.euler}. However,
this is not so easy, since we don't know whether $a\perp n$; we only know that
the weaker statement $a\perp p$ is true. We need to work around this.

Fortunately, Exercise \ref{exe.ent.prime.coprime-lift} is here to help. We set
$i=v_{p}\left(  n\right)  $. Then, $v_{p}\left(  n\right)  \geq i$, so that
$p^{i}\mid n$ (by Lemma \ref{lem.ent.prime.vp-def}). Furthermore, Exercise
\ref{exe.ent.coprime.powers} yields $a^{1}\perp p^{i}$ (since $a\perp p$). In
other words, $a\perp p^{i}$. Hence, it is easy to see that $\gcd\left(
a,p^{i},n\right)  =1$\ \ \ \ \footnote{\textit{Proof.} Let $m=\gcd\left(
a,p^{i},n\right)  $. Then, $m$ is a common divisor of $a$, $p^{i}$ and $n$ (by
the definition of a gcd). Hence, $m\mid a$ and $m\mid p^{i}$ and $m\mid n$.
However, Theorem \ref{thm.ent.gcd.uniprop} (applied to $b=p^{i}$) yields that
we have the following logical equivalence:%
\[
\left(  m\mid a\ \text{and }m\mid p^{i}\right)  \ \Longleftrightarrow\ \left(
m\mid\gcd\left(  a,p^{i}\right)  \right)  .
\]
Thus, $m\mid\gcd\left(  a,p^{i}\right)  $ (since $m\mid a$ and $m\mid p^{i}$).
Thus, we have $m\mid\gcd\left(  a,p^{i}\right)  =1$ (since $a\perp p^{i}$).
Since $m$ is nonnegative (because we defined $m$ as a gcd), this entails
$m=1$. Thus, $\gcd\left(  a,p^{i},n\right)  =m=1$.}. Thus, Exercise
\ref{exe.ent.prime.coprime-lift} (applied to $b=p^{i}$ and $c=n$) yields that
there is a positive integer $x$ such that $a+p^{i}x\perp n$. Consider this
$x$. Set $b=a+p^{i}x$. Thus, $b-a=p^{i}x$ is divisible by $p^{i}$; in other
words, $b\equiv a\operatorname{mod}p^{i}$. Hence, $b^{\phi\left(  n\right)
}\equiv a^{\phi\left(  n\right)  }\operatorname{mod}p^{i}$, so that
$a^{\phi\left(  n\right)  }\equiv b^{\phi\left(  n\right)  }\operatorname{mod}%
p^{i}$.

Now, $b=a+p^{i}x\perp n$; hence, Theorem \ref{thm.ent.euler} (applied to $b$
instead of $a$) yields $b^{\phi\left(  n\right)  }\equiv1\operatorname{mod}n$.
This entails $b^{\phi\left(  n\right)  }\equiv1\operatorname{mod}p^{i}$ (by
Proposition \ref{prop.ent.mod.basics} \textbf{(e)}, since $p^{i}\mid n$).
However, $a^{\phi\left(  n\right)  }\equiv b^{\phi\left(  n\right)  }%
\equiv1\operatorname{mod}p^{i}$. In other words, $a^{\phi\left(  n\right)
}\equiv1\operatorname{mod}p^{v_{p}\left(  n\right)  }$ (since $i=v_{p}\left(
n\right)  $).

Now,%
\[
a^{n}=a^{n-\phi\left(  n\right)  }\cdot\underbrace{a^{\phi\left(  n\right)  }%
}_{\equiv1\operatorname{mod}p^{v_{p}\left(  n\right)  }}\equiv a^{n-\phi
\left(  n\right)  }\cdot1=a^{n-\phi\left(  n\right)  }\operatorname{mod}%
p^{v_{p}\left(  n\right)  }.
\]
Thus, (\ref{sol.ent.euler.non-coprime.p-goal}) is proved in Case 2.

Hence, we have proved (\ref{sol.ent.euler.non-coprime.p-goal}) in both Cases 1
and 2. This shows that (\ref{sol.ent.euler.non-coprime.p-goal}) always holds.
As explained above, this completes the solution to Exercise
\ref{exe.ent.euler.non-coprime}.
\end{proof}

The above solution to Exercise \ref{exe.ent.euler.non-coprime} might appear
clunky with its two cases, its rough (analysis-style) estimates of
$n-\phi\left(  n\right)  $ (in Case 1), and its somewhat unmotivated use of
Exercise \ref{exe.ent.prime.coprime-lift}. However, it illustrates several
important techniques.

The first technique is the passage from proving a congruence modulo $n$ to
proving a congruence modulo $p^{v_{p}\left(  n\right)  }$ (via Corollary
\ref{cor.ent.prime.modpvp}). This is called \textit{working locally} (where
\textquotedblleft locally\textquotedblright\ means \textquotedblleft focusing
on a single prime\textquotedblright), and has the advantage that
$p^{v_{p}\left(  n\right)  }$ behaves \textquotedblleft
nicer\textquotedblright\ than the (a priori) arbitrary positive integer $n$.
In our specific case, we profited from this passage by being able to apply
Proposition \ref{prop.ent.prime.div-or-coprime} and use $p$-valuations
(whereas there is no analogue of Proposition
\ref{prop.ent.prime.div-or-coprime} for $n$ instead of $p$). There are many
other ways in which working locally can be useful; for example, if we want to
show that some two integers are coprime, then (by Lemma
\ref{lem.ent.prime.copri}) it suffices to show that every prime fails to
divide at least one of them. Other applications of working locally are enabled
by the \textit{Chinese remainder theorem}, which we shall discuss further below.

The second technique is the trick that allowed us to apply Theorem
\ref{thm.ent.euler} in Case 2: We could not apply Theorem \ref{thm.ent.euler}
directly to $a$, since $a$ may fail to satisfy $a\perp n$; thus, we instead
applied Theorem \ref{thm.ent.euler} to a new integer $b$ that we constructed
tactically to satisfy $b\perp n$ (so that it satisfies the assumption of
Theorem \ref{thm.ent.euler}) while being congruent to $a$ modulo $p^{i}$ (so
that it could act as a stand-in for $a$ for the purpose of proving a
congruence modulo $p^{i}$). Thus, so to speak, we have ``snuck'' $a$ into
Theorem \ref{thm.ent.euler} under the ``disguise'' of $b$. The
\textquotedblleft moral\textquotedblright\ of the story is that all is not
lost when a theorem does not immediately apply; often it is possible to tweak
the objects until it does apply to them. (Of course, we were lucky to have
Exercise \ref{exe.ent.prime.coprime-lift} available when it came to tweaking
$a$. It would have been much harder otherwise...)

\subsubsection{Factorials and their $p$-valuations}

Next, we shall study a very special case of $p$-valuations: those of the
factorials. In other words, we shall compute $v_{p}\left(  n!\right)  $ for
any $n\in\mathbb{N}$ and any prime $p$:

\begin{theorem}
[de Polignac's formula]\label{thm.ent.prime.de-polignac}Let $p$ be a prime.
Let $n\in\mathbb{N}$. Then,
\[
v_{p}\left(  n!\right)  =\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}%
}\right\rfloor .
\]
(The summation sign \textquotedblleft$\sum_{i\geq1}$\textquotedblright\ is
shorthand for \textquotedblleft$\sum_{i\in\left\{  1,2,3,\ldots\right\}  }%
$\textquotedblright. The sum $\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}%
}\right\rfloor $ in this equality is well-defined according to Definition
\ref{def.seqsum.sums.inf0}, since it has only finitely many nonzero addends.)
\end{theorem}

For example, applied to $n=5$ and $p=2$, Theorem
\ref{thm.ent.prime.de-polignac} predicts that%
\begin{align*}
v_{2}\left(  5!\right)   &  =\sum_{i\geq1}\left\lfloor \dfrac{5}{2^{i}%
}\right\rfloor =\underbrace{\left\lfloor \dfrac{5}{2^{1}}\right\rfloor }%
_{=2}+\underbrace{\left\lfloor \dfrac{5}{2^{2}}\right\rfloor }_{=1}%
+\underbrace{\left\lfloor \dfrac{5}{2^{3}}\right\rfloor }_{=0}%
+\underbrace{\left\lfloor \dfrac{5}{2^{4}}\right\rfloor }_{=0}+\cdots\\
&  =2+1+\underbrace{0+0+\cdots}_{=0}=2+1=3.
\end{align*}
This is easily confirmed (since $5!=120=2^{3}\cdot3\cdot5$).

We shall give only a brief outline of the proof of Theorem
\ref{thm.ent.prime.de-polignac}, since this proof can be found in many places.
(In particular, Theorem \ref{thm.ent.prime.de-polignac} is \cite[Theorem
1.3.3]{floor}. Moreover, it appears in an equivalent form in \cite[Exercise
2.17.2 \textbf{(c)}]{19s}\footnote{Indeed, \cite[Exercise 2.17.2 \textbf{(c)}%
]{19s} says that $v_{p}\left(  n!\right)  =\sum_{i\geq1}n//p^{i}$ instead of
$v_{p}\left(  n!\right)  =\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}%
}\right\rfloor $. However, this is equivalent, since an easy application of
Proposition \ref{prop.ent.quo-rem.quo=floor} yields that $n//p^{i}%
=\left\lfloor \dfrac{n}{p^{i}}\right\rfloor $ for any $i\in\mathbb{N}$.}.)

The proof of Theorem \ref{thm.ent.prime.de-polignac} hinges on two
lemmas:\footnote{We are using the Iverson bracket notation (Definition
\ref{def.iverson}) again.}

\begin{lemma}
\label{lem.ent.prime.de-polignac.l1}Let $n\in\mathbb{N}$. Let $k$ be a
positive integer. Then, $\left\lfloor \dfrac{n}{k}\right\rfloor =\sum
_{i=1}^{n}\left[  k\mid i\right]  $.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.de-polignac.l1} (sketched).](See \cite[
Exercise 2.17.2 \textbf{(a)}]{19s} for details\footnote{but notice that \cite[
Exercise 2.17.2 \textbf{(a)}]{19s} talks about $n//k$ instead of $\left\lfloor
\dfrac{n}{k}\right\rfloor $ (which, however, is the same number, since an easy
application of Proposition \ref{prop.ent.quo-rem.quo=floor} shows that
$n//k=\left\lfloor \dfrac{n}{k}\right\rfloor $)}.) Each addend of the sum
$\sum_{i=1}^{n}\left[  k\mid i\right]  $ is either $0$ or $1$. Namely, an
addend $\left[  k\mid i\right]  $ is $1$ if $i$ is a multiple of $k$, and $0$
otherwise. Hence,
\begin{align*}
\sum_{i=1}^{n}\left[  k\mid i\right]   &  =\left(  \text{\# of integers }%
i\in\left\{  1,2,\ldots,n\right\}  \text{ that are multiples of }k\right)
\cdot1\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of integers }i\in\left\{
1,2,\ldots,n\right\}  \text{ that are not multiples of }k\right)  \cdot0\\
&  =\left(  \text{\# of integers }i\in\left\{  1,2,\ldots,n\right\}  \text{
that are multiples of }k\right) \\
&  =n//k\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since there are precisely }n//k\text{ many }\\
\text{multiples of }k\text{ among the integers }i\in\left\{  1,2,\ldots
,n\right\}
\end{array}
\right) \\
&  =\left\lfloor \dfrac{n}{k}\right\rfloor
\end{align*}
(by an easy application of Proposition \ref{prop.ent.quo-rem.quo=floor}). This
proves Lemma \ref{lem.ent.prime.de-polignac.l1}.
\end{proof}

\begin{lemma}
\label{lem.ent.prime.de-polignac.2}Let $p$ be a prime. Let $n$ be a nonzero
integer. Then, $v_{p}\left(  n\right)  =\sum_{i\geq1}\left[  p^{i}\mid
n\right]  $.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.prime.de-polignac.2} (sketched).](See \cite[
Exercise 2.17.2 \textbf{(b)}]{19s} for details.) Let $k=v_{p}\left(  n\right)
$. Then, $k$ is the largest $m\in\mathbb{N}$ such that $p^{m}\mid n$ (by the
definition of $v_{p}\left(  n\right)  $). Hence, $p^{k}\mid n$ but
$p^{k+1}\nmid n$. Thus, the $k$ numbers $p^{1},p^{2},\ldots,p^{k}$ divide $n$,
but none of the numbers $p^{k+1},p^{k+2},p^{k+3},\ldots$ does. In other words,
the statement $p^{i}\mid n$ holds for each $i\in\left\{  1,2,\ldots,k\right\}
$, but is false for each $i\in\left\{  k+1,k+2,k+3,\ldots\right\}  $. Hence,
the truth value $\left[  p^{i}\mid n\right]  $ equals $1$ for each
$i\in\left\{  1,2,\ldots,k\right\}  $, but equals $0$ for each $i\in\left\{
k+1,k+2,k+3,\ldots\right\}  $. Therefore, the sum $\sum_{i\geq1}\left[
p^{i}\mid n\right]  $ has $k$ addends equal to $1$, while all remaining
addends are $0$. Therefore, this sum equals $k$. In other words, $\sum
_{i\geq1}\left[  p^{i}\mid n\right]  =k=v_{p}\left(  n\right)  $. This proves
Lemma \ref{lem.ent.prime.de-polignac.2}.
\end{proof}

It is now easy to prove Theorem \ref{thm.ent.prime.de-polignac}:

\begin{proof}
[Proof of Theorem \ref{thm.ent.prime.de-polignac} (sketched).](See \cite[
Exercise 2.17.2 \textbf{(c)}]{19s} for details.) From $n!=1\cdot2\cdot
\cdots\cdot n$, we obtain%
\begin{align}
v_{p}\left(  n!\right)   &  =v_{p}\left(  1\cdot2\cdot\cdots\cdot n\right)
=v_{p}\left(  1\right)  +v_{p}\left(  2\right)  +\cdots+v_{p}\left(  n\right)
\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by Corollary
\ref{cor.ent.prime.vp-ringk}, applied to }k=n\text{ and }a_{i}=i\right)
\nonumber\\
&  =\sum_{m=1}^{n}\underbrace{v_{p}\left(  m\right)  }_{\substack{=\sum
_{i\geq1}\left[  p^{i}\mid m\right]  \\\text{(by Lemma
\ref{lem.ent.prime.de-polignac.2})}}}=\sum_{m=1}^{n}\ \ \sum_{i\geq1}\left[
p^{i}\mid m\right]  =\sum_{m=1}^{n}\ \ \sum_{j\geq1}\left[  p^{j}\mid m\right]
\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed
the summation index }i\text{ as }j\right) \nonumber\\
&  =\sum_{j\geq1}\ \ \sum_{m=1}^{n}\left[  p^{j}\mid m\right]  .
\label{pf.thm.ent.prime.de-polignac.1}%
\end{align}
(In the last step of this computation, we have interchanged the two summation
signs \textquotedblleft$\sum_{m=1}^{n}$\textquotedblright\ and
\textquotedblleft$\sum_{j\geq1}$\textquotedblright. Make sure you understand
why this is legitimate!\footnote{It is not always legitimate to interchange
two infinite sums, even if both are well-defined. Fortunately, one of our two
summation signs -- viz., \textquotedblleft$\sum_{m=1}^{n}$\textquotedblright%
\ -- is a finite sum.}) But each positive integer $j$ satisfies%
\begin{align}
\left\lfloor \dfrac{n}{p^{j}}\right\rfloor  &  =\sum_{i=1}^{n}\left[
p^{j}\mid i\right]  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Lemma
\ref{lem.ent.prime.de-polignac.l1}, applied to }k=p^{j}\right) \nonumber\\
&  =\sum_{m=1}^{n}\left[  p^{j}\mid m\right]
\label{pf.thm.ent.prime.de-polignac.2}%
\end{align}
(here, we have renamed the summation index $i$ as $m$). Thus,
(\ref{pf.thm.ent.prime.de-polignac.1}) becomes%
\[
v_{p}\left(  n!\right)  =\sum_{j\geq1}\ \ \underbrace{\sum_{m=1}^{n}\left[
p^{j}\mid m\right]  }_{\substack{=\left\lfloor \dfrac{n}{p^{j}}\right\rfloor
\\\text{(by (\ref{pf.thm.ent.prime.de-polignac.2}))}}}=\sum_{j\geq
1}\left\lfloor \dfrac{n}{p^{j}}\right\rfloor =\sum_{i\geq1}\left\lfloor
\dfrac{n}{p^{i}}\right\rfloor
\]
(here, we have renamed the summation index $j$ as $i$). This proves Theorem
\ref{thm.ent.prime.de-polignac}.
\end{proof}

Theorem \ref{thm.ent.prime.de-polignac} tends to be useful whenever it comes
to proving divisibilities involving factorials. The following is perhaps the
simplest application:

\begin{exercise}
\label{exe.ent.prime.de-polignac.bincoeff}Let $n,m\in\mathbb{N}$. Prove that
$n!m!\mid\left(  n+m\right)  !$.
\end{exercise}

We shall give two solutions to Exercise
\ref{exe.ent.prime.de-polignac.bincoeff}: one using binomial coefficients, and
one using $p$-valuations. The first solution is shorter and neater, but the
second illustrates a generalizable method.

\begin{proof}
[First solution to Exercise \ref{exe.ent.prime.de-polignac.bincoeff}.]We have
$m\leq n+m$ (since $\left(  n+m\right)  -m=n\geq0$). Hence, Theorem
\ref{thm.binom.fac} (applied to $n+m$ and $m$ instead of $n$ and $k$) yields
\[
\dbinom{n+m}{m}=\dfrac{\left(  n+m\right)  !}{m!\cdot\left(  \left(
n+m\right)  -m\right)  !}=\dfrac{\left(  n+m\right)  !}{m!\cdot n!}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  n+m\right)  -m=n\right)  .
\]
However, Theorem \ref{thm.binom.ZZ} (applied to $n+m$ and $m$ instead of $n$
and $k$) yields $\dbinom{n+m}{m}\in\mathbb{Z}$. In view of $\dbinom{n+m}%
{m}=\dfrac{\left(  n+m\right)  !}{m!\cdot n!}$, this rewrites as
$\dfrac{\left(  n+m\right)  !}{m!\cdot n!}\in\mathbb{Z}$. In other words,
$m!\cdot n!\mid\left(  n+m\right)  !$. In other words, $n!m!\mid\left(
n+m\right)  !$ (since $m!\cdot n!=n!m!$). This solves Exercise
\ref{exe.ent.prime.de-polignac.bincoeff}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ent.prime.de-polignac.bincoeff}
(sketched).]Proposition \ref{prop.ent.prime.n|m} (applied to $n!m!$ and
$\left(  n+m\right)  !$ instead of $n$ and $m$) shows that we have
$n!m!\mid\left(  n+m\right)  !$ if and only if each prime $p$ satisfies
$v_{p}\left(  n!m!\right)  \leq v_{p}\left(  \left(  n+m\right)  !\right)  $.
Thus, it suffices to show that each prime $p$ satisfies $v_{p}\left(
n!m!\right)  \leq v_{p}\left(  \left(  n+m\right)  !\right)  $.

Let us show this. Let $p$ be a prime. We must prove that $v_{p}\left(
n!m!\right)  \leq v_{p}\left(  \left(  n+m\right)  !\right)  $. Theorem
\ref{thm.ent.prime.de-polignac} (applied to $n+m$ instead of $n$) yields%
\begin{equation}
v_{p}\left(  \left(  n+m\right)  !\right)  =\sum_{i\geq1}\left\lfloor
\dfrac{n+m}{p^{i}}\right\rfloor .
\label{sol.ent.prime.de-polignac.bincoeff.2nd.2}%
\end{equation}
Also, Theorem \ref{thm.ent.prime.vp-ring} \textbf{(a)} (applied to $a=n!$ and
$b=m!$) yields%
\begin{align}
v_{p}\left(  n!m!\right)   &  =\underbrace{v_{p}\left(  n!\right)
}_{\substack{=\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}}\right\rfloor
\\\text{(by Theorem \ref{thm.ent.prime.de-polignac})}}}+\underbrace{v_{p}%
\left(  m!\right)  }_{\substack{=\sum_{i\geq1}\left\lfloor \dfrac{m}{p^{i}%
}\right\rfloor \\\text{(by Theorem \ref{thm.ent.prime.de-polignac})}%
}}\nonumber\\
&  =\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\sum_{i\geq
1}\left\lfloor \dfrac{m}{p^{i}}\right\rfloor .
\label{sol.ent.prime.de-polignac.bincoeff.2nd.3}%
\end{align}


Recall that our goal is to prove that $v_{p}\left(  n!m!\right)  \leq
v_{p}\left(  \left(  n+m\right)  !\right)  $. In view of
(\ref{sol.ent.prime.de-polignac.bincoeff.2nd.2}) and
(\ref{sol.ent.prime.de-polignac.bincoeff.2nd.3}), this is equivalent to
proving that%
\[
\sum_{i\geq1}\left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\sum_{i\geq
1}\left\lfloor \dfrac{m}{p^{i}}\right\rfloor \leq\sum_{i\geq1}\left\lfloor
\dfrac{n+m}{p^{i}}\right\rfloor .
\]
This would be easy if we knew that we have%
\[
\left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\left\lfloor \dfrac{m}{p^{i}%
}\right\rfloor \leq\left\lfloor \dfrac{n+m}{p^{i}}\right\rfloor
\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\mathbb{N}.
\]
Fortunately, this is indeed the case: We can show that $\left\lfloor
u\right\rfloor +\left\lfloor v\right\rfloor \leq\left\lfloor u+v\right\rfloor
$ for any two reals $u$ and $v$\ \ \ \ \footnote{\textit{Proof.} (See
\cite[Proposition 1.1.13]{floor} for a detailed proof.) Let $u$ and $v$ be two
reals. We have $\left\lfloor u\right\rfloor \leq u$ (by the definition of
$\left\lfloor u\right\rfloor $) and $\left\lfloor v\right\rfloor \leq v$.
Adding these two inequalities together, we obtain $\left\lfloor u\right\rfloor
+\left\lfloor v\right\rfloor \leq u+v$. Hence, $\left\lfloor u\right\rfloor
+\left\lfloor v\right\rfloor $ is an integer that is $\leq u+v$ (since
$\left\lfloor u\right\rfloor +\left\lfloor v\right\rfloor $ is clearly an
integer). But $\left\lfloor u+v\right\rfloor $ is the \textbf{largest} such
integer (by the definition of $\left\lfloor u+v\right\rfloor $). Therefore,
$\left\lfloor u\right\rfloor +\left\lfloor v\right\rfloor \leq\left\lfloor
u+v\right\rfloor $, qed.}. Applying this to $u=\dfrac{n}{p^{i}}$ and
$v=\dfrac{m}{p^{i}}$, we obtain the inequality%
\[
\left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\left\lfloor \dfrac{m}{p^{i}%
}\right\rfloor \leq\left\lfloor \dfrac{n}{p^{i}}+\dfrac{m}{p^{i}}\right\rfloor
=\left\lfloor \dfrac{n+m}{p^{i}}\right\rfloor \ \ \ \ \ \ \ \ \ \ \left(
\text{since }\dfrac{n}{p^{i}}+\dfrac{m}{p^{i}}=\dfrac{n+m}{p^{i}}\right)
\]
for each $i\in\mathbb{N}$. Summing these inequalities over all $i\in\left\{
1,2,3,\ldots\right\}  $, we obtain%
\[
\sum_{i\geq1}\left(  \left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\left\lfloor
\dfrac{m}{p^{i}}\right\rfloor \right)  \leq\sum_{i\geq1}\left\lfloor
\dfrac{n+m}{p^{i}}\right\rfloor .
\]
In view of%
\[
\sum_{i\geq1}\left(  \left\lfloor \dfrac{n}{p^{i}}\right\rfloor +\left\lfloor
\dfrac{m}{p^{i}}\right\rfloor \right)  =\sum_{i\geq1}\left\lfloor \dfrac
{n}{p^{i}}\right\rfloor +\sum_{i\geq1}\left\lfloor \dfrac{m}{p^{i}%
}\right\rfloor =v_{p}\left(  n!m!\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.prime.de-polignac.bincoeff.2nd.3})}\right)
\]
and%
\[
\sum_{i\geq1}\left\lfloor \dfrac{n+m}{p^{i}}\right\rfloor =v_{p}\left(
\left(  n+m\right)  !\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.prime.de-polignac.bincoeff.2nd.2})}\right)  ,
\]
this rewrites as $v_{p}\left(  n!m!\right)  \leq v_{p}\left(  \left(
n+m\right)  !\right)  $. But this is precisely what we wanted to show. Hence,
Exercise \ref{exe.ent.prime.de-polignac.bincoeff} is solved again.
\end{proof}

Let us prove something less straightforward using de Polignac's formula. For
example, let us prove the following (\cite[Exercise 3.25]{detnotes}):

\begin{exercise}
\label{exe.ent.prime.de-polignac.supercat}Let $a,b\in\mathbb{N}$. Prove that
$\dfrac{\left(  2a\right)  !\left(  2b\right)  !}{a!b!\left(  a+b\right)
!}\in\mathbb{Z}$.
\end{exercise}

Better yet, let us prove a more general result:

\begin{exercise}
\label{exe.ent.prime.de-polignac.supercatn}Let $n\in\mathbb{N}$. Let
$q_{1},q_{2},\ldots,q_{n}$ be $n$ positive integers such that $\dfrac{1}%
{q_{1}}+\dfrac{1}{q_{2}}+\cdots+\dfrac{1}{q_{n}}\leq1$. Let $a_{1}%
,a_{2},\ldots,a_{n}$ be $n$ nonnegative integers. Prove that%
\[
\frac{\left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}a_{2}\right)  !\cdot
\cdots\cdot\left(  q_{n}a_{n}\right)  !}{\left(  a_{1}!\right)  ^{q_{1}%
-1}\cdot\left(  a_{2}!\right)  ^{q_{2}-1}\cdot\cdots\cdot\left(
a_{n}!\right)  ^{q_{n}-1}\cdot\left(  a_{1}+a_{2}+\cdots+a_{n}\right)  !}%
\in\mathbb{Z}.
\]

\end{exercise}

Note that Exercise \ref{exe.ent.prime.de-polignac.supercat} is a particular
case of Exercise \ref{exe.ent.prime.de-polignac.supercatn} (namely, the case
for $n=2$ and $q_{1}=2$ and $q_{2}=2$ and $a_{1}=a$ and $a_{2}=b$). Thus,
solving Exercise \ref{exe.ent.prime.de-polignac.supercatn} will automatically
solve Exercise \ref{exe.ent.prime.de-polignac.supercat}.

Before we solve Exercise \ref{exe.ent.prime.de-polignac.supercatn}, we pave
our way with a lemma about floors (which will play a similar role to the
inequality $\left\lfloor u\right\rfloor +\left\lfloor v\right\rfloor
\leq\left\lfloor u+v\right\rfloor $ in our above second solution to Exercise
\ref{exe.ent.prime.de-polignac.bincoeff}):

\begin{lemma}
\label{lem.floor.supercatn}Let $n\in\mathbb{N}$. Let $q_{1},q_{2},\ldots
,q_{n}$ be $n$ positive integers such that $\dfrac{1}{q_{1}}+\dfrac{1}{q_{2}%
}+\cdots+\dfrac{1}{q_{n}}\leq1$. Let $u_{1},u_{2},\ldots,u_{n}$ be $n$ reals.
Then,%
\[
\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor \geq\sum_{i=1}^{n}\left(
q_{i}-1\right)  \left\lfloor u_{i}\right\rfloor +\left\lfloor u_{1}%
+u_{2}+\cdots+u_{n}\right\rfloor .
\]

\end{lemma}

There are various ways to prove this lemma. A particularly easy one proceeds
by WLOG assuming that each of $u_{1},u_{2},\ldots,u_{n}$ belongs to the
half-open interval $\left[  0,1\right)  $ (because subtracting an integer from
any single $u_{i}$ changes both sides of the inequality in question by the
same amount\footnote{This technique is rather similar to the periodicity
argument we used in our second solution to Exercise \ref{exe.floor.hermite}
above (in Subsection \ref{subsect.per.func}).}). In this case, Lemma
\ref{lem.floor.supercatn} quickly boils down to the following:

\begin{lemma}
\label{lem.floor.supercatn01}Let $n\in\mathbb{N}$. Let $q_{1},q_{2}%
,\ldots,q_{n}$ be $n$ positive integers such that $\dfrac{1}{q_{1}}+\dfrac
{1}{q_{2}}+\cdots+\dfrac{1}{q_{n}}\leq1$. Let $u_{1},u_{2},\ldots,u_{n}$ be
$n$ nonnegative reals. Then,%
\[
\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor \geq\left\lfloor
u_{1}+u_{2}+\cdots+u_{n}\right\rfloor .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.floor.supercatn01}.]It is easy to see that Lemma
\ref{lem.floor.supercatn01} holds for $n=0$\ \ \ \ \footnote{\textit{Proof.}
Assume that $n=0$. Then, $u_{1}+u_{2}+\cdots+u_{n}=u_{1}+u_{2}+\cdots
+u_{0}=\left(  \text{empty sum}\right)  =0$, so that $\left\lfloor u_{1}%
+u_{2}+\cdots+u_{n}\right\rfloor =\left\lfloor 0\right\rfloor =0$. Also, from
$n=0$, we obtain%
\[
\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor =\sum_{i=1}^{0}\left\lfloor
q_{i}u_{i}\right\rfloor =\left(  \text{empty sum}\right)  =0\geq0=\left\lfloor
u_{1}+u_{2}+\cdots+u_{n}\right\rfloor
\]
(since $\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor =0$). Thus, we have
proved Lemma \ref{lem.floor.supercatn01} under the assumption that $n=0$.
Qed.}. Hence, for the rest of this proof, we WLOG assume that we don't have
$n=0$. Hence, $n>0$ (since $n\in\mathbb{N}$).

Let $k=\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor $. Thus, $k$ is an
integer (since the floor of any real is an integer). Furthermore, the sum
$u_{1}+u_{2}+\cdots+u_{n}$ is nonnegative (since its addends $u_{1}%
,u_{2},\ldots,u_{n}$ are nonnegative). In other words, $u_{1}+u_{2}%
+\cdots+u_{n}\geq0$. From this, we easily see that $k\geq0$%
\ \ \ \ \footnote{\textit{Proof.} We have $0\leq u_{1}+u_{2}+\cdots+u_{n}$
(since $u_{1}+u_{2}+\cdots+u_{n}\geq0$). Thus, $0$ is an integer that is $\leq
u_{1}+u_{2}+\cdots+u_{n}$.
\par
Recall that $\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor $ was defined
as the \textbf{largest} integer that is $\leq u_{1}+u_{2}+\cdots+u_{n}$.
Hence, if $m$ is an integer that is $\leq u_{1}+u_{2}+\cdots+u_{n}$, then
$\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor \geq m$. Applying this to
$m=0$, we obtain $\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor \geq0$
(since $0$ is an integer that is $\leq u_{1}+u_{2}+\cdots+u_{n}$). Hence,
$k=\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor \geq0$.}.

Now, I claim that at least one $j\in\left\{  1,2,\ldots,n\right\}  $ satisfies
$u_{j}\geq\dfrac{k}{q_{j}}$.

[\textit{Proof:} Assume the contrary. Hence, no $j\in\left\{  1,2,\ldots
,n\right\}  $ satisfies $u_{j}\geq\dfrac{k}{q_{j}}$. In other words, each
$j\in\left\{  1,2,\ldots,n\right\}  $ satisfies $u_{j}<\dfrac{k}{q_{j}}$.
Adding these $n$ inequalities $u_{j}<\dfrac{k}{q_{j}}$ (for $j\in\left\{
1,2,\ldots,n\right\}  $) together, we obtain%
\begin{align*}
\sum_{j=1}^{n}u_{j}  &  <\sum_{j=1}^{n}\dfrac{k}{q_{j}}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n>0\right) \\
&  =\dfrac{k}{q_{1}}+\dfrac{k}{q_{2}}+\cdots+\dfrac{k}{q_{n}}=k\cdot
\underbrace{\left(  \dfrac{1}{q_{1}}+\dfrac{1}{q_{2}}+\cdots+\dfrac{1}{q_{n}%
}\right)  }_{\leq1}\\
&  \leq k\cdot1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }k\geq0\right) \\
&  =k.
\end{align*}


However, (\ref{sol.floor.hermite.lem1}) (applied to $x=\sum_{j=1}^{n}u_{j}$)
yields $\left\lfloor \sum_{j=1}^{n}u_{j}\right\rfloor \leq\sum_{j=1}^{n}%
u_{j}<\left\lfloor \sum_{j=1}^{n}u_{j}\right\rfloor +1$. Hence, $\left\lfloor
\sum_{j=1}^{n}u_{j}\right\rfloor \leq\sum_{j=1}^{n}u_{j}<k$. In view of
$\sum_{j=1}^{n}u_{j}=u_{1}+u_{2}+\cdots+u_{n}$, this rewrites as $\left\lfloor
u_{1}+u_{2}+\cdots+u_{n}\right\rfloor <k$. But this contradicts $\left\lfloor
u_{1}+u_{2}+\cdots+u_{n}\right\rfloor =k$. This contradiction shows that our
assumption was false. Hence, we have proved that at least one $j\in\left\{
1,2,\ldots,n\right\}  $ satisfies $u_{j}\geq\dfrac{k}{q_{j}}$.]

Thus, we know that at least one $j\in\left\{  1,2,\ldots,n\right\}  $
satisfies $u_{j}\geq\dfrac{k}{q_{j}}$. Consider this $j$. Multiplying both
sides of the inequality $u_{j}\geq\dfrac{k}{q_{j}}$ by $q_{j}$, we obtain
$q_{j}u_{j}\geq k$ (since $q_{j}$ is positive). That is, $k\leq q_{j}u_{j}$.
Hence, $k$ is an integer that is $\leq q_{j}u_{j}$ (since $k$ is an integer).
Hence, it easily follows that $\left\lfloor q_{j}u_{j}\right\rfloor \geq
k$\ \ \ \ \footnote{\textit{Proof.} Recall that $\left\lfloor q_{j}%
u_{j}\right\rfloor $ was defined as the \textbf{largest} integer that is $\leq
q_{j}u_{j}$. Hence, if $m$ is an integer that is $\leq q_{j}u_{j}$, then
$\left\lfloor q_{j}u_{j}\right\rfloor \geq m$. Applying this to $m=k$, we
obtain $\left\lfloor q_{j}u_{j}\right\rfloor \geq k$ (since $k$ is an integer
that is $\leq q_{j}u_{j}$).}.

Furthermore, recall again that $u_{1},u_{2},\ldots,u_{n}$ are nonnegative.
Hence, it is easy to see that
\begin{equation}
\left\lfloor q_{i}u_{i}\right\rfloor \geq0\ \ \ \ \ \ \ \ \ \ \text{for each
}i\in\left\{  1,2,\ldots,n\right\}  \label{pf.lem.floor.supercatn01.all-nn}%
\end{equation}
\footnote{\textit{Proof of (\ref{pf.lem.floor.supercatn01.all-nn}):} Let
$i\in\left\{  1,2,\ldots,n\right\}  $. Then, $u_{i}$ is nonnegative (since
$u_{1},u_{2},\ldots,u_{n}$ are nonnegative). Hence, $q_{i}u_{i}$ is
nonnegative (since $q_{i}$ is positive (because $q_{1},q_{2},\ldots,q_{n}$ are
$n$ positive integers)). In other words, $q_{i}u_{i}\geq0$. That is, $0\leq
q_{i}u_{i}$. Thus, $0$ is an integer that is $\leq q_{i}u_{i}$.
\par
Recall that $\left\lfloor q_{i}u_{i}\right\rfloor $ was defined as the
\textbf{largest} integer that is $\leq q_{i}u_{i}$. Hence, if $m$ is an
integer that is $\leq q_{i}u_{i}$, then $\left\lfloor q_{i}u_{i}\right\rfloor
\geq m$. Applying this to $m=0$, we obtain $\left\lfloor q_{i}u_{i}%
\right\rfloor \geq0$ (since $0$ is an integer that is $\leq q_{i}u_{i}$). This
proves (\ref{pf.lem.floor.supercatn01.all-nn}).}. From this, it easily follows
that $\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor \geq\left\lfloor
q_{j}u_{j}\right\rfloor $\ \ \ \ \footnote{\textit{Proof.} We have%
\begin{align*}
\underbrace{\sum_{i=1}^{n}}_{=\sum_{i\in\left\{  1,2,\ldots,n\right\}  }%
}\left\lfloor q_{i}u_{i}\right\rfloor  &  =\sum_{i\in\left\{  1,2,\ldots
,n\right\}  }\left\lfloor q_{i}u_{i}\right\rfloor =\left\lfloor q_{j}%
u_{j}\right\rfloor +\sum_{\substack{i\in\left\{  1,2,\ldots,n\right\}
;\\i\neq j}}\underbrace{\left\lfloor q_{i}u_{i}\right\rfloor }_{\substack{\geq
0\\\text{(by (\ref{pf.lem.floor.supercatn01.all-nn}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split
off the addend for }i=j\text{ from the sum}\right) \\
&  \geq\left\lfloor q_{j}u_{j}\right\rfloor +\underbrace{\sum_{\substack{i\in
\left\{  1,2,\ldots,n\right\}  ;\\i\neq j}}0}_{=0}=\left\lfloor q_{j}%
u_{j}\right\rfloor .
\end{align*}
}. Hence,%
\[
\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor \geq\left\lfloor q_{j}%
u_{j}\right\rfloor \geq k=\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor
.
\]
This proves Lemma \ref{lem.floor.supercatn01}.
\end{proof}

Let us now derive Lemma \ref{lem.floor.supercatn} from Lemma
\ref{lem.floor.supercatn01}:

\begin{proof}
[Proof of Lemma \ref{lem.floor.supercatn}.]For each $i\in\left\{
1,2,\ldots,n\right\}  $, we set $v_{i}=\left\lfloor u_{i}\right\rfloor $ and
$w_{i}=u_{i}-\left\lfloor u_{i}\right\rfloor $. Thus, $v_{1},v_{2}%
,\ldots,v_{n}$ are $n$ integers\footnote{\textit{Proof.} Let $i\in\left\{
1,2,\ldots,n\right\}  $. It is clear that $\left\lfloor x\right\rfloor $ is an
integer for each $x\in\mathbb{R}$. Applying this to $x=u_{i}$, we conclude
that $\left\lfloor u_{i}\right\rfloor $ is an integer. In other words, $v_{i}$
is an integer (since $v_{i}=\left\lfloor u_{i}\right\rfloor $).
\par
Forget that we fixed $i$. We thus have shown that $v_{i}$ is an integer for
each $i\in\left\{  1,2,\ldots,n\right\}  $. In other words, $v_{1}%
,v_{2},\ldots,v_{n}$ are $n$ integers.}. Furthermore, the reals $w_{1}%
,w_{2},\ldots,w_{n}$ are nonnegative\footnote{\textit{Proof.} Let
$i\in\left\{  1,2,\ldots,n\right\}  $. Applying (\ref{sol.floor.hermite.lem1})
to $x=u_{i}$, we obtain $\left\lfloor u_{i}\right\rfloor \leq u_{i}%
<\left\lfloor u_{i}\right\rfloor +1$. Hence, $\left\lfloor u_{i}\right\rfloor
\leq u_{i}$, so that $u_{i}-\left\lfloor u_{i}\right\rfloor \geq0$. Now,
$w_{i}=u_{i}-\left\lfloor u_{i}\right\rfloor \geq0$. In other words, $w_{i}$
is nonnegative.
\par
Forget that we fixed $i$. We thus have shown that $w_{i}$ is nonnegative for
each $i\in\left\{  1,2,\ldots,n\right\}  $. In other words, $w_{1}%
,w_{2},\ldots,w_{n}$ are nonnegative.}. Hence, Lemma
\ref{lem.floor.supercatn01} (applied to $w_{i}$ instead of $u_{i}$) yields%
\begin{equation}
\sum_{i=1}^{n}\left\lfloor q_{i}w_{i}\right\rfloor \geq\left\lfloor
w_{1}+w_{2}+\cdots+w_{n}\right\rfloor . \label{pf.lem.floor.supercatn.w-ineq}%
\end{equation}


However, it is easy to see that each $i\in\left\{  1,2,\ldots,n\right\}  $
satisfies the equality%
\begin{equation}
\left\lfloor q_{i}u_{i}\right\rfloor =\left\lfloor q_{i}w_{i}\right\rfloor
+q_{i}v_{i} \label{pf.lem.floor.supercatn.1}%
\end{equation}
\footnote{\textit{Proof of (\ref{pf.lem.floor.supercatn.1}):} Let
$i\in\left\{  1,2,\ldots,n\right\}  $. Adding the two equalities $w_{i}%
=u_{i}-\left\lfloor u_{i}\right\rfloor $ and $v_{i}=\left\lfloor
u_{i}\right\rfloor $ together, we obtain $w_{i}+v_{i}=\left(  u_{i}%
-\left\lfloor u_{i}\right\rfloor \right)  +\left\lfloor u_{i}\right\rfloor
=u_{i}$.
\par
However, $q_{i}$ is an integer (since $q_{1},q_{2},\ldots,q_{n}$ are $n$
integers), and $v_{i}$ is an integer (since $v_{1},v_{2},\ldots,v_{n}$ are $n$
integers). Thus, the product $q_{i}v_{i}$ of these two integers must also be
an integer. In other words, $q_{i}v_{i}\in\mathbb{Z}$. Therefore,
(\ref{sol.floor.hermite.2nd.C1.pf.1}) (applied to $y=q_{i}w_{i}$ and
$k=q_{i}v_{i}$) yields $\left\lfloor q_{i}w_{i}+q_{i}v_{i}\right\rfloor
=\left\lfloor q_{i}w_{i}\right\rfloor +q_{i}v_{i}$. In view of $q_{i}%
w_{i}+q_{i}v_{i}=q_{i}\underbrace{\left(  w_{i}+v_{i}\right)  }_{=u_{i}}%
=q_{i}u_{i}$, this rewrites as $\left\lfloor q_{i}u_{i}\right\rfloor
=\left\lfloor q_{i}w_{i}\right\rfloor +q_{i}v_{i}$. Qed.}. Hence,%
\begin{align}
\sum_{i=1}^{n}\underbrace{\left\lfloor q_{i}u_{i}\right\rfloor }%
_{\substack{=\left\lfloor q_{i}w_{i}\right\rfloor +q_{i}v_{i}\\\text{(by
(\ref{pf.lem.floor.supercatn.1}))}}}  &  =\sum_{i=1}^{n}\left(  \left\lfloor
q_{i}w_{i}\right\rfloor +q_{i}v_{i}\right)  =\underbrace{\sum_{i=1}%
^{n}\left\lfloor q_{i}w_{i}\right\rfloor }_{\substack{\geq\left\lfloor
w_{1}+w_{2}+\cdots+w_{n}\right\rfloor \\\text{(by
(\ref{pf.lem.floor.supercatn.w-ineq}))}}}+\sum_{i=1}^{n}q_{i}v_{i}\nonumber\\
&  \geq\left\lfloor w_{1}+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}^{n}%
q_{i}v_{i}. \label{pf.lem.floor.supercatn.2}%
\end{align}


On the other hand, it is easy to see that
\begin{equation}
\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor =\left\lfloor w_{1}%
+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}^{n}v_{i}
\label{pf.lem.floor.supercatn.3}%
\end{equation}
\footnote{\textit{Proof of (\ref{pf.lem.floor.supercatn.3}):} The sum
$\sum_{i=1}^{n}v_{i}$ is an integer (since its addends $v_{1},v_{2}%
,\ldots,v_{n}$ are $n$ integers). In other words, $\sum_{i=1}^{n}v_{i}%
\in\mathbb{Z}$. Therefore, (\ref{sol.floor.hermite.2nd.C1.pf.1}) (applied to
$y=\sum_{i=1}^{n}w_{i}$ and $k=\sum_{i=1}^{n}v_{i}$) yields
\[
\left\lfloor \sum_{i=1}^{n}w_{i}+\sum_{i=1}^{n}v_{i}\right\rfloor
=\left\lfloor \sum_{i=1}^{n}w_{i}\right\rfloor +\sum_{i=1}^{n}v_{i}.
\]
In view of%
\begin{align*}
\sum_{i=1}^{n}\underbrace{w_{i}}_{\substack{=u_{i}-\left\lfloor u_{i}%
\right\rfloor \\\text{(by the definition of }w_{i}\text{)}}}+\sum_{i=1}%
^{n}\underbrace{v_{i}}_{\substack{=\left\lfloor u_{i}\right\rfloor \\\text{(by
the definition of }v_{i}\text{)}}}  &  =\sum_{i=1}^{n}\left(  u_{i}%
-\left\lfloor u_{i}\right\rfloor \right)  +\sum_{i=1}^{n}\left\lfloor
u_{i}\right\rfloor \\
&  =\sum_{i=1}^{n}\underbrace{\left(  u_{i}-\left\lfloor u_{i}\right\rfloor
+\left\lfloor u_{i}\right\rfloor \right)  }_{=u_{i}}=\sum_{i=1}^{n}u_{i}\\
&  =u_{1}+u_{2}+\cdots+u_{n},
\end{align*}
this rewrites as%
\[
\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor =\left\lfloor \sum
_{i=1}^{n}w_{i}\right\rfloor +\sum_{i=1}^{n}v_{i}.
\]
In view of $\sum_{i=1}^{n}w_{i}=w_{1}+w_{2}+\cdots+w_{n}$, this rewrites as%
\[
\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor =\left\lfloor w_{1}%
+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}^{n}v_{i}.
\]
Qed.}. On the other hand,%
\[
\sum_{i=1}^{n}\left(  q_{i}-1\right)  \underbrace{\left\lfloor u_{i}%
\right\rfloor }_{\substack{=v_{i}\\\text{(since }v_{i}=\left\lfloor
u_{i}\right\rfloor \\\text{(by the definition of }v_{i}\text{))}}}=\sum
_{i=1}^{n}\left(  q_{i}-1\right)  v_{i}.
\]
Adding (\ref{pf.lem.floor.supercatn.3}) to this equality, we obtain%
\begin{align*}
&  \sum_{i=1}^{n}\left(  q_{i}-1\right)  \left\lfloor u_{i}\right\rfloor
+\left\lfloor u_{1}+u_{2}+\cdots+u_{n}\right\rfloor \\
&  =\sum_{i=1}^{n}\left(  q_{i}-1\right)  v_{i}+\left\lfloor w_{1}%
+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}^{n}v_{i}\\
&  =\left\lfloor w_{1}+w_{2}+\cdots+w_{n}\right\rfloor +\underbrace{\sum
_{i=1}^{n}v_{i}+\sum_{i=1}^{n}\left(  q_{i}-1\right)  v_{i}}_{=\sum_{i=1}%
^{n}\left(  v_{i}+\left(  q_{i}-1\right)  v_{i}\right)  }\\
&  =\left\lfloor w_{1}+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}%
^{n}\underbrace{\left(  v_{i}+\left(  q_{i}-1\right)  v_{i}\right)  }%
_{=q_{i}v_{i}}\\
&  =\left\lfloor w_{1}+w_{2}+\cdots+w_{n}\right\rfloor +\sum_{i=1}^{n}%
q_{i}v_{i}.
\end{align*}
In light of this equality, we can rewrite (\ref{pf.lem.floor.supercatn.2}) as%
\[
\sum_{i=1}^{n}\left\lfloor q_{i}u_{i}\right\rfloor \geq\sum_{i=1}^{n}\left(
q_{i}-1\right)  \left\lfloor u_{i}\right\rfloor +\left\lfloor u_{1}%
+u_{2}+\cdots+u_{n}\right\rfloor .
\]
This proves Lemma \ref{lem.floor.supercatn}.
\end{proof}

At last, we can solve Exercise \ref{exe.ent.prime.de-polignac.supercatn}:

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.de-polignac.supercatn}.]Let $p$ be a
prime. We shall prove that
\begin{align*}
&  v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(
a_{1}+a_{2}+\cdots+a_{n}\right)  !\right) \\
&  \leq v_{p}\left(  \left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}%
a_{2}\right)  !\cdot\cdots\cdot\left(  q_{n}a_{n}\right)  !\right)  .
\end{align*}


Indeed, the $n$ numbers $q_{1}-1,q_{2}-1,\ldots,q_{n}-1$ are nonnegative
integers (since $q_{1},q_{2},\ldots,q_{n}$ are $n$ positive integers). Hence,
$\left(  a_{1}!\right)  ^{q_{1}-1},\left(  a_{2}!\right)  ^{q_{2}-1}%
,\ldots,\left(  a_{n}!\right)  ^{q_{n}-1}$ are $n$ integers. Thus, Corollary
\ref{cor.ent.prime.vp-ringk} (applied to $n$ and $\left(  a_{j}!\right)
^{q_{j}-1}$ instead of $k$ and $a_{j}$) yields%
\begin{align}
&  v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\right) \nonumber\\
&  =v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\right)  +v_{p}\left(
\left(  a_{2}!\right)  ^{q_{2}-1}\right)  +\cdots+v_{p}\left(  \left(
a_{n}!\right)  ^{q_{n}-1}\right) \nonumber\\
&  =\sum_{j=1}^{n}v_{p}\left(  \left(  a_{j}!\right)  ^{q_{j}-1}\right)  .
\label{sol.ent.prime.de-polignac.supercatn.2}%
\end{align}


Now, let $j\in\left\{  1,2,\ldots,n\right\}  $. Then, $q_{j}$ is a positive
integer (since $q_{1},q_{2},\ldots,q_{n}$ are $n$ positive integers). Hence,
$q_{j}-1\in\mathbb{N}$. Thus, Corollary \ref{cor.ent.prime.vp-pow} (applied to
$a_{j}!$ and $q_{j}-1$ instead of $a$ and $k$) yields%
\begin{align}
v_{p}\left(  \left(  a_{j}!\right)  ^{q_{j}-1}\right)   &  =\left(
q_{j}-1\right)  \underbrace{v_{p}\left(  a_{j}!\right)  }_{\substack{=\sum
_{i\geq1}\left\lfloor \dfrac{a_{j}}{p^{i}}\right\rfloor \\\text{(by Theorem
\ref{thm.ent.prime.de-polignac},}\\\text{applied to }a_{j}\text{ instead of
}n\text{)}}}\nonumber\\
&  =\left(  q_{j}-1\right)  \sum_{i\geq1}\left\lfloor \dfrac{a_{j}}{p^{i}%
}\right\rfloor =\sum_{i\geq1}\left(  q_{j}-1\right)  \left\lfloor \dfrac
{a_{j}}{p^{i}}\right\rfloor . \label{sol.ent.prime.de-polignac.supercatn.3}%
\end{align}


Forget that we fixed $j$. We thus have proved
(\ref{sol.ent.prime.de-polignac.supercatn.3}) for each $j\in\left\{
1,2,\ldots,n\right\}  $. Thus, (\ref{sol.ent.prime.de-polignac.supercatn.2})
becomes%
\begin{align}
&  v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\right) \nonumber\\
&  =\sum_{j=1}^{n}\underbrace{v_{p}\left(  \left(  a_{j}!\right)  ^{q_{j}%
-1}\right)  }_{\substack{=\sum_{i\geq1}\left(  q_{j}-1\right)  \left\lfloor
\dfrac{a_{j}}{p^{i}}\right\rfloor \\\text{(by
(\ref{sol.ent.prime.de-polignac.supercatn.3}))}}}=\underbrace{\sum_{j=1}%
^{n}\ \ \sum_{i\geq1}}_{=\sum_{i\geq1}\ \ \sum_{j=1}^{n}}\left(
q_{j}-1\right)  \left\lfloor \dfrac{a_{j}}{p^{i}}\right\rfloor \nonumber\\
&  =\sum_{i\geq1}\ \ \sum_{j=1}^{n}\left(  q_{j}-1\right)  \left\lfloor
\dfrac{a_{j}}{p^{i}}\right\rfloor .
\label{sol.ent.prime.de-polignac.supercatn.4}%
\end{align}


Theorem \ref{thm.ent.prime.vp-ring} \textbf{(a)} (applied to $a=\left(
a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)  ^{q_{2}-1}\cdot
\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}$ and $b=\left(  a_{1}%
+a_{2}+\cdots+a_{n}\right)  !$) yields%
\begin{align}
&  v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(
a_{1}+a_{2}+\cdots+a_{n}\right)  !\right) \nonumber\\
&  =\underbrace{v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(
a_{2}!\right)  ^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}%
-1}\right)  }_{\substack{=\sum_{i\geq1}\ \ \sum_{j=1}^{n}\left(
q_{j}-1\right)  \left\lfloor \dfrac{a_{j}}{p^{i}}\right\rfloor \\\text{(by
(\ref{sol.ent.prime.de-polignac.supercatn.4}))}}}+\underbrace{v_{p}\left(
\left(  a_{1}+a_{2}+\cdots+a_{n}\right)  !\right)  }_{\substack{=\sum_{i\geq
1}\left\lfloor \dfrac{a_{1}+a_{2}+\cdots+a_{n}}{p^{i}}\right\rfloor
\\\text{(by Theorem \ref{thm.ent.prime.de-polignac},}\\\text{applied to }%
a_{1}+a_{2}+\cdots+a_{n}\text{ instead of }n\text{)}}}\nonumber\\
&  =\sum_{i\geq1}\ \ \sum_{j=1}^{n}\left(  q_{j}-1\right)  \left\lfloor
\dfrac{a_{j}}{p^{i}}\right\rfloor +\sum_{i\geq1}\left\lfloor \dfrac
{a_{1}+a_{2}+\cdots+a_{n}}{p^{i}}\right\rfloor \nonumber\\
&  =\sum_{i\geq1}\left(  \sum_{j=1}^{n}\left(  q_{j}-1\right)  \left\lfloor
\dfrac{a_{j}}{p^{i}}\right\rfloor +\left\lfloor \dfrac{a_{1}+a_{2}%
+\cdots+a_{n}}{p^{i}}\right\rfloor \right) \nonumber\\
&  =\sum_{s\geq1}\left(  \sum_{i=1}^{n}\left(  q_{i}-1\right)  \left\lfloor
\dfrac{a_{i}}{p^{s}}\right\rfloor +\left\lfloor \dfrac{a_{1}+a_{2}%
+\cdots+a_{n}}{p^{s}}\right\rfloor \right)
\label{sol.ent.prime.de-polignac.supercatn.bot}%
\end{align}
(here, we have renamed the summation indices $i$ and $j$ of the two sums as
$s$ and $i$, respectively).

On the other hand, $\left(  q_{1}a_{1}\right)  !,\left(  q_{2}a_{2}\right)
!,\ldots,\left(  q_{n}a_{n}\right)  !$ are $n$ integers. Thus, Corollary
\ref{cor.ent.prime.vp-ringk} (applied to $n$ and $\left(  q_{j}a_{j}\right)
!$ instead of $k$ and $a_{j}$) yields%
\begin{align*}
&  v_{p}\left(  \left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}a_{2}\right)
!\cdot\cdots\cdot\left(  q_{n}a_{n}\right)  !\right) \\
&  =v_{p}\left(  \left(  q_{1}a_{1}\right)  !\right)  +v_{p}\left(  \left(
q_{2}a_{2}\right)  !\right)  +\cdots+v_{p}\left(  \left(  q_{n}a_{n}\right)
!\right) \\
&  =\sum_{j=1}^{n}\underbrace{v_{p}\left(  \left(  q_{j}a_{j}\right)
!\right)  }_{\substack{=\sum_{i\geq1}\left\lfloor \dfrac{q_{j}a_{j}}{p^{i}%
}\right\rfloor \\\text{(by Theorem \ref{thm.ent.prime.de-polignac}%
,}\\\text{applied to }q_{j}a_{j}\text{ instead of }n\text{)}}%
}=\underbrace{\sum_{j=1}^{n}\ \ \sum_{i\geq1}}_{=\sum_{i\geq1}\ \ \sum
_{j=1}^{n}}\underbrace{\left\lfloor \dfrac{q_{j}a_{j}}{p^{i}}\right\rfloor
}_{\substack{=\left\lfloor q_{j}\cdot\dfrac{a_{j}}{p^{i}}\right\rfloor
\\\text{(since }\dfrac{q_{j}a_{j}}{p^{i}}=q_{j}\cdot\dfrac{a_{j}}{p^{i}%
}\text{)}}}\\
&  =\sum_{i\geq1}\ \ \sum_{j=1}^{n}\left\lfloor q_{j}\cdot\dfrac{a_{j}}{p^{i}%
}\right\rfloor =\sum_{s\geq1}\ \ \underbrace{\sum_{i=1}^{n}\left\lfloor
q_{i}\cdot\dfrac{a_{i}}{p^{s}}\right\rfloor }_{\substack{\geq\sum_{i=1}%
^{n}\left(  q_{i}-1\right)  \left\lfloor \dfrac{a_{i}}{p^{s}}\right\rfloor
+\left\lfloor \dfrac{a_{1}}{p^{s}}+\dfrac{a_{2}}{p^{s}}+\cdots+\dfrac{a_{n}%
}{p^{s}}\right\rfloor \\\text{(by Lemma \ref{lem.floor.supercatn}, applied to
}u_{i}=\dfrac{a_{i}}{p^{s}}\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the summation indices }i\text{ and }j\\
\text{of the two sums as }s\text{ and }i\text{, respectively}%
\end{array}
\right) \\
&  \geq\sum_{s\geq1}\left(  \sum_{i=1}^{n}\left(  q_{i}-1\right)  \left\lfloor
\dfrac{a_{i}}{p^{s}}\right\rfloor +\left\lfloor \dfrac{a_{1}}{p^{s}}%
+\dfrac{a_{2}}{p^{s}}+\cdots+\dfrac{a_{n}}{p^{s}}\right\rfloor \right) \\
&  =\sum_{s\geq1}\left(  \sum_{i=1}^{n}\left(  q_{i}-1\right)  \left\lfloor
\dfrac{a_{i}}{p^{s}}\right\rfloor +\left\lfloor \dfrac{a_{1}+a_{2}%
+\cdots+a_{n}}{p^{s}}\right\rfloor \right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\dfrac{a_{1}%
}{p^{s}}+\dfrac{a_{2}}{p^{s}}+\cdots+\dfrac{a_{n}}{p^{s}}=\dfrac{a_{1}%
+a_{2}+\cdots+a_{n}}{p^{s}}\text{ for any }s\geq1\right) \\
&  =v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(
a_{1}+a_{2}+\cdots+a_{n}\right)  !\right)
\end{align*}
(by (\ref{sol.ent.prime.de-polignac.supercatn.bot})).

Forget that we fixed $p$. We thus have shown that each prime $p$ satisfies%
\begin{align*}
&  v_{p}\left(  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(
a_{1}+a_{2}+\cdots+a_{n}\right)  !\right) \\
&  \leq v_{p}\left(  \left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}%
a_{2}\right)  !\cdot\cdots\cdot\left(  q_{n}a_{n}\right)  !\right)  .
\end{align*}
Thus, Proposition \ref{prop.ent.prime.n|m} (applied to $\left(  a_{1}!\right)
^{q_{1}-1}\cdot\left(  a_{2}!\right)  ^{q_{2}-1}\cdot\cdots\cdot\left(
a_{n}!\right)  ^{q_{n}-1}\cdot\left(  a_{1}+a_{2}+\cdots+a_{n}\right)  !$ and
$\left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}a_{2}\right)  !\cdot\cdots
\cdot\left(  q_{n}a_{n}\right)  !$ instead of $n$ and $m$) entails that%
\begin{align*}
&  \left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)  ^{q_{2}%
-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(  a_{1}%
+a_{2}+\cdots+a_{n}\right)  !\\
&  \mid\left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}a_{2}\right)
!\cdot\cdots\cdot\left(  q_{n}a_{n}\right)  !.
\end{align*}
In other words,%
\[
\frac{\left(  q_{1}a_{1}\right)  !\cdot\left(  q_{2}a_{2}\right)  !\cdot
\cdots\cdot\left(  q_{n}a_{n}\right)  !}{\left(  a_{1}!\right)  ^{q_{1}%
-1}\cdot\left(  a_{2}!\right)  ^{q_{2}-1}\cdot\cdots\cdot\left(
a_{n}!\right)  ^{q_{n}-1}\cdot\left(  a_{1}+a_{2}+\cdots+a_{n}\right)  !}%
\in\mathbb{Z}%
\]
(since $\left(  a_{1}!\right)  ^{q_{1}-1}\cdot\left(  a_{2}!\right)
^{q_{2}-1}\cdot\cdots\cdot\left(  a_{n}!\right)  ^{q_{n}-1}\cdot\left(
a_{1}+a_{2}+\cdots+a_{n}\right)  !$ is positive and thus nonzero). This solves
Exercise \ref{exe.ent.prime.de-polignac.supercatn}.
\end{proof}

As we already mentioned, Exercise \ref{exe.ent.prime.de-polignac.supercat} is
a particular case of Exercise \ref{exe.ent.prime.de-polignac.supercatn}.
However, Exercise \ref{exe.ent.prime.de-polignac.supercat} can also be proved
algebraically, via binomial identities. (See \cite[Exercise 3.25 \textbf{(b)}%
]{detnotes} for such a proof\footnote{In more detail: The number
$\dfrac{\left(  2a\right)  !\left(  2b\right)  !}{a!b!\left(  a+b\right)  !}$
is what is called $T\left(  a,b\right)  $ in \cite[Exercise 3.25]{detnotes}.
Thus, \cite[Exercise 3.25 \textbf{(b)}]{detnotes} (applied to $m=a$ and $n=b$)
shows that $\dfrac{\left(  2a\right)  !\left(  2b\right)  !}{a!b!\left(
a+b\right)  !}\in\mathbb{N}\subseteq\mathbb{Z}$.}, and \cite[Exercise
3.25]{detnotes} for further properties of $\dfrac{\left(  2a\right)  !\left(
2b\right)  !}{a!b!\left(  a+b\right)  !}$.) I am not aware of a similar
solution to Exercise \ref{exe.ent.prime.de-polignac.supercatn}.

\subsubsection{\label{subsect.hw10b}Homework set \#10B: More about primes and
numbers}

Again, this homework set is optional.

\begin{exercise}
\label{exe.ent.num-divs}Let $n\in\mathbb{Z}$ be nonzero. Prove the following:

\textbf{(a)} The product $\prod_{p\text{ prime}}\left(  v_{p}\left(  n\right)
+1\right)  $ is well-defined, since only finitely many of its factors are
different from $1$.

\textbf{(b)} We have
\[
\left(  \text{the number of positive divisors of }n\right)  =\prod_{p\text{
prime}}\left(  v_{p}\left(  n\right)  +1\right)
\]
and%
\[
\left(  \text{the number of divisors of }n\right)  =2\prod_{p\text{ prime}%
}\left(  v_{p}\left(  n\right)  +1\right)  .
\]

\end{exercise}

The next exercise extends the notion of the $p$-adic valuation of an integer
to a rational number:

\begin{exercise}
\label{exe.ent.p-val.wp}Fix a prime $p$. For each nonzero rational number $r$,
define an integer $w_{p}\left(  r\right)  $ (called the \textit{extended
$p$-adic valuation} of $r$) as follows: We write $r$ in the form $r=a/b$ for
two nonzero integers $a$ and $b$, and we set $w_{p}\left(  r\right)
=v_{p}\left(  a\right)  -v_{p}\left(  b\right)  $. (It also makes sense to set
$w_{p}\left(  0\right)  =\infty$, but we shall not concern ourselves with this
border case in this exercise.)

\textbf{(a)} Prove that this is well-defined -- i.e., that $w_{p}\left(
r\right)  $ does not depend on the precise choice of $a$ and $b$ satisfying
$r=a/b$.

\textbf{(b)} Prove that $w_{p}\left(  n\right)  =v_{p}\left(  n\right)  $ for
each nonzero integer $n$.

\textbf{(c)} Prove that $w_{p}\left(  ab\right)  =w_{p}\left(  a\right)
+w_{p}\left(  b\right)  $ for any two nonzero rational numbers $a$ and $b$.

\textbf{(d)} Prove that $w_{p}\left(  a+b\right)  \geq\min\left\{
w_{p}\left(  a\right)  ,w_{p}\left(  b\right)  \right\}  $ for any two nonzero
rational numbers $a$ and $b$ if $a+b\neq0$.

\textbf{(e)} Prove that $r=\prod_{p\text{ prime}}p^{w_{p}\left(  r\right)  }$
for any positive rational number $r$. (This is a generalization of the
canonical factorization to rational numbers.)
\end{exercise}

The following exercise is a generalization of Exercise
\ref{exe.chip.abelkonkabc}:

\begin{exercise}
\label{exe.chip.abelkonkabc2}Let $n$ and $u$ be positive integers. Let
$a_{1},a_{2},\ldots,a_{u}$ be any integers. Set $a_{u+1}=a_{1}$. Assume that%
\[
a_{i}\mid a_{i+1}^{n}\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left[  u\right]
.
\]
Set $m=n^{u-1}+n^{u-2}+\cdots+n^{0}$. Prove that%
\[
a_{1}a_{2}\cdots a_{u}\mid\left(  a_{1}+a_{2}+\cdots+a_{u}\right)  ^{m}.
\]

\end{exercise}

\begin{noncompile}
Idea: Fix a prime $p$. Set $k_{i}=v_{p}\left(  a_{i}\right)  $. Then,
$nk_{i+1}\geq k_{i}$ for all $i$. Use this to show that $mk_{\min}\geq
k_{1}+k_{2}+\cdots+k_{u}$.

This does not yet show the graph-theoretical version, but is already pretty strong.
\end{noncompile}

The next two exercises are parts of what is known as
\href{https://en.wikipedia.org/wiki/Lifting-the-exponent_lemma}{the
\textit{lifting-the-exponent lemma}}:

\begin{exercise}
\label{exe.ent.lte.1}Let $p$ be a nonnegative integer (not necessarily prime).
Let $a$ and $b$ be two integers such that $a\equiv b\operatorname{mod}p$.

\textbf{(a)} Prove that $a^{p}\equiv b^{p}\operatorname{mod}p^{2}$.

\textbf{(b)} Prove that $a^{p^{i}}\equiv b^{p^{i}}\operatorname{mod}p^{i+1}$
for each $i\in\mathbb{N}$. (Keep in mind that $a^{p^{i}}$ means $a^{\left(
p^{i}\right)  }$.)
\end{exercise}

\begin{exercise}
\label{exe.ent.lte.2}Let $p$ be a prime. Let $a$ and $b$ be two integers such
that $a\equiv b\not \equiv 0\operatorname{mod}p$. Let $n$ be a positive integer.

\textbf{(a)} Prove that $v_{p}\left(  a^{n}-b^{n}\right)  \geq v_{p}\left(
a-b\right)  +v_{p}\left(  n\right)  $.

\textbf{(b)} Prove that $v_{p}\left(  a^{n}-b^{n}\right)  =v_{p}\left(
a-b\right)  +v_{p}\left(  n\right)  $ if $p\neq2$.

\textbf{(c)} Prove that $v_{p}\left(  a^{n}-b^{n}\right)  =v_{p}\left(
a-b\right)  +v_{p}\left(  n\right)  $ if $p=2$ and $a\equiv
b\operatorname{mod}4$.

\textbf{(d)} Find an example where $p=2$ and $a\equiv b\operatorname{mod}2$
and $v_{p}\left(  a^{n}-b^{n}\right)  >v_{p}\left(  a-b\right)  +v_{p}\left(
n\right)  $.
\end{exercise}

See \url{https://brilliant.org/wiki/lifting-the-exponent} or \cite[\S 3.5]%
{AndDosS} or \cite[OTIS Excerpts, Chapter 13]{ChenEvan} or \cite{Parvar11} for
applications of Exercise \ref{exe.ent.lte.2}.

The next two exercises are connected to $p$-valuations of factorials:

\begin{exercise}
\label{exe.ent.prime.de-polignac.Ncfac}Let $p$ be a prime. Let $k\in
\mathbb{N}$. Let $N=p^{k}-1$. Let $c\in\left\{  1,2,\ldots,p^{k}\right\}  $.
Prove that%
\[
v_{p}\left(  \left(  Nc\right)  !\right)  =c\left(  p^{0}+p^{1}+\cdots
+p^{k-1}\right)  -k.
\]

\end{exercise}

\begin{noncompile}
This is the Corollary from
\href{https://math.stackexchange.com/questions/2887978/binomial-coefficients-involving-prime-powers-minus-1/2896848#2896848}{https://math.stackexchange.com/questions/2887978/binomial-coefficients-involving-prime-powers-minus-1/2896848\#2896848}
.
\end{noncompile}

\begin{exercise}
\label{exe.ent.prime.de-polignac.mp}Let $n\in\mathbb{N}$ be odd. Let
$m=\left(  n-1\right)  /2$. Let $k\in\mathbb{N}$. Let $a_{1},a_{2}%
,\ldots,a_{k}$ be nonnegative integers.

\textbf{(a)} Prove that the number%
\[
\dfrac{\left(  na_{1}\right)  !\left(  na_{2}\right)  !\cdots\left(
na_{k}\right)  !}{a_{1}!a_{2}!\cdots a_{k}!\cdot\left(  \left(  a_{1}%
+a_{2}\right)  !\right)  ^{m}\left(  \left(  a_{2}+a_{3}\right)  !\right)
^{m}\cdots\left(  \left(  a_{k-1}+a_{k}\right)  !\right)  ^{m}\left(  \left(
a_{k}+a_{1}\right)  !\right)  ^{m}}%
\]
is an integer.

\textbf{(b)} Show that this integer furthermore is divisible by
$n^{k-\left\lfloor k/2\right\rfloor }$ when $n$ is prime and $a_{1}%
,a_{2},\ldots,a_{k}$ are positive.
\end{exercise}

\begin{noncompile}
This was my quest\#98. It is from
http://matheplanet.com/matheplanet/nuke/html/viewtopic.php?topic=99616 .
\end{noncompile}

The next exercise gives yet another variation on Fermat's Little Theorem:

\begin{exercise}
\label{exe.ent.ML225}Let $a\in\mathbb{Z}$ and $n\in\mathbb{N}$. Prove that%
\[
n!\mid\prod_{k=0}^{n-1}\left(  a^{n}-a^{k}\right)  .
\]

\end{exercise}

\begin{fineprint}
This might sound familiar to algebraists: Indeed, if $a$ is prime, then
$\prod_{k=0}^{n-1}\left(  a^{n}-a^{k}\right)  $ is the order of the general
linear group $\operatorname*{GL}\nolimits_{n}\left(  \mathbb{F}_{a}\right)  $
over the finite field $\mathbb{F}_{a}$, whereas $n!$ is the order of the
symmetric group $S_{n}$. Thus, if $a$ is prime, then Exercise
\ref{exe.ent.ML225} follows from Lagrange's theorem, as the symmetric group
$S_{n}$ embeds as a subgroup into $\operatorname*{GL}\nolimits_{n}\left(
\mathbb{F}_{a}\right)  $ (via the embedding that identifies each permutation
with its permutation matrix). More generally, this argument can be made when
$a$ is a power of a prime (not necessarily a prime itself), since there is a
finite field of size $a$ in this case. However, this slick argument does not
work when $a$ is not a power of a prime. I am not aware of any way how to
generalize it to arbitrary $a$; it appears to be a dead end, at least if
solving Exercise \ref{exe.ent.ML225} for general $a$ is the goal.
\end{fineprint}

\begin{noncompile}
Exercise \ref{exe.ent.ML225} is
\href{https://artofproblemsolving.com/community/c6h225}{ML topic \#225}. Prove
using $p$-valuations.
\end{noncompile}

The following exercise is an analogue of Proposition
\ref{prop.ent.prime.vp-gcd} for lowest common multiples\footnote{See Section
\ref{sect.ent.lcm} for the definition of lowest common multiples and their
most important properties.}:

\begin{exercise}
\label{exe.ent.prime.vp-lcm}Let $p$ be a prime. Let $k$ be a positive integer.
Let $n_{1},n_{2},\ldots,n_{k}$ be $k$ integers. Then,%
\[
v_{p}\left(  \operatorname{lcm}\left(  n_{1},n_{2},\ldots,n_{k}\right)
\right)  =\max\left\{  v_{p}\left(  n_{1}\right)  ,v_{p}\left(  n_{2}\right)
,\ldots,v_{p}\left(  n_{k}\right)  \right\}  .
\]

\end{exercise}

The following exercise is Problem B3 from the Putnam contest 2003:

\begin{exercise}
\label{exe.ent.nfac-as-lcm}Let $n\in\mathbb{N}$. Prove that%
\[
n!=\prod_{k=1}^{n}\operatorname{lcm}\left(  1,2,\ldots,\left\lfloor \dfrac
{n}{k}\right\rfloor \right)  .
\]

\end{exercise}

\begin{noncompile}
https://prase.cz/kalva/putnam/psoln/psol039.html
\end{noncompile}

See \cite[OTIS Excerpts, Chapter 13]{ChenEvan} and \cite[Chapter 3]{AndDos}
and \cite[Chapter 3]{AndDosS} for more about $p$-valuations.

The next exercise expands on the idea of Exercise
\ref{exe.ent.prime.dirichlet.easy2}:

\begin{exercise}
\label{exe.ent.prime.dirichlet.easy}Prove the following:

\textbf{(a)} There are infinitely many primes $p$ that satisfy $p\equiv
3\operatorname{mod}4$.

\textbf{(b)} There are infinitely many primes $p$ that satisfy $p\equiv
5\operatorname{mod}6$.
\end{exercise}

\begin{noncompile}
Both parts of this are in kim-NT/sol1/14.
\end{noncompile}

We note that Exercise \ref{exe.ent.prime.dirichlet.easy2} and both parts of
Exercise \ref{exe.ent.prime.dirichlet.easy} are particular cases of
\textit{\href{https://en.wikipedia.org/wiki/Dirichlet's_theorem_on_arithmetic_progressions}{\textit{Dirichlet's
theorem}}}, which says that if $a$ and $b>0$ are two coprime integers, then
there are infinitely many primes $p$ that satisfy $p\equiv a\operatorname{mod}%
b$. This theorem is deep and difficult (all known proofs use some kind of
analysis, often complex); the three particular cases we just mentioned are
among the few cases that have known simple proofs.

The next exercise generalizes Exercise \ref{exe.ent.prime.sum-ik-1}:

\begin{exercise}
\label{exe.ent.prime.sum-ik-2}Let $p$ be a prime. Let $k\in\mathbb{N}$ be such
that $k$ is not a positive multiple of $p-1$. Prove that $\sum_{i=0}%
^{p-1}i^{k}\equiv0\operatorname{mod}p$.
\end{exercise}

\begin{noncompile}
This is \cite[Theorem 3.1]{lucascong}.
\end{noncompile}

The next exercise is a fundamental property of the Euler totient function,
originally found by Gauss:

\begin{exercise}
\label{exe.ent.phi.gauss-sum}For any positive integer $n$, we let $\phi\left(
n\right)  $ denote the number of all $i\in\left\{  1,2,\ldots,n\right\}  $
satisfying $i\perp n$.

Prove that
\[
\sum_{d\mid n}\phi\left(  d\right)  =n\ \ \ \ \ \ \ \ \ \ \text{for any
positive integer }n.
\]
Here, the summation sign \textquotedblleft$\sum_{d\mid n}$\textquotedblright%
\ means a sum over all \textbf{positive} divisors $d$ of $n$. (For example,
$\sum_{d\mid15}\phi\left(  d\right)  =\phi\left(  1\right)  +\phi\left(
3\right)  +\phi\left(  5\right)  +\phi\left(  15\right)  $.)
\end{exercise}

The next exercise is somewhat similar to Exercise \ref{exe.ent.ab=cn.pos}: It
says that any equality of the form $ab=cd$, where $a,b,c,d$ are integers, can
be \textquotedblleft explained\textquotedblright\ by decomposing $a,b,c,d$
further into products.

\begin{exercise}
\label{exe.ent.ab=cd-decompose}Let $a,b,c,d$ be four integers such that
$ab=cd$. Prove that there exist four integers $x,y,z,w$ such that%
\[
a=xy,\ \ \ \ \ \ \ \ \ \ b=zw,\ \ \ \ \ \ \ \ \ \ c=xz,\ \ \ \ \ \ \ \ \ \ d=yw.
\]

\end{exercise}

\begin{noncompile}
Proofs: elementary; prime fac; rank-1 matrix.

Elementary proof: If $a=0$, distinguish between $c=0$ and $d=0$, and do each
case explicitly.

If $a\neq0$, set $g=\gcd\left(  a,d\right)  $ and set $x=a/g$ and $y=g$ and
$z=cg/a$ and $w=d/g$. Use Theorem \ref{thm.ent.gcd.cancel} to show that $z$ is
an integer.
\end{noncompile}

The next exercise is one of the simplest forms of what is known as the
\textit{Chinese Remainder Theorem}:

\begin{exercise}
\label{exe.ent.crt2.bij}Let $m$ and $n$ be two positive integers. Prove that
the map%
\begin{align*}
\left\{  0,1,\ldots,mn-1\right\}   &  \rightarrow\left\{  0,1,\ldots
,m-1\right\}  \times\left\{  0,1,\ldots,n-1\right\}  ,\\
i  &  \mapsto\left(  i\%m,\ i\%n\right)
\end{align*}
is a bijection if and only if $m$ and $n$ are coprime.
\end{exercise}

The Chinese Remainder Theorem has several more advanced forms, but even
Exercise \ref{exe.ent.crt2.bij} has many uses. Here is just one application:

\begin{exercise}
\label{exe.ent.phi.multi}For any positive integer $n$, we let $\phi\left(
n\right)  $ denote the number of all $i\in\left\{  1,2,\ldots,n\right\}  $
satisfying $i\perp n$.

Prove that $\phi\left(  mn\right)  =\phi\left(  m\right)  \cdot\phi\left(
n\right)  $ for any two coprime positive integers $m$ and $n$.
\end{exercise}

Exercise \ref{exe.ent.phi.multi} is known as the \textit{multiplicativity of
the Euler totient function}. One of its consequences is the following
\textquotedblleft explicit\textquotedblright\ formula for $\phi\left(
n\right)  $:

\begin{exercise}
\label{exe.ent.phi.explicit}Let $n$ be a positive integer. Let $\phi\left(
n\right)  $ denote the number of all $i\in\left\{  1,2,\ldots,n\right\}  $
satisfying $i\perp n$. Prove that%
\[
\phi\left(  n\right)  =\prod_{\substack{p\text{ prime;}\\p\mid n}}\left(
\left(  p-1\right)  p^{v_{p}\left(  n\right)  -1}\right)  =n\cdot
\prod_{\substack{p\text{ prime;}\\p\mid n}}\left(  1-\dfrac{1}{p}\right)  .
\]

\end{exercise}

Finally, a complex-looking but not particularly difficult exercise:

\begin{exercise}
\label{exe.ent.vp-nonprime}Assume that $p$ is no longer required to be a prime
in Definition \ref{def.ent.prime.vp}, but is merely assumed to be an integer
$>1$. Which of the above properties of $p$-valuations remain true, and which
become false? Specifically, analyze Lemma \ref{lem.ent.prime.vp-def},
Corollary \ref{cor.ent.prime.vp-0}, Lemma \ref{lem.ent.prime.vp-copr}, Theorem
\ref{thm.ent.prime.vp-ring}, Proposition \ref{prop.ent.prime.vp-gcd} and
Exercise \ref{exe.ent.prime.vp-lcm}.
\end{exercise}

\appendix


\newpage

\section{Discussion of homework questions}

\subsection{\label{sect.ind.hw0s}Homework set \#0 discussion}

The following are discussions of the problems on homework set \#0 (Section
\ref{sect.intro.hw0}). I distinguish \textquotedblleft
discussion\textquotedblright\ from \textquotedblleft
solution\textquotedblright\ in that a solution is a (usually rather rigorous)
mathematical proof while a \textquotedblleft discussion\textquotedblright\ is
an (often informal) piece of writing that (at least hopefully) explains how a
solution can be obtained. Thus, a discussion can be both less than a solution
(as it can omit certain straightforward arguments that a solution would have
to include) and more than a solution (as it can talk about the motivation
behind the solution and about how similar problems can be solved). I hope my
discussions will be more instructive than pure (unmotivated) solutions would
be, while still being sufficiently rigorous that you won't have much trouble
turning them into full solutions. As always, there is no guarantee that I will
succeed at these goals. Let me know of any unclarities and errors!

\subsubsection{Discussion of Exercise \ref{exe.fac.reddit}}

\begin{proof}
[Discussion of Exercise \ref{exe.fac.reddit}.]The obvious thing to do against
such a problem is to check small values of $n$ and see what the corresponding
$q$'s are. This is somewhat complicated by the fact that for some $n$'s, there
are several $q$'s that work. Here is a table:%
\[%
\begin{tabular}
[c]{|cc|}\hline
$n$ & \multicolumn{1}{|c|}{values of $q$}\\\hline
\multicolumn{1}{|c|}{$2$} & $2$\\
\multicolumn{1}{|c|}{$4$} & $3,4$\\
\multicolumn{1}{|c|}{$6$} & $6$\\
\multicolumn{1}{|c|}{$8$} & $8,9$\\
\multicolumn{1}{|c|}{$10$} & $10$\\
\multicolumn{1}{|c|}{$12$} & $12$\\\hline
\end{tabular}
\]
(You don't need a computer to create this table; it is easy to do these
calculations by \textquotedblleft casting out squares\textquotedblright:
Indeed, basic number theory (of which we will probably see more as this course
progresses) says that for any two nonzero integers $a$ and $b$, we have the
equivalence%
\[
\left(  a^{2}b\text{ is a perfect square}\right)  \Longleftrightarrow\left(
b\text{ is a perfect square}\right)  .
\]
\footnote{To wit, the \textquotedblleft$\Longleftarrow$\textquotedblright%
\ direction of this equivalence is obvious, while the \textquotedblleft%
$\Longrightarrow$\textquotedblright\ direction is easiest to prove using the
uniqueness of prime decomposition.} Hence, if we have a product of nonzero
integers and we want to know whether this product is a square, we can
\textquotedblleft cancel\textquotedblright\ any squares from this product.
Thus, for example, we can see that $\dfrac{1!\cdot2!\cdot\cdots\cdot\left(
2\cdot2\right)  !}{3!}$ is not a perfect square by observing that%
\begin{align*}
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2\cdot2\right)  !}{2!}  &
=\dfrac{1!\cdot2!\cdot3!\cdot4!}{3!}=\underbrace{1!}_{=1}\cdot\underbrace{2!}%
_{=1\cdot2}\cdot\underbrace{4!}_{=1\cdot2\cdot3\cdot4}=1\cdot1\cdot
2\cdot1\cdot2\cdot3\cdot4\\
&  =2^{2}\cdot3\cdot4^{2}\sim3,
\end{align*}
where in the last step we have \textquotedblleft cancelled\textquotedblright%
\ the perfect squares $2^{2}$ and $4^{2}$. If you \textquotedblleft
cancel\textquotedblright\ strategically, you can do these computations fairly
quickly, as any two successive factorials $k!$ and $\left(  k+1\right)  !$
mostly \textquotedblleft cancel\textquotedblright\ each other.)

Based on the above table, it appears that $q=n$ always does the job (although
sometimes there is a second value that also does it). So we need to prove that%
\begin{equation}
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{n!}\text{ is a perfect
square.} \label{sol.fac.reddit.nclaim}%
\end{equation}
To do this, we shall try to combine as many factors as we can into perfect
squares (inspired by our above \textquotedblleft cancelling\textquotedblright%
\ strategy). To wit, the numerator of our fraction is%
\begin{align*}
1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !  &  =\left(  1!\cdot2!\right)
\cdot\left(  3!\cdot4!\right)  \cdot\cdots\cdot\left(  \left(  2n-1\right)
!\cdot\left(  2n\right)  !\right) \\
&  =\prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\cdot\underbrace{\left(
2k\right)  !}_{=\left(  2k-1\right)  !\cdot2k}\right)  =\prod_{k=1}^{n}\left(
\underbrace{\left(  2k-1\right)  !\cdot\left(  2k-1\right)  !}_{=\left(
\left(  2k-1\right)  !\right)  ^{2}}\cdot2k\right) \\
&  =\prod_{k=1}^{n}\left(  \left(  \left(  2k-1\right)  !\right)  ^{2}%
\cdot2k\right)  =\left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)
^{2}\right)  \cdot\underbrace{\prod_{k=1}^{n}\left(  2k\right)  }_{=2^{n}%
\prod_{k=1}^{n}k}\\
&  =\left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)  ^{2}\right)
\cdot2^{n}\underbrace{\prod_{k=1}^{n}k}_{=n!}=\left(  \prod_{k=1}^{n}\left(
\left(  2k-1\right)  !\right)  ^{2}\right)  \cdot2^{n}n!.
\end{align*}
Dividing this by $n!$, we find%
\[
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{n!}=\left(  \prod
_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)  ^{2}\right)  \cdot
2^{n}=\left(  \left(  \prod_{k=1}^{n}\left(  2k-1\right)  !\right)
\cdot2^{n/2}\right)  ^{2}.
\]
The right hand side is a perfect square (since $n$ is even, so that
$2^{n/2}\in\mathbb{Z}$). Thus, (\ref{sol.fac.reddit.nclaim}) is proved, and
the problem is solved.\footnote{See \cite[Exercise 3.5 \textbf{(c)}]{detnotes}
for this argument in more detail.}

[\textit{Remark:} This exercise is a puzzle I found on reddit.

The claim (\ref{sol.fac.reddit.nclaim}) can also be proved by a
straightforward induction on $n$.

If neither $n$ nor $n+1$ is a perfect square, then $n$ is the \textbf{only}
$q\in\left\{  1,2,\ldots,2n\right\}  $ for which $\dfrac{1!\cdot2!\cdot
\cdots\cdot\left(  2n\right)  !}{q!}$ is a perfect square. I don't know of a
nice and simple proof of this, but a somewhat laborious proof (using a result
of Erd\"{o}s) can be found at \url{https://math.stackexchange.com/a/3325448/} .]
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.laurent.t}}

\begin{proof}
[Discussion of Exercise \ref{exe.laurent.t}.]This exercise has appeared in
various places (e.g., it was Exercise 8 on the 5th
\href{https://intranet.math.vt.edu/people/plinnell/Vtregional/}{Virginia Tech
Regional Mathematics Contest}). I gave a detailed solution in
\cite[Proposition 2.64]{detnotes}, so here I will mostly comment on how the
sausage is made. Note that the sequence $\left(  t_{0},t_{1},t_{2}%
,\ldots\right)  $ appears in the OEIS as
\href{https://oeis.org/A005246}{Sequence A005246}.

Since the sequence $\left(  t_{0},t_{1},t_{2},\ldots\right)  $ is defined
recursively, it is reasonable to guess that its properties are best proved by
induction. More precisely, strong induction is the best thing to try, since
the recursive definition of $t_{n}$ refers not just to $t_{n-1}$ but also to
the previous two values $t_{n-2}$ and $t_{n-3}$.

A strong induction needs no induction base -- although this often comes at the
price that a few \textquotedblleft edge\textquotedblright\ cases have to be
considered separately within the induction step. We shall see this now.

\textbf{(a)} We proceed by strong induction on $n$.

\textit{Induction step:} Let $m\geq2$ be an integer. Assume (as induction
hypothesis) that the claim of Exercise \ref{exe.laurent.t} \textbf{(a)} holds
for all $n<m$ (meaning, of course, for all integers $n\geq2$ satisfying
$n<m$). We must prove that the claim of Exercise \ref{exe.laurent.t}
\textbf{(a)} also holds for $n=m$. In other words, we must prove that
$t_{m+2}=4t_{m}-t_{m-2}$.

We want to reduce this to our induction hypothesis, which says things like
$t_{m+1}=4t_{m-1}-t_{m-3}$ and $t_{m}=4t_{m-2}-t_{m-4}$ and so on. So we need
to get rid of \textquotedblleft$t$s with high indices\textquotedblright\ --
that is, in our case, $t_{m+2}$. We achieve this by rewriting $t_{m+2}$ as
$\dfrac{1+t_{m+1}t_{m}}{t_{m-1}}$ (a consequence of the recursive definition
of our sequence). So, the equality we must prove (namely, $t_{m+2}%
=4t_{m}-t_{m-2}$) rewrites as follows:%
\begin{align*}
&  \ \left(  t_{m+2}=4t_{m}-t_{m-2}\right) \\
&  \Longleftrightarrow\ \left(  \dfrac{1+t_{m+1}t_{m}}{t_{m-1}}=4t_{m}%
-t_{m-2}\right) \\
&  \Longleftrightarrow\ \left(  1+t_{m+1}t_{m}=\left(  4t_{m}-t_{m-2}\right)
t_{m-1}\right) \\
&  \Longleftrightarrow\ \left(  1+t_{m+1}t_{m}=4t_{m}t_{m-1}-t_{m-2}%
t_{m-1}\right) \\
&  \Longleftrightarrow\ \left(  1=4t_{m}t_{m-1}-t_{m+1}t_{m}-t_{m-2}%
t_{m-1}\right)
\end{align*}
(where in the last step we brought the $t_{m+1}t_{m}$ term to the right hand
side so it could join the rather similar terms there). The $4t_{m}%
t_{m-1}-t_{m+1}t_{m}$ on the right hand side rewrites as $t_{m}\left(
4t_{m-1}-t_{m+1}\right)  $; but this looks familiar! Indeed, our induction
hypothesis (applied to $n=m-1$) yields $t_{m+1}=4t_{m-1}-t_{m-3}$, so that
$4t_{m-1}-t_{m+1}=t_{m-3}$. We can now continue our above chain of equivalent
transformations of our goal:%
\begin{align*}
&  \ \left(  1=4t_{m}t_{m-1}-t_{m+1}t_{m}-t_{m-2}t_{m-1}\right) \\
&  \Longleftrightarrow\ \left(  1=t_{m}\underbrace{\left(  4t_{m-1}%
-t_{m+1}\right)  }_{=t_{m-3}}-t_{m-2}t_{m-1}\right) \\
&  \Longleftrightarrow\ \left(  1=t_{m}t_{m-3}-t_{m-2}t_{m-1}\right)  .
\end{align*}
But the equality $1=t_{m}t_{m-3}-t_{m-2}t_{m-1}$ follows from the very
definition of $t_{m}$, which (as we recall) says $t_{m}=\dfrac{1+t_{m-1}%
t_{m-2}}{t_{m-3}}$. So we have reduced the equality in question (that is,
$t_{m+2}=4t_{m}-t_{m-2}$) to an equality we know to be true. We now need to
walk this argument backwards and we have our induction step.

Did you spot the gap? You can see that there is a gap, since we have never
used the base values ($t_{0}=t_{1}=t_{2}=1$). But it is not hard to see that
the problem would not remain true if the base values were replaced by
arbitrary numbers. Something has to give.

The problem is that we applied the induction hypothesis to $n=m-1$. But the
induction hypothesis said that Exercise \ref{exe.laurent.t} \textbf{(a)} holds
for all integers $n\geq2$ satisfying $n<m$. Thus, in order to apply it to
$n=m-1$, we need to know that $m-1$ is an integer satisfying $m-1\geq2$ and
$m-1<m$. Of course, $m-1$ is an integer and satisfies $m-1<m$. But $m-1\geq2$
is not automatically satisfied; it holds for $m\geq3$, but not for $m=2$.
Thus, we need to treat the $m=2$ case separately. So much for a strong
induction not needing an induction base! (Of course, technically it is true:
We are not doing an induction base; we are just special-casing a special case
in the induction step. But the difference is just organizational.)

So we need to verify the claim of Exercise \ref{exe.laurent.t} \textbf{(a)}
for $m=2$. This means verifying that $t_{4}=4t_{2}-t_{0}$. This is not the
most challenging part of the problem, so I stop here.

One last thing about \textbf{(a)}: If you look again at the above induction,
you might notice that we only ever applied the induction hypothesis to
$n=m-1$. This means that we did not need the \textquotedblleft
strength\textquotedblright\ of strong induction; we can just as well restate
the argument as a (standard) induction on $n$. The case $m=2$ then becomes an
actual (de-jure, not just de-facto) induction base. I think the resulting
proof is a little bit easier to write up.

\textbf{(b)} We will separately prove the two statements that
\begin{equation}
t_{n}\text{ is positive for each integer }n\geq0 \label{sol.laurent.t.b.pos}%
\end{equation}
and that%
\begin{equation}
t_{n}\text{ is an integer for each integer }n\geq0.
\label{sol.laurent.t.b.int}%
\end{equation}


To be pedantic, (\ref{sol.laurent.t.b.pos}) does not even have to be proved,
since it is implicit in the problem statement (\textquotedblleft a sequence
$\left(  t_{0},t_{1},t_{2},\ldots\right)  $ of \textbf{positive} rational
numbers\textquotedblright). (The reason why I put the \textquotedblleft
positive\textquotedblright\ in the statement is to pre-empt any question about
\textquotedblleft what happens if the expression $\dfrac{1+t_{n-1}t_{n-2}%
}{t_{n-3}}$ has a zero in the denominator?\textquotedblright. If we know that
all entries of the sequence are positive, then of course there cannot be any
zero denominators.) Just for the sake of completeness: The reason that $t_{n}$
is positive for each integer $n\geq0$ is that the sequence $\left(
t_{0},t_{1},t_{2},\ldots\right)  $ was defined recursively with three positive
base values ($t_{0},t_{1},t_{2}$ are all positive) and a recursive rule
($t_{n}=\dfrac{1+t_{n-1}t_{n-2}}{t_{n-3}}$) that produces a positive $t_{n}$
when given positive $t_{n-1},t_{n-2},t_{n-3}$. So to speak, the sequence
$\left(  t_{0},t_{1},t_{2},\ldots\right)  $ never has a chance to escape the
positive numbers. To make this argument formal (which you don't need to do on
any contests, given how trivial it is), you can argue by strong induction,
similarly to how we are soon going to prove (\ref{sol.laurent.t.b.int}) (but
using the recursive rule $t_{n}=\dfrac{1+t_{n-1}t_{n-2}}{t_{n-3}}$ instead of
part \textbf{(a)}).

Let us now prove (\ref{sol.laurent.t.b.int}). We proceed by strong induction
on $n$.

\textit{Induction step:} Fix an integer $m\geq0$, and we assume (as induction
hypothesis) that (\ref{sol.laurent.t.b.int}) holds for all $n<m$. We must now
prove that (\ref{sol.laurent.t.b.int}) holds for $n=m$. In other words, we
must prove that $t_{m}$ is an integer.

First assume that $m\geq4$. Then, $m-2\geq2$; thus, we can apply Exercise
\ref{exe.laurent.t} \textbf{(a)} to $n=m-2$, and thus obtain $t_{m}%
=4t_{m-2}-t_{m-4}$. The induction hypothesis then yields that $t_{m-2}$ and
$t_{m-4}$ are integers (since $m-2$ and $m-4$ are integers $\geq0$ and satisfy
$m-2<m$ and $m-4<m$), and so $t_{m}$ is an integer as well (since
$t_{m}=4t_{m-2}-t_{m-4}$). So we are done with the induction step in the case
when $m\geq4$. It remains to cover the remaining cases. These are the cases
when $m<4$, that is, $m\in\left\{  0,1,2,3\right\}  $. In other words, we need
to show that $t_{0},t_{1},t_{2},t_{3}$ are integers. This is straightforward
(and has been already done in the problem statement). Thus the induction step
is complete. Hence, (\ref{sol.laurent.t.b.int}) is proved.

(Note that this was a real strong induction: We applied the induction
hypothesis to two different values of $n$, none of which was $m-1$.)

Having proved (\ref{sol.laurent.t.b.pos}) and (\ref{sol.laurent.t.b.int}), we
are done with Exercise \ref{exe.laurent.t} \textbf{(b)}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.floor.hermite}}

\begin{proof}
[Discussion of Exercise \ref{exe.floor.hermite}.]This equality is known as
\textit{\href{https://en.wikipedia.org/wiki/Hermite's_identity}{\textit{Hermite's
identity for floor functions}}}. The \textquotedblleft trick\textquotedblright%
\ is simply to express every addend of the sum $\sum_{k=0}^{n-1}\left\lfloor
x+\dfrac{k}{n}\right\rfloor $ explicitly in terms of as few parameters as
possible. Here is the solution in full detail:

\begin{proof}
[Solution to Exercise \ref{exe.floor.hermite}.]Let $g=\left\lfloor
nx\right\rfloor $. Then, (\ref{sol.floor.hermite.lem1}) (applied to $nx$
instead of $x$) yields $\left\lfloor nx\right\rfloor \leq nx<\left\lfloor
nx\right\rfloor +1$. In view of $g=\left\lfloor nx\right\rfloor $, this
rewrites as $g\leq nx<g+1$.

Let $q$ and $r$ be the quotient and the remainder obtained when $g$ is divided
by $n$. Thus, $g=qn+r$ and $q\in\mathbb{Z}$ and $r\in\left\{  0,1,\ldots
,n-1\right\}  $.

Now, we shall prove explicit formulas for the values $\left\lfloor x+\dfrac
{k}{n}\right\rfloor $ for $k\in\left\{  0,1,\ldots,n-1\right\}  $. Namely:

\begin{itemize}
\item For any $k\in\left\{  0,1,\ldots,n-r-1\right\}  $, we have%
\begin{equation}
\left\lfloor x+\dfrac{k}{n}\right\rfloor =q. \label{sol.floor.hermite.1}%
\end{equation}


\item For any $k\in\left\{  n-r,n-r+1,\ldots,n-1\right\}  $, we have%
\begin{equation}
\left\lfloor x+\dfrac{k}{n}\right\rfloor =q+1. \label{sol.floor.hermite.2}%
\end{equation}

\end{itemize}

[\textit{Proof of (\ref{sol.floor.hermite.1}):} Let $k\in\left\{
0,1,\ldots,n-r-1\right\}  $. Thus, $k\geq0$ and $k\leq n-r-1$. From $k\leq
n-r-1$, we obtain $k+r+1\leq n$.

We shall prove that $q\leq x+\dfrac{k}{n}<q+1$ (since this will quickly entail
$\left\lfloor x+\dfrac{k}{n}\right\rfloor =q$). In order to do so, we shall
show that $qn\leq nx+k<\left(  q+1\right)  n$.

Indeed, $r\geq0$, so that $qn\leq qn+r=g\leq nx\leq nx+k$ (since $k\geq0$).
Also,
\[
\underbrace{nx}_{<g+1}+k<\underbrace{g}_{=qn+r}%
+1+k=qn+r+1+k=qn+\underbrace{k+r+1}_{\leq n}\leq qn+n=\left(  q+1\right)  n.
\]
Combining $qn\leq nx+k$ with this, we obtain the chain of inequalities $qn\leq
nx+k<\left(  q+1\right)  n$. Dividing this chain by $n$, we find $q\leq
\dfrac{nx+k}{n}<q+1$. Hence, the integer $q$ is $\leq\dfrac{nx+k}{n}$, but the
next integer $q+1$ no longer is. Thus, $q$ is the largest integer $\leq
\dfrac{nx+k}{n}$. In other words, $q=\left\lfloor \dfrac{nx+k}{n}\right\rfloor
$ (by the definition of $\left\lfloor \dfrac{nx+k}{n}\right\rfloor $). In
other words, $q=\left\lfloor x+\dfrac{k}{n}\right\rfloor $ (since
$\dfrac{nx+k}{n}=x+\dfrac{k}{n}$). This proves (\ref{sol.floor.hermite.1}).]

[\textit{Proof of (\ref{sol.floor.hermite.2}):} Let $k\in\left\{
n-r,n-r+1,\ldots,n-1\right\}  $. Thus, $k\geq n-r$ and $k\leq n-1$. From
$k\geq n-r$, we obtain $k+r\geq n$, so that $n\leq k+r$.

We shall prove that $q+1\leq x+\dfrac{k}{n}<q+2$ (since this will quickly
entail $\left\lfloor x+\dfrac{k}{n}\right\rfloor =q+1$). In order to do so, we
shall show that $\left(  q+1\right)  n\leq nx+k<\left(  q+2\right)  n$.

Indeed, combining
\[
\left(  q+1\right)  n=qn+\underbrace{n}_{\leq k+r}\leq
qn+k+r=\underbrace{qn+r}_{=g\leq nx}+k\leq nx+k
\]
with%
\[
\underbrace{nx}_{<g+1}+\underbrace{k}_{\leq n-1}<g+1+n-1=\underbrace{g}%
_{=qn+r}+n=qn+\underbrace{r}_{\leq n-1<n}+n<qn+n+n=\left(  q+2\right)  n,
\]
we obtain the chain of inequalities $\left(  q+1\right)  n\leq nx+k<\left(
q+2\right)  n$. Dividing this chain by $n$, we find $q+1\leq\dfrac{nx+k}%
{n}<q+2$. Hence, the integer $q+1$ is $\leq\dfrac{nx+k}{n}$, but the next
integer $q+2$ no longer is. Thus, $q+1$ is the largest integer $\leq
\dfrac{nx+k}{n}$. In other words, $q+1=\left\lfloor \dfrac{nx+k}%
{n}\right\rfloor $ (by the definition of $\left\lfloor \dfrac{nx+k}%
{n}\right\rfloor $). In other words, $q+1=\left\lfloor x+\dfrac{k}%
{n}\right\rfloor $ (since $\dfrac{nx+k}{n}=x+\dfrac{k}{n}$). This proves
(\ref{sol.floor.hermite.2}).]

Now, $r\in\left\{  0,1,\ldots,n-1\right\}  $, so that $n-r\in\left\{
1,2,\ldots,n\right\}  $. Thus, we can split the sum $\sum_{k=0}^{n-1}%
\left\lfloor x+\dfrac{k}{n}\right\rfloor $ at $k=n-r$. We thus
obtain\footnote{Keep in mind that the sum $\sum_{k=n-r}^{n-1}\left\lfloor
x+\dfrac{k}{n}\right\rfloor $ will be empty if $r=0$. An empty sum equals $0$
by definition.}%
\begin{align*}
\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor  &  =\sum
_{k=0}^{n-r-1}\underbrace{\left\lfloor x+\dfrac{k}{n}\right\rfloor
}_{\substack{=q\\\text{(by (\ref{sol.floor.hermite.1}))}}}+\sum_{k=n-r}%
^{n-1}\underbrace{\left\lfloor x+\dfrac{k}{n}\right\rfloor }%
_{\substack{=q+1\\\text{(by (\ref{sol.floor.hermite.2}))}}}\\
&  =\underbrace{\sum_{k=0}^{n-r-1}q}_{\substack{=\left(  n-r\right)
q\\\text{(since this sum has }n-r\text{ addends)}}}+\underbrace{\sum
_{k=n-r}^{n-1}\left(  q+1\right)  }_{\substack{=r\left(  q+1\right)
\\\text{(since this sum has }r\text{ addends)}}}\\
&  =\left(  n-r\right)  q+r\left(  q+1\right)  =qn+r=g=\left\lfloor
nx\right\rfloor .
\end{align*}
This solves the exercise.
\end{proof}

With some experience, the above solution will appear straightforward. The
decisive step was to introduce $q$ and $r$; but this was not unmotivated.
Indeed, the first addend of the sum $\sum_{k=0}^{n-1}\left\lfloor x+\dfrac
{k}{n}\right\rfloor $ is $\left\lfloor x+\dfrac{0}{n}\right\rfloor
=\left\lfloor x\right\rfloor =q$, and all other addends are either $q$ or
$q+1$. The question that remains is which of them are $q$ and which are $q+1$;
but it soon becomes clear that the remainder of $g$ divided by $n$ decides
this. Thus the above solution.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.chip.abelkonkabc}}

\begin{proof}
[Discussion of Exercise \ref{exe.chip.abelkonkabc}.]The following solution is
probably the easiest one to find, but not the nicest or the most generalizable
one. More on this after the solution.

\begin{proof}
[Solution to Exercise \ref{exe.chip.abelkonkabc}.]Expanding $\left(
a+b+c\right)  ^{n^{2}+n+1}$ will yield a sum of monomials of the form
$a^{i}b^{j}c^{k}$ with $i,j,k$ being nonnegative integers satisfying
$i+j+k=n^{2}+n+1$. (Indeed,
\href{https://en.wikipedia.org/wiki/Multinomial_theorem}{the multinomial
theorem} yields the exact result, but we don't need it; all we need is that it
is some sum of such monomials.) Thus, in order to prove that $abc$ divides
$\left(  a+b+c\right)  ^{n^{2}+n+1}$, it will suffice to show that $abc$
divides each of these monomials $a^{i}b^{j}c^{k}$. So let us do this.

Let us fix three nonnegative integers $i,j,k$ satisfying $i+j+k=n^{2}+n+1$. We
must prove that $abc\mid a^{i}b^{j}c^{k}$.

If all of $i,j,k$ are nonzero (thus $\geq1$), then this is true for obvious
reasons. Thus, we WLOG assume that $i,j,k$ are not all nonzero. So at least
one of $i,j,k$ is zero.

Now $abc\mid a^{i}b^{j}c^{k}$ is no longer obvious, but we can try to use our
assumptions $a\mid b^{n}$ and $b\mid c^{n}$ and $c\mid a^{n}$ to our
advantage. These assumptions allow us to \textquotedblleft
trade\textquotedblright\ a $b^{n}$ for an $a$, or a $c^{n}$ for a $b$, or an
$a^{n}$ for a $c$ in the term $a^{i}b^{j}c^{k}$. We hope that by a few such
\textquotedblleft trades\textquotedblright, we can transform $a^{i}b^{j}c^{k}$
into a monomial where each of $a,b,c$ appears at least once (whence the
monomial is divisible by $abc$).

Which \textquotedblleft trades\textquotedblright\ we need to make depends on
the values of $i,j,k$. We distinguish between two cases:

\textit{Case 1:} Exactly one of $i,j,k$ is zero.

\textit{Case 2:} Exactly two of $i,j,k$ are zero.

(These are the only possibilities, because we already know that at least one
of $i,j,k$ is zero, whereas the condition $i+j+k=n^{2}+n+1$ rules out the
possibility that all of $i,j,k$ are zero).

Let us first consider Case 1. In this case, exactly one of $i,j,k$ is zero.

Notice the cyclic symmetry in the problem: If we cyclically permute $a,b,c$
(that is, replace $a,b,c$ by $b,c,a$, respectively) and simultaneously
cyclically permute $i,j,k$, then neither the assumptions nor the claim of the
problem change. Thus, we can cyclically permute the numbers $i,j,k$ at will
(as long as we remember to permute $a,b,c$ along with them). By doing so, we
can always guarantee that $i=0$ (because we know that at least one of the
three numbers $i,j,k$ is zero, and we can bring this number to the front by a
cyclic permutation). Thus, WLOG assume that $i=0$. Hence, $j$ and $k$ are
nonzero (since exactly one of $i,j,k$ is zero). In other words, $j\geq1$ and
$k\geq1$. Our monomial $a^{i}b^{j}c^{k}$ thus has no $a$, but at least one $b$
and at least one $c$ in it.

We now want to \textquotedblleft trade\textquotedblright\ a $b^{n}$ for an
$a$, or, if this is impossible (because we don't have a $b^{n}$), to
\textquotedblleft trade\textquotedblright\ $n$ copies of $c^{n}$ for $b$'s and
then trade the resulting $b^{n}$ for an $a$. We need to be careful not to
\textquotedblleft sell\textquotedblright\ all our $b$'s in the trade, so we
should \textquotedblleft trade\textquotedblright\ $b^{n}$ only if we have at
least one $b$ left after that -- i.e., if $j\geq n+1$. Thus, we distinguish
between the following two subcases:

\textit{Subcase 1.1:} We have $j\geq n+1$.

\textit{Subcase 1.2:} We have $j<n+1$.

In Subcase 1.1, we have $j\geq n+1$. Hence, $b^{n+1}\mid b^{j}$. But $a\mid
b^{n}$. Multiplying this divisibility by $b$, we find\footnote{We are using
the following basic fact of number theory here: If $x$ and $y$ are two
integers satisfying $x\mid y$, then $xb\mid yb$.} $ab\mid b^{n}b=b^{n+1}\mid
b^{j}$. Also, $c\mid c^{k}$ (since $k\geq1$). Multiplying these two
divisibilities\footnote{This means we are using the following fact from number
theory: If $x,y,u,v$ are four integers satisfying $x\mid y$ and $u\mid v$,
then $xu\mid yv$.}, we obtain $\left(  ab\right)  c\mid b^{j}c^{k}$. Hence,
$abc=\left(  ab\right)  c\mid b^{j}c^{k}\mid a^{i}b^{j}c^{k}$. Thus, $abc\mid
a^{i}b^{j}c^{k}$ is proved in Subcase 1.1.

Let us next consider Subcase 1.2. In this case, we have $j<n+1$. Hence, $j\leq
n$ (since $j$ and $n$ are integers). Now, recall that $i+j+k=n^{2}+n+1$, so
that $n^{2}+n+1=\underbrace{i}_{=0}+\underbrace{j}_{\leq n}+k\leq n+k$, so
that $k\geq n^{2}+1$. Therefore, $c^{n^{2}+1}\mid c^{k}$. But we can take the
divisibility $b\mid c^{n}$ to the $n$-th power\footnote{This is, again, a
consequence of a standard fact from number theory: If $x$ and $y$ are two
integers such that $x\mid y$, then $x^{n}\mid y^{n}$.}, and obtain $b^{n}%
\mid\left(  c^{n}\right)  ^{n}=c^{n^{2}}$. Hence, $a\mid b^{n}\mid c^{n^{2}}$.
Multiplying this divisibility by $c$, we obtain $ac\mid c^{n^{2}}c=c^{n^{2}%
+1}\mid c^{k}$. Also, $b\mid b^{j}$ (since $j\geq1$). Multiplying the
preceding two divisibilities, we obtain $\left(  ac\right)  b\mid c^{k}b^{j}$.
Thus, $abc=\left(  ac\right)  b\mid c^{k}b^{j}=b^{j}c^{k}\mid a^{i}b^{j}c^{k}%
$. Thus, $abc\mid a^{i}b^{j}c^{k}$ is proved in Subcase 1.2.

We have now proved $abc\mid a^{i}b^{j}c^{k}$ in all of Case 1. It remains to
deal with Case 2.

So let us consider Case 2. In this case, exactly two of $i,j,k$ are zero. The
same \textquotedblleft cyclic symmetry\textquotedblright\ argument as in Case
1 lets us WLOG assume that $i$ and $j$ are zero. Thus, $i+j+k=0+0+k=k$, so
that $k=i+j+k=n^{2}+n+1$. Hence, $c^{k}=c^{n^{2}+n+1}=c^{n^{2}}c^{n}c$. As in
Subcase 1.2, we can see that $a\mid c^{n^{2}}$. Also, we know that $b\mid
c^{n}$. Multiplying these two divisibilities, we find $ab\mid c^{n^{2}}c^{n}$.
Multiplying this further by $c$, we find $abc\mid c^{n^{2}}c^{n}c=c^{k}\mid
a^{i}b^{j}c^{k}$. Thus, $abc\mid a^{i}b^{j}c^{k}$ is proved in Case 2.

This completes our proof of $abc\mid a^{i}b^{j}c^{k}$. As explained above,
this solves the problem.
\end{proof}

Now, a few words about the ideas behind the problem. It is a slight
generalization of an olympiad problem from Norway
(\href{https://www.matematikksenteret.no/abelkonkurransen/}{Abelkonkurransen}
1998-99 final problem 2b). As the above solution reveals, it is not much of a
number theory problem; it is a combinatorial problem about \textquotedblleft
trading exponents\textquotedblright\ in a monomial, wrapped in
number-theoretical packaging. At the core is the following fact: If you have a
monomial $a^{i}b^{j}c^{k}$ with $i+j+k=n^{2}+n+1$ (treating $a,b,c$ as formal
variables rather than specific numbers), and you are allowed to trade a
$b^{n}$ for an $a$, a $c^{n}$ for a $b$, or an $a^{n}$ for a $c$, then you can
always (choosing your trades strategically) wind up with a monomial that
contains each of $a,b,c$ at least once. (You can think of $a,b,c$ as three
different currencies that can only be exchanged for one another at a loss.)

This fact can be generalized to $k$ (rather than $3$) currencies; Fedor Petrov
has proved this generalization in
\url{https://mathoverflow.net/questions/198605/} .
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.lemmings}}

\begin{proof}
[Discussion of Exercise \ref{exe.lemmings}.]Let me outline two solutions:

\begin{proof}
[First solution to Exercise \ref{exe.lemmings} (sketched).]This is the
\textquotedblleft gotcha\textquotedblright\ solution.

Let $M_{1}$ be our mountain ridge. Imagine, in a parallel universe, a second
mountain ridge $M_{2}$, which has the same shape and length as $M_{1}$ and
initially has the same lemmings as $M_{1}$ at the same positions as on $M_{1}%
$, walking in the same directions as on $M_{1}$ and with the same speed as on
$M_{1}$. However, they interact differently: When two $M_{2}$-lemmings meet,
they just walk through one another like ghosts (as opposed to $M_{1}%
$-lemmings, which \textquotedblleft bounce off\textquotedblright\ one
another). For example, if $M_{1}$ and $M_{2}$ initially look like this:%
\[
\underline{\ \ \ \ \ \ \ \ \ \ \overrightarrow{1}\ \ \ \ \overleftarrow{2}%
\ \ \ \ \ \ \overleftarrow{3}\ \ \ \ \ \ \ \ \ \ \ \ \ \overrightarrow{4}%
\ \ \ \ \ \ \ \ \ \ \overleftarrow{5}\ \ \ \ \ \ }%
\]
then after the first \textquotedblleft lemming collision\textquotedblright%
\ they will look as follows:%
\begin{align*}
M_{1}  &  :\underline{\ \ \ \ \ \ \ \ \ \ \ \ \overleftarrow{1}%
\overrightarrow{2}\ \ \ \ \ \ \overleftarrow{3}%
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \overrightarrow{4}%
\ \ \ \ \ \ \overleftarrow{5}\ \ \ \ \ \ \ \ }\ \ ;\\
M_{2}  &  :\underline{\ \ \ \ \ \ \ \ \ \ \ \ \overleftarrow{2}%
\overrightarrow{1}\ \ \ \ \ \ \overleftarrow{3}%
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \overrightarrow{4}%
\ \ \ \ \ \ \overleftarrow{5}\ \ \ \ \ \ \ \ }\ \ .
\end{align*}


Now the key observation is the following:

\begin{statement}
\textit{Observation 1:} At any moment in time, the multiset of the positions
of all $M_{1}$-lemmings on the $M_{1}$-ridge is the same as the multiset of
the positions of all $M_{2}$-lemmings on the $M_{2}$-ridge.
\end{statement}

In other words, if we don't distinguish between the specific lemmings, then we
never see a difference between $M_{1}$ and $M_{2}$.

Why is Observation 1 true? Roughly speaking\footnote{We shall not formalize
this argument, as it would require a lot of busywork even to formally define
what it means for a lemming to walk along the ridge, and to ensure that the
positions of the lemmings are actually well-defined at any time. From a
rigorous point of view, these things do need to be verified!
\par
(If you are wondering why, ponder the following variant of the exercise.
Assume that the ridge is a circle instead of a line segment, and that the
lemmings double their speeds after every \textquotedblleft
collision\textquotedblright. Assume further that you start out with two
lemmings that have just bounced off one another. Say they collide after $1$
minute. After this collision, their speeds double, so they collide again after
another $\dfrac{1}{2}$ minute. Then their speeds double again, so they collide
after another $\dfrac{1}{4}$ minute. And so on... Thus, the lemmings keep
running around the ridge all the way up to the $2$-minute mark (since
$1+\dfrac{1}{2}+\dfrac{1}{4}+\dfrac{1}{8}+\cdots=2$). But what happens
afterwards -- say, after $3$ minutes? This has no well-defined answer; our
rules of collision simply do not define any behavior outside of the time
interval $\left[  0,2\right)  $.
\par
This is rather similar to finite-time blow-up of solutions to some different
equations.)}, it is true because it is true at the onset (by definition of
$M_{2}$), it remains true as long as there are no collisions (since the only
difference between $M_{1}$ and $M_{2}$ is the rule for collisions), and it
remains true through each collision (since the collision rules on $M_{1}$ and
on $M_{2}$ do not depend on the identities of the individual lemmings
colliding, and their results differ only if one distinguishes between the
lemmings\footnote{To be fully honest, we need to first observe that the speeds
of all lemmings remain constant and equal throughout the ordeal, both on
$M_{1}$ and $M_{2}$ (because collisions never change the speeds). When two
lemmings collide at equal speeds, the result is the same on $M_{1}$ and on
$M_{2}$ as long as you don't distinguish between the lemmings: You still have
two lemmings walking in the same directions at the same speeds. The only
difference is that the two lemmings have traded places on $M_{1}$.}). Thus,
Observation 1 never has any chance to become false.

But the $M_{2}$-lemmings are much easier to analyze than the $M_{1}$-lemmings.
After all, collisions don't matter on $M_{2}$. Thus, each $M_{2}$-lemming
keeps walking in the direction it has always been walking. As a consequence,
each $M_{2}$-lemming eventually falls off the cliff (since the speeds are
constant and nonzero, and the ridge is finite). In other words, there are
eventually no lemmings on $M_{2}$ any more. According to Observation 1, this
means that there are eventually no lemmings on $M_{1}$ any more. In other
words, each $M_{1}$-lemming eventually falls off the cliff. This solves the exercise.
\end{proof}

Note that the above solution shows something better than the exercise asked
for: Namely, it shows that if the ridge has length $d$ and the speed of each
lemming is $v$, then there will be no lemmings on the ridge after time $d/v$.
Indeed, this is clearly what happens on $M_{2}$ (since each $M_{2}$-lemming
just walks with speed $v$ in a fixed direction), and therefore (by Observation
1) is also what happens on $M_{1}$.

The next proof does not (at least directly) show this stronger result, but is
probably easier to come up with:

\begin{proof}
[Second solution to Exercise \ref{exe.lemmings} (sketched).]Consider the
initial state. If the leftmost lemming is walking left, then it will reach the
left cliff undisturbed and fall off it. If the leftmost lemming is walking
right, then it will either reach the right cliff undisturbed and fall off it,
or it will collide with another lemming and bounce off, which will then send
it moving left and eventually falling off the left cliff (undisturbed, since
there won't be any other lemming for it to collide with; it will stay the
leftmost lemming on the ridge until it falls). In either case, the leftmost
lemming will eventually fall off the cliff. After this happens, another
lemming will become the leftmost lemming, and thus (by the same argument) will
also eventually fall off the cliff. Repeat this argument once for each lemming
(strictly speaking, this means arguing by induction). This shows that
eventually, all lemmings will have fallen off the cliff (although it does not
offer a good bound on how soon).
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.socks.intro}}

\begin{proof}
[Discussion of Exercise \ref{exe.socks.intro}.]This is a particular case of
\cite[Exercise 7]{18s-hw2s}. (More precisely, part \textbf{(a)} is the
particular case of \cite[Exercise 7]{18s-hw2s} for $n=40$ and $s=10$, whereas
part \textbf{(b)} is the particular case of \cite[Exercise 7]{18s-hw2s} for
$n=26$ and $s=10$.)

Let us introduce notations that cover both parts \textbf{(a)} and
\textbf{(b)}. Let $n$ and $s$ be two even positive integers. Assume that we
have $n/2$ white socks and $n/2$ black socks hanging on a clothesline, in some
order. We are looking to pick $s$ consecutive socks on the clothesline such
that $s/2$ of them are black and the other $s/2$ white. We shall refer to such
a pick as a \textit{balanced pick}. (Let's not call it \textquotedblleft
color-balanced\textquotedblright\ for brevity.) Thus, part \textbf{(a)} claims
that we can find a balanced pick if $n=40$ and $s=10$, whereas part
\textbf{(b)} claims that we can find a balanced pick if $n=26$ and $s=10$.

We shall prove a more general claim (\cite[Exercise 7]{18s-hw2s}). Namely, we
shall prove the following:

\begin{statement}
\textit{Claim 1:} Set $q=n//s$ and $r=n\%s$ (where we are using the notations
$//$ and $\%$ introduced in Definition \ref{def.ent.quorem}). Assume that
there is \textbf{no} balanced pick. Then, $r\geq2q$ and $s>2q+r$.
\end{statement}

Claim 1 will solve part \textbf{(a)} of our problem, since $r\geq2q$ is
violated for $n=40$ and $s=10$; it will also solve part \textbf{(b)}, since
$s>2q+r$ is violated for $n=26$ and $s=10$.

[\textit{Proof of Claim 1:} We have $s/2\in\mathbb{Z}$ (since $s$ is even).
Also, $q$ and $r$ are the quotient and the remainder of division of $n$ by $s$
(since $q=n//s$ and $r=n\%s$). Thus, $q\in\mathbb{Z}$, $r\in\left\{
0,1,\ldots,s-1\right\}  $ and $n=qs+r$. From $r\in\left\{  0,1,\ldots
,s-1\right\}  $, we obtain $r<s$. Thus, $s>r$.

We must prove that $r\geq2q$ and $s>2q+r$. If $q=0$, then this is obvious
(because $r\geq0$ and $s>r$). Hence, we WLOG assume that $q\neq0$. Thus,
$q\geq1$. Therefore, $n=\underbrace{q}_{\geq1}s+\underbrace{r}_{\geq0}\geq s$,
so that $n-s+1\geq1$.

Number the socks by $1,2,\ldots,n$ in the order in which they appear on the
clothesline. For any $m\in\mathbb{N}$, let $\left[  m\right]  $ denote the
$m$-element set $\left\{  1,2,\ldots,m\right\}  $.

For each $i\in\left[  n-s+1\right]  $, define the integer%
\begin{equation}
b_{i}=\left(  \text{the number of black socks among socks }i,i+1,\ldots
,i+s-1\right)  -s/2. \label{sol.socks.balanced.bi-def}%
\end{equation}
(This is indeed an integer, because $s/2\in\mathbb{Z}$.) Then, each
$i\in\left[  n-s+1\right]  $ satisfies%
\begin{align}
b_{i}  &  =\dfrac{1}{2}\left(  \text{the number of black socks among socks
}i,i+1,\ldots,i+s-1\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ -\dfrac{1}{2}\left(  \text{the number of white socks
among socks }i,i+1,\ldots,i+s-1\right)  . \label{sol.socks.balanced.bi-symm}%
\end{align}
(This comes from the fact that each sock is either black or white; see
\cite[solution to Exercise 7]{18s-hw2s} for a detailed proof.)

The equality (\ref{sol.socks.balanced.bi-symm}) shows that if we invert the
colors of all socks (simultaneously), then all the numbers $b_{1},b_{2}%
,\ldots,b_{n-s+1}$ change signs. Hence, we can WLOG assume that $b_{1}\geq0$
(since otherwise, we can invert the colors of all socks, and then $b_{1}$ will
change sign). Assume this.

Note that each $i\in\left[  n-s+1\right]  $ satisfies%
\begin{equation}
\left(  \text{the number of black socks among socks }i,i+1,\ldots
,i+s-1\right)  =b_{i}+s/2 \label{sol.socks.balanced.bi-def-2}%
\end{equation}
(by (\ref{sol.socks.balanced.bi-def})).

For each $i\in\left[  n-s+1\right]  $, we have $b_{i}\neq0$ (because if we had
$b_{i}=0$, then the $s$ consecutive socks $i,i+1,\ldots,i+s-1$ would form a
balanced pick; but this would contradict our assumption that there is no
balanced pick). Thus, $b_{1},b_{2},\ldots,b_{n-s+1}$ are nonzero integers.
Furthermore,%
\[
\left\vert b_{i+1}-b_{i}\right\vert \leq1\ \ \ \ \ \ \ \ \ \ \text{for all
}i\in\left[  \left(  n-s+1\right)  -1\right]
\]
\footnote{\textit{Proof.} Compare the definitions of $b_{i}$ and $b_{i+1}$,
and observe that the $s$ socks $i,i+1,\ldots,i+s-1$ differ from the $s$ socks
$i+1,i+2,\ldots,i+s$ in at most one sock. (See \cite[solution to Exercise
7]{18s-hw2s} for the details.)}. Hence, Proposition \ref{prop.ind.dc} (applied
to $g=1$ and $h=n-s+1$) shows that $b_{i}>0$ for all $i\in\left[
n-s+1\right]  $. Since the $b_{i}$ are integers, this shows that%
\begin{equation}
b_{i}\geq1\text{ for all }i\in\left[  n-s+1\right]  .
\label{sol.socks.balanced.bi-geq1}%
\end{equation}


Now, let $g$ be the number of black socks among the $r$ socks
$qs+1,qs+2,\ldots,qs+r$. Thus, clearly, $0\leq g\leq r$.

Recall that the total number of black socks on the clothesline is $n/2$. Thus,%
\begin{align*}
n/2  &  =\left(  \text{the total number of black socks}\right) \\
&  =\left(  \text{the number of black socks among socks }1,2,\ldots,n\right)
\\
&  =\left(  \text{the number of black socks among socks }1,2,\ldots
,qs+r\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }n=qs+r\right) \\
&  =\left(  \text{the number of black socks among socks }1,2,\ldots,s\right)
\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of black socks among socks
}s+1,s+2,\ldots,2s\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of black socks among socks
}2s+1,2s+2,\ldots,3s\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of black socks among socks
}\left(  q-1\right)  s+1,\left(  q-1\right)  s+2,\ldots,qs\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{the number of black socks among socks
}qs+1,qs+2,\ldots,qs+r\right) \\
&  =\sum_{h=0}^{q-1}\underbrace{\left(  \text{the number of black socks among
socks }hs+1,hs+2,\ldots,\left(  h+1\right)  s\right)  }_{\substack{=b_{hs+1}%
+s/2\\\text{(by (\ref{sol.socks.balanced.bi-def-2}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{the number of black socks
among socks }qs+1,qs+2,\ldots,qs+r\right)  }_{=g}\\
&  =\sum_{h=0}^{q-1}\left(  \underbrace{b_{hs+1}}_{\substack{\geq1\\\text{(by
(\ref{sol.socks.balanced.bi-geq1}))}}}+s/2\right)  +g\\
&  \geq\underbrace{\sum_{h=0}^{q-1}\left(  1+s/2\right)  }%
_{\substack{=q\left(  1+s/2\right)  \\=q+qs/2}}+g=q+qs/2+g.
\end{align*}
Hence,
\[
q+qs/2+g\leq\underbrace{n}_{=qs+r}/2=\left(  qs+r\right)  /2=qs/2+r/2.
\]
Subtracting $qs/2$ from both sides of this inequality, we find
\begin{equation}
q+g\leq r/2. \label{sol.socks.balanced.6}%
\end{equation}
Hence, $r/2\geq q+\underbrace{g}_{\geq0}\geq q$, so that $r\geq2q$.

It remains to prove that $s>2q+r$. From $n=qs+r$, we obtain $n-r=qs$. Thus,%
\begin{align*}
&  \left(  \text{the number of black socks among socks }n-r+1,n-r+2,\ldots
,n\right) \\
&  =\left(  \text{the number of black socks among socks }qs+1,qs+2,\ldots
,n\right) \\
&  =\left(  \text{the number of black socks among socks }qs+1,qs+2,\ldots
,qs+r\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }n=qs+r\right) \\
&  =g.
\end{align*}


But there is a sock $n-s+1$ on our clothesline (since $n-s+1\geq1$). Let $p$
be the number of black socks among the $s-r$ socks $n-s+1,n-s+2,\ldots,n-r$.
Thus, clearly, $p\leq s-r$.

From (\ref{sol.socks.balanced.bi-def-2}), we obtain%
\begin{align*}
&  \left(  \text{the number of black socks among socks }n-s+1,n-s+2,\ldots
,n\right) \\
&  =\underbrace{b_{n-s+1}}_{\substack{\geq1\\\text{(by
(\ref{sol.socks.balanced.bi-geq1}))}}}+s/2\geq1+s/2.
\end{align*}
Hence,%
\begin{align*}
&  1+s/2\\
&  \leq\left(  \text{the number of black socks among socks }n-s+1,n-s+2,\ldots
,n\right) \\
&  =\underbrace{\left(  \text{the number of black socks among socks
}n-s+1,n-s+2,\ldots,n-r\right)  }_{=p}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{the number of black socks
among socks }n-r+1,n-r+2,\ldots,n\right)  }_{=g}\\
&  =\underbrace{p}_{\leq s-r}+\underbrace{g}_{\substack{\leq r/2-q\\\text{(by
(\ref{sol.socks.balanced.6}))}}}\leq\left(  s-r\right)  +\left(  r/2-q\right)
=s-r/2-q.
\end{align*}
Subtracting $s/2$ from both sides of this inequality, we find $1\leq
s/2-r/2-q$, so that $s/2-r/2-q\geq1>0$. Multiplying this inequality by $2$, we
obtain $s-r-2q>0$, so that $s>2q+r$. This completes the proof of Claim 1.]

Thus, Exercise \ref{exe.socks.intro} is solved.

[\textit{Remark:} I have heard that Claim 1 is an \textquotedblleft if and
only if\textquotedblright: If we \textbf{don't} have $r\geq2q$ and $s>2q+r$,
then there exists a way to place $n/2$ black and $n/2$ white socks on a
clothesline such that there is no balanced pick. I don't currently remember a proof.]
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.factor.vdm-deg4}}

\begin{proof}
[Discussion of Exercise \ref{exe.factor.vdm-deg4}.]The solution is short:%
\begin{align*}
&  bc\left(  b-c\right)  \left(  b+c\right)  +ca\left(  c-a\right)  \left(
c+a\right)  +ab\left(  a-b\right)  \left(  a+b\right) \\
&  =\left(  a-b\right)  \left(  a-c\right)  \left(  b-c\right)  \left(
a+b+c\right)  .
\end{align*}


But how to find this? There are several options. The easiest approach is by
identifying and factoring out divisors. The most elementary implementation of
this approach is the following. We treat $b$ and $c$ as constants, and
consider our polynomial as a polynomial in the single variable $a$. Recall
that if a polynomial in a variable $x$ has a root $x_{0}$, then this
polynomial is divisible by the linear polynomial $x-x_{0}$. Now, the
polynomial%
\[
P\left(  a\right)  :=bc\left(  b-c\right)  \left(  b+c\right)  +ca\left(
c-a\right)  \left(  c+a\right)  +ab\left(  a-b\right)  \left(  a+b\right)
\]
has root $b$, since
\begin{align*}
P\left(  b\right)   &  =bc\left(  b-c\right)  \left(  b+c\right)  +cb\left(
c-b\right)  \left(  c+b\right)  +bb\underbrace{\left(  b-b\right)  }%
_{=0}\left(  b+b\right) \\
&  =bc\left(  b-c\right)  \left(  b+c\right)  +cb\left(  c-b\right)  \left(
c+b\right)  =bc\underbrace{\left(  \left(  b-c\right)  +\left(  c-b\right)
\right)  }_{=0}\left(  b+c\right)  =0.
\end{align*}
Thus, it is divisible by $a-b$. For the same reason, it is divisible by $a-c$.
Occam's Razor thus suggests that it is divisible by the product $\left(
a-b\right)  \left(  a-c\right)  $ as well\footnote{Algebraists will not need
Occam's Razor here: They know that the ring of polynomials in the three
variables $a,b,c$ over (say) $\mathbb{Q}$ is a
\href{https://en.wikipedia.org/wiki/Unique_factorization_domain}{unique
factorization domain} (this holds more generally for any polynomial ring over
a field), and therefore a polynomial divisible by two coprime polynomials like
$a-b$ and $a-c$ must necessarily be divisible by their product. But justifying
this without using abstract algebra is not easy. (Our approach of treating $b$
and $c$ as constants, in particular, makes this argument rather slippery,
because $b$ and $c$ might be equal and then the polynomials $a-b$ and $a-c$
are no longer coprime.) Fortunately, we don't need to justify this step in
order to solve the problem -- it is merely used to find a factorization of a
specific polynomial, which, once found, can be proved by direct computation.}.
By \href{https://en.wikipedia.org/wiki/Polynomial_long_division}{polynomial
long division}, we can find the quotient $\dfrac{P\left(  a\right)  }{\left(
a-b\right)  \left(  a-c\right)  }$ to be
\[
b^{2}+ab-c^{2}-ac=a\left(  b-c\right)  +\underbrace{\left(  b^{2}%
-c^{2}\right)  }_{=\left(  b+c\right)  \left(  b-c\right)  }=\left(
a+b+c\right)  \left(  b-c\right)  .
\]
And thus $P\left(  a\right)  =\left(  a-b\right)  \left(  a-c\right)  \left(
a+b+c\right)  \left(  b-c\right)  $.

There are other ways to find this as well. The probably nicest one is using
determinants: Recall that the determinant of a matrix does not change if we
subtract a multiple of a column from another column. Now,%
\begin{align*}
&  bc\underbrace{\left(  b-c\right)  \left(  b+c\right)  }_{=b^{2}-c^{2}%
}+ca\underbrace{\left(  c-a\right)  \left(  c+a\right)  }_{=c^{2}-a^{2}%
}+ab\underbrace{\left(  a-b\right)  \left(  a+b\right)  }_{=a^{2}-b^{2}}\\
&  =bc\left(  b^{2}-c^{2}\right)  +ca\left(  c^{2}-a^{2}\right)  +ab\left(
a^{2}-b^{2}\right) \\
&  =b^{3}c-bc^{3}+c^{3}a-ca^{3}+a^{3}b-ab^{3}=\det\left(
\begin{array}
[c]{ccc}%
a^{3} & a & 1\\
b^{3} & b & 1\\
c^{3} & c & 1
\end{array}
\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
the determinant}\right) \\
&  =\det\left(
\begin{array}
[c]{ccc}%
a^{3}-c^{2}a & a & 1\\
b^{3}-c^{2}b & b & 1\\
c^{3}-c^{2}c & c & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we subtracted the }c^{2}\text{-multiple}\\
\text{of the second column}\\
\text{from the first column}%
\end{array}
\right) \\
&  =\det\left(
\begin{array}
[c]{ccc}%
a^{3}-c^{2}a & a-c & 1\\
b^{3}-c^{2}b & b-c & 1\\
c^{3}-c^{2}c & c-c & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we subtracted the }c\text{-multiple}\\
\text{of the third column}\\
\text{from the second column}%
\end{array}
\right) \\
&  =\det\left(
\begin{array}
[c]{ccc}%
a\left(  a+c\right)  \left(  a-c\right)  & a-c & 1\\
b\left(  b+c\right)  \left(  b-c\right)  & b-c & 1\\
0 & 0 & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here we just rewrote the}\\
\text{entries of the matrix}%
\end{array}
\right) \\
&  =\det\left(
\begin{array}
[c]{ccc}%
a\left(  a+c\right)  \left(  a-c\right)  -b\left(  b+c\right)  \left(
a-c\right)  & a-c & 1\\
b\left(  b+c\right)  \left(  b-c\right)  -b\left(  b+c\right)  \left(
b-c\right)  & b-c & 1\\
0 & 0 & 1
\end{array}
\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we subtracted the }b\left(  b+c\right)  \text{-multiple}\\
\text{of the second column from the first column}%
\end{array}
\right) \\
&  =\det\left(
\begin{array}
[c]{ccc}%
\left(  a+b+c\right)  \left(  a-b\right)  \left(  a-c\right)  & a-c & 1\\
0 & b-c & 1\\
0 & 0 & 1
\end{array}
\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here we just rewrote the}\\
\text{entries of the matrix}%
\end{array}
\right) \\
&  =\left(  a+b+c\right)  \left(  a-b\right)  \left(  a-c\right)  \cdot\left(
b-c\right)  \cdot1\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the determinant of a triangular matrix equals}\\
\text{the product of its diagonal entries}%
\end{array}
\right) \\
&  =\left(  a-b\right)  \left(  a-c\right)  \left(  b-c\right)  \left(
a+b+c\right)  .
\end{align*}
This way of solving the exercise is suggestive of some generalizations (see
\cite[Exercise 6.16]{detnotes} for one of them).

Finally, let me notice that factoring a polynomial over $\mathbb{Q}$ (that is,
into irreducible polynomials with rational coefficients) is an algorithmically
solvable problem -- in the sense that there are algorithms that can be used to
solve it mechanically. The first algorithm was probably found by Kronecker
\cite[Essay 1.4]{Edwards-Essays}. Most computer algebra systems have this
algorithm implemented. Thus, the problem becomes trivial if one has access to
a computer. However, the manual solution-finding strategies shown above have
other uses.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ineq.abs-qmo4a1}}

\begin{proof}
[Discussion of Exercise \ref{exe.ineq.abs-qmo4a1}.]\textbf{(a)} This is
problem A1 in the 4th QEDMO (2007); the first of the following two solutions
is copied from
\href{https://www.cip.ifi.lmu.de/~grinberg/Dreigeom/QEDMO4a.zip}{the model
solutions (German)}, while the second (simpler) solution has been suggested by
one of you (name withheld for FERPA).

Both solutions rely on the following two important properties of absolute values:

\begin{itemize}
\item If $x,y\in\mathbb{R}$, then%
\begin{equation}
\left\vert xy\right\vert =\left\vert x\right\vert \cdot\left\vert y\right\vert
. \label{sol.ineq.abs-qmo4a1.absxy}%
\end{equation}


\item The \textit{triangle inequality}: If $x,y\in\mathbb{R}$, then%
\begin{equation}
\left\vert x\right\vert +\left\vert y\right\vert \geq\left\vert x+y\right\vert
. \label{sol.ineq.abs-qmo4a1.triangle}%
\end{equation}

\end{itemize}

\noindent Both of these properties are easily verified by case distinction.

\begin{proof}
[First solution to Exercise \ref{exe.ineq.abs-qmo4a1} \textbf{(a)}.]The
inequality (\ref{sol.ineq.abs-qmo4a1.triangle}) (applied to $x=b-c$ and
$y=c-a$) yields
\begin{align}
\left\vert b-c\right\vert +\left\vert c-a\right\vert  &  \geq\left\vert
\left(  b-c\right)  +\left(  c-a\right)  \right\vert =\left\vert \left(
-1\right)  \left(  a-b\right)  \right\vert \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  b-c\right)  +\left(
c-a\right)  =b-a=\left(  -1\right)  \left(  a-b\right)  \right) \nonumber\\
&  =\underbrace{\left\vert -1\right\vert }_{=1}\cdot\left\vert a-b\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.ineq.abs-qmo4a1.absxy})}\right)
\nonumber\\
&  =\left\vert a-b\right\vert . \label{sol.ineq.abs-qmo4a1.3}%
\end{align}
The same reasoning (but with the variables cyclically permuted) yields%
\begin{align}
\left\vert c-a\right\vert +\left\vert a-b\right\vert  &  \geq\left\vert
b-c\right\vert \ \ \ \ \ \ \ \ \ \ \text{and}\label{sol.ineq.abs-qmo4a1.1}\\
\left\vert a-b\right\vert +\left\vert b-c\right\vert  &  \geq\left\vert
c-a\right\vert . \label{sol.ineq.abs-qmo4a1.2}%
\end{align}
(Note that at least one of these three inequalities is an equality. The best
way to see this is to imagine the three numbers $a,b,c$ as points on the real
axis; then, one of the three lies between the two others, and then the
corresponding inequality is an equality. But we won't need this.)

Now, $b^{2}-c^{2}=\left(  b+c\right)  \left(  b-c\right)  $, so that%
\begin{align*}
\left\vert b^{2}-c^{2}\right\vert  &  =\left\vert \left(  b+c\right)  \left(
b-c\right)  \right\vert =\underbrace{\left\vert b+c\right\vert }%
_{\substack{=b+c\\\text{(since }b+c\geq0\text{)}}}\cdot\left\vert
b-c\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ineq.abs-qmo4a1.absxy})}\right) \\
&  =\left(  b+c\right)  \cdot\left\vert b-c\right\vert =b\cdot\left\vert
b-c\right\vert +c\cdot\left\vert b-c\right\vert .
\end{align*}
Again, the same reasoning (but with the variables cyclically permuted) yields%
\begin{align*}
\left\vert c^{2}-a^{2}\right\vert  &  =c\cdot\left\vert c-a\right\vert
+a\cdot\left\vert c-a\right\vert \ \ \ \ \ \ \ \ \ \ \text{and}\\
\left\vert a^{2}-b^{2}\right\vert  &  =a\cdot\left\vert a-b\right\vert
+b\cdot\left\vert a-b\right\vert .
\end{align*}
Adding up these three equalities, we find%
\begin{align*}
&  \left\vert b^{2}-c^{2}\right\vert +\left\vert c^{2}-a^{2}\right\vert
+\left\vert a^{2}-b^{2}\right\vert \\
&  =\left(  b\cdot\left\vert b-c\right\vert +c\cdot\left\vert b-c\right\vert
\right)  +\left(  c\cdot\left\vert c-a\right\vert +a\cdot\left\vert
c-a\right\vert \right)  +\left(  a\cdot\left\vert a-b\right\vert
+b\cdot\left\vert a-b\right\vert \right) \\
&  =a\cdot\underbrace{\left(  \left\vert c-a\right\vert +\left\vert
a-b\right\vert \right)  }_{\substack{\geq\left\vert b-c\right\vert \\\text{(by
(\ref{sol.ineq.abs-qmo4a1.1}))}}}+b\cdot\underbrace{\left(  \left\vert
a-b\right\vert +\left\vert b-c\right\vert \right)  }_{\substack{\geq\left\vert
c-a\right\vert \\\text{(by (\ref{sol.ineq.abs-qmo4a1.2}))}}}+c\cdot
\underbrace{\left(  \left\vert b-c\right\vert +\left\vert c-a\right\vert
\right)  }_{\substack{\geq\left\vert a-b\right\vert \\\text{(by
(\ref{sol.ineq.abs-qmo4a1.3}))}}}\\
&  \geq a\cdot\left\vert b-c\right\vert +b\cdot\left\vert c-a\right\vert
+c\cdot\left\vert a-b\right\vert
\end{align*}
(here we have multiplied three inequalities with $a,b,c$, respectively; this
was allowed since $a,b,c$ are nonnegative). In view of%
\begin{align*}
&  \left\vert \underbrace{ca-ab}_{=\left(  -a\right)  \left(  b-c\right)
}\right\vert +\left\vert \underbrace{ab-bc}_{=\left(  -b\right)  \left(
c-a\right)  }\right\vert +\left\vert \underbrace{bc-ca}_{=\left(  -c\right)
\left(  a-b\right)  }\right\vert \\
&  =\underbrace{\left\vert \left(  -a\right)  \left(  b-c\right)  \right\vert
}_{\substack{=\left\vert -a\right\vert \cdot\left\vert b-c\right\vert
\\\text{(by (\ref{sol.ineq.abs-qmo4a1.absxy}))}}}+\underbrace{\left\vert
\left(  -b\right)  \left(  c-a\right)  \right\vert }_{\substack{=\left\vert
-b\right\vert \cdot\left\vert c-a\right\vert \\\text{(by
(\ref{sol.ineq.abs-qmo4a1.absxy}))}}}+\underbrace{\left\vert \left(
-c\right)  \left(  a-b\right)  \right\vert }_{\substack{=\left\vert
-c\right\vert \cdot\left\vert a-b\right\vert \\\text{(by
(\ref{sol.ineq.abs-qmo4a1.absxy}))}}}\\
&  =\underbrace{\left\vert -a\right\vert }_{=a}\cdot\left\vert b-c\right\vert
+\underbrace{\left\vert -b\right\vert }_{=b}\cdot\left\vert c-a\right\vert
+\underbrace{\left\vert -c\right\vert }_{=c}\cdot\left\vert a-b\right\vert \\
&  =a\cdot\left\vert b-c\right\vert +b\cdot\left\vert c-a\right\vert
+c\cdot\left\vert a-b\right\vert ,
\end{align*}
this rewrites as%
\[
\left\vert b^{2}-c^{2}\right\vert +\left\vert c^{2}-a^{2}\right\vert
+\left\vert a^{2}-b^{2}\right\vert \geq\left\vert ca-ab\right\vert +\left\vert
ab-bc\right\vert +\left\vert bc-ca\right\vert .
\]
This solves Exercise \ref{exe.ineq.abs-qmo4a1} \textbf{(a)}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ineq.abs-qmo4a1} \textbf{(a)}.]The
inequality we are trying to prove is symmetric in $a$, $b$ and $c$, in the
sense that permuting $a$, $b$ and $c$ in any way does not change it (check
this!). Thus, we can WLOG assume that $a\leq b\leq c$ (since we can always
achieve this by permuting $a$, $b$ and $c$ so that the smallest of $a$, $b$
and $c$ becomes $a$, the second-smallest becomes $b$ and the largest becomes
$c$). Assume this. From $a\leq b\leq c$, we obtain $a^{2}\leq b^{2}\leq c^{2}$
(since $a,b,c$ are nonnegative). Furthermore, multiplying both sides of the
inequality $b\leq c$ by $a$, we obtain $ab\leq ac$ (since $a$ is nonnegative).
Similarly, from $a\leq b$, we obtain $ca\leq cb$. Now, $ab\leq ac=ca\leq
cb=bc$, so that $ab\leq ca\leq bc$.

Now, we can get rid of the absolute value signs in the problem. Indeed, we
have $b^{2}\leq c^{2}$, so that $b^{2}-c^{2}\leq0$ and thus $\left\vert
b^{2}-c^{2}\right\vert =-\left(  b^{2}-c^{2}\right)  =c^{2}-b^{2}$. Likewise,
$\left\vert c^{2}-a^{2}\right\vert =c^{2}-a^{2}$ (since $a^{2}\leq c^{2}$) and
$\left\vert a^{2}-b^{2}\right\vert =b^{2}-a^{2}$ (since $a^{2}\leq b^{2}$) and
$\left\vert ca-ab\right\vert =ca-ab$ (since $ab\leq ca$) and $\left\vert
ab-bc\right\vert =bc-ab$ (since $ab\leq bc$) and $\left\vert bc-ca\right\vert
=bc-ca$ (since $ca\leq bc$). Hence,%
\begin{align}
&  \underbrace{\left\vert b^{2}-c^{2}\right\vert }_{=c^{2}-b^{2}%
}+\underbrace{\left\vert c^{2}-a^{2}\right\vert }_{=c^{2}-a^{2}}%
+\underbrace{\left\vert a^{2}-b^{2}\right\vert }_{=b^{2}-a^{2}}\nonumber\\
&  =c^{2}-b^{2}+c^{2}-a^{2}+b^{2}-a^{2}=2\left(  c^{2}-a^{2}\right)
\nonumber\\
&  =2\left(  c+a\right)  \left(  c-a\right)  \label{sol.ineq.abs-qmo4a1.R}%
\end{align}
and%
\begin{align}
&  \underbrace{\left\vert ca-ab\right\vert }_{=ca-ab}+\underbrace{\left\vert
ab-bc\right\vert }_{=bc-ab}+\underbrace{\left\vert bc-ca\right\vert }%
_{=bc-ca}\nonumber\\
&  =ca-ab+bc-ab+bc-ca=2\left(  bc-ab\right) \nonumber\\
&  =2b\left(  c-a\right)  . \label{sol.ineq.abs-qmo4a1.L}%
\end{align}


But we need to prove that%
\[
\left\vert ca-ab\right\vert +\left\vert ab-bc\right\vert +\left\vert
bc-ca\right\vert \leq\left\vert b^{2}-c^{2}\right\vert +\left\vert c^{2}%
-a^{2}\right\vert +\left\vert a^{2}-b^{2}\right\vert .
\]
In view of (\ref{sol.ineq.abs-qmo4a1.L}) and (\ref{sol.ineq.abs-qmo4a1.R}),
this rewrites as
\begin{equation}
2b\left(  c-a\right)  \leq2\left(  c+a\right)  \left(  c-a\right)  .
\label{sol.ineq.abs-qmo4a1.4}%
\end{equation}
Thus, it remains to prove (\ref{sol.ineq.abs-qmo4a1.4}). But this is easy to
check directly: We have $b\leq c\leq c+a$ (since $a\geq0$), thus
$2b\leq2\left(  c+a\right)  $. We can multiply both sides of this inequality
by $c-a$ (since $c-\underbrace{a}_{\leq c}\geq c-c=0$), and thus obtain
$2b\left(  c-a\right)  \leq2\left(  c+a\right)  \left(  c-a\right)  $. This
proves (\ref{sol.ineq.abs-qmo4a1.4}); thus, Exercise \ref{exe.ineq.abs-qmo4a1}
\textbf{(a)} is solved.
\end{proof}

[\textit{Remark:} The first solution to Exercise \ref{exe.ineq.abs-qmo4a1}
\textbf{(a)} is longer, but it has a redeeming quality: It generalizes to $n$
variables instead of $3$. The corresponding result is that if $a_{1}%
,a_{2},\ldots,a_{n}$ are $n$ nonnegative reals, then%
\[
\sum_{i=1}^{n}\left\vert a_{i-1}a_{i}-a_{i}a_{i+1}\right\vert \leq\sum
_{i=1}^{n}\left\vert a_{i}^{2}-a_{i+1}^{2}\right\vert ,
\]
where we set $a_{0}=a_{n}$ and $a_{n+1}=a_{1}$.]

\textbf{(b)} No. For a simple counterexample, set $a=b=1$ and $c=-1$. In this
case, the left hand side becomes $4$ while the right hand side is $0$ (since
$a^{2}=b^{2}=c^{2}$).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.nt.p1}}

\begin{proof}
[Discussion of Exercise \ref{exe.nt.p1}.]This is an exercise on modular
arithmetic and the pigeonhole principle.\footnote{And it appears in many
places as an example for the use of the pigeonhole principle (e.g., in
\cite[\S 3.1, Application 3]{Bruald09} or -- in a weaker form -- in
\cite[Chapter 4, Example E3]{Engel}).} Indeed, let $b_{i}=a_{1}+a_{2}%
+\cdots+a_{i}$ for each $i\in\left\{  0,1,\ldots,n\right\}  $. Thus, $b_{0}$
is an empty sum, so that $b_{0}=0$. Recall that the remainder of an integer
$u$ upon division by $n$ is denoted by $u\%n$. Now, the $n+1$ remainders
\[
b_{0}\%n,\ \ b_{1}\%n,\ \ b_{2}\%n,\ \ \ldots,\ \ b_{n}\%n
\]
are $n+1$ elements of the $n$-element set $\left\{  0,1,\ldots,n-1\right\}  $
(since they are remainders upon division by $n$), and thus at least two of
them must be equal (by the Pigeonhole Principle)\footnote{We are using the
following form of the Pigeonhole Principle here: If $g_{1},g_{2},\ldots,g_{m}$
are $m$ elements of a (fixed) $n$-element set, and if we have $m>n$, then at
least two of the $m$ elements $g_{1},g_{2},\ldots,g_{m}$ must be equal. (This
is our Corollary \ref{cor.php.php-inj-dist} with slightly different
notations.)}. In other words, there exist two integers $u$ and $v$ with $0\leq
u<v\leq n$ and $b_{u}\%n=b_{v}\%n$. Consider these $u$ and $v$. From $u<v$, we
obtain $u+1\leq v$ (since $u$ and $v$ are integers). Also, $0\leq u$, thus
$1\leq u+1\leq v\leq n$. Hence, both $u+1$ and $v$ belong to $\left\{
1,2,\ldots,n\right\}  $.

The integers $b_{v}$ and $b_{u}$ leave the same remainder when divided by $n$
(since $b_{v}\%n=b_{u}\%n$); thus, $b_{v}\equiv b_{u}\operatorname{mod}n$ (by
Proposition \ref{prop.ent.quo-rem.mod=rem}, applied to $b_{v}$ and $b_{u}$
instead of $u$ and $v$). In other words, $n\mid b_{v}-b_{u}$. In view of%
\begin{align*}
\underbrace{b_{v}}_{\substack{=a_{1}+a_{2}+\cdots+a_{v}\\\text{(by the
definition of }b_{v}\text{)}}}-\underbrace{b_{u}}_{\substack{=a_{1}%
+a_{2}+\cdots+a_{u}\\\text{(by the definition of }b_{u}\text{)}}}  &  =\left(
a_{1}+a_{2}+\cdots+a_{v}\right)  -\left(  a_{1}+a_{2}+\cdots+a_{u}\right) \\
&  =a_{u+1}+a_{u+2}+\cdots+a_{v}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}u<v\right)  ,
\end{align*}
this rewrites as $n\mid a_{u+1}+a_{u+2}+\cdots+a_{v}$. Hence, there exist some
$p,q\in\left\{  1,2,\ldots,n\right\}  $ with $p\leq q$ and $n\mid
a_{p}+a_{p+1}+\cdots+a_{q}$ (namely, $p=u+1$ and $q=v$). This solves Exercise
\ref{exe.nt.p1}.
\end{proof}

\subsection{Homework set \#1 discussion}

The following are discussions of the problems on homework set \#1 (Section
\ref{sect.hw1}).

\subsubsection{Discussion of Exercise \ref{exe.lac.size}}

\begin{proof}
[Discussion of Exercise \ref{exe.lac.size}.]We shall give two solutions, and
then sketch two more. The first is a fairly straightforward strong induction
argument whose induction step proceeds by removing the largest element $w$
from $S$ and observing that the remaining part $S\setminus\left\{  w\right\}
$ of $S$ is a subset of $\left\{  1,2,\ldots,n-k\right\}  $ (because the
$k$-lacunarity condition forces any element of $S\setminus\left\{  w\right\}
$ to be $\leq w-k$ and therefore $\leq n-k$). There is a bit of busywork
involved in ensuring that $n-k$ is still an element of $\mathbb{N}$ (so that
the induction hypothesis can be applied). Here are the full details, for the skeptics:

\begin{proof}
[First solution to Exercise \ref{exe.lac.size}.]Forget that we fixed $n$ and
$S$. We thus need to prove the following claim:

\begin{statement}
\textit{Claim 1:} Let $n\in\mathbb{N}$. Let $S$ be a $k$-lacunar subset of
$\left\{  1,2,\ldots,n\right\}  $. Then, $\left\vert S\right\vert \leq
\dfrac{n+k-1}{k}$.
\end{statement}

[\textit{Proof of Claim 1:} We apply strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 1 holds for all $n<m$. We must prove that Claim 1 holds
for $n=m$.

Note that $k\geq1$ (since $k$ is a positive integer), so that
$m+\underbrace{k}_{\geq1}-1\geq m+1-1=m\geq0$. Hence, $\dfrac{m+k-1}{k}\geq0$,
so that $0\leq\dfrac{m+k-1}{k}$. Also, $m-k<m$ (since $k>0$).

We have assumed (as the induction hypothesis) that Claim 1 holds for all
$n<m$. In other words, if $n\in\mathbb{N}$ satisfies $n<m$, and if $S$ is a
$k$-lacunar subset of $\left\{  1,2,\ldots,n\right\}  $, then%
\begin{equation}
\left\vert S\right\vert \leq\dfrac{n+k-1}{k}. \label{sol.lac.size.1st.IH}%
\end{equation}


Now, let us prove that Claim 1 holds for $n=m$. Let $S$ be a $k$-lacunar
subset of $\left\{  1,2,\ldots,m\right\}  $. We shall show that%
\begin{equation}
\left\vert S\right\vert \leq\dfrac{m+k-1}{k}. \label{sol.lac.size.1st.IG}%
\end{equation}
If $\left\vert S\right\vert =0$, then this is definitely true (since we have
$0\leq\dfrac{m+k-1}{k}$). Thus, we WLOG assume that $\left\vert S\right\vert
\neq0$. Hence, the set $S$ is nonempty. Also, the set $S$ is finite (since it
is a subset of the finite set $\left\{  1,2,\ldots,m\right\}  $). Therefore,
Proposition \ref{prop.ind.fin-min} shows that the set $S$ has a maximum. Let
$w$ be this maximum. Thus, $w\in S\subseteq\left\{  1,2,\ldots,m\right\}  $.
Hence, $1\leq w\leq m$, so that $m\geq1$. Now, $\underbrace{m}_{\geq1}%
+k-1\geq1+k-1=k$, so that $\dfrac{m+k-1}{k}\geq1$. Therefore, if $\left\vert
S\right\vert =1$, then $\left\vert S\right\vert =1\leq\dfrac{m+k-1}{k}$ (since
$\dfrac{m+k-1}{k}\geq1$), and thus (\ref{sol.lac.size.1st.IG}) is proved in
this case. Hence, we WLOG assume that $\left\vert S\right\vert \neq1$. But
$w\in S$, so that $\left\vert S\setminus\left\{  w\right\}  \right\vert
=\left\vert S\right\vert -1\neq0$ (since $\left\vert S\right\vert \neq1$). In
other words, the set $S\setminus\left\{  w\right\}  $ is nonempty.

Now, each $g\in S\setminus\left\{  w\right\}  $ satisfies $g\leq
w-k$\ \ \ \ \footnote{\textit{Proof.} Let $g\in S\setminus\left\{  w\right\}
$. Thus, $g\neq w$ and $g\in S\setminus\left\{  w\right\}  \subseteq S$. But
each $s\in S$ satisfies $s\leq w$ (since $w$ is the maximum of $S$). Applying
this to $s=g$, we obtain $g\leq w$ (since $g\in S$). Hence, $w-g\geq0$, so
that $\left\vert w-g\right\vert =w-g$.
\par
Recall that the set $S$ is $k$-lacunar. In other words, every two distinct
elements $u,v\in S$ satisfy $\left\vert u-v\right\vert \geq k$ (by the
definition of \textquotedblleft$k$-lacunar\textquotedblright). Applying this
to $u=w$ and $v=g$, we obtain $\left\vert w-g\right\vert \geq k$ (since $w$
and $g$ are distinct (because $g\neq w$)). In other words, $w-g\geq k$ (since
$\left\vert w-g\right\vert =w-g$). Thus, $w\geq g+k$ and therefore $g\leq
w-k$. Qed.} and therefore $g\leq\underbrace{w}_{\leq m}-k\leq m-k$ and
consequently $g\in\left\{  1,2,\ldots,m-k\right\}  $ (since $g\in
S\setminus\left\{  w\right\}  \subseteq S\subseteq\left\{  1,2,\ldots
,m\right\}  $ entails $g\geq1$)\ \ \ \ \footnote{We are here following the
convention that $\left\{  1,2,\ldots,m-k\right\}  $ is the empty set when
$m-k\leq0$. (Although we shall soon see that we don't have $m-k\leq0$.)}. In
other words, $S\setminus\left\{  w\right\}  \subseteq\left\{  1,2,\ldots
,m-k\right\}  $. But recall that the set $S\setminus\left\{  w\right\}  $ is
nonempty; thus, there exists some $x\in S\setminus\left\{  w\right\}  $.
Consider this $x$. We have $x\in S\setminus\left\{  w\right\}  \subseteq
\left\{  1,2,\ldots,m-k\right\}  $, so that $1\leq x\leq m-k$, thus
$m-k\geq1\geq0$ and therefore $m-k\in\mathbb{N}$.

Furthermore, it is easy to see that any subset of a $k$-lacunar subset is
itself $k$-lacunar; hence, the set $S\setminus\left\{  w\right\}  $ is
$k$-lacunar (because it is a subset of the $k$-lacunar set $S$). Thus,
$S\setminus\left\{  w\right\}  $ is a $k$-lacunar subset of $\left\{
1,2,\ldots,m-k\right\}  $ (since $S\setminus\left\{  w\right\}  \subseteq
\left\{  1,2,\ldots,m-k\right\}  $). Hence, (\ref{sol.lac.size.1st.IH})
(applied to $m-k$ and $S\setminus\left\{  w\right\}  $ instead of $n$ and $S$)
yields%
\[
\left\vert S\setminus\left\{  w\right\}  \right\vert \leq\dfrac{\left(
m-k\right)  +k-1}{k}=\dfrac{m-1}{k}.
\]
Now, recall that $\left\vert S\setminus\left\{  w\right\}  \right\vert
=\left\vert S\right\vert -1$, so that%
\[
\left\vert S\right\vert =\underbrace{\left\vert S\setminus\left\{  w\right\}
\right\vert }_{\leq\dfrac{m-1}{k}}+1\leq\dfrac{m-1}{k}+1=\dfrac{m+k-1}{k}.
\]
Thus, (\ref{sol.lac.size.1st.IG}) is proved.

Forget that we fixed $S$. We thus have showed that if $S$ is a $k$-lacunar
subset of $\left\{  1,2,\ldots,m\right\}  $, then $\left\vert S\right\vert
\leq\dfrac{m+k-1}{k}$. In other words, Claim 1 holds for $n=m$. This completes
the induction step; thus, Claim 1 is proved.]
\end{proof}

The second solution of Exercise \ref{exe.lac.size} is more direct, and relies
on the following basic fact of enumerative combinatorics (known as the
\textit{sum rule}): If $S_{1},S_{2},\ldots,S_{k}$ are $k$ disjoint finite
sets, then the set $S_{1}\cup S_{2}\cup\cdots\cup S_{k}$ is finite and
satisfies%
\begin{equation}
\left\vert S_{1}\cup S_{2}\cup\cdots\cup S_{k}\right\vert =\left\vert
S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert . \label{sol.lac.size.sumrule}%
\end{equation}
(Note that \textquotedblleft disjoint\textquotedblright\ means
\textquotedblleft pairwise disjoint\textquotedblright; i.e., the $k$ sets
$S_{1},S_{2},\ldots,S_{k}$ are said to be disjoint if and only if every two
distinct elements $i$ and $j$ of $\left\{  1,2,\ldots,k\right\}  $ satisfy
$S_{i}\cap S_{j}=\varnothing$.) Note that this is a generalization of Theorem
\ref{thm.enum.sumrule2} to multiple (not just $2$) disjoint sets.

\begin{proof}
[Second solution to Exercise \ref{exe.lac.size}.]For each $i\in\left\{
1,2,\ldots,k\right\}  $, we define a set%
\[
S_{i}=\left\{  s+i\ \mid\ s\in S\right\}  .
\]
Roughly speaking, $S_{i}$ is just the set $S$ shifted to the right by a
distance of $i$ (on the real axis). Hence, $S_{i}$ has the same size as $S$;
that is, we have%
\begin{equation}
\left\vert S_{i}\right\vert =\left\vert S\right\vert
\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left\{  1,2,\ldots,k\right\}  .
\label{sol.lac.size.2nd.size1}%
\end{equation}


Furthermore, the sets $S_{1},S_{2},\ldots,S_{k}$ are subsets of the set
$\left\{  2,3,\ldots,n+k\right\}  $\ \ \ \ \footnote{\textit{Proof.} We must
show that $S_{i}\subseteq\left\{  2,3,\ldots,n+k\right\}  $ for each
$i\in\left\{  1,2,\ldots,k\right\}  $. Let us do this.
\par
So let $i\in\left\{  1,2,\ldots,k\right\}  $. Thus, $1\leq i\leq k$.
\par
Let $z\in S_{i}$. Thus, $z\in S_{i}=\left\{  s+i\ \mid\ s\in S\right\}  $, so
that $z=s+i$ for some $s\in S$. Consider this $s$. We have $s\in
S\subseteq\left\{  1,2,\ldots,n\right\}  $, so that $1\leq s\leq n$. Now,
$z=\underbrace{s}_{\geq1}+\underbrace{i}_{\geq1}\geq1+1=2$ and
$z=\underbrace{s}_{\leq n}+\underbrace{i}_{\leq k}\leq n+k$. Combining these
two inequalities, we obtain $2\leq z\leq n+k$ and thus $z\in\left\{
2,3,\ldots,n+k\right\}  $.
\par
Forget that we fixed $z$. We thus have shown that $z\in\left\{  2,3,\ldots
,n+k\right\}  $ for each $z\in S_{i}$. In other words, $S_{i}\subseteq\left\{
2,3,\ldots,n+k\right\}  $. This completes our proof.}. Hence, their union
$S_{1}\cup S_{2}\cup\cdots\cup S_{k}$ is a subset of $\left\{  2,3,\ldots
,n+k\right\}  $ as well. Therefore,%
\begin{align*}
\left\vert S_{1}\cup S_{2}\cup\cdots\cup S_{k}\right\vert  &  \leq\left\vert
\left\{  2,3,\ldots,n+k\right\}  \right\vert \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{because if }A\text{ is a subset of a
finite set }B\text{, then }\left\vert A\right\vert \leq\left\vert B\right\vert
\right) \\
&  =n+k-1.
\end{align*}
On the other hand, since $S$ is $k$-lacunar, it is easy to see that the $k$
sets $S_{1},S_{2},\ldots,S_{k}$ are disjoint\footnote{\textit{Proof.} We must
prove that $S_{i}\cap S_{j}=\varnothing$ for every two distinct elements $i$
and $j$ of $\left\{  1,2,\ldots,k\right\}  $. Thus, let $i$ and $j$ be two
distinct elements of $\left\{  1,2,\ldots,k\right\}  $. We must prove that
$S_{i}\cap S_{j}=\varnothing$.
\par
We WLOG assume that $i\leq j$ (since otherwise, we can swap $i$ with $j$).
Hence, $j-i\geq0$. Thus, $\left\vert j-i\right\vert =j-i$.
\par
Let $t\in S_{i}\cap S_{j}$. Thus, $t\in S_{i}\cap S_{j}\subseteq
S_{i}=\left\{  s+i\ \mid\ s\in S\right\}  $. In other words, there exists some
$s\in S$ such that $t=s+i$. Consider this $s$. From $t=s+i$, we obtain
$t-i=s\in S$. Similarly, $t-j\in S$. Moreover, $i\neq j$ (since $i$ and $j$
are distinct) and thus $t-i\neq t-j$. Hence, the elements $t-i$ and $t-j$ of
$S$ are distinct.
\par
Recall that the set $S$ is $k$-lacunar. In other words, every two distinct
elements $u,v\in S$ satisfy $\left\vert u-v\right\vert \geq k$ (by the
definition of \textquotedblleft$k$-lacunar\textquotedblright). Applying this
to $u=t-i$ and $v=t-j$, we obtain $\left\vert \left(  t-i\right)  -\left(
t-j\right)  \right\vert \geq k$. In other words, $\left\vert j-i\right\vert
\geq k$ (since $\left(  t-i\right)  -\left(  t-j\right)  =j-i$). In other
words, $j-i\geq k$ (since $\left\vert j-i\right\vert =j-i$). Therefore, $j\geq
i+k>k$ (since $i>0$). On the other hand, from $j\in\left\{  1,2,\ldots
,k\right\}  $, we obtain $j\leq k$. This contradicts $j>k$.
\par
Forget that we fixed $t$. We thus have obtained a contradiction for each $t\in
S_{i}\cap S_{j}$. Hence, there exists no $t\in S_{i}\cap S_{j}$. In other
words, $S_{i}\cap S_{j}$ is an empty set. That is, $S_{i}\cap S_{j}%
=\varnothing$. This completes our proof.}. Hence, (\ref{sol.lac.size.sumrule})
yields%
\[
\left\vert S_{1}\cup S_{2}\cup\cdots\cup S_{k}\right\vert =\left\vert
S_{1}\right\vert +\left\vert S_{2}\right\vert +\cdots+\left\vert
S_{k}\right\vert =\sum_{i=1}^{k}\underbrace{\left\vert S_{i}\right\vert
}_{\substack{=\left\vert S\right\vert \\\text{(by
(\ref{sol.lac.size.2nd.size1}))}}}=\sum_{i=1}^{k}\left\vert S\right\vert
=k\cdot\left\vert S\right\vert .
\]
Therefore,%
\[
k\cdot\left\vert S\right\vert =\left\vert S_{1}\cup S_{2}\cup\cdots\cup
S_{k}\right\vert \leq n+k-1.
\]
Dividing both sides of this inequality by $k$, we find $\left\vert
S\right\vert \leq\dfrac{n+k-1}{k}$. This solves Exercise \ref{exe.lac.size} again.
\end{proof}

\begin{proof}
[Third solution to Exercise \ref{exe.lac.size} (sketched).]This was suggested
by one of the students. We let $q=\left(  n-1\right)  //k$, and we subdivide
the set $\left\{  1,2,\ldots,n\right\}  $ into $q+1$ integer intervals%
\begin{align*}
I_{0}  &  =\left\{  1,2,\ldots,k\right\}  ,\\
I_{1}  &  =\left\{  k+1,k+2,\ldots,2k\right\}  ,\\
I_{2}  &  =\left\{  2k+1,2k+2,\ldots,3k\right\}  ,\\
&  \ldots,\\
I_{q-1}  &  =\left\{  \left(  q-1\right)  k+1,\left(  q-1\right)
k+2,\ldots,qk\right\}  ,\\
I_{q}  &  =\left\{  qk+1,qk+2,\ldots,n\right\}  .
\end{align*}
Each of these $q+1$ intervals $I_{0},I_{1},\ldots,I_{q}$ has length $\leq k$
(indeed, all but $I_{q}$ have length exactly $k$, whereas $I_{q}$ has length
$n-qk\leq k$). Therefore, each $i\in\left\{  0,1,\ldots,q\right\}  $
satisfies
\begin{equation}
\left\vert S\cap I_{i}\right\vert \leq1 \label{sol.lac.size.3rd.leq1}%
\end{equation}
(because otherwise, the set $S\cap I_{i}$ would contain at least two distinct
elements $u$ and $v$, but then these two elements would satisfy $u,v\in S$ and
$\left\vert u-v\right\vert <k$, which would contradict the assumption that $S$
is $k$-lacunar). But the sum rule (\ref{sol.lac.size.sumrule}) yields%
\begin{align*}
&  \left\vert \left(  S\cap I_{0}\right)  \cup\left(  S\cap I_{1}\right)
\cup\cdots\cup\left(  S\cap I_{q}\right)  \right\vert \\
&  =\left\vert S\cap I_{0}\right\vert +\left\vert S\cap I_{1}\right\vert
+\cdots+\left\vert S\cap I_{q}\right\vert =\sum_{i=0}^{q}%
\underbrace{\left\vert S\cap I_{i}\right\vert }_{\substack{\leq1\\\text{(by
(\ref{sol.lac.size.3rd.leq1}))}}}\leq\sum_{i=0}^{q}1\\
&  =q+1\leq\dfrac{n-1}{k}+1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }q=\left(
n-1\right)  //k=\left\lfloor \dfrac{n-1}{k}\right\rfloor \leq\dfrac{n-1}%
{k}\right) \\
&  =\dfrac{n+k-1}{k}.
\end{align*}
But $S\subseteq\left\{  1,2,\ldots,n\right\}  $ and therefore $S=\left(  S\cap
I_{0}\right)  \cup\left(  S\cap I_{1}\right)  \cup\cdots\cup\left(  S\cap
I_{q}\right)  $ (since the intervals $I_{0},I_{1},\ldots,I_{q}$ cover the
entire set $\left\{  1,2,\ldots,n\right\}  $). Hence,%
\[
\left\vert S\right\vert =\left\vert \left(  S\cap I_{0}\right)  \cup\left(
S\cap I_{1}\right)  \cup\cdots\cup\left(  S\cap I_{q}\right)  \right\vert
\leq\dfrac{n+k-1}{k}.
\]
This solves Exercise \ref{exe.lac.size} again.
\end{proof}

\begin{proof}
[Hint to a fourth solution to Exercise \ref{exe.lac.size}.]This was suggested
by one of the students. This time I will be really terse, since formalizing
this would take a while. We say that the $k$-lacunar subset $S$ is
\textit{left-flush} if it has the form
\[
\left\{  1,k+1,2k+1,3k+1,\ldots,pk+1\right\}
\]
for some $p\in\mathbb{N}\cup\left\{  -1\right\}  $ (this allows $p=-1$, in
which case $S$ will be the empty set). In other words, the $k$-lacunar subset
$S$ is left-flush if its smallest element is as small as possible (that is,
$1$), its second-smallest element is as small as possible (that is, $k+1$,
because $S$ has to be $k$-lacunar), its third-smallest element is as small as
possible (that is, $2k+1$), etc.. It is easy to see that the inequality
$\left\vert S\right\vert \leq\dfrac{n+k-1}{k}$ holds when the $k$-lacunar
subset $S$ is left-flush. Now, it remains to show that we can transform
\textbf{any} $k$-lacunar subset into a left-flush $k$-lacunar subset without
changing its size. But it is fairly clear how to do this: Just keep decreasing
the smallest element until no longer possible (i.e., until it hits $1$); then
do the same with the second-smallest element (which will end up at $k+1$
because the subset must remain $k$-lacunar); then do the same with the
third-smallest element; and so on.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.fib.gcd-nbr}}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.gcd-nbr}.]This is a classical problem
(see, e.g., \cite[Chapter 2, \S 12]{Vorobi02} or \cite[Exercise 376]{Gunder10}
or \url{https://artofproblemsolving.com/community/c6h63078p376755} ).

The solution is rather similar to the solution we gave for Exercise
\ref{exe.ent.gcd.an-1} \textbf{(b)}; but first we need a lemma:

\begin{lemma}
\label{lem.sol.fib.gcd-nbr.gcd}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Let $a,b\in\mathbb{N}$ be such that $a>0$ and
$a\leq b$. Then, $\gcd\left(  f_{a},f_{b}\right)  =\gcd\left(  f_{a}%
,f_{b-a}\right)  $.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.fib.gcd-nbr.gcd}.]From $a>0$, we obtain $a\geq1$
and thus $a-1\in\mathbb{N}$. Hence, Exercise \ref{exe.fibonacci.addition}
(applied to $n=b-a$ and $m=a-1$) yields%
\begin{align*}
f_{\left(  b-a\right)  +\left(  a-1\right)  +1}  &  =f_{b-a}f_{a-1}+f_{\left(
b-a\right)  +1}\underbrace{f_{\left(  a-1\right)  +1}}_{\substack{=f_{a}%
\\\equiv0\operatorname{mod}f_{a}}}\\
&  \equiv f_{b-a}f_{a-1}+f_{\left(  b-a\right)  +1}0=f_{b-a}f_{a-1}%
\operatorname{mod}f_{a}.
\end{align*}
In view of $\left(  b-a\right)  +\left(  a-1\right)  +1=b$, this rewrites as
$f_{b}\equiv f_{b-a}f_{a-1}\operatorname{mod}f_{a}$. Hence, Proposition
\ref{prop.ent.gcd.props1} \textbf{(d)} (applied to $f_{a}$, $f_{b}$ and
$f_{b-a}f_{a-1}$ instead of $a$, $b$ and $c$) yields%
\begin{equation}
\gcd\left(  f_{a},f_{b}\right)  =\gcd\left(  f_{a},f_{b-a}f_{a-1}\right)  .
\label{pf.lem.sol.fib.gcd-nbr.gcd.1}%
\end{equation}


But Exercise \ref{exe.sol.fib.gcd-nbrs} (applied to $n=a-1$) yields
$f_{a-1}\perp f_{\left(  a-1\right)  +1}$ (since $a-1\in\mathbb{N}$). In other
words, $f_{a-1}\perp f_{a}$. According to Proposition
\ref{prop.ent.coprime.perp-symm}, this yields $f_{a}\perp f_{a-1}$. Hence,
Proposition \ref{prop.ent.coprime.gcd=gcd} (applied to $f_{a}$, $f_{b-a}$ and
$f_{a-1}$ instead of $a$, $b$ and $c$) yields $\gcd\left(  f_{a}%
,f_{b-a}f_{a-1}\right)  =\gcd\left(  f_{a},f_{b-a}\right)  $. Thus,
(\ref{pf.lem.sol.fib.gcd-nbr.gcd.1}) becomes%
\[
\gcd\left(  f_{a},f_{b}\right)  =\gcd\left(  f_{a},f_{b-a}f_{a-1}\right)
=\gcd\left(  f_{a},f_{b-a}\right)  .
\]
This proves Lemma \ref{lem.sol.fib.gcd-nbr.gcd}.
\end{proof}

We can now step to the actual solution to Exercise \ref{exe.fib.gcd-nbr}:

\begin{proof}
[Solution to Exercise \ref{exe.fib.gcd-nbr} (sketched).]We use strong
induction on $n+m$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.fib.gcd-nbr} is true for $n+m<k$. We must
prove that Exercise \ref{exe.fib.gcd-nbr} is true for $n+m=k$. Let us do this
now, renaming $n,m$ as $a,b$ in order to match the notations from the proof of
Theorem \ref{thm.ent.gcd.bezout}.

So let $a,b\in\mathbb{N}$ be such that $a+b=k$. We must show that $\gcd\left(
f_{a},f_{b}\right)  =f_{\gcd\left(  a,b\right)  }$.

Note that $a$ and $b$ play symmetric roles in this claim\footnote{because
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} yields $\gcd\left(
a,b\right)  =\gcd\left(  b,a\right)  $ and $\gcd\left(  f_{a},f_{b}\right)
=\gcd\left(  f_{b},f_{a}\right)  $}, and thus can be swapped at will. By
swapping $a$ and $b$ if necessary, we can ensure that $a\leq b$. Hence, we
WLOG assume that $a\leq b$. Thus, $b-a\in\mathbb{N}$.

Definition \ref{def.fibonacci} easily shows that all the Fibonacci numbers
$f_{0},f_{1},f_{2},\ldots$ are nonnegative\footnote{Strictly speaking, this
can be proved by strong induction.}. Thus, $f_{\gcd\left(  a,b\right)  }$ is nonnegative.

It is easy to see that our claim $\gcd\left(  f_{a},f_{b}\right)
=f_{\gcd\left(  a,b\right)  }$ holds if $a=0$\ \ \ \ \footnote{\textit{Proof.}
Assume that $a=0$. Then, $\gcd\left(  a,b\right)  =b$ (this has already been
proved during our above proof of Theorem \ref{thm.ent.gcd.bezout}) and thus
$b=\gcd\left(  a,b\right)  $. Furthermore, from $a=0$, we obtain $f_{a}%
=f_{0}=0$ and therefore%
\begin{align*}
\gcd\left(  f_{a},f_{b}\right)   &  =\gcd\left(  0,f_{b}\right) \\
&  =\gcd\left(  f_{b},0\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =\left\vert f_{b}\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(a)}}\right) \\
&  =\left\vert f_{\gcd\left(  a,b\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b=\gcd\left(  a,b\right)  \right) \\
&  =f_{\gcd\left(  a,b\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}f_{\gcd\left(  a,b\right)  }\text{ is nonnegative}\right)  ,
\end{align*}
qed.}. Thus, we are done if $a=0$. Hence, we WLOG assume that $a\neq0$.
Therefore, $a>0$ (since $a\in\mathbb{N}$). Thus, $a+b>b$, so that $b<a+b=k$.

But our induction hypothesis says that Exercise \ref{exe.fib.gcd-nbr} is true
for $a+b<k$. Hence, we can apply Exercise \ref{exe.fib.gcd-nbr} to $b-a$
instead of $b$ (since $b-a\in\mathbb{N}$ and $a+\left(  b-a\right)  =b<k$). We
thus obtain
\begin{equation}
\gcd\left(  f_{a},f_{b-a}\right)  =f_{\gcd\left(  a,b-a\right)  }.
\label{sol.fib.gc-nbr.b.4}%
\end{equation}
But we have $\gcd\left(  a,b-a\right)  =\gcd\left(  a,b\right)  $ (this has
already been proved during our proof of Theorem \ref{thm.ent.gcd.bezout}).
Furthermore, Lemma \ref{lem.sol.fib.gcd-nbr.gcd} yields%
\begin{align*}
\gcd\left(  f_{a},f_{b}\right)   &  =\gcd\left(  f_{a},f_{b-a}\right)
=f_{\gcd\left(  a,b-a\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.fib.gc-nbr.b.4})}\right) \\
&  =f_{\gcd\left(  a,b\right)  }\ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
\gcd\left(  a,b-a\right)  =\gcd\left(  a,b\right)  \right)  .
\end{align*}


Now, forget that we fixed $a,b$. We thus have shown that any $a,b\in
\mathbb{N}$ satisfying $a+b=k$ satisfy $\gcd\left(  f_{a},f_{b}\right)
=f_{\gcd\left(  a,b\right)  }$. Renaming the variables $a$ and $b$ as $n$ and
$m$ in this statement, we obtain the following: Any $n,m\in\mathbb{N}$
satisfying $n+m=k$ satisfy $\gcd\left(  f_{n},f_{m}\right)  =f_{\gcd\left(
n,m\right)  }$. In other words, Exercise \ref{exe.fib.gcd-nbr} is true for
$n+m=k$. This completes the induction step. Thus, Exercise
\ref{exe.fib.gcd-nbr} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.fermat-num.1}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.fermat-num.1}.]Exercise
\ref{exe.ent.fermat-num.1} is a classic (see, e.g., \cite[Exercise 22 and the
paragraph thereafter]{Gunder10}). Part \textbf{(a)} is a simple induction,
while part \textbf{(b)} follows from part \textbf{(a)}. Here is the solution
in detail:

\begin{proof}
[Solution to Exercise \ref{exe.ent.fermat-num.1}.]\textbf{(a)} We proceed by
induction on $n$:

\textit{Induction base:} The definition of $F_{0}$ yields $F_{0}=2^{2^{0}%
}+1=2^{1}+1=3$. Comparing this with $\underbrace{F_{0}F_{1}\cdots F_{-1}%
}_{=\left(  \text{empty product}\right)  =1}+2=1+2=3$, we obtain $F_{0}%
=F_{0}F_{1}\cdots F_{-1}+2$. In other words, Exercise
\ref{exe.ent.fermat-num.1} \textbf{(a)} holds for $n=0$.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.ent.fermat-num.1} \textbf{(a)} holds for
$n=m$. We must prove that Exercise \ref{exe.ent.fermat-num.1} \textbf{(a)}
holds for $n=m+1$. In other words, we must prove that $F_{m+1}=F_{0}%
F_{1}\cdots F_{m}+2$.

Our induction hypothesis says that Exercise \ref{exe.ent.fermat-num.1}
\textbf{(a)} holds for $n=m$. In other words, $F_{m}=F_{0}F_{1}\cdots
F_{m-1}+2$. Solving this for $F_{0}F_{1}\cdots F_{m-1}$, we obtain%
\begin{align}
F_{0}F_{1}\cdots F_{m-1}  &  =\underbrace{F_{m}}_{\substack{=2^{2^{m}%
}+1\\\text{(by the definition of }F_{m}\text{)}}}-2=\left(  2^{2^{m}%
}+1\right)  -2\nonumber\\
&  =2^{2^{m}}-1. \label{sol.ent.fermat-num.1.a.2}%
\end{align}


Now, the definition of $F_{m+1}$ yields $F_{m+1}=2^{2^{m+1}}+1$, so that%
\[
F_{m+1}-2=\left(  2^{2^{m+1}}+1\right)  -2=2^{2^{m+1}}-1=2^{2^{m}\cdot
2}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }2^{m+1}=2^{m}\cdot2\right)  .
\]
But we know that $a^{b\cdot c}=\left(  a^{b}\right)  ^{c}$ for any
$a,b,c\in\mathbb{N}$. Applying this to $a=2$, $b=2^{m}$ and $c=2$, we find
$2^{2^{m}\cdot2}=\left(  2^{2^{m}}\right)  ^{2}$. Hence,
\[
2^{2^{m}\cdot2}-1=\left(  2^{2^{m}}\right)  ^{2}-1=\left(  2^{2^{m}}-1\right)
\left(  2^{2^{m}}+1\right)
\]
(since $a^{2}-1=\left(  a-1\right)  \left(  a+1\right)  $ for any
$a\in\mathbb{R}$). Hence,%
\[
F_{m+1}-2=2^{2^{m}\cdot2}-1=\left(  2^{2^{m}}-1\right)  \left(  2^{2^{m}%
}+1\right)  .
\]


Comparing this with%
\[
F_{0}F_{1}\cdots F_{m}=\underbrace{F_{0}F_{1}\cdots F_{m-1}}%
_{\substack{=2^{2^{m}}-1\\\text{(by (\ref{sol.ent.fermat-num.1.a.2}))}}%
}\cdot\underbrace{F_{m}}_{=2^{2^{m}}+1}=\left(  2^{2^{m}}-1\right)  \left(
2^{2^{m}}+1\right)  ,
\]
we find $F_{m+1}-2=F_{0}F_{1}\cdots F_{m}$. In other words, $F_{m+1}%
=F_{0}F_{1}\cdots F_{m}+2$. This is precisely what we needed to prove. Thus,
the induction step is complete, and Exercise \ref{exe.ent.fermat-num.1}
\textbf{(a)} is solved.

\textbf{(b)} Let $n$ and $m$ be two distinct nonnegative integers. We must
prove that $\gcd\left(  F_{n},F_{m}\right)  =1$.

Note that $\gcd\left(  F_{n},F_{m}\right)  =\gcd\left(  F_{m},F_{n}\right)  $
(by Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}). Hence, our situation
is symmetric in $n$ and $m$. Thus, we can WLOG assume that $n\geq m$ (since
otherwise, we can swap $n$ with $m$). Assume this. Then, $n>m$ (since $n$ and
$m$ are distinct and satisfy $n\geq m$). Hence, $m<n$, so that $m\leq n-1$
(since $m$ and $n$ are integers). Thus, $m\in\left\{  0,1,\ldots,n-1\right\}
$, so that $F_{m}$ is one of the factors in the product $F_{0}F_{1}\cdots
F_{n-1}$. Hence, $F_{m}\mid F_{0}F_{1}\cdots F_{n-1}$; in other words,
$F_{0}F_{1}\cdots F_{n-1}\equiv0\operatorname{mod}F_{m}$.

Exercise \ref{exe.ent.fermat-num.1} \textbf{(a)} yields $F_{n}%
=\underbrace{F_{0}F_{1}\cdots F_{n-1}}_{\equiv0\operatorname{mod}F_{m}%
}+2\equiv0+2=2\operatorname{mod}F_{m}$. Thus, Proposition
\ref{prop.ent.gcd.props1} \textbf{(d)} (applied to $a=F_{m}$, $b=F_{n}$ and
$c=2$) yields $\gcd\left(  F_{m},F_{n}\right)  =\gcd\left(  F_{m},2\right)  $.

But the definition of $F_{m}$ yields $F_{m}=2^{2^{m}}+1$. From $2^{m}>0$, we
conclude that $2^{2^{m}}$ is divisible by $2$, so that $2^{2^{m}}%
\equiv0\operatorname{mod}2$. Hence, $F_{m}=\underbrace{2^{2^{m}}}%
_{\equiv0\operatorname{mod}2}+1\equiv0+1=1\operatorname{mod}2$. In view of
Exercise \ref{exe.ent.even-odd.1} \textbf{(d)}, this shows that $F_{m}$ is
odd. In other words, $2\nmid F_{m}$. From this, it easily follows that
$\gcd\left(  F_{m},2\right)  =1$\ \ \ \ \footnote{\textit{Proof.} Proposition
\ref{prop.ent.gcd.props1} \textbf{(f)} yields $\gcd\left(  F_{m},2\right)
\mid F_{m}$ and $\gcd\left(  F_{m},2\right)  \mid2$. But $\gcd\left(
F_{m},2\right)  $ is a nonnegative integer (by Proposition
\ref{prop.ent.gcd.pos} \textbf{(a)}). Hence, from $\gcd\left(  F_{m},2\right)
\mid2$, we conclude that $\gcd\left(  F_{m},2\right)  $ is a nonnegative
divisor of $2$. Since the only nonnegative divisors of $2$ are $1$ and $2$, we
thus have either $\gcd\left(  F_{m},2\right)  =1$ or $\gcd\left(
F_{m},2\right)  =2$. But $\gcd\left(  F_{m},2\right)  =2$ is impossible, since
this would yield $2=\gcd\left(  F_{m},2\right)  \mid F_{m}$, which would
contradict $2\nmid F_{m}$. Hence, the only option that remains is $\gcd\left(
F_{m},2\right)  =1$.}. Hence,
\[
\gcd\left(  F_{n},F_{m}\right)  =\gcd\left(  F_{m},F_{n}\right)  =\gcd\left(
F_{m},2\right)  =1.
\]
This solves Exercise \ref{exe.ent.fermat-num.1} \textbf{(b)}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.fac.reddit-odd1}}

\begin{proof}
[Discussion of Exercise \ref{exe.fac.reddit-odd1}.]This is clearly a followup
to Exercise \ref{exe.fac.reddit}, meant to illustrate that $\dfrac
{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{q!}$ can be a perfect square
not just when $n$ is even but also for some odd values of $n$. In order to
solve this, we fix some $n\in\mathbb{N}$, and we recall the equality%
\begin{equation}
1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !=\left(  \prod_{k=1}^{n}\left(
\left(  2k-1\right)  !\right)  ^{2}\right)  \cdot2^{n}n!
\label{sol.fac.reddit-odd1.1}%
\end{equation}
that was proved in our solution to Exercise \ref{exe.fac.reddit}. (Our proof
of this equality made no use of the assumption that $n$ be even.) Thus, for
each integer $n\geq2$, we have%
\begin{align}
\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{\left(  n+1\right)  !}
&  =\dfrac{\left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)
^{2}\right)  \cdot2^{n}n!}{\left(  n+1\right)  !}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.fac.reddit-odd1.1})}\right) \nonumber\\
&  =\left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)  ^{2}\right)
\cdot\underbrace{2^{n}}_{=\left(  2^{\left(  n-1\right)  /2}\right)  ^{2}%
\cdot2}\cdot\underbrace{\dfrac{n!}{\left(  n+1\right)  !}}_{=\dfrac{1}{n+1}%
}\nonumber\\
&  =\left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)  ^{2}\right)
\cdot\left(  2^{\left(  n-1\right)  /2}\right)  ^{2}\cdot2\cdot\dfrac{1}%
{n+1}\nonumber\\
&  =\left(  \left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)  !\right)
\right)  \cdot2^{\left(  n-1\right)  /2}\right)  ^{2}\cdot\dfrac{2}%
{n+1}\nonumber\\
&  =\underbrace{\left(  \left(  \prod_{k=1}^{n}\left(  \left(  2k-1\right)
!\right)  \right)  \cdot\dfrac{2^{\left(  n-1\right)  /2}}{n+1}\right)  ^{2}%
}_{\substack{\text{a perfect square when }n\text{ is odd}\\\text{(indeed, the
denominator }n+1\\\text{is cancelled by the }\left(  2n-1\right)
!\\\text{factor in the product)}}}\cdot2\left(  n+1\right)  .
\label{sol.fac.reddit-odd1.2}%
\end{align}


Now, we want to find odd positive integers $n$ for which $\dfrac
{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)  !}{\left(  n+1\right)  !}$ is a
perfect square. If $n\geq2$ is such an integer, then
(\ref{sol.fac.reddit-odd1.1}) suggests that $2\left(  n+1\right)  $ should be
a perfect square\footnote{At least this is a sufficient condition. (It is also
necessary, but this needs a bit more thought.)}. In other words, we should
have $2\left(  n+1\right)  =u^{2}$ for some $u\in\mathbb{Z}$. Solving this
equation for $n$, we obtain $n=\dfrac{u^{2}}{2}-1$. For $\dfrac{u^{2}}{2}$ to
be an integer, $u$ should be even (check this!), so that $u=2v$ for some
$v\in\mathbb{Z}$. Thus, $n=\dfrac{u^{2}}{2}-1=\dfrac{\left(  2v\right)  ^{2}%
}{2}-1=2v^{2}-1$.

So we have shown that $\dfrac{1!\cdot2!\cdot\cdots\cdot\left(  2n\right)
!}{\left(  n+1\right)  !}$ is a perfect square whenever $n\geq2$ is an integer
of the form $n=2v^{2}-1$ for some $v\in\mathbb{Z}$. It is clear that any
integer of this form is odd, and furthermore there are infinitely many
integers of this form that are $\geq2$. Thus, there are infinitely many odd
positive integers $n$ for which $\dfrac{1!\cdot2!\cdot\cdots\cdot\left(
2n\right)  !}{\left(  n+1\right)  !}$ is a perfect square (namely, all
integers of the form $n=2v^{2}-1$ for $v\in\mathbb{Z}$ satisfying $v\geq2$).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.floor.hermite-m}}

\begin{proof}
[Discussion of Exercise \ref{exe.floor.hermite-m}.]This is a generalization of
Exercise \ref{exe.floor.hermite} (which can be recovered by setting $m=1$).
But we will solve this using Exercise \ref{exe.floor.hermite} (so we will not
get a new solution to Exercise \ref{exe.floor.hermite}). We will use the
following basic property of sums:

\begin{proposition}
\label{prop.sol.floor.hermite-m.sumsplit}Let $S$ be a finite set. Let
$S_{1},S_{2},\ldots,S_{m}$ be $m$ subsets of $S$, where $m\in\mathbb{N}$.
Assume that these subsets $S_{1},S_{2},\ldots,S_{m}$ are disjoint (i.e., we
have $S_{i}\cap S_{j}=\varnothing$ for any two distinct elements $i$ and $j$
of $\left\{  1,2,\ldots,m\right\}  $) and their union is $S$. Let $a_{s}$ be a
number for each $s\in S$. Then,%
\[
\sum_{s\in S}a_{s}=\sum_{s\in S_{1}}a_{s}+\sum_{s\in S_{2}}a_{s}+\cdots
+\sum_{s\in S_{m}}a_{s}.
\]

\end{proposition}

Proposition \ref{prop.sol.floor.hermite-m.sumsplit} is a slightly rewritten
version of \cite[(26)]{detnotes} (with $n$ renamed as $m$).

We will also use the following simple property of floors:

\begin{proposition}
\label{prop.sol.floor.floorplusint}Let $x\in\mathbb{R}$ and $k\in\mathbb{Z}$.
Then, $\left\lfloor x+k\right\rfloor =\left\lfloor x\right\rfloor +k$.
\end{proposition}

The proof of Proposition \ref{prop.sol.floor.floorplusint} can be found in
\cite[proof of Proposition 1.1.10]{floor}. (The definition of the floor of a
number given in \cite{floor} is a bit different from the one we gave; but
\cite[Corollary 1.1.6]{floor} shows that the two definitions are equivalent.)

\begin{proof}
[Solution to Exercise \ref{exe.floor.hermite-m}.]The interval $\left\{
0,1,\ldots,mn-1\right\}  $ can be written as the union of the $m$ disjoint
intervals%
\begin{align*}
&  \left\{  0,1,\ldots,n-1\right\}  ,\\
&  \left\{  n,n+1,\ldots,2n-1\right\}  ,\\
&  \left\{  2n,2n+1,\ldots,3n-1\right\}  ,\\
&  \ldots,\\
&  \left\{  \left(  m-1\right)  n,\left(  m-1\right)  n+1,\ldots,mn-1\right\}
\end{align*}
(each containing exactly $n$ numbers). Hence, Proposition
\ref{prop.sol.floor.hermite-m.sumsplit} shows that the sum $\sum_{k=0}%
^{mn-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor $ can be split into $m$
smaller sums as follows:%
\begin{align*}
&  \sum_{k=0}^{mn-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor \\
&  =\sum_{k=0}^{n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\sum
_{k=n}^{2n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\sum_{k=2n}%
^{3n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor +\cdots+\sum_{k=\left(
m-1\right)  n}^{mn-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor \\
&  =\sum_{i=0}^{m-1}\underbrace{\sum_{k=in}^{\left(  i+1\right)
n-1}\left\lfloor x+\dfrac{k}{n}\right\rfloor }_{\substack{=\sum_{k=0}%
^{n-1}\left\lfloor x+\dfrac{k+in}{n}\right\rfloor \\\text{(here, we have
substituted }k+in\\\text{for }k\text{ in the sum)}}}=\sum_{i=0}^{m-1}%
\sum_{k=0}^{n-1}\left\lfloor \underbrace{x+\dfrac{k+in}{n}}_{=x+i+\dfrac{k}%
{n}}\right\rfloor \\
&  =\sum_{i=0}^{m-1}\underbrace{\sum_{k=0}^{n-1}\left\lfloor x+i+\dfrac{k}%
{n}\right\rfloor }_{\substack{=\left\lfloor n\left(  x+i\right)  \right\rfloor
\\\text{(by Exercise \ref{exe.floor.hermite},}\\\text{applied to }x+i\text{
instead of }x\text{)}}}=\sum_{i=0}^{m-1}\underbrace{\left\lfloor
nx+ni\right\rfloor }_{\substack{=\left\lfloor nx\right\rfloor +ni\\\text{(by
Proposition \ref{prop.sol.floor.floorplusint},}\\\text{applied to }nx\text{
and }ni\text{ instead of }x\text{ and }k\text{)}}}\\
&  =\sum_{i=0}^{m-1}\left(  \left\lfloor nx\right\rfloor +ni\right)
=\underbrace{\sum_{i=0}^{m-1}\left\lfloor nx\right\rfloor }_{=m\left\lfloor
nx\right\rfloor }+\underbrace{\sum_{i=0}^{m-1}ni}_{=n\sum_{i=0}^{m-1}%
i}=m\left\lfloor nx\right\rfloor +n\underbrace{\sum_{i=0}^{m-1}i}%
_{\substack{=0+1+\cdots+\left(  m-1\right)  \\=1+2+\cdots+\left(  m-1\right)
}}\\
&  =m\left\lfloor nx\right\rfloor +n\underbrace{\left(  1+2+\cdots+\left(
m-1\right)  \right)  }_{\substack{=\dfrac{\left(  m-1\right)  \left(  \left(
m-1\right)  +1\right)  }{2}\\\text{(by (\ref{eq.ind.little-gauss}), applied to
}m-1\text{ instead of }n\text{)}}}\\
&  =m\left\lfloor nx\right\rfloor +\underbrace{n\dfrac{\left(  m-1\right)
\left(  \left(  m-1\right)  +1\right)  }{2}}_{=n\dfrac{\left(  m-1\right)
m}{2}=m\dfrac{n\left(  m-1\right)  }{2}}=m\left\lfloor nx\right\rfloor
+m\dfrac{n\left(  m-1\right)  }{2}\\
&  =m\left(  \left\lfloor nx\right\rfloor +\dfrac{n\left(  m-1\right)  }%
{2}\right)  .
\end{align*}
This solves Exercise \ref{exe.floor.hermite-m}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.fib.mod5}}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.mod5}.]This is a straightforward strong
induction proof, similar to the solution of Exercise \ref{exe.fib.parity}. We
apply strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.fib.mod5} holds for all $n<m$. We must
prove that Exercise \ref{exe.fib.mod5} for $n=m$. In other words, we must
prove that%
\begin{equation}
f_{m}\equiv f_{m\%5}\cdot3^{m//5}\operatorname{mod}5.
\label{sol.fib.mod5.goal}%
\end{equation}


If $m<5$, then we can see this easily from $m\%5=m$ and $m//5=0$. Thus, we
WLOG assume that $m\geq5$. Hence, $m-2$ and $m-1$ are nonnegative integers.
Since these two nonnegative integers $m-2$ and $m-1$ are $<m$, we can thus
apply Exercise \ref{exe.fib.mod5} to $n=m-2$ and to $n=m-1$ (by our induction
hypothesis). We thus obtain%
\[
f_{m-1}\equiv f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)
//5}\operatorname{mod}5
\]
and%
\[
f_{m-2}\equiv f_{\left(  m-2\right)  \%5}\cdot3^{\left(  m-2\right)
//5}\operatorname{mod}5.
\]
Adding these two congruences, we obtain%
\[
f_{m-1}+f_{m-2}\equiv f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)
//5}+f_{\left(  m-2\right)  \%5}\cdot3^{\left(  m-2\right)  //5}%
\operatorname{mod}5.
\]
This rewrites as%
\begin{equation}
f_{m}\equiv f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)
//5}+f_{\left(  m-2\right)  \%5}\cdot3^{\left(  m-2\right)  //5}%
\operatorname{mod}5 \label{sol.fib.mod5.goal2}%
\end{equation}
(since the recursive definition of the Fibonacci sequence yields
$f_{m}=f_{m-1}+f_{m-2}$). Our goal is now to deduce (\ref{sol.fib.mod5.goal})
from this congruence. In order to do so, it suffices to show that%
\begin{equation}
f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)  //5}+f_{\left(
m-2\right)  \%5}\cdot3^{\left(  m-2\right)  //5}\equiv f_{m\%5}\cdot
3^{m//5}\operatorname{mod}5 \label{sol.fib.mod5.goal3}%
\end{equation}
(because then, combining (\ref{sol.fib.mod5.goal2}) with
(\ref{sol.fib.mod5.goal3}) will immediately yield (\ref{sol.fib.mod5.goal}) by
the transitivity of congruence).

The proof of (\ref{sol.fib.mod5.goal3}) is an easy case distinction. Indeed,
Proposition \ref{prop.ent.quorem.props} \textbf{(a)} (applied to $n=5$ and
$u=m$) yields that $m\%5\in\left\{  0,1,2,3,4\right\}  $ and $m\%5\equiv
m\operatorname{mod}5$. Symmetry of congruence yields $m\equiv
m\%5\operatorname{mod}5$ (since $m\%5\equiv m\operatorname{mod}5$). Since
$m\%5\in\left\{  0,1,2,3,4\right\}  $, we are in one of the following five cases:

\textit{Case 1:} We have $m\%5=0$.

\textit{Case 2:} We have $m\%5=1$.

\textit{Case 3:} We have $m\%5=2$.

\textit{Case 4:} We have $m\%5=3$.

\textit{Case 5:} We have $m\%5=4$.

Before I get to any of these cases, let me say a few generalities. We want to
know how the numbers $k//5$ and $k\%5$ change when an integer $k$ is
incremented (i.e., increased by $1$). The answer is fairly easy:

\begin{statement}
\textit{Observation 1:} When an integer $k$ is incremented, its quotient
$k//5$ upon division by $5$ stays the same unless $5\mid k+1$, in which case
$k//5$ also increases by $1$.
\end{statement}

\begin{statement}
\textit{Observation 2:} When an integer $k$ is incremented, its remainder
$k\%5$ upon division by $5$ increases by $1$ unless $5\mid k+1$, in which case
$k\%5$ changes from $4$ to $0$.
\end{statement}

\noindent We leave the proofs of these two observations to the
reader.\footnote{We won't actually use Observation 2; we stated it only for
the sake of completeness.} Observation 1 entails that%
\begin{equation}
m//5=%
\begin{cases}
\left(  m-1\right)  //5, & \text{if }5\nmid m;\\
\left(  m-1\right)  //5+1, & \text{if }5\mid m
\end{cases}
\label{sol.fib.mod5.m//5}%
\end{equation}
and%
\begin{equation}
\left(  m-1\right)  //5=%
\begin{cases}
\left(  m-2\right)  //5, & \text{if }5\nmid m-1;\\
\left(  m-2\right)  //5+1, & \text{if }5\mid m-1.
\end{cases}
\label{sol.fib.mod5.m-1//5}%
\end{equation}
With these equalities in hand, let us analyze the above five cases.

We begin with Case 1. In this case, we have $m\%5=0$. Thus, $m\equiv
m\%5=0\operatorname{mod}5$. Thus, $\underbrace{m}_{\equiv0\operatorname{mod}%
5}-1\equiv0-1\equiv4\operatorname{mod}5$ and $\underbrace{m}_{\equiv
0\operatorname{mod}5}-2\equiv0-2\equiv3\operatorname{mod}5$. From these three
congruences, it easily follows (using Proposition \ref{prop.ent.quorem.props}
\textbf{(c)}) that $m\%5=0$ and $\left(  m-1\right)  \%5=4$ and $\left(
m-2\right)  \%5=3$. Let us next express $\left(  m-1\right)  //5$ and $\left(
m-2\right)  //5$ through $m//5$. Indeed, $m\%5=0$ entails $5\mid m$, hence
$m//5=\left(  m-1\right)  //5+1$ (because of (\ref{sol.fib.mod5.m//5})).
Solving this for $\left(  m-1\right)  //5$, we obtain $\left(  m-1\right)
//5=m//5-1$. Furthermore, $\left(  m-1\right)  \%5=4\neq0$ entails $5\nmid
m-1$ and therefore $\left(  m-1\right)  //5=\left(  m-2\right)  //5$ (by
(\ref{sol.fib.mod5.m-1//5})). Thus, $\left(  m-2\right)  //5=\left(
m-1\right)  //5=m//5-1$. Now,%
\begin{align*}
&  \underbrace{f_{\left(  m-1\right)  \%5}}_{\substack{=f_{4}\\\text{(since
}\left(  m-1\right)  \%5=4\text{)}}}\cdot\underbrace{3^{\left(  m-1\right)
//5}}_{\substack{=3^{m//5-1}\\\text{(since }\left(  m-1\right)
//5=m//5-1\text{)}}}+\underbrace{f_{\left(  m-2\right)  \%5}}%
_{\substack{=f_{3}\\\text{(since }\left(  m-2\right)  \%5=3\text{)}}%
}\cdot\underbrace{3^{\left(  m-2\right)  //5}}_{\substack{=3^{m//5-1}%
\\\text{(since }\left(  m-2\right)  //5=m//5-1\text{)}}}\\
&  =\underbrace{f_{4}}_{=3}\cdot3^{m//5-1}+\underbrace{f_{3}}_{=2}%
\cdot3^{m//5-1}=3\cdot3^{m//5-1}+2\cdot3^{m//5-1}=\underbrace{\left(
3+2\right)  }_{\equiv0\operatorname{mod}5}\cdot3^{m//5-1}\\
&  \equiv0\operatorname{mod}5.
\end{align*}
Comparing this with%
\[
\underbrace{f_{m\%5}}_{\substack{=f_{0}\\\text{(since }m\%5=0\text{)}}%
}\cdot3^{m//5}=\underbrace{f_{0}}_{=0}\cdot3^{m//5}=0\equiv0\operatorname{mod}%
5,
\]
we obtain $f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)
//5}+f_{\left(  m-2\right)  \%5}\cdot3^{\left(  m-2\right)  //5}\equiv
f_{m\%5}\cdot3^{m//5}\operatorname{mod}5$. Thus, we have proved
(\ref{sol.fib.mod5.goal3}) in Case 1.

Next, let us handle Case 2. In this case, we have $m\%5=1$. Thus, $m\equiv
m\%5=1\operatorname{mod}5$. Thus, $\underbrace{m}_{\equiv1\operatorname{mod}%
5}-1\equiv1-1=0\operatorname{mod}5$ and $\underbrace{m}_{\equiv
1\operatorname{mod}5}-2\equiv1-2\equiv4\operatorname{mod}5$. From these three
congruences, it easily follows (using Proposition \ref{prop.ent.quorem.props}
\textbf{(c)}) that $m\%5=1$ and $\left(  m-1\right)  \%5=0$ and $\left(
m-2\right)  \%5=4$. Let us next express $\left(  m-1\right)  //5$ and $\left(
m-2\right)  //5$ through $m//5$. Indeed, $m\%5=1\neq0$ entails $5\nmid m$,
hence $m//5=\left(  m-1\right)  //5$ (because of (\ref{sol.fib.mod5.m//5})).
Solving this for $\left(  m-1\right)  //5$, we obtain $\left(  m-1\right)
//5=m//5$. Furthermore, $\left(  m-1\right)  \%5=0$ entails $5\mid m-1$ and
therefore $\left(  m-1\right)  //5=\left(  m-2\right)  //5+1$ (by
(\ref{sol.fib.mod5.m-1//5})). Thus, $\left(  m-2\right)
//5=\underbrace{\left(  m-1\right)  //5}_{=m//5}-1=m//5-1$. Now,%
\begin{align*}
&  \underbrace{f_{\left(  m-1\right)  \%5}}_{\substack{=f_{0}\\\text{(since
}\left(  m-1\right)  \%5=0\text{)}}}\cdot\underbrace{3^{\left(  m-1\right)
//5}}_{\substack{=3^{m//5}\\\text{(since }\left(  m-1\right)  //5=m//5\text{)}%
}}+\underbrace{f_{\left(  m-2\right)  \%5}}_{\substack{=f_{4}\\\text{(since
}\left(  m-2\right)  \%5=4\text{)}}}\cdot\underbrace{3^{\left(  m-2\right)
//5}}_{\substack{=3^{m//5-1}\\\text{(since }\left(  m-2\right)
//5=m//5-1\text{)}}}\\
&  =\underbrace{f_{0}}_{=0}\cdot3^{m//5}+\underbrace{f_{4}}_{=3}%
\cdot3^{m//5-1}=3\cdot3^{m//5-1}=3^{m//5}\equiv3^{m//5}\operatorname{mod}5.
\end{align*}
Comparing this with%
\[
\underbrace{f_{m\%5}}_{\substack{=f_{1}\\\text{(since }m\%5=1\text{)}}%
}\cdot3^{m//5}=\underbrace{f_{1}}_{=1}\cdot3^{m//5}=3^{m//5}\equiv
3^{m//5}\operatorname{mod}5,
\]
we obtain $f_{\left(  m-1\right)  \%5}\cdot3^{\left(  m-1\right)
//5}+f_{\left(  m-2\right)  \%5}\cdot3^{\left(  m-2\right)  //5}\equiv
f_{m\%5}\cdot3^{m//5}\operatorname{mod}5$. (Actually, this holds even as an
equality, not just as a congruence; i.e., the two sides are equal.) Thus, we
have proved (\ref{sol.fib.mod5.goal3}) in Case 2.

We leave it to the reader to prove (\ref{sol.fib.mod5.goal3}) in the remaining
three cases. (In all of these three cases, just as in Case 2, the congruence
(\ref{sol.fib.mod5.goal3}) holds as an equality, not just as a congruence.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.gcd.diff-pos}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.gcd.diff-pos}.]Theorem
\ref{thm.ent.gcd.bezout} yields that there exist integers $x\in\mathbb{Z}$ and
$y\in\mathbb{Z}$ such that $\gcd\left(  a,b\right)  =xa+yb$. Consider these
$x$ and $y$, and denote them by $x^{\prime}$ and $y^{\prime}$. (We do not want
to call them $x$ and $y$, since they are not the $x$ and $y$ we are looking
for.) Thus, $x^{\prime}$ and $y^{\prime}$ are integers satisfying $\gcd\left(
a,b\right)  =x^{\prime}a+y^{\prime}b$. Hence, $\gcd\left(  a,b\right)
=x^{\prime}a+y^{\prime}b=x^{\prime}a-\left(  -y^{\prime}\right)  b$.

If $x^{\prime}$ and $-y^{\prime}$ are positive, then we are already done
(since we can just take $x=x^{\prime}$ and $y=-y^{\prime}$). But $x^{\prime}$
and $-y^{\prime}$ might not be positive yet. The trick is now to modify
$x^{\prime}$ and $-y^{\prime}$ in such a way that they become positive but the
difference $x^{\prime}a-\left(  -y^{\prime}\right)  b$ is unchanged. (This is
the same technique that we used in the solution to Exercise
\ref{exe.ent.gcd.xa+yb-positive}.)

How can we modify $x^{\prime}$ and $-y^{\prime}$ in a way that $x^{\prime
}a-\left(  -y^{\prime}\right)  b$ is unchanged? A simple way to do so is to
add $b$ to $x^{\prime}$ and subtract $a$ from $y^{\prime}$ (because this
causes $x^{\prime}a-\left(  -y^{\prime}\right)  b$ to become $\left(
x^{\prime}+b\right)  a-\left(  -\left(  y^{\prime}-a\right)  \right)  b$,
which is still the same as $x^{\prime}a-\left(  -y^{\prime}\right)  b$). More
generally, we can pick any $d\in\mathbb{Z}$ and add $db$ to $x^{\prime}$ and
subtract $da$ from $y^{\prime}$. Obviously, if we pick $d$ large enough, then
this will cause $x^{\prime}$ and $-y^{\prime}$ to become positive (since $b$
and $a$ are positive), and we will be done.

Let us make this more explicit: Pick any integer $d$ such that $d>\max\left\{
\dfrac{-x^{\prime}}{b},\dfrac{y^{\prime}}{a}\right\}  $. (Such a $d$ clearly
exists, since the integers are unbounded from above.) Then, we have
$d>\max\left\{  \dfrac{-x^{\prime}}{b},\dfrac{y^{\prime}}{a}\right\}
\geq\dfrac{-x^{\prime}}{b}$. Multiplying this inequality by $b$, we obtain
$bd>-x^{\prime}$ (since $b>0$), so that $x^{\prime}+bd>0$. Furthermore,
$d>\max\left\{  \dfrac{-x^{\prime}}{b},\dfrac{y^{\prime}}{a}\right\}
\geq\dfrac{y^{\prime}}{a}$. Multiplying this inequality by $a$, we obtain
$ad>y^{\prime}$ (since $a>0$), so that $-y^{\prime}+ad>0$. Now, we know that
$x^{\prime}+bd$ and $-y^{\prime}+ad$ are positive integers (since $x^{\prime
}+bd>0$ and $-y^{\prime}+ad>0$) and satisfy%
\[
\gcd\left(  a,b\right)  =\left(  x^{\prime}+bd\right)  a-\left(  -y^{\prime
}+ad\right)  b
\]
(because $\left(  x^{\prime}+bd\right)  a-\left(  -y^{\prime}+ad\right)
b=x^{\prime}a+y^{\prime}b=\gcd\left(  a,b\right)  $). Hence, there exist
positive integers $x$ and $y$ such that $\gcd\left(  a,b\right)  =xa-yb$
(namely, $x=x^{\prime}+bd$ and $y=-y^{\prime}+ad$). This solves Exercise
\ref{exe.ent.gcd.diff-pos}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.bases.balter}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.bases.balter}.]Exercise
\ref{exe.ent.bases.balter} is a twist on the well-known fact that every
nonnegative integer has a unique base-$3$ representation (i.e., a unique
representation in the form $b_{m}3^{m}+b_{m-1}3^{m-1}+\cdots+b_{0}3^{0}$ for
some $m\in\mathbb{N}$ and some $b_{0},b_{1},\ldots,b_{m}\in\left\{
0,1,2\right\}  $ with $b_{m}\neq0$). A proof of the latter can be found, e.g.,
in \cite[\S 7.3, subsection on \textquotedblleft Application: tests for
divisibility\textquotedblright]{Newste20} or in \cite[Section 13, Theorem
3]{Dudley12}. (See also \cite[\S 7.1]{BecGeo10}, where the same proof is given
for the more familiar base-$10$ representation.) The solution to Exercise
\ref{exe.ent.bases.balter} that we shall outline below is inspired by the
proof of this fact.

\begin{proof}
[Solution to Exercise \ref{exe.ent.bases.balter} (sketched).]In the following,
a \textit{balanced ternary expression} of an integer $a$ will mean a way to
express $a$ in the form
\[
a=3^{m}+b_{m-1}3^{m-1}+b_{m-2}3^{m-2}+\cdots+b_{0}3^{0}%
\]
with $m\in\mathbb{N}$ and $b_{0},b_{1},\ldots,b_{m-1}\in\left\{
0,1,-1\right\}  $. Thus, we must prove that any positive integer $a$ has a
unique balanced ternary expression.

Let us first prove that no positive integer has more than one such expression.
To do so, we shall show the following lemma:

\begin{lemma}
\label{lem.sol.ent.bases.balter.uni}Let $k\in\mathbb{N}$. If $\left(
c_{0},c_{1},\ldots,c_{k}\right)  $ and $\left(  d_{0},d_{1},\ldots
,d_{k}\right)  $ are two $\left(  k+1\right)  $-tuples of elements of
$\left\{  0,1,-1\right\}  $ satisfying%
\begin{equation}
c_{k}3^{k}+c_{k-1}3^{k-1}+\cdots+c_{0}3^{0}=d_{k}3^{k}+d_{k-1}3^{k-1}%
+\cdots+d_{0}3^{0}, \label{eq.lem.sol.ent.bases.balter.uni.1}%
\end{equation}
then $\left(  c_{0},c_{1},\ldots,c_{k}\right)  =\left(  d_{0},d_{1}%
,\ldots,d_{k}\right)  $.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.ent.bases.balter.uni}.]We shall prove Lemma
\ref{lem.sol.ent.bases.balter.uni} by induction over $k$.

\textit{Induction base:} Lemma \ref{lem.sol.ent.bases.balter.uni} holds for
$k=0$ (because if $k=0$, then (\ref{eq.lem.sol.ent.bases.balter.uni.1})
simplifies to $c_{0}3^{0}=d_{0}3^{0}$, which clearly implies $c_{0}=d_{0}$ and
thus $\left(  c_{0}\right)  =\left(  d_{0}\right)  $).

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Lemma \ref{lem.sol.ent.bases.balter.uni} holds for $k=m-1$.
We must prove that Lemma \ref{lem.sol.ent.bases.balter.uni} holds for $k=m$.

Our induction hypothesis says that Lemma \ref{lem.sol.ent.bases.balter.uni}
holds for $k=m-1$. In other words, if $\left(  c_{0},c_{1},\ldots
,c_{m-1}\right)  $ and $\left(  d_{0},d_{1},\ldots,d_{m-1}\right)  $ are two
$m$-tuples of elements of $\left\{  0,1,-1\right\}  $ satisfying%
\[
c_{m-1}3^{m-1}+c_{m-2}3^{m-2}+\cdots+c_{0}3^{0}=d_{m-1}3^{m-1}+d_{m-2}%
3^{m-2}+\cdots+d_{0}3^{0},
\]
then%
\begin{equation}
\left(  c_{0},c_{1},\ldots,c_{m-1}\right)  =\left(  d_{0},d_{1},\ldots
,d_{m-1}\right)  . \label{pf.lem.sol.ent.bases.balter.uni.stat}%
\end{equation}


Now, we need to prove that Lemma \ref{lem.sol.ent.bases.balter.uni} holds for
$k=m$. So let $\left(  c_{0},c_{1},\ldots,c_{m}\right)  $ and $\left(
d_{0},d_{1},\ldots,d_{m}\right)  $ be two $\left(  m+1\right)  $-tuples of
elements of $\left\{  0,1,-1\right\}  $ satisfying%
\begin{equation}
c_{m}3^{m}+c_{m-1}3^{m-1}+\cdots+c_{0}3^{0}=d_{m}3^{m}+d_{m-1}3^{m-1}%
+\cdots+d_{0}3^{0}. \label{pf.lem.sol.ent.bases.balter.uni.1}%
\end{equation}
Then,%
\begin{align*}
d_{m}3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}  &  =\underbrace{d_{m}%
3^{m}+d_{m-1}3^{m-1}+\cdots+d_{1}3^{1}}_{\substack{=3\cdot\left(  d_{m}%
3^{m-1}+d_{m-1}3^{m-2}+\cdots+d_{1}3^{0}\right)  \\\equiv0\operatorname{mod}%
3}}+d_{0}\underbrace{3^{0}}_{=1}\\
&  \equiv0+d_{0}\cdot1=d_{0}\operatorname{mod}3
\end{align*}
and similarly%
\[
c_{m}3^{m}+c_{m-1}3^{m-1}+\cdots+c_{0}3^{0}\equiv c_{0}\operatorname{mod}3.
\]
Hence,%
\begin{align*}
c_{0}  &  \equiv c_{m}3^{m}+c_{m-1}3^{m-1}+\cdots+c_{0}3^{0}\\
&  =d_{m}3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{pf.lem.sol.ent.bases.balter.uni.1})}\right) \\
&  \equiv d_{0}\operatorname{mod}3.
\end{align*}
But $c_{0}$ and $d_{0}$ both are elements of $\left\{  0,1,-1\right\}  $, and
thus can only be congruent modulo $3$ if they are equal\footnote{Indeed, it is
easy to check that no two distinct elements of $\left\{  0,1,-1\right\}  $ are
congruent modulo $3$.}. Thus, from $c_{0}\equiv d_{0}\operatorname{mod}3$, we
obtain $c_{0}=d_{0}$. Thus, $c_{0}3^{0}=d_{0}3^{0}$. Subtracting the latter
equality from the equality (\ref{pf.lem.sol.ent.bases.balter.uni.1}), we
obtain%
\[
c_{m}3^{m}+c_{m-1}3^{m-1}+\cdots+c_{1}3^{1}=d_{m}3^{m}+d_{m-1}3^{m-1}%
+\cdots+d_{1}3^{1}.
\]
Dividing both sides of this new equality by $3$, we find%
\[
c_{m}3^{m-1}+c_{m-1}3^{m-2}+\cdots+c_{1}3^{0}=d_{m}3^{m-1}+d_{m-1}%
3^{m-2}+\cdots+d_{1}3^{0}.
\]
Consequently, we can apply (\ref{pf.lem.sol.ent.bases.balter.uni.stat}) to
$\left(  c_{1},c_{2},\ldots,c_{m}\right)  $ and $\left(  d_{1},d_{2}%
,\ldots,d_{m}\right)  $ instead of $\left(  c_{0},c_{1},\ldots,c_{m-1}\right)
$ and $\left(  d_{0},d_{1},\ldots,d_{m-1}\right)  $. As a result, we obtain
$\left(  c_{1},c_{2},\ldots,c_{m}\right)  =\left(  d_{1},d_{2},\ldots
,d_{m}\right)  $. Together with $c_{0}=d_{0}$, this yields $\left(
c_{0},c_{1},\ldots,c_{m}\right)  =\left(  d_{0},d_{1},\ldots,d_{m}\right)  $.

Forget that we fixed $\left(  c_{0},c_{1},\ldots,c_{m}\right)  $ and $\left(
d_{0},d_{1},\ldots,d_{m}\right)  $. We thus have shown that if $\left(
c_{0},c_{1},\ldots,c_{m}\right)  $ and $\left(  d_{0},d_{1},\ldots
,d_{m}\right)  $ are two $\left(  m+1\right)  $-tuples of elements of
$\left\{  0,1,-1\right\}  $ satisfying
(\ref{pf.lem.sol.ent.bases.balter.uni.1}), then $\left(  c_{0},c_{1}%
,\ldots,c_{m}\right)  =\left(  d_{0},d_{1},\ldots,d_{m}\right)  $. In other
words, Lemma \ref{lem.sol.ent.bases.balter.uni} holds for $k=m$. The induction
step is thus complete, and Lemma \ref{lem.sol.ent.bases.balter.uni} is proven.
\end{proof}

Now, using Lemma \ref{lem.sol.ent.bases.balter.uni}, we can easily conclude
that no positive integer has more than one balanced ternary
expression.\footnote{\textit{Proof.} Assume the contrary. Thus, some positive
integer $a$ has two different balanced ternary expressions%
\begin{equation}
a=3^{k}+c_{k-1}3^{k-1}+c_{k-2}3^{k-2}+\cdots+c_{0}3^{0}
\label{sol.ent.bases.balter.exp1}%
\end{equation}
and%
\begin{equation}
a=3^{m}+d_{m-1}3^{m-1}+d_{m-2}3^{m-2}+\cdots+d_{0}3^{0}.
\label{sol.ent.bases.balter.exp2}%
\end{equation}
Consider this $a$ and these two expressions. We WLOG assume that $m\leq k$
(otherwise, we could just switch the roles of the two expressions). We set
$c_{k}=1$; thus, (\ref{sol.ent.bases.balter.exp1}) rewrites as%
\begin{equation}
a=c_{k}3^{k}+c_{k-1}3^{k-1}+\cdots+c_{0}3^{0}.
\label{sol.ent.bases.balter.exp1c}%
\end{equation}
We also set $d_{m}=1$; thus, (\ref{sol.ent.bases.balter.exp2}) rewrites as%
\begin{equation}
a=d_{m}3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}.
\label{sol.ent.bases.balter.exp2b}%
\end{equation}
We furthermore set $d_{m+1}=0$, $d_{m+2}=0$, $\ldots$, $d_{k}=0$ (that is, we
set $d_{i}=0$ for each $i\in\left\{  m+1,m+2,\ldots,k\right\}  $). Thus,%
\begin{align*}
&  d_{k}3^{k}+d_{k-1}3^{k-1}+\cdots+d_{0}3^{0}\\
&  =\left(  \underbrace{d_{k}}_{=0}3^{k}+\underbrace{d_{k-1}}_{=0}%
3^{k-1}+\cdots+\underbrace{d_{m+1}}_{=0}3^{m+1}\right)  +\left(  d_{m}%
3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }m\leq k\right) \\
&  =\underbrace{\left(  0\cdot3^{k}+0\cdot3^{k-1}+\cdots+0\cdot3^{m+1}\right)
}_{=0}+\left(  d_{m}3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}\right) \\
&  =d_{m}3^{m}+d_{m-1}3^{m-1}+\cdots+d_{0}3^{0}.
\end{align*}
Hence, (\ref{sol.ent.bases.balter.exp2b}) rewrites as%
\begin{equation}
a=d_{k}3^{k}+d_{k-1}3^{k-1}+\cdots+d_{0}3^{0}.
\label{sol.ent.bases.balter.exp2c}%
\end{equation}
Thus, from (\ref{sol.ent.bases.balter.exp1c}), we have%
\[
c_{k}3^{k}+c_{k-1}3^{k-1}+\cdots+c_{0}3^{0}=a=d_{k}3^{k}+d_{k-1}3^{k-1}%
+\cdots+d_{0}3^{0}%
\]
(by (\ref{sol.ent.bases.balter.exp2c})). Lemma
\ref{lem.sol.ent.bases.balter.uni} thus shows that $\left(  c_{0},c_{1}%
,\ldots,c_{k}\right)  =\left(  d_{0},d_{1},\ldots,d_{k}\right)  $ (since
$\left(  c_{0},c_{1},\ldots,c_{k}\right)  $ and $\left(  d_{0},d_{1}%
,\ldots,d_{k}\right)  $ are two $\left(  k+1\right)  $-tuples of elements of
$\left\{  0,1,-1\right\}  $). Hence, in particular, we have $c_{k}=d_{k}$. In
other words, $d_{k}=c_{k}=1\neq0$. If we had $m<k$, then we would have
$d_{k}=0$ (since we have set $d_{m+1}=0$, $d_{m+2}=0$, $\ldots$, $d_{k}=0$),
which would contradict $d_{k}\neq0$. Thus, we cannot have $m<k$. Hence, we
have $m\geq k$, and therefore $m=k$ (since $m\leq k$). Now,
\[
\left(  c_{0},c_{1},\ldots,c_{k}\right)  =\left(  d_{0},d_{1},\ldots
,d_{k}\right)  =\left(  d_{0},d_{1},\ldots,d_{m}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }k=m\right)  .
\]
As a consequence, the two expressions (\ref{sol.ent.bases.balter.exp1}) and
(\ref{sol.ent.bases.balter.exp2}) are identical; this contradicts our
assumption that they be different. This contradiction proves that our
assumption was wrong, qed.}

It remains to prove that every positive integer $a$ has some balanced ternary
expression. We shall prove this by strong induction over $a$.

\textit{Induction step:} Let $b$ be a positive integer. Assume (as the
induction hypothesis) that every positive integer $a$ satisfying $a<b$ has
some balanced ternary expression. We must now show that $b$ has some balanced
ternary expression.

If $b<3$, then $b$ clearly has a balanced ternary expression (since $1=3^{0}$
is a balanced ternary expression of $1$, whereas $2=3^{1}-3^{0}$ is a balanced
ternary expression of $2$). Thus, for the rest of this proof, we WLOG assume
that $b\geq3$.

Theorem \ref{thm.ent.quorem.full} (applied to $n=3$ and $u=b$) yields that
there exists a unique pair $\left(  q,r\right)  \in\mathbb{Z}\times\left\{
0,1,\ldots,3-1\right\}  $ such that $b=q\cdot3+r$. Consider this pair $\left(
q,r\right)  $. From $\left(  q,r\right)  \in\mathbb{Z}\times\left\{
0,1,\ldots,3-1\right\}  $, we obtain $q\in\mathbb{Z}$ and $r\in\left\{
0,1,\ldots,3-1\right\}  =\left\{  0,1,2\right\}  $, so that $0\leq r\leq2<3$.
Now,
\[
b=q\cdot3+r=3q+\underbrace{r}_{<3}<3q+3=3\left(  q+1\right)  ,
\]
so that $3\left(  q+1\right)  >b\geq3$. Dividing this inequality by $3$, we
find $q+1>1$, thus $q>0$. Hence, $q\geq1$ (since $q\in\mathbb{Z}$). Thus, $q$
is a positive integer. Hence, $q+1$ is a positive integer, too. Moreover,
$b=3q+\underbrace{r}_{\geq0}\geq3q>q$ (since $q>0$), thus $q<b$.

Recall that our induction hypothesis says that every positive integer $a$
satisfying $a<b$ has some balanced ternary expression. We can apply this to
$a=q$ (since $q$ is a positive integer and satisfies $q<b$). Thus, we conclude
that $q$ has some balanced ternary expression. Let
\begin{equation}
q=3^{k}+c_{k-1}3^{k-1}+c_{k-2}3^{k-2}+\cdots+c_{0}3^{0}
\label{sol.ent.bases.balter.q=ex}%
\end{equation}
be this balanced ternary expression. But recall that $r\in\left\{
0,1,2\right\}  $; thus we are in one of the following three cases:

\textit{Case 1:} We have $r=0$.

\textit{Case 2:} We have $r=1$.

\textit{Case 3:} We have $r=2$.

Let us first consider Case 1. In this case, we have $r=0$. Hence,%
\begin{align*}
b  &  =3q+\underbrace{r}_{=0}=3q=3\left(  3^{k}+c_{k-1}3^{k-1}+c_{k-2}%
3^{k-2}+\cdots+c_{0}3^{0}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.bases.balter.q=ex})}\right) \\
&  =3^{k+1}+c_{k-1}3^{k}+c_{k-2}3^{k-1}+\cdots+c_{0}3^{1}\\
&  =3^{k+1}+c_{k-1}3^{k}+c_{k-2}3^{k-1}+\cdots+c_{0}3^{1}+0\cdot3^{0}.
\end{align*}
This is clearly a balanced ternary expression of $b$. Hence, we have shown
that $b$ has some balanced ternary expression in Case 1.

Let us next consider Case 2. In this case, we have $r=1$. Hence,%
\begin{align*}
b  &  =3q+\underbrace{r}_{=1}=3q+1\\
&  =\underbrace{3\left(  3^{k}+c_{k-1}3^{k-1}+c_{k-2}3^{k-2}+\cdots+c_{0}%
3^{0}\right)  }_{=3^{k+1}+c_{k-1}3^{k}+c_{k-2}3^{k-1}+\cdots+c_{0}3^{1}%
}+1\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.ent.bases.balter.q=ex}%
)}\right) \\
&  =3^{k+1}+c_{k-1}3^{k}+c_{k-2}3^{k-1}+\cdots+c_{0}3^{1}+\underbrace{1}%
_{=1\cdot3^{0}}\\
&  =3^{k+1}+c_{k-1}3^{k}+c_{k-2}3^{k-1}+\cdots+c_{0}3^{1}+1\cdot3^{0}.
\end{align*}
This is clearly a balanced ternary expression of $b$. Hence, we have shown
that $b$ has some balanced ternary expression in Case 2.

Finally, let us consider Case 3. In this case, we have $r=2$. Thus,
$b=3q+\underbrace{r}_{=2}=3q+2$, so that $b+1=\left(  3q+2\right)
+1=3q+3=3\left(  q+1\right)  $. But now, from $q>0$, we obtain
$q+1<3q+1<3q+2=b$. Recall that our induction hypothesis says that every
positive integer $a$ satisfying $a<b$ has some balanced ternary expression. We
can apply this to $a=q+1$ (since $q+1$ is a positive integer and satisfies
$q+1<b$). Thus, we conclude that $q+1$ has some balanced ternary expression.
Let
\begin{equation}
q+1=3^{\ell}+d_{\ell-1}3^{\ell-1}+d_{\ell-2}3^{\ell-2}+\cdots+d_{0}3^{0}
\label{sol.ent.bases.balter.q+1=ex}%
\end{equation}
be this balanced ternary expression. Then,%
\begin{align*}
b+1  &  =3\left(  q+1\right)  =3\left(  3^{\ell}+d_{\ell-1}3^{\ell-1}%
+d_{\ell-2}3^{\ell-2}+\cdots+d_{0}3^{0}\right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.ent.bases.balter.q+1=ex})}\right) \\
&  =3^{\ell+1}+d_{\ell-1}3^{\ell}+d_{\ell-2}3^{\ell-1}+\cdots+d_{0}3^{1},
\end{align*}
so that
\begin{align*}
b  &  =3^{\ell+1}+d_{\ell-1}3^{\ell}+d_{\ell-2}3^{\ell-1}+\cdots+d_{0}%
3^{1}-1\\
&  =3^{\ell+1}+d_{\ell-1}3^{\ell}+d_{\ell-2}3^{\ell-1}+\cdots+d_{0}%
3^{1}+\left(  -1\right)  \cdot3^{0}.
\end{align*}
This is again a balanced ternary expression of $b$. Hence, we have shown that
$b$ has some balanced ternary expression in Case 3.

Thus, in all three cases, we have shown that $b$ has some balanced ternary
expression. Hence, this statement always holds. This completes the induction step.

Now, we have shown that every positive integer $a$ has some balanced ternary
expression. But previously, we have shown that no positive integer has more
than one balanced ternary expression. Combining these two results, we conclude
that every positive integer $a$ has a unique balanced ternary expression. In
other words, every positive integer $a$ can be uniquely expressed in the form%
\[
a=3^{m}+b_{m-1}3^{m-1}+b_{m-2}3^{m-2}+\cdots+b_{0}3^{0}%
\]
where $m$ is a nonnegative integer, and where $b_{0},b_{1},\ldots,b_{m-1}%
\in\left\{  0,1,-1\right\}  $. This solves Exercise \ref{exe.ent.bases.balter}.
\end{proof}

[\textit{Remark:} The above proof of existence of a balanced ternary
expression is one of several possible approaches. Let me sketch two others,
found by students in a different class I taught a while ago:

\begin{itemize}
\item \textit{Second approach:} Prove that if $k\in\mathbb{N}$ and if $a$ is a
positive integer satisfying $a\leq\dfrac{1}{2}\cdot3^{k}$, then $a$ has a
balanced ternary expression which begins\footnote{We say that a balanced
ternary expression of the form $a=3^{m}+b_{m-1}3^{m-1}+b_{m-2}3^{m-2}%
+\cdots+b_{0}3^{0}$ \textit{begins} with $3^{m}$.} with a power of $3$ that is
smaller than $3^{k}$. This can be proven by induction on $k$. In the induction
step, you assume that $a\leq\dfrac{1}{2}\cdot3^{k+1}$. If $a\leq\dfrac{1}%
{2}\cdot3^{k}$ as well, then the induction hypothesis finishes the proof;
otherwise, you have $\dfrac{1}{2}\cdot3^{k}<a\leq\dfrac{1}{2}\cdot3^{k+1}$,
and thus $\left\vert a-3^{k}\right\vert \leq\dfrac{1}{2}\cdot3^{k}$, which
means that you can apply the induction hypothesis to $\left\vert
a-3^{k}\right\vert $ instead of $a$ (unless $\left\vert a-3^{k}\right\vert
=0$, but in this case you are done anyway). This gives you a balanced ternary
expression of $\left\vert a-3^{k}\right\vert $ which begins with a power of
$3$ that is smaller than $3^{k}$. Now, either add it to $3^{k}$ or subtract it
from $3^{k}$ (depending on whether $\left\vert a-3^{k}\right\vert =a-3^{k}$ or
$\left\vert a-3^{k}\right\vert =-\left(  a-3^{k}\right)  $) to obtain a
balanced ternary expression of $a$ that begins with $3^{k}$. This finishes the
induction step.

\item \textit{Third approach:} Let $a$ be a positive integer. We want to find
a balanced ternary expression of $a$.

Start with \textbf{any} way of writing $a$ in the form $a=c_{n}3^{n}%
+c_{n-1}3^{n-1}+\cdots+c_{0}3^{0}$, where $c_{n},c_{n-1},\ldots,c_{0}$ are
some integers which are $\geq-1$. (For instance, you can take $n=0$ and
$c_{0}=a$. Alternatively, you can take the usual ternary
representation\footnote{\textquotedblleft Ternary
representation\textquotedblright\ means \textquotedblleft base-$3$
representation\textquotedblright.} of $a$.) Now, we shall gradually transform
this representation of $a$ into one where $c_{n},c_{n-1},\ldots,c_{0}$ are all
in $\left\{  0,1,-1\right\}  $.

How do we do this? We pick any $i$ for which $c_{i}\geq2$, and then we
subtract $3$ from $c_{i}$ while at the same time adding $1$ to $c_{i+1}%
$\ \ \ \ \footnote{If $c_{i+1}$ does not exist (that is, if $i=n$), then we
change $n$ to $n+1$ and set $c_{i+1}=1$. (That is, we essentially extend the
representation by one more \textquotedblleft digit\textquotedblright,
similarly to what happens to the usual decimal representation of $999$ when we
add $1$ to $999$.)}. (For instance, if we had $a=\cdots+4\cdot3^{7}%
+5\cdot3^{6}+\cdots$, and we take $i=6$, then it becomes $a=\cdots+5\cdot
3^{7}+2\cdot3^{6}+\cdots$.) Of course, a single step like this does not
guarantee us that all $c_{i}$ are in $\left\{  0,1,-1\right\}  $. However, we
can perform steps like this repeatedly, and none of the steps changes the
value of the sum $c_{n}3^{n}+c_{n-1}3^{n-1}+\cdots+c_{0}$ (because we have
added $1$ to $c_{i+1}$ while subtracting $3$ from $c_{i}$, and thus
$c_{n}3^{n}+c_{n-1}3^{n-1}+\cdots+c_{0}$ has changed by $1\cdot3^{i+1}%
-3\cdot3^{i}=3^{i+1}-3^{i+1}=0$). Each of these steps \textbf{decreases the
sum of the }$c_{i}$ \textbf{by }$2$ (indeed, we subtract $3$ from one of them
and add $1$ to another). Since this sum cannot decrease by $2$ indefinitely
(after all, it is bounded from below by $\left(  n+1\right)  \cdot\left(
-1\right)  $, since there are $n+1$ of the $c_{i}$'s and each of them is
$\geq-1$), this means that our process will come to an end -- at some point,
we just won't be able to make a step anymore; this means that none of our
$c_{i}$ will be $\geq2$, and that means that what we will have then is a
balanced ternary expression of $a$.

Did you spot the mistake? It is subtle, because it is true that our process
will come to an end. But my argument is not correct: I claimed that the sum is
bounded from below by $\left(  n+1\right)  \cdot\left(  -1\right)  $. But $n$
is not fixed; sometimes it grows during the algorithm (when we gain a new
\textquotedblleft digit\textquotedblright), and \textquotedblleft being
bounded from below by a bound that keeps moving down\textquotedblright\ is not
\textquotedblleft being bounded from below\textquotedblright. I hope that this
tripwire I inserted makes clear why the termination of the algorithm is
\textbf{not obvious}. Here is one way to fix the argument: Each of the steps
decreases the sum of the $c_{i}$ by $2$, while increasing $n$ by at most $1$.
So it decreases $n+\left(  c_{0}+c_{1}+\cdots+c_{n}\right)  $ by at least
$2-1=1$. And $n+\left(  c_{0}+c_{1}+\cdots+c_{n}\right)  $ is really bounded
from below, namely by $-1$ (because each of the $c_{i}$ is $\geq-1$), which
shows that it cannot decrease by at least $1$ indefinitely.
\end{itemize}

On another note, balanced ternary representation once seemed to have
\href{http://en.wikipedia.org/wiki/Setun}{a bright future in computing}.]
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ind.engel-8-26}}

\begin{proof}
[Discussion of Exercise \ref{exe.ind.engel-8-26}.]This exercise is Exercise 26
in Chapter 8 of Engel's book \cite{Engel} (although Engel forgets to require
the entries of the table to be distinct, which is important for the validity
of the exercise). The following solution is essentially taken from
\cite{Engel}; I am not aware of any other solution.

\begin{proof}
[Solution to Exercise \ref{exe.ind.engel-8-26} (sketched).]We proceed by
induction on $m+n$.

\textit{Induction base:} Exercise \ref{exe.ind.engel-8-26} holds for $m+n=0$
(because in this case we must have $m=0$ and $n=0$ and therefore $p=0$ and
$q=0$, so that $pq=0$).

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.ind.engel-8-26} holds for $m+n=k$. We must
prove that Exercise \ref{exe.ind.engel-8-26} holds for $m+n=k+1$.

So let $p,q,m,n\in\mathbb{N}$ be such that $p\leq m$ and $q\leq n$ and
$m+n=k+1$. Let $T$ be an $m\times n$-table of integers, with all entries
distinct. Mark some of the entries in $T$ with a cyan marker and some with a
red marker, as described in the statement of the exercise. We must show that
at least $pq$ entries of $T$ are marked twice (i.e., with both colors).

Let us first simplify our language. We shall call an entry \textit{cyan} if it
is marked cyan, and \textit{red} if it is marked red. We shall say that an
entry is $1$\textit{-marked} if it is marked exactly once (i.e., either cyan
or red, but not both). We shall say that an entry is $2$\textit{-marked} if it
is marked twice. Thus, we must show that at least $pq$ entries of $T$ are $2$-marked.

If $T$ has no $1$-marked entries, then this is easy to
check\footnote{\textit{Proof.} Assume that $T$ has no $1$-marked entries.
Hence, every cyan entry of $T$ is $2$-marked (since otherwise it would be
$1$-marked, but $T$ has no $1$-marked entries). However, exactly $pn$ entries
of the table $T$ are cyan (since $T$ has $n$ columns, and exactly $p$ entries
in any column are cyan). All of these $pn$ entries are therefore $2$-marked
(since every cyan entry of $T$ is $2$-marked). This entails that at least $pn$
entries of $T$ are $2$-marked. Therefore, at least $pq$ entries of $T$ are
$2$-marked (since $p\underbrace{n}_{\geq q}\geq pq$). But this is precisely
what we wanted to show.}. Hence, we WLOG assume that $T$ has at least one
$1$-marked entry. Hence, the set of all $1$-marked entries of $T$ is nonempty;
this set is also finite (obviously). Thus, this set has a
maximum\footnote{Here we are using the \textit{Extremal Principle} --
specifically, the version thereof that says that any nonempty finite set of
integers has a largest element (i.e., a maximum). This is exactly the claim of
Proposition \ref{prop.ind.fin-min}.}. In other words, the \textbf{largest}
$1$-marked entry of $T$ exists. Let $M$ be this largest $1$-marked entry.
Since $M$ is $1$-marked, this entry $M$ is either cyan or red but not both. In
other words, we are in one of the following two cases:

\textit{Case 1:} The entry $M$ is cyan but not red.

\textit{Case 2:} The entry $M$ is red but not cyan.

Let us consider Case 1. In this case, the entry $M$ is cyan but not red.
Recalling the definitions of the cyan and red markings, we can restate this as
follows: The entry $M$ is one of the $p$ largest entries in its column, but
not one of the $q$ largest entries in its row. Let $R$ denote the row of $T$
that contains $M$. Thus, $M$ is not one of the $q$ largest entries of $R$
(since $M$ is not one of the $q$ largest entries in its row). Hence, the $q$
largest entries of $R$ are larger than $M$, and therefore cannot be $1$-marked
(since $M$ is the largest $1$-marked entry of $T$). But the $q$ largest
entries of $R$ are red (because they are the $q$ largest entries in a row of
$T$), and thus must be either $1$-marked or $2$-marked. Since we have just
shown that they cannot be $1$-marked, we conclude that they must be
$2$-marked. So we have shown that the $q$ largest entries of $R$ are $2$-marked.

Note that $p>0$ (since otherwise, $T$ would not have any cyan entries at all;
but we know that the entry $M$ is cyan). Thus, $p\geq1$, so that
$p-1\in\mathbb{N}$. Also, $p-1\leq m-1$ (since $p\leq m$).

Let us now remove the row $R$ from the $m\times n$-table $T$. The result is an
$\left(  m-1\right)  \times n$-table $T^{\prime}$. Note that the table
$T^{\prime}$ and the row $R$ have no entries in common (since the entries of
$T$ are all distinct). Also, all entries of the table $T^{\prime}$ are
distinct (for the same reason). Let us pause this proof for an example:

\begin{example}
For this example, let $m=4$ and $n=4$ and $p=2$ and $q=2$, and let $T$ be the
$m\times n$-table $\left(
\begin{array}
[c]{cccc}%
1 & 2 & 11 & 9\\
12 & 4 & 3 & 8\\
5 & 6 & 13 & 7\\
10 & 14 & 16 & 15
\end{array}
\right)  $. Then, the cyan entries are $10,12,6,14,13,16,9,15$, whereas the
red entries are $9,11,8,12,7,13,15,16$. Thus, the $2$-marked entries are
$9,12,13,15,16$, whereas the $1$-marked entries are $6,7,8,10,11,14$. Hence,
$M$ (the largest $1$-marked entry) is $14$. This entry $M=14$ is cyan, so we
are in Case 1. The row $R$ containing the entry $M=14$ is the last row of $T$.
Hence, $T^{\prime}=\left(
\begin{array}
[c]{cccc}%
1 & 2 & 11 & 9\\
12 & 4 & 3 & 8\\
5 & 6 & 13 & 7
\end{array}
\right)  $.
\end{example}

We do not copy the cyan and red markings from $T$ to $T^{\prime}$, but instead
we mark some of the entries in $T^{\prime}$ as follows: In each column of
$T^{\prime}$, we mark the $p-1$ largest entries with a \textit{cyan} marker.
In each row of $T^{\prime}$, we mark the $q$ largest entries with a
\textit{red} marker. Since we have $\left(  m-1\right)  +n=\underbrace{m+n}%
_{=k+1}-1=k+1-1=k$, our induction hypothesis shows that we can apply Exercise
\ref{exe.ind.engel-8-26} to $m-1$, $p-1$ and $T^{\prime}$ instead of $m$, $p$
and $T$. Thus we conclude that at least $\left(  p-1\right)  q$ entries of
$T^{\prime}$ are marked twice. In other words, at least $\left(  p-1\right)
q$ entries of $T^{\prime}$ are $2$-marked.

Now, we shall show that every entry of $T^{\prime}$ that is $2$-marked in
$T^{\prime}$ is also $2$-marked in $T$. Indeed, we have the following two observations:

\begin{itemize}
\item Every entry of $T^{\prime}$ that is cyan in $T^{\prime}$ is also cyan in
$T$. (Indeed, if an entry of $T^{\prime}$ is cyan in $T^{\prime}$, then it is
one of the $p-1$ largest entries in its column in $T^{\prime}$. Therefore, it
must be one of the $p$ largest entries in its column in $T$ (since its column
in $T$ differs from its column in $T^{\prime}$ only in having one extra
entry). In other words, it must be cyan in $T$.)

\item Every entry of $T^{\prime}$ that is red in $T^{\prime}$ is also red in
$T$. (Indeed, if an entry of $T^{\prime}$ is red in $T^{\prime}$, then it is
one of the $q$ largest entries in its row in $T^{\prime}$. Therefore, it must
be one of the $q$ largest entries in its row in $T$ (since its row in $T$ is a
copy of its row in $T^{\prime}$). In other words, it must be red in $T$.)
\end{itemize}

\noindent Combining these two observations, we conclude that every entry of
$T^{\prime}$ that is $2$-marked in $T^{\prime}$ is also $2$-marked in $T$. But
recall that at least $\left(  p-1\right)  q$ entries of $T^{\prime}$ are
$2$-marked in $T^{\prime}$. All these entries are therefore also $2$-marked in
$T$ (since every entry of $T^{\prime}$ that is $2$-marked in $T^{\prime}$ is
also $2$-marked in $T$). Thus, we have found $\left(  p-1\right)  q$ entries
that are $2$-marked in $T$. Additionally, we know of another set of $q$
entries that are $2$-marked in $T$: namely, the $q$ largest entries of $R$ are
$2$-marked in $T$. These two sets of entries are disjoint, since the entries
in the former set all come from $T^{\prime}$ while the entries in the latter
set all come from the row $R$ (and since the table $T^{\prime}$ and the row
$R$ have no entries in common). Hence, by combining these two sets of entries,
we obtain at least $\left(  p-1\right)  q+q$ entries that are $2$-marked in
$T$. Thus, at least $\left(  p-1\right)  q+q$ entries of $T$ are $2$-marked.
In other words, at least $pq$ entries of $T$ are $2$-marked (since $\left(
p-1\right)  q+q=pq$). Thus, in Case 1, we have shown that at least $pq$
entries of $T$ are $2$-marked.

An analogous argument (with the roles of $m$ and $n$ interchanged, the roles
of $p$ and $q$ interchanged, and the roles of rows and columns interchanged)
proves the same result in Case 2.

Thus, in both cases, we have shown that at least $pq$ entries of $T$ are
$2$-marked. In other words, at least $pq$ entries of $T$ are marked twice.

Now, forget that we fixed $m$, $n$, $p$, $q$ and $T$. We thus have shown that
if $p,q,m,n\in\mathbb{N}$ and $T$ are as defined in the exercise, and if
$m+n=k+1$, then at least $pq$ entries of $T$ are marked twice (where the
coloring is defined as in the statement of the exercise). In other words,
Exercise \ref{exe.ind.engel-8-26} holds for $m+n=k+1$. This completes the
induction step. Thus, Exercise \ref{exe.ind.engel-8-26} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ind.01-100}}

\begin{proof}
[Discussion of Exercise \ref{exe.ind.01-100}.]I have taken Exercise
\ref{exe.ind.01-100} \textbf{(a)} from \cite[Aufgabe 1.27]{ngrin}, where it is
solved by a double induction (i.e., an induction nested within the induction
step of another induction)\footnote{Here is a very brief outline of this
proof: Given a bitstring $a$, let $n_{a}$ denote the number of $0$s in $a$
(that is, the number of entries of $a$ equal to $0$), and let $k_{a}$ denote
the number of $1$s in $a$. Induct on $k_{a}$. Within the induction step,
induct on $n_{a}$. We must prove that any sequence of moves that can be
applied successively to $a$ must have an end. To this end, we consider the
first entry of $a$. If this first entry is $1$, then this $1$ will never be
involved in any move (since a move can only involve a $1$ that has a $0$ in
front of it) and will never move away from its first position; thus, we can as
well pretend it does not exist, and thus our claim reduces to the situation
with one fewer $1$ (to which we can apply the induction hypothesis). On the
other hand, if the first entry of $a$ is $0$, then our sequence of moves (if
long enough) will eventually result in this $0$ being involved in a move
(since otherwise, we can as well pretend it does not exist, which again
reduces the problem to the induction hypothesis). Once this happens, the first
entry becomes $1$, so we are back in the first case. When fleshing out this
proof, keep in mind that we are doing an induction within an induction; make
sure to clarify which of the two induction hypotheses is being used at which
point!}. I will sketch two solutions to Exercise \ref{exe.ind.01-100}.

Before we come to the solutions, let us agree on a few notations that will be
used in all of them:

\begin{itemize}
\item A \textit{bit} shall mean an element of $\left\{  0,1\right\}  $.

\item We will never use the notation $ab$ for the product of two numbers $a$
and $b$. Instead, we will denote this product by $a\cdot b$. This will allow
us to use the notation $ab$ for things like the bitstring $\left(  a,b\right)
$ without worrying about ambiguity.
\end{itemize}

\begin{proof}
[First solution to Exercise \ref{exe.ind.01-100} (sketched).]A
\textit{subsequence} of a bitstring $a_{1}a_{2}\ldots a_{n}$ is defined to be
a bitstring of the form $a_{i_{1}}a_{i_{2}}\ldots a_{i_{m}}$, where
$i_{1},i_{2},\ldots,i_{m}$ are elements of $\left\{  1,2,\ldots,n\right\}  $
satisfying $i_{1}<i_{2}<\cdots<i_{m}$. In other words, a \textit{subsequence}
of a bitstring $a$ is a bitstring obtained from $a$ by removing some (possibly
none or all) entries. For example, the bitstring $011$ has eight subsequences:
the empty bitstring, the one-letter bitstrings $0$, $1$, $1$, the two-letter
bitstrings $01$, $01$ and $11$, and the entire bitstring $011$. Some of these
subsequences are equal as bitstrings (e.g., the two $01$s), but we shall
nevertheless distinguish between them. More generally: We shall distinguish
two subsequences $a_{i_{1}}a_{i_{2}}\ldots a_{i_{m}}$ and $a_{j_{1}}a_{j_{2}%
}\ldots a_{j_{m}}$ of a bitstring $a_{1}a_{2}\ldots a_{n}$ whenever the
respective $m$-tuples $\left(  i_{1},i_{2},\ldots,i_{m}\right)  $ and $\left(
j_{1},j_{2},\ldots,j_{m}\right)  $ are distinct (even if the bitstrings
$a_{i_{1}}a_{i_{2}}\ldots a_{i_{m}}$ and $a_{j_{1}}a_{j_{2}}\ldots a_{j_{m}}$
are equal).

A bitstring will be called a \textit{comb} if it has the form
$0\underbrace{11\ldots1}_{\substack{\text{some nonzero}\\\text{number of
}1\text{'s}}}$. In other words, it is called a comb if it has at least $2$
entries, its first entry is a $0$, and all its remaining entries are $1$s.

If $a$ is a bitstring, then an $a$\textit{-comb} will mean a subsequence of
$a$ that is a comb. The \textit{comb number} of a bitstring $a$ is defined as
the number of $a$-combs.\footnote{Recall that we are distinguishing two
subsequences that differ in their positions in $a$, even if they are equal as
bitstrings.} For example, the comb number of the bitstring $001011$ is $17$,
because there are exactly seventeen $001011$-combs (namely, eight copies of
$01$, seven copies of $011$ and two copies of $0111$).

We now make the following crucial observation:

\begin{statement}
\textit{Claim 1:} When we apply a move to an bitstring $a$, the comb number of
$a$ decreases by $1$.
\end{statement}

[\textit{Proof of Claim 1 (sketched):} Let us consider a move that changes a
bitstring $a$ to a new bitstring $a^{\prime}$. We must prove that the comb
number of $a^{\prime}$ equals the comb number of $a$ minus $1$.

The move that changes $a$ to $a^{\prime}$ looks as follows:%
\[
a=\ldots\underline{01}\ldots\ \ \rightarrow\ \ \ldots\underline{100}%
\ldots=a^{\prime}%
\]
(where the two \textquotedblleft$\ldots$\textquotedblright\ parts remain
unchanged). We shall refer to the two consecutive entries $01$ of $a$ that are
being replaced by the move, as well as to the three consecutive entries $100$
of $a^{\prime}$ that replace them, as \textit{mobile}; all other entries of
the bitstrings $a$ and $a^{\prime}$ will be called \textit{frozen}. We
furthermore notice that the two mobile entries of $a$ form an $a$-comb (of the
form $01$); we call this specific $a$-comb \textit{trivial}, and we call all
other $a$-combs (including all other $a$-combs of the form $01$)
\textit{nontrivial}.

Now, to each nontrivial $a$-comb, we shall assign a certain $a^{\prime}$-comb.
We do this as follows:

\begin{itemize}
\item If a nontrivial $a$-comb contains none of the two mobile entries, then
it remains an $a^{\prime}$-comb after the move (even though its entries can
shift their positions: namely, each entry that is to the right of the mobile
entries gets moved by one step).

\item If a nontrivial $a$-comb contains the mobile $1$ but not the mobile $0$,
then it remains an $a^{\prime}$-comb after the move (even though the mobile
$1$ moves one step to the left, and the frozen entries to its right move one
step to the right).

\item If a nontrivial $a$-comb contains the mobile $0$ but not the mobile $1$
(and thus begins with the mobile $0$, because a $0$ in a comb must necessarily
be the first entry of the comb), then we turn it into an $a^{\prime}$-comb by
replacing the mobile $0$ in $a$ by the \textbf{first} of the two mobile $0$s
in $a^{\prime}$.

\item If a nontrivial $a$-comb contains both mobile entries (and thus begins
with them, because a $0$ in a comb must necessarily be the first entry of the
comb), then we turn it into an $a^{\prime}$-comb by replacing these two
entries with the \textbf{second} of the two mobile $0$s in $a^{\prime}$. We
note that the result is indeed a valid $a^{\prime}$-comb (because the $a$-comb
we started with was nontrivial, and thus contained not only the two mobile
entries but also at least one further entry).
\end{itemize}

\noindent Thus, we have transformed each nontrivial $a$-comb into an
$a^{\prime}$-comb. This transformation is easily seen to be a 1-to-1
correspondence, because an $a^{\prime}$-comb cannot contain more than one
mobile entry (check this!). Hence,
\[
\left(  \text{the number of nontrivial }a\text{-combs}\right)  =\left(
\text{the number of }a^{\prime}\text{-combs}\right)  .
\]
Therefore,%
\begin{align*}
\left(  \text{the number of }a^{\prime}\text{-combs}\right)   &  =\left(
\text{the number of nontrivial }a\text{-combs}\right) \\
&  =\left(  \text{the number of }a\text{-combs}\right)  -1.
\end{align*}
In other words, the comb number of $a^{\prime}$ equals the comb number of $a$
minus $1$. This proves Claim 1.]

We can now easily solve part \textbf{(a)} of Exercise \ref{exe.ind.01-100}: If
we apply a sequence of moves (successively) to a bitstring $a$, then the comb
number of the bitstring decreases by $1$ during each move (by Claim 1). But
the comb number (being a nonnegative integer) cannot keep decreasing by $1$
indefinitely\footnote{In fact, any strictly decreasing sequence of nonnegative
integers is finite (and its length cannot surpass its first element plus
$1$).}. Thus, our sequence of moves cannot be infinite. This solves Exercise
\ref{exe.ind.01-100} \textbf{(a)}.

\textbf{(b)} Let $a$ be any bitstring. Let $c_{a}$ denote the comb number of
$a$. Let $k_{a}$ denote the number of $1$s in $a$ (that is, the number of
entries of $a$ that are equal to $1$). Let $n_{a}$ denote the number of $0$s
in $a$.

Let $a^{\circ}$ be an immovable bitstring obtained from $a$ by performing
moves until no more moves are possible. We shall show that $a^{\circ}$ is
uniquely determined by $a$ (without knowing the specific sequence of moves
used to construct it).

Indeed, we first observe that $a^{\circ}$ must have the form $11\ldots
100\ldots0$ (that is, some number of $1$s followed by some number of $0$s).
Indeed, if it didn't, then it would have two consecutive entries $01$ (check
this!), and thus a move could be applied to it; but this would contradict the
fact that it is immovable.

Furthermore, any move leaves the number of $1$s in a bitstring unchanged.
Hence, the number of $1$s in $a^{\circ}$ equals the number of $1$s in $a$
(since $a^{\circ}$ was obtained from $a$ by a sequence of moves). But the
latter number is $k_{a}$ (by definition of $k_{a}$). Hence, the number of $1$s
in $a^{\circ}$ is $k_{a}$.

The bitstring $a^{\circ}$ has no comb (since $a^{\circ}$ has the form
$11\ldots100\ldots0$). In other words, the comb number of $a^{\circ}$ is $0$.
But the comb number of $a$ is $c_{a}$. But we know that $a^{\circ}$ was
obtained from $a$ by a sequence of moves, and we know (from Claim 1) that each
move decreases the comb number of the bitstring by $1$. Thus, the sequence of
moves that transformed $a$ into $a^{\circ}$ must have contained precisely
$c_{a}$ many moves (because the comb number of $a$ was $c_{a}$, but the comb
number of $a^{\circ}$ is $0$). Since each move increases the number of $0$s in
the bitstring by $1$, we thus conclude that $a^{\circ}$ has precisely $c_{a}$
more $0$s than $a$ has. In other words, the number of $0$s in $a^{\circ}$ is
$n_{a}+c_{a}$ (since $a$ has $n_{a}$ many $0$s).

Now we know that $a^{\circ}$ has the form $11\ldots100\ldots0$, but we also
know that the number of $1$s in $a^{\circ}$ is $k_{a}$ and that the number of
$0$s in $a^{\circ}$ is $n_{a}+c_{a}$. Hence, we know exactly how the bitstring
$a^{\circ}$ looks like: It consists of $k_{a}$ many $1$s, followed by
$n_{a}+c_{a}$ many $0$s. This shows that $a^{\circ}$ is uniquely determined by
$a$ (without knowing the specific sequence of moves used to construct it).

It remains to show that the number of moves needed to reach $a^{\circ}$ is
also uniquely determined by $a$. But this is clear, since we have already seen
that this number of moves is $c_{a}$. Exercise \ref{exe.ind.01-100}
\textbf{(b)} is thus completely solved.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ind.01-100} (sketched).]If $a=a_{1}%
a_{2}\ldots a_{n}$ is a bitstring and $b$ is an element of $\left\{
0,1\right\}  $, then $ba$ shall denote the bitstring $ba_{1}a_{2}\ldots a_{n}$
(that is, the bitstring obtained by inserting $b$ at the front of $a$). For
example, if $a=1011$ and $b=0$, then $ba=01011$.

For any bitstring $a$, we let $\operatorname*{ones}a$ denote the number of
$1$s in $a$ (that is, the number of entries of $a$ that are equal to $1$).
(This was denoted by $k_{a}$ in the previous proof.) For example,
$\operatorname*{ones}\left(  01001\right)  =2$. It is clear that any bitstring
$c$ satisfies%
\begin{equation}
\operatorname*{ones}\left(  1c\right)  =1+\operatorname*{ones}c
\label{sol.ind.01-100.2nd.ones-1}%
\end{equation}
and%
\begin{equation}
\operatorname*{ones}\left(  0c\right)  =\operatorname*{ones}c.
\label{sol.ind.01-100.2nd.ones-0}%
\end{equation}
Also, we let $\varepsilon$ denote the empty bitstring; then,%
\begin{equation}
\operatorname*{ones}\varepsilon=0. \label{sol.ind.01-100.2nd.ones-eps}%
\end{equation}


Notice that the formulas (\ref{sol.ind.01-100.2nd.ones-eps}),
(\ref{sol.ind.01-100.2nd.ones-0}) and (\ref{sol.ind.01-100.2nd.ones-1}) (taken
together) can be used to compute the integers $\operatorname*{ones}a$ for all
bitstrings $a$. In fact, a bitstring $a$ is either empty (in which case
$\operatorname*{ones}a$ is determined by (\ref{sol.ind.01-100.2nd.ones-eps})),
or begins with a $0$ (in which case we can use
(\ref{sol.ind.01-100.2nd.ones-0}) to express $\operatorname*{ones}a$ through
$\operatorname*{ones}c$ for a shorter bitstring $c$), or begins with a $1$ (in
which case we can use (\ref{sol.ind.01-100.2nd.ones-1}) to express
$\operatorname*{ones}a$ through $\operatorname*{ones}c$ for a shorter
bitstring $c$). Moreover, these formulas provide a unique way of computing
$\operatorname*{ones}a$ (because for each bitstring $a$, only one of these
three formulas has $\operatorname*{ones}a$ on its left hand side). Thus, if we
forget how we originally defined $\operatorname*{ones}a$, then we can use the
formulas (\ref{sol.ind.01-100.2nd.ones-eps}), (\ref{sol.ind.01-100.2nd.ones-0}%
) and (\ref{sol.ind.01-100.2nd.ones-1}) as a recursive definition of the
integers $\operatorname*{ones}a$ for every bitstring $a$.

We notice that the two formulas (\ref{sol.ind.01-100.2nd.ones-0}) and
(\ref{sol.ind.01-100.2nd.ones-1}) can be combined into a single formula using
the Iverson bracket notation (Definition \ref{def.iverson}): For any bitstring
$c$ and any $b\in\left\{  0,1\right\}  $, we have%
\begin{equation}
\operatorname*{ones}\left(  bc\right)  =\left[  b=1\right]
+\operatorname*{ones}c. \label{sol.ind.01-100.2nd.ones-b}%
\end{equation}
(Indeed, this boils down to (\ref{sol.ind.01-100.2nd.ones-0}) when $b=0$, and
boils down to (\ref{sol.ind.01-100.2nd.ones-1}) when $b=1$. Since $b$ is
either $0$ or $1$, we thus conclude that (\ref{sol.ind.01-100.2nd.ones-b})
always holds.)

For any bitstring $a$, we let $\operatorname*{zeros}a$ denote the number of
$0$s in $a$ (that is, the number of entries of $a$ that are equal to $0$).
(This was denoted by $n_{a}$ in the previous proof.) For example,
$\operatorname*{zeros}\left(  01001\right)  =3$. It is clear that any
bitstring $c$ satisfies%
\begin{equation}
\operatorname*{zeros}\left(  1c\right)  =\operatorname*{zeros}c
\label{sol.ind.01-100.2nd.zeros-1}%
\end{equation}
and%
\begin{equation}
\operatorname*{zeros}\left(  0c\right)  =1+\operatorname*{zeros}c.
\label{sol.ind.01-100.2nd.zeros-0}%
\end{equation}
Also, the empty bitstring $\varepsilon$ satisfies%
\begin{equation}
\operatorname*{zeros}\varepsilon=0. \label{sol.ind.01-100.2nd.zeros-eps}%
\end{equation}
Again, the formulas (\ref{sol.ind.01-100.2nd.zeros-eps}),
(\ref{sol.ind.01-100.2nd.zeros-0}) and (\ref{sol.ind.01-100.2nd.zeros-1})
(taken together) can be used as a recursive definition of the integers
$\operatorname*{zeros}a$ for every bitstring $a$.

We notice that the two formulas (\ref{sol.ind.01-100.2nd.zeros-0}) and
(\ref{sol.ind.01-100.2nd.zeros-1}) can be combined into a single formula using
the Iverson bracket notation: For any bitstring $c$ and any $b\in\left\{
0,1\right\}  $, we have%
\begin{equation}
\operatorname*{zeros}\left(  bc\right)  =\left[  b=0\right]
+\operatorname*{zeros}c. \label{sol.ind.01-100.2nd.zeros-b}%
\end{equation}
(Indeed, this boils down to (\ref{sol.ind.01-100.2nd.zeros-0}) when $b=0$, and
boils down to (\ref{sol.ind.01-100.2nd.zeros-1}) when $b=1$. Since $b$ is
either $0$ or $1$, we thus conclude that (\ref{sol.ind.01-100.2nd.zeros-b})
always holds.)

We shall now define another integer $\operatorname*{load}a$ for any bitstring
$a$. We define it recursively, by setting
\begin{equation}
\operatorname*{load}\varepsilon=0 \label{sol.ind.01-100.2nd.load-eps}%
\end{equation}
and%
\begin{equation}
\operatorname*{load}\left(  0c\right)  =\operatorname*{load}%
c+2^{\operatorname*{ones}c}-1 \label{sol.ind.01-100.2nd.load-0}%
\end{equation}
and%
\begin{equation}
\operatorname*{load}\left(  1c\right)  =\operatorname*{load}c
\label{sol.ind.01-100.2nd.load-1}%
\end{equation}
for any bitstring $c$. This is a valid definition of $\operatorname*{load}a$,
for the same reason as why the formulas (\ref{sol.ind.01-100.2nd.ones-eps}),
(\ref{sol.ind.01-100.2nd.ones-0}) and (\ref{sol.ind.01-100.2nd.ones-1})
provide a valid recursive definition of the integers $\operatorname*{ones}a$
for every bitstring $a$.

\begin{example}
Here is an example of how $\operatorname*{load}a$ is computed:%
\begin{align*}
\operatorname*{load}\left(  010001\right)   &
=\underbrace{\operatorname*{load}\left(  10001\right)  }%
_{\substack{=\operatorname*{load}\left(  0001\right)  \\\text{(by
(\ref{sol.ind.01-100.2nd.load-1}))}}}+\underbrace{2^{\operatorname*{ones}%
\left(  10001\right)  }}_{=2^{2}=4}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ind.01-100.2nd.load-0})}\right) \\
&  =\underbrace{\operatorname*{load}\left(  0001\right)  }%
_{\substack{=\operatorname*{load}\left(  001\right)  +2^{\operatorname*{ones}%
\left(  001\right)  }-1\\\text{(by (\ref{sol.ind.01-100.2nd.load-0}))}}}+4-1\\
&  =\underbrace{\operatorname*{load}\left(  001\right)  }%
_{\substack{=\operatorname*{load}\left(  01\right)  +2^{\operatorname*{ones}%
\left(  01\right)  }-1\\\text{(by (\ref{sol.ind.01-100.2nd.load-0}))}%
}}+\underbrace{2^{\operatorname*{ones}\left(  001\right)  }}_{=2^{1}%
=2}-1+4-1\\
&  =\underbrace{\operatorname*{load}\left(  01\right)  }%
_{\substack{=\operatorname*{load}\left(  1\right)  +2^{\operatorname*{ones}%
\left(  1\right)  }-1\\\text{(by (\ref{sol.ind.01-100.2nd.load-0}))}%
}}+\underbrace{2^{\operatorname*{ones}\left(  01\right)  }}_{=2^{1}%
=2}-1+2-1+4-1\\
&  =\underbrace{\operatorname*{load}\left(  1\right)  }%
_{\substack{=\operatorname*{load}\left(  1\varepsilon\right)
\\=\operatorname*{load}\varepsilon\\\text{(by (\ref{sol.ind.01-100.2nd.load-1}%
))}}}+\underbrace{2^{\operatorname*{ones}\left(  1\right)  }}_{=2^{1}%
=2}-1+2-1+2-1+4-1\\
&  =\underbrace{\operatorname*{load}\varepsilon}_{=0}+2-1+2-1+2-1+4-1\\
&  =2-1+2-1+2-1+4-1=6.
\end{align*}

\end{example}

We notice that
\begin{equation}
\operatorname*{load}a\text{ is a nonnegative integer for every bitstring }a.
\label{sol.ind.01-100.2nd.load-nonn}%
\end{equation}
Indeed, this is clear from the recursive definition of $\operatorname*{load}%
a$, since the $2^{\operatorname*{ones}c}-1$ on the right hand side of
(\ref{sol.ind.01-100.2nd.load-0}) is always a nonnegative integer (because
$\operatorname*{ones}c\geq0$ and thus $2^{\operatorname*{ones}c}-1\geq
2^{0}-1=0$).

We notice that the two formulas (\ref{sol.ind.01-100.2nd.load-0}) and
(\ref{sol.ind.01-100.2nd.load-1}) can be combined into a single formula using
the Iverson bracket notation: For any bitstring $c$ and any $b\in\left\{
0,1\right\}  $, we have%
\begin{equation}
\operatorname*{load}\left(  bc\right)  =\operatorname*{load}c+\left[
b=0\right]  \cdot\left(  2^{\operatorname*{ones}c}-1\right)  .
\label{sol.ind.01-100.2nd.load-b}%
\end{equation}
(Indeed, this boils down to (\ref{sol.ind.01-100.2nd.load-0}) when $b=0$, and
boils down to (\ref{sol.ind.01-100.2nd.load-1}) when $b=1$. Since $b$ is
either $0$ or $1$, we thus conclude that (\ref{sol.ind.01-100.2nd.load-b})
always holds.)

We now claim that when we apply a move to a bitstring $a$,

\begin{itemize}
\item the number $\operatorname*{load}a$ decreases by $1$,

\item the number $\operatorname*{ones}a$ stays unchanged, and

\item the number $\operatorname*{zeros}a$ increases by $1$.
\end{itemize}

\noindent We shall state this claim in a slightly more formal way. First, we
define a notation: We shall use the notation \textquotedblleft$a\rightarrow
b$\textquotedblright\ to say that a bitstring $b$ is obtained by applying a
move to a bitstring $a$. Now, we claim the following:

\begin{statement}
\textit{Claim 1:} Let $a$ and $b$ be two bitstrings such that $a\rightarrow
b$. Then, $\operatorname*{load}b=\operatorname*{load}a-1$ and
$\operatorname*{ones}b=\operatorname*{ones}a$ and $\operatorname*{zeros}%
b=\operatorname*{zeros}a+1$.
\end{statement}

We will prove this in the following rewritten form:

\begin{statement}
\textit{Claim 2:} Let $d$ be a bitstring. Let $k\in\mathbb{N}$, and let
$b_{1},b_{2},\ldots,b_{k}$ be any elements of $\left\{  0,1\right\}  $. Then,
\[
\operatorname*{load}\left(  b_{k}b_{k-1}\ldots b_{1}100d\right)
=\operatorname*{load}\left(  b_{k}b_{k-1}\ldots b_{1}01d\right)  -1
\]
and%
\[
\operatorname*{ones}\left(  b_{k}b_{k-1}\ldots b_{1}100d\right)
=\operatorname*{ones}\left(  b_{k}b_{k-1}\ldots b_{1}01d\right)
\]
and%
\[
\operatorname*{zeros}\left(  b_{k}b_{k-1}\ldots b_{1}100d\right)
=\operatorname*{zeros}\left(  b_{k}b_{k-1}\ldots b_{1}01d\right)  +1.
\]

\end{statement}

[\textit{Proof of Claim 2:} We shall prove Claim 2 by induction on $k$:

\textit{Induction base:} For the base case, we need to prove that Claim 2
holds for $k=0$. In other words, we need to prove that $\operatorname*{load}%
\left(  100d\right)  =\operatorname*{load}\left(  01d\right)  -1$ and
$\operatorname*{ones}\left(  100d\right)  =\operatorname*{ones}\left(
01d\right)  $ and $\operatorname*{zeros}\left(  100d\right)
=\operatorname*{zeros}\left(  01d\right)  +1$ (since the list $b_{k}%
b_{k-1}\cdots b_{1}$ is empty when $k=0$). But this is an easy matter of
computation: The bitstrings $100d$ and $01d$ clearly have the same number of
$1$s (namely, each of them has exactly one more $1$ than $d$). In other words,
$\operatorname*{ones}\left(  100d\right)  =\operatorname*{ones}\left(
01d\right)  $. Furthermore, the bitstring $100d$ has exactly one more $0$ than
the bitstring $01d$ (since the former bitstring has two more $0$s than $d$,
while the latter bitstring has one more $0$ than $d$). In other words,
$\operatorname*{zeros}\left(  100d\right)  =\operatorname*{zeros}\left(
01d\right)  +1$. Next, we notice that the bitstrings $0d$ and $d$ have the
same number of $1$s; in other words, $\operatorname*{ones}\left(  0d\right)
=\operatorname*{ones}d$. On the other hand, the number of $1$s in the
bitstring $1d$ is larger than the number of $1$s in the bitstring $d$ by
exactly $1$; in other words, $\operatorname*{ones}\left(  1d\right)
=\operatorname*{ones}d+1$. Now,%
\begin{align}
\operatorname*{load}\left(  01d\right)   &  =\underbrace{\operatorname*{load}%
\left(  1d\right)  }_{\substack{=\operatorname*{load}d\\\text{(by
(\ref{sol.ind.01-100.2nd.load-1}),}\\\text{applied to }c=d\text{)}%
}}+\underbrace{2^{\operatorname*{ones}\left(  1d\right)  }}%
_{\substack{=2^{\operatorname*{ones}d+1}\\\text{(since }\operatorname*{ones}%
\left(  1d\right)  =\operatorname*{ones}d+1\text{)}}%
}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.ind.01-100.2nd.load-0}),
applied to }c=1d\right) \nonumber\\
&  =\operatorname*{load}d+2^{\operatorname*{ones}d+1}-1.
\label{sol.ind.01-100.2nd.C2.pf.IB.1}%
\end{align}
But%
\begin{align*}
\operatorname*{load}\left(  100d\right)   &  =\operatorname*{load}\left(
00d\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ind.01-100.2nd.load-1}), applied to }c=00d\right) \\
&  =\underbrace{\operatorname*{load}\left(  0d\right)  }%
_{\substack{=\operatorname*{load}d+2^{\operatorname*{ones}d}-1\\\text{(by
(\ref{sol.ind.01-100.2nd.load-0}),}\\\text{applied to }c=d\text{)}%
}}+\underbrace{2^{\operatorname*{ones}\left(  0d\right)  }}%
_{\substack{=2^{\operatorname*{ones}d}\\\text{(since }\operatorname*{ones}%
\left(  0d\right)  =\operatorname*{ones}d\text{)}}%
}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.ind.01-100.2nd.load-0}),
applied to }c=0d\right) \\
&  =\operatorname*{load}d+2^{\operatorname*{ones}d}-1+2^{\operatorname*{ones}%
d}-1=\operatorname*{load}d+\underbrace{2\cdot2^{\operatorname*{ones}d}%
}_{=2^{\operatorname*{ones}d+1}}-2\\
&  =\operatorname*{load}d+2^{\operatorname*{ones}d+1}-2=\underbrace{\left(
\operatorname*{load}d+2^{\operatorname*{ones}d+1}-1\right)  }%
_{\substack{=\operatorname*{load}\left(  01d\right)  \\\text{(by
(\ref{sol.ind.01-100.2nd.C2.pf.IB.1}))}}}-1=\operatorname*{load}\left(
01d\right)  -1.
\end{align*}
Thus, we have shown that $\operatorname*{load}\left(  100d\right)
=\operatorname*{load}\left(  01d\right)  -1$ and $\operatorname*{ones}\left(
100d\right)  =\operatorname*{ones}\left(  01d\right)  $ and
$\operatorname*{zeros}\left(  100d\right)  =\operatorname*{zeros}\left(
01d\right)  +1$. In other words, Claim 2 holds for $k=0$.

\textit{Induction step:} Let $\ell\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 2 holds for $k=\ell$. We must prove that Claim 2 holds
for $k=\ell+1$.

Let $b_{1},b_{2},\ldots,b_{\ell+1}$ be any elements of $\left\{  0,1\right\}
$. We must show that
\begin{equation}
\operatorname*{load}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{load}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)  -1
\label{sol.ind.01-100.2nd.C2.pf.IG.load}%
\end{equation}
and%
\begin{equation}
\operatorname*{ones}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{ones}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)
\label{sol.ind.01-100.2nd.C2.pf.IG.ones}%
\end{equation}
and%
\begin{equation}
\operatorname*{zeros}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{zeros}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)  +1.
\label{sol.ind.01-100.2nd.C2.pf.IG.zeros}%
\end{equation}


The induction hypothesis says that Claim 2 holds for $k=\ell$. Hence, we have
\begin{equation}
\operatorname*{load}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}100d\right)
=\operatorname*{load}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}01d\right)  -1
\label{sol.ind.01-100.2nd.C2.pf.IH.load}%
\end{equation}
and%
\begin{equation}
\operatorname*{ones}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}100d\right)
=\operatorname*{ones}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}01d\right)
\label{sol.ind.01-100.2nd.C2.pf.IH.ones}%
\end{equation}
and%
\begin{equation}
\operatorname*{zeros}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}100d\right)
=\operatorname*{zeros}\left(  b_{\ell}b_{\ell-1}\ldots b_{1}01d\right)  +1.
\label{sol.ind.01-100.2nd.C2.pf.IH.zeros}%
\end{equation}


Let $c=b_{\ell}b_{\ell-1}\ldots b_{1}100d$ and $c^{\prime}=b_{\ell}b_{\ell
-1}\ldots b_{1}01d$. Thus, the three equalities
(\ref{sol.ind.01-100.2nd.C2.pf.IH.load}),
(\ref{sol.ind.01-100.2nd.C2.pf.IH.ones}) and
(\ref{sol.ind.01-100.2nd.C2.pf.IH.zeros}) can be rewritten as%
\begin{equation}
\operatorname*{load}c=\operatorname*{load}\left(  c^{\prime}\right)  -1
\label{sol.ind.01-100.2nd.C2.pf.IH.load-c}%
\end{equation}
and%
\begin{equation}
\operatorname*{ones}c=\operatorname*{ones}\left(  c^{\prime}\right)
\label{sol.ind.01-100.2nd.C2.pf.IH.ones-c}%
\end{equation}
and%
\begin{equation}
\operatorname*{zeros}c=\operatorname*{zeros}\left(  c^{\prime}\right)  +1.
\label{sol.ind.01-100.2nd.C2.pf.IH.zeros-c}%
\end{equation}


Now, $b_{\ell+1}\in\left\{  0,1\right\}  $. Hence,
(\ref{sol.ind.01-100.2nd.zeros-b}) (applied to $b=b_{\ell+1}$) yields%
\begin{equation}
\operatorname*{zeros}\left(  b_{\ell+1}c\right)  =\left[  b_{\ell+1}=0\right]
+\operatorname*{zeros}c. \label{sol.ind.01-100.2nd.C2.pf.IS.zeros.1}%
\end{equation}
The same argument (applied to $c^{\prime}$ instead of $c$) yields%
\begin{equation}
\operatorname*{zeros}\left(  b_{\ell+1}c^{\prime}\right)  =\left[  b_{\ell
+1}=0\right]  +\operatorname*{zeros}\left(  c^{\prime}\right)  .
\label{sol.ind.01-100.2nd.C2.pf.IS.zeros.2}%
\end{equation}
Hence, (\ref{sol.ind.01-100.2nd.C2.pf.IS.zeros.1}) becomes%
\begin{align}
\operatorname*{zeros}\left(  b_{\ell+1}c\right)   &  =\left[  b_{\ell
+1}=0\right]  +\underbrace{\operatorname*{zeros}c}%
_{\substack{=\operatorname*{zeros}\left(  c^{\prime}\right)  +1\\\text{(by
(\ref{sol.ind.01-100.2nd.C2.pf.IH.zeros-c}))}}}=\underbrace{\left[  b_{\ell
+1}=0\right]  +\operatorname*{zeros}\left(  c^{\prime}\right)  }%
_{\substack{=\operatorname*{zeros}\left(  b_{\ell+1}c^{\prime}\right)
\\\text{(by (\ref{sol.ind.01-100.2nd.C2.pf.IS.zeros.2}))}}}+1\nonumber\\
&  =\operatorname*{zeros}\left(  b_{\ell+1}c^{\prime}\right)  +1.
\label{sol.ind.01-100.2nd.C2.pf.IS.zeros.3}%
\end{align}


Furthermore, (\ref{sol.ind.01-100.2nd.ones-b}) (applied to $b=b_{\ell+1}$)
yields%
\begin{equation}
\operatorname*{ones}\left(  b_{\ell+1}c\right)  =\left[  b_{\ell+1}=1\right]
+\operatorname*{ones}c. \label{sol.ind.01-100.2nd.C2.pf.IS.ones.1}%
\end{equation}
The same argument (applied to $c^{\prime}$ instead of $c$) yields%
\begin{equation}
\operatorname*{ones}\left(  b_{\ell+1}c^{\prime}\right)  =\left[  b_{\ell
+1}=1\right]  +\operatorname*{ones}\left(  c^{\prime}\right)  .
\label{sol.ind.01-100.2nd.C2.pf.IS.ones.2}%
\end{equation}
Hence, (\ref{sol.ind.01-100.2nd.C2.pf.IS.ones.1}) becomes%
\begin{align}
\operatorname*{ones}\left(  b_{\ell+1}c\right)   &  =\left[  b_{\ell
+1}=1\right]  +\underbrace{\operatorname*{ones}c}%
_{\substack{=\operatorname*{ones}\left(  c^{\prime}\right)  \\\text{(by
(\ref{sol.ind.01-100.2nd.C2.pf.IH.ones-c}))}}}=\left[  b_{\ell+1}=1\right]
+\operatorname*{ones}\left(  c^{\prime}\right) \nonumber\\
&  =\operatorname*{ones}\left(  b_{\ell+1}c^{\prime}\right)
\label{sol.ind.01-100.2nd.C2.pf.IS.ones.3}%
\end{align}
(by (\ref{sol.ind.01-100.2nd.C2.pf.IS.ones.2})).

Finally, (\ref{sol.ind.01-100.2nd.load-b}) (applied to $b=b_{\ell+1}$) yields%
\begin{equation}
\operatorname*{load}\left(  b_{\ell+1}c\right)  =\operatorname*{load}c+\left[
b_{\ell+1}=0\right]  \cdot\left(  2^{\operatorname*{ones}c}-1\right)  .
\label{sol.ind.01-100.2nd.C2.pf.IS.load.1}%
\end{equation}
The same argument (applied to $c^{\prime}$ instead of $c$) yields%
\begin{equation}
\operatorname*{load}\left(  b_{\ell+1}c^{\prime}\right)  =\operatorname*{load}%
\left(  c^{\prime}\right)  +\left[  b_{\ell+1}=0\right]  \cdot\left(
2^{\operatorname*{ones}\left(  c^{\prime}\right)  }-1\right)  .
\label{sol.ind.01-100.2nd.C2.pf.IS.load.2}%
\end{equation}
Hence, (\ref{sol.ind.01-100.2nd.C2.pf.IS.load.1}) becomes%
\begin{align}
\operatorname*{load}\left(  b_{\ell+1}c\right)   &
=\underbrace{\operatorname*{load}c}_{\substack{=\operatorname*{load}\left(
c^{\prime}\right)  -1\\\text{(by (\ref{sol.ind.01-100.2nd.C2.pf.IH.load-c}))}%
}}+\left[  b_{\ell+1}=0\right]  \cdot\underbrace{\left(
2^{\operatorname*{ones}c}-1\right)  }_{\substack{=2^{\operatorname*{ones}%
\left(  c^{\prime}\right)  }-1\\\text{(by
(\ref{sol.ind.01-100.2nd.C2.pf.IH.ones-c}))}}}\nonumber\\
&  =\operatorname*{load}\left(  c^{\prime}\right)  -1+\left[  b_{\ell
+1}=0\right]  \cdot\left(  2^{\operatorname*{ones}\left(  c^{\prime}\right)
}-1\right) \nonumber\\
&  =\underbrace{\operatorname*{load}\left(  c^{\prime}\right)  +\left[
b_{\ell+1}=0\right]  \cdot\left(  2^{\operatorname*{ones}\left(  c^{\prime
}\right)  }-1\right)  }_{\substack{=\operatorname*{load}\left(  b_{\ell
+1}c^{\prime}\right)  \\\text{(by (\ref{sol.ind.01-100.2nd.C2.pf.IS.load.2}%
))}}}-1\nonumber\\
&  =\operatorname*{load}\left(  b_{\ell+1}c^{\prime}\right)  -1.
\label{sol.ind.01-100.2nd.C2.pf.IS.load.3}%
\end{align}


Now, recall that
\[
b_{\ell+1}\underbrace{c}_{=b_{\ell}b_{\ell-1}\ldots b_{1}100d}=b_{\ell
+1}b_{\ell}b_{\ell-1}\ldots b_{1}100d=b_{\ell+1}b_{\ell}\ldots b_{1}100d
\]
and%
\[
b_{\ell+1}\underbrace{c^{\prime}}_{=b_{\ell}b_{\ell-1}\ldots b_{1}01d}%
=b_{\ell+1}b_{\ell}b_{\ell-1}\ldots b_{1}01d=b_{\ell+1}b_{\ell}\ldots
b_{1}01d.
\]
In light of these two equalities, we can rewrite the three equalities
(\ref{sol.ind.01-100.2nd.C2.pf.IS.load.3}),
(\ref{sol.ind.01-100.2nd.C2.pf.IS.ones.3}) and
(\ref{sol.ind.01-100.2nd.C2.pf.IS.zeros.3}) as%
\[
\operatorname*{load}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{load}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)  -1
\]
and%
\[
\operatorname*{ones}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{ones}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)
\]
and%
\[
\operatorname*{zeros}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}100d\right)
=\operatorname*{zeros}\left(  b_{\ell+1}b_{\ell}\ldots b_{1}01d\right)  +1.
\]
But these are precisely the three equalities
(\ref{sol.ind.01-100.2nd.C2.pf.IG.load}),
(\ref{sol.ind.01-100.2nd.C2.pf.IG.ones}) and
(\ref{sol.ind.01-100.2nd.C2.pf.IG.zeros}). So the latter three equalities are proved.

Now, forget that we fixed $b_{1},b_{2},\ldots,b_{\ell+1}$. We thus have proved
the equalities (\ref{sol.ind.01-100.2nd.C2.pf.IG.load}),
(\ref{sol.ind.01-100.2nd.C2.pf.IG.ones}) and
(\ref{sol.ind.01-100.2nd.C2.pf.IG.zeros}) for any $\ell+1$ elements
$b_{1},b_{2},\ldots,b_{\ell+1}$ of $\left\{  0,1\right\}  $. In other words,
Claim 2 holds for $k=\ell+1$. This completes the induction step, so that Claim
2 is proved.]

[\textit{Proof of Claim 1:} We have $a\rightarrow b$. In other words, the
bitstring $b$ is obtained by applying a move to $a$ (by the definition of the
notation \textquotedblleft$a\rightarrow b$\textquotedblright). In other words,
the bitstring $b$ is obtained from $a$ by picking two consecutive entries $01$
and replacing them by $100$. In other words, there exist some $k,\ell
\in\mathbb{N}$ and some elements $b_{1},b_{2},\ldots,b_{k},d_{1},d_{2}%
,\ldots,d_{\ell}$ of $\left\{  0,1\right\}  $ such that%
\begin{equation}
a=b_{k}b_{k-1}\ldots b_{1}01d_{1}d_{2}\ldots d_{\ell}
\label{sol.ind.01-100.2nd.C1.pf.a=}%
\end{equation}
and%
\begin{equation}
b=b_{k}b_{k-1}\ldots b_{1}100d_{1}d_{2}\ldots d_{\ell}
\label{sol.ind.01-100.2nd.C1.pf.b=}%
\end{equation}
(indeed, $b_{k},b_{k-1},\ldots,b_{1}$ are the entries of $a$ to the left of
the two consecutive entries $01$ that are being replaced, whereas $d_{1}%
,d_{2},\ldots,d_{\ell}$ are the entries of $a$ to the right of these two
consecutive entries $01$). Consider these $k,\ell$ and these $b_{1}%
,b_{2},\ldots,b_{k},d_{1},d_{2},\ldots,d_{\ell}$. Claim 2 (applied to
$d=d_{1}d_{2}\ldots d_{\ell}$) yields%
\[
\operatorname*{load}\left(  b_{k}b_{k-1}\ldots b_{1}100d_{1}d_{2}\ldots
d_{\ell}\right)  =\operatorname*{load}\left(  b_{k}b_{k-1}\ldots b_{1}%
01d_{1}d_{2}\ldots d_{\ell}\right)  -1
\]
and%
\[
\operatorname*{ones}\left(  b_{k}b_{k-1}\ldots b_{1}100d_{1}d_{2}\ldots
d_{\ell}\right)  =\operatorname*{ones}\left(  b_{k}b_{k-1}\ldots b_{1}%
01d_{1}d_{2}\ldots d_{\ell}\right)
\]
and%
\[
\operatorname*{zeros}\left(  b_{k}b_{k-1}\ldots b_{1}100d_{1}d_{2}\ldots
d_{\ell}\right)  =\operatorname*{zeros}\left(  b_{k}b_{k-1}\ldots b_{1}%
01d_{1}d_{2}\ldots d_{\ell}\right)  +1.
\]
In view of (\ref{sol.ind.01-100.2nd.C1.pf.a=}) and
(\ref{sol.ind.01-100.2nd.C1.pf.b=}), these three equalities rewrite as
$\operatorname*{load}b=\operatorname*{load}a-1$ and $\operatorname*{ones}%
b=\operatorname*{ones}a$ and $\operatorname*{zeros}b=\operatorname*{zeros}%
a+1$. This proves Claim 1.]

Next, we introduce a notation for chains of moves. Namely, if $a_{0}%
,a_{1},\ldots,a_{k}$ are several bitstrings\footnote{Note that the notation
$a_{i}$ stands for a bitstring, not for a single entry of a bitstring here.},
then the notation \textquotedblleft$a_{0}\rightarrow a_{1}\rightarrow
\cdots\rightarrow a_{k}$\textquotedblright\ shall mean that every
$i\in\left\{  1,2,\ldots,k\right\}  $ satisfies $a_{i-1}\rightarrow a_{i}$
(that is, every bitstring in the chain $a_{0}\rightarrow a_{1}\rightarrow
\cdots\rightarrow a_{k}$ is obtained from the preceding one by a move). Now,
from Claim 1, we can easily derive the following:

\begin{statement}
\textit{Claim 3:} Let $a_{0},a_{1},\ldots,a_{k}$ be bitstrings such that
$a_{0}\rightarrow a_{1}\rightarrow\cdots\rightarrow a_{k}$. Then,
$\operatorname*{load}\left(  a_{k}\right)  =\operatorname*{load}\left(
a_{0}\right)  -k$ and $\operatorname*{ones}\left(  a_{k}\right)
=\operatorname*{ones}\left(  a_{0}\right)  $ and $\operatorname*{zeros}\left(
a_{k}\right)  =\operatorname*{zeros}\left(  a_{0}\right)  +k$.
\end{statement}

[\textit{Proof of Claim 3:} This is straightforward to prove by induction on
$k$ (using Claim 1 in the induction step). Alternatively, we can proceed as
follows: For each $i\in\left\{  1,2,\ldots,k\right\}  $, we have
$a_{i-1}\rightarrow a_{i}$ (since $a_{0}\rightarrow a_{1}\rightarrow
\cdots\rightarrow a_{k}$), and therefore Claim 1 (applied to $a=a_{i-1}$ and
$b=a_{i}$) yields%
\begin{equation}
\operatorname*{load}\left(  a_{i}\right)  =\operatorname*{load}\left(
a_{i-1}\right)  -1 \label{sol.ind.01-100.2nd.C3.pf.l}%
\end{equation}
and%
\begin{equation}
\operatorname*{ones}\left(  a_{i}\right)  =\operatorname*{ones}\left(
a_{i-1}\right)  \label{sol.ind.01-100.2nd.C3.pf.o}%
\end{equation}
and%
\begin{equation}
\operatorname*{zeros}\left(  a_{i}\right)  =\operatorname*{zeros}\left(
a_{i-1}\right)  +1. \label{sol.ind.01-100.2nd.C3.pf.z}%
\end{equation}


Now, combining the equalities (\ref{sol.ind.01-100.2nd.C3.pf.o}) for all
$i\in\left\{  1,2,\ldots,k\right\}  $, we obtain%
\[
\operatorname*{ones}\left(  a_{k}\right)  =\operatorname*{ones}\left(
a_{k-1}\right)  =\operatorname*{ones}\left(  a_{k-2}\right)  =\cdots
=\operatorname*{ones}\left(  a_{0}\right)  .
\]
Hence, $\operatorname*{ones}\left(  a_{k}\right)  =\operatorname*{ones}\left(
a_{0}\right)  $ is proved. Furthermore, the telescope principle (specifically,
an application of Theorem \ref{thm.seqsum.telesc}) yields%
\[
\sum_{i=1}^{k}\left(  \operatorname*{load}\left(  a_{i}\right)
-\operatorname*{load}\left(  a_{i-1}\right)  \right)  =\operatorname*{load}%
\left(  a_{k}\right)  -\operatorname*{load}\left(  a_{0}\right)  ,
\]
so that%
\begin{align*}
\operatorname*{load}\left(  a_{k}\right)  -\operatorname*{load}\left(
a_{0}\right)   &  =\sum_{i=1}^{k}\underbrace{\left(  \operatorname*{load}%
\left(  a_{i}\right)  -\operatorname*{load}\left(  a_{i-1}\right)  \right)
}_{\substack{=-1\\\text{(by (\ref{sol.ind.01-100.2nd.C3.pf.l}))}}}=\sum
_{i=1}^{k}\left(  -1\right) \\
&  =k\cdot\left(  -1\right)  =-k.
\end{align*}
Therefore, $\operatorname*{load}\left(  a_{k}\right)  =\operatorname*{load}%
\left(  a_{0}\right)  -k$. Finally, the telescope principle (specifically, an
application of Theorem \ref{thm.seqsum.telesc}) yields%
\[
\sum_{i=1}^{k}\left(  \operatorname*{zeros}\left(  a_{i}\right)
-\operatorname*{zeros}\left(  a_{i-1}\right)  \right)  =\operatorname*{zeros}%
\left(  a_{k}\right)  -\operatorname*{zeros}\left(  a_{0}\right)  ,
\]
so that%
\begin{align*}
\operatorname*{zeros}\left(  a_{k}\right)  -\operatorname*{zeros}\left(
a_{0}\right)   &  =\sum_{i=1}^{k}\underbrace{\left(  \operatorname*{zeros}%
\left(  a_{i}\right)  -\operatorname*{zeros}\left(  a_{i-1}\right)  \right)
}_{\substack{=1\\\text{(by (\ref{sol.ind.01-100.2nd.C3.pf.z}))}}}=\sum
_{i=1}^{k}1\\
&  =k\cdot1=k.
\end{align*}
In other words, $\operatorname*{zeros}\left(  a_{k}\right)
=\operatorname*{zeros}\left(  a_{0}\right)  +k$. This completes the proof of
Claim 3.]

We can now reap the consequences of Claim 3:

\begin{statement}
\textit{Claim 4:} Let $a$ be any bitstring. Let $a_{0},a_{1},\ldots,a_{k}$ be
bitstrings such that $a_{0}\rightarrow a_{1}\rightarrow\cdots\rightarrow
a_{k}$ and $a_{0}=a$. Then, $k\leq\operatorname*{load}a$.
\end{statement}

[\textit{Proof of Claim 4:} Claim 3 yields $\operatorname*{load}\left(
a_{k}\right)  =\operatorname*{load}\left(  a_{0}\right)  -k$ and
$\operatorname*{ones}\left(  a_{k}\right)  =\operatorname*{ones}\left(
a_{0}\right)  $ and $\operatorname*{zeros}\left(  a_{k}\right)
=\operatorname*{zeros}\left(  a_{0}\right)  +k$. But
(\ref{sol.ind.01-100.2nd.load-nonn}) (applied to $a_{k}$ instead of $a$) shows
that $\operatorname*{load}\left(  a_{k}\right)  $ is a nonnegative integer.
Hence, $\operatorname*{load}\left(  a_{k}\right)  \geq0$. In view of
$\operatorname*{load}\left(  a_{k}\right)  =\operatorname*{load}\left(
a_{0}\right)  -k=\operatorname*{load}a-k$ (since $a_{0}=a$), this rewrites as
$\operatorname*{load}a-k\geq0$. In other words, $k\leq\operatorname*{load}a$.
This proves Claim 4.]

Next, a few more notations. A bitstring shall be called \textit{immovable} if
no move can be applied to it. A bitstring shall be called \textit{sorted} if
it has the form%
\[
\underbrace{11\ldots1}_{\text{some number of }1\text{s}}%
\ \ \underbrace{00\ldots0}_{\text{some number of }0\text{s}}.
\]
Here, \textquotedblleft some number\textquotedblright\ is allowed to mean
\textquotedblleft$0$\textquotedblright; thus, for example, $111$ and $00$ and
the empty bitstring $\varepsilon$ are sorted.

It is easy to see that each sorted bitstring is immovable (since it contains
no two consecutive entries $01$). Now, we claim that the converse is true as well:

\begin{statement}
\textit{Claim 5:} Let $a$ be any immovable bitstring. Then, $a$ is sorted and
satisfies $\operatorname*{load}a=0$.
\end{statement}

[\textit{Proof of Claim 5:} This is easy to see in a few moments of thought,
but since we have made a habit of proving everything by induction in this
solution, let us prove Claim 5 by induction as well.

The \textit{length} $\ell\left(  c\right)  $ of a bitstring $c$ is defined as
the number of its entries. For example, the bitstring $010$ has length
$\ell\left(  010\right)  =3$. Now, we shall prove Claim 5 by induction on
$\ell\left(  a\right)  $:

\textit{Induction base:} It is easy to see that Claim 5 holds for $\ell\left(
a\right)  =0$.\ \ \ \ \footnote{Indeed, if $\ell\left(  a\right)  =0$, then
$a$ is the empty bitstring $\varepsilon$, and thus $a$ is sorted (since
$\varepsilon$ is sorted) and satisfies $\operatorname*{load}%
a=\operatorname*{load}\varepsilon=0$.} This completes the induction base.

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 5 holds for $\ell\left(  a\right)  =m$. We must prove
that Claim 5 holds for $\ell\left(  a\right)  =m+1$.

Our induction hypothesis says that Claim 5 holds for $\ell\left(  a\right)
=m$. In other words, if $a$ is any immovable bitstring satisfying $\ell\left(
a\right)  =m$, then%
\begin{equation}
a\text{ is sorted and satisfies }\operatorname*{load}a=0.
\label{sol.ind.01-100.2nd.C5.pf.IH.1}%
\end{equation}


Now, let us prove that Claim 5 holds for $\ell\left(  a\right)  =m+1$. Let $a$
be an immovable bitstring such that $\ell\left(  a\right)  =m+1$. Then, $a$ is
not the empty bitstring (since $a$ has length $\ell\left(  a\right)
=m+1>m\geq0$). Hence, $a$ has a well-defined first entry. In other words, we
can write $a$ in the form $a=ba^{\prime}$ for some $b\in\left\{  0,1\right\}
$ and some bitstring $a^{\prime}$. Moreover, from $a=ba^{\prime}$, we see that
the length of $a$ is exactly by $1$ larger than the length of $a^{\prime}$
(since $b$ is a single entry). In other words, $\ell\left(  a\right)
=\ell\left(  a^{\prime}\right)  +1$. Hence, $\ell\left(  a^{\prime}\right)
=\ell\left(  a\right)  -1=m$ (since $\ell\left(  a\right)  =m+1$).

Recall that the bitstring $a$ is immovable. In other words, no move can be
applied to $a$ (by the definition of \textquotedblleft
immovable\textquotedblright). Hence, the bitstring $a$ contains no two
consecutive entries $01$ (because if it would contain two such consecutive
entries, then we could apply a move to $a$ that would replace these entries by
$100$; but this would contradict the preceding sentence). Thus, in particular,
the bitstring $a$ cannot begin with $01$.

But the bitstring $a$ contains the bitstring $a^{\prime}$ as a contiguous
segment (since $a=ba^{\prime}$). Hence, the bitstring $a^{\prime}$ is
immovable\footnote{\textit{Proof.} Assume the contrary. Thus, the string
$a^{\prime}$ is not immovable. In other words, some move can be applied to
$a^{\prime}$ (by the definition of \textquotedblleft
immovable\textquotedblright). Hence, the bitstring $a^{\prime}$ contains two
consecutive entries $01$ (since any move requires two consecutive entries
$01$). Therefore, the bitstring $a$ contains two consecutive entries $01$ as
well (since the bitstring $a$ contains the bitstring $a^{\prime}$ as a
contiguous segment). This contradicts the fact that the bitstring $a$ contains
no two consecutive entries $01$. Hence, our assumption was wrong, qed.}. Thus,
$a^{\prime}$ is an immovable bitstring satisfying $\ell\left(  a^{\prime
}\right)  =m$. Hence, (\ref{sol.ind.01-100.2nd.C5.pf.IH.1}) (applied to
$a^{\prime}$ instead of $a$) yields that $a^{\prime}$ is sorted and satisfies
$\operatorname*{load}\left(  a^{\prime}\right)  =0$.

Now, $b\in\left\{  0,1\right\}  $. Hence, we are in one of the following two cases:

\textit{Case 1:} We have $b=0$.

\textit{Case 2:} We have $b=1$.

Let us first consider Case 1. In this case, we have $b=0$. Thus,
$a=\underbrace{b}_{=0}a^{\prime}=0a^{\prime}$. Recall that the bitstring $a$
cannot begin with $01$. In other words, the bitstring $0a^{\prime}$ cannot
begin with $01$ (since $a=0a^{\prime}$). However, if the bitstring $a^{\prime
}$ would begin with a $1$, then the bitstring $0a^{\prime}$ would begin with
$01$, which would contradict the previous sentence. Thus, the bitstring
$a^{\prime}$ cannot begin with a $1$.

But recall that the bitstring $a^{\prime}$ is sorted. Thus, if $a^{\prime}$
contains any $1$, then $a^{\prime}$ must begin with a $1$. Since $a^{\prime}$
cannot begin with a $1$ (as we have just shown), we thus conclude that
$a^{\prime}$ cannot contain any $1$. Therefore, all entries of $a^{\prime}$
are $0$s. Thus, $a^{\prime}=\underbrace{00\ldots0}_{\text{some number of
}0\text{s}}$. Therefore,%
\[
a=0\underbrace{a^{\prime}}_{=\underbrace{00\ldots0}_{\text{some number of
}0\text{s}}}=0\underbrace{00\ldots0}_{\text{some number of }0\text{s}%
}=\underbrace{00\ldots0}_{\text{some number of }0\text{s}}.
\]
Therefore, the bitstring $a$ is sorted. Furthermore, $\operatorname*{ones}%
\left(  a^{\prime}\right)  =0$ (since $a^{\prime}$ cannot contain any $1$).
From $a=0a^{\prime}$, we obtain%
\begin{align*}
\operatorname*{load}a  &  =\operatorname*{load}\left(  0a^{\prime}\right)
=\operatorname*{load}\left(  a^{\prime}\right)  +2^{\operatorname*{ones}%
\left(  a^{\prime}\right)  }-1\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ind.01-100.2nd.load-0}), applied to }c=a^{\prime}\right) \\
&  =\underbrace{\operatorname*{load}\left(  a^{\prime}\right)  }%
_{=0}+\underbrace{2^{0}-1}_{=0}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\operatorname*{ones}\left(  a^{\prime}\right)  =0\right) \\
&  =0+0=0.
\end{align*}
Thus, in Case 1, we have shown that the bitstring $a$ is sorted and satisfies
$\operatorname*{load}a=0$.

Let us next consider Case 2. In this case, we have $b=1$. Thus,
$a=\underbrace{b}_{=1}a^{\prime}=1a^{\prime}$. Hence, the bitstring $a$ is
sorted\footnote{\textit{Proof.} The bitstring $a^{\prime}$ is sorted. In other
words, $a^{\prime}$ has the form $a^{\prime}=\underbrace{11\ldots
1}_{\text{some number of }1\text{s}}\ \ \underbrace{00\ldots0}_{\text{some
number of }0\text{s}}$ (by the definition of \textquotedblleft
sorted\textquotedblright). Hence,%
\[
a=1\underbrace{a^{\prime}}_{=\underbrace{11\ldots1}_{\text{some number of
}1\text{s}}\ \ \underbrace{00\ldots0}_{\text{some number of }0\text{s}}%
}=1\underbrace{11\ldots1}_{\text{some number of }1\text{s}}%
\ \ \underbrace{00\ldots0}_{\text{some number of }0\text{s}}.
\]
Therefore, the bitstring $a$ also has the form $\underbrace{11\ldots
1}_{\text{some number of }1\text{s}}\ \ \underbrace{00\ldots0}_{\text{some
number of }0\text{s}}$. In other words, $a$ is sorted (by the definition of
\textquotedblleft sorted\textquotedblright).}. Moreover, from $a=1a^{\prime}$,
we obtain%
\begin{align*}
\operatorname*{load}a  &  =\operatorname*{load}\left(  1a^{\prime}\right)
=\operatorname*{load}\left(  a^{\prime}\right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.ind.01-100.2nd.load-1}), applied to }c=a^{\prime}\right) \\
&  =0.
\end{align*}
Thus, in Case 2, we have shown that the bitstring $a$ is sorted and satisfies
$\operatorname*{load}a=0$.

Hence, in each of the two Cases 1 and 2, we have shown that the bitstring $a$
is sorted and satisfies $\operatorname*{load}a=0$. Thus, this always holds.

Now, forget that we fixed $a$. We thus have proved that if $a$ is any
immovable bitstring satisfying $\ell\left(  a\right)  =m+1$, then $a$ is
sorted and satisfies $\operatorname*{load}a=0$. In other words, Claim 5 holds
for $\ell\left(  a\right)  =m+1$. This completes the induction step. Thus,
Claim 5 is proved.]

Using Claim 3 and Claim 5, we can now easily see the following:

\begin{statement}
\textit{Claim 6:} Let $a$ be any bitstring. Let $a_{0},a_{1},\ldots,a_{k}$ be
bitstrings such that $a_{0}\rightarrow a_{1}\rightarrow\cdots\rightarrow
a_{k}$ and $a_{0}=a$. Assume that the bitstring $a_{k}$ is immovable. Then,%
\[
k=\operatorname*{load}a
\]
and%
\[
a_{k}=\underbrace{11\ldots1}_{\operatorname*{ones}a\text{ many }1\text{s}%
}\ \ \underbrace{00\ldots0}_{\operatorname*{zeros}a+\operatorname*{load}%
a\text{ many }0\text{s}}.
\]

\end{statement}

[\textit{Proof of Claim 6:} Claim 3 yields $\operatorname*{load}\left(
a_{k}\right)  =\operatorname*{load}\left(  a_{0}\right)  -k$ and
$\operatorname*{ones}\left(  a_{k}\right)  =\operatorname*{ones}\left(
a_{0}\right)  $ and $\operatorname*{zeros}\left(  a_{k}\right)
=\operatorname*{zeros}\left(  a_{0}\right)  +k$. Furthermore, Claim 5 (applied
to $a_{k}$ instead of $a$) yields that $a_{k}$ is sorted and satisfies
$\operatorname*{load}\left(  a_{k}\right)  =0$. Comparing
$\operatorname*{load}\left(  a_{k}\right)  =\operatorname*{load}\left(
a_{0}\right)  -k$ with $\operatorname*{load}\left(  a_{k}\right)  =0$, we
obtain $\operatorname*{load}\left(  a_{0}\right)  -k=0$. Thus,
$\operatorname*{load}\left(  a_{0}\right)  =k$. Hence, $k=\operatorname*{load}%
\left(  a_{0}\right)  =\operatorname*{load}a$ (since $a_{0}=a$).

The bitstring $a_{k}$ is sorted. In other words, $a_{k}$ has the form
\[
\underbrace{11\ldots1}_{\text{some number of }1\text{s}}%
\ \ \underbrace{00\ldots0}_{\text{some number of }0\text{s}}%
\]
(by the definition of \textquotedblleft sorted\textquotedblright). In other
words, there exist numbers $p,q\in\mathbb{N}$ such that%
\begin{equation}
a_{k}=\underbrace{11\ldots1}_{p\text{ many }1\text{s}}\ \ \underbrace{00\ldots
0}_{q\text{ many }0\text{s}}. \label{sol.ind.01-100.2nd.C6.pf.1}%
\end{equation}
Consider these $p$ and $q$.

From (\ref{sol.ind.01-100.2nd.C6.pf.1}), we see that the bitstring $a_{k}$ has
exactly $p$ many $1$s. In other words, the number of $1$s in $a_{k}$ is $p$.
In other words, $\operatorname*{ones}\left(  a_{k}\right)  =p$. Hence,
$p=\operatorname*{ones}\left(  a_{k}\right)  =\operatorname*{ones}\left(
a_{0}\right)  =\operatorname*{ones}a$ (since $a_{0}=a$).

Furthermore, from (\ref{sol.ind.01-100.2nd.C6.pf.1}), we see that the
bitstring $a_{k}$ has exactly $q$ many $0$s. In other words, the number of
$0$s in $a_{k}$ is $q$. In other words, $\operatorname*{zeros}\left(
a_{k}\right)  =q$. Hence, $q=\operatorname*{zeros}\left(  a_{k}\right)
=\operatorname*{zeros}\left(  a_{0}\right)  +k=\operatorname*{zeros}%
a+\operatorname*{load}a$ (since $a_{0}=a$ and $k=\operatorname*{load}a$).

Thus, we know that $p=\operatorname*{ones}a$ and $q=\operatorname*{zeros}%
a+\operatorname*{load}a$. Hence, the equality
(\ref{sol.ind.01-100.2nd.C6.pf.1}) rewrites as%
\[
a_{k}=\underbrace{11\ldots1}_{\operatorname*{ones}a\text{ many }1\text{s}%
}\ \ \underbrace{00\ldots0}_{\operatorname*{zeros}a+\operatorname*{load}%
a\text{ many }0\text{s}}.
\]
This completes the proof of Claim 6.]

Solving the exercise is now just a matter of translating Claims 4 and 6 back:

\textbf{(a)} Let us start with a bitstring $a$, and consider a sequence of
moves that can be applied successively to it. We must prove that this sequence
must have an end. We shall prove a stronger claim: namely, that this sequence
cannot have more than $\operatorname*{load}a$ moves.

Indeed, assume the contrary. Thus, this sequence has more than
$\operatorname*{load}a$ moves. This means that we can apply more than
$\operatorname*{load}a$ moves consecutively starting at $a$. Hence, in
particular, we can apply $\operatorname*{load}a+1$ moves consecutively
starting at $a$. Let $a_{0},a_{1},\ldots,a_{\operatorname*{load}a+1}$ denote
the bitstrings obtained in this process (starting with $a$ itself). Thus,
$a_{0}\rightarrow a_{1}\rightarrow\cdots\rightarrow a_{\operatorname*{load}%
a+1}$ and $a_{0}=a$. Now, Claim 4 (applied to $k=\operatorname*{load}a+1$)
yields $\operatorname*{load}a+1\leq\operatorname*{load}a$, which is absurd.
This contradiction shows that our assumption was wrong. Hence, our claim (that
our sequence of moves cannot have more than $\operatorname*{load}a$ moves) is
proved. This solves Exercise \ref{exe.ind.01-100} \textbf{(a)}.

\textbf{(b)} Let $a^{\circ}$ be an immovable bitstring obtained from $a$ by
performing moves until no more moves are possible. We must prove that this
bitstring $a^{\circ}$ is uniquely determined by $a$ (independently of the
sequence of moves used to obtain it). We must also show that the number of
moves used to obtain $a^{\circ}$ from $a$ is uniquely determined by $a$.

We have assumed that $a^{\circ}$ is obtained from $a$ by performing moves. Let
$a_{0},a_{1},\ldots,a_{k}$ be the bitstrings obtained in this sequence of
moves (starting with $a$ and ending with $a^{\circ}$). Thus, $a_{0}\rightarrow
a_{1}\rightarrow\cdots\rightarrow a_{k}$ and $a_{0}=a$ and $a_{k}=a^{\circ}$.
Note that the number of moves used to obtain $a^{\circ}$ from $a$ through this
sequence is $k$.

Now, the bitstring $a^{\circ}$ is immovable. In other words, the bitstring
$a_{k}$ is immovable (since $a_{k}=a^{\circ}$). Hence, Claim 6 yields that
\[
k=\operatorname*{load}a
\]
and%
\[
a_{k}=\underbrace{11\ldots1}_{\operatorname*{ones}a\text{ many }1\text{s}%
}\ \ \underbrace{00\ldots0}_{\operatorname*{zeros}a+\operatorname*{load}%
a\text{ many }0\text{s}}.
\]
Thus,%
\[
a^{\circ}=a_{k}=\underbrace{11\ldots1}_{\operatorname*{ones}a\text{ many
}1\text{s}}\ \ \underbrace{00\ldots0}_{\operatorname*{zeros}%
a+\operatorname*{load}a\text{ many }0\text{s}}.
\]
This equality shows that $a^{\circ}$ is uniquely determined by $a$ (since the
right hand side of this equality is clearly uniquely determined by $a$).
Furthermore, $k$ is uniquely determined by $a$ (since $k=\operatorname*{load}%
a$). In other words, the number of moves used to obtain $a^{\circ}$ from $a$
is uniquely determined by $a$ (since the number of moves used to obtain
$a^{\circ}$ from $a$ is $k$). Thus, Exercise \ref{exe.ind.01-100} \textbf{(b)}
is solved.
\end{proof}

[\textit{Remark:} The first and the second solution to Exercise
\ref{exe.ind.01-100} given above differ mostly in their presentation. At their
core, they are doing the same thing. For example, the comb number of a
bitstring $a$ (as defined in the first solution) is precisely the number
$\operatorname*{load}a$ (as defined in the second solution). Thus, Claim 1 in
the first solution is equivalent to Claim 1 in the second. The proofs of the
two Claims 1 are different, but the way they are used is also the same except
for the presentation. The main difference is that the first solution involved
some combinatorial handwaving (in defining a 1-to-1 correspondence between
nontrivial $a$-combs and $a^{\prime}$-combs) while the second instead relied
on rigorous induction arguments. This allowed the first solution to be
shorter, at the (probable) expense of readability. I think of the two
solutions as more or less the same argument, with the first solution being how
a combinatorialist would write it up, while the second solution is how a
computer scientist would write it up.]
\end{proof}

\subsection{Homework set \#2 discussion}

The following are discussions of the problems on homework set \#2 (Section
\ref{sect.hw2}).

\subsubsection{Discussion of Exercise \ref{exe.seqsum.cycle-mod-4}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqsum.cycle-mod-4}.]Here is the probably
most direct solution:

\begin{proof}
[Solution to Exercise \ref{exe.seqsum.cycle-mod-4}.]Let $i\in\left\{
1,2,\ldots,n\right\}  $. Then, $a_{i}$ is an odd integer (since $a_{1}%
,a_{2},\ldots,a_{n}$ are $n$ odd integers). Thus, Exercise
\ref{exe.ent.even-odd.1} \textbf{(d)} (applied to $u=a_{i}$) yields that
$a_{i}\equiv1\operatorname{mod}2$. In other words, $2\mid a_{i}-1$. In other
words, there exists an integer $c_{i}$ such that $a_{i}-1=2c_{i}$. Consider
this $c_{i}$.

Forget that we fixed $i$. Thus, for each $i\in\left\{  1,2,\ldots,n\right\}
$, we have constructed an integer $c_{i}$ such that $a_{i}-1=2c_{i}$. Hence,
for each $i\in\left\{  1,2,\ldots,n\right\}  $, we have%
\begin{equation}
a_{i}=2c_{i}+1 \label{sol.seqsum.cycle-mod-4.1}%
\end{equation}
(since $a_{i}-1=2c_{i}$). Now,%
\begin{align*}
&  \underbrace{a_{1}a_{2}+a_{2}a_{3}+\cdots+a_{n-1}a_{n}}_{=\sum_{k=1}%
^{n-1}a_{k}a_{k+1}}+a_{n}a_{1}\\
&  =\sum_{k=1}^{n-1}\underbrace{a_{k}}_{\substack{=2c_{k}+1\\\text{(by
(\ref{sol.seqsum.cycle-mod-4.1}))}}}\ \ \underbrace{a_{k+1}}%
_{\substack{=2c_{k+1}+1\\\text{(by (\ref{sol.seqsum.cycle-mod-4.1}))}%
}}+\underbrace{a_{n}}_{\substack{=2c_{n}+1\\\text{(by
(\ref{sol.seqsum.cycle-mod-4.1}))}}}\ \ \underbrace{a_{1}}_{\substack{=2c_{1}%
+1\\\text{(by (\ref{sol.seqsum.cycle-mod-4.1}))}}}\\
&  =\sum_{k=1}^{n-1}\underbrace{\left(  2c_{k}+1\right)  \left(
2c_{k+1}+1\right)  }_{=4c_{k}c_{k+1}+2c_{k}+2c_{k+1}+1}+\underbrace{\left(
2c_{n}+1\right)  \left(  2c_{1}+1\right)  }_{=4c_{n}c_{1}+2c_{n}+2c_{1}+1}\\
&  =\sum_{k=1}^{n-1}\left(  4c_{k}c_{k+1}+2c_{k}+2c_{k+1}+1\right)
+4c_{n}c_{1}+2c_{n}+2c_{1}+1\\
&  =\sum_{k=1}^{n-1}4c_{k}c_{k+1}+\sum_{k=1}^{n-1}2c_{k}+\underbrace{\sum
_{k=1}^{n-1}2c_{k+1}}_{\substack{=\sum_{k=2}^{n}2c_{k}\\\text{(here, we have
substituted }k\\\text{for }k+1\text{ in the sum)}}}+\sum_{k=1}^{n-1}%
1+4c_{n}c_{1}+2c_{n}+2c_{1}+1\\
&  =\sum_{k=1}^{n-1}4c_{k}c_{k+1}+\sum_{k=1}^{n-1}2c_{k}+\sum_{k=2}^{n}%
2c_{k}+4c_{n}c_{1}+2c_{n}+2c_{1}+\underbrace{\sum_{k=1}^{n-1}1+1}_{=\sum
_{k=1}^{n}1=n\cdot1=n}\\
&  =\underbrace{\sum_{k=1}^{n-1}4c_{k}c_{k+1}}_{=4\sum_{k=1}^{n-1}c_{k}%
c_{k+1}}+4c_{n}c_{1}+\underbrace{\sum_{k=1}^{n-1}2c_{k}+2c_{n}}%
_{\substack{=\sum_{k=1}^{n}2c_{k}\\=2\sum_{k=1}^{n}c_{k}}}+\underbrace{\sum
_{k=2}^{n}2c_{k}+2c_{1}}_{\substack{=\sum_{k=1}^{n}2c_{k}\\=2\sum_{k=1}%
^{n}c_{k}}}+n\\
&  =4\sum_{k=1}^{n-1}c_{k}c_{k+1}+4c_{n}c_{1}+2\sum_{k=1}^{n}c_{k}+2\sum
_{k=1}^{n}c_{k}+n\\
&  =4\sum_{k=1}^{n-1}c_{k}c_{k+1}+4c_{n}c_{1}+4\sum_{k=1}^{n}c_{k}+n\\
&  =\underbrace{4\left(  \sum_{k=1}^{n-1}c_{k}c_{k+1}+c_{n}c_{1}+\sum
_{k=1}^{n}c_{k}\right)  }_{\equiv0\operatorname{mod}4}+n\equiv
0+n=n\operatorname{mod}4.
\end{align*}
This solves Exercise \ref{exe.seqsum.cycle-mod-4}.
\end{proof}

Several variants of the above solution exist. One way to simplify it would be
to discard multiples of $4$ the moment they appear (rather than, as we did, at
the end of the computation). This is allowed because of
(\ref{eq.exe.ent.mod.k-sum.a}). Another simplification can be obtained by
\textquotedblleft making the sum cyclic\textquotedblright: Namely, we WLOG
assume that $n\geq1$ (since the case $n=0$ is trivial). We set $a_{n+1}=a_{1}$
and $c_{n+1}=c_{1}$. Then,%
\begin{align}
\sum_{k=1}^{n}c_{k+1}  &  =\sum_{k=2}^{n+1}c_{k}\ \ \ \ \ \ \ \ \ \ \left(
\text{here, we have substituted }k\text{ for }k+1\text{ in the sum}\right)
\nonumber\\
&  =\sum_{k=2}^{n}c_{k}+\underbrace{c_{n+1}}_{=c_{1}}=\sum_{k=2}^{n}%
c_{k}+c_{1}=\sum_{k=1}^{n}c_{k}. \label{sol.seqsum.cycle-mod-4.csum}%
\end{align}
Furthermore, the equality (\ref{sol.seqsum.cycle-mod-4.1}) holds not only for
all $i\in\left\{  1,2,\ldots,n\right\}  $, but also for $i=n+1$ (since
$a_{n+1}=a_{1}$ and $c_{n+1}=c_{1}$). Therefore, we can apply
(\ref{sol.seqsum.cycle-mod-4.1}) to each $i\in\left\{  1,2,\ldots,n+1\right\}
$. Now,%
\begin{align*}
&  a_{1}a_{2}+a_{2}a_{3}+\cdots+a_{n-1}a_{n}+a_{n}\underbrace{a_{1}}%
_{=a_{n+1}}\\
&  =a_{1}a_{2}+a_{2}a_{3}+\cdots+a_{n-1}a_{n}+a_{n}a_{n+1}\\
&  =\sum_{k=1}^{n}\underbrace{a_{k}}_{\substack{=2c_{k}+1\\\text{(by
(\ref{sol.seqsum.cycle-mod-4.1}))}}}\ \ \underbrace{a_{k+1}}%
_{\substack{=2c_{k+1}+1\\\text{(by (\ref{sol.seqsum.cycle-mod-4.1}))}}%
}=\sum_{k=1}^{n}\underbrace{\left(  2c_{k}+1\right)  \left(  2c_{k+1}%
+1\right)  }_{=4c_{k}c_{k+1}+2c_{k}+2c_{k+1}+1}\\
&  =\sum_{k=1}^{n}\left(  4c_{k}c_{k+1}+2c_{k}+2c_{k+1}+1\right)
=\underbrace{\sum_{k=1}^{n}4c_{k}c_{k+1}}_{=4\sum_{k=1}^{n}c_{k}c_{k+1}%
}+\underbrace{\sum_{k=1}^{n}2c_{k}}_{=2\sum_{k=1}^{n}c_{k}}+\underbrace{\sum
_{k=1}^{n}2c_{k+1}}_{\substack{=2\sum_{k=1}^{n}c_{k+1}\\=2\sum_{k=1}^{n}%
c_{k}\\\text{(by (\ref{sol.seqsum.cycle-mod-4.csum}))}}}+\underbrace{\sum
_{k=1}^{n}1}_{=n\cdot1=n}\\
&  =4\sum_{k=1}^{n}c_{k}c_{k+1}+2\sum_{k=1}^{n}c_{k}+2\sum_{k=1}^{n}%
c_{k}+n=4\sum_{k=1}^{n}c_{k}c_{k+1}+4\sum_{k=1}^{n}c_{k}+n\\
&  =\underbrace{4\left(  \sum_{k=1}^{n}c_{k}c_{k+1}+\sum_{k=1}^{n}%
c_{k}\right)  }_{\equiv0\operatorname{mod}4}+n\equiv0+n=n\operatorname{mod}4.
\end{align*}
Note how much simpler the computation has become after we integrated the last
addend $a_{n}a_{1}$ into the sum.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.xa+yb.pos-no-1}}

\begin{proof}
[Solution to Exercise \ref{exe.ent.xa+yb.pos-no-1}.]\textbf{(a)} Let $x$ and
$y$ be positive integers satisfying $ab=xa+yb$. We shall derive a contradiction.

We have $a\mid a\left(  b-x\right)  =ab-ax=by$ (since $ab=xa+yb=ax+by$). But
$a\perp b$ (since $a$ and $b$ are coprime). Hence, Theorem
\ref{thm.ent.coprime.cancel} (applied to $c=y$) yields $a\mid y$. Hence,
$y\geq a$\ \ \ \ \footnote{\textit{Proof.} We have $a\mid y$ and $y\neq0$
(since $y$ is positive). Hence, Proposition \ref{prop.ent.div.1} (applied to
$y$ instead of $b$) yields that $\left\vert a\right\vert \leq\left\vert
y\right\vert $. But $\left\vert y\right\vert =y$ (since $y$ is positive) and
$\left\vert a\right\vert =a$ (since $a$ is positive). Hence, $a=\left\vert
a\right\vert \leq\left\vert y\right\vert =y$. In other words, $y\geq a$.}.
Multiplying this inequality by $b$, we obtain $yb\geq ab$ (since $b$ is positive).

Also, $xa$ is positive (since $x$ and $a$ are positive). Hence, $xa>0$.
Therefore, $\underbrace{xa}_{>0}+yb>yb\geq ab$. This contradicts $ab=xa+yb$.

Forget that we fixed $x$ and $y$. We thus have obtained a contradiction for
any two positive integers $x$ and $y$ satisfying $ab=xa+yb$. Hence, there do
\textbf{not} exist such integers. This solves Exercise
\ref{exe.ent.xa+yb.pos-no-1} \textbf{(a)}.

\textbf{(b)} Exercise \ref{exe.ent.xa+yb.pos-no-1} \textbf{(a)} shows that
there do \textbf{not} exist any positive integers $x$ and $y$ satisfying
$ab=xa+yb$. In other words:

\begin{statement}
\textit{Claim 1:} If $x$ and $y$ are two positive integers satisfying
$ab=xa+yb$, then a contradiction ensues.
\end{statement}

Now, let $x,y\in\mathbb{N}$ be such that $ab-a-b=xa+yb$. We shall derive a contradiction.

Indeed, $x+1$ and $y+1$ are two positive integers (since $x,y\in\mathbb{N}$)
and satisfy
\[
ab=\underbrace{ab-a-b}_{=xa+yb}+a+b=xa+yb+a+b=\left(  x+1\right)  a+\left(
y+1\right)  b.
\]
Thus, Claim 1 (applied to $x+1$ and $y+1$ instead of $x$ and $y$) yields a contradiction.

Forget that we fixed $x,y$. We thus have found a contradiction for any two
integers $x,y\in\mathbb{N}$ satisfying $ab-a-b=xa+yb$. Thus, there do
\textbf{not} exist such integers. This solves Exercise
\ref{exe.ent.xa+yb.pos-no-1} \textbf{(b)}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.amn-1-div}}

\begin{proof}
[Solution to Exercise \ref{exe.ent.amn-1-div}.]We have $\gcd\left(
n,m\right)  =1$ (since $n$ and $m$ are coprime). Thus, $u^{\gcd\left(
n,m\right)  }=u^{1}=u$.

Exercise \ref{exe.ent.gcd.an-1} \textbf{(b)} (applied to $a=n$ and $b=m$)
yields $\gcd\left(  u^{n}-1,u^{m}-1\right)  =\left\vert u^{\gcd\left(
n,m\right)  }-1\right\vert =\left\vert u-1\right\vert $ (since $u^{\gcd\left(
n,m\right)  }=u$). But each integer $v$ satisfies $\left\vert v\right\vert
=\pm v$. Applying this to $v=u-1$, we find $\left\vert u-1\right\vert
=\pm\left(  u-1\right)  $.

On the other hand, it is easy to see that $u^{n}-1\mid u^{nm}-1$. Indeed, the
simplest way to prove this is as follows: Clearly, $u^{n}\equiv
1\operatorname{mod}u^{n}-1$ (since $u^{n}-1\mid u^{n}-1$). Hence, Proposition
\ref{prop.ent.mod.k-power} (applied to $u^{n}$, $1$, $u^{n}-1$ and $m$ instead
of $a$, $b$, $n$ and $k$) yields $\left(  u^{n}\right)  ^{m}\equiv
1^{m}\operatorname{mod}u^{n}-1$. In view of $\left(  u^{n}\right)  ^{m}%
=u^{nm}$ and $1^{m}=1$, this rewrites as $u^{nm}\equiv1\operatorname{mod}%
u^{n}-1$. In other words, $u^{n}-1\mid u^{nm}-1$.

The same argument (with the roles of $n$ and $m$ interchanged) yields
$u^{m}-1\mid u^{mn}-1$. In other words, $u^{m}-1\mid u^{nm}-1$ (since $mn=nm$).

Hence, Theorem \ref{thm.ent.gcd.combine} (applied to $a=u^{n}-1$, $b=u^{m}-1$
and $c=u^{nm}-1$) yields%
\begin{align*}
\left(  u^{n}-1\right)  \left(  u^{m}-1\right)   &  \mid\underbrace{\gcd
\left(  u^{n}-1,u^{m}-1\right)  }_{=\left\vert u-1\right\vert =\pm\left(
u-1\right)  }\cdot\left(  u^{nm}-1\right) \\
&  =\pm\left(  u-1\right)  \cdot\left(  u^{nm}-1\right)  \mid\left(
u-1\right)  \cdot\left(  u^{nm}-1\right)  .
\end{align*}
This solves Exercise \ref{exe.ent.amn-1-div}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.gcd-integrality}}

Exercise \ref{exe.binom.gcd-integrality} \textbf{(b)} is a well-known result
(due to Hermite in 1889) and rather popular on mathematical contests; in
particular, it appeared as Problem B2 on the Putnam contest 2000, and as
Problem 4 on the 40th Virginia Tech Regional Mathematics Contest 2018.

\begin{proof}
[Solution to Exercise \ref{exe.binom.gcd-integrality}.]\textbf{(a)} We are in
one of the following two cases:

\textit{Case 1:} We have $m=0$.

\textit{Case 2:} We have $m>0$.

Let us first consider Case 1. In this case, we have $m=0$. Hence,
$m-1=-1\notin\mathbb{N}$, so that $\dbinom{n-1}{m-1}=0$ (by an application of
(\ref{eq.def.binom.def.b})). Comparing this with
\[
\dfrac{m}{n}\dbinom{n}{m}=\underbrace{m}_{=0}\cdot\dfrac{1}{n}\dbinom{n}%
{m}=0,
\]
we obtain $\dfrac{m}{n}\dbinom{n}{m}=\dbinom{n-1}{m-1}$. Thus, Exercise
\ref{exe.binom.gcd-integrality} \textbf{(a)} is solved in Case 1.

Let us now consider Case 2. In this case, we have $m>0$. Hence, $m\geq1$
(since $m\in\mathbb{N}$), so that $m-1\in\mathbb{N}$. Hence,
(\ref{eq.def.binom.def.a}) yields%
\begin{align}
\dbinom{n-1}{m-1}  &  =\dfrac{\left(  n-1\right)  \left(  \left(  n-1\right)
-1\right)  \left(  \left(  n-1\right)  -2\right)  \cdots\left(  \left(
n-1\right)  -\left(  m-1\right)  +1\right)  }{\left(  m-1\right)
!}\nonumber\\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-m+1\right)  }{\left(  m-1\right)  !}.
\label{sol.binom.gcd-integrality.a.1}%
\end{align}
On the other hand, (\ref{eq.def.binom.def.a}) yields
\[
\dbinom{n}{m}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-m+1\right)  }{m!}=\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-m+1\right)  }{m\cdot\left(  m-1\right)  !}%
\]
(since $m!=m\cdot\left(  m-1\right)  !$). Multiplying both sides of this
equality by $\dfrac{m}{n}$, we find%
\begin{align*}
\dfrac{m}{n}\dbinom{n}{m}  &  =\dfrac{m}{n}\cdot\dfrac{n\left(  n-1\right)
\left(  n-2\right)  \cdots\left(  n-m+1\right)  }{m\cdot\left(  m-1\right)
!}\\
&  =\dfrac{1}{\left(  m-1\right)  !}\cdot\underbrace{\dfrac{n\left(
n-1\right)  \left(  n-2\right)  \cdots\left(  n-m+1\right)  }{n}}_{=\left(
n-1\right)  \left(  n-2\right)  \left(  n-3\right)  \cdots\left(
n-m+1\right)  }\\
&  =\dfrac{1}{\left(  m-1\right)  !}\cdot\left(  n-1\right)  \left(
n-2\right)  \left(  n-3\right)  \cdots\left(  n-m+1\right) \\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-m+1\right)  }{\left(  m-1\right)  !}.
\end{align*}
Comparing this with (\ref{sol.binom.gcd-integrality.a.1}), we obtain
$\dfrac{m}{n}\dbinom{n}{m}=\dbinom{n-1}{m-1}$. Thus, Exercise
\ref{exe.binom.gcd-integrality} \textbf{(a)} is solved in Case 2.

We have now solved Exercise \ref{exe.binom.gcd-integrality} \textbf{(a)} in
both Cases 1 and 2. This completes the solution to Exercise
\ref{exe.binom.gcd-integrality} \textbf{(a)}.

\textbf{(b)} Exercise \ref{exe.binom.gcd-integrality} \textbf{(a)} yields
$\dfrac{m}{n}\dbinom{n}{m}=\dbinom{n-1}{m-1}$. Multiplying both sides of this
equality by $n$, we obtain $m\dbinom{n}{m}=n\dbinom{n-1}{m-1}$. But Theorem
\ref{thm.binom.ZZ} (applied to $n-1$ and $m-1$ instead of $n$ and $k$) yields
$\dbinom{n-1}{m-1}\in\mathbb{Z}$. In other words, $\dbinom{n-1}{m-1}$ is an
integer. Also, $\dbinom{n}{m}$ is an integer (for similar reasons). Now, from
$m\dbinom{n}{m}=n\dbinom{n-1}{m-1}$, we obtain $n\mid m\dbinom{n}{m}$ (since
$\dbinom{n-1}{m-1}$ is an integer). Hence, Theorem \ref{thm.ent.gcd.cancel}
(applied to $a=n$, $b=m$ and $c=\dbinom{n}{m}$) yields $n\mid\gcd\left(
n,m\right)  \cdot\dbinom{n}{m}$.

But $n\neq0$ (since $n>0$). Hence, Proposition \ref{prop.ent.div.1}
\textbf{(d)} (applied to $a=n$ and $b=\gcd\left(  n,m\right)  \cdot\dbinom
{n}{m}$) yields that $n\mid\gcd\left(  n,m\right)  \cdot\dbinom{n}{m}$ if and
only if $\dfrac{\gcd\left(  n,m\right)  \cdot\dbinom{n}{m}}{n}\in\mathbb{Z}$.
Therefore, $\dfrac{\gcd\left(  n,m\right)  \cdot\dbinom{n}{m}}{n}\in
\mathbb{Z}$ (since $n\mid\gcd\left(  n,m\right)  \cdot\dbinom{n}{m}$).
Therefore,%
\[
\dfrac{\gcd\left(  n,m\right)  }{n}\dbinom{n}{m}=\dfrac{\gcd\left(
n,m\right)  \cdot\dbinom{n}{m}}{n}\in\mathbb{Z}.
\]
This solves Exercise \ref{exe.binom.gcd-integrality} \textbf{(b)}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.noncoprime-ML770}}

Exercise \ref{exe.binom.noncoprime-ML770} is a result of Erd\"{o}s and
Szekeres \cite[(1)]{ErdSze78}; it later re-appeared in Crux Mathematicorum as
problem 1915 and in \url{https://artofproblemsolving.com/community/c6h770} .

\begin{proof}
[Solution to Exercise \ref{exe.binom.noncoprime-ML770}.]We note that $i$ and
$j$ play symmetric roles in Exercise \ref{exe.binom.noncoprime-ML770} (since
$\gcd\left(  \dbinom{n}{i},\dbinom{n}{j}\right)  =\gcd\left(  \dbinom{n}%
{j},\dbinom{n}{i}\right)  $). Hence, we can WLOG assume that $i\leq j$ (since
otherwise, we can swap $i$ with $j$). Furthermore, $j\leq n$ (since $j<n$) and
$i\geq0$ (since $i$ is positive). Now, we claim that%
\begin{equation}
\dbinom{n}{j}\dbinom{j}{i}=\dbinom{n}{i}\dbinom{n-i}{j-i}.
\label{sol.binom.noncoprime-ML770.tri-rev}%
\end{equation}


[\textit{Proof of (\ref{sol.binom.noncoprime-ML770.tri-rev}):} The equality
(\ref{sol.binom.noncoprime-ML770.tri-rev}) is a particular case of the
\textit{trinomial revision formula} (\cite[Proposition 3.23]{detnotes}), which
we will eventually see in this course. However, let us give a quick proof for
it here: We have $i\leq j$, thus $j-i\geq0$ and therefore $j-i\in\mathbb{N}$.
Also, $\underbrace{j}_{\leq n}-i\leq n-i\leq n$ (since $i\geq0$) and
$n-i\in\mathbb{N}$ (since $i\leq j\leq n$). Now, comparing%
\begin{align*}
\underbrace{\dbinom{n}{i}}_{\substack{=\dfrac{n!}{i!\cdot\left(  n-i\right)
!}\\\text{(by Theorem \ref{thm.binom.fac},}\\\text{applied to }k=i\text{)}%
}}\ \ \underbrace{\dbinom{n-i}{j-i}}_{\substack{=\dfrac{\left(  n-i\right)
!}{\left(  j-i\right)  !\cdot\left(  \left(  n-i\right)  -\left(  j-i\right)
\right)  !}\\\text{(by Theorem \ref{thm.binom.fac},}\\\text{applied to
}n-i\text{ and }j-i\\\text{instead of }n\text{ and }k\text{)}}}  &
=\dfrac{n!}{i!\cdot\left(  n-i\right)  !}\cdot\dfrac{\left(  n-i\right)
!}{\left(  j-i\right)  !\cdot\left(  \left(  n-i\right)  -\left(  j-i\right)
\right)  !}\\
&  =\dfrac{n!}{i!\cdot\left(  j-i\right)  !\cdot\left(  \left(  n-i\right)
-\left(  j-i\right)  \right)  !}\\
&  =\dfrac{n!}{i!\cdot\left(  j-i\right)  !\cdot\left(  n-j\right)  !}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  n-i\right)  -\left(
j-i\right)  =n-j\right)
\end{align*}
with%
\[
\underbrace{\dbinom{n}{j}}_{\substack{=\dfrac{n!}{j!\cdot\left(  n-j\right)
!}\\\text{(by Theorem \ref{thm.binom.fac},}\\\text{applied to }k=j\text{)}%
}}\ \ \underbrace{\dbinom{j}{i}}_{\substack{=\dfrac{j!}{i!\cdot\left(
j-i\right)  !}\\\text{(by Theorem \ref{thm.binom.fac},}\\\text{applied to
}j\text{ and }i\\\text{instead of }n\text{ and }k\text{)}}}=\dfrac{n!}%
{j!\cdot\left(  n-j\right)  !}\cdot\dfrac{j!}{i!\cdot\left(  j-i\right)
!}=\dfrac{n!}{i!\cdot\left(  j-i\right)  !\cdot\left(  n-j\right)  !},
\]
we obtain $\dbinom{n}{j}\dbinom{j}{i}=\dbinom{n}{i}\dbinom{n-i}{j-i}$. This
proves (\ref{sol.binom.noncoprime-ML770.tri-rev}).]

Next, we observe that all four binomial coefficients $\dbinom{n}{j}$,
$\dbinom{j}{i}$, $\dbinom{n}{i}$ and $\dbinom{n-i}{j-i}$ that appear in
(\ref{sol.binom.noncoprime-ML770.tri-rev}) belong to $\mathbb{Z}$ (because of
Theorem \ref{thm.binom.ZZ}). Hence, (\ref{sol.binom.noncoprime-ML770.tri-rev})
entails%
\begin{equation}
\dbinom{n}{i}\mid\dbinom{n}{j}\dbinom{j}{i}.
\label{sol.binom.noncoprime-ML770.div}%
\end{equation}


Furthermore, (\ref{eq.def.binom.def.a}) yields%
\begin{align}
\dbinom{n}{i}  &  =\dfrac{n\left(  n-1\right)  \left(  n-2\right)
\cdots\left(  n-i+1\right)  }{i!}=\dfrac{1}{i!}\cdot n\left(  n-1\right)
\left(  n-2\right)  \cdots\left(  n-i+1\right) \nonumber\\
&  =\dfrac{1}{i!}\cdot\prod_{k=0}^{i-1}\left(  n-k\right)  .
\label{sol.binom.noncoprime-ML770.1}%
\end{align}
The same argument (applied to $j$ instead of $n$) yields%
\begin{equation}
\dbinom{j}{i}=\dfrac{1}{i!}\cdot\prod_{k=0}^{i-1}\left(  j-k\right)  .
\label{sol.binom.noncoprime-ML770.2}%
\end{equation}


But we have $\underbrace{j}_{<n}-k<n-k$ for each $k\in\left\{  0,1,\ldots
,i-1\right\}  $. We can multiply these $i$ inequalities, since each of the
factors involved is positive (indeed, each $k\in\left\{  0,1,\ldots
,i-1\right\}  $ satisfies $j-\underbrace{k}_{<i}>j-i\geq0$ and $\underbrace{n}%
_{>j}-k>j-k>0$). Thus, we obtain%
\begin{equation}
\prod_{k=0}^{i-1}\left(  j-k\right)  <\prod_{k=0}^{i-1}\left(  n-k\right)  .
\label{sol.binom.noncoprime-ML770.ineq1}%
\end{equation}
(Note that this is a \textbf{strict} inequality, because $i>0$. In fact, if
$i$ was $0$, then both sides of (\ref{sol.binom.noncoprime-ML770.ineq1}) would
be empty products and thus would be equal. Trivial as it sounds, but this is a
nontrivial pitfall in working with strict inequalities.)

Now, (\ref{sol.binom.noncoprime-ML770.2}) yields
\begin{equation}
\dbinom{j}{i}=\dfrac{1}{i!}\cdot\underbrace{\prod_{k=0}^{i-1}\left(
j-k\right)  }_{\substack{<\prod_{k=0}^{i-1}\left(  n-k\right)  \\\text{(by
(\ref{sol.binom.noncoprime-ML770.ineq1}))}}}<\dfrac{1}{i!}\cdot\prod
_{k=0}^{i-1}\left(  n-k\right)  =\dbinom{n}{i}
\label{sol.binom.noncoprime-ML770.ineq2}%
\end{equation}
(by (\ref{sol.binom.noncoprime-ML770.2})). (Note that we have tacitly used the
fact that $\dfrac{1}{i!}>0$ here.)

Also, each of the factors $j-k$ on the right hand side of
(\ref{sol.binom.noncoprime-ML770.2}) is positive (because for each
$k\in\left\{  0,1,\ldots,i-1\right\}  $, we have $j-\underbrace{k}%
_{<i}>j-i\geq0$). Thus, the entire right hand side of
(\ref{sol.binom.noncoprime-ML770.2}) is positive. Therefore, $\dbinom{j}{i}%
>0$, so that $\dbinom{j}{i}\neq0$. From
(\ref{sol.binom.noncoprime-ML770.ineq2}), we obtain $\dbinom{n}{i}>\dbinom
{j}{i}>0$, so that $\dbinom{n}{i}\neq0$. Hence, $\gcd\left(  \dbinom{n}%
{i},\dbinom{n}{j}\right)  $ is a positive integer (by Proposition
\ref{prop.ent.gcd.pos} \textbf{(b)}).

Recall that we must prove that $\gcd\left(  \dbinom{n}{i},\dbinom{n}%
{j}\right)  >1$. Indeed, assume the contrary. Hence, $\gcd\left(  \dbinom
{n}{i},\dbinom{n}{j}\right)  \leq1$, so that $\gcd\left(  \dbinom{n}%
{i},\dbinom{n}{j}\right)  =1$ (since $\gcd\left(  \dbinom{n}{i},\dbinom{n}%
{j}\right)  $ is a positive integer). In other words, $\dbinom{n}{i}%
\perp\dbinom{n}{j}$. Combining this with (\ref{sol.binom.noncoprime-ML770.div}%
), we conclude that $\dbinom{n}{i}\mid\dbinom{j}{i}$ (by Theorem
\ref{thm.ent.coprime.cancel}, applied to $a=\dbinom{n}{i}$, $b=\dbinom{n}{j}$
and $c=\dbinom{j}{i}$). Hence, Proposition \ref{prop.ent.div.1} \textbf{(b)}
(applied to $a=\dbinom{n}{i}$ and $b=\dbinom{j}{i}$) yields $\left\vert
\dbinom{n}{i}\right\vert \leq\left\vert \dbinom{j}{i}\right\vert $ (since
$\dbinom{j}{i}\neq0$). Since $\dbinom{n}{i}>\dbinom{j}{i}>0$, we have
$\left\vert \dbinom{n}{i}\right\vert =\dbinom{n}{i}$ and $\left\vert
\dbinom{j}{i}\right\vert =\dbinom{j}{i}$. Thus,%
\[
\dbinom{n}{i}=\left\vert \dbinom{n}{i}\right\vert \leq\left\vert \dbinom{j}%
{i}\right\vert =\dbinom{j}{i},
\]
which contradicts $\dbinom{n}{i}>\dbinom{j}{i}$. This contradiction shows that
our assumption was false. Hence, Exercise \ref{exe.binom.noncoprime-ML770} is solved.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.coprime.sum-of-coprime}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.coprime.sum-of-coprime}.]We shall be very
terse; a detailed solution can be found in \cite{19s}. (Exercise
\ref{exe.ent.coprime.sum-of-coprime} \textbf{(a)} is \cite[Exercise
2.14.4]{19s}, while Exercise \ref{exe.ent.coprime.sum-of-coprime} \textbf{(b)}
is \cite[Exercise 2.14.5]{19s}.)

\textbf{(a)} Assume that $n>2$. Let $T$ be the set of all $i\in\left\{
1,2,\ldots,n\right\}  $ satisfying $i\perp n$. Then, $\left\vert T\right\vert
=\phi\left(  n\right)  $ (by the definition of $\phi\left(  n\right)  $). We
thus must prove that $\left\vert T\right\vert $ is even.

The main idea is to match each $i\in T$ with $n-i$, in a similar vein as we
matched every positive divisor of $n$ with its complement in the solution to
Exercise \ref{exe.ent.num-of-divs-even}. Here is how this works in a bit more
detail: We first notice that $n>1$ (since $n>2$); hence, $n$ does not satisfy
$n\perp n$. Thus, $n\notin T$, so we could just as well have defined $T$ as
the set of all $i\in\left\{  1,2,\ldots,n-1\right\}  $ satisfying $i\perp n$.
Furthermore, $n/2\notin T$ (because we have $n>2$, and thus, even if $n/2$ is
an integer, then $n/2$ is not coprime to $n$). Hence, each $i\in T$ satisfies
$i\neq n/2$. Therefore, we can split the set $T$ into two disjoint subsets $X$
and $Y$ defined by%
\[
X=\left\{  i\in T\ \mid\ i<n/2\right\}  \ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ Y=\left\{  i\in T\ \mid\ i>n/2\right\}  .
\]
These subsets $X$ and $Y$ are disjoint and their union is $X\cup Y=T$; thus,
$\left\vert T\right\vert =\left\vert X\right\vert +\left\vert Y\right\vert $.
Hence, if we can show that $\left\vert X\right\vert =\left\vert Y\right\vert
$, then it will follow that $\left\vert T\right\vert $ is even (as desired).

In order to show that $\left\vert X\right\vert =\left\vert Y\right\vert $, we
need to find a bijection from $X$ to $Y$. But such a bijection is easy to
construct: Namely, the two maps%
\[
X\rightarrow Y,\ \ \ \ \ \ \ \ \ \ i\mapsto n-i
\]
and%
\[
Y\rightarrow X,\ \ \ \ \ \ \ \ \ \ i\mapsto n-i
\]
are easily seen to be well-defined (because $\gcd\left(  i,n\right)
=\gcd\left(  n-i,n\right)  $ for each $i\in\mathbb{Z}$, and because $i<n/2$
holds if and only if $n-i>n/2$) and mutually inverse (since $n-\left(
n-i\right)  =i$ for each $i\in\mathbb{Z}$); thus, they are bijections. Hence,
we conclude that $\left\vert X\right\vert =\left\vert Y\right\vert $, so that
$\left\vert T\right\vert =\underbrace{\left\vert X\right\vert }_{=\left\vert
Y\right\vert }+\left\vert Y\right\vert =\left\vert Y\right\vert +\left\vert
Y\right\vert =2\cdot\left\vert Y\right\vert $, and therefore $\left\vert
T\right\vert $ is even. In other words, $\phi\left(  n\right)  $ is even; this
solves Exercise \ref{exe.ent.coprime.sum-of-coprime} \textbf{(a)}.

\textbf{(b)} This can be solved using Gauss's \textquotedblleft doubling
trick\textquotedblright, which we have already seen when solving Exercise
\ref{exe.seqsum.sums.gauss}. To wit, let us assume that $n>1$. Let $T$ be the
set of all $i\in\left\{  1,2,\ldots,n\right\}  $ satisfying $i\perp n$. Then,
we must prove that $\sum_{i\in T}i=\dfrac{1}{2}n\phi\left(  n\right)  $. But
notice that $n\notin T$ (as we already saw in the solution to Exercise
\ref{exe.ent.coprime.sum-of-coprime} \textbf{(a)} above); thus, the map%
\[
T\rightarrow T,\ \ \ \ \ \ \ \ \ \ i\mapsto n-i
\]
is easily seen to be well-defined (because $\gcd\left(  i,n\right)
=\gcd\left(  n-i,n\right)  $ for each $i\in\mathbb{Z}$) and therefore a
bijection (since it is its own inverse). Hence, we can substitute $n-i$ for
$i$ in the sum $\sum_{i\in T}i$. We thus obtain $\sum_{i\in T}i=\sum_{i\in
T}\left(  n-i\right)  $. Now, Gauss's \textquotedblleft doubling
trick\textquotedblright\ tells us that%
\begin{align*}
2\cdot\sum_{i\in T}i  &  =\sum_{i\in T}i+\underbrace{\sum_{i\in T}i}%
_{=\sum_{i\in T}\left(  n-i\right)  }=\sum_{i\in T}i+\sum_{i\in T}\left(
n-i\right) \\
&  =\sum_{i\in T}\underbrace{\left(  i+\left(  n-i\right)  \right)  }%
_{=n}=\sum_{i\in T}n=n\left\vert T\right\vert =n\phi\left(  n\right)
\end{align*}
(since the definition of $\phi\left(  n\right)  $ yields $\left\vert
T\right\vert =\phi\left(  n\right)  $). Therefore, $\sum_{i\in T}i=\dfrac
{1}{2}n\phi\left(  n\right)  $. This solves Exercise
\ref{exe.ent.coprime.sum-of-coprime} \textbf{(b)}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqsum.fib.infsum1}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqsum.fib.infsum1}.]Exercise
\ref{exe.seqsum.fib.infsum1} is \cite[Problem E25]{AndTet18}. Here is a sketch
of the solution:

Let us fix a positive integer $n$, and compute the finite sum $S\left(
n\right)  :=\sum_{k=2}^{n}\dfrac{f_{k}}{f_{k-1}f_{k+1}}$.

Indeed, each $k\geq1$ satisfies $f_{k+1}=f_{k}+f_{k-1}$ (by the definition of
the Fibonacci sequence) and thus $f_{k}=f_{k+1}-f_{k-1}$ and therefore%
\begin{equation}
\dfrac{f_{k}}{f_{k-1}f_{k+1}}=\dfrac{f_{k+1}-f_{k-1}}{f_{k-1}f_{k+1}}%
=\dfrac{1}{f_{k-1}}-\dfrac{1}{f_{k+1}}. \label{sol.seqsum.fib.infsum1.1}%
\end{equation}
Now,%
\begin{align}
S\left(  n\right)   &  =\sum_{k=2}^{n}\underbrace{\dfrac{f_{k}}{f_{k-1}%
f_{k+1}}}_{\substack{=\dfrac{1}{f_{k-1}}-\dfrac{1}{f_{k+1}}\\\text{(by
(\ref{sol.seqsum.fib.infsum1.1}))}}}=\sum_{k=2}^{n}\left(  \dfrac{1}{f_{k-1}%
}-\dfrac{1}{f_{k+1}}\right)  =\sum_{k=2}^{n}\dfrac{1}{f_{k-1}}-\sum_{k=2}%
^{n}\dfrac{1}{f_{k+1}}\nonumber\\
&  =\underbrace{\sum_{k=1}^{n-1}\dfrac{1}{f_{k}}}_{=\sum_{k=1}^{n+1}\dfrac
{1}{f_{k}}-\dfrac{1}{f_{n}}-\dfrac{1}{f_{n+1}}}-\underbrace{\sum_{k=3}%
^{n+1}\dfrac{1}{f_{k}}}_{=\sum_{k=1}^{n+1}\dfrac{1}{f_{k}}-\dfrac{1}{f_{1}%
}-\dfrac{1}{f_{2}}}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have substituted }k\text{ for }k-1\text{ in the first sum,}\\
\text{and substituted }k\text{ for }k+1\text{ in the second sum}%
\end{array}
\right) \nonumber\\
&  =\left(  \sum_{k=1}^{n+1}\dfrac{1}{f_{k}}-\dfrac{1}{f_{n}}-\dfrac
{1}{f_{n+1}}\right)  -\left(  \sum_{k=1}^{n+1}\dfrac{1}{f_{k}}-\dfrac{1}%
{f_{1}}-\dfrac{1}{f_{2}}\right) \nonumber\\
&  =\dfrac{1}{f_{1}}+\dfrac{1}{f_{2}}-\dfrac{1}{f_{n}}-\dfrac{1}{f_{n+1}}.
\label{sol.seqsum.fib.infsum1.3}%
\end{align}


The sum we are looking for is $\sum_{k=2}^{\infty}\dfrac{f_{k}}{f_{k-1}%
f_{k+1}}=\lim\limits_{n\rightarrow\infty}S\left(  n\right)  $. But
(\ref{sol.seqsum.fib.infsum1.3}) makes this limit easy to compute: As $n$ goes
to $\infty$, the Fibonacci numbers $f_{n}$ go to $\infty$ as
well\footnote{There are various ways to see this. For example, it is easy to
check that the sequence $\left(  f_{2},f_{3},f_{4},\ldots\right)  $ is a
strictly increasing sequence of positive integers, and thus goes to $\infty$.
Alternatively, one can use Theorem \ref{thm.fib.binet} to see not only that
$f_{n}$ goes to $\infty$ (since $\varphi^{n}\rightarrow\infty$ whereas
$\psi^{n}\rightarrow0$), but also to see how exactly $f_{n}$ grows (viz.,
exponentially).}, and thus $\dfrac{1}{f_{n}}$ goes to $0$, whence $\dfrac
{1}{f_{n+1}}$ also goes to $0$. Now,
\begin{align*}
\sum_{k=2}^{\infty}\dfrac{f_{k}}{f_{k-1}f_{k+1}}  &  =\lim
\limits_{n\rightarrow\infty}S\left(  n\right)  =\lim\limits_{n\rightarrow
\infty}\left(  \dfrac{1}{f_{1}}+\dfrac{1}{f_{2}}-\dfrac{1}{f_{n}}-\dfrac
{1}{f_{n+1}}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.seqsum.fib.infsum1.3})}\right) \\
&  =\dfrac{1}{f_{1}}+\dfrac{1}{f_{2}}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\dfrac{1}{f_{n}}\text{ and }\dfrac{1}{f_{n+1}}\text{ go to }0\text{ as
}n\text{ goes to }\infty\right) \\
&  =\dfrac{1}{1}+\dfrac{1}{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
f_{1}=1\text{ and }f_{2}=1\right) \\
&  =2.
\end{align*}
This solves the exercise.

A few remarks about the computation (\ref{sol.seqsum.fib.infsum1.3}) are in
order. First, why did we rewrite $\sum_{k=1}^{n-1}\dfrac{1}{f_{k}}$ as
$\sum_{k=1}^{n+1}\dfrac{1}{f_{k}}-\dfrac{1}{f_{n}}-\dfrac{1}{f_{n+1}}$ instead
of $\sum_{k=3}^{n-1}\dfrac{1}{f_{k}}+\dfrac{1}{f_{1}}+\dfrac{1}{f_{2}}$?
Because the former works for every positive integer $n$, whereas the latter
would only work for $n\geq3$. Second, there is a reason why we introduced the
finite sum $S\left(  n\right)  $ instead of working with the infinite sum
$\sum_{k=2}^{\infty}\dfrac{f_{k}}{f_{k-1}f_{k+1}}$; indeed, while it is
possible to perform a computation analogous to (\ref{sol.seqsum.fib.infsum1.3}%
) on the level of infinite sums, this would require some nontrivial
justification (e.g., in order to rewrite $\sum_{k=2}^{\infty}\left(  \dfrac
{1}{f_{k-1}}-\dfrac{1}{f_{k+1}}\right)  $ as $\sum_{k=2}^{\infty}\dfrac
{1}{f_{k-1}}-\sum_{k=2}^{\infty}\dfrac{1}{f_{k+1}}$, we would need to prove
that both sums $\sum_{k=2}^{\infty}\dfrac{1}{f_{k-1}}$ and $\sum_{k=2}%
^{\infty}\dfrac{1}{f_{k+1}}$ converge). In general, infinite sums are not
worth the headache when they can be avoided this easily.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.hock-neg-hock}}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.hock-neg-hock}.]Exercise
\ref{exe.binom.hock-neg-hock} \textbf{(a)} is (part of) \cite[Exercise 3.3
\textbf{(b)}]{detnotes} (and known as the \textquotedblleft hockey-stick
identity\textquotedblright\ or the \textquotedblleft upper summation formula
for binomial coefficients\textquotedblright), whereas Exercise
\ref{exe.binom.hock-neg-hock} \textbf{(b)} is \cite[Exercise 4]{18f-hw2s}
(more precisely, it is a generalization of the latter exercise to arbitrary
complex $n$, but the first two solutions of the latter exercise given in
\cite{18f-hw2s} are still valid in this generality).

However, you can probably solve both parts by the telescope
principle\footnote{To wit, part \textbf{(a)} uses $\dbinom{i}{k}=\dbinom
{i+1}{k+1}-\dbinom{i}{k+1}$, while part \textbf{(b)} uses $\left(  -1\right)
^{k}\dbinom{n}{k}=\left(  -1\right)  ^{k}\dbinom{n-1}{k}-\left(  -1\right)
^{k-1}\dbinom{n-1}{k-1}$. (Both of these equalities follow from Theorem
\ref{thm.binom.rec}.)} or by induction\footnote{Induction on $n$ for part
\textbf{(a)}, and induction on $m$ for part \textbf{(b)}.} before you have
opened these references.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.fib.sum-5}}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.sum-5}.]Here is the idea: Rewrite
(\ref{eq.thm.fib.binet.eq}) as
\[
f_{n}=\dfrac{1}{\sqrt{5}}\left(  \dfrac{1+\sqrt{5}}{2}\right)  ^{n}-\dfrac
{1}{\sqrt{5}}\left(  \dfrac{1-\sqrt{5}}{2}\right)  ^{n}.
\]
Now apply the binomial formula on the right hand side, and cancel the addends
with odd powers of $\sqrt{5}$.

Here is the argument in detail:

\begin{proof}
[Solution to Exercise \ref{exe.fib.sum-5}.]Let $n\in\mathbb{N}$. Let
$\varphi=\dfrac{1+\sqrt{5}}{2}$ and $\psi=\dfrac{1-\sqrt{5}}{2}$ be the two
solutions of the quadratic equation $X^{2}-X-1=0$. Then, Theorem
\ref{thm.fib.binet} yields%
\begin{align}
f_{n}  &  =\dfrac{1}{\sqrt{5}}\varphi^{n}-\dfrac{1}{\sqrt{5}}\psi^{n}%
=\dfrac{1}{\sqrt{5}}\underbrace{\left(  \dfrac{1+\sqrt{5}}{2}\right)  ^{n}%
}_{=\dfrac{\left(  1+\sqrt{5}\right)  ^{n}}{2^{n}}}-\dfrac{1}{\sqrt{5}%
}\underbrace{\left(  \dfrac{1-\sqrt{5}}{2}\right)  ^{n}}_{=\dfrac{\left(
1-\sqrt{5}\right)  ^{n}}{2^{n}}}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\varphi=\dfrac{1+\sqrt{5}}%
{2}\text{ and }\psi=\dfrac{1-\sqrt{5}}{2}\right) \nonumber\\
&  =\underbrace{\dfrac{1}{\sqrt{5}}\cdot\dfrac{\left(  1+\sqrt{5}\right)
^{n}}{2^{n}}}_{=\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\left(  1+\sqrt{5}\right)
^{n}}-\underbrace{\dfrac{1}{\sqrt{5}}\cdot\dfrac{\left(  1-\sqrt{5}\right)
^{n}}{2^{n}}}_{=\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\left(  1-\sqrt{5}\right)
^{n}}\nonumber\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\left(  \underbrace{1+\sqrt{5}}%
_{=\sqrt{5}+1}\right)  ^{n}-\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\left(
\underbrace{1-\sqrt{5}}_{=-\sqrt{5}+1}\right)  ^{n}\nonumber\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\underbrace{\left(  \sqrt{5}+1\right)
^{n}}_{\substack{=\sum_{k=0}^{n}\dbinom{n}{k}\left(  \sqrt{5}\right)
^{k}1^{n-k}\\\text{(by Theorem \ref{thm.binom.binom},}\\\text{applied to
}x=\sqrt{5}\text{ and }y=1\text{)}}}-\dfrac{1}{\sqrt{5}\cdot2^{n}}%
\cdot\underbrace{\left(  -\sqrt{5}+1\right)  ^{n}}_{\substack{=\sum_{k=0}%
^{n}\dbinom{n}{k}\left(  -\sqrt{5}\right)  ^{k}1^{n-k}\\\text{(by Theorem
\ref{thm.binom.binom},}\\\text{applied to }x=-\sqrt{5}\text{ and }y=1\text{)}%
}}\nonumber\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n}{k}\left(
\sqrt{5}\right)  ^{k}\underbrace{1^{n-k}}_{=1}-\dfrac{1}{\sqrt{5}\cdot2^{n}%
}\cdot\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{\left(  -\sqrt{5}\right)  ^{k}%
}_{=\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)  ^{k}}\underbrace{1^{n-k}%
}_{=1}\nonumber\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\sum_{k=0}^{n}\dbinom{n}{k}\left(
\sqrt{5}\right)  ^{k}-\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\sum_{k=0}^{n}%
\dbinom{n}{k}\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)  ^{k}\nonumber\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\left(  \sum_{k=0}^{n}\dbinom{n}%
{k}\left(  \sqrt{5}\right)  ^{k}-\sum_{k=0}^{n}\dbinom{n}{k}\left(  -1\right)
^{k}\left(  \sqrt{5}\right)  ^{k}\right)  . \label{sol.fib.sum-5.2}%
\end{align}
But%
\begin{align*}
&  \sum_{k=0}^{n}\dbinom{n}{k}\left(  \sqrt{5}\right)  ^{k}-\sum_{k=0}%
^{n}\dbinom{n}{k}\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)  ^{k}\\
&  =\sum_{k=0}^{n}\underbrace{\left(  \dbinom{n}{k}\left(  \sqrt{5}\right)
^{k}-\dbinom{n}{k}\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)  ^{k}\right)
}_{=\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)  \left(  \sqrt
{5}\right)  ^{k}}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k}.
\end{align*}
Comparing this with%
\begin{align*}
&  \sum_{k=0}^{2n+1}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k}+\sum_{k=n+1}^{2n+1}\underbrace{\dbinom{n}{k}%
}_{\substack{=0\\\text{(by Proposition \ref{prop.binom.0}}\\\text{(since
}k\geq n+1>n\text{))}}}\left(  1-\left(  -1\right)  ^{k}\right)  \left(
\sqrt{5}\right)  ^{k}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split the sum at }n\text{,
using (\ref{eq.sum.split.uvw})}\right) \\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k}+\underbrace{\sum_{k=n+1}^{2n+1}0\left(
1-\left(  -1\right)  ^{k}\right)  \left(  \sqrt{5}\right)  ^{k}}_{=0}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k},
\end{align*}
we obtain%
\begin{align}
&  \sum_{k=0}^{n}\dbinom{n}{k}\left(  \sqrt{5}\right)  ^{k}-\sum_{k=0}%
^{n}\dbinom{n}{k}\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)
^{k}\nonumber\\
&  =\underbrace{\sum_{k=0}^{2n+1}}_{=\sum_{k\in\left\{  0,1,\ldots
,2n+1\right\}  }}\dbinom{n}{k}\left(  1-\left(  -1\right)  ^{k}\right)
\left(  \sqrt{5}\right)  ^{k}\nonumber\\
&  =\sum_{k\in\left\{  0,1,\ldots,2n+1\right\}  }\dbinom{n}{k}\left(
1-\left(  -1\right)  ^{k}\right)  \left(  \sqrt{5}\right)  ^{k}\nonumber\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\left(  1-\underbrace{\left(  -1\right)  ^{k}}%
_{\substack{=1\\\text{(since }k\text{ is even)}}}\right)  \left(  \sqrt
{5}\right)  ^{k}+\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}
;\\k\text{ is odd}}}\dbinom{n}{k}\left(  1-\underbrace{\left(  -1\right)
^{k}}_{\substack{=-1\\\text{(since }k\text{ is odd)}}}\right)  \left(
\sqrt{5}\right)  ^{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we used Theorem
\ref{thm.seqsum.sums.split-A-notA}}\right) \nonumber\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\underbrace{\left(  1-1\right)  }_{=0}\left(  \sqrt{5}\right)
^{k}+\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\underbrace{\left(  1-\left(  -1\right)  \right)  }_{=2}\left(
\sqrt{5}\right)  ^{k}\nonumber\\
&  =\underbrace{\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}
;\\k\text{ is even}}}\dbinom{n}{k}\cdot0\left(  \sqrt{5}\right)  ^{k}}%
_{=0}+\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is
odd}}}\dbinom{n}{k}\cdot2\left(  \sqrt{5}\right)  ^{k}\nonumber\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\cdot2\left(  \sqrt{5}\right)  ^{k}=2\sum_{\substack{k\in
\left\{  0,1,\ldots,2n+1\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}\left(
\sqrt{5}\right)  ^{k}\nonumber\\
&  =2\sum_{i\in\left\{  0,1,\ldots,n\right\}  }\dbinom{n}{2i+1}\left(
\sqrt{5}\right)  ^{2i+1} \label{sol.fib.sum-5.5}%
\end{align}
(here, we have substituted $2i+1$ for $k$ in the sum, since the map%
\begin{align*}
\left\{  0,1,\ldots,n\right\}   &  \rightarrow\left\{  k\in\left\{
0,1,\ldots,2n+1\right\}  \ \mid\ k\text{ is odd}\right\}  ,\\
i  &  \mapsto2i+1
\end{align*}
is a bijection\footnote{This is just saying that the odd integers in $\left\{
0,1,\ldots,2n+1\right\}  $ are $1,3,5,\ldots,2n+1$ (and these numbers are all
distinct).}).

Hence, (\ref{sol.fib.sum-5.2}) becomes%
\begin{align*}
f_{n}  &  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot\underbrace{\left(  \sum
_{k=0}^{n}\dbinom{n}{k}\left(  \sqrt{5}\right)  ^{k}-\sum_{k=0}^{n}\dbinom
{n}{k}\left(  -1\right)  ^{k}\left(  \sqrt{5}\right)  ^{k}\right)
}_{\substack{=2\sum_{i\in\left\{  0,1,\ldots,n\right\}  }\dbinom{n}%
{2i+1}\left(  \sqrt{5}\right)  ^{2i+1}\\\text{(by (\ref{sol.fib.sum-5.5}))}%
}}\\
&  =\dfrac{1}{\sqrt{5}\cdot2^{n}}\cdot2\sum_{i\in\left\{  0,1,\ldots
,n\right\}  }\dbinom{n}{2i+1}\left(  \sqrt{5}\right)  ^{2i+1}\\
&  =\underbrace{\dfrac{2}{2^{n}}}_{=\dfrac{1}{2^{n-1}}}\underbrace{\sum
_{i\in\left\{  0,1,\ldots,n\right\}  }}_{=\sum_{i=0}^{n}}\dbinom{n}%
{2i+1}\underbrace{\dfrac{\left(  \sqrt{5}\right)  ^{2i+1}}{\sqrt{5}}%
}_{=\left(  \sqrt{5}\right)  ^{2i}=\left(  \left(  \sqrt{5}\right)
^{2}\right)  ^{i}=5^{i}}\\
&  =\dfrac{1}{2^{n-1}}\sum_{i=0}^{n}\dbinom{n}{2i+1}5^{i}=\dfrac{1}{2^{n-1}%
}\sum_{k=0}^{n}\dbinom{n}{2k+1}5^{k}%
\end{align*}
(here, we have renamed the summation index $i$ as $k$). Multiplying both sides
of this equality by $2^{n-1}$, we obtain%
\[
2^{n-1}\cdot f_{n}=\sum_{k=0}^{n}\dbinom{n}{2k+1}5^{k}.
\]
This solves Exercise \ref{exe.fib.sum-5}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.fib.fibonom-coeff}}

\begin{proof}
[Discussion of Exercise \ref{exe.fib.fibonom-coeff}.]The quickest way to prove
part \textbf{(a)} is by defining the \textquotedblleft Fibonacci
factorial\textquotedblright\ $m!_{F}$ of any $m\in\mathbb{N}$ to be the
product $f_{1}f_{2}\cdots f_{m}$, and then showing that if $k\leq n$, then
$\dbinom{n}{k}_{F}=\dfrac{n!_{F}}{k!_{F}\left(  n-k\right)  !_{F}}$ (an
analogue of Theorem \ref{thm.binom.fac}). Parts \textbf{(b)} and \textbf{(c)}
are \cite[Exercise 4]{18f-hw3s}.

The numbers $\dbinom{n}{k}_{F}$ are known as
\textit{\href{https://en.wikipedia.org/wiki/Fibonomial_coefficient}{\textit{Fibonomial
coefficients}}} (entering these words in Google Scholar will produce a
noticeable amount of literature), and are one of several analogues of binomial
coefficients known.

A combinatorial solution to Exercise \ref{exe.fib.fibonom-coeff} \textbf{(c)}
can be found in \cite{BenPlo08}.

For the sake of completeness, let us give a detailed solution to Exercise
\ref{exe.fib.fibonom-coeff} \textbf{(a)} (while detailed solutions to parts
\textbf{(b)} and \textbf{(c)} can be found in \cite[Exercise 4]{18f-hw3s}):

\begin{proof}
[Solution to Exercise \ref{exe.fib.fibonom-coeff} \textbf{(a)}.]For each
$m\in\mathbb{N}$, define the positive integer $m!_{F}$ by%
\begin{equation}
m!_{F}=f_{1}f_{2}\cdots f_{m}. \label{sol.fib.fibonom-coeff.a.fac}%
\end{equation}
(This is indeed a positive integer, because it is easy to see that the
Fibonacci numbers $f_{1},f_{2},\ldots,f_{m}$ all are positive\footnote{because
the Fibonacci sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ is weakly
increasing (this is easily seen from its recursive definition) and its entry
$f_{1}=1$ is already positive}.)

We first show the following auxiliary fact:

\begin{statement}
\textit{Claim 1:} Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$ satisfy $k\leq n$.
Then,
\[
\dbinom{n}{k}_{F}=\dfrac{n!_{F}}{k!_{F}\left(  n-k\right)  !_{F}}.
\]

\end{statement}

[\textit{Proof of Claim 1:} We have $k\leq n$, thus $n\geq k\geq0$ (since
$k\in\mathbb{N}$). The definition of $\dbinom{n}{k}_{F}$ yields%
\begin{align*}
\dbinom{n}{k}_{F}  &  =%
\begin{cases}
\dfrac{f_{n}f_{n-1}\cdots f_{n-k+1}}{f_{k}f_{k-1}\cdots f_{1}}, & \text{ if
}n\geq k\geq0;\\
0, & \text{ otherwise}%
\end{cases}
\\
&  =\dfrac{f_{n}f_{n-1}\cdots f_{n-k+1}}{f_{k}f_{k-1}\cdots f_{1}%
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\geq k\geq0\right)  .
\end{align*}
In view of%
\begin{align*}
f_{n}f_{n-1}\cdots f_{n-k+1}  &  =\underbrace{\left(  f_{n}f_{n-1}\cdots
f_{1}\right)  }_{\substack{=f_{1}f_{2}\cdots f_{n}\\=n!_{F}\\\text{(since
}n!_{F}\text{ was defined to be }f_{1}f_{2}\cdots f_{n}\text{)}}%
}/\underbrace{\left(  f_{n-k}f_{n-k-1}\cdots f_{1}\right)  }_{\substack{=f_{1}%
f_{2}\cdots f_{n-k}\\=\left(  n-k\right)  !_{F}\\\text{(since }\left(
n-k\right)  !_{F}\text{ was defined to be }f_{1}f_{2}\cdots f_{n-k}\text{)}%
}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  f_{n}f_{n-1}\cdots
f_{n-k+1}\right)  \cdot\left(  f_{n-k}f_{n-k-1}\cdots f_{1}\right)
=f_{n}f_{n-1}\cdots f_{1}\right) \\
&  =n!_{F}/\left(  n-k\right)  !_{F}%
\end{align*}
and%
\[
f_{k}f_{k-1}\cdots f_{1}=f_{1}f_{2}\cdots f_{k}=k!_{F}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }k!_{F}\text{ was defined to be }%
f_{1}f_{2}\cdots f_{k}\right)  ,
\]
this rewrites as
\[
\dbinom{n}{k}_{F}=\dfrac{n!_{F}/\left(  n-k\right)  !_{F}}{k!_{F}}%
=\dfrac{n!_{F}}{k!_{F}\left(  n-k\right)  !_{F}}.
\]
This proves Claim 1.]

Now, let $n\in\mathbb{N}$ and $k\in\mathbb{N}$. We must prove that%
\begin{equation}
\dbinom{n}{k}_{F}=\dbinom{n}{n-k}_{F}. \label{sol.fib.fibonom-coeff.a.goal}%
\end{equation}


We are in one of the following two cases:

\textit{Case 1:} We have $k\leq n$.

\textit{Case 2:} We have $k>n$.

Let us first consider Case 1. In this case, we have $k\leq n$. Hence,
$n-k\in\mathbb{N}$. Also, $n-k\leq n$ (since $k\geq0$). Now, Claim 1 yields
\[
\dbinom{n}{k}_{F}=\dfrac{n!_{F}}{k!_{F}\left(  n-k\right)  !_{F}%
}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }k\leq n\right)  .
\]
On the other hand, Claim 1 (applied to $n-k$ instead of $k$) yields%
\begin{align*}
\dbinom{n}{n-k}_{F}  &  =\dfrac{n!_{F}}{\left(  n-k\right)  !_{F}\left(
n-\left(  n-k\right)  \right)  !_{F}}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}n-k\in\mathbb{N}\text{ and }n-k\leq n\right) \\
&  =\dfrac{n!_{F}}{\left(  n-k\right)  !_{F}k!_{F}}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }n-\left(  n-k\right)  =k\right) \\
&  =\dfrac{n!_{F}}{k!_{F}\left(  n-k\right)  !_{F}}.
\end{align*}
Comparing these two equalities, we obtain $\dbinom{n}{k}_{F}=\dbinom{n}%
{n-k}_{F}$. This proves (\ref{sol.fib.fibonom-coeff.a.goal}) in Case 1.

Let us now consider Case 2. In this case, we have $k>n$. Hence, we don't have
$n\geq k\geq0$ (since $n\geq k$ would contradict $k>n$). Also, $n-k<0$ (since
$k>n$). Hence, we don't have $n\geq n-k\geq0$ (since $n-k\geq0$ would
contradict $n-k<0$). The definition of $\dbinom{n}{k}_{F}$ yields%
\begin{align*}
\dbinom{n}{k}_{F}  &  =%
\begin{cases}
\dfrac{f_{n}f_{n-1}\cdots f_{n-k+1}}{f_{k}f_{k-1}\cdots f_{1}}, & \text{ if
}n\geq k\geq0;\\
0, & \text{ otherwise}%
\end{cases}
\\
&  =0\ \ \ \ \ \ \ \ \ \ \left(  \text{since we don't have }n\geq
k\geq0\right)  .
\end{align*}
On the other hand, the definition of $\dbinom{n}{n-k}_{F}$ yields%
\begin{align*}
\dbinom{n}{n-k}_{F}  &  =%
\begin{cases}
\dfrac{f_{n}f_{n-1}\cdots f_{n-\left(  n-k\right)  +1}}{f_{n-k}f_{\left(
n-k\right)  -1}\cdots f_{1}}, & \text{ if }n\geq n-k\geq0;\\
0, & \text{ otherwise}%
\end{cases}
\\
&  =0\ \ \ \ \ \ \ \ \ \ \left(  \text{since we don't have }n\geq
n-k\geq0\right)  .
\end{align*}
Comparing these two equalities, we find $\dbinom{n}{k}_{F}=\dbinom{n}{n-k}%
_{F}$. This proves (\ref{sol.fib.fibonom-coeff.a.goal}) in Case 2.

We have now proved (\ref{sol.fib.fibonom-coeff.a.goal}) in each of the two
Cases 1 and 2. Thus, (\ref{sol.fib.fibonom-coeff.a.goal}) always holds. This
solves Exercise \ref{exe.fib.fibonom-coeff} \textbf{(a)}.
\end{proof}
\end{proof}

\subsection{Homework set \#3 discussion}

The following are discussions of the problems on homework set \#3 (Section
\ref{sect.hw3}).

\subsubsection{Discussion of Exercise \ref{exe.seqs.1pxn-1x-2}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.1pxn-1x-2}.]We shall first prove part
\textbf{(a)} of Exercise \ref{exe.seqs.1pxn-1x-2}. Then, we will show a
general result (Theorem \ref{thm.sol.seqs.gcd-from-mod-cong}) that will allow
us to derive parts \textbf{(b)} and \textbf{(c)} from part \textbf{(a)}.

Recall that%
\begin{equation}
a_{n}=1+a_{n-1}a_{n-2}\ \ \ \ \ \ \ \ \ \ \text{for each integer }n\geq2.
\label{sol.seqs.1pxn-1x-2.a.rec}%
\end{equation}


\textbf{(a)} Fix $n\in\mathbb{N}$. We claim that%
\begin{equation}
a_{k+n}\equiv a_{k}\operatorname{mod}a_{n}\ \ \ \ \ \ \ \ \ \ \text{for each
}k\in\mathbb{N}. \label{sol.seqs.1pxn-1x-2.a.goal}%
\end{equation}


[\textit{Proof of (\ref{sol.seqs.1pxn-1x-2.a.goal}):} We proceed by strong
induction on $k$:

\textit{Induction step:} Let $p\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.seqs.1pxn-1x-2.a.goal}) holds for $k<p$. We must
now prove that (\ref{sol.seqs.1pxn-1x-2.a.goal}) holds for $k=p$. In other
words, we must prove that $a_{p+n}\equiv a_{p}\operatorname{mod}a_{n}$.

If $n=0$, then this is obvious (because if $n=0$, then $p+\underbrace{n}%
_{=0}=p$ and thus $a_{p+n}=a_{p}\equiv a_{p}\operatorname{mod}a_{n}$). Hence,
for the rest of this proof, we WLOG assume that $n\neq0$. Hence, $n\geq1$
(since $n\in\mathbb{N}$).

We have $p\in\mathbb{N}$. Hence, we are in one of the following three cases:

\textit{Case 1:} We have $p=0$.

\textit{Case 2:} We have $p=1$.

\textit{Case 3:} We have $p\geq2$.

Let us first consider Case 1. In this case, we have $p=0$. Thus, $a_{p}%
=a_{0}=0$. On the other hand, $\underbrace{p}_{=0}+n=0+n=n$, so that
$a_{p+n}=a_{n}\equiv0\operatorname{mod}a_{n}$. This rewrites as $a_{p+n}\equiv
a_{p}\operatorname{mod}a_{n}$ (since $a_{p}=0$). Thus, $a_{p+n}\equiv
a_{p}\operatorname{mod}a_{n}$ is proved in Case 1.

Let us next consider Case 2. In this case, we have $p=1$. Thus, $a_{p}%
=a_{1}=1$. On the other hand, $\underbrace{p}_{=1}+n=1+n=n+1$, so that
$a_{p+n}=a_{n+1}$. Note that $n+1\geq2$ (since $n\geq1$). Hence,
(\ref{sol.seqs.1pxn-1x-2.a.rec}) (applied to $n+1$ instead of $n$) yields%
\[
a_{n+1}=1+a_{\left(  n+1\right)  -1}a_{\left(  n+1\right)  -2}%
=1+\underbrace{a_{n}}_{\equiv0\operatorname{mod}a_{n}}a_{n-1}\equiv
1+0a_{n-1}=1\operatorname{mod}a_{n}.
\]
In view of $a_{p+n}=a_{n+1}$ and $a_{p}=1$, this rewrites as $a_{p+n}\equiv
a_{p}\operatorname{mod}a_{n}$. Thus, $a_{p+n}\equiv a_{p}\operatorname{mod}%
a_{n}$ is proved in Case 2.

At last, let us consider Case 3. In this case, we have $p\geq2$. Hence,
$p-1\in\mathbb{N}$ and $p-2\in\mathbb{N}$.

We have assumed that (\ref{sol.seqs.1pxn-1x-2.a.goal}) holds for $k<p$. Hence,
we can apply (\ref{sol.seqs.1pxn-1x-2.a.goal}) to $k=p-1$ (since
$p-1\in\mathbb{N}$ and $p-1<p$). Thus, we obtain%
\begin{equation}
a_{\left(  p-1\right)  +n}\equiv a_{p-1}\operatorname{mod}a_{n}.
\label{sol.seqs.1pxn-1x-2.a.min1}%
\end{equation}


We have assumed that (\ref{sol.seqs.1pxn-1x-2.a.goal}) holds for $k<p$. Hence,
we can apply (\ref{sol.seqs.1pxn-1x-2.a.goal}) to $k=p-2$ (since
$p-2\in\mathbb{N}$ and $p-2<p$). Thus, we obtain%
\begin{equation}
a_{\left(  p-2\right)  +n}\equiv a_{p-2}\operatorname{mod}a_{n}.
\label{sol.seqs.1pxn-1x-2.a.min2}%
\end{equation}


However, $p\geq2$. Hence, (\ref{sol.seqs.1pxn-1x-2.a.rec}) (applied to $p$
instead of $n$) yields%
\begin{equation}
a_{p}=1+a_{p-1}a_{p-2}. \label{sol.seqs.1pxn-1x-2.a.p}%
\end{equation}
Also, $n\geq0$, so that $p+n\geq p\geq2$. Hence,
(\ref{sol.seqs.1pxn-1x-2.a.rec}) (applied to $p+n$ instead of $n$) yields%
\begin{align*}
a_{p+n}  &  =1+a_{\left(  p+n\right)  -1}a_{\left(  p+n\right)  -2}%
=1+\underbrace{a_{\left(  p-1\right)  +n}}_{\substack{\equiv a_{p-1}%
\operatorname{mod}a_{n}\\\text{(by (\ref{sol.seqs.1pxn-1x-2.a.min1}))}%
}}\ \ \underbrace{a_{\left(  p-2\right)  +n}}_{\substack{\equiv a_{p-2}%
\operatorname{mod}a_{n}\\\text{(by (\ref{sol.seqs.1pxn-1x-2.a.min2}))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  p+n\right)  -1=\left(
p-1\right)  +n\text{ and }\left(  p+n\right)  -2=\left(  p-2\right)  +n\right)
\\
&  \equiv1+a_{p-1}a_{p-2}=a_{p}\operatorname{mod}a_{n}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.seqs.1pxn-1x-2.a.p})}\right)  .
\end{align*}
Thus, $a_{p+n}\equiv a_{p}\operatorname{mod}a_{n}$ is proved in Case 3.

We have now proved $a_{p+n}\equiv a_{p}\operatorname{mod}a_{n}$ in each of the
three Cases 1, 2 and 3. Hence, $a_{p+n}\equiv a_{p}\operatorname{mod}a_{n}$
always holds. In other words, (\ref{sol.seqs.1pxn-1x-2.a.goal}) holds for
$k=p$. This completes the induction step. Thus,
(\ref{sol.seqs.1pxn-1x-2.a.goal}) is proven.]

This solves Exercise \ref{exe.seqs.1pxn-1x-2} \textbf{(a)}.

Let us now forget the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $
defined in Exercise \ref{exe.seqs.1pxn-1x-2}. Instead, we shall prove a
general property of a wider class of sequences:

\begin{theorem}
\label{thm.sol.seqs.gcd-from-mod-cong}Let $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ be \textbf{any} sequence of integers. Assume that we have%
\begin{equation}
a_{k+n}\equiv a_{k}\operatorname{mod}a_{n}\ \ \ \ \ \ \ \ \ \ \text{for any
}k\in\mathbb{N}\text{ and }n\in\mathbb{N}\text{.}
\label{eq.thm.sol.seqs.gcd-from-mod-cong.ass}%
\end{equation}
Then:

\textbf{(a)} If $u,v\in\mathbb{N}$ satisfy $u\mid v$, then $a_{u}\mid a_{v}$.

\textbf{(b)} For any $n,m\in\mathbb{N}$, we have $\gcd\left(  a_{n}%
,a_{m}\right)  =\left\vert a_{\gcd\left(  n,m\right)  }\right\vert $.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.sol.seqs.gcd-from-mod-cong}.]We shall prove Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} first, since Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(a)} follows easily from it. Of
course, it is not much harder to prove Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(a)} independently, by strong
induction on $v$ (or induction on $v/u$).

\textbf{(b)} This will be a calque of our solution to Exercise
\ref{exe.ent.gcd.an-1} \textbf{(b)}. Why innovate when you can just imitate?

We shall prove Theorem \ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} by
strong induction on $n+m$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Theorem \ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} is
true for $n+m<k$. We must prove that Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} is true for $n+m=k$.

So let $n,m\in\mathbb{N}$ be such that $n+m=k$. We must show that $\gcd\left(
a_{n},a_{m}\right)  =\left\vert a_{\gcd\left(  n,m\right)  }\right\vert $.

Note that $n$ and $m$ play symmetric roles in this claim\footnote{because
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} yields $\gcd\left(
a_{n},a_{m}\right)  =\gcd\left(  a_{m},a_{n}\right)  $ and $\gcd\left(
n,m\right)  =\gcd\left(  m,n\right)  $}, and thus can be swapped at will. By
swapping $n$ and $m$ if necessary, we can ensure that $n\leq m$. Hence, we
WLOG assume that $n\leq m$. Thus, $m-n\in\mathbb{N}$.

It is easy to see that our claim $\gcd\left(  a_{n},a_{m}\right)  =\left\vert
a_{\gcd\left(  n,m\right)  }\right\vert $ holds if $n=0$%
\ \ \ \ \footnote{\textit{Proof.} Assume that $n=0$. Thus, $a_{n}=a_{0}=0$.
But Proposition \ref{prop.ent.gcd.props1} \textbf{(a)} (applied to $m$ instead
of $a$) yields $\gcd\left(  m,0\right)  =\gcd\left(  m\right)  =\left\vert
m\right\vert =m$ (since $m\geq0$). But Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} yields $\gcd\left(  n,m\right)  =\gcd\left(  m,\underbrace{n}%
_{=0}\right)  =\gcd\left(  m,0\right)  =m$. Thus, $m=\gcd\left(  n,m\right)
$.
\par
Also, Proposition \ref{prop.ent.gcd.props1} \textbf{(a)} (applied to $a_{m}$
instead of $a$) yields $\gcd\left(  a_{m},0\right)  =\gcd\left(  a_{m}\right)
=\left\vert a_{m}\right\vert $. Now, Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} yields%
\begin{align*}
\gcd\left(  a_{n},a_{m}\right)   &  =\gcd\left(  a_{m},a_{n}\right)
=\gcd\left(  a_{m},0\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
a_{n}=0\right) \\
&  =\left\vert a_{m}\right\vert =\left\vert a_{\gcd\left(  n,m\right)
}\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{since }m=\gcd\left(
n,m\right)  \right)  ,
\end{align*}
qed.}. Thus, we are done if $n=0$. Hence, we WLOG assume that $n\neq0$.
Therefore, $n>0$ (since $n\in\mathbb{N}$). Thus, $n+m>m$, so that $m<n+m=k$.

But our induction hypothesis says that Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} is true for $n+m<k$. Hence,
we can apply Theorem \ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} to
$m-n$ instead of $m$ (since $m-n\in\mathbb{N}$ and $n+\left(  m-n\right)
=m<k$). We thus obtain
\begin{equation}
\gcd\left(  a_{n},a_{m-n}\right)  =\left\vert a_{\gcd\left(  n,m-n\right)
}\right\vert . \label{pf.thm.sol.seqs.gcd-from-mod-cong.b.4}%
\end{equation}
But we have $m-\underbrace{n}_{\equiv0\operatorname{mod}n}\equiv
m\operatorname{mod}n$, and thus $\gcd\left(  n,m-n\right)  =\gcd\left(
n,m\right)  $ (by Proposition \ref{prop.ent.gcd.props1} \textbf{(d)}, applied
to $a=n$, $b=m-n$ and $c=m$). Furthermore,
(\ref{eq.thm.sol.seqs.gcd-from-mod-cong.ass}) (applied to $m-n$ instead of
$k$) yields $a_{\left(  m-n\right)  +n}\equiv a_{m-n}\operatorname{mod}a_{n}$
(since $m-n\in\mathbb{N}$). In other words, $a_{m}\equiv a_{m-n}%
\operatorname{mod}a_{n}$ (since $\left(  m-n\right)  +n=m$). Hence,
Proposition \ref{prop.ent.gcd.props1} \textbf{(d)} (applied to $a_{n}$,
$a_{m}$ and $a_{m-n}$ instead of $a$, $b$ and $c$) yields%
\begin{align*}
\gcd\left(  a_{n},a_{m}\right)   &  =\gcd\left(  a_{n},a_{m-n}\right)
=\left\vert a_{\gcd\left(  n,m-n\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.thm.sol.seqs.gcd-from-mod-cong.b.4})}\right) \\
&  =\left\vert a_{\gcd\left(  n,m\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\gcd\left(  n,m-n\right)
=\gcd\left(  n,m\right)  \right)  .
\end{align*}


Now, forget that we fixed $n,m$. We thus have shown that any $n,m\in
\mathbb{N}$ satisfying $n+m=k$ satisfy $\gcd\left(  a_{n},a_{m}\right)
=\left\vert a_{\gcd\left(  n,m\right)  }\right\vert $. In other words, Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} is true for $n+m=k$. This
completes the induction step. Thus, Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} is proved.

\textbf{(a)} Let us now prove Theorem \ref{thm.sol.seqs.gcd-from-mod-cong}
\textbf{(a)}. This is easy after part \textbf{(b)} has already been shown:

Let $u,v\in\mathbb{N}$ be such that $u\mid v$. We must show that $a_{u}\mid
a_{v}$.

We have $u\mid v$. Thus, Proposition \ref{prop.ent.gcd.props1} \textbf{(i)}
(applied to $a=u$ and $b=v$) yields $\gcd\left(  u,v\right)  =\left\vert
u\right\vert =u$ (since $u\geq0$). But Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(b)} (applied to $n=u$ and $m=v$)
yields
\begin{align*}
\gcd\left(  a_{u},a_{v}\right)   &  =\left\vert a_{\gcd\left(  u,v\right)
}\right\vert =\left\vert a_{u}\right\vert \ \ \ \ \ \ \ \ \ \ \left(
\text{since }\gcd\left(  u,v\right)  =u\right) \\
&  =\pm a_{u},
\end{align*}
so that $a_{u}\mid\gcd\left(  a_{u},a_{v}\right)  $. However, Proposition
\ref{prop.ent.gcd.props1} \textbf{(f)} (applied to $a=a_{u}$ and $b=a_{v}$)
yields $\gcd\left(  a_{u},a_{v}\right)  \mid a_{u}$ and $\gcd\left(
a_{u},a_{v}\right)  \mid a_{v}$. Hence, $a_{u}\mid\gcd\left(  a_{u}%
,a_{v}\right)  \mid a_{v}$. This proves Theorem
\ref{thm.sol.seqs.gcd-from-mod-cong} \textbf{(a)}.
\end{proof}

Let us now resume the solution of Exercise \ref{exe.seqs.1pxn-1x-2}. Consider
again the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ defined in
Exercise \ref{exe.seqs.1pxn-1x-2}. We claim that%
\begin{equation}
a_{n}\geq0\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\label{sol.seqs.1pxn-1x-2.nonneg}%
\end{equation}


[\textit{Proof of (\ref{sol.seqs.1pxn-1x-2.nonneg}):} This is straightforward
by now. We proceed by strong induction on $n$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.seqs.1pxn-1x-2.nonneg}) holds for $n<k$. We must
prove that (\ref{sol.seqs.1pxn-1x-2.nonneg}) holds for $n=k$. In other words,
we must prove that $a_{k}\geq0$.

This is clearly true if $k=0$ (since $a_{0}=0\geq0$), and also is clearly true
if $k=1$ (since $a_{1}=1\geq0$). Hence, for the rest of this proof, we can
WLOG assume that $k$ equals neither $0$ nor $1$. Hence, $k\geq2$ (since
$k\in\mathbb{N}$). Therefore, $k-2\in\mathbb{N}$ and $k-1\in\mathbb{N}$.

But we assumed that (\ref{sol.seqs.1pxn-1x-2.nonneg}) holds for $n<k$. Hence,
we can apply (\ref{sol.seqs.1pxn-1x-2.nonneg}) to $n=k-2$ (since
$k-2\in\mathbb{N}$ and $k-2<k$). Thus we obtain $a_{k-2}\geq0$. Similarly,
$a_{k-1}\geq0$.

However, $k\geq2$. Thus, (\ref{sol.seqs.1pxn-1x-2.a.rec}) (applied to $n=k$)
yields $a_{k}=1+\underbrace{a_{k-1}}_{\geq0}\underbrace{a_{k-2}}_{\geq0}%
\geq1\geq0$. This completes our induction step. Thus,
(\ref{sol.seqs.1pxn-1x-2.a.rec}) is proved.]

Now, we can solve parts \textbf{(b)} and \textbf{(c)} of Exercise
\ref{exe.seqs.1pxn-1x-2}:

\textbf{(b)} We have $a_{k+n}\equiv a_{k}\operatorname{mod}a_{n}$ for any
$k\in\mathbb{N}$ and $n\in\mathbb{N}$ (by Exercise \ref{exe.seqs.1pxn-1x-2}
\textbf{(a)}). Hence, Theorem \ref{thm.sol.seqs.gcd-from-mod-cong}
\textbf{(a)} shows that if $u,v\in\mathbb{N}$ satisfy $u\mid v$, then
$a_{u}\mid a_{v}$. This solves Exercise \ref{exe.seqs.1pxn-1x-2} \textbf{(b)}.

\textbf{(c)} We have $a_{k+n}\equiv a_{k}\operatorname{mod}a_{n}$ for any
$k\in\mathbb{N}$ and $n\in\mathbb{N}$ (by Exercise \ref{exe.seqs.1pxn-1x-2}
\textbf{(a)}). Hence, Theorem \ref{thm.sol.seqs.gcd-from-mod-cong}
\textbf{(b)} shows that for any $n,m\in\mathbb{N}$, we have%
\[
\gcd\left(  a_{n},a_{m}\right)  =\left\vert a_{\gcd\left(  n,m\right)
}\right\vert =a_{\gcd\left(  n,m\right)  }%
\]
(since $a_{\gcd\left(  n,m\right)  }\geq0$ (by
(\ref{sol.seqs.1pxn-1x-2.nonneg}), applied to $\gcd\left(  n,m\right)  $
instead of $n$)). This solves Exercise \ref{exe.seqs.1pxn-1x-2} \textbf{(c)}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.sum-div-nums}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.sum-div-nums}.]Exercise
\ref{exe.ent.sum-div-nums} is a result of Dirichlet (published in 1849). Let
us give a solution using manipulation of sums.

We will need the following fact:

\begin{proposition}
\label{prop.ent.floor-of-quot-as-number}Let $n\in\mathbb{N}$, and let $b$ be a
positive integer. Then,%
\begin{equation}
\sum_{\substack{k\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1=\left\lfloor
\dfrac{n}{b}\right\rfloor . \label{eq.prop.ent.floor-of-quot-as-number.eq}%
\end{equation}

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.ent.floor-of-quot-as-number} (sketched).]%
Clearly, the sum $\sum_{\substack{k\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid
k}}1$ equals the number of all $k\in\left\{  1,2,\ldots,n\right\}  $ that are
multiples of $b$ (by (\ref{eq.sum.equal})). In other words, this sum equals
the number of all multiples of $b$ in the set $\left\{  1,2,\ldots,n\right\}
$. But these multiples are precisely $1b,2b,3b,\ldots,\left(  n//b\right)  b$.
Hence, their number is $n//b$ (see Definition \ref{def.ent.quorem}
\textbf{(a)} for the meaning of this notation). Thus, we obtain $\sum
_{\substack{k\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1=n//b=\left\lfloor
\dfrac{n}{b}\right\rfloor $ (by Proposition \ref{prop.ent.quo-rem.quo=floor},
applied to $n$ and $b$ instead of $u$ and $n$), so Proposition
\ref{prop.ent.floor-of-quot-as-number} is proven. (See \cite[Proposition
1.1.11]{floor} for a detailed proof.)
\end{proof}

The next lemma is even simpler:

\begin{lemma}
\label{lem.ent.dk-as-sum}Let $n$ be a positive integer. Let $k\in\left\{
1,2,\ldots,n\right\}  $. Then,%
\begin{equation}
\sum_{\substack{b\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1=d\left(
k\right)  . \label{eq.lem.ent.dk-as-sum.eq}%
\end{equation}

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.dk-as-sum}.]Using (\ref{eq.sum.equal}), we see
that%
\begin{align}
&  \sum_{\substack{b\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1\nonumber\\
&  =\left(  \text{the number of all }b\in\left\{  1,2,\ldots,n\right\}  \text{
satisfying }b\mid k\right)  \cdot1\nonumber\\
&  =\left(  \text{the number of all }b\in\left\{  1,2,\ldots,n\right\}  \text{
satisfying }b\mid k\right)  . \label{pf.lem.ent.dk-as-sum.1}%
\end{align}
However, the numbers $b\in\left\{  1,2,\ldots,n\right\}  $ satisfying $b\mid
k$ are precisely the positive divisors of $k$\ \ \ \ \footnote{\textit{Proof.}
It is clear that each number $b\in\left\{  1,2,\ldots,n\right\}  $ satisfying
$b\mid k$ is a positive divisor of $k$. Thus, we only need to prove the
converse statement -- i.e., we need to prove that each positive divisor of $k$
is a $b\in\left\{  1,2,\ldots,n\right\}  $ satisfying $b\mid k$. In other
words, we need to show that if $b$ is a positive divisor of $k$, then
$b\in\left\{  1,2,\ldots,n\right\}  $ and $b\mid k$.
\par
So let us do this. Let $b$ be a positive divisor of $k$. We must show that
$b\in\left\{  1,2,\ldots,n\right\}  $ and $b\mid k$.
\par
We have $b\mid k$ (since $b$ is a divisor of $k$) and $k\neq0$ (since
$k\in\left\{  1,2,\ldots,n\right\}  $). Hence, Proposition
\ref{prop.ent.div.1} \textbf{(b)} (applied to $b$ and $k$ instead of $a$ and
$b$) yields $\left\vert b\right\vert \leq\left\vert k\right\vert $. Hence,
$\left\vert k\right\vert \geq\left\vert b\right\vert =b$ (since $b$ is
positive). Also, $k$ is positive (since $k\in\left\{  1,2,\ldots,n\right\}
$), so that $\left\vert k\right\vert =k$. Hence, $k=\left\vert k\right\vert
\geq b$, thus $b\leq k\leq n$ (since $k\in\left\{  1,2,\ldots,n\right\}  $).
Since $b$ is a positive integer, we thus conclude that $b\in\left\{
1,2,\ldots,n\right\}  $. Thus, we have shown that $b\in\left\{  1,2,\ldots
,n\right\}  $ and $b\mid k$. As explained above, this completes our proof.}.
Hence,%
\begin{align*}
&  \left(  \text{the number of all }b\in\left\{  1,2,\ldots,n\right\}  \text{
satisfying }b\mid k\right) \\
&  =\left(  \text{the number of all positive divisors of }k\right)  =d\left(
k\right)
\end{align*}
(since $d\left(  k\right)  $ was defined to be the number of all positive
divisors of $k$). Thus, (\ref{pf.lem.ent.dk-as-sum.1}) becomes%
\[
\sum_{\substack{b\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1=\left(
\text{the number of all }b\in\left\{  1,2,\ldots,n\right\}  \text{ satisfying
}b\mid k\right)  =d\left(  k\right)  .
\]
This proves Lemma \ref{lem.ent.dk-as-sum}.
\end{proof}

Now,
\begin{align*}
&  \left\lfloor \dfrac{n}{1}\right\rfloor +\left\lfloor \dfrac{n}%
{2}\right\rfloor +\cdots+\left\lfloor \dfrac{n}{n}\right\rfloor \\
&  =\sum_{b\in\left\{  1,2,\ldots,n\right\}  }\underbrace{\left\lfloor
\dfrac{n}{b}\right\rfloor }_{\substack{=\sum_{\substack{k\in\left\{
1,2,\ldots,n\right\}  ;\\b\mid k}}1\\\text{(by
(\ref{eq.prop.ent.floor-of-quot-as-number.eq}))}}}=\underbrace{\sum
_{b\in\left\{  1,2,\ldots,n\right\}  }\ \ \sum_{\substack{k\in\left\{
1,2,\ldots,n\right\}  ;\\b\mid k}}}_{\substack{=\sum_{k\in\left\{
1,2,\ldots,n\right\}  }\ \ \sum_{\substack{b\in\left\{  1,2,\ldots,n\right\}
;\\b\mid k}}\\\text{(here, we have used Theorem
\ref{thm.seqsum.sums.fubini-pred}}\\\text{to interchange the two summation
signs)}}}1\\
&  =\sum_{k\in\left\{  1,2,\ldots,n\right\}  }\ \ \underbrace{\sum
_{\substack{b\in\left\{  1,2,\ldots,n\right\}  ;\\b\mid k}}1}%
_{\substack{=d\left(  k\right)  \\\text{(by Lemma \ref{lem.ent.dk-as-sum})}%
}}=\sum_{k\in\left\{  1,2,\ldots,n\right\}  }d\left(  k\right)  =d\left(
1\right)  +d\left(  2\right)  +\cdots+d\left(  n\right)  .
\end{align*}
This solves Exercise \ref{exe.ent.sum-div-nums}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.sum-k-nck}}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.sum-k-nck}.]\textbf{(a)} The answer is%
\begin{equation}
\sum_{k=0}^{n}k\dbinom{n}{k}=n\cdot2^{n-1}. \label{sol.binom.sum-k-nck.a.res}%
\end{equation}


The formula (\ref{sol.binom.sum-k-nck.a.res}) appears twice in \cite{19fco}:
once as \cite[Exercise 1.3.6]{19fco} (where two proofs are given) and once
again as \cite[Corollary 1.6.5]{19fco} (with a different, combinatorial
proof). We shall briefly outline the first two proofs as well as another using
derivatives of polynomials:

\begin{proof}
[First proof of (\ref{sol.binom.sum-k-nck.a.res}) (sketched).]We WLOG assume
that $n\neq0$ (since the case $n=0$ is easily checked by hand). Hence,
$n\geq1$, so that $n-1\in\mathbb{N}$. Now,%
\begin{align*}
\sum_{k=0}^{n}k\dbinom{n}{k}  &  =\underbrace{0\dbinom{n}{0}}_{=0}+\sum
_{k=1}^{n}\underbrace{k}_{=n\cdot\dfrac{k}{n}}\dbinom{n}{k}=\sum_{k=1}%
^{n}n\cdot\underbrace{\dfrac{k}{n}\dbinom{n}{k}}_{\substack{=\dbinom{n-1}%
{k-1}\\\text{(by Exercise \ref{exe.binom.gcd-integrality} \textbf{(a)}%
,}\\\text{applied to }m=k\text{)}}}\\
&  =\sum_{k=1}^{n}n\cdot\dbinom{n-1}{k-1}=n\sum_{k=1}^{n}\dbinom{n-1}%
{k-1}=n\underbrace{\sum_{k=0}^{n-1}\dbinom{n-1}{k}}_{\substack{=2^{n-1}%
\\\text{(by Corollary \ref{cor.binom.2pown},}\\\text{applied to }n-1\text{
instead of }n\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k\text{ for
}k-1\text{ in the sum}\right) \\
&  =n\cdot2^{n-1}.
\end{align*}
This proves (\ref{sol.binom.sum-k-nck.a.res}).
\end{proof}

\begin{proof}
[Second proof of (\ref{sol.binom.sum-k-nck.a.res}) (sketched).]We use Gauss's
\textquotedblleft doubling trick\textquotedblright\ as in the solution to
Exercise \ref{exe.seqsum.sums.gauss}: We have%
\begin{align*}
2\cdot\sum_{k=0}^{n}k\dbinom{n}{k}  &  =\sum_{k=0}^{n}k\dbinom{n}{k}%
+\sum_{k=0}^{n}k\dbinom{n}{k}=\sum_{k=0}^{n}k\dbinom{n}{k}+\sum_{k=0}%
^{n}\left(  n-k\right)  \underbrace{\dbinom{n}{n-k}}_{\substack{=\dbinom{n}%
{k}\\\text{(by Theorem \ref{thm.binom.sym})}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }n-k\text{ for
}k\text{ in the second sum}\right) \\
&  =\sum_{k=0}^{n}k\dbinom{n}{k}+\sum_{k=0}^{n}\left(  n-k\right)  \dbinom
{n}{k}=\sum_{k=0}^{n}\underbrace{\left(  k\dbinom{n}{k}+\left(  n-k\right)
\dbinom{n}{k}\right)  }_{=\left(  k+\left(  n-k\right)  \right)  \dbinom{n}%
{k}}\\
&  =\sum_{k=0}^{n}\underbrace{\left(  k+\left(  n-k\right)  \right)  }%
_{=n}\dbinom{n}{k}=\sum_{k=0}^{n}n\dbinom{n}{k}=n\underbrace{\sum_{k=0}%
^{n}\dbinom{n}{k}}_{\substack{=2^{n}\\\text{(by Corollary
\ref{cor.binom.2pown})}}}=n\cdot2^{n}.
\end{align*}
Dividing both sides of this equality by $2$, we obtain
(\ref{sol.binom.sum-k-nck.a.res}). This proves
(\ref{sol.binom.sum-k-nck.a.res}) again.
\end{proof}

\begin{proof}
[Third proof of (\ref{sol.binom.sum-k-nck.a.res}) (sketched).]Consider
polynomials in a single indeterminate $x$ over the real numbers. Applying
Theorem \ref{thm.binom.binom} to $y=1$, we obtain%
\begin{equation}
\left(  x+1\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}{k}x^{k}\underbrace{1^{n-k}%
}_{=1}=\sum_{k=0}^{n}\dbinom{n}{k}x^{k}.
\label{sol.binom.sum-k-nck.a.res.pf3.1}%
\end{equation}
(Strictly speaking, we did not literally apply Theorem \ref{thm.binom.binom}
here, because the $x$ in Theorem \ref{thm.binom.binom} is required to be a
number, not a polynomial. But Theorem \ref{thm.binom.binom} holds for
polynomials just as well as for numbers (i.e., the $x$ and the $y$ in Theorem
\ref{thm.binom.binom} can be polynomials rather than numbers), and can be
proved in this generality just as it was proved for numbers. It is this
generalized version of Theorem \ref{thm.binom.binom} that we have applied above.)

Now, (\ref{sol.binom.sum-k-nck.a.res.pf3.1}) is an equality between two
polynomials in $x$; thus, we can take derivatives on both sides. The
derivative of $\left(  x+1\right)  ^{n}$ is easily seen to be $n\left(
x+1\right)  ^{n-1}$, whereas the derivative of $\sum_{k=0}^{n}\dbinom{n}%
{k}x^{k}$ is $\sum_{k=0}^{n}\dbinom{n}{k}kx^{k-1}$ (since the derivative of
each $x^{k}$ is $kx^{k-1}$). Hence, by taking derivatives on both sides of
(\ref{sol.binom.sum-k-nck.a.res.pf3.1}), we obtain%
\[
n\left(  x+1\right)  ^{n-1}=\sum_{k=0}^{n}\dbinom{n}{k}kx^{k-1}.
\]
Substituting $1$ for $x$ in this equality, we obtain%
\[
n\left(  1+1\right)  ^{n-1}=\sum_{k=0}^{n}\underbrace{\dbinom{n}{k}%
k}_{=k\dbinom{n}{k}}\underbrace{1^{k-1}}_{=1}=\sum_{k=0}^{n}k\dbinom{n}{k}.
\]
Hence,%
\[
\sum_{k=0}^{n}k\dbinom{n}{k}=n\left(  \underbrace{1+1}_{=2}\right)
^{n-1}=n\cdot2^{n-1}.
\]
This again proves (\ref{sol.binom.sum-k-nck.a.res}).
\end{proof}

Now, (\ref{sol.binom.sum-k-nck.a.res}) has been proved (three times to boot),
so Exercise \ref{exe.binom.sum-k-nck} \textbf{(a)} is solved.

\textbf{(b)} This is similar to Exercise \ref{exe.binom.sum-n-choose-k-half},
except that the odd $n$ has been replaced by an even $2n$. The solution is
just a bit more complicated, because the $2n$-th row of Pascal's triangle
splits into a left \textquotedblleft half\textquotedblright, a right
\textquotedblleft half\textquotedblright, and a lone entry $\dbinom{2n}{n}$ in
the middle. Here is the argument in detail:

\begin{proof}
[Solution to Exercise \ref{exe.binom.sum-k-nck} \textbf{(b)}.]Corollary
\ref{cor.binom.2pown} (applied to $2n$ instead of $n$) yields $\sum
\limits_{k=0}^{2n}\dbinom{2n}{k}=2^{2n}$. Hence,%
\begin{equation}
2^{2n}=\sum\limits_{k=0}^{2n}\dbinom{2n}{k}=\sum_{k=0}^{n}\dbinom{2n}{k}%
+\sum_{k=n+1}^{2n}\dbinom{2n}{k} \label{sol.binom.sum-k-nck.1}%
\end{equation}
(here, we have split the sum at $k=n$; that is, we have applied
(\ref{eq.sum.split.uvw}) to $0$, $n$ and $2n$ instead of $u$, $v$ and $w$).
But%
\begin{align*}
\sum_{k=n+1}^{2n}\dbinom{2n}{k}  &  =\sum_{k=0}^{n-1}\underbrace{\dbinom
{2n}{2n-k}}_{\substack{=\dbinom{2n}{k}\\\text{(since Theorem
\ref{thm.binom.sym}}\\\text{(applied to }2n\text{ instead of }n\text{)}%
\\\text{yields }\dbinom{2n}{k}=\dbinom{2n}{2n-k}\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have substituted }2n-k\text{ for }k\text{ in the sum,}\\
\text{since the map }\left\{  0,1,\ldots,n-1\right\}  \rightarrow\left\{
n+1,n+2,\ldots,2n\right\} \\
\text{that sends each }k\text{ to }2n-k\text{ is a bijection}%
\end{array}
\right) \\
&  =\sum_{k=0}^{n-1}\dbinom{2n}{k}=\sum_{k=0}^{n}\dbinom{2n}{k}-\dbinom{2n}{n}%
\end{align*}
(since $\sum_{k=0}^{n}\dbinom{2n}{k}=\sum_{k=0}^{n-1}\dbinom{2n}{k}%
+\dbinom{2n}{n}$). Hence, (\ref{sol.binom.sum-k-nck.1}) becomes%
\begin{align*}
2^{2n}  &  =\sum_{k=0}^{n}\dbinom{2n}{k}+\underbrace{\sum_{k=n+1}^{2n}%
\dbinom{2n}{k}}_{=\sum_{k=0}^{n}\dbinom{2n}{k}-\dbinom{2n}{n}}\\
&  =\sum_{k=0}^{n}\dbinom{2n}{k}+\sum_{k=0}^{n}\dbinom{2n}{k}-\dbinom{2n}%
{n}=2\cdot\sum_{k=0}^{n}\dbinom{2n}{k}-\dbinom{2n}{n}.
\end{align*}
Solving this equality for $\sum_{k=0}^{n}\dbinom{2n}{k}$, we obtain%
\begin{equation}
\sum_{k=0}^{n}\dbinom{2n}{k}=\dfrac{1}{2}\cdot\left(  2^{2n}+\dbinom{2n}%
{n}\right)  . \label{sol.binom.sum-k-nck.res1}%
\end{equation}


This already solves Exercise \ref{exe.binom.sum-k-nck} \textbf{(b)}. But let
us simplify this a bit further (getting rid of the $\dfrac{1}{2}$) when $n$ is
positive. Namely, assume that $n$ is positive. Then, Exercise
\ref{exe.binom.gcd-integrality} \textbf{(a)} (applied to $2n$ and $n$ instead
of $n$ and $m$) yields $\dfrac{n}{2n}\dbinom{2n}{n}=\dbinom{2n-1}{n-1}$. This
rewrites as $\dfrac{1}{2}\dbinom{2n}{n}=\dbinom{2n-1}{n-1}$ (since $\dfrac
{n}{2n}=\dfrac{1}{2}$). Now, (\ref{sol.binom.sum-k-nck.res1}) becomes%
\begin{align}
\sum_{k=0}^{n}\dbinom{2n}{k}  &  =\dfrac{1}{2}\cdot\left(  2^{2n}+\dbinom
{2n}{n}\right)  =\underbrace{\dfrac{1}{2}\cdot2^{2n}}_{=2^{2n-1}%
}+\underbrace{\dfrac{1}{2}\dbinom{2n}{n}}_{=\dbinom{2n-1}{n-1}}\nonumber\\
&  =2^{2n-1}+\dbinom{2n-1}{n-1}. \label{sol.binom.sum-k-nck.res2}%
\end{align}
Note that this is \textbf{not} true for $n=0$. Division by $0$ is not a good idea!
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.sums.polariz1}}

\begin{proof}
[Discussion of Exercise \ref{exe.sums.polariz1}.]The two claims of Exercise
\ref{exe.sums.polariz1} are known as \textquotedblleft polarization
identities\textquotedblright\ (although the name is often shared with other
similar-looking formulas). Exercise \ref{exe.sums.polariz1} is a particular
case of \cite[Exercise 6.51 parts \textbf{(a)} and \textbf{(b)}]%
{detnotes}.\footnote{We are working with numbers here rather than elements of
a noncommutative ring, so the complicated sum $\sum_{\sigma\in S_{n}}%
v_{\sigma\left(  1\right)  }v_{\sigma\left(  2\right)  }\cdots v_{\sigma
\left(  n\right)  }$ from \cite[Exercise 6.51 \textbf{(b)}]{detnotes} can be
simplified to $n!v_{1}v_{2}\cdots v_{n}$.} Let us give a self-contained
solution here:

\begin{proof}
[Solution to Exercise \ref{exe.sums.polariz1}.]For each $p\in\mathbb{N}$, we
let $\left[  p\right]  $ be the $p$-element set $\left\{  1,2,\ldots
,p\right\}  $. (This generalizes the definition $\left[  n\right]  =\left\{
1,2,\ldots,n\right\}  $ made in Exercise \ref{exe.sums.polariz1}.)

For any $p\in\left\{  0,1,\ldots,n\right\}  $ and $m\in\mathbb{N}$, we define
a number%
\begin{equation}
S_{p,m}:=\sum_{I\subseteq\left[  p\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{m}.
\label{sol.sums.polariz1.Spm=}%
\end{equation}
Thus, Exercise \ref{exe.sums.polariz1} \textbf{(a)} is saying that $S_{n,m}=0$
for each $m\in\left\{  0,1,\ldots,n-1\right\}  $, whereas Exercise
\ref{exe.sums.polariz1} \textbf{(b)} is saying that $S_{n,n}=n!x_{1}%
x_{2}\cdots x_{n}$. The reason why we have introduced $S_{p,m}$ for general
$p$ (not just for $p=n$) is that we want to induct on $p$. (We could just as
well induct on $n$, but it is somewhat easier to keep $n$ fixed.)

Now, we claim that the $S_{p,m}$ satisfy the following recurrence relation:

\begin{statement}
\textit{Claim 1:} Let $p\in\left\{  1,2,\ldots,n\right\}  $ and $m\in
\mathbb{N}$. Then,%
\[
S_{p,m}=\sum_{k=0}^{m-1}\dbinom{m}{k}x_{p}^{m-k}S_{p-1,k}.
\]

\end{statement}

[\textit{Proof of Claim 1:} First of all, both $p$ and $p-1$ belong to the set
$\left\{  0,1,\ldots,n\right\}  $ (since $p\in\left\{  1,2,\ldots,n\right\}
$). Thus, $\left[  p\right]  $ and $\left[  p-1\right]  $ are subsets of
$\left[  n\right]  $.

If $I$ is any subset of $\left[  n\right]  $, then we define a number $z_{I}$
by%
\begin{equation}
z_{I}:=y+\sum_{i\in I}x_{i}. \label{sol.sums.polariz1.C1.pf.xI=}%
\end{equation}
(Thus, in particular, $z_{\varnothing}=y+\underbrace{\left(  \text{empty
sum}\right)  }_{=0}=y$.) The definition of $S_{p,m}$ now yields%
\begin{align}
S_{p,m}  &  =\sum_{I\subseteq\left[  p\right]  }\left(  -1\right)
^{p-\left\vert I\right\vert }\left(  \underbrace{y+\sum_{i\in I}x_{i}%
}_{\substack{=z_{I}\\\text{(by (\ref{sol.sums.polariz1.C1.pf.xI=}))}}}\right)
^{m}\nonumber\\
&  =\sum_{I\subseteq\left[  p\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }z_{I}^{m}. \label{sol.sums.polariz1.C1.pf.Spm=}%
\end{align}


Likewise, we can see that%
\begin{equation}
S_{p-1,k}=\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{\left(
p-1\right)  -\left\vert I\right\vert }z_{I}^{k}\ \ \ \ \ \ \ \ \ \ \text{for
each }k\in\mathbb{N}. \label{sol.sums.polariz1.C1.pf.Sp-1k=}%
\end{equation}
(Indeed, this follows from the same argument that we used to prove
(\ref{sol.sums.polariz1.C1.pf.Spm=}), but now applied to $p-1$ and $k$ instead
of $p$ and $m$.)

We shall call a subset of $\left[  p\right]  $

\begin{itemize}
\item \textit{red} if it contains $p$;

\item \textit{green} if it does not contain $p$.
\end{itemize}

\noindent Thus, each subset of $\left[  p\right]  $ is either red or green
(but not both). Hence, the sum on the right hand side of
(\ref{sol.sums.polariz1.C1.pf.Spm=}) can be split up as follows:%
\[
\sum_{I\subseteq\left[  p\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }z_{I}^{m}=\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{
is red}}}\left(  -1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}%
+\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is green}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}.
\]
We shall now take a closer look at the two sums on the right hand side of this.

The green subsets $I$ of $\left[  p\right]  $ are the subsets of $\left[
p\right]  $ that do not contain $p$ (by the definition of \textquotedblleft
green\textquotedblright). In other words, they are just the subsets of
$\left[  p\right]  \setminus\left\{  p\right\}  $. Since $\left[  p\right]
\setminus\left\{  p\right\}  =\left[  p-1\right]  $, this means that they are
just the subsets of $\left[  p-1\right]  $. Hence, we can rewrite the
summation sign $\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is
green}}}$ as $\sum_{I\subseteq\left[  p-1\right]  }$. So we obtain%
\begin{equation}
\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is green}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}=\sum_{I\subseteq\left[
p-1\right]  }\left(  -1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}.
\label{sol.sums.polariz1.C1.pf.green}%
\end{equation}


The red subsets are a bit more complicated. If $I$ is a red subset of $\left[
p\right]  $, then $I$ contains $p$ (by the definition of \textquotedblleft
red\textquotedblright), and thus is not a subset of $\left[  p-1\right]  $.
However, we can obtain a subset of $\left[  p-1\right]  $ by removing $p$ from
$I$. Conversely, if $J$ is a subset of $\left[  p-1\right]  $, then we can
obtain a red subset of $\left[  p\right]  $ by inserting $p$ into $J$. Let us
make this more formal: We have two maps%
\begin{align*}
\left\{  \text{red subsets of }\left[  p\right]  \right\}   &  \rightarrow
\left\{  \text{subsets of }\left[  p-1\right]  \right\}  ,\\
I  &  \mapsto I\setminus\left\{  p\right\}
\end{align*}
and%
\begin{align*}
\left\{  \text{subsets of }\left[  p-1\right]  \right\}   &  \rightarrow
\left\{  \text{red subsets of }\left[  p\right]  \right\}  ,\\
J  &  \mapsto J\cup\left\{  p\right\}  .
\end{align*}
These two maps are mutually inverse; thus, they are invertible, i.e., they are
bijections. In particular, the map%
\begin{align*}
\left\{  \text{subsets of }\left[  p-1\right]  \right\}   &  \rightarrow
\left\{  \text{red subsets of }\left[  p\right]  \right\}  ,\\
J  &  \mapsto J\cup\left\{  p\right\}
\end{align*}
is a bijection. Hence, we can substitute $J\cup\left\{  p\right\}  $ for $I$
in the sum%
\[
\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is red}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}.
\]
As a result, we obtain%
\begin{align}
\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is red}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}  &  =\sum_{J\subseteq\left[
p-1\right]  }\left(  -1\right)  ^{p-\left\vert J\cup\left\{  p\right\}
\right\vert }z_{J\cup\left\{  p\right\}  }^{m}\nonumber\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\cup\left\{  p\right\}  \right\vert }z_{I\cup\left\{  p\right\}  }^{m}
\label{sol.sums.polariz1.C1.pf.red1}%
\end{align}
(here, we have renamed the summation index $J$ as $I$).

We can rewrite this somewhat. Indeed, if $I$ is a subset of $\left[
p-1\right]  $, then $p\notin I$ (since having $p\in I$ would entail $p\in
I\subseteq\left[  p-1\right]  =\left\{  1,2,\ldots,p-1\right\}  $, which is
absurd) and therefore $\left\vert I\cup\left\{  p\right\}  \right\vert
=\left\vert I\right\vert +1$ and thus%
\begin{equation}
\left(  -1\right)  ^{p-\left\vert I\cup\left\{  p\right\}  \right\vert
}=\left(  -1\right)  ^{p-\left(  \left\vert I\right\vert +1\right)  }=\left(
-1\right)  ^{p-\left\vert I\right\vert -1}=-\left(  -1\right)  ^{p-\left\vert
I\right\vert } \label{sol.sums.polariz1.C1.pf.red2aux1}%
\end{equation}
and%
\begin{align}
z_{I\cup\left\{  p\right\}  }  &  =y+\underbrace{\sum_{i\in I\cup\left\{
p\right\}  }x_{i}}_{\substack{=\sum_{i\in I}x_{i}+x_{p}\\\text{(since }p\notin
I\text{)}}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }%
z_{I\cup\left\{  p\right\}  }\right) \nonumber\\
&  =\underbrace{y+\sum_{i\in I}x_{i}}_{\substack{=z_{I}\\\text{(by
(\ref{sol.sums.polariz1.C1.pf.xI=}))}}}+x_{p}=z_{I}+x_{p}.
\label{sol.sums.polariz1.C1.pf.red2aux3}%
\end{align}
Thus, (\ref{sol.sums.polariz1.C1.pf.red1}) becomes%
\begin{align}
&  \sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is red}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}\nonumber\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\underbrace{\left(  -1\right)
^{p-\left\vert I\cup\left\{  p\right\}  \right\vert }}_{\substack{=-\left(
-1\right)  ^{p-\left\vert I\right\vert }\\\text{(by
(\ref{sol.sums.polariz1.C1.pf.red2aux1}))}}}\underbrace{z_{I\cup\left\{
p\right\}  }^{m}}_{\substack{=\left(  z_{I}+x_{p}\right)  ^{m}\\\text{(by
(\ref{sol.sums.polariz1.C1.pf.red2aux3}))}}}\nonumber\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -\left(  -1\right)
^{p-\left\vert I\right\vert }\right)  \left(  z_{I}+x_{p}\right)
^{m}\nonumber\\
&  =-\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }\left(  z_{I}+x_{p}\right)  ^{m}.
\label{sol.sums.polariz1.C1.pf.red3}%
\end{align}


Now, (\ref{sol.sums.polariz1.C1.pf.Spm=}) yields%
\begin{align}
S_{p,m}  &  =\sum_{I\subseteq\left[  p\right]  }\left(  -1\right)
^{p-\left\vert I\right\vert }z_{I}^{m}\nonumber\\
&  =\underbrace{\sum_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is
red}}}\left(  -1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}}%
_{\substack{=-\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)
^{p-\left\vert I\right\vert }\left(  z_{I}+x_{p}\right)  ^{m}\\\text{(by
(\ref{sol.sums.polariz1.C1.pf.red3}))}}}+\underbrace{\sum
_{\substack{I\subseteq\left[  p\right]  ;\\I\text{ is green}}}\left(
-1\right)  ^{p-\left\vert I\right\vert }z_{I}^{m}}_{\substack{=\sum
_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }z_{I}^{m}\\\text{(by (\ref{sol.sums.polariz1.C1.pf.green}))}%
}}\nonumber\\
&  =-\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }\left(  z_{I}+x_{p}\right)  ^{m}+\sum_{I\subseteq\left[
p-1\right]  }\left(  -1\right)  ^{p-\left\vert I\right\vert }z_{I}%
^{m}\nonumber\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }z_{I}^{m}-\sum_{I\subseteq\left[  p-1\right]  }\left(
-1\right)  ^{p-\left\vert I\right\vert }\left(  z_{I}+x_{p}\right)
^{m}\nonumber\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }\left(  z_{I}^{m}-\left(  z_{I}+x_{p}\right)  ^{m}\right)  .
\label{sol.sums.polariz1.C1.pf.4}%
\end{align}


Now, let us simplify the difference inside the big parentheses on the right
hand side. Fix a subset $I$ of $\left[  p-1\right]  $. Then, Theorem
\ref{thm.binom.binom} (applied to $m$, $z_{I}$ and $x_{p}$ instead of $n$, $x$
and $y$) yields%
\begin{align*}
\left(  z_{I}+x_{p}\right)  ^{m}  &  =\sum_{k=0}^{m}\dbinom{m}{k}z_{I}%
^{k}x_{p}^{m-k}=\sum_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}^{m-k}%
+\underbrace{\dbinom{m}{m}}_{\substack{=1\\\text{(by
(\ref{eq.thm.binom.sym.nn}))}}}z_{I}^{m}\underbrace{x_{p}^{m-m}}_{=x_{p}%
^{0}=1}\\
&  =\sum_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}^{m-k}+z_{I}^{m}.
\end{align*}
Hence,%
\begin{align}
z_{I}^{m}-\left(  z_{I}+x_{p}\right)  ^{m}  &  =z_{I}^{m}-\left(  \sum
_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}^{m-k}+z_{I}^{m}\right) \nonumber\\
&  =-\sum_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}^{m-k}.
\label{sol.sums.polariz1.C1.pf.5}%
\end{align}


Forget that we fixed $I$. We thus have proved (\ref{sol.sums.polariz1.C1.pf.5}%
) for each subset $I$ of $\left[  p-1\right]  $.

Now, (\ref{sol.sums.polariz1.C1.pf.4}) becomes%
\begin{align*}
S_{p,m}  &  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)
^{p-\left\vert I\right\vert }\underbrace{\left(  z_{I}^{m}-\left(  z_{I}%
+x_{p}\right)  ^{m}\right)  }_{\substack{=-\sum_{k=0}^{m-1}\dbinom{m}{k}%
z_{I}^{k}x_{p}^{m-k}\\\text{(by (\ref{sol.sums.polariz1.C1.pf.5}))}}}\\
&  =\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)  ^{p-\left\vert
I\right\vert }\left(  -\sum_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}%
^{m-k}\right)  =-\sum_{I\subseteq\left[  p-1\right]  }\left(  -1\right)
^{p-\left\vert I\right\vert }\sum_{k=0}^{m-1}\dbinom{m}{k}z_{I}^{k}x_{p}%
^{m-k}\\
&  =-\underbrace{\sum_{I\subseteq\left[  p-1\right]  }\ \ \sum_{k=0}^{m-1}%
}_{=\sum_{k=0}^{m-1}\ \ \sum_{I\subseteq\left[  p-1\right]  }}%
\underbrace{\left(  -1\right)  ^{p-\left\vert I\right\vert }}%
_{\substack{=-\left(  -1\right)  ^{p-\left\vert I\right\vert -1}\\=-\left(
-1\right)  ^{\left(  p-1\right)  -\left\vert I\right\vert }\\\text{(since
}p-\left\vert I\right\vert -1=\left(  p-1\right)  -\left\vert I\right\vert
\text{)}}}\dbinom{m}{k}z_{I}^{k}x_{p}^{m-k}\\
&  =-\sum_{k=0}^{m-1}\ \ \sum_{I\subseteq\left[  p-1\right]  }\left(  -\left(
-1\right)  ^{\left(  p-1\right)  -\left\vert I\right\vert }\right)  \dbinom
{m}{k}z_{I}^{k}x_{p}^{m-k}\\
&  =\sum_{k=0}^{m-1}\ \ \sum_{I\subseteq\left[  p-1\right]  }\left(
-1\right)  ^{\left(  p-1\right)  -\left\vert I\right\vert }\dbinom{m}{k}%
z_{I}^{k}x_{p}^{m-k}\\
&  =\sum_{k=0}^{m-1}\dbinom{m}{k}x_{p}^{m-k}\underbrace{\sum_{I\subseteq
\left[  p-1\right]  }\left(  -1\right)  ^{\left(  p-1\right)  -\left\vert
I\right\vert }z_{I}^{k}}_{\substack{=S_{p-1,k}\\\text{(by
(\ref{sol.sums.polariz1.C1.pf.Sp-1k=}))}}}=\sum_{k=0}^{m-1}\dbinom{m}{k}%
x_{p}^{m-k}S_{p-1,k}.
\end{align*}
This proves Claim 1.]

With Claim 1 in hand, we can prove properties of the $S_{p,m}$ like the
following by a straightforward induction:

\begin{statement}
\textit{Claim 2:} We have $S_{p,m}=0$ for each $p\in\left\{  0,1,\ldots
,n\right\}  $ and each $m\in\left\{  0,1,\ldots,p-1\right\}  $.
\end{statement}

[\textit{Proof of Claim 2:} We proceed by induction on $p$:

\textit{Induction base:} If $p=0$, then there exists no $m\in\left\{
0,1,\ldots,p-1\right\}  $ (since the set $\left\{  0,1,\ldots,p-1\right\}  $
is empty in this case). Thus, Claim 2 is vacuously true for $p=0$.

\textit{Induction step:} Let $q\in\left\{  0,1,\ldots,n-1\right\}  $. Assume
(as the induction hypothesis) that Claim 2 holds for $p=q$. We must prove that
Claim 2 holds for $p=q+1$.

We have assumed that Claim 2 holds for $p=q$. In other words, we have%
\begin{equation}
S_{q,m}=0\ \ \ \ \ \ \ \ \ \ \text{for each }m\in\left\{  0,1,\ldots
,q-1\right\}  . \label{sol.sums.polariz1.C2.pf.IH}%
\end{equation}


Now, let $m\in\left\{  0,1,\ldots,q\right\}  $. Thus, $0\leq m\leq q$. Note
that $q+1\in\left\{  1,2,\ldots,n\right\}  $ (since $q\in\left\{
0,1,\ldots,n-1\right\}  $). Hence, Claim 1 (applied to $p=q+1$) yields%
\begin{equation}
S_{q+1,m}=\sum_{k=0}^{m-1}\dbinom{m}{k}x_{q+1}^{m-k}S_{\left(  q+1\right)
-1,k}=\sum_{k=0}^{m-1}\dbinom{m}{k}x_{q+1}^{m-k}S_{q,k}
\label{sol.sums.polariz1.C2.pf.3}%
\end{equation}
(since $\left(  q+1\right)  -1=q$). However, if $k\in\left\{  0,1,\ldots
,m-1\right\}  $, then $k\leq\underbrace{m}_{\leq q}-1\leq q-1$ and therefore
$k\in\left\{  0,1,\ldots,q-1\right\}  $ (since $k$ is a nonnegative integer)
and thus%
\begin{equation}
S_{q,k}=0 \label{sol.sums.polariz1.C2.pf.4}%
\end{equation}
(by (\ref{sol.sums.polariz1.C2.pf.IH}), applied to $k$ instead of $m$). Hence,
(\ref{sol.sums.polariz1.C2.pf.3}) becomes%
\[
S_{q+1,m}=\sum_{k=0}^{m-1}\dbinom{m}{k}x_{q+1}^{m-k}\underbrace{S_{q,k}%
}_{\substack{=0\\\text{(by (\ref{sol.sums.polariz1.C2.pf.4}))}}}=\sum
_{k=0}^{m-1}\dbinom{m}{k}x_{q+1}^{m-k}0=0.
\]


Forget that we fixed $m$. We thus have shown that $S_{q+1,m}=0$ for each
$m\in\left\{  0,1,\ldots,q\right\}  $. In other words, Claim 2 holds for
$p=q+1$. This completes the induction step. Thus, Claim 2 is proved.]

Claim 2 yields part \textbf{(a)} of Exercise \ref{exe.sums.polariz1} rather
quickly (see below for the details). In order to solve part \textbf{(b)} as
well, we need another claim:

\begin{statement}
\textit{Claim 3:} We have $S_{p,p}=p!x_{1}x_{2}\cdots x_{p}$ for each
$p\in\left\{  0,1,\ldots,n\right\}  $.
\end{statement}

[\textit{Proof of Claim 3:} We proceed by induction on $p$:

\textit{Induction base:} If $p=0$, then
\begin{align*}
S_{p,p}  &  =S_{0,0}=\sum_{I\subseteq\left[  0\right]  }\left(  -1\right)
^{0-\left\vert I\right\vert }\underbrace{\left(  y+\sum_{i\in I}x_{i}\right)
^{0}}_{=1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }%
S_{0,0}\right) \\
&  =\sum_{I\subseteq\left[  0\right]  }\left(  -1\right)  ^{0-\left\vert
I\right\vert }=\sum_{I\subseteq\varnothing}\left(  -1\right)  ^{0-\left\vert
I\right\vert }\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left[  0\right]
=\varnothing\right) \\
&  =\left(  -1\right)  ^{0-\left\vert \varnothing\right\vert }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since the only subset }I\text{ of
}\varnothing\text{ is }\varnothing\right) \\
&  =1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }0-\left\vert \varnothing
\right\vert =0-0=0\text{ is even}\right) \\
&  =p!x_{1}x_{2}\cdots x_{p}%
\end{align*}
(because $p=0$ entails $p!x_{1}x_{2}\cdots x_{p}=\underbrace{0!}%
_{=1}\underbrace{x_{1}x_{2}\cdots x_{0}}_{=\left(  \text{empty product}%
\right)  =1}=1$). In other words, Claim 3 holds for $p=0$.

\textit{Induction step:} Let $q\in\left\{  0,1,\ldots,n-1\right\}  $. Assume
(as the induction hypothesis) that Claim 3 holds for $p=q$. We must prove that
Claim 3 holds for $p=q+1$.

We have assumed that Claim 3 holds for $p=q$. In other words, we have%
\begin{equation}
S_{q,q}=q!x_{1}x_{2}\cdots x_{q}. \label{sol.sums.polariz1.C3.pf.IH}%
\end{equation}


Furthermore, $q\in\left\{  0,1,\ldots,n-1\right\}  \subseteq\left\{
0,1,\ldots,n\right\}  $. Hence, each $k\in\left\{  0,1,\ldots,q-1\right\}  $
satisfies%
\begin{equation}
S_{q,k}=0 \label{sol.sums.polariz1.C3.pf.3}%
\end{equation}
(by Claim 2, applied to $p=q$ and $m=k$).

Now, $q+1\in\left\{  1,2,\ldots,n\right\}  $ (since $q\in\left\{
0,1,\ldots,n-1\right\}  $). Hence, Claim 1 (applied to $p=q+1$ and $m=q+1$)
yields%
\begin{align}
S_{q+1,q+1}  &  =\sum_{k=0}^{\left(  q+1\right)  -1}\dbinom{q+1}{k}%
x_{q+1}^{\left(  q+1\right)  -k}S_{\left(  q+1\right)  -1,k}\nonumber\\
&  =\sum_{k=0}^{q}\dbinom{q+1}{k}x_{q+1}^{\left(  q+1\right)  -k}%
S_{q,k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  q+1\right)
-1=q\right) \nonumber\\
&  =\sum_{k=0}^{q-1}\dbinom{q+1}{k}x_{q+1}^{\left(  q+1\right)  -k}%
\underbrace{S_{q,k}}_{\substack{=0\\\text{(by (\ref{sol.sums.polariz1.C3.pf.3}%
))}}}+\dbinom{q+1}{q}\underbrace{x_{q+1}^{\left(  q+1\right)  -q}}%
_{=x_{q+1}^{1}=x_{q+1}}S_{q,q}\nonumber\\
&  =\underbrace{\sum_{k=0}^{q-1}\dbinom{q+1}{k}x_{q+1}^{\left(  q+1\right)
-k}0}_{=0}+\dbinom{q+1}{q}x_{q+1}S_{q,q}\nonumber\\
&  =\dbinom{q+1}{q}x_{q+1}S_{q,q}. \label{sol.sums.polariz1.C3.pf.5}%
\end{align}


Theorem \ref{thm.binom.sym} (applied to $q+1$ and $q$ instead of $n$ and $k$)
yields%
\[
\dbinom{q+1}{q}=\dbinom{q+1}{\left(  q+1\right)  -q}=\dbinom{q+1}%
{1}=q+1\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.exa.binom.small.nC1}%
)}\right)  .
\]
Hence, (\ref{sol.sums.polariz1.C3.pf.5}) becomes%
\begin{align*}
S_{q+1,q+1}  &  =\underbrace{\dbinom{q+1}{q}}_{=q+1}x_{q+1}\underbrace{S_{q,q}%
}_{\substack{=q!x_{1}x_{2}\cdots x_{q}\\\text{(by
(\ref{sol.sums.polariz1.C3.pf.IH}))}}}=\left(  q+1\right)  x_{q+1}\cdot
q!x_{1}x_{2}\cdots x_{q}\\
&  =\underbrace{\left(  q+1\right)  \cdot q!}_{=\left(  q+1\right)  !}%
\cdot\underbrace{\left(  x_{1}x_{2}\cdots x_{q}\right)  x_{q+1}}_{=x_{1}%
x_{2}\cdots x_{q+1}}=\left(  q+1\right)  !x_{1}x_{2}\cdots x_{q+1}.
\end{align*}
In other words, Claim 3 holds for $p=q+1$. This completes the induction step.
Thus, Claim 3 is proved.]

Let us now finish the solution of Exercise \ref{exe.sums.polariz1}:

\textbf{(a)} Let $m\in\left\{  0,1,\ldots,n-1\right\}  $. Then, Claim 2
(applied to $p=n$) yields%
\[
S_{n,m}=0.
\]
But the definition of $S_{n,m}$ yields%
\[
S_{n,m}=\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{m}.
\]
Comparing these two equalities, we find%
\[
\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{m}=0.
\]
This solves Exercise \ref{exe.sums.polariz1} \textbf{(a)}.

\textbf{(b)} Claim 3 (applied to $p=n$) yields%
\[
S_{n,n}=n!x_{1}x_{2}\cdots x_{n}.
\]
But the definition of $S_{n,n}$ yields%
\[
S_{n,n}=\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{n}.
\]
Comparing these two equalities, we find%
\[
\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert
I\right\vert }\left(  y+\sum_{i\in I}x_{i}\right)  ^{n}=n!x_{1}x_{2}\cdots
x_{n}.
\]
This solves Exercise \ref{exe.sums.polariz1} \textbf{(b)}.
\end{proof}

There is an alternative solution to Exercise \ref{exe.sums.polariz1}, which
proceeds by expanding the products
\[
\left(  y+\sum_{i\in I}x_{i}\right)  ^{m}=\left(  y+\sum_{i\in I}x_{i}\right)
\left(  y+\sum_{i\in I}x_{i}\right)  \cdots\left(  y+\sum_{i\in I}%
x_{i}\right)
\]
(for all $I\subseteq\left[  n\right]  $) as sums of products of $y$'s and
$x_{i}$'s and then observing that the \textquotedblleft$\sum_{I\subseteq
\left[  n\right]  }\left(  -1\right)  ^{n-\left\vert I\right\vert }$
operator\textquotedblright\ causes all such products other than (permutations
of) $x_{1}x_{2}\cdots x_{n}$ to cancel each other. This argument (albeit only
in the particular case $y=0$, which is a bit simpler) can be found in
\cite[solution to Exercise 6]{18f-hw3s}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.sums.AMM12022a}}

\begin{proof}
[Discussion of Exercise \ref{exe.sums.AMM12022a}.]Exercise
\ref{exe.sums.AMM12022a} is an identity originally found by Euler in 1753
(\cite[\S 11]{Euler190}). It has recently reappeared as the first part of AMM
problem \#12022 (see \cite{MerJoh19} for a solution) and (in a slightly
rewritten form) in \cite[Proposition]{BiFoFo95}. The solution we give below is
a restatement of the solution from \cite{MerJoh19} (with all details expanded
and with the induction replaced by a use of the telescope principle).

\begin{proof}
[Solution to Exercise \ref{exe.sums.AMM12022a}.]First of all, let us see why
the fractions appearing in Exercise \ref{exe.sums.AMM12022a} are well-defined
in the first place. Indeed, all powers $x^{1},x^{2},x^{3},\ldots$ of $x$ are
distinct from $1$ (since $x\in\mathbb{R}\setminus\left\{  1,-1\right\}  $).
Hence, all the numbers $1-x^{1},1-x^{2},1-x^{3},\ldots$ are nonzero. In other
words, all the numbers $y_{1},y_{2},y_{3},\ldots$ are nonzero (since
$y_{i}=1-x^{i}$ for each integer $i\geq1$). Therefore, the denominators of the
fractions $\dfrac{y_{n}y_{n-1}\cdots y_{n-k}}{y_{k+1}}$ in Exercise
\ref{exe.sums.AMM12022a} are nonzero, so the fractions are well-defined. This
shows that Exercise \ref{exe.sums.AMM12022a} makes sense.

For any two numbers $p\in\left\{  0,1,\ldots,n\right\}  $ and $k\in\left\{
0,1,\ldots,n\right\}  $ satisfying $p\geq k$, we set%
\begin{equation}
b_{p,k}=\dfrac{y_{p}y_{p-1}\cdots y_{p-k}}{y_{k+1}}
\label{pf.prop.sums.AMM12022a.gen.bpk=}%
\end{equation}
and%
\begin{equation}
c_{p,k}=y_{p-1}y_{p-2}\cdots y_{p-k}. \label{pf.prop.sums.AMM12022a.gen.cpk=}%
\end{equation}
Now, an easy computation reveals the following:

\begin{statement}
\textit{Claim 1:} For any two numbers $p\in\left\{  0,1,\ldots,n\right\}  $
and $k\in\left\{  0,1,\ldots,n\right\}  $ satisfying $p-1\geq k$, we have
\[
b_{p,k}-b_{p-1,k}=c_{p,k}-c_{p,k+1}.
\]

\end{statement}

[\textit{Proof of Claim 1:} Let $p\in\left\{  0,1,\ldots,n\right\}  $ and
$k\in\left\{  0,1,\ldots,n\right\}  $ be two numbers satisfying $p-1\geq k$.
Then, $p-1\geq k\geq0$ and $p-1\leq p\leq n$ (since $p\in\left\{
0,1,\ldots,n\right\}  $). Combining these two inequalities, we obtain
$p-1\in\left\{  0,1,\ldots,n\right\}  $. Hence, $b_{p-1,k}$ is well-defined.
Also, $p>p-1\geq k$; hence, $b_{p,k}$ and $c_{p,k}$ are well-defined. Finally,
$p-1\geq k$ entails $p\geq k+1$, so that $k+1\leq p\leq n$ and therefore
$k+1\in\left\{  0,1,\ldots,n\right\}  $. Hence, $c_{p,k+1}$ is well-defined.

Now, we have%
\begin{align*}
b_{p,k}  &  =\dfrac{y_{p}y_{p-1}\cdots y_{p-k}}{y_{k+1}}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }b_{p,k}\right) \\
&  =\dfrac{1}{y_{k+1}}\cdot\underbrace{y_{p}y_{p-1}\cdots y_{p-k}}%
_{=y_{p}\cdot y_{p-1}y_{p-2}\cdots y_{p-k}}=\dfrac{1}{y_{k+1}}\cdot y_{p}\cdot
y_{p-1}y_{p-2}\cdots y_{p-k}%
\end{align*}
and%
\begin{align*}
b_{p-1,k}  &  =\dfrac{y_{p-1}y_{\left(  p-1\right)  -1}\cdots y_{\left(
p-1\right)  -k}}{y_{k+1}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition
of }b_{p-1,k}\right) \\
&  =\dfrac{y_{p-1}y_{p-2}\cdots y_{p-k-1}}{y_{k+1}}=\dfrac{1}{y_{k+1}}%
\cdot\underbrace{y_{p-1}y_{p-2}\cdots y_{p-k-1}}_{=y_{p-1}y_{p-2}\cdots
y_{p-k}\cdot y_{p-k-1}}\\
&  =\dfrac{1}{y_{k+1}}\cdot y_{p-1}y_{p-2}\cdots y_{p-k}\cdot y_{p-k-1}%
=\dfrac{1}{y_{k+1}}\cdot y_{p-k-1}\cdot y_{p-1}y_{p-2}\cdots y_{p-k}.
\end{align*}
Subtracting these two equalities from one another, we obtain%
\begin{align}
b_{p,k}-b_{p-1,k}  &  =\dfrac{1}{y_{k+1}}\cdot y_{p}\cdot y_{p-1}y_{p-2}\cdots
y_{p-k}-\dfrac{1}{y_{k+1}}\cdot y_{p-k-1}\cdot y_{p-1}y_{p-2}\cdots
y_{p-k}\nonumber\\
&  =\dfrac{1}{y_{k+1}}\cdot\left(  y_{p}-y_{p-k-1}\right)  \cdot
y_{p-1}y_{p-2}\cdots y_{p-k}. \label{pf.prop.sums.AMM12022a.gen.1.pf.1}%
\end{align}


On the other hand, $y_{p}=1-x^{p}$ (by the definition of $y_{p}$) and
$y_{p-k-1}=1-x^{p-k-1}$ (by the definition of $y_{p-k-1}$). Subtracting these
two equalities from one another, we obtain%
\begin{align*}
y_{p}-y_{p-k-1}  &  =\left(  1-x^{p}\right)  -\left(  1-x^{p-k-1}\right)
=x^{p-k-1}-x^{p}\\
&  =\underbrace{\left(  1-x^{k+1}\right)  }_{\substack{=y_{k+1}\\\text{(since
}y_{k+1}\text{ is}\\\text{defined as }1-x^{k+1}\text{)}}%
}\ \ \underbrace{x^{p-k-1}}_{\substack{=1-y_{p-k-1}\\\text{(since }%
y_{p-k-1}=1-x^{p-k-1}\text{)}}}=y_{k+1}\left(  1-y_{p-k-1}\right)  .
\end{align*}
Thus, (\ref{pf.prop.sums.AMM12022a.gen.1.pf.1}) becomes%
\begin{align*}
b_{p,k}-b_{p-1,k}  &  =\dfrac{1}{y_{k+1}}\cdot\underbrace{\left(
y_{p}-y_{p-k-1}\right)  }_{=y_{k+1}\left(  1-y_{p-k-1}\right)  }\cdot
y_{p-1}y_{p-2}\cdots y_{p-k}\\
&  =\dfrac{1}{y_{k+1}}\cdot y_{k+1}\left(  1-y_{p-k-1}\right)  \cdot
y_{p-1}y_{p-2}\cdots y_{p-k}\\
&  =\left(  1-y_{p-k-1}\right)  \cdot y_{p-1}y_{p-2}\cdots y_{p-k}.
\end{align*}
Comparing this with%
\begin{align*}
&  \underbrace{c_{p,k}}_{\substack{=y_{p-1}y_{p-2}\cdots y_{p-k}\\\text{(by
the definition of }c_{p,k}\text{)}}}-\underbrace{c_{p,k+1}}%
_{\substack{=y_{p-1}y_{p-2}\cdots y_{p-\left(  k+1\right)  }\\\text{(by the
definition of }c_{p,k+1}\text{)}}}\\
&  =y_{p-1}y_{p-2}\cdots y_{p-k}-\underbrace{y_{p-1}y_{p-2}\cdots y_{p-\left(
k+1\right)  }}_{\substack{=y_{p-1}y_{p-2}\cdots y_{p-k-1}\\=y_{p-1}%
y_{p-2}\cdots y_{p-k}\cdot y_{p-k-1}}}\\
&  =y_{p-1}y_{p-2}\cdots y_{p-k}-y_{p-1}y_{p-2}\cdots y_{p-k}\cdot y_{p-k-1}\\
&  =y_{p-1}y_{p-2}\cdots y_{p-k}\cdot\left(  1-y_{p-k-1}\right)  =\left(
1-y_{p-k-1}\right)  \cdot y_{p-1}y_{p-2}\cdots y_{p-k},
\end{align*}
we obtain $b_{p,k}-b_{p-1,k}=c_{p,k}-c_{p,k+1}$. This proves Claim 1.]

Another easy computation yields the following:

\begin{statement}
\textit{Claim 2:} For each $p\in\left\{  1,2,\ldots,n\right\}  $, we have
\[
b_{p,p-1}=c_{p,p-1}.
\]

\end{statement}

[\textit{Proof of Claim 2:} Let $p\in\left\{  1,2,\ldots,n\right\}  $. Thus,
both $p$ and $p-1$ belong to $\left\{  0,1,\ldots,n\right\}  $. Hence, both
$b_{p,p-1}$ and $c_{p,p-1}$ are well-defined (since $p\geq p-1$). Comparing
\begin{align*}
b_{p,p-1}  &  =\dfrac{y_{p}y_{p-1}\cdots y_{p-\left(  p-1\right)  }%
}{y_{\left(  p-1\right)  +1}}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the
definition of }b_{p,p-1}\right) \\
&  =\dfrac{y_{p}y_{p-1}\cdots y_{1}}{y_{p}}=y_{p-1}y_{p-2}\cdots y_{1}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }p\geq1\text{ and thus }%
y_{p}y_{p-1}\cdots y_{1}=y_{p}\cdot y_{p-1}y_{p-2}\cdots y_{1}\right)
\end{align*}
with%
\begin{align*}
c_{p,p-1}  &  =y_{p-1}y_{p-2}\cdots y_{p-\left(  p-1\right)  }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }c_{p,p-1}\right) \\
&  =y_{p-1}y_{p-2}\cdots y_{1},
\end{align*}
we obtain $b_{p,p-1}=c_{p,p-1}$. This proves Claim 2.]

For each $p\in\left\{  1,2,\ldots,n\right\}  $, set%
\begin{equation}
S_{p}=\sum_{k=0}^{p-1}b_{p,k}. \label{sol.sums.AMM12022a.Sp=}%
\end{equation}


Now, we claim the following:

\begin{statement}
\textit{Claim 3:} For any $p\in\left\{  1,2,\ldots,n\right\}  $, we have%
\[
S_{p}-S_{p-1}=1.
\]

\end{statement}

[\textit{Proof of Claim 3:} Fix $p\in\left\{  1,2,\ldots,n\right\}  $. Then,
$p\geq1$, so that $p-1\geq0$. The definition of $S_{p}$ yields%
\[
S_{p}=\sum_{k=0}^{p-1}b_{p,k}=b_{p,p-1}+\sum_{k=0}^{p-2}b_{p,k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }p-1\geq0\right)  .
\]
Meanwhile, the definition of $S_{p-1}$ yields%
\[
S_{p-1}=\sum_{k=0}^{\left(  p-1\right)  -1}b_{p-1,k}=\sum_{k=0}^{p-2}%
b_{p-1,k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  p-1\right)
-1=p-2\right)  .
\]
Subtracting these two equalities from one another, we obtain%
\begin{align*}
S_{p}-S_{p-1}  &  =\left(  b_{p,p-1}+\sum_{k=0}^{p-2}b_{p,k}\right)
-\sum_{k=0}^{p-2}b_{p-1,k}=b_{p,p-1}+\underbrace{\sum_{k=0}^{p-2}b_{p,k}%
-\sum_{k=0}^{p-2}b_{p-1,k}}_{=\sum_{k=0}^{p-2}\left(  b_{p,k}-b_{p-1,k}%
\right)  }\\
&  =b_{p,p-1}+\sum_{k=0}^{p-2}\left(  b_{p,k}-b_{p-1,k}\right)  .
\end{align*}
In view of%
\begin{align*}
&  \sum_{k=0}^{p-2}\underbrace{\left(  b_{p,k}-b_{p-1,k}\right)
}_{\substack{=c_{p,k}-c_{p,k+1}\\\text{(by Claim 1}\\\text{(since }k\leq
p-2<p-1\text{ and thus }p-1\geq k\text{))}}}\\
&  =\sum_{k=0}^{p-2}\underbrace{\left(  c_{p,k}-c_{p,k+1}\right)  }_{=\left(
-c_{p,k+1}\right)  -\left(  -c_{p,k}\right)  }=\sum_{k=0}^{p-2}\left(  \left(
-c_{p,k+1}\right)  -\left(  -c_{p,k}\right)  \right) \\
&  =\sum_{i=0}^{p-2}\left(  \left(  -c_{p,i+1}\right)  -\left(  -c_{p,i}%
\right)  \right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the}\\
\text{summation index }k\text{ as }i
\end{array}
\right) \\
&  =\left(  -c_{p,\left(  p-2\right)  +1}\right)  -\left(  -c_{p,0}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Corollary \ref{cor.seqsum.telesc-pos},
applied to }u=0\text{ and }v=p-2\text{ and }a_{i}=-c_{p,i}\right) \\
&  =c_{p,0}-c_{p,\left(  p-2\right)  +1}=c_{p,0}-c_{p,p-1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  p-2\right)  +1=p-1\right)  ,
\end{align*}
this becomes%
\begin{align*}
S_{p}-S_{p-1}  &  =\underbrace{b_{p,p-1}}_{\substack{=c_{p,p-1}\\\text{(by
Claim 2)}}}+\underbrace{\sum_{k=0}^{p-2}\left(  b_{p,k}-b_{p-1,k}\right)
}_{=c_{p,0}-c_{p,p-1}}=c_{p,p-1}+c_{p,0}-c_{p,p-1}\\
&  =c_{p,0}=y_{p-1}y_{p-2}\cdots y_{p-0}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
the definition of }c_{p,0}\right) \\
&  =\left(  \text{empty product}\right)  =1.
\end{align*}
This proves Claim 3.]

Now,
\[
\sum_{p=1}^{n}\underbrace{\left(  S_{p}-S_{p-1}\right)  }%
_{\substack{=1\\\text{(by Claim 3)}}}=\sum_{p=1}^{n}1=n\cdot1=n.
\]
Hence,%
\begin{align*}
n  &  =\sum_{p=1}^{n}\left(  S_{p}-S_{p-1}\right)  =\sum_{s=1}^{n}\left(
S_{s}-S_{s-1}\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the}\\
\text{summation index }p\text{ as }s
\end{array}
\right) \\
&  =\underbrace{S_{n}}_{\substack{=\sum_{k=0}^{n-1}b_{n,k}\\\text{(by the
definition of }S_{n}\text{)}}}-\underbrace{S_{1-1}}_{\substack{=S_{0}%
=\sum_{k=0}^{0-1}b_{0,k}\\\text{(by the definition of }S_{0}\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.seqsum.telesc},
applied to }u=1\text{ and }v=n\text{ and }a_{s}=S_{s}\right) \\
&  =\sum_{k=0}^{n-1}\underbrace{b_{n,k}}_{\substack{=\dfrac{y_{n}y_{n-1}\cdots
y_{n-k}}{y_{k+1}}\\\text{(by the definition of }b_{n,k}\text{)}}%
}-\underbrace{\sum_{k=0}^{0-1}b_{0,k}}_{=\left(  \text{empty sum}\right)
=0}=\sum_{k=0}^{n-1}\dfrac{y_{n}y_{n-1}\cdots y_{n-k}}{y_{k+1}}.
\end{align*}
This solves Exercise \ref{exe.sums.AMM12022a}.
\end{proof}

Let us note in passing that we can prove the following generalization of
Exercise \ref{exe.sums.AMM12022a}:

\begin{proposition}
\label{prop.sums.AMM12022a.gen}Let $n\in\mathbb{N}$ and $x\in\mathbb{R}%
\setminus\left\{  1,-1\right\}  $. For each $i\in\mathbb{N}$, set
$y_{i}=1-x^{i}$. Let $m\in\left\{  0,1,\ldots,n\right\}  $. Then,%
\begin{equation}
\sum_{k=m}^{n-1}\dfrac{y_{n}y_{n-1}\cdots y_{n-k}}{y_{k+1}}=\sum_{p=m+1}%
^{n}y_{p-1}y_{p-2}\cdots y_{p-m}. \label{eq.prop.sums.AMM12022a.gen.eq}%
\end{equation}

\end{proposition}

Exercise \ref{exe.sums.AMM12022a} is easily seen to be the particular case of
Proposition \ref{prop.sums.AMM12022a.gen} for $m=0$. Our below proof of
Proposition \ref{prop.sums.AMM12022a.gen} is a lazy adaptation of our above
solution to Exercise \ref{exe.sums.AMM12022a}.

\begin{proof}
[Proof of Proposition \ref{prop.sums.AMM12022a.gen}.]We proceed precisely as
in the above solution to Exercise \ref{exe.sums.AMM12022a} until the point
where we define $S_{p}$. From that point on, we proceed as follows:

For each $p\in\left\{  m,m+1,\ldots,n\right\}  $, set%
\[
T_{p}=\sum_{k=m}^{p-1}b_{p,k}.
\]


(Note that if $m=0$, then $T_{p}$ is the $S_{p}$ from our above solution to
Exercise \ref{exe.sums.AMM12022a}.)

Now, we claim the following:

\begin{statement}
\textit{Claim 4:} For any $p\in\left\{  m+1,m+2,\ldots,n\right\}  $, we have%
\[
T_{p}-T_{p-1}=c_{p,m}.
\]

\end{statement}

[\textit{Proof of Claim 4:} Fix $p\in\left\{  m+1,m+2,\ldots,n\right\}  $.
Then, $p\geq m+1$, so that $p-1\geq m$. Both $p$ and $p-1$ belong to the set
$\left\{  m,m+1,\ldots,n\right\}  $ (since $p\in\left\{  m+1,m+2,\ldots
,n\right\}  $). Hence, $T_{p}$ and $T_{p-1}$ are well-defined. The definition
of $T_{p}$ yields%
\[
T_{p}=\sum_{k=m}^{p-1}b_{p,k}=b_{p,p-1}+\sum_{k=m}^{p-2}b_{p,k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }p-1\geq m\right)  .
\]
Meanwhile, the definition of $T_{p-1}$ yields%
\[
T_{p-1}=\sum_{k=m}^{\left(  p-1\right)  -1}b_{p-1,k}=\sum_{k=m}^{p-2}%
b_{p-1,k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  p-1\right)
-1=p-2\right)  .
\]
Subtracting these two equalities from one another, we obtain%
\begin{align*}
T_{p}-T_{p-1}  &  =\left(  b_{p,p-1}+\sum_{k=m}^{p-2}b_{p,k}\right)
-\sum_{k=m}^{p-2}b_{p-1,k}=b_{p,p-1}+\underbrace{\sum_{k=m}^{p-2}b_{p,k}%
-\sum_{k=m}^{p-2}b_{p-1,k}}_{=\sum_{k=m}^{p-2}\left(  b_{p,k}-b_{p-1,k}%
\right)  }\\
&  =b_{p,p-1}+\sum_{k=m}^{p-2}\left(  b_{p,k}-b_{p-1,k}\right)  .
\end{align*}
In view of%
\begin{align*}
&  \sum_{k=m}^{p-2}\underbrace{\left(  b_{p,k}-b_{p-1,k}\right)
}_{\substack{=c_{p,k}-c_{p,k+1}\\\text{(by Claim 1}\\\text{(since }k\leq
p-2<p-1\text{ and thus }p-1\geq k\text{))}}}\\
&  =\sum_{k=m}^{p-2}\underbrace{\left(  c_{p,k}-c_{p,k+1}\right)  }_{=\left(
-c_{p,k+1}\right)  -\left(  -c_{p,k}\right)  }=\sum_{k=m}^{p-2}\left(  \left(
-c_{p,k+1}\right)  -\left(  -c_{p,k}\right)  \right) \\
&  =\sum_{i=m}^{p-2}\left(  \left(  -c_{p,i+1}\right)  -\left(  -c_{p,i}%
\right)  \right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the}\\
\text{summation index }k\text{ as }i
\end{array}
\right) \\
&  =\left(  -c_{p,\left(  p-2\right)  +1}\right)  -\left(  -c_{p,m}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Corollary \ref{cor.seqsum.telesc-pos},
applied to }u=m\text{ and }v=p-2\text{ and }a_{i}=-c_{p,i}\right) \\
&  =c_{p,m}-c_{p,\left(  p-2\right)  +1}=c_{p,m}-c_{p,p-1}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  p-2\right)  +1=p-1\right)  ,
\end{align*}
this becomes%
\[
T_{p}-T_{p-1}=\underbrace{b_{p,p-1}}_{\substack{=c_{p,p-1}\\\text{(by Claim
2)}}}+\underbrace{\sum_{k=m}^{p-2}\left(  b_{p,k}-b_{p-1,k}\right)
}_{=c_{p,m}-c_{p,p-1}}=c_{p,p-1}+c_{p,m}-c_{p,p-1}=c_{p,m}.
\]
This proves Claim 4.]

Now,
\[
\sum_{p=m+1}^{n}\underbrace{\left(  T_{p}-T_{p-1}\right)  }%
_{\substack{=c_{p,m}\\\text{(by Claim 4)}}}=\sum_{p=m+1}^{n}%
\underbrace{c_{p,m}}_{\substack{=y_{p-1}y_{p-2}\cdots y_{p-m}\\\text{(by the
definition of }c_{p,m}\text{)}}}=\sum_{p=m+1}^{n}y_{p-1}y_{p-2}\cdots
y_{p-m}.
\]
Hence,%
\begin{align*}
&  \sum_{p=m+1}^{n}y_{p-1}y_{p-2}\cdots y_{p-m}\\
&  =\sum_{p=m+1}^{n}\left(  T_{p}-T_{p-1}\right)  =\sum_{s=m+1}^{n}\left(
T_{s}-T_{s-1}\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have renamed the}\\
\text{summation index }p\text{ as }s
\end{array}
\right) \\
&  =\underbrace{T_{n}}_{\substack{=\sum_{k=m}^{n-1}b_{n,k}\\\text{(by the
definition of }T_{n}\text{)}}}-\underbrace{T_{\left(  m+1\right)  -1}%
}_{\substack{=T_{m}=\sum_{k=m}^{m-1}b_{m,k}\\\text{(by the definition of
}T_{m}\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.seqsum.telesc},
applied to }u=m+1\text{ and }v=n\text{ and }a_{s}=T_{s}\right) \\
&  =\sum_{k=m}^{n-1}\underbrace{b_{n,k}}_{\substack{=\dfrac{y_{n}y_{n-1}\cdots
y_{n-k}}{y_{k+1}}\\\text{(by the definition of }b_{n,k}\text{)}}%
}-\underbrace{\sum_{k=m}^{m-1}b_{m,k}}_{=\left(  \text{empty sum}\right)
=0}=\sum_{k=m}^{n-1}\dfrac{y_{n}y_{n-1}\cdots y_{n-k}}{y_{k+1}}.
\end{align*}
This proves Proposition \ref{prop.sums.AMM12022a.gen}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.0-1-2-6}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.0-1-2-6}.]It is easy to realize that
$a_{n}$ is a multiple of $n!$ for each $n\in\mathbb{N}$. (Indeed, this is
clearly true for $n=0$ and for $n=1$, while for higher $n$ it follows by
induction using the recursion $a_{n}=n\left(  a_{n-1}+\left(  n-1\right)
a_{n-2}\right)  $). In other words, $\dfrac{a_{n}}{n!}$ is an integer for each
$n\in\mathbb{N}$. This suggests that we should study the sequence $\left(
\dfrac{a_{0}}{0!},\dfrac{a_{1}}{1!},\dfrac{a_{2}}{2!},\ldots\right)  $ instead
of the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $. The recursion
$a_{n}=n\left(  a_{n-1}+\left(  n-1\right)  a_{n-2}\right)  $ (which holds for
each $n\geq2$) can now be easily rewritten in terms of the new sequence
$\left(  \dfrac{a_{0}}{0!},\dfrac{a_{1}}{1!},\dfrac{a_{2}}{2!},\ldots\right)
$ as $\dfrac{a_{n}}{n!}=\dfrac{a_{n-1}}{\left(  n-1\right)  !}+\dfrac{a_{n-2}%
}{\left(  n-2\right)  !}$ (because $n!=n\cdot\left(  n-1\right)  !=n\left(
n-1\right)  \cdot\left(  n-2\right)  !$); but this is precisely the recursion
of the Fibonacci sequence. Its starting values $\dfrac{a_{0}}{0!}=0$ and
$\dfrac{a_{1}}{1!}=1$, too, are identical with those of the Fibonacci
sequence. Thus, we conclude that the sequence $\left(  \dfrac{a_{0}}%
{0!},\dfrac{a_{1}}{1!},\dfrac{a_{2}}{2!},\ldots\right)  $ must be the
Fibonacci sequence. In other words,
\[
\dfrac{a_{n}}{n!}=f_{n}\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}%
\]
(where $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ is the Fibonacci sequence).
In other words,%
\begin{equation}
a_{n}=n!\cdot f_{n}\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\label{sol.seqs.0-1-2-6.goal}%
\end{equation}


It is easy to restate the above derivation of (\ref{sol.seqs.0-1-2-6.goal}) as
a rigorous proof by strong induction on $n$.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.gcd.qedmo5a1-uv}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.gcd.qedmo5a1-uv}.]There are many
approaches to Exercise \ref{exe.ent.gcd.qedmo5a1-uv}. The most
\textquotedblleft systematic\textquotedblright\ approach is by showing that
both sequences $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ and $\left(
b_{0},b_{1},b_{2},\ldots\right)  $ are $\left(  2u,v^{2}-u^{2}\right)
$-recurrent\footnote{Indeed, for each $n\geq2$, we have the three equalities%
\[
\left\{
\begin{array}
[c]{c}%
a_{n}=ua_{n-1}+vb_{n-1};\\
a_{n-1}=ua_{n-2}+vb_{n-2};\\
b_{n-1}=ub_{n-2}+va_{n-2}.
\end{array}
\right.
\]
Eliminating $b_{n-1}$ and $b_{n-2}$ from them (for example, by using the first
equality to express $b_{n-1}$ through $a_{n}$ and $a_{n-1}$, then using the
second equality to express $b_{n-2}$ through $a_{n-1}$ and $a_{n-2}$, then
substituting the resulting two expressions into the third equality), we obtain%
\[
a_{n}=2ua_{n-1}+\left(  v^{2}-u^{2}\right)  a_{n-2}.
\]
Thus, the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is $\left(
2u,v^{2}-u^{2}\right)  $-recurrent. Similarly, the same holds for the sequence
$\left(  b_{0},b_{1},b_{2},\ldots\right)  $.
\par
A more conceptual way to show this uses the Cayley--Hamilton theorem. Namely,
the recursions
\[
a_{n}=ua_{n-1}+vb_{n-1}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ b_{n}%
=ub_{n-1}+va_{n-1}%
\]
can be combined into a single matrix equation%
\[
\left(
\begin{array}
[c]{c}%
a_{n}\\
b_{n}%
\end{array}
\right)  =\left(
\begin{array}
[c]{cc}%
u & v\\
v & u
\end{array}
\right)  \left(
\begin{array}
[c]{c}%
a_{n-1}\\
b_{n-1}%
\end{array}
\right)  .
\]
We can rewrite this equation as%
\[
w_{n}=Aw_{n-1},\ \ \ \ \ \ \ \ \ \ \text{where }A=\left(
\begin{array}
[c]{cc}%
u & v\\
v & u
\end{array}
\right)  \text{ and }w_{i}=\left(
\begin{array}
[c]{c}%
a_{i}\\
b_{i}%
\end{array}
\right)  \text{ for each }i\in\mathbb{N}.
\]
Now, the characteristic polynomial of $A$ is $X^{2}-2uX-\left(  v^{2}%
-u^{2}\right)  $; thus, the Cayley--Hamilton theorem yields $A^{2}-2uA-\left(
v^{2}-u^{2}\right)  I_{2}=0$ (where $I_{2}$ is the $2\times2$ identity
matrix). Thus,%
\[
\underbrace{\left(  A^{2}-2uA-\left(  v^{2}-u^{2}\right)  I_{2}\right)  }%
_{=0}w_{n}=0\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]
In view of%
\begin{align*}
\left(  A^{2}-2uA-\left(  v^{2}-u^{2}\right)  I_{2}\right)  w_{n}  &
=\underbrace{A^{2}w_{n}}_{\substack{=AAw_{n}=Aw_{n+1}\\\text{(since }%
Aw_{n}=w_{n+1}\text{)}}}-2u\underbrace{Aw_{n}}_{=w_{n+1}}-\left(  v^{2}%
-u^{2}\right)  \underbrace{I_{2}w_{n}}_{=w_{n}}\\
&  =\underbrace{Aw_{n+1}}_{=w_{n+2}}-2uw_{n+1}-\left(  v^{2}-u^{2}\right)
w_{n}\\
&  =w_{n+2}-2uw_{n+1}-\left(  v^{2}-u^{2}\right)  w_{n}\\
&  =\left(
\begin{array}
[c]{c}%
a_{n+2}\\
b_{n+2}%
\end{array}
\right)  -2u\left(
\begin{array}
[c]{c}%
a_{n+1}\\
b_{n+1}%
\end{array}
\right)  -\left(  v^{2}-u^{2}\right)  \left(
\begin{array}
[c]{c}%
a_{n}\\
b_{n}%
\end{array}
\right) \\
&  =\left(
\begin{array}
[c]{c}%
a_{n+2}-2ua_{n+1}-\left(  v^{2}-u^{2}\right)  a_{n}\\
b_{n+2}-2ub_{n+1}-\left(  v^{2}-u^{2}\right)  b_{n}%
\end{array}
\right)  ,
\end{align*}
this rewrites as $\left(
\begin{array}
[c]{c}%
a_{n+2}-2ua_{n+1}-\left(  v^{2}-u^{2}\right)  a_{n}\\
b_{n+2}-2ub_{n+1}-\left(  v^{2}-u^{2}\right)  b_{n}%
\end{array}
\right)  =0$. In other words, $a_{n+2}-2ua_{n+1}-\left(  v^{2}-u^{2}\right)
a_{n}=0$ and $b_{n+2}-2ub_{n+1}-\left(  v^{2}-u^{2}\right)  b_{n}=0$. Since we
have shown this for each $n\in\mathbb{N}$, we thus conclude that both
sequences $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ and $\left(  b_{0}%
,b_{1},b_{2},\ldots\right)  $ are $\left(  2u,v^{2}-u^{2}\right)  $-recurrent.
The main advantage of this argument is its generalizability (to more than two
sequences and higher-order recurrences).}, and then applying Theorem
\ref{thm.rec.binet} to obtain an explicit formula for them. But this is
laborious. A simpler solution can be given using an utterly trivial lemma:

\begin{lemma}
\label{lem.xy-ab}Let $a$ and $b$ be two numbers. Let $s=a+b$ and $d=a-b$.
Then, $a=\dfrac{s+d}{2}$ and $b=\dfrac{s-d}{2}$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.xy-ab}.]From $s=a+b$ and $d=a-b$, we obtain
\[
\dfrac{s+d}{2}=\dfrac{\left(  a+b\right)  +\left(  a-b\right)  }%
{2}=a\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \dfrac{s-d}{2}%
=\dfrac{\left(  a+b\right)  -\left(  a-b\right)  }{2}=b.
\]
This proves Lemma \ref{lem.xy-ab}.
\end{proof}

Harmless as it is, Lemma \ref{lem.xy-ab} suggests a useful trick: Any two
numbers can be reconstructed from their sum and their difference. Sometimes,
these sums and differences are easier to handle than the original two numbers,
so it can be a good idea to work with the sum and the difference for as long
as possible. Nothing is lost when doing so, since Lemma \ref{lem.xy-ab} allows
recovering the original numbers.

Let us now solve Exercise \ref{exe.ent.gcd.qedmo5a1-uv} using this trick:

\begin{proof}
[Solution to Exercise \ref{exe.ent.gcd.qedmo5a1-uv}.]For each $n\in\mathbb{N}%
$, we define two numbers%
\[
s_{n}=a_{n}+b_{n}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ d_{n}%
=a_{n}-b_{n}.
\]
Then, for each $n\in\mathbb{N}$, we have%
\begin{equation}
a_{n}=\dfrac{s_{n}+d_{n}}{2}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ b_{n}=\dfrac{s_{n}-d_{n}}{2}
\label{sol.ent.gcd.qedmo5a1-uv.ab-from-sd}%
\end{equation}
(by Lemma \ref{lem.xy-ab}, applied to $a_{n}$, $b_{n}$, $s_{n}$ and $d_{n}$
instead of $a$, $b$, $s$ and $d$).

Now, each integer $n\geq1$ satisfies%
\[
a_{n}=ua_{n-1}+vb_{n-1}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ b_{n}%
=ub_{n-1}+va_{n-1}%
\]
(by the recursive definition of the sequences $\left(  a_{0},a_{1}%
,a_{2},\ldots\right)  $ and $\left(  b_{0},b_{1},b_{2},\ldots\right)  $) and
therefore%
\begin{align}
s_{n}  &  =\underbrace{a_{n}}_{=ua_{n-1}+vb_{n-1}}+\underbrace{b_{n}%
}_{=ub_{n-1}+va_{n-1}}=ua_{n-1}+vb_{n-1}+ub_{n-1}+va_{n-1}\nonumber\\
&  =\left(  u+v\right)  \underbrace{\left(  a_{n-1}+b_{n-1}\right)
}_{\substack{=s_{n-1}\\\text{(since }s_{n-1}\text{ was defined as }%
a_{n-1}+b_{n-1}\text{)}}}=\left(  u+v\right)  s_{n-1}
\label{sol.ent.gcd.qedmo5a1-uv.sn-rec}%
\end{align}
and%
\begin{align}
d_{n}  &  =\underbrace{a_{n}}_{=ua_{n-1}+vb_{n-1}}-\underbrace{b_{n}%
}_{=ub_{n-1}+va_{n-1}}=ua_{n-1}+vb_{n-1}-\left(  ub_{n-1}+va_{n-1}\right)
\nonumber\\
&  =\left(  u-v\right)  \underbrace{\left(  a_{n-1}-b_{n-1}\right)
}_{\substack{=d_{n-1}\\\text{(since }d_{n-1}\text{ was defined as }%
a_{n-1}-b_{n-1}\text{)}}}=\left(  u-v\right)  d_{n-1}.
\label{sol.ent.gcd.qedmo5a1-uv.dn-rec}%
\end{align}


The equality (\ref{sol.ent.gcd.qedmo5a1-uv.sn-rec}) holding for each $n\geq1$
shows that the sequence $\left(  s_{0},s_{1},s_{2},\ldots\right)  $ is a
geometric progression with ratio $u+v$. Therefore,%
\begin{equation}
s_{n}=\left(  u+v\right)  ^{n}s_{0}\ \ \ \ \ \ \ \ \ \ \text{for each }%
n\in\mathbb{N}. \label{sol.ent.gcd.qedmo5a1-uv.sn-exp}%
\end{equation}
\footnote{For the sake of completeness, here is the (entirely straightforward)
\textit{proof of (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}):}
\par
We shall prove (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) by induction on $n$:
\par
\textit{Induction base:} We have $s_{0}=\left(  u+v\right)  ^{0}s_{0}$ (since
$\underbrace{\left(  u+v\right)  ^{0}}_{=1}s_{0}=s_{0}$). In other words,
(\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) holds for $n=0$.
\par
\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) holds for $n=m$. We
must prove that (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) holds for $n=m+1$.
\par
We have assumed that (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) holds for $n=m$.
In other words, we have $s_{m}=\left(  u+v\right)  ^{m}s_{0}$. But $m+1\geq1$;
hence, (\ref{sol.ent.gcd.qedmo5a1-uv.sn-rec}) (applied to $n=m+1$) yields
$s_{m+1}=\left(  u+v\right)  \underbrace{s_{\left(  m+1\right)  -1}}%
_{=s_{m}=\left(  u+v\right)  ^{m}s_{0}}=\underbrace{\left(  u+v\right)
\left(  u+v\right)  ^{m}}_{=\left(  u+v\right)  ^{m+1}}s_{0}=\left(
u+v\right)  ^{m+1}s_{0}$. In other words,
(\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) holds for $n=m+1$. This completes the
induction step. Thus, (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}) is proved.}
Likewise, we find that%
\begin{equation}
d_{n}=\left(  u-v\right)  ^{n}d_{0}\ \ \ \ \ \ \ \ \ \ \text{for each }%
n\in\mathbb{N}. \label{sol.ent.gcd.qedmo5a1-uv.dn-exp}%
\end{equation}
\footnote{The proof of (\ref{sol.ent.gcd.qedmo5a1-uv.dn-exp}) is analogous to
the proof of (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}), once the obvious changes
are made (viz., we must use (\ref{sol.ent.gcd.qedmo5a1-uv.dn-rec}) instead of
(\ref{sol.ent.gcd.qedmo5a1-uv.sn-rec}), and we must replace $s_{k}$ and $u+v$
by $d_{k}$ and $u-v$, respectively).}

Now, for each $n\in\mathbb{N}$, we have%
\begin{align*}
a_{n}  &  =\dfrac{s_{n}+d_{n}}{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.gcd.qedmo5a1-uv.ab-from-sd})}\right) \\
&  =\dfrac{1}{2}\left(  \underbrace{s_{n}}_{\substack{=\left(  u+v\right)
^{n}s_{0}\\\text{(by (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}))}}%
}+\underbrace{d_{n}}_{\substack{=\left(  u-v\right)  ^{n}d_{0}\\\text{(by
(\ref{sol.ent.gcd.qedmo5a1-uv.dn-exp}))}}}\right) \\
&  =\dfrac{1}{2}\left(  \left(  u+v\right)  ^{n}\underbrace{s_{0}%
}_{\substack{=a_{0}+b_{0}\\\text{(by the definition of }s_{0}\text{)}%
}}+\left(  u-v\right)  ^{n}\underbrace{d_{0}}_{\substack{=a_{0}-b_{0}%
\\\text{(by the definition of }d_{0}\text{)}}}\right) \\
&  =\dfrac{1}{2}\left(  \left(  u+v\right)  ^{n}\left(  a_{0}+b_{0}\right)
+\left(  u-v\right)  ^{n}\left(  a_{0}-b_{0}\right)  \right)
\end{align*}
and%
\begin{align*}
b_{n}  &  =\dfrac{s_{n}-d_{n}}{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ent.gcd.qedmo5a1-uv.ab-from-sd})}\right) \\
&  =\dfrac{1}{2}\left(  \underbrace{s_{n}}_{\substack{=\left(  u+v\right)
^{n}s_{0}\\\text{(by (\ref{sol.ent.gcd.qedmo5a1-uv.sn-exp}))}}%
}-\underbrace{d_{n}}_{\substack{=\left(  u-v\right)  ^{n}d_{0}\\\text{(by
(\ref{sol.ent.gcd.qedmo5a1-uv.dn-exp}))}}}\right) \\
&  =\dfrac{1}{2}\left(  \left(  u+v\right)  ^{n}\underbrace{s_{0}%
}_{\substack{=a_{0}+b_{0}\\\text{(by the definition of }s_{0}\text{)}%
}}-\left(  u-v\right)  ^{n}\underbrace{d_{0}}_{\substack{=a_{0}-b_{0}%
\\\text{(by the definition of }d_{0}\text{)}}}\right) \\
&  =\dfrac{1}{2}\left(  \left(  u+v\right)  ^{n}\left(  a_{0}+b_{0}\right)
-\left(  u-v\right)  ^{n}\left(  a_{0}-b_{0}\right)  \right)  .
\end{align*}
This solves Exercise \ref{exe.ent.gcd.qedmo5a1-uv}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.1223334444}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.1223334444}.]Our solution to Exercise
\ref{exe.seqs.1223334444} will rely on the following two simple lemmas:

\begin{lemma}
\label{lem.floor.as-min-greater}Let $q\geq-1$ be a real number. Then,%
\begin{equation}
\left\lfloor q+1\right\rfloor =\min\left\{  k\in\mathbb{N}\ \mid\ k>q\right\}
. \label{eq.lem.floor.as-min-greater.eq}%
\end{equation}
(In words: $\left\lfloor q+1\right\rfloor $ is the smallest nonnegative
integer that is greater than $q$.)
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.floor.as-min-greater}.]Applying
(\ref{sol.floor.hermite.lem1}) to $x=q+1$, we find $\left\lfloor
q+1\right\rfloor \leq q+1<\left\lfloor q+1\right\rfloor +1$. Thus,
$q+1<\left\lfloor q+1\right\rfloor +1$, so that $q<\left\lfloor
q+1\right\rfloor $. Therefore, $\left\lfloor q+1\right\rfloor >q\geq-1$. Also,
$\left\lfloor q+1\right\rfloor $ is an integer (since the floor of any real
number is an integer). Therefore, from $\left\lfloor q+1\right\rfloor >-1$, we
obtain $\left\lfloor q+1\right\rfloor \geq0$. Hence, $\left\lfloor
q+1\right\rfloor \in\mathbb{N}$ (since $\left\lfloor q+1\right\rfloor $ is an
integer). Thus, $\left\lfloor q+1\right\rfloor $ is a $k\in\mathbb{N}$
satisfying $k>q$ (since $\left\lfloor q+1\right\rfloor >q$). In other words,
\begin{equation}
\left\lfloor q+1\right\rfloor \in\left\{  k\in\mathbb{N}\ \mid\ k>q\right\}  .
\label{pf.lem.floor.as-min-greater.1}%
\end{equation}


Now, let $s$ be any element of the set $\left\{  k\in\mathbb{N}\ \mid
\ k>q\right\}  $. Thus, $s$ is a $k\in\mathbb{N}$ satisfying $k>q$. In other
words, $s\in\mathbb{N}$ and $s>q$. If we had $s<\left\lfloor q+1\right\rfloor
$, then we would have $s\leq\left\lfloor q+1\right\rfloor -1$ (since $s$ and
$\left\lfloor q+1\right\rfloor $ are integers), which would entail
$s+1\leq\left\lfloor q+1\right\rfloor \leq q+1$, which would contradict
$\underbrace{s}_{>q}+1>q+1$. Hence, we cannot have $s<\left\lfloor
q+1\right\rfloor $. Thus, we have $s\geq\left\lfloor q+1\right\rfloor $.

Forget that we fixed $s$. We thus have shown that $s\geq\left\lfloor
q+1\right\rfloor $ for every $s\in\left\{  k\in\mathbb{N}\ \mid\ k>q\right\}
$. In other words, every element of the set $\left\{  k\in\mathbb{N}%
\ \mid\ k>q\right\}  $ is $\geq\left\lfloor q+1\right\rfloor $. In other
words, $\left\lfloor q+1\right\rfloor $ is smaller or equal to any element of
the set $\left\{  k\in\mathbb{N}\ \mid\ k>q\right\}  $. Since $\left\lfloor
q+1\right\rfloor $ itself is an element of this set (by
(\ref{pf.lem.floor.as-min-greater.1})), we thus conclude that $\left\lfloor
q+1\right\rfloor $ is the smallest element of this set. In other words,
$\left\lfloor q+1\right\rfloor =\min\left\{  k\in\mathbb{N}\ \mid
\ k>q\right\}  $. Thus, (\ref{eq.lem.floor.as-min-greater.eq}) is proved. In
other words, we have proved Lemma \ref{lem.floor.as-min-greater}.
\end{proof}

\begin{lemma}
\label{lem.min.k-as-min}Let $m\in\mathbb{N}$. Then,
\[
m=\min\left\{  k\in\mathbb{N}\ \mid\ k\geq m\right\}  .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.min.k-as-min}.]This is even more obvious than Lemma
\ref{lem.floor.as-min-greater}. The number $m$ is an element of the set
$\left\{  k\in\mathbb{N}\ \mid\ k\geq m\right\}  $ (since $m\in\mathbb{N}$ and
$m\geq m$), but every element of this set is $\geq m$ (because every element
of this set is a $k\in\mathbb{N}$ satisfying $k\geq m$). Hence, the number $m$
is the smallest element of the set $\left\{  k\in\mathbb{N}\ \mid\ k\geq
m\right\}  $. In other words, $m=\min\left\{  k\in\mathbb{N}\ \mid\ k\geq
m\right\}  $. This proves Lemma \ref{lem.min.k-as-min}.
\end{proof}

\begin{proof}
[Solution to Exercise \ref{exe.seqs.1223334444}.]Let us first fix
$n\in\mathbb{N}$. Then, $\sqrt{8n+1}>0$; therefore, we have $\dfrac
{\sqrt{8n+1}-1}{2}>\dfrac{0-1}{2}>-1$. Hence,
(\ref{eq.lem.floor.as-min-greater.eq}) (applied to $q=\dfrac{\sqrt{8n+1}-1}%
{2}$) yields%
\begin{equation}
\left\lfloor \dfrac{\sqrt{8n+1}-1}{2}+1\right\rfloor =\min\left\{
k\in\mathbb{N}\ \mid\ k>\dfrac{\sqrt{8n+1}-1}{2}\right\}  .
\label{sol.seqs.1223334444.1}%
\end{equation}


Let us now fix $k\in\mathbb{N}$. We shall prove the following logical
equivalence:%
\begin{equation}
\left(  a_{n}\leq k\right)  \ \Longleftrightarrow\ \left(  k>\dfrac
{\sqrt{8n+1}-1}{2}\right)  . \label{sol.seqs.1223334444.main-equiv}%
\end{equation}


In order to do so, let us take a look at the sequence $\left(  a_{0}%
,a_{1},a_{2},\ldots\right)  $. The sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ contains each positive integer $i$ exactly $i$ times. Thus,
it contains the integer $1$ exactly once, the integer $2$ exactly twice, the
integer $3$ exactly thrice, and so on. Hence, this sequence contains a total
of $1+2+\cdots+k$ entries that are $\leq k$. Since this sequence is
furthermore weakly increasing, we know that these $1+2+\cdots+k$ entries are
precisely the first $1+2+\cdots+k$ entries of the sequence $\left(
a_{0},a_{1},a_{2},\ldots\right)  $ (since otherwise, the sequence would have
an entry $a_{i}>k$ to the left of an entry $a_{j}\leq k$; but this would
contradict the fact that the sequence is weakly increasing). In other words,
they are the entries $a_{0},a_{1},\ldots,a_{\left(  1+2+\cdots+k\right)  -1}$.

Thus we have shown that the entries of the sequence $\left(  a_{0},a_{1}%
,a_{2},\ldots\right)  $ that are $\leq k$ are precisely the entries
$a_{0},a_{1},\ldots,a_{\left(  1+2+\cdots+k\right)  -1}$. In other words, an
entry $a_{m}$ of the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is
$\leq k$ if and only if $m\in\left\{  0,1,\ldots,\left(  1+2+\cdots+k\right)
-1\right\}  $. In other words, for each $m\in\mathbb{N}$, we have the logical
equivalence%
\[
\left(  a_{m}\leq k\right)  \ \Longleftrightarrow\ \left(  m\in\left\{
0,1,\ldots,\left(  1+2+\cdots+k\right)  -1\right\}  \right)  .
\]
Applying this to $m=n$, we obtain the following chain of equivalences:%
\begin{align*}
\  &  \ \left(  a_{n}\leq k\right) \\
\Longleftrightarrow &  \ \left(  n\in\left\{  0,1,\ldots,\left(
1+2+\cdots+k\right)  -1\right\}  \right) \\
\Longleftrightarrow &  \ \left(  n\leq\left(  1+2+\cdots+k\right)  -1\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\in\mathbb{N}\right) \\
\Longleftrightarrow &  \ \left(  n<1+2+\cdots+k\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\text{ and }1+2+\cdots+k\text{ are
integers}\right) \\
\Longleftrightarrow &  \ \left(  n<\dfrac{k\left(  k+1\right)  }{2}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }1+2+\cdots+k=\dfrac{k\left(
k+1\right)  }{2}\right) \\
\Longleftrightarrow &  \ \left(  8n<4k\left(  k+1\right)  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have multiplied both
sides of our inequality by }8\right) \\
\Longleftrightarrow &  \ \left(  8n+1<4k\left(  k+1\right)  +1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have added }1\text{ to
both sides of our inequality}\right) \\
\Longleftrightarrow &  \ \left(  8n+1<\left(  2k+1\right)  ^{2}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }4k\left(  k+1\right)  +1=\left(
2k+1\right)  ^{2}\right) \\
\Longleftrightarrow &  \ \left(  \sqrt{8n+1}<2k+1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have taken the square root on both sides}\\
\text{of the inequality; this is legitimate because }\sqrt{8n+1}\\
\text{and }2k+1\text{ are positive reals}%
\end{array}
\right) \\
\Longleftrightarrow &  \ \left(  \sqrt{8n+1}-1<2k\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have subtracted
}1\text{ from both sides of the inequality}\right) \\
\Longleftrightarrow &  \ \left(  \dfrac{\sqrt{8n+1}-1}{2}<k\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have divided both
sides of the inequality by }2\right) \\
\Longleftrightarrow &  \ \left(  k>\dfrac{\sqrt{8n+1}-1}{2}\right)  .
\end{align*}
Thus, the equivalence (\ref{sol.seqs.1223334444.main-equiv}) is proved.

Now, forget that we fixed $k$. We thus have proved the equivalence
(\ref{sol.seqs.1223334444.main-equiv}) for each $k\in\mathbb{N}$. Now, $a_{n}$
is a positive integer (since $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is a
sequence of positive integers). Hence, $a_{n}\in\mathbb{N}$. Thus, Lemma
\ref{lem.min.k-as-min} (applied to $m=a_{n}$) yields
\begin{align*}
a_{n}  &  =\min\left\{  k\in\mathbb{N}\ \mid\ k\geq a_{n}\right\} \\
&  =\min\left\{  k\in\mathbb{N}\ \mid\ a_{n}\leq k\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since the statement
\textquotedblleft}k\geq a_{n}\text{\textquotedblright\ is equivalent to
\textquotedblleft}a_{n}\leq k\text{\textquotedblright}\right) \\
&  =\min\left\{  k\in\mathbb{N}\ \mid\ k>\dfrac{\sqrt{8n+1}-1}{2}\right\} \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since the statement \textquotedblleft}a_{n}\leq
k\text{\textquotedblright\ is equivalent}\\
\text{to \textquotedblleft}k>\dfrac{\sqrt{8n+1}-1}{2}\text{\textquotedblright%
\ (by (\ref{sol.seqs.1223334444.main-equiv}))}%
\end{array}
\right) \\
&  =\left\lfloor \dfrac{\sqrt{8n+1}-1}{2}+1\right\rfloor
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.seqs.1223334444.1})}\right) \\
&  =\left\lfloor \dfrac{1}{2}\sqrt{8n+1}+\dfrac{1}{2}\right\rfloor
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\dfrac{\sqrt{8n+1}-1}{2}+1=\dfrac
{1}{2}\sqrt{8n+1}+\dfrac{1}{2}\right)  .
\end{align*}
This solves Exercise \ref{exe.seqs.1223334444}.
\end{proof}

See also \cite[Chapter 5, Exercise 29, Second solution]{Engel} for a result
closely connected to Exercise \ref{exe.seqs.1223334444} (but notice that our
sequence begins with $a_{0}$ rather than $a_{1}$).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.periods-ab}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.periods-ab}.]\textbf{(a)} Assume that
$a/b\in\mathbb{Q}$. We must show that $f+g$ is a periodic function.

We know that $a$ and $b$ are positive reals. Hence, $a/b$ is a positive real
as well. In other words, $a/b>0$. But we also have $a/b\in\mathbb{Q}$; hence,
we can write $a/b$ in the form $a/b=n/m$ for some integers $n$ and $m\neq0$.
Consider these $n$ and $m$. From $n/m=a/b>0$, we conclude that the two
integers $n$ and $m$ are nonzero and have the same sign (i.e., are either both
positive or both negative). Hence, we can WLOG assume that $n$ and $m$ are
positive (since otherwise, we can just replace $n$ and $m$ by $-n$ and $-m$,
without changing $n/m$). Assume this. From $a/b=n/m$, we obtain $ma=nb$. Note
that $ma$ is a positive real (since $m$ and $a$ are positive).

The function $f$ is $a$-periodic. In other words, $a$ is a period of $f$ (by
the definition of \textquotedblleft$a$-periodic\textquotedblright). Hence,
Theorem \ref{thm.funcs.period.main} \textbf{(c)} (applied to $f$ and $m$
instead of $u$ and $n$) yields that $ma$ is a period of $f$. But $ma$ is a
period of $f$ if and only if every $x\in\mathbb{R}$ satisfies $f\left(
x\right)  =f\left(  x+ma\right)  $ (by Definition \ref{def.funcs.period}
\textbf{(a)}). Hence,
\begin{equation}
\text{every }x\in\mathbb{R}\text{ satisfies }f\left(  x\right)  =f\left(
x+ma\right)  \label{sol.seqs.period-ab.a.fma}%
\end{equation}
(since $ma$ is a period of $f$). The same argument (applied to $g$, $b$ and
$n$ instead of $f$, $a$ and $m$) shows that%
\begin{equation}
\text{every }x\in\mathbb{R}\text{ satisfies }g\left(  x\right)  =g\left(
x+nb\right)  . \label{sol.seqs.period-ab.a.gnb}%
\end{equation}
Now, every $x\in\mathbb{R}$ satisfies%
\begin{align*}
\left(  f+g\right)  \left(  x\right)   &  =\underbrace{f\left(  x\right)
}_{\substack{=f\left(  x+ma\right)  \\\text{(by
(\ref{sol.seqs.period-ab.a.fma}))}}}+\underbrace{g\left(  x\right)
}_{\substack{=g\left(  x+nb\right)  \\\text{(by
(\ref{sol.seqs.period-ab.a.gnb}))}}}=f\left(  x+ma\right)  +g\left(
x+\underbrace{nb}_{=ma}\right) \\
&  =f\left(  x+ma\right)  +g\left(  x+ma\right)  =\left(  f+g\right)  \left(
x+ma\right)  .
\end{align*}


Recall that $ma$ is a positive real. Hence, $ma$ is a period of $f+g$ if and
only if every $x\in\mathbb{R}$ satisfies $\left(  f+g\right)  \left(
x\right)  =\left(  f+g\right)  \left(  x+ma\right)  $ (by Definition
\ref{def.funcs.period} \textbf{(a)}). Hence, $ma$ is a period of $f+g$ (since
we have just shown that every $x\in\mathbb{R}$ satisfies $\left(  f+g\right)
\left(  x\right)  =\left(  f+g\right)  \left(  x+ma\right)  $). Therefore, the
function $f+g$ has a period (namely, $ma$). In other words, this function
$f+g$ is periodic (by Definition \ref{def.funcs.period} \textbf{(b)}). This
solves Exercise \ref{exe.seqs.periods-ab} \textbf{(a)}.

\textbf{(b)} Assume that $a/b\notin\mathbb{Q}$. We shall find an $a$-periodic
function $f:\mathbb{R}\rightarrow\mathbb{R}$ and a $b$-periodic function
$g:\mathbb{R}\rightarrow\mathbb{R}$ such that $f+g$ is not periodic.

The easiest way to find such $f$ and $g$ is to define them by
setting\footnote{We are using Definition \ref{def.iverson}.}%
\[
f\left(  x\right)  =\left[  \dfrac{x}{a}\in\mathbb{Z}\right]
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ g\left(  x\right)  =\left[
\dfrac{x}{b}\in\mathbb{Z}\right]
\]
for each $x\in\mathbb{R}$. Note that each of the functions $f$ and $g$ only
takes two different values (namely, $0$ and $1$). The function $f$ is
$a$-periodic, since each $x\in\mathbb{R}$ satisfies
\begin{align*}
f\left(  x+a\right)   &  =\left[  \dfrac{x+a}{a}\in\mathbb{Z}\right]  =\left[
\dfrac{x}{a}+1\in\mathbb{Z}\right]  \ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\dfrac{x+a}{a}=\dfrac{x}{a}+1\right) \\
&  =\left[  \dfrac{x}{a}\in\mathbb{Z}\right]  \ \ \ \ \ \ \ \ \ \ \left(
\text{since }\dfrac{x}{a}+1\in\mathbb{Z}\text{ holds if and only if }\dfrac
{x}{a}\in\mathbb{Z}\right) \\
&  =f\left(  x\right)  .
\end{align*}
Likewise, the function $g$ is $b$-periodic.

We now claim that the function $f+g$ is not periodic. Indeed, assume the
contrary. Thus, $f+g$ is periodic. In other words, there exists a period $d$
of $f+g$. Consider this $d$. Since $d$ is a period of $f+g$, we have $\left(
f+g\right)  \left(  0\right)  =\left(  f+g\right)  \left(  0+d\right)
=\left(  f+g\right)  \left(  d\right)  =f\left(  d\right)  +g\left(  d\right)
$. Hence,
\[
f\left(  d\right)  +g\left(  d\right)  =\left(  f+g\right)  \left(  0\right)
=\underbrace{f\left(  0\right)  }_{=1}+\underbrace{g\left(  0\right)  }%
_{=1}=1+1=2.
\]
Since each of $f\left(  d\right)  $ and $g\left(  d\right)  $ is either $0$ or
$1$, we thus conclude that both $f\left(  d\right)  $ and $g\left(  d\right)
$ must equal $1$. Thus, in particular, $f\left(  d\right)  =1$. But the
definition of $f$ yields $f\left(  d\right)  =\left[  \dfrac{d}{a}%
\in\mathbb{Z}\right]  $. Hence, $\left[  \dfrac{d}{a}\in\mathbb{Z}\right]
=f\left(  d\right)  =1$, so that $\dfrac{d}{a}\in\mathbb{Z}$. Likewise,
$\dfrac{d}{b}\in\mathbb{Z}$.

Thus, we have shown that $\dfrac{d}{b}$ and $\dfrac{d}{a}$ are integers. These
integers are furthermore positive (since $d$, $a$ and $b$ are positive).
Hence, their ratio $\dfrac{d}{b}/\dfrac{d}{a}$ is a well-defined rational
number. In other words, $\dfrac{d}{b}/\dfrac{d}{a}\in\mathbb{Q}$. But this
contradicts $\dfrac{d}{b}/\dfrac{d}{a}=\dfrac{a}{b}\notin\mathbb{Q}$. This
contradiction shows that our assumption was wrong. Hence, we have shown that
the function $f+g$ is not periodic. This solves Exercise
\ref{exe.seqs.periods-ab} \textbf{(b)}.

(An alternative choice of functions $f$ and $g$ that results in the same
conclusion can be obtained by setting%
\[
f\left(  x\right)  =\cos\dfrac{2\pi x}{a}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ g\left(  x\right)  =\cos\dfrac{2\pi x}{b}.
\]
Again, these $f$ and $g$ have the property that $\left(  f+g\right)  \left(
d\right)  $ cannot equal $\left(  f+g\right)  \left(  0\right)  =2$ for $d>0$,
because this would cause $\dfrac{d}{b}$ and $\dfrac{d}{a}$ to be integers.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.gcd-sod}}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.gcd-sod}.]Exercise
\ref{exe.binom.gcd-sod} is known as the
\textit{\href{https://en.wikipedia.org/wiki/Star_of_David_theorem}{\textit{Star
of David theorem}}} (conjectured by Henry W. Gould in 1971 -- see
\cite{Gould72} -- and proved soon after by A. P. Hillman and V. E. Hoggatt,
Jr. \cite{HilHog72}). It owes its name to the fact that the six binomial
coefficients it involves are arranged as follows on Pascal's triangle:%
\[
\xymatrix{
& \dbinom{n-1}{k-1} \are[dd] \are[rrrd] & & \dbinom{n-1}{k} \are[llld] \are[dd] \\
\dbinom{n}{k-1} \are[drrr] & & & & \dbinom{n}{k+1} \are[dlll] \\
& \dbinom{n+1}{k} & & \dbinom{n+1}{k+1}
}
\]
(where edges have been drawn to connect binomial coefficients that appear on
the same side of the equation). It can be contrasted with the similar identity%
\begin{equation}
\dbinom{n-1}{k-1}\dbinom{n}{k+1}\dbinom{n+1}{k}=\dbinom{n-1}{k}\dbinom{n}%
{k-1}\dbinom{n+1}{k+1} \label{sol.binom.gcd-sod.prod-gcd}%
\end{equation}
which also holds for all $n,k\in\mathbb{Z}$. However, the latter identity
(which is sometimes also called \textquotedblleft Star of David
theorem\textquotedblright, as it involves the exact same six binomial
coefficients as Exercise \ref{exe.binom.gcd-sod}) can be proved by
straightforward computations (see \cite[Exercise 5]{19fco-hw2s} for the
proof), and can be generalized to
\[
\dbinom{n-r}{k-s}\dbinom{n}{k+r}\dbinom{n+s}{k}=\dbinom{n-r}{k}\dbinom{n}%
{k-s}\dbinom{n+s}{k+r}%
\]
for any $r,s\in\mathbb{Z}$, whereas Exercise \ref{exe.binom.gcd-sod} has
neither a straightforward proof nor such a generalization. This should not be
very surprising: gcds are more complicated than products.

This being said, let me give a solution to Exercise \ref{exe.binom.gcd-sod}
now. It will rely on the following lemmas:

\begin{lemma}
\label{lem.sol.binom.gcd-sod.gcd3}Let $u,v,w\in\mathbb{Z}$ and $m\in
\mathbb{Z}$. Then, we have the following logical equivalence:%
\[
\left(  m\mid u\text{ and }m\mid v\text{ and }m\mid w\right)
\ \Longleftrightarrow\ \left(  m\mid\gcd\left(  u,v,w\right)  \right)  .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.binom.gcd-sod.gcd3}.]Set $b_{1}=u$ and $b_{2}=v$
and $b_{3}=w$. Thus, we have defined three integers $b_{1},b_{2},b_{3}$. Now,
we have the following chain of equivalences:%
\begin{align*}
&  \ \left(  m\mid\underbrace{u}_{=b_{1}}\text{ and }m\mid\underbrace{v}%
_{=b_{2}}\text{ and }m\mid\underbrace{w}_{=b_{3}}\right) \\
&  \Longleftrightarrow\ \left(  m\mid b_{1}\text{ and }m\mid b_{2}\text{ and
}m\mid b_{3}\right) \\
&  \Longleftrightarrow\ \left(  m\mid\gcd\left(  \underbrace{b_{1}}%
_{=u},\underbrace{b_{2}}_{=v},\underbrace{b_{3}}_{=w}\right)  \right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.ent.gcd.uniprop-mul},
applied to }k=3\right) \\
&  \Longleftrightarrow\ \left(  m\mid\gcd\left(  u,v,w\right)  \right)  .
\end{align*}
This proves Lemma \ref{lem.sol.binom.gcd-sod.gcd3}.
\end{proof}

The next lemma collects some useful relations between adjacent entries in
Pascal's triangle:

\begin{lemma}
\label{lem.binom.neighbors}Let $n$ and $k$ be any numbers. Then:

\textbf{(a)} We have $n\dbinom{n-1}{k-1}=k\dbinom{n}{k}$.

\textbf{(b)} We have $\left(  k+1\right)  \dbinom{n}{k+1}=\left(  n-k\right)
\dbinom{n}{k}$.

\textbf{(c)} We have $n\dbinom{n-1}{k}=\left(  n-k\right)  \dbinom{n}{k}$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom.neighbors}.]There are many ways to prove Lemma
\ref{lem.binom.neighbors}; in particular, each of the three parts of this
lemma can be proved separately. The following line of argument is probably the quickest:

\textbf{(c)} We must prove that $n\dbinom{n-1}{k}=\left(  n-k\right)
\dbinom{n}{k}$. If $k\notin\mathbb{N}$, then this equality is
obvious\footnote{\textit{Proof.} Assume that $k\notin\mathbb{N}$. Then,
$\dbinom{n}{k}=0$ (by (\ref{eq.def.binom.def.b})) and $\dbinom{n-1}{k}=0$
(likewise). Hence, $n\underbrace{\dbinom{n-1}{k}}_{=0}=0$ and $\left(
n-k\right)  \underbrace{\dbinom{n}{k}}_{=0}=0$. Comparing these two
equalities, we obtain $n\dbinom{n-1}{k}=\left(  n-k\right)  \dbinom{n}{k}$.
Thus, we have proved $n\dbinom{n-1}{k}=\left(  n-k\right)  \dbinom{n}{k}$
under the assumption that $k\notin\mathbb{N}$.}. Hence, for the rest of this
proof, we WLOG assume that $k\in\mathbb{N}$. Thus, (\ref{eq.def.binom.def.a})
(applied to $n-1$ instead of $n$) yields%
\begin{align*}
\dbinom{n-1}{k}  &  =\dfrac{\left(  n-1\right)  \left(  \left(  n-1\right)
-1\right)  \left(  \left(  n-2\right)  -2\right)  \cdots\left(  \left(
n-1\right)  -k+1\right)  }{k!}\\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  n-k\right)  }{k!}=\dfrac{1}{k!}\cdot\left(  n-1\right)  \left(
n-2\right)  \left(  n-3\right)  \cdots\left(  n-k\right)  .
\end{align*}
Multiplying both sides of this equality by $n$, we find%
\begin{align*}
n\dbinom{n-1}{k}  &  =n\cdot\dfrac{1}{k!}\cdot\left(  n-1\right)  \left(
n-2\right)  \left(  n-3\right)  \cdots\left(  n-k\right) \\
&  =\dfrac{1}{k!}\cdot\underbrace{n\cdot\left(  n-1\right)  \left(
n-2\right)  \left(  n-3\right)  \cdots\left(  n-k\right)  }%
_{\substack{=n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k\right)  \\=n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  \cdot\left(  n-k\right)  }}\\
&  =\dfrac{1}{k!}\cdot n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(
n-k+1\right)  \cdot\left(  n-k\right) \\
&  =\left(  n-k\right)  \cdot\underbrace{\dfrac{n\left(  n-1\right)  \left(
n-2\right)  \cdots\left(  n-k+1\right)  }{k!}}_{\substack{=\dbinom{n}%
{k}\\\text{(by (\ref{eq.def.binom.def.a}))}}}=\left(  n-k\right)  \dbinom
{n}{k}.
\end{align*}
This proves Lemma \ref{lem.binom.neighbors} \textbf{(c)}.

\textbf{(a)} Theorem \ref{thm.binom.rec} yields $\dbinom{n}{k}=\dbinom
{n-1}{k-1}+\dbinom{n-1}{k}$. Thus,%
\[
\dbinom{n-1}{k-1}=\dbinom{n}{k}-\dbinom{n-1}{k}.
\]
Multiplying both sides of this equality by $n$, we obtain%
\begin{align*}
n\dbinom{n-1}{k-1}  &  =n\left(  \dbinom{n}{k}-\dbinom{n-1}{k}\right)
=n\dbinom{n}{k}-\underbrace{n\dbinom{n-1}{k}}_{\substack{=\left(  n-k\right)
\dbinom{n}{k}\\\text{(by Lemma \ref{lem.binom.neighbors} \textbf{(c)})}}}\\
&  =n\dbinom{n}{k}-\left(  n-k\right)  \dbinom{n}{k}=\underbrace{\left(
n-\left(  n-k\right)  \right)  }_{=k}\dbinom{n}{k}=k\dbinom{n}{k}.
\end{align*}
This proves Lemma \ref{lem.binom.neighbors} \textbf{(a)}.

\textbf{(b)} Lemma \ref{lem.binom.neighbors} \textbf{(a)} (applied to $k+1$
instead of $k$) yields
\[
n\dbinom{n-1}{\left(  k+1\right)  -1}=\left(  k+1\right)  \dbinom{n}{k+1}.
\]
Hence,%
\begin{align*}
\left(  k+1\right)  \dbinom{n}{k+1}  &  =n\dbinom{n-1}{\left(  k+1\right)
-1}=n\dbinom{n-1}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
k+1\right)  -1=k\right) \\
&  =\left(  n-k\right)  \dbinom{n}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
Lemma \ref{lem.binom.neighbors} \textbf{(c)}}\right)  .
\end{align*}
This proves Lemma \ref{lem.binom.neighbors} \textbf{(b)}.
\end{proof}

\begin{proof}
[Solution to Exercise \ref{exe.binom.gcd-sod}.]Define seven numbers $A$, $B$,
$C$, $D$, $E$, $F$ and $M$ by%
\begin{align*}
A  &  =\dbinom{n-1}{k-1},\ \ \ \ \ \ \ \ \ \ B=\dbinom{n-1}{k}%
,\ \ \ \ \ \ \ \ \ \ C=\dbinom{n}{k+1},\\
D  &  =\dbinom{n}{k-1},\ \ \ \ \ \ \ \ \ \ E=\dbinom{n+1}{k}%
,\ \ \ \ \ \ \ \ \ \ F=\dbinom{n+1}{k+1},\ \ \ \ \ \ \ \ \ \ M=\dbinom{n}{k}.
\end{align*}
All these seven numbers $A$, $B$, $C$, $D$, $E$, $F$ and $M$ belong to
$\mathbb{Z}$ (because of Theorem \ref{thm.binom.ZZ}); in other words, they are
integers. Hence, speaking of $\gcd\left(  A,C,E\right)  $ and $\gcd\left(
B,D,F\right)  $ makes sense.

We set $x=\gcd\left(  A,C,E\right)  $ and $y=\gcd\left(  B,D,F\right)  $.
Then, $x$ and $y$ are nonnegative integers (by Proposition
\ref{prop.ent.gcd.pos} \textbf{(a)}). Our goal is to show that $x=y$. We shall
achieve this by proving that $x\mid y$ and $y\mid x$ (just as in our proof of
Theorem \ref{thm.ent.gcd.sa,sb}).

We have $x\mid x=\gcd\left(  A,C,E\right)  $. But Lemma
\ref{lem.sol.binom.gcd-sod.gcd3} (applied to $A$, $C$, $E$ and $x$ instead of
$u$, $v$, $w$ and $m$) shows that we have the following logical equivalence:%
\[
\left(  x\mid A\text{ and }x\mid C\text{ and }x\mid E\right)
\ \Longleftrightarrow\ \left(  x\mid\gcd\left(  A,C,E\right)  \right)  .
\]
Hence, we have $\left(  x\mid A\text{ and }x\mid C\text{ and }x\mid E\right)
$ (since we have $x\mid\gcd\left(  A,C,E\right)  $). The same argument
(applied to $y$, $B$, $D$ and $F$ instead of $x$, $A$, $C$ and $E$) shows that
we have $\left(  y\mid B\text{ and }y\mid D\text{ and }y\mid F\right)  $.

Now, we shall prove a few relations between $A$, $B$, $C$, $D$, $E$, $F$ and
$M$. First, we claim that%
\begin{align}
M-A  &  =B;\label{sol.binom.gcd-sod.MAB}\\
E-M  &  =D,\label{sol.binom.gcd-sod.EMD}\\
C+M  &  =F. \label{sol.binom.gcd-sod.CMF}%
\end{align}
These three equalities are clear from Theorem \ref{thm.binom.rec} upon a look
at a picture of Pascal's triangle, in which the entries $A$, $B$, $C$, $D$,
$E$, $F$ and $M$ are arranged as follows:%
\[
\xymatrix{
& A & & B \\
D & & M & & C \\
& E & & F
}
\]
(where each of the entries $A$, $B$, $C$, $D$, $E$, $F$ is adjacent to
$M$).\ \ \ \ \footnote{For the sake of completeness, here are detailed proofs
of (\ref{sol.binom.gcd-sod.MAB}), (\ref{sol.binom.gcd-sod.EMD}) and
(\ref{sol.binom.gcd-sod.CMF}):
\par
\textit{Proof of (\ref{sol.binom.gcd-sod.MAB}):} Theorem \ref{thm.binom.rec}
yields%
\[
\dbinom{n}{k}=\underbrace{\dbinom{n-1}{k-1}}_{=A}+\underbrace{\dbinom{n-1}{k}%
}_{=B}=A+B.
\]
Hence, $M=\dbinom{n}{k}=A+B$, so that $M-A=B$. This proves
(\ref{sol.binom.gcd-sod.MAB}).
\par
\textit{Proof of (\ref{sol.binom.gcd-sod.EMD}):} Theorem \ref{thm.binom.rec}
(applied to $n+1$ instead of $n$) yields%
\[
\dbinom{n+1}{k}=\underbrace{\dbinom{\left(  n+1\right)  -1}{k-1}}_{=\dbinom
{n}{k-1}=D}+\underbrace{\dbinom{\left(  n+1\right)  -1}{k}}_{=\dbinom{n}{k}%
=M}=D+M.
\]
Hence, $E=\dbinom{n+1}{k}=D+M$, so that $E-M=D$. This proves
(\ref{sol.binom.gcd-sod.EMD}).
\par
\textit{Proof of (\ref{sol.binom.gcd-sod.CMF}):} Theorem \ref{thm.binom.rec}
(applied to $n+1$ and $k+1$ instead of $n$ and $k$) yields%
\[
\dbinom{n+1}{k+1}=\underbrace{\dbinom{\left(  n+1\right)  -1}{\left(
k+1\right)  -1}}_{=\dbinom{n}{k}=M}+\underbrace{\dbinom{\left(  n+1\right)
-1}{k+1}}_{=\dbinom{n}{k+1}=C}=M+C=C+M.
\]
Hence, $F=\dbinom{n+1}{k+1}=C+M$. This proves (\ref{sol.binom.gcd-sod.CMF}).}

We also need two less trivial equalities. Namely, we claim that%
\begin{equation}
-nA-\left(  k+1\right)  C+\left(  n+1-k\right)  E=M.
\label{sol.binom.gcd-sod.M-ACE}%
\end{equation}


[\textit{Proof of (\ref{sol.binom.gcd-sod.M-ACE}):} From $A=\dbinom{n-1}{k-1}%
$, we obtain%
\begin{align*}
nA  &  =n\dbinom{n-1}{k-1}=k\underbrace{\dbinom{n}{k}}_{=M}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Lemma \ref{lem.binom.neighbors}
\textbf{(a)}}\right) \\
&  =kM.
\end{align*}
From $C=\dbinom{n}{k+1}$, we obtain%
\begin{align*}
\left(  k+1\right)  C  &  =\left(  k+1\right)  \dbinom{n}{k+1}=\left(
n-k\right)  \underbrace{\dbinom{n}{k}}_{=M}\ \ \ \ \ \ \ \ \ \ \left(
\text{by Lemma \ref{lem.binom.neighbors} \textbf{(b)}}\right) \\
&  =\left(  n-k\right)  M.
\end{align*}
Also, we have $M=\dbinom{n}{k}=\dbinom{\left(  n+1\right)  -1}{k}$ (since
$n=\left(  n+1\right)  -1$), and therefore%
\begin{align*}
\left(  n+1\right)  M  &  =\left(  n+1\right)  \dbinom{\left(  n+1\right)
-1}{k}=\left(  n+1-k\right)  \underbrace{\dbinom{n+1}{k}}_{=E}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Lemma \ref{lem.binom.neighbors}
\textbf{(c)}, applied to }n+1\text{ instead of }n\right) \\
&  =\left(  n+1-k\right)  E,
\end{align*}
so that%
\[
\left(  n+1-k\right)  E=\left(  n+1\right)  M.
\]


Now,%
\[
-\underbrace{nA}_{=kM}-\underbrace{\left(  k+1\right)  C}_{=\left(
n-k\right)  M}+\underbrace{\left(  n+1-k\right)  E}_{=\left(  n+1\right)
M}=-kM-\left(  n-k\right)  M+\left(  n+1\right)  M=M.
\]
This proves (\ref{sol.binom.gcd-sod.M-ACE}).]

Next, we claim that%
\begin{equation}
-nB-\left(  n+1-k\right)  D+\left(  k+1\right)  F=M.
\label{sol.binom.gcd-sod.M-BDF}%
\end{equation}


[\textit{Proof of (\ref{sol.binom.gcd-sod.M-BDF}):} We have%
\begin{align*}
&  -n\underbrace{B}_{\substack{=M-A\\\text{(by (\ref{sol.binom.gcd-sod.MAB}%
))}}}-\left(  n+1-k\right)  \underbrace{D}_{\substack{=E-M\\\text{(by
(\ref{sol.binom.gcd-sod.EMD}))}}}+\left(  k+1\right)  \underbrace{F}%
_{\substack{=C+M\\\text{(by (\ref{sol.binom.gcd-sod.CMF}))}}}\\
&  =-n\left(  M-A\right)  -\left(  n+1-k\right)  \left(  E-M\right)  +\left(
k+1\right)  \left(  C+M\right) \\
&  =-nM+nA-\left(  n+1-k\right)  E+\left(  n+1-k\right)  M+\left(  k+1\right)
C+\left(  k+1\right)  M\\
&  =\underbrace{\left(  -nM+\left(  n+1-k\right)  M+\left(  k+1\right)
M\right)  }_{=2M}-\underbrace{\left(  -nA-\left(  k+1\right)  C+\left(
n+1-k\right)  E\right)  }_{\substack{=M\\\text{(by
(\ref{sol.binom.gcd-sod.M-ACE}))}}}\\
&  =2M-M=M.
\end{align*}
This proves (\ref{sol.binom.gcd-sod.M-BDF}).]

Now, we have some modular arithmetic to do.

Recall that $\left(  x\mid A\text{ and }x\mid C\text{ and }x\mid E\right)  $.
Hence, $A\equiv0\operatorname{mod}x$ (since $x\mid A$) and $C\equiv
0\operatorname{mod}x$ (since $x\mid C$) and $E\equiv0\operatorname{mod}x$
(since $x\mid E$). Now, (\ref{sol.binom.gcd-sod.M-ACE}) yields%
\begin{align*}
M  &  =-n\underbrace{A}_{\equiv0\operatorname{mod}x}-\left(  k+1\right)
\underbrace{C}_{\equiv0\operatorname{mod}x}+\left(  n+1-k\right)
\underbrace{E}_{\equiv0\operatorname{mod}x}\\
&  \equiv-n\cdot0-\left(  k+1\right)  \cdot0+\left(  n+1-k\right)
\cdot0=0\operatorname{mod}x.
\end{align*}
Now, (\ref{sol.binom.gcd-sod.MAB}) yields $B=\underbrace{M}_{\equiv
0\operatorname{mod}x}-\underbrace{A}_{\equiv0\operatorname{mod}x}%
\equiv0-0=0\operatorname{mod}x$, so that $x\mid B$. Also,
(\ref{sol.binom.gcd-sod.EMD}) yields $D=\underbrace{E}_{\equiv
0\operatorname{mod}x}-\underbrace{M}_{\equiv0\operatorname{mod}x}%
\equiv0-0=0\operatorname{mod}x$, so that $x\mid D$. Finally,
(\ref{sol.binom.gcd-sod.CMF}) yields $F=\underbrace{C}_{\equiv
0\operatorname{mod}x}+\underbrace{M}_{\equiv0\operatorname{mod}x}%
\equiv0+0=0\operatorname{mod}x$, so that $x\mid F$. But Lemma
\ref{lem.sol.binom.gcd-sod.gcd3} (applied to $B$, $D$, $F$ and $x$ instead of
$u$, $v$, $w$ and $m$) shows that we have the following logical equivalence:%
\[
\left(  x\mid B\text{ and }x\mid D\text{ and }x\mid F\right)
\ \Longleftrightarrow\ \left(  x\mid\gcd\left(  B,D,F\right)  \right)  .
\]
Hence, we have $x\mid\gcd\left(  B,D,F\right)  $ (since we have $\left(  x\mid
B\text{ and }x\mid D\text{ and }x\mid F\right)  $). In other words, $x\mid y$
(since $y=\gcd\left(  B,D,F\right)  $).

On the other hand, recall that $\left(  y\mid B\text{ and }y\mid D\text{ and
}y\mid F\right)  $. Hence, $B\equiv0\operatorname{mod}y$ (since $y\mid B$) and
$D\equiv0\operatorname{mod}y$ (since $y\mid D$) and $F\equiv
0\operatorname{mod}y$ (since $y\mid F$). Now, (\ref{sol.binom.gcd-sod.M-BDF})
yields%
\begin{align*}
M  &  =-n\underbrace{B}_{\equiv0\operatorname{mod}y}-\left(  n+1-k\right)
\underbrace{D}_{\equiv0\operatorname{mod}y}+\left(  k+1\right)  \underbrace{F}%
_{\equiv0\operatorname{mod}y}\\
&  \equiv-n\cdot0-\left(  n+1-k\right)  \cdot0+\left(  k+1\right)
\cdot0=0\operatorname{mod}y.
\end{align*}
Now, (\ref{sol.binom.gcd-sod.MAB}) yields $B=M-A$, so that $A=\underbrace{M}%
_{\equiv0\operatorname{mod}y}-\underbrace{B}_{\equiv0\operatorname{mod}%
y}\equiv0-0=0\operatorname{mod}y$, so that $y\mid A$. Also,
(\ref{sol.binom.gcd-sod.EMD}) yields $D=E-M$, so that $E=\underbrace{D}%
_{\equiv0\operatorname{mod}y}+\underbrace{M}_{\equiv0\operatorname{mod}%
y}\equiv0+0=0\operatorname{mod}y$, so that $y\mid E$. Finally,
(\ref{sol.binom.gcd-sod.CMF}) yields $F=C+M$, so that $C=\underbrace{F}%
_{\equiv0\operatorname{mod}y}-\underbrace{M}_{\equiv0\operatorname{mod}%
y}\equiv0-0=0\operatorname{mod}y$, so that $y\mid C$. But Lemma
\ref{lem.sol.binom.gcd-sod.gcd3} (applied to $A$, $C$, $E$ and $y$ instead of
$u$, $v$, $w$ and $m$) shows that we have the following logical equivalence:%
\[
\left(  y\mid A\text{ and }y\mid C\text{ and }y\mid E\right)
\ \Longleftrightarrow\ \left(  y\mid\gcd\left(  A,C,E\right)  \right)  .
\]
Hence, we have $y\mid\gcd\left(  A,C,E\right)  $ (since we have $\left(  y\mid
A\text{ and }y\mid C\text{ and }y\mid E\right)  $). In other words, $y\mid x$
(since $x=\gcd\left(  A,C,E\right)  $).

Thus we know that $x\mid y$ and $y\mid x$. Hence, Proposition
\ref{prop.ent.div.1} \textbf{(c)} (applied to $a=x$ and $b=y$) yields
$\left\vert x\right\vert =\left\vert y\right\vert $. But $x$ is nonnegative;
thus, $\left\vert x\right\vert =x$. Similarly, $\left\vert y\right\vert =y$.
Hence, $x=\left\vert x\right\vert =\left\vert y\right\vert =y$. In view of%
\[
x=\gcd\left(  \underbrace{A}_{=\dbinom{n-1}{k-1}},\underbrace{C}_{=\dbinom
{n}{k+1}},\underbrace{E}_{=\dbinom{n+1}{k}}\right)  =\gcd\left(  \dbinom
{n-1}{k-1},\dbinom{n}{k+1},\dbinom{n+1}{k}\right)
\]
and%
\[
y=\gcd\left(  \underbrace{B}_{=\dbinom{n-1}{k}},\underbrace{D}_{=\dbinom
{n}{k-1}},\underbrace{F}_{=\dbinom{n+1}{k+1}}\right)  =\gcd\left(
\dbinom{n-1}{k},\dbinom{n}{k-1},\dbinom{n+1}{k+1}\right)  ,
\]
this rewrites as%
\[
\gcd\left(  \dbinom{n-1}{k-1},\dbinom{n}{k+1},\dbinom{n+1}{k}\right)
=\gcd\left(  \dbinom{n-1}{k},\dbinom{n}{k-1},\dbinom{n+1}{k+1}\right)  .
\]
This solves Exercise \ref{exe.binom.gcd-sod}.
\end{proof}
\end{proof}

\subsection{\label{sect.hw4s}Homework set \#4 discussion}

The following are discussions of the problems on homework set \#4 (Section
\ref{sect.hw4}).

\subsubsection{Discussion of Exercise \ref{exe.seqs.binom-periodic}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.binom-periodic}.]We shall use the
following simple lemma:

\begin{lemma}
\label{lem.ent.cong-cancel-weak}Let $a,b,c,n$ be four integers such that
$c\neq0$ and $ac\equiv bc\operatorname{mod}nc$. Then, $a\equiv
b\operatorname{mod}n$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.ent.cong-cancel-weak}.]We have $ac\equiv
bc\operatorname{mod}nc$. In other words, $nc\mid ac-bc$. In other words,
$nc\mid\left(  a-b\right)  c$ (since $ac-bc=\left(  a-b\right)  c$). But
Proposition \ref{prop.ent.div.acbc} (applied to $n$ and $a-b$ instead of $a$
and $b$) yields that $n\mid a-b$ holds if and only if $nc\mid\left(
a-b\right)  c$. Thus, $n\mid a-b$ holds (since $nc\mid\left(  a-b\right)  c$
holds). In other words, $a\equiv b\operatorname{mod}n$. This proves Lemma
\ref{lem.ent.cong-cancel-weak}.
\end{proof}

\begin{proof}
[Solution to Exercise \ref{exe.seqs.binom-periodic}.]We know that $k!$ is a
positive integer; hence, $k!\neq0$.

Theorem \ref{thm.binom.ZZ} yields that $\dbinom{n}{k}\in\mathbb{Z}$ for each
$n\in\mathbb{Z}$. Hence, the sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ is well-defined.

Let $v=uk!$. Then, $v$ is a positive integer (since $u$ and $k!$ are positive
integers). We shall now prove that every $i\in\mathbb{N}$ satisfies
$a_{i}=a_{i+v}$.

Indeed, let $i\in\mathbb{N}$. Set $j=i+v$. Thus, $j=i+\underbrace{v}%
_{\equiv0\operatorname{mod}v}\equiv i\operatorname{mod}v$.

Applying (\ref{eq.def.binom.def.a}) to $n=i$, we obtain%
\[
\dbinom{i}{k}=\dfrac{i\left(  i-1\right)  \left(  i-2\right)  \cdots\left(
i-k+1\right)  }{k!}.
\]
Multiplying both sides of this equality by $k!$, we find%
\begin{equation}
\dbinom{i}{k}\cdot k!=i\left(  i-1\right)  \left(  i-2\right)  \cdots\left(
i-k+1\right)  =\prod_{s=0}^{k-1}\left(  i-s\right)  .
\label{sol.seqs.binom-periodic.1}%
\end{equation}
The same argument (applied to $j$ instead of $i$) yields%
\begin{equation}
\dbinom{j}{k}\cdot k!=\prod_{s=0}^{k-1}\left(  j-s\right)  .
\label{sol.seqs.binom-periodic.2}%
\end{equation}


However, for each $s\in\left\{  0,1,\ldots,k-1\right\}  $, we have
$\underbrace{j}_{\equiv i\operatorname{mod}v}-s\equiv i-s\operatorname{mod}v$.
Multiplying these congruences for all $s\in\left\{  0,1,\ldots,k-1\right\}  $
(that is, applying (\ref{eq.exe.ent.mod.k-sum.b}) to $S=\left\{
0,1,\ldots,k-1\right\}  $ and $n=v$ and $a_{s}=j-s$ and $b_{s}=i-s$), we
obtain%
\[
\prod_{s=0}^{k-1}\left(  j-s\right)  \equiv\prod_{s=0}^{k-1}\left(
i-s\right)  \operatorname{mod}v.
\]
In view of (\ref{sol.seqs.binom-periodic.1}) and
(\ref{sol.seqs.binom-periodic.2}), we can rewrite this as%
\[
\dbinom{j}{k}\cdot k!\equiv\dbinom{i}{k}\cdot k!\operatorname{mod}v.
\]
In view of $v=uk!$, this rewrites as
\[
\dbinom{j}{k}\cdot k!\equiv\dbinom{i}{k}\cdot k!\operatorname{mod}uk!.
\]
Hence, Lemma \ref{lem.ent.cong-cancel-weak} (applied to $a=\dbinom{j}{k}$,
$b=\dbinom{i}{k}$, $c=k!$ and $n=u$) yields that $\dbinom{j}{k}\equiv
\dbinom{i}{k}\operatorname{mod}u$ (since $k!\neq0$).

Proposition \ref{prop.ent.quo-rem.mod=rem} (applied to $u$, $\dbinom{j}{k}$
and $\dbinom{i}{k}$ instead of $n$, $u$ and $v$) shows that $\dbinom{j}%
{k}\equiv\dbinom{i}{k}\operatorname{mod}u$ if and only if $\dbinom{j}%
{k}\%u=\dbinom{i}{k}\%u$. Thus, we have $\dbinom{j}{k}\%u=\dbinom{i}{k}\%u$
(since $\dbinom{j}{k}\equiv\dbinom{i}{k}\operatorname{mod}u$). In other words,
$\dbinom{i}{k}\%u=\dbinom{j}{k}\%u$.

But the definition of $a_{i}$ yields $a_{i}=\dbinom{i}{k}\%u$. Similarly,
$a_{j}=\dbinom{j}{k}\%u$. Now, $a_{i}=\dbinom{i}{k}\%u=\dbinom{j}{k}%
\%u=a_{j}=a_{i+v}$ (since $j=i+v$).

Forget that we fixed $i$. We thus have shown that every $i\in\mathbb{N}$
satisfies $a_{i}=a_{i+v}$. In other words, the sequence $\left(  a_{0}%
,a_{1},a_{2},\ldots\right)  $ is $v$-periodic (by the definition of
\textquotedblleft$v$-periodic\textquotedblright). In other words, the sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is $uk!$-periodic (since $v=uk!$).
This solves Exercise \ref{exe.seqs.binom-periodic}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.rec.fn-div-not-1}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.rec.fn-div-not-1}.]Exercise
\ref{exe.ent.rec.fn-div-not-1} generalizes Exercise \ref{exe.ent.rec.fn-div}
by removing the condition $x_{1}=1$. This extra generality is ridiculously
shallow: If $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ is the unique $\left(
u,v\right)  $-recurrent sequence of integers with $y_{0}=0$ and $y_{1}=1$,
then any $\left(  u,v\right)  $-recurrent sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ satisfying $x_{0}=0$ can be written as $\left(
\lambda y_{0},\lambda y_{1},\lambda y_{2},\ldots\right)  $ for an appropriate
number $\lambda$ (namely, for $\lambda=x_{1}$), and therefore Exercise
\ref{exe.ent.rec.fn-div-not-1} follows from Exercise \ref{exe.ent.rec.fn-div}
(applied to $y_{i}$ instead of $x_{i}$). Here are the details of this argument:

\begin{proof}
[Solution to Exercise \ref{exe.ent.rec.fn-div-not-1}.]Define a sequence
$\left(  y_{0},y_{1},y_{2},\ldots\right)  $ of integers recursively by setting%
\begin{align*}
y_{0}  &  =0,\ \ \ \ \ \ \ \ \ \ y_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
y_{n}  &  =uy_{n-1}+vy_{n-2}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq2.
\end{align*}
Then, the sequence $\left(  y_{0},y_{1},y_{2},\ldots\right)  $ is $\left(
u,v\right)  $-recurrent\footnote{since every $n\geq2$ satisfies $y_{n}%
=uy_{n-1}+vy_{n-2}$} and satisfies $y_{0}=0$ and $y_{1}=1$. Hence, Exercise
\ref{exe.ent.rec.fn-div} (applied to $y_{i}$ instead of $x_{i}$) yields that
all $a,b\in\mathbb{N}$ satisfying $a\mid b$ satisfy%
\begin{equation}
y_{a}\mid y_{b}. \label{sol.ent.rec.fn-div-not-1.ydiv}%
\end{equation}


On the other hand, let $\lambda=x_{1}$. We claim that%
\begin{equation}
x_{i}=\lambda y_{i}\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\mathbb{N}.
\label{sol.ent.rec.fn-div-not-1.x=ly}%
\end{equation}


[\textit{Proof of (\ref{sol.ent.rec.fn-div-not-1.x=ly}):} Let us prove
(\ref{sol.ent.rec.fn-div-not-1.x=ly}) by strong induction on $i$:

\textit{Induction step:} Let $n\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ent.rec.fn-div-not-1.x=ly}) holds for $i<n$. We
must prove that (\ref{sol.ent.rec.fn-div-not-1.x=ly}) holds for $i=n$. In
other words, we must prove that $x_{n}=\lambda y_{n}$.

Comparing $x_{0}=0$ with $\lambda\underbrace{y_{0}}_{=0}=0$, we obtain
$x_{0}=\lambda y_{0}$. Hence, $x_{n}=\lambda y_{n}$ is proved if $n=0$. Thus,
for the rest of this proof, we WLOG assume that $n\neq0$.

From $\lambda\underbrace{y_{1}}_{=1}=\lambda=x_{1}$, we obtain $x_{1}=\lambda
y_{1}$. Hence, $x_{n}=\lambda y_{n}$ is proved if $n=1$. Thus, for the rest of
this proof, we WLOG assume that $n\neq1$.

We now have $n\neq0$ and $n\neq1$. Therefore, $n\geq2$ (since $n\in\mathbb{N}%
$). Hence, $y_{n}=uy_{n-1}+vy_{n-2}$ (since the sequence $\left(  y_{0}%
,y_{1},y_{2},\ldots\right)  $ is $\left(  u,v\right)  $-recurrent) and
$x_{n}=ux_{n-1}+vx_{n-2}$ (since the sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ is $\left(  u,v\right)  $-recurrent).

But from $n\geq2$, we obtain $n-2\in\mathbb{N}$. Also, $n-1\in\mathbb{N}$
(since $n\geq2\geq1$).

Recall our induction hypothesis, which says that
(\ref{sol.ent.rec.fn-div-not-1.x=ly}) holds for $i<n$. Hence,
(\ref{sol.ent.rec.fn-div-not-1.x=ly}) holds for $i=n-2$ (since $n-2\in
\mathbb{N}$ and $n-2<n$). In other words, we have $x_{n-2}=\lambda y_{n-2}$.
The same argument (applied to $n-1$ instead of $n-2$) yields $x_{n-1}=\lambda
y_{n-1}$ (since $n-1\in\mathbb{N}$ and $n-1<n$). Hence,%
\[
x_{n}=u\underbrace{x_{n-1}}_{=\lambda y_{n-1}}+v\underbrace{x_{n-2}}_{=\lambda
y_{n-2}}=u\lambda y_{n-1}+v\lambda y_{n-2}=\lambda\underbrace{\left(
uy_{n-1}+vy_{n-2}\right)  }_{\substack{=y_{n}\\\text{(since }y_{n}%
=uy_{n-1}+vy_{n-2}\text{)}}}=\lambda y_{n}.
\]
In other words, (\ref{sol.ent.rec.fn-div-not-1.x=ly}) holds for $i=n$. This
completes the induction step. Thus, (\ref{sol.ent.rec.fn-div-not-1.x=ly}) is proved.]

Now, let $a,b\in\mathbb{N}$ satisfy $a\mid b$. We must prove that $x_{a}\mid
x_{b}$. But (\ref{sol.ent.rec.fn-div-not-1.x=ly}) (applied to $i=a$) yields
$x_{a}=\lambda y_{a}$. Similarly, $x_{b}=\lambda y_{b}$. However,
(\ref{sol.ent.rec.fn-div-not-1.ydiv}) yields $y_{a}\mid y_{b}$. In other
words, there exists an integer $c$ such that $y_{b}=y_{a}c$ (by Definition
\ref{def.ent.div.div}). Consider this $c$. We have $x_{b}=\lambda
\underbrace{y_{b}}_{=y_{a}c}=\underbrace{\lambda y_{a}}_{=x_{a}}c=x_{a}c$.
Since $c$ is an integer, we thus have $x_{a}\mid x_{b}$. This solves Exercise
\ref{exe.ent.rec.fn-div-not-1}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.cassini-gen}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.cassini-gen}.]Here is one possible
generalization of Exercise \ref{exe.rec.cassini}:

\begin{proposition}
\label{prop.rec.cassini-gen1}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ be two $\left(  a,b\right)  $-recurrent sequences. Then,%
\[
x_{n+1}y_{n-1}-x_{n}y_{n}=\left(  -b\right)  ^{n-1}\left(  x_{2}y_{0}%
-x_{1}y_{1}\right)
\]
for any positive integer $n$.
\end{proposition}

Exercise \ref{exe.rec.cassini} is the particular case of Proposition
\ref{prop.rec.cassini-gen1} for $y_{i}=x_{i}$.

We can generalize Proposition \ref{prop.rec.cassini-gen1} even further:

\begin{proposition}
\label{prop.rec.cassini-gen2}Let $a$ and $b$ be two numbers. Let $\left(
x_{0},x_{1},x_{2},\ldots\right)  $ and $\left(  y_{0},y_{1},y_{2}%
,\ldots\right)  $ be two $\left(  a,b\right)  $-recurrent sequences. Then,%
\begin{equation}
x_{p+1}y_{q}-x_{p}y_{q+1}=\left(  -b\right)  ^{q}\left(  x_{p-q+1}%
y_{0}-x_{p-q}y_{1}\right)  \label{eq.prop.rec.cassini-gen2.eq}%
\end{equation}
for any $p,q\in\mathbb{N}$ satisfying $p\geq q$.
\end{proposition}

Proposition \ref{prop.rec.cassini-gen1} is the particular case of Proposition
\ref{prop.rec.cassini-gen2} for $p=n$ and $q=n-1$.

\begin{proof}
[Proof of Proposition \ref{prop.rec.cassini-gen2}.]We shall prove
(\ref{eq.prop.rec.cassini-gen2.eq}) by induction on $q$ (without fixing $p$):

\textit{Induction base:} For any $p\in\mathbb{N}$ satisfying $p\geq0$, we have
$x_{p+1}y_{0}-x_{p}y_{0+1}=\left(  -b\right)  ^{0}\left(  x_{p-0+1}%
y_{0}-x_{p-0}y_{1}\right)  $ (since $\underbrace{\left(  -b\right)  ^{0}}%
_{=1}\left(  \underbrace{x_{p-0+1}}_{=x_{p+1}}y_{0}-\underbrace{x_{p-0}%
}_{=x_{p}}\underbrace{y_{1}}_{=y_{0+1}}\right)  =x_{p+1}y_{0}-x_{p}y_{0+1}$).
In other words, (\ref{eq.prop.rec.cassini-gen2.eq}) holds for $q=0$ (and any
$p\in\mathbb{N}$ satisfying $p\geq0$).

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{eq.prop.rec.cassini-gen2.eq}) holds for
$q=m-1$ (and any $p\in\mathbb{N}$ satisfying $p\geq m-1$). We must prove that
(\ref{eq.prop.rec.cassini-gen2.eq}) holds for $q=m$ (and any $p\in\mathbb{N}$
satisfying $p\geq m$).

We have assumed that (\ref{eq.prop.rec.cassini-gen2.eq}) holds for $q=m-1$
(and any $p\in\mathbb{N}$ satisfying $p\geq m-1$). In other words, we have%
\begin{equation}
x_{p+1}y_{m-1}-x_{p}y_{\left(  m-1\right)  +1}=\left(  -b\right)
^{m-1}\left(  x_{p-\left(  m-1\right)  +1}y_{0}-x_{p-\left(  m-1\right)
}y_{1}\right)  \label{pf.prop.rec.cassini-gen2.IH}%
\end{equation}
for any $p\in\mathbb{N}$ satisfying $p\geq m-1$.

Now, let $p\in\mathbb{N}$ be such that $p\geq m$. The integer $m$ is positive;
thus, $m\geq1$. Hence, $m+1\geq2$. But the sequence $\left(  y_{0},y_{1}%
,y_{2},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent. In other words,
every $n\geq2$ satisfies $y_{n}=ay_{n-1}+by_{n-2}$ (by the definition of
\textquotedblleft$\left(  a,b\right)  $-recurrent\textquotedblright). Applying
this equality to $n=m+1$, we obtain
\begin{equation}
y_{m+1}=ay_{\left(  m+1\right)  -1}+by_{\left(  m+1\right)  -2}=ay_{m}%
+by_{m-1} \label{pf.prop.rec.cassini-gen2.2}%
\end{equation}
(since $m+1\geq2$).

Also, $p\geq m\geq1$. Hence, $p+1\geq2$. But the sequence $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent. In other
words, every $n\geq2$ satisfies $x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition
of \textquotedblleft$\left(  a,b\right)  $-recurrent\textquotedblright).
Applying this equality to $n=p+1$, we obtain
\[
x_{p+1}=ax_{\left(  p+1\right)  -1}+bx_{\left(  p+1\right)  -2}=ax_{p}%
+bx_{p-1}%
\]
(since $p+1\geq2$). Thus,%
\begin{equation}
x_{p+1}-ax_{p}=bx_{p-1}. \label{pf.prop.rec.cassini-gen2.4}%
\end{equation}


Now,%
\begin{align}
&  x_{p+1}y_{m}-x_{p}\underbrace{y_{m+1}}_{\substack{=ay_{m}+by_{m-1}%
\\\text{(by (\ref{pf.prop.rec.cassini-gen2.2}))}}}\nonumber\\
&  =x_{p+1}y_{m}-x_{p}\left(  ay_{m}+by_{m-1}\right)  =x_{p+1}y_{m}%
-x_{p}ay_{m}-x_{p}by_{m-1}\nonumber\\
&  =\underbrace{\left(  x_{p+1}-ax_{p}\right)  }_{\substack{=bx_{p-1}%
\\\text{(by (\ref{pf.prop.rec.cassini-gen2.4}))}}}y_{m}-x_{p}by_{m-1}%
=bx_{p-1}y_{m}-x_{p}by_{m-1}\nonumber\\
&  =\left(  -b\right)  \left(  x_{p}y_{m-1}-x_{p-1}y_{m}\right)  .
\label{pf.prop.rec.cassini-gen2.5}%
\end{align}


However, $p\geq m$ and thus $p-1\geq m-1\geq0$ (since $m\geq1$). In other
words, $p-1\in\mathbb{N}$. Also, $p-1\geq m-1$. Hence, we can apply
(\ref{pf.prop.rec.cassini-gen2.IH}) to $p-1$ instead of $p$. We thus obtain%
\[
x_{\left(  p-1\right)  +1}y_{m-1}-x_{p-1}y_{\left(  m-1\right)  +1}=\left(
-b\right)  ^{m-1}\left(  x_{\left(  p-1\right)  -\left(  m-1\right)  +1}%
y_{0}-x_{\left(  p-1\right)  -\left(  m-1\right)  }y_{1}\right)  .
\]
This rewrites as%
\[
x_{p}y_{m-1}-x_{p-1}y_{m}=\left(  -b\right)  ^{m-1}\left(  x_{p-m+1}%
y_{0}-x_{p-m}y_{1}\right)
\]
(since $\left(  p-1\right)  +1=p$ and $\left(  m-1\right)  +1=m$ and $\left(
p-1\right)  -\left(  m-1\right)  =p-m$). Thus,
(\ref{pf.prop.rec.cassini-gen2.5}) becomes%
\begin{align*}
&  x_{p+1}y_{m}-x_{p}y_{m+1}\\
&  =\left(  -b\right)  \underbrace{\left(  x_{p}y_{m-1}-x_{p-1}y_{m}\right)
}_{=\left(  -b\right)  ^{m-1}\left(  x_{p-m+1}y_{0}-x_{p-m}y_{1}\right)
}=\underbrace{\left(  -b\right)  \left(  -b\right)  ^{m-1}}_{=\left(
-b\right)  ^{m}}\left(  x_{p-m+1}y_{0}-x_{p-m}y_{1}\right) \\
&  =\left(  -b\right)  ^{m}\left(  x_{p-m+1}y_{0}-x_{p-m}y_{1}\right)  .
\end{align*}


Forget now that we fixed $p$. We thus have shown that
\[
x_{p+1}y_{m}-x_{p}y_{m+1}=\left(  -b\right)  ^{m}\left(  x_{p-m+1}%
y_{0}-x_{p-m}y_{1}\right)
\]
holds for any $p\in\mathbb{N}$ satisfying $p\geq m$. In other words,
(\ref{eq.prop.rec.cassini-gen2.eq}) holds for $q=m$ (and any $p\in\mathbb{N}$
satisfying $p\geq m$). This completes the induction step. Thus,
(\ref{eq.prop.rec.cassini-gen2.eq}) is proved. In other words, Proposition
\ref{prop.rec.cassini-gen2} is proved.
\end{proof}

This solves Exercise \ref{exe.rec.cassini-gen}. (An alternative proof of
Proposition \ref{prop.rec.cassini-gen2} can be given using the matrix
approach, similar to our second solution to Exercise \ref{exe.rec.cassini}.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.xn-mynpm}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.xn-mynpm}.]There are several ways of
solving this. Here is one:

\begin{proof}
[Solution to Exercise \ref{exe.rec.xn-mynpm}.]Fix $m\in\mathbb{N}$. We must
prove that%
\begin{equation}
x_{n-m}y_{n+m}=x_{n}y_{n}-\left(  -1\right)  ^{n+m}x_{m}y_{m}
\label{sol.rec.xn-mynpm.goal}%
\end{equation}
for each $n\in\mathbb{N}$ satisfying $n\geq m$. In other words, we must prove
that (\ref{sol.rec.xn-mynpm.goal}) holds for each integer $n\geq m$.

We shall prove this by induction on $n$:

\textit{Induction base:} Comparing $\underbrace{x_{m-m}}_{=x_{0}=0}y_{m+m}=0$
with $x_{m}y_{m}-\underbrace{\left(  -1\right)  ^{m+m}}%
_{\substack{=1\\\text{(since }m+m=2m\text{ is even)}}}x_{m}y_{m}=x_{m}%
y_{m}-x_{m}y_{m}=0$, we obtain $x_{m-m}y_{m+m}=x_{m}y_{m}-\left(  -1\right)
^{m+m}x_{m}y_{m}$. In other words, (\ref{sol.rec.xn-mynpm.goal}) holds for
$n=m$.

\textit{Induction step:} Let $k$ be an integer satisfying $k\geq m$. Assume
(as the induction hypothesis) that (\ref{sol.rec.xn-mynpm.goal}) holds for
$n=k$. We must prove that (\ref{sol.rec.xn-mynpm.goal}) holds for $n=k+1$.

Exercise \ref{exe.rec.addition} (applied to $1$, $k$ and $k$ instead of $b$,
$n$ and $m$) yields%
\[
1x_{0}y_{k+k}+x_{1}y_{k+k+1}=1x_{k}y_{k}+x_{k+1}y_{k+1}=x_{k}y_{k}%
+x_{k+1}y_{k+1}.
\]
Hence,%
\begin{align}
x_{k}y_{k}+x_{k+1}y_{k+1}  &  =1x_{0}y_{k+k}+x_{1}y_{k+k+1}=x_{0}y_{k+k}%
+x_{1}y_{k+k+1}\nonumber\\
&  =x_{0}y_{2k}+x_{1}y_{2k+1} \label{sol.rec.xn-mynpm.3}%
\end{align}
(since $k+k=2k$).

From $k\geq m$, we obtain $k-m\in\mathbb{N}$. Hence, Exercise
\ref{exe.rec.addition} (applied to $1$, $k-m$ and $k+m$ instead of $b$, $n$
and $m$) yields%
\begin{align*}
1x_{0}y_{\left(  k-m\right)  +\left(  k+m\right)  }+x_{1}y_{\left(
k-m\right)  +\left(  k+m\right)  +1}  &  =1x_{k-m}y_{k+m}+x_{k-m+1}y_{k+m+1}\\
&  =x_{k-m}y_{k+m}+x_{k-m+1}y_{k+m+1}.
\end{align*}
Hence,%
\begin{align*}
x_{k-m}y_{k+m}+x_{k-m+1}y_{k+m+1}  &  =1x_{0}y_{\left(  k-m\right)  +\left(
k+m\right)  }+x_{1}y_{\left(  k-m\right)  +\left(  k+m\right)  +1}\\
&  =x_{0}y_{\left(  k-m\right)  +\left(  k+m\right)  }+x_{1}y_{\left(
k-m\right)  +\left(  k+m\right)  +1}\\
&  =x_{0}y_{2k}+x_{1}y_{2k+1}%
\end{align*}
(since $\left(  k-m\right)  +\left(  k+m\right)  =2k$). Comparing this with
(\ref{sol.rec.xn-mynpm.3}), we obtain%
\[
x_{k-m}y_{k+m}+x_{k-m+1}y_{k+m+1}=x_{k}y_{k}+x_{k+1}y_{k+1}.
\]
In other words,%
\begin{equation}
x_{k-m+1}y_{k+m+1}=x_{k}y_{k}+x_{k+1}y_{k+1}-x_{k-m}y_{k+m}.
\label{sol.rec.xn-mynpm.5}%
\end{equation}


We have assumed that (\ref{sol.rec.xn-mynpm.goal}) holds for $n=k$. In other
words, we have%
\[
x_{k-m}y_{k+m}=x_{k}y_{k}-\left(  -1\right)  ^{k+m}x_{m}y_{m}.
\]
Hence, (\ref{sol.rec.xn-mynpm.5}) becomes%
\begin{align*}
x_{k-m+1}y_{k+m+1}  &  =x_{k}y_{k}+x_{k+1}y_{k+1}-\underbrace{x_{k-m}y_{k+m}%
}_{=x_{k}y_{k}-\left(  -1\right)  ^{k+m}x_{m}y_{m}}\\
&  =x_{k}y_{k}+x_{k+1}y_{k+1}-\left(  x_{k}y_{k}-\left(  -1\right)
^{k+m}x_{m}y_{m}\right) \\
&  =x_{k+1}y_{k+1}-\left(  -1\right)  ^{k+m}x_{m}y_{m}=x_{k+1}y_{k+1}%
+\underbrace{\left(  -\left(  -1\right)  ^{k+m}\right)  }_{=\left(  -1\right)
^{k+m+1}}x_{m}y_{m}\\
&  =x_{k+1}y_{k+1}+\left(  -1\right)  ^{k+m+1}x_{m}y_{m}.
\end{align*}
In view of $k-m+1=\left(  k+1\right)  -m$ and $k+m+1=\left(  k+1\right)  +m$,
we can rewrite this as
\[
x_{\left(  k+1\right)  -m}y_{\left(  k+1\right)  +m}=x_{k+1}y_{k+1}+\left(
-1\right)  ^{\left(  k+1\right)  +m}x_{m}y_{m}.
\]
In other words, (\ref{sol.rec.xn-mynpm.goal}) holds for $n=k+1$. This
completes the induction step. Hence, (\ref{sol.rec.xn-mynpm.goal}) is proved.
In other words, Exercise \ref{exe.rec.xn-mynpm} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.gcd}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.gcd}.]The solution to Exercise
\ref{exe.rec.gcd} is rather similar to that of Exercise \ref{exe.fib.gcd-nbr},
which it generalizes. We will take the lazy route and just copy the latter
solution, modifying whatever we need to modify. We begin with a lemma that
generalizes Lemma \ref{lem.sol.fib.gcd-nbr.gcd}:

\begin{lemma}
\label{lem.sol.rec.gcd.gcd1}Let $u$ and $v$ be two integers such that $u\perp
v$. Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be a $\left(  u,v\right)
$-recurrent sequence of integers with $x_{0}=0$ and $x_{1}=1$. Let
$a,b\in\mathbb{N}$ be such that $a>0$ and $a\leq b$. Then, $\gcd\left(
x_{a},x_{b}\right)  =\gcd\left(  x_{a},x_{b-a}\right)  $.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.rec.gcd.gcd1}.]From $a>0$, we obtain $a\geq1$ and
thus $a-1\in\mathbb{N}$. Hence, Exercise \ref{exe.rec.addition01} (applied to
$u$, $v$, $b-a$, $a-1$ and $x_{i}$ instead of $a$, $b$, $n$, $m$ and $y_{i}$)
yields%
\begin{align*}
x_{\left(  b-a\right)  +\left(  a-1\right)  +1}  &  =\underbrace{vx_{b-a}%
}_{=x_{b-a}v}x_{a-1}+x_{\left(  b-a\right)  +1}\underbrace{x_{\left(
a-1\right)  +1}}_{\substack{=x_{a}\\\equiv0\operatorname{mod}x_{a}}}\\
&  \equiv x_{b-a}vx_{a-1}+x_{\left(  b-a\right)  +1}0=x_{b-a}vx_{a-1}%
\operatorname{mod}x_{a}.
\end{align*}
In view of $\left(  b-a\right)  +\left(  a-1\right)  +1=b$, this rewrites as
$x_{b}\equiv x_{b-a}vx_{a-1}\operatorname{mod}x_{a}$. Hence, Proposition
\ref{prop.ent.gcd.props1} \textbf{(d)} (applied to $x_{a}$, $x_{b}$ and
$x_{b-a}vx_{a-1}$ instead of $a$, $b$ and $c$) yields%
\begin{equation}
\gcd\left(  x_{a},x_{b}\right)  =\gcd\left(  x_{a},x_{b-a}vx_{a-1}\right)  .
\label{pf.lem.sol.rec.gcd.gcd1.1}%
\end{equation}


But recall the claim (\ref{sol.ent.rec.gcd-nbrs.goal}) that was proved during
our solution to Exercise \ref{exe.ent.rec.gcd-nbrs}. Applying this claim
(\ref{sol.ent.rec.gcd-nbrs.goal}) to $n=a-1$, we obtain%
\[
x_{a-1}\perp x_{\left(  a-1\right)  +1}\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ v\perp x_{\left(  a-1\right)  +1}.
\]
In view of $\left(  a-1\right)  +1=a$, this rewrites as%
\[
x_{a-1}\perp x_{a}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ v\perp
x_{a}.
\]
Hence, Theorem \ref{thm.ent.coprime.ab-to-c} (applied to $v$, $x_{a-1}$ and
$x_{a}$ instead of $a$, $b$ and $c$) yields $vx_{a-1}\perp x_{a}$. According
to Proposition \ref{prop.ent.coprime.perp-symm}, this yields $x_{a}\perp
vx_{a-1}$. Hence, Proposition \ref{prop.ent.coprime.gcd=gcd} (applied to
$x_{a}$, $x_{b-a}$ and $vx_{a-1}$ instead of $a$, $b$ and $c$) yields
$\gcd\left(  x_{a},x_{b-a}vx_{a-1}\right)  =\gcd\left(  x_{a},x_{b-a}\right)
$. Thus, (\ref{pf.lem.sol.rec.gcd.gcd1.1}) becomes%
\[
\gcd\left(  x_{a},x_{b}\right)  =\gcd\left(  x_{a},x_{b-a}vx_{a-1}\right)
=\gcd\left(  x_{a},x_{b-a}\right)  .
\]
This proves Lemma \ref{lem.sol.rec.gcd.gcd1}.
\end{proof}

We can now step to the actual solution to Exercise \ref{exe.rec.gcd}:

\begin{proof}
[Solution to Exercise \ref{exe.rec.gcd} (sketched).]We use strong induction on
$a+b$:

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.rec.gcd} is true for $a+b<k$. We must prove
that Exercise \ref{exe.rec.gcd} is true for $a+b=k$. Let us do this now.

So let $a,b\in\mathbb{N}$ be such that $a+b=k$. We must show that $\gcd\left(
x_{a},x_{b}\right)  =\left\vert x_{\gcd\left(  a,b\right)  }\right\vert $.

Note that $a$ and $b$ play symmetric roles in this claim\footnote{because
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} yields $\gcd\left(
a,b\right)  =\gcd\left(  b,a\right)  $ and $\gcd\left(  x_{a},x_{b}\right)
=\gcd\left(  x_{b},x_{a}\right)  $}, and thus can be swapped at will. By
swapping $a$ and $b$ if necessary, we can ensure that $a\leq b$. Hence, we
WLOG assume that $a\leq b$. Thus, $b-a\in\mathbb{N}$.

It is easy to see that our claim $\gcd\left(  x_{a},x_{b}\right)  =\left\vert
x_{\gcd\left(  a,b\right)  }\right\vert $ holds if $a=0$%
\ \ \ \ \footnote{\textit{Proof.} Assume that $a=0$. Then, $\gcd\left(
a,b\right)  =b$ (this has already been proved during our above proof of
Theorem \ref{thm.ent.gcd.bezout}) and thus $b=\gcd\left(  a,b\right)  $.
Furthermore, from $a=0$, we obtain $x_{a}=x_{0}=0$ and therefore%
\begin{align*}
\gcd\left(  x_{a},x_{b}\right)   &  =\gcd\left(  0,x_{b}\right) \\
&  =\gcd\left(  x_{b},0\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(b)}}\right) \\
&  =\left\vert x_{b}\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{by
Proposition \ref{prop.ent.gcd.props1} \textbf{(a)}}\right) \\
&  =\left\vert x_{\gcd\left(  a,b\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b=\gcd\left(  a,b\right)  \right)  ,
\end{align*}
qed.}. Thus, we are done if $a=0$. Hence, we WLOG assume that $a\neq0$.
Therefore, $a>0$ (since $a\in\mathbb{N}$). Thus, $a+b>b$, so that $b<a+b=k$.

But our induction hypothesis says that Exercise \ref{exe.rec.gcd} is true for
$a+b<k$. Hence, we can apply Exercise \ref{exe.rec.gcd} to $b-a$ instead of
$b$ (since $b-a\in\mathbb{N}$ and $a+\left(  b-a\right)  =b<k$). We thus
obtain
\begin{equation}
\gcd\left(  x_{a},x_{b-a}\right)  =\left\vert x_{\gcd\left(  a,b-a\right)
}\right\vert . \label{sol.rec.gcd.4}%
\end{equation}
But we have $\gcd\left(  a,b-a\right)  =\gcd\left(  a,b\right)  $ (this has
already been proved during our proof of Theorem \ref{thm.ent.gcd.bezout}).
Furthermore, Lemma \ref{lem.sol.rec.gcd.gcd1} yields%
\begin{align*}
\gcd\left(  x_{a},x_{b}\right)   &  =\gcd\left(  x_{a},x_{b-a}\right)
=\left\vert x_{\gcd\left(  a,b-a\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.rec.gcd.4})}\right) \\
&  =\left\vert x_{\gcd\left(  a,b\right)  }\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\gcd\left(  a,b-a\right)
=\gcd\left(  a,b\right)  \right)  .
\end{align*}


Now, forget that we fixed $a,b$. We thus have shown that any $a,b\in
\mathbb{N}$ satisfying $a+b=k$ satisfy $\gcd\left(  x_{a},x_{b}\right)
=\left\vert x_{\gcd\left(  a,b\right)  }\right\vert $. In other words,
Exercise \ref{exe.rec.gcd} is true for $a+b=k$. This completes the induction
step. Thus, Exercise \ref{exe.rec.gcd} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.VSE28}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.VSE28}.]Exercise \ref{exe.rec.VSE28} is a
classic exercise (see, e.g., \cite[Exercise 14.38]{Engel} or \cite[Problem
31]{Strasz65} or \cite[Problem 15.53]{Polya81}) that can be used to illustrate
various ideas. We shall generalize it by replacing $\sqrt{2}-1$ by $\sqrt
{g+1}-\sqrt{g}$, where $g$ is an arbitrary nonnegative integer. That is, we
shall prove that there exists some $m\in\mathbb{N}$ such that%
\begin{equation}
\left(  \sqrt{g+1}-\sqrt{g}\right)  ^{n}=\sqrt{m+1}-\sqrt{m}.
\label{sol.rec.VSE28.gen}%
\end{equation}
This generalization does not simplify the problem, but it is so nice I
couldn't leave it unexplored.\footnote{See also \cite[Problem 941]{GelAnd} or
\cite[Problem 1.4]{Tomesc85} for a variant of this generalization in which the
minus signs are replaced by plus signs.}

So let us try to solve the generalized problem. The most straightforward
approach is to try to find the $m$ that satisfies (\ref{sol.rec.VSE28.gen})
explicitly (in terms of $n$ and $g$). The function that sends each
$m\in\mathbb{N}$ to $\sqrt{m+1}-\sqrt{m}\in\mathbb{R}$ is strictly decreasing
(check this!) and thus injective; hence, if there is an $m\in\mathbb{N}$
satisfying (\ref{sol.rec.VSE28.gen}), then this $m$ is unique. Furthermore, it
can be computed explicitly by solving the equation (\ref{sol.rec.VSE28.gen})
for $m$. More generally, for any fixed nonnegative real $a\leq1$, we can solve
the equation%
\begin{equation}
a=\sqrt{x+1}-\sqrt{x} \label{sol.rec.VSE28.gen-eq}%
\end{equation}
in the unknown $x\geq0$; the solution is always%
\begin{equation}
x=\left(  \dfrac{a-1/a}{2}\right)  ^{2} \label{sol.rec.VSE28.gen-sol}%
\end{equation}
(check this!). We can apply this to $a=\left(  \sqrt{g+1}-\sqrt{g}\right)
^{n}$ (indeed, it is easy to see that the number $\sqrt{g+1}-\sqrt{g}$ is
positive and $\leq1$; therefore, the same holds for its $n$-th power $a$), and
thus we find that the solution $m$ is given by%
\begin{align}
m  &  =\left(  \dfrac{\left(  \sqrt{g+1}-\sqrt{g}\right)  ^{n}-1/\left(
\sqrt{g+1}-\sqrt{g}\right)  ^{n}}{2}\right)  ^{2}\nonumber\\
&  =\left(  \dfrac{\left(  \sqrt{g+1}-\sqrt{g}\right)  ^{n}-\left(  \sqrt
{g+1}+\sqrt{g}\right)  ^{n}}{2}\right)  ^{2} \label{sol.rec.VSE28.idea2}%
\end{align}
(by fairly simple computations\footnote{Specifically, we have to notice that
$1/\left(  \sqrt{g+1}-\sqrt{g}\right)  =\sqrt{g+1}+\sqrt{g}$ and thus
$1/\left(  \sqrt{g+1}-\sqrt{g}\right)  ^{n}=\left(  \sqrt{g+1}+\sqrt
{g}\right)  ^{n}$.}). It thus remains to prove that this $m$ is an element of
$\mathbb{N}$. Thus, we must prove the following theorem:

\begin{theorem}
\label{thm.sol.rec.VSE28.g-gen}Let $g\in\mathbb{N}$ and $n\in\mathbb{N}$. Let
$\lambda=\sqrt{g+1}-\sqrt{g}$ and $\mu=\sqrt{g+1}+\sqrt{g}$. Let%
\[
m=\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}.
\]
Then, we have $m\in\mathbb{N}$ and $\lambda^{n}=\sqrt{m+1}-\sqrt{m}$.
\end{theorem}

We will give two proofs of Theorem \ref{thm.sol.rec.VSE28.g-gen} and sketch a
third one. First, let us prove an auxiliary lemma:

\begin{lemma}
\label{lem.binom-sumdiff}Let $u$ and $v$ be two numbers. Let $n\in\mathbb{N}$.
Then,%
\begin{equation}
\left(  u+v\right)  ^{n}+\left(  u-v\right)  ^{n}=2\sum_{\substack{k\in
\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}}}\dbinom{n}{k}v^{k}u^{n-k}
\label{pf.lem.binom-sumdiff.plus}%
\end{equation}
and%
\begin{equation}
\left(  u+v\right)  ^{n}-\left(  u-v\right)  ^{n}=2\sum_{\substack{k\in
\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}v^{k}u^{n-k}.
\label{pf.lem.binom-sumdiff.minus}%
\end{equation}

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom-sumdiff}.]We have $u+v=v+u$ and thus%
\begin{equation}
\left(  u+v\right)  ^{n}=\left(  v+u\right)  ^{n}=\sum_{k=0}^{n}\dbinom{n}%
{k}v^{k}u^{n-k} \label{pf.lem.binom-sumdiff.upv}%
\end{equation}
(by Theorem \ref{thm.binom.binom}, applied to $x=v$ and $y=u$). Also,
$u-v=\left(  -v\right)  +u$ and thus%
\begin{equation}
\left(  u-v\right)  ^{n}=\left(  \left(  -v\right)  +u\right)  ^{n}=\sum
_{k=0}^{n}\dbinom{n}{k}\left(  -v\right)  ^{k}u^{n-k}
\label{pf.lem.binom-sumdiff.umv}%
\end{equation}
(by Theorem \ref{thm.binom.binom}, applied to $x=-v$ and $y=u$). Adding this
equality to the equality (\ref{pf.lem.binom-sumdiff.upv}), we obtain%
\begin{align*}
&  \left(  u+v\right)  ^{n}+\left(  u-v\right)  ^{n}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}v^{k}u^{n-k}+\sum_{k=0}^{n}\dbinom{n}%
{k}\underbrace{\left(  -v\right)  ^{k}}_{=\left(  -1\right)  ^{k}v^{k}}%
u^{n-k}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}v^{k}u^{n-k}+\sum_{k=0}^{n}\dbinom{n}{k}\left(
-1\right)  ^{k}v^{k}u^{n-k}\\
&  =\underbrace{\sum_{k=0}^{n}}_{=\sum_{k\in\left\{  0,1,\ldots,n\right\}  }%
}\underbrace{\left(  \dbinom{n}{k}v^{k}u^{n-k}+\dbinom{n}{k}\left(  -1\right)
^{k}v^{k}u^{n-k}\right)  }_{=\dbinom{n}{k}\left(  1+\left(  -1\right)
^{k}\right)  v^{k}u^{n-k}}\\
&  =\sum_{k\in\left\{  0,1,\ldots,n\right\}  }\dbinom{n}{k}\left(  1+\left(
-1\right)  ^{k}\right)  v^{k}u^{n-k}\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\left(  1+\underbrace{\left(  -1\right)  ^{k}}%
_{\substack{=1\\\text{(since }k\text{ is even)}}}\right)  v^{k}u^{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ +\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}
;\\k\text{ is odd}}}\dbinom{n}{k}\left(  1+\underbrace{\left(  -1\right)
^{k}}_{\substack{=-1\\\text{(since }k\text{ is odd)}}}\right)  v^{k}u^{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since each }%
k\in\left\{  0,1,\ldots,n\right\}  \text{ is either even or odd}\right) \\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\underbrace{\left(  1+1\right)  }_{=2}v^{k}u^{n-k}%
+\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\underbrace{\left(  1+\left(  -1\right)  \right)  }_{=0}%
v^{k}u^{n-k}\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\cdot2v^{k}u^{n-k}+\underbrace{\sum_{\substack{k\in\left\{
0,1,\ldots,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}\cdot0v^{k}u^{n-k}%
}_{=0}\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\cdot2v^{k}u^{n-k}=2\sum_{\substack{k\in\left\{  0,1,\ldots
,n\right\}  ;\\k\text{ is even}}}\dbinom{n}{k}v^{k}u^{n-k}.
\end{align*}
This proves (\ref{pf.lem.binom-sumdiff.plus}).

Subtracting the equality (\ref{pf.lem.binom-sumdiff.umv}) from the equality
(\ref{pf.lem.binom-sumdiff.upv}), we obtain%
\begin{align*}
&  \left(  u+v\right)  ^{n}-\left(  u-v\right)  ^{n}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}v^{k}u^{n-k}-\sum_{k=0}^{n}\dbinom{n}%
{k}\underbrace{\left(  -v\right)  ^{k}}_{=\left(  -1\right)  ^{k}v^{k}}%
u^{n-k}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}v^{k}u^{n-k}-\sum_{k=0}^{n}\dbinom{n}{k}\left(
-1\right)  ^{k}v^{k}u^{n-k}\\
&  =\underbrace{\sum_{k=0}^{n}}_{=\sum_{k\in\left\{  0,1,\ldots,n\right\}  }%
}\underbrace{\left(  \dbinom{n}{k}v^{k}u^{n-k}-\dbinom{n}{k}\left(  -1\right)
^{k}v^{k}u^{n-k}\right)  }_{=\dbinom{n}{k}\left(  1-\left(  -1\right)
^{k}\right)  v^{k}u^{n-k}}\\
&  =\sum_{k\in\left\{  0,1,\ldots,n\right\}  }\dbinom{n}{k}\left(  1-\left(
-1\right)  ^{k}\right)  v^{k}u^{n-k}\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\left(  1-\underbrace{\left(  -1\right)  ^{k}}%
_{\substack{=1\\\text{(since }k\text{ is even)}}}\right)  v^{k}u^{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ +\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}
;\\k\text{ is odd}}}\dbinom{n}{k}\left(  1-\underbrace{\left(  -1\right)
^{k}}_{\substack{=-1\\\text{(since }k\text{ is odd)}}}\right)  v^{k}u^{n-k}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since each }%
k\in\left\{  0,1,\ldots,n\right\}  \text{ is either even or odd}\right) \\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}\underbrace{\left(  1-1\right)  }_{=0}v^{k}u^{n-k}%
+\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\underbrace{\left(  1-\left(  -1\right)  \right)  }_{=2}%
v^{k}u^{n-k}\\
&  =\underbrace{\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{
is even}}}\dbinom{n}{k}\cdot0v^{k}u^{n-k}}_{=0}+\sum_{\substack{k\in\left\{
0,1,\ldots,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}\cdot2v^{k}u^{n-k}\\
&  =\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\cdot2v^{k}u^{n-k}=2\sum_{\substack{k\in\left\{  0,1,\ldots
,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}v^{k}u^{n-k}.
\end{align*}
This proves (\ref{pf.lem.binom-sumdiff.minus}). Thus, Lemma
\ref{lem.binom-sumdiff} is proven.
\end{proof}

\begin{proof}
[First proof of Theorem \ref{thm.sol.rec.VSE28.g-gen}.]We have $m=\left(
\dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}\geq0$ (since the square of any
real is nonnegative) and thus $m+1\geq1\geq0$. Hence, $\sqrt{m+1}$ and
$\sqrt{m}$ are well-defined.

Multiplying the equalities $\lambda=\sqrt{g+1}-\sqrt{g}$ and $\mu=\sqrt
{g+1}+\sqrt{g}$, we obtain%
\begin{align}
\lambda\mu &  =\left(  \sqrt{g+1}-\sqrt{g}\right)  \left(  \sqrt{g+1}+\sqrt
{g}\right)  =\underbrace{\left(  \sqrt{g+1}\right)  ^{2}}_{=g+1}%
-\underbrace{\left(  \sqrt{g}\right)  ^{2}}_{=g}\nonumber\\
&  =\left(  g+1\right)  -g=1. \label{pf.thm.sol.rec.VSE28.g-gen.lm}%
\end{align}
Hence, the numbers $\lambda$ and $\mu$ are nonzero and are each other's
inverses; in particular, $\lambda=1/\mu$. But $\mu=\sqrt{g+1}+\sqrt{g}%
\geq\sqrt{g+1}\geq1$ (since $g+1\geq1$); hence, $1/\mu\leq1/1=1$ and thus
$\lambda=1/\mu\leq1$. Also, $\mu\geq1>0$ and thus $1/\mu>0$ and therefore
$\lambda=1/\mu>0$. Now, $\mu\geq1\geq\lambda$ (since $\lambda\leq1$), so that
$\mu^{n}\geq\lambda^{n}$ (since $n\geq0$ and since $\mu>0$ and $\lambda>0$).
Therefore, $\mu^{n}-\lambda^{n}\geq0$, so that $\dfrac{\mu^{n}-\lambda^{n}}%
{2}\geq0$. Now, from $m=\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}$,
we obtain%
\begin{align}
\sqrt{m}  &  =\sqrt{\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}%
}=\left\vert \dfrac{\mu^{n}-\lambda^{n}}{2}\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\sqrt{x^{2}}=\left\vert x\right\vert
\text{ for each }x\in\mathbb{R}\right) \nonumber\\
&  =\dfrac{\mu^{n}-\lambda^{n}}{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\dfrac{\mu^{n}-\lambda^{n}}{2}\geq0\right)  .
\label{pf.thm.sol.rec.VSE28.g-gen.sqrt-m}%
\end{align}
Furthermore, from $m=\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}$, we
obtain%
\[
m+1=\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}+1=\left(  \dfrac
{\mu^{n}+\lambda^{n}}{2}\right)  ^{2}%
\]
(by the equality $\left(  \dfrac{a-b}{2}\right)  ^{2}+1=\left(  \dfrac{a+b}%
{2}\right)  ^{2}$, which holds for any two numbers $a$ and $b$). Hence,%
\begin{align*}
\sqrt{m+1}  &  =\sqrt{\left(  \dfrac{\mu^{n}+\lambda^{n}}{2}\right)  ^{2}%
}=\left\vert \dfrac{\mu^{n}+\lambda^{n}}{2}\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\sqrt{x^{2}}=\left\vert x\right\vert
\text{ for each }x\in\mathbb{R}\right) \\
&  =\dfrac{\mu^{n}+\lambda^{n}}{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\dfrac{\mu^{n}+\lambda^{n}}{2}\geq0\text{ (because }\mu>0\text{ and }%
\lambda>0\text{)}\right)  .
\end{align*}
Subtracting the equality (\ref{pf.thm.sol.rec.VSE28.g-gen.sqrt-m}) from this
equality, we find%
\begin{equation}
\sqrt{m+1}-\sqrt{m}=\dfrac{\mu^{n}+\lambda^{n}}{2}-\dfrac{\mu^{n}-\lambda^{n}%
}{2}=\lambda^{n}.\nonumber
\end{equation}
Thus, $\lambda^{n}=\sqrt{m+1}-\sqrt{m}$ is proven. It remains to show that
$m\in\mathbb{N}$.

From $\lambda=\sqrt{g+1}-\sqrt{g}$ and $\mu=\sqrt{g+1}+\sqrt{g}$, we obtain%
\begin{align*}
\mu^{n}-\lambda^{n}  &  =\left(  \sqrt{g+1}+\sqrt{g}\right)  ^{n}-\left(
\sqrt{g+1}-\sqrt{g}\right)  ^{n}\\
&  =2\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}\underbrace{\left(  \sqrt{g}\right)  ^{k}}_{=g^{k/2}%
}\underbrace{\left(  \sqrt{g+1}\right)  ^{n-k}}_{=\left(  g+1\right)
^{\left(  n-k\right)  /2}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.lem.binom-sumdiff.minus}), applied to }u=\sqrt{g+1}\text{ and
}v=\sqrt{g}\right) \\
&  =2\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is odd}%
}}\dbinom{n}{k}g^{k/2}\left(  g+1\right)  ^{\left(  n-k\right)  /2}.
\end{align*}
Dividing both sides of this equality by $2$, we find%
\begin{equation}
\dfrac{\mu^{n}-\lambda^{n}}{2}=\sum_{\substack{k\in\left\{  0,1,\ldots
,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}g^{k/2}\left(  g+1\right)
^{\left(  n-k\right)  /2}. \label{pf.thm.sol.rec.VSE28.g-gen.4}%
\end{equation}
Thus, (\ref{pf.thm.sol.rec.VSE28.g-gen.sqrt-m}) becomes%
\begin{equation}
\sqrt{m}=\dfrac{\mu^{n}-\lambda^{n}}{2}=\sum_{\substack{k\in\left\{
0,1,\ldots,n\right\}  ;\\k\text{ is odd}}}\dbinom{n}{k}g^{k/2}\left(
g+1\right)  ^{\left(  n-k\right)  /2}. \label{pf.thm.sol.rec.VSE28.g-gen.5}%
\end{equation}


Now, we make the following three claims:

\begin{statement}
\textit{Claim 1:} If $n$ is even, then there is an integer $u$ such that
$\sqrt{m}=\sqrt{g}\cdot\sqrt{g+1}\cdot u$.
\end{statement}

\begin{statement}
\textit{Claim 2:} If $n$ is odd, then there is an integer $u$ such that
$\sqrt{m}=\sqrt{g}\cdot u$.
\end{statement}

\begin{statement}
\textit{Claim 3:} We always have $m\in\mathbb{Z}$.
\end{statement}

[\textit{Proof of Claim 1:} Assume that $n$ is even. Thus, $n=2r$ for some
$r\in\mathbb{Z}$. Consider this $r$. We have $2r=n\geq0$ and thus $r\geq0$.
The equality (\ref{pf.thm.sol.rec.VSE28.g-gen.5}) rewrites as%
\begin{equation}
\sqrt{m}=\sum_{\substack{k\in\left\{  0,1,\ldots,2r\right\}  ;\\k\text{ is
odd}}}\dbinom{2r}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r-k\right)  /2}
\label{pf.thm.sol.rec.VSE28.g-gen.5ev}%
\end{equation}
(since $n=2r$).

Now, the odd elements of the set $\left\{  0,1,\ldots,2r\right\}  $ are
$1,3,5,\ldots,2r-1$. In other words, the odd elements of the set $\left\{
0,1,\ldots,2r\right\}  $ are the elements $2i-1$ for $i\in\left\{
1,2,\ldots,r\right\}  $. Hence, the map%
\begin{align*}
\left\{  1,2,\ldots,r\right\}   &  \rightarrow\left\{  k\in\left\{
0,1,\ldots,2r\right\}  \ \mid\ k\text{ is odd}\right\}  ,\\
i  &  \mapsto2i-1
\end{align*}
is a bijection. Thus, we can substitute $2i-1$ for $k$ in the sum
\[
\sum_{\substack{k\in\left\{  0,1,\ldots,2r\right\}  ;\\k\text{ is odd}%
}}\dbinom{2r}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r-k\right)  /2}.
\]
We thus obtain%
\begin{align*}
&  \sum_{\substack{k\in\left\{  0,1,\ldots,2r\right\}  ;\\k\text{ is odd}%
}}\dbinom{2r}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r-k\right)  /2}\\
&  =\sum_{i\in\left\{  1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}%
\underbrace{g^{\left(  2i-1\right)  /2}}_{\substack{=g^{\left(  i-1\right)
+1/2}\\\text{(since }\left(  2i-1\right)  /2=\left(  i-1\right)  +1/2\text{)}%
}}\ \ \underbrace{\left(  g+1\right)  ^{\left(  2r-\left(  2i-1\right)
\right)  /2}}_{\substack{=\left(  g+1\right)  ^{\left(  r-i\right)
+1/2}\\\text{(since }\left(  2r-\left(  2i-1\right)  \right)  /2=\left(
r-i\right)  +1/2\text{)}}}\\
&  =\sum_{i\in\left\{  1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}%
\underbrace{g^{\left(  i-1\right)  +1/2}}_{\substack{=g^{i-1}g^{1/2}%
\\\text{(because }i-1\text{ and }1/2\text{ are}\\\text{nonnegative (since
}i\in\left\{  1,2,\ldots,r\right\}  \\\text{entails }i\geq1\text{ and thus
}i-1\geq0\text{))}}}\ \ \underbrace{\left(  g+1\right)  ^{\left(  r-i\right)
+1/2}}_{\substack{=\left(  g+1\right)  ^{r-i}\left(  g+1\right)
^{1/2}\\\text{(because }r-i\text{ and }1/2\text{ are}\\\text{nonnegative
(since }i\in\left\{  1,2,\ldots,r\right\}  \\\text{entails }i\leq r\text{ and
thus }r-i\geq0\text{))}}}\\
&  =\sum_{i\in\left\{  1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}g^{i-1}%
\underbrace{g^{1/2}}_{=\sqrt{g}}\left(  g+1\right)  ^{r-i}\underbrace{\left(
g+1\right)  ^{1/2}}_{=\sqrt{g+1}}\\
&  =\sum_{i\in\left\{  1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}g^{i-1}\sqrt
{g}\left(  g+1\right)  ^{r-i}\sqrt{g+1}\\
&  =\sqrt{g}\cdot\sqrt{g+1}\cdot\sum_{i\in\left\{  1,2,\ldots,r\right\}
}\dbinom{2r}{2i-1}g^{i-1}\left(  g+1\right)  ^{r-i}.
\end{align*}
Hence, (\ref{pf.thm.sol.rec.VSE28.g-gen.5ev}) becomes%
\begin{align}
\sqrt{m}  &  =\sum_{\substack{k\in\left\{  0,1,\ldots,2r\right\}  ;\\k\text{
is odd}}}\dbinom{2r}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r-k\right)
/2}\nonumber\\
&  =\sqrt{g}\cdot\sqrt{g+1}\cdot\sum_{i\in\left\{  1,2,\ldots,r\right\}
}\dbinom{2r}{2i-1}g^{i-1}\left(  g+1\right)  ^{r-i}.
\label{pf.thm.sol.rec.VSE28.g-gen.7ev}%
\end{align}
Note that the sum $\sum_{i\in\left\{  1,2,\ldots,r\right\}  }\dbinom{2r}%
{2i-1}g^{i-1}\left(  g+1\right)  ^{r-i}$ on the right hand side of this
equality is an integer\footnote{Indeed, for each $i\in\left\{  1,2,\ldots
,r\right\}  $, the binomial coefficient $\dbinom{2r}{2i-1}$ is an integer
(since Theorem \ref{thm.binom.ZZ} yields that $\dbinom{2r}{2i-1}\in\mathbb{Z}%
$), and the powers $g^{i-1}$ and $\left(  g+1\right)  ^{r-i}$ are integers as
well (since $i\in\left\{  1,2,\ldots,r\right\}  $ entails $i-1\in\mathbb{N}$
and $r-i\in\mathbb{N}$). Therefore, each addend of the sum $\sum_{i\in\left\{
1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}g^{i-1}\left(  g+1\right)  ^{r-i}$ is
an integer. Hence, the sum itself is an integer as well.}. Thus, the equality
(\ref{pf.thm.sol.rec.VSE28.g-gen.7ev}) shows that there is an integer $u$ such
that $\sqrt{m}=\sqrt{g}\cdot\sqrt{g+1}\cdot u$ (namely, $u=\sum_{i\in\left\{
1,2,\ldots,r\right\}  }\dbinom{2r}{2i-1}g^{i-1}\left(  g+1\right)  ^{r-i}$).
This proves Claim 1.]

[\textit{Proof of Claim 2:} Assume that $n$ is odd. Thus, $n=2r+1$ for some
$r\in\mathbb{Z}$. Consider this $r$. We have $2r+1=n\geq0$ and thus
$r\geq-\dfrac{1}{2}$, so that $r\geq0$ (since $r\in\mathbb{Z}$). The equality
(\ref{pf.thm.sol.rec.VSE28.g-gen.5}) rewrites as%
\begin{equation}
\sqrt{m}=\sum_{\substack{k\in\left\{  0,1,\ldots,2r+1\right\}  ;\\k\text{ is
odd}}}\dbinom{2r+1}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r+1-k\right)  /2}
\label{pf.thm.sol.rec.VSE28.g-gen.5od}%
\end{equation}
(since $n=2r+1$).

Now, the odd elements of the set $\left\{  0,1,\ldots,2r+1\right\}  $ are
$1,3,5,\ldots,2r+1$. In other words, the odd elements of the set $\left\{
0,1,\ldots,2r+1\right\}  $ are the elements $2i+1$ for $i\in\left\{
0,1,\ldots,r\right\}  $. Hence, the map%
\begin{align*}
\left\{  0,1,\ldots,r\right\}   &  \rightarrow\left\{  k\in\left\{
0,1,\ldots,2r+1\right\}  \ \mid\ k\text{ is odd}\right\}  ,\\
i  &  \mapsto2i+1
\end{align*}
is a bijection. Thus, we can substitute $2i+1$ for $k$ in the sum
\[
\sum_{\substack{k\in\left\{  0,1,\ldots,2r+1\right\}  ;\\k\text{ is odd}%
}}\dbinom{2r+1}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r+1-k\right)  /2}.
\]
We thus obtain%
\begin{align*}
&  \sum_{\substack{k\in\left\{  0,1,\ldots,2r+1\right\}  ;\\k\text{ is odd}%
}}\dbinom{2r+1}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r+1-k\right)  /2}\\
&  =\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}%
\underbrace{g^{\left(  2i+1\right)  /2}}_{\substack{=g^{i+1/2}\\\text{(since
}\left(  2i+1\right)  /2=i+1/2\text{)}}}\ \ \underbrace{\left(  g+1\right)
^{\left(  2r+1-\left(  2i+1\right)  \right)  /2}}_{\substack{=\left(
g+1\right)  ^{r-i}\\\text{(since }\left(  2r+1-\left(  2i+1\right)  \right)
/2=r-i\text{)}}}\\
&  =\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}%
\underbrace{g^{i+1/2}}_{\substack{=g^{i}g^{1/2}\\\text{(because }i\text{ and
}1/2\text{ are}\\\text{nonnegative)}}}\left(  g+1\right)  ^{r-i}\\
&  =\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}%
g^{i}\underbrace{g^{1/2}}_{=\sqrt{g}}\left(  g+1\right)  ^{r-i}\\
&  =\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}g^{i}\sqrt
{g}\left(  g+1\right)  ^{r-i}\\
&  =\sqrt{g}\cdot\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}%
{2i+1}g^{i}\left(  g+1\right)  ^{r-i}.
\end{align*}
Hence, (\ref{pf.thm.sol.rec.VSE28.g-gen.5od}) becomes%
\begin{align}
\sqrt{m}  &  =\sum_{\substack{k\in\left\{  0,1,\ldots,2r+1\right\}  ;\\k\text{
is odd}}}\dbinom{2r+1}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2r+1-k\right)
/2}\nonumber\\
&  =\sqrt{g}\cdot\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}%
{2i+1}g^{i}\left(  g+1\right)  ^{r-i}. \label{pf.thm.sol.rec.VSE28.g-gen.7od}%
\end{align}
Note that the sum $\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom
{2r+1}{2i+1}g^{i}\left(  g+1\right)  ^{r-i}$ on the right hand side of this
equality is an integer\footnote{Indeed, for each $i\in\left\{  0,1,\ldots
,r\right\}  $, the binomial coefficient $\dbinom{2r+1}{2i+1}$ is an integer
(since Theorem \ref{thm.binom.ZZ} yields that $\dbinom{2r+1}{2i+1}%
\in\mathbb{Z}$), and the powers $g^{i}$ and $\left(  g+1\right)  ^{r-i}$ are
integers as well (since $i\in\left\{  0,1,\ldots,r\right\}  $ entails
$i\in\mathbb{N}$ and $r-i\in\mathbb{N}$). Therefore, each addend of the sum
$\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}g^{i}\left(
g+1\right)  ^{r-i}$ is an integer. Hence, the sum itself is an integer as
well.}. Thus, the equality (\ref{pf.thm.sol.rec.VSE28.g-gen.7od}) shows that
there is an integer $u$ such that $\sqrt{m}=\sqrt{g}\cdot u$ (namely,
$u=\sum_{i\in\left\{  0,1,\ldots,r\right\}  }\dbinom{2r+1}{2i+1}g^{i}\left(
g+1\right)  ^{r-i}$). This proves Claim 2.]

[\textit{Proof of Claim 3:} The integer $n$ is either even or odd. We thus are
in one of the following two cases:

\textit{Case 1:} The integer $n$ is even.

\textit{Case 2:} The integer $n$ is odd.

Let us first consider Case 1. In this case, the integer $n$ is even. Hence,
Claim 1 yields that there is an integer $u$ such that $\sqrt{m}=\sqrt{g}%
\cdot\sqrt{g+1}\cdot u$. Consider this $u$. Squaring both sides of the
equality $\sqrt{m}=\sqrt{g}\cdot\sqrt{g+1}\cdot u$, we obtain $m=\left(
\sqrt{g}\cdot\sqrt{g+1}\cdot u\right)  ^{2}=g\left(  g+1\right)  u^{2}%
\in\mathbb{Z}$ (since $g$, $g+1$ and $u$ are integers). Thus, Claim 3 is
proved in Case 1.

Let us now consider Case 2. In this case, the integer $n$ is odd. Hence, Claim
2 yields that there is an integer $u$ such that $\sqrt{m}=\sqrt{g}\cdot u$.
Consider this $u$. Squaring both sides of the equality $\sqrt{m}=\sqrt{g}\cdot
u$, we obtain $m=\left(  \sqrt{g}\cdot u\right)  ^{2}=gu^{2}\in\mathbb{Z}$
(since $g$ and $u$ are integers). Thus, Claim 3 is proved in Case 2.

We have now proved Claim 3 in both Cases 1 and 2. Hence, Claim 3 always holds.]

Claim 3 yields $m\in\mathbb{Z}$. Hence, $m\in\mathbb{N}$ (since $m\geq0$).
This completes the proof of Theorem \ref{thm.sol.rec.VSE28.g-gen}.
\end{proof}

\begin{proof}
[Second proof of Theorem \ref{thm.sol.rec.VSE28.g-gen}.]As in the first proof
of Theorem \ref{thm.sol.rec.VSE28.g-gen} above, we can show that $m\geq0$ and
$\lambda\mu=1$ and $\lambda^{n}=\sqrt{m+1}-\sqrt{m}$. It remains to show that
$m\in\mathbb{N}$.

Multiplying both sides of the equality $m=\left(  \dfrac{\mu^{n}-\lambda^{n}%
}{2}\right)  ^{2}$ by $4$, we find%
\begin{align}
4m  &  =\left(  \mu^{n}-\lambda^{n}\right)  ^{2}=\underbrace{\left(  \mu
^{n}\right)  ^{2}}_{=\mu^{2n}}+\underbrace{\left(  \lambda^{n}\right)  ^{2}%
}_{=\lambda^{2n}}-2\underbrace{\mu^{n}\lambda^{n}}_{\substack{=\lambda^{n}%
\mu^{n}=\left(  \lambda\mu\right)  ^{n}=1^{n}\\\text{(since }\lambda
\mu=1\text{)}}}\nonumber\\
&  =\mu^{2n}+\lambda^{2n}-2\cdot\underbrace{1^{n}}_{=1}=\mu^{2n}+\lambda
^{2n}-2. \label{pf.thm.sol.rec.VSE28.g-gen.4m=}%
\end{align}


Now, from $\lambda=\sqrt{g+1}-\sqrt{g}$ and $\mu=\sqrt{g+1}+\sqrt{g}$, we
obtain%
\begin{align}
\mu^{2n}+\lambda^{2n}  &  =\left(  \sqrt{g+1}+\sqrt{g}\right)  ^{2n}+\left(
\sqrt{g+1}-\sqrt{g}\right)  ^{2n}\nonumber\\
&  =2\sum_{\substack{k\in\left\{  0,1,\ldots,2n\right\}  ;\\k\text{ is even}%
}}\dbinom{2n}{k}\underbrace{\left(  \sqrt{g}\right)  ^{k}}_{=g^{k/2}%
}\underbrace{\left(  \sqrt{g+1}\right)  ^{2n-k}}_{=\left(  g+1\right)
^{\left(  2n-k\right)  /2}}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by (\ref{pf.lem.binom-sumdiff.plus}), applied to }\sqrt{g+1}\text{,
}\sqrt{g}\text{ and }2n\\
\text{instead of }u\text{, }v\text{ and }n
\end{array}
\right) \nonumber\\
&  =2\sum_{\substack{k\in\left\{  0,1,\ldots,2n\right\}  ;\\k\text{ is even}%
}}\dbinom{2n}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2n-k\right)  /2}.
\label{pf.thm.sol.rec.VSE28.g-gen.ml1}%
\end{align}


Now, the even elements of the set $\left\{  0,1,\ldots,2n\right\}  $ are
$0,2,4,\ldots,2n$. In other words, the even elements of the set $\left\{
0,1,\ldots,2n\right\}  $ are the elements $2i$ for $i\in\left\{
0,1,\ldots,n\right\}  $. Hence, the map%
\begin{align*}
\left\{  0,1,\ldots,n\right\}   &  \rightarrow\left\{  k\in\left\{
0,1,\ldots,2n\right\}  \ \mid\ k\text{ is even}\right\}  ,\\
i  &  \mapsto2i
\end{align*}
is a bijection. Thus, we can substitute $2i$ for $k$ in the sum
\[
\sum_{\substack{k\in\left\{  0,1,\ldots,2n\right\}  ;\\k\text{ is even}%
}}\dbinom{2n}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2n-k\right)  /2}.
\]
We thus obtain%
\begin{align}
&  \sum_{\substack{k\in\left\{  0,1,\ldots,2n\right\}  ;\\k\text{ is even}%
}}\dbinom{2n}{k}g^{k/2}\left(  g+1\right)  ^{\left(  2n-k\right)
/2}\nonumber\\
&  =\underbrace{\sum_{i\in\left\{  0,1,\ldots,n\right\}  }}_{=\sum_{i=0}^{n}%
}\dbinom{2n}{2i}\underbrace{g^{2i/2}}_{\substack{=g^{i}\\\text{(since
}2i/2=i\text{)}}}\ \ \underbrace{\left(  g+1\right)  ^{\left(  2n-2i\right)
/2}}_{\substack{=\left(  g+1\right)  ^{n-i}\\\text{(since }\left(
2n-2i\right)  /2=n-i\text{)}}}\nonumber\\
&  =\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}.
\label{pf.thm.sol.rec.VSE28.g-gen.sum3}%
\end{align}
The sum on the right hand side of this equality is an integer\footnote{Indeed,
for each $i\in\left\{  0,1,\ldots,n\right\}  $, the binomial coefficient
$\dbinom{2n}{2i}$ is an integer (since Theorem \ref{thm.binom.ZZ} yields that
$\dbinom{2n}{2i}\in\mathbb{Z}$), and the powers $g^{i}$ and $\left(
g+1\right)  ^{n-i}$ are integers as well (since $i\in\left\{  0,1,\ldots
,n\right\}  $ entails $i\in\mathbb{N}$ and $n-i\in\mathbb{N}$). Therefore,
each addend of the sum $\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)
^{n-i}$ is an integer. Hence, the sum itself is an integer as well.}; but we
shall furthermore show that it is an odd integer. In other words, we shall
show that%
\begin{equation}
\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}\text{ is odd.}
\label{pf.thm.sol.rec.VSE28.g-gen.sum-odd}%
\end{equation}


[\textit{Proof of (\ref{pf.thm.sol.rec.VSE28.g-gen.sum-odd}):} We are in one
of the following two cases:

\textit{Case 1:} The integer $g$ is even.

\textit{Case 2:} The integer $g$ is odd.

Let us first consider Case 1. In this case, the integer $g$ is even. Hence,
$2\mid g$ and $g\equiv0\operatorname{mod}2$. Now,%
\begin{align*}
&  \sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}\\
&  =\sum_{i=1}^{n}\dbinom{2n}{2i}\underbrace{g^{i}}_{\substack{\equiv
0\operatorname{mod}2\\\text{(since }2\mid g\mid g^{i}\\\text{(because }%
i\geq1\text{))}}}\left(  g+1\right)  ^{n-i}+\underbrace{\dbinom{2n}{2\cdot0}%
}_{\substack{=\dbinom{2n}{0}=1\\\text{(by (\ref{eq.exa.binom.small.nC0}))}%
}}\underbrace{g^{0}}_{=1}\underbrace{\left(  g+1\right)  ^{n-0}}_{=\left(
g+1\right)  ^{n}}\\
&  \equiv\underbrace{\sum_{i=1}^{n}\dbinom{2n}{2i}0\left(  g+1\right)  ^{n-i}%
}_{=0}+\left(  \underbrace{g}_{\equiv0\operatorname{mod}2}+1\right)
^{n}\equiv\left(  0+1\right)  ^{n}=1^{n}=1\operatorname{mod}2.
\end{align*}
In other words, $\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}$
is odd. Thus, (\ref{pf.thm.sol.rec.VSE28.g-gen.sum-odd}) is proved in Case 1.

Let us now consider Case 2. In this case, the integer $g$ is odd. Hence,
$g\equiv1\operatorname{mod}2$, so that $\underbrace{g}_{\equiv
1\operatorname{mod}2}+1\equiv1+1=2\equiv0\operatorname{mod}2$. Now,%
\begin{align*}
\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  \underbrace{g+1}_{\equiv
0\operatorname{mod}2}\right)  ^{n-i}  &  \equiv\sum_{i=0}^{n}\dbinom{2n}%
{2i}g^{i}0^{n-i}\\
&  =\sum_{i=0}^{n-1}\dbinom{2n}{2i}g^{i}\underbrace{0^{n-i}}%
_{\substack{=0\\\text{(since }n-i\geq1\\\text{(because }i\leq n-1\text{))}%
}}+\underbrace{\dbinom{2n}{2n}}_{\substack{=1\\\text{(by
(\ref{eq.thm.binom.sym.nn}))}}}g^{n}\underbrace{0^{n-n}}_{=0^{0}=1}\\
&  =\underbrace{\sum_{i=0}^{n-1}\dbinom{2n}{2i}g^{i}0}_{=0}+g^{n}%
=g^{n}=\left(  \underbrace{g}_{\equiv1\operatorname{mod}2}\right)  ^{n}%
\equiv1^{n}=1\operatorname{mod}2.
\end{align*}
In other words, $\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}$
is odd. Thus, (\ref{pf.thm.sol.rec.VSE28.g-gen.sum-odd}) is proved in Case 2.

We have now proved (\ref{pf.thm.sol.rec.VSE28.g-gen.sum-odd}) in both Cases 1
and 2. Hence, (\ref{pf.thm.sol.rec.VSE28.g-gen.sum-odd}) always holds.]

We have thus shown that the integer $\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(
g+1\right)  ^{n-i}$ is odd. In other words,
\begin{equation}
\sum_{i=0}^{n}\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}=2u+1
\label{pf.thm.sol.rec.VSE28.g-gen.2up1}%
\end{equation}
for some integer $u$. Consider this $u$. Now,
(\ref{pf.thm.sol.rec.VSE28.g-gen.ml1}) becomes%
\begin{align*}
\mu^{2n}+\lambda^{2n}  &  =2\underbrace{\sum_{\substack{k\in\left\{
0,1,\ldots,2n\right\}  ;\\k\text{ is even}}}\dbinom{2n}{k}g^{k/2}\left(
g+1\right)  ^{\left(  2n-k\right)  /2}}_{\substack{=\sum_{i=0}^{n}\dbinom
{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}\\\text{(by
(\ref{pf.thm.sol.rec.VSE28.g-gen.sum3}))}}}=2\underbrace{\sum_{i=0}^{n}%
\dbinom{2n}{2i}g^{i}\left(  g+1\right)  ^{n-i}}_{\substack{=2u+1\\\text{(by
(\ref{pf.thm.sol.rec.VSE28.g-gen.2up1}))}}}\\
&  =2\left(  2u+1\right)  .
\end{align*}
Now, (\ref{pf.thm.sol.rec.VSE28.g-gen.4m=}) becomes%
\[
4m=\underbrace{\mu^{2n}+\lambda^{2n}}_{=2\left(  2u+1\right)  }-2=2\left(
2u+1\right)  -2=4u.
\]
Cancelling the factor $4$ from this equality, we find $m=u$. Hence, $m$ is an
integer (since $u$ is an integer). Since $m\geq0$, we thus obtain
$m\in\mathbb{N}$. This again completes the proof of Theorem
\ref{thm.sol.rec.VSE28.g-gen}.
\end{proof}

\begin{proof}
[Third proof of Theorem \ref{thm.sol.rec.VSE28.g-gen} (sketched).]As in the
first proof of Theorem \ref{thm.sol.rec.VSE28.g-gen} above, we can show that
$m\geq0$ and $\lambda\mu=1$ and $\lambda^{n}=\sqrt{m+1}-\sqrt{m}$. It remains
to show that $m\in\mathbb{N}$.

Let us rename $m$ as $m_{n}$, in order to stress its dependence on $n$. Thus,
we need to show that $m_{n}\in\mathbb{N}$. Forget that we fixed $n$.

Now, it is not hard to see that $m_{0}=0$ and $m_{1}=g$ and $m_{2}=4g\left(
g+1\right)  $. Also, for each $n\in\mathbb{N}$, we have%
\begin{align}
m_{n}  &  =\left(  \dfrac{\mu^{n}-\lambda^{n}}{2}\right)  ^{2}=\dfrac{1}%
{4}\left(  \mu^{n}-\lambda^{n}\right)  ^{2}=\dfrac{1}{4}\left(
\underbrace{\left(  \mu^{n}\right)  ^{2}}_{=\mu^{2n}}+\underbrace{\left(
\lambda^{n}\right)  ^{2}}_{=\lambda^{2n}}-2\underbrace{\mu^{n}\lambda^{n}%
}_{=\lambda^{n}\mu^{n}=\left(  \lambda\mu\right)  ^{n}}\right) \nonumber\\
&  =\dfrac{1}{4}\left(  \underbrace{\mu^{2n}}_{=\left(  \mu^{2}\right)  ^{n}%
}+\underbrace{\lambda^{2n}}_{=\left(  \lambda^{2}\right)  ^{n}}-2\cdot\left(
\underbrace{\lambda\mu}_{=1}\right)  ^{n}\right)  =\dfrac{1}{4}\left(  \left(
\mu^{2}\right)  ^{n}+\left(  \lambda^{2}\right)  ^{n}-2\cdot1^{n}\right)
\nonumber\\
&  =\dfrac{1}{4}\left(  \mu^{2}\right)  ^{n}+\dfrac{1}{4}\left(  \lambda
^{2}\right)  ^{n}+\dfrac{-1}{2}\cdot1^{n}.
\label{pf.thm.sol.rec.VSE28.g-gen.mn=sum}%
\end{align}
This formula looks much like (\ref{eq.thm.akrec.binet.distinct}): The right
hand side is a sum of several $n$-th powers multiplied by constant
coefficients. This strongly suggests that our sequence $\left(  m_{0}%
,m_{1},m_{2},\ldots\right)  $ should be $\left(  a_{1},a_{2},a_{3}\right)
$-recurrent for some three numbers $a_{1},a_{2},a_{3}$ (three because there
are three $n$-th powers on the right hand side of
(\ref{pf.thm.sol.rec.VSE28.g-gen.mn=sum})). How do we find these $a_{1}%
,a_{2},a_{3}$ ? If the formula (\ref{pf.thm.sol.rec.VSE28.g-gen.mn=sum}) is to
be an instance of (\ref{eq.thm.akrec.binet.distinct}), then the bases of the
three powers on the right hand side (\ref{pf.thm.sol.rec.VSE28.g-gen.mn=sum})
(that is, the three numbers $\mu^{2}$, $\lambda^{2}$ and $1$) should be the
roots of the polynomial $X^{3}-a_{1}X^{2}-a_{2}X-a_{3}$. This means that we
should have%
\[
\left(  X-\mu^{2}\right)  \left(  X-\lambda^{2}\right)  \left(  X-1\right)
=X^{3}-a_{1}X^{2}-a_{2}X-a_{3}.
\]
But a straightforward computation shows that%
\[
\left(  X-\mu^{2}\right)  \left(  X-\lambda^{2}\right)  \left(  X-1\right)
=X^{3}-\left(  4g+3\right)  X^{2}+\left(  4g+3\right)  X-1.
\]
Comparing these two equations yields $a_{1}=4g+3$ and $a_{2}=-\left(
4g+3\right)  $ and $a_{3}=1$. Thus, we guess that our sequence $\left(
m_{0},m_{1},m_{2},\ldots\right)  $ should be $\left(  4g+3,-\left(
4g+3\right)  ,1\right)  $-recurrent. In other words, we guess that
\begin{equation}
m_{n}=\left(  4g+3\right)  m_{n-1}-\left(  4g+3\right)  m_{n-2}+m_{n-3}
\label{pf.thm.sol.rec.VSE28.g-gen.mnrec}%
\end{equation}
for each $n\geq3$.

Proving this guess is easy: Just rewrite the four values $m_{n},m_{n-1}%
,m_{n-2},m_{n-3}$ on both sides of (\ref{pf.thm.sol.rec.VSE28.g-gen.mnrec})
using (\ref{pf.thm.sol.rec.VSE28.g-gen.mn=sum}), and then use the equalities%
\begin{align*}
\left(  \mu^{2}\right)  ^{n}  &  =\left(  4g+3\right)  \left(  \mu^{2}\right)
^{n-1}-\left(  4g+3\right)  \left(  \mu^{2}\right)  ^{n-2}+\left(  \mu
^{2}\right)  ^{n-3},\\
\left(  \lambda^{2}\right)  ^{n}  &  =\left(  4g+3\right)  \left(  \lambda
^{2}\right)  ^{n-1}-\left(  4g+3\right)  \left(  \lambda^{2}\right)
^{n-2}+\left(  \lambda^{2}\right)  ^{n-3},\\
1^{n}  &  =\left(  4g+3\right)  1^{n-1}-\left(  4g+3\right)  1^{n-2}+1^{n-3}%
\end{align*}
(which follow from the fact that $\mu^{2}$, $\lambda^{2}$ and $1$ are roots of
the polynomial $X^{3}-\left(  4g+3\right)  X^{2}+\left(  4g+3\right)  X-1$).

Thus, the sequence $\left(  m_{0},m_{1},m_{2},\ldots\right)  $ is $\left(
4g+3,-\left(  4g+3\right)  ,1\right)  $-recurrent. Since the first three
entries of this sequence are integers (indeed, $m_{0}=0\in\mathbb{Z}$ and
$m_{1}=g\in\mathbb{Z}$ and $m_{2}=4g\left(  g+1\right)  \in\mathbb{Z}$), we
thus conclude (by strong induction on $n$) that all its entries $m_{n}$ are
integers (since $4g+3$, $-\left(  4g+3\right)  $ and $1$ are integers). In
other words, $m_{n}$ is an integer for all $n\in\mathbb{N}$. Since we also
know that $m_{n}\geq0$, we thus conclude that $m_{n}\in\mathbb{N}$ for all
$n\in\mathbb{N}$. This proves Theorem \ref{thm.sol.rec.VSE28.g-gen}.
\end{proof}

Now, let us solve Exercise \ref{exe.rec.VSE28} at last. Indeed, set $g=1$.
Define $\lambda$, $\mu$ and $m$ as in Theorem \ref{thm.sol.rec.VSE28.g-gen}.
Then, Theorem \ref{thm.sol.rec.VSE28.g-gen} yields that $m\in\mathbb{N}$ and
$\lambda^{n}=\sqrt{m+1}-\sqrt{m}$. But
\begin{align*}
\lambda &  =\sqrt{g+1}-\sqrt{g}=\underbrace{\sqrt{1+1}}_{=\sqrt{2}%
}-\underbrace{\sqrt{1}}_{=1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}g=1\right) \\
&  =\sqrt{2}-1,
\end{align*}
so that $\lambda^{n}=\left(  \sqrt{2}-1\right)  ^{n}$. Hence, $\left(
\sqrt{2}-1\right)  ^{n}=\lambda^{n}=\sqrt{m+1}-\sqrt{m}$. Thus, we have found
an $m\in\mathbb{N}$ such that $\left(  \sqrt{2}-1\right)  ^{n}=\sqrt
{m+1}-\sqrt{m}$. This shows that such an $m$ exists. Thus, Exercise
\ref{exe.rec.VSE28} is solved.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.v33-2}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.v33-2}.]Exercise \ref{exe.seqs.v33-2} is
Exercise 2 from the 33rd
\href{https://intranet.math.vt.edu/people/plinnell/Vtregional/}{Virginia Tech
Regional Mathematics Contest}. The trick is to guess the explicit formula for
$a_{n}$; proving it afterwards is straightforward. The formula is the
following: For each $n\in\mathbb{N}$, we have%
\begin{equation}
a_{n}=n^{2}-1. \label{sol.seqs.v33-2.1}%
\end{equation}


For the sake of completeness, let us give the straightforward proof of
(\ref{sol.seqs.v33-2.1}):

[\textit{Proof of (\ref{sol.seqs.v33-2.1}):} We shall prove
(\ref{sol.seqs.v33-2.1}) by strong induction on $n$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.seqs.v33-2.1}) holds for $n<m$. We must prove that
(\ref{sol.seqs.v33-2.1}) holds for $n=m$. In other words, we must prove that
$a_{m}=m^{2}-1$.

This is certainly true if $m=0$ (since $a_{0}=-1=0^{2}-1$), and is also true
if $m=1$ (since $a_{1}=0=1^{2}-1$). Hence, for the rest of this proof, we WLOG
assume that $m$ is neither $0$ nor $1$. Therefore, $m\geq2$ (since
$m\in\mathbb{N}$). Hence, $m-1\in\mathbb{N}$ and $m-2\in\mathbb{N}$.

We have assumed that (\ref{sol.seqs.v33-2.1}) holds for $n<m$. Thus,
(\ref{sol.seqs.v33-2.1}) holds for $n=m-1$ (since $m-1\in\mathbb{N}$ and
$m-1<m$). In other words, we have $a_{m-1}=\left(  m-1\right)  ^{2}-1$. The
same argument (applied to $m-2$ instead of $m-1$) shows that $a_{m-2}=\left(
m-2\right)  ^{2}-1$ (since $m-2\in\mathbb{N}$ and $m-2<m$).

Now, recall that $a_{n}=a_{n-1}^{2}-n^{2}a_{n-2}-1$ for all $n\geq2$ (by the
definition of our sequence). Applying this to $n=m$, we find%
\begin{align*}
a_{m}  &  =a_{m-1}^{2}-m^{2}a_{m-2}-1=\left(  \underbrace{\left(  m-1\right)
^{2}-1}_{=m\left(  m-2\right)  }\right)  ^{2}-m^{2}\left(  \underbrace{\left(
m-2\right)  ^{2}-1}_{=\left(  m-3\right)  \left(  m-1\right)  }\right)  -1\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{m-1}=\left(  m-1\right)
^{2}-1\text{ and }a_{m-2}=\left(  m-2\right)  ^{2}-1\right) \\
&  =\left(  m\left(  m-2\right)  \right)  ^{2}-m^{2}\left(  m-3\right)
\left(  m-1\right)  -1=m^{2}\underbrace{\left(  \left(  m-2\right)
^{2}-\left(  m-3\right)  \left(  m-1\right)  \right)  }_{=1}-1\\
&  =m^{2}-1.
\end{align*}
This completes the induction step. Thus, (\ref{sol.seqs.v33-2.1}) is proved by induction.]

The formula (\ref{sol.seqs.v33-2.1}) can now be applied to $n=100$, resulting
in $a_{100}=100^{2}-1=9999$.

A better question is: How would one come up with a formula like
(\ref{sol.seqs.v33-2.1})? One way is to recognize the first few entries
$a_{0}=-1$, $a_{1}=0$, $a_{2}=3$, $a_{3}=8$ and $a_{4}=15$ as $0^{2}-1$,
$1^{2}-1$ and so on. This is arguably easier with the benefit of hindsight.
How else could one discover (\ref{sol.seqs.v33-2.1})? I think a natural way to
do so is to observe that the sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ grows \textquotedblleft a lot slower than
expected\textquotedblright. To wit, the recurrence equation $a_{n}=a_{n-1}%
^{2}-n^{2}a_{n-2}-1$ for computing an entry $a_{n}$ involves squaring the
preceding entry $a_{n-1}$; this suggests a doubly exponential growth (which
would certainly be the case if the \textquotedblleft$-$\textquotedblright%
\ signs were replaced by \textquotedblleft$+$\textquotedblright\ signs). Yet a
look at the first $10$ or so entries of the sequence suggests a much slower
growth -- polynomial perhaps. This is not a rigorous argument -- the growth
behavior of a sequence is not determined by its first $10$ entries, or by its
first $1000$ entries for that matter -- but it is a remarkable observation
that calls for explanation. Guided by this observation, one might look for a
polynomial formula for $a_{n}$ -- that is, a polynomial $P$ such that
$a_{n}=P\left(  n\right)  $ for all $n\in\mathbb{N}$. Making the reasonable
assumption that $\deg P$ shouldn't be too large, one can then find $P$ using
\href{https://en.wikipedia.org/wiki/Polynomial_interpolation}{polynomial
interpolation}. The result is the formula (\ref{sol.seqs.v33-2.1}). Of course,
this does not substitute for a rigorous proof of (\ref{sol.seqs.v33-2.1}).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.galv-7.2}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.galv-7.2}.]Exercise
\ref{exe.rec.galv-7.2} is \cite[Chapter 7, Problem 2]{Galvin20}. Fairly
similar exercises appear all over the literature; see, e.g., \cite[Problem
14.30]{Engel}. The trick is always the same: Whenever you see a quadratic
irrationality like $a+b\sqrt{q}$, try to also get its conjugate $a-b\sqrt{q}$
(that is, the other root of the quadratic equation $X^{2}=2aX+\left(
b^{2}q-a^{2}\right)  $, whose first root is $a+b\sqrt{q}$) involved. In the
case of this exercise, the conjugate of $1+\sqrt{2}$ is $1-\sqrt{2}$, and
(unlike $1+\sqrt{2}$) this is a real number between $-1$ and $0$. Thus, its
$n$-th power%
\begin{equation}
\left(  1-\sqrt{2}\right)  ^{n}\text{ lies }%
\begin{cases}
\text{between }0\text{ and }1, & \text{if }n\text{ is even;}\\
\text{between }-1\text{ and }0, & \text{if }n\text{ is odd.}%
\end{cases}
\label{sol.rec.galv-7.2.idea}%
\end{equation}
\ \ \ \ But the binomial formula can easily be used to show that $\left(
1+\sqrt{2}\right)  ^{n}+\left(  1-\sqrt{2}\right)  ^{n}$ is an even integer --
let's call it $2u$. From (\ref{sol.rec.galv-7.2.idea}), we thus conclude that
\[
\left(  1+\sqrt{2}\right)  ^{n}\text{ lies }%
\begin{cases}
\text{between }2u-1\text{ and }2u, & \text{if }n\text{ is even;}\\
\text{between }2u\text{ and }2u+1, & \text{if }n\text{ is odd.}%
\end{cases}
\]
Hence,%
\[
\left\lfloor \left(  1+\sqrt{2}\right)  ^{n}\right\rfloor =%
\begin{cases}
2u-1, & \text{if }n\text{ is even;}\\
2u, & \text{if }n\text{ is odd.}%
\end{cases}
\]
Since $2u$ is even and $2u-1$ is odd, the claim of the exercise thus follows.

The same argument can be used to prove the following more general result:

\begin{theorem}
\label{thm.sol.rec.galv-7.2.mq}Let $m,q\in\mathbb{N}$ satisfy $m^{2}<q<\left(
m+1\right)  ^{2}$. Let $n\in\mathbb{N}$. Then, $\left\lfloor \left(
m+\sqrt{q}\right)  ^{n}\right\rfloor $ is even if and only if $n$ is odd.
\end{theorem}

For the sake of completeness, here is a proof of this theorem (following the
above plan):

\begin{proof}
[Proof of Theorem \ref{thm.sol.rec.galv-7.2.mq}.]Let $\lambda=m+\sqrt{q}$ and
$\mu=m-\sqrt{q}$.

Taking square roots on all sides of the inequality chain $m^{2}<q<\left(
m+1\right)  ^{2}$, we obtain $m<\sqrt{q}<m+1$ (since all of $m$, $q$ and $m+1$
are nonnegative reals). Hence, $\mu=m-\sqrt{q}<0$ (since $m<\sqrt{q}$) and
$\mu=m-\sqrt{q}>-1$ (since $\sqrt{q}<m+1$). From $\mu<0$, we see that $\mu$ is
negative, so that $\left\vert \mu\right\vert =-\mu$. Hence, $\left\vert
\mu\right\vert =-\mu<1$ (since $\mu>-1$). Thus, $\left\vert \mu\right\vert
^{n}\leq1$ (since $\left\vert \mu\right\vert $ is nonnegative), so that
$\left\vert \mu^{n}\right\vert =\left\vert \mu\right\vert ^{n}\leq1$.

From $\lambda=m+\sqrt{q}$ and $\mu=m-\sqrt{q}$, we obtain%
\begin{align}
\lambda^{n}+\mu^{n}  &  =\left(  m+\sqrt{q}\right)  ^{n}+\left(  m-\sqrt
{q}\right)  ^{n}=2\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}
;\\k\text{ is even}}}\dbinom{n}{k}\underbrace{\left(  \sqrt{q}\right)  ^{k}%
}_{=q^{k/2}}m^{n-k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.lem.binom-sumdiff.plus}), applied to }u=m\text{ and }v=\sqrt
{q}\right) \nonumber\\
&  =2\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}q^{k/2}m^{n-k}. \label{pf.thm.sol.rec.galv-7.2.mq.1}%
\end{align}


The sum $\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is
even}}}\dbinom{n}{k}q^{k/2}m^{n-k}$ is an integer\footnote{\textit{Proof.} Let
$k\in\left\{  0,1,\ldots,n\right\}  $ be even. Then, $k\in\left\{
0,1,\ldots,n\right\}  \subseteq\mathbb{N}$, so that $k\geq0$ and thus
$k/2\geq0$. The binomial coefficient $\dbinom{n}{k}$ is an integer (since
Theorem \ref{thm.binom.ZZ} yields that $\dbinom{n}{k}\in\mathbb{Z}$).
Moreover, $k/2\in\mathbb{Z}$ (since $k$ is even), so that $k/2\in\mathbb{N}$
(since $k/2\geq0$). Hence, $q^{k/2}$ is an integer. Also, $k\leq n$ (since
$k\in\left\{  0,1,\ldots,n\right\}  $) and thus $n-k\in\mathbb{N}$. Hence,
$m^{n-k}$ is an integer. Now, we conclude that $\dbinom{n}{k}q^{k/2}m^{n-k}$
is an integer (since $\dbinom{n}{k}$, $q^{k/2}$ and $m^{n-k}$ are integers).
\par
Forget that we fixed $k$. We thus have proved that $\dbinom{n}{k}%
q^{k/2}m^{n-k}$ is an integer for each even $k\in\left\{  0,1,\ldots
,n\right\}  $. In other words, each addend of the sum $\sum_{\substack{k\in
\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}}}\dbinom{n}{k}%
q^{k/2}m^{n-k}$ is an integer. Hence, the whole sum is an integer as well.}.
Let us denote this integer by $u$. Thus,%
\[
u=\sum_{\substack{k\in\left\{  0,1,\ldots,n\right\}  ;\\k\text{ is even}%
}}\dbinom{n}{k}q^{k/2}m^{n-k}.
\]
Hence, (\ref{pf.thm.sol.rec.galv-7.2.mq.1}) rewrites as $\lambda^{n}+\mu
^{n}=2u$. Hence, $2u=\lambda^{n}+\mu^{n}$.

Now, we are in one of the following two cases:

\textit{Case 1:} The integer $n$ is even.

\textit{Case 2:} The integer $n$ is odd.

Let us first consider Case 1. In this case, the integer $n$ is even. Hence,
$\alpha^{n}\geq0$ for each positive real $\alpha$. Applying this to
$\alpha=\mu$, we obtain $\mu^{n}\geq0$. Thus, $\left\vert \mu^{n}\right\vert
=\mu^{n}$, so that $\mu^{n}=\left\vert \mu^{n}\right\vert \leq1$. Also,
$\mu\neq0$ (since $\mu<0$), so that $\mu^{n}\neq0$ and thus $\mu^{n}>0$ (since
$\mu^{n}\geq0$).

The integer $2u-1$ satisfies $2u-1\leq\lambda^{n}$ (since $2u=\lambda
^{n}+\underbrace{\mu^{n}}_{\leq1}\leq\lambda^{n}+1$) and $\lambda^{n}<2u$
(since $2u=\lambda^{n}+\underbrace{\mu^{n}}_{>0}>\lambda^{n}$). Thus, the
integer $2u-1$ is $\leq\lambda^{n}$ (since $2u-1\leq\lambda^{n}$), while the
next integer $2u$ is no longer $\leq\lambda^{n}$ (since $\lambda^{n}<2u$).
Therefore, the largest integer that is $\leq\lambda^{n}$ is $2u-1$. In other
words, $\left\lfloor \lambda^{n}\right\rfloor $ is $2u-1$ (since $\left\lfloor
\lambda^{n}\right\rfloor $ was defined as the largest integer that is
$\leq\lambda^{n}$ (by the definition of a floor)). In other words,
$\left\lfloor \lambda^{n}\right\rfloor =2u-1$. But $2u-1$ is odd (since $u$ is
an integer). In other words, $\left\lfloor \lambda^{n}\right\rfloor $ is odd
(since $\left\lfloor \lambda^{n}\right\rfloor =2u-1$). In view of
$\lambda=m+\sqrt{q}$, this rewrites as follows: $\left\lfloor \left(
m+\sqrt{q}\right)  ^{n}\right\rfloor $ is odd. Thus, $\left\lfloor \left(
m+\sqrt{q}\right)  ^{n}\right\rfloor $ is not even. Also, $n$ is not odd
(since $n$ is even). Thus, we conclude that $\left\lfloor \left(  m+\sqrt
{q}\right)  ^{n}\right\rfloor $ is even if and only if $n$ is odd (because we
know that $\left\lfloor \left(  m+\sqrt{q}\right)  ^{n}\right\rfloor $ is not
even, and that $n$ is not odd). In other words, Theorem
\ref{thm.sol.rec.galv-7.2.mq} is proved in Case 1.

Let us now consider Case 2. In this case, the integer $n$ is odd. Hence,
$\alpha^{n}<0$ for each negative real $\alpha$. Applying this to $\alpha=\mu$,
we obtain $\mu^{n}<0$ (since $\mu$ is negative). Hence, $\left\vert \mu
^{n}\right\vert =-\mu^{n}$, so that $-\mu^{n}=\left\vert \mu^{n}\right\vert
=\left\vert \mu\right\vert ^{n}$. But we have $\left\vert \mu\right\vert <1$
and therefore $\left\vert \mu\right\vert ^{n}<1$ (since $n\geq1$ (because $n$
is an odd nonnegative integer)). Hence, $-\mu^{n}=\left\vert \mu\right\vert
^{n}<1$. In other words, $\mu^{n}>-1$.

The integer $2u$ satisfies $2u\leq\lambda^{n}$ (since $2u=\lambda
^{n}+\underbrace{\mu^{n}}_{<0}<\lambda^{n}$) and $\lambda^{n}<2u+1$ (since
$2u=\lambda^{n}+\underbrace{\mu^{n}}_{>-1}>\lambda^{n}+\left(  -1\right)
=\lambda^{n}-1$). Thus, the integer $2u$ is $\leq\lambda^{n}$ (since
$2u\leq\lambda^{n}$), while the next integer $2u+1$ is no longer $\leq
\lambda^{n}$ (since $\lambda^{n}<2u+1$). Therefore, the largest integer that
is $\leq\lambda^{n}$ is $2u$. In other words, $\left\lfloor \lambda
^{n}\right\rfloor $ is $2u$ (since $\left\lfloor \lambda^{n}\right\rfloor $
was defined as the largest integer that is $\leq\lambda^{n}$ (by the
definition of a floor)). In other words, $\left\lfloor \lambda^{n}%
\right\rfloor =2u$. But $2u$ is even (since $u$ is an integer). In other
words, $\left\lfloor \lambda^{n}\right\rfloor $ is even (since $\left\lfloor
\lambda^{n}\right\rfloor =2u$). In view of $\lambda=m+\sqrt{q}$, this rewrites
as follows: $\left\lfloor \left(  m+\sqrt{q}\right)  ^{n}\right\rfloor $ is
even. Thus, we conclude that $\left\lfloor \left(  m+\sqrt{q}\right)
^{n}\right\rfloor $ is even if and only if $n$ is odd (because we know that
$\left\lfloor \left(  m+\sqrt{q}\right)  ^{n}\right\rfloor $ is even, and that
$n$ is odd). In other words, Theorem \ref{thm.sol.rec.galv-7.2.mq} is proved
in Case 2.

We have now proved Theorem \ref{thm.sol.rec.galv-7.2.mq} in both Cases 1 and
2. Hence, the proof of Theorem \ref{thm.sol.rec.galv-7.2.mq} is complete.
\end{proof}

Exercise \ref{exe.rec.galv-7.2} follows by applying Theorem
\ref{thm.sol.rec.galv-7.2.mq} to $m=1$ and $q=2$ (since $1^{2}<2<\left(
1+1\right)  ^{2}$).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.rec.ML49408}}

\begin{proof}
[Discussion of Exercise \ref{exe.rec.ML49408}.]Exercise \ref{exe.rec.ML49408}
has appeared in the thread
\url{https://artofproblemsolving.com/community/c6h49408p314696} . The
following solution is taken from said thread.

\begin{proof}
[Solution to Exercise \ref{exe.rec.ML49408}.]We assumed that $m\mid k+1$.
Thus, there exists an integer $q$ such that $k+1=mq$. Consider this $q$.

For each integer $n\geq3$, we have $a_{n}=\dfrac{k+a_{n-1}a_{n-2}}{a_{n-3}}$
(by the definition of the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)
$) and thus%
\[
a_{n}a_{n-3}=k+a_{n-1}a_{n-2}%
\]
and therefore%
\begin{equation}
a_{n}a_{n-3}-a_{n-1}a_{n-2}=k. \label{sol.rec.ML49408.aa-aa}%
\end{equation}
Applying this to $n=3$, we find $a_{3}a_{3-3}-a_{3-1}a_{3-2}=k$. In view of
$a_{3-3}=a_{0}=1$ and $a_{3-1}=a_{2}=m$ and $a_{3-2}=a_{1}=1$, this rewrites
as $a_{3}\cdot1-m\cdot1=k$. Hence, $a_{3}\cdot1=m\cdot1+k=m+k$, so that
$a_{3}=a_{3}\cdot1=m+k$.

Now, we will show the following:

\begin{statement}
\textit{Observation 1:} Let $u$ be an integer such that $u\geq4$. Then,
$\left(  a_{u}+a_{u-2}\right)  a_{u-3}=\left(  a_{u-2}+a_{u-4}\right)
a_{u-1}$.
\end{statement}

[\textit{Proof of Observation 1:} We have $u-1\geq3$ (since $u\geq4$). Hence,
(\ref{sol.rec.ML49408.aa-aa}) (applied to $n=u-1$) yields%
\[
a_{u-1}a_{\left(  u-1\right)  -3}-a_{\left(  u-1\right)  -1}a_{\left(
u-1\right)  -2}=k.
\]
Hence,%
\begin{equation}
k=a_{u-1}\underbrace{a_{\left(  u-1\right)  -3}}_{=a_{u-4}}%
-\underbrace{a_{\left(  u-1\right)  -1}}_{=a_{u-2}}\underbrace{a_{\left(
u-1\right)  -2}}_{=a_{u-3}}=a_{u-1}a_{u-4}-a_{u-2}a_{u-3}.
\label{sol.rec.ML49408.o1.pf.1}%
\end{equation}


Also, $u\geq4\geq3$. Hence, (\ref{sol.rec.ML49408.aa-aa}) (applied to $n=u$)
yields%
\[
a_{u}a_{u-3}-a_{u-1}a_{u-2}=k=a_{u-1}a_{u-4}-a_{u-2}a_{u-3}%
\]
(by (\ref{sol.rec.ML49408.o1.pf.1})). In other words,%
\[
a_{u}a_{u-3}+a_{u-2}a_{u-3}=a_{u-1}a_{u-4}+a_{u-1}a_{u-2}.
\]
In view of%
\[
a_{u-1}a_{u-4}+a_{u-1}a_{u-2}=a_{u-1}\left(  a_{u-4}+a_{u-2}\right)  =\left(
a_{u-4}+a_{u-2}\right)  a_{u-1}=\left(  a_{u-2}+a_{u-4}\right)  a_{u-1}%
\]
and%
\[
a_{u}a_{u-3}+a_{u-2}a_{u-3}=\left(  a_{u}+a_{u-2}\right)  a_{u-3},
\]
this rewrites as $\left(  a_{u}+a_{u-2}\right)  a_{u-3}=\left(  a_{u-2}%
+a_{u-4}\right)  a_{u-1}$. This proves Observation 1.]

The core of our argument will be the following two observations:

\begin{statement}
\textit{Observation 2:} We have $a_{n}=\left(  m+1\right)  a_{n-1}-a_{n-2}$
for each even integer $n\geq2$.
\end{statement}

\begin{statement}
\textit{Observation 3:} We have $a_{n}=\left(  q+1\right)  a_{n-1}-a_{n-2}$
for each odd integer $n\geq2$.
\end{statement}

[\textit{Proof of Observation 2:} We shall prove Observation 2 by strong
induction on $n$:

\textit{Induction step:} Let $u$ be an even integer such that $u\geq2$. Assume
(as the induction hypothesis) that Observation 2 holds for $n<u$. We must
prove that Observation 2 holds for $n=u$. In other words, we must prove that
$a_{u}=\left(  m+1\right)  a_{u-1}-a_{u-2}$.

If $u=2$, then this is easy to check\footnote{\textit{Proof.} Assume that
$u=2$. Thus, $a_{u}=a_{2}=m$ and $a_{u-1}=a_{2-1}=a_{1}=1$ and $a_{u-2}%
=a_{2-2}=a_{0}=1$. Hence, $\left(  m+1\right)  \underbrace{a_{u-1}}%
_{=1}-\underbrace{a_{u-2}}_{=1}=\left(  m+1\right)  -1=m$. Comparing this with
$a_{u}=m$, we find $a_{u}=\left(  m+1\right)  a_{u-1}-a_{u-2}$. Thus,
$a_{u}=\left(  m+1\right)  a_{u-1}-a_{u-2}$ is proved under the assumption
that $u=2$.}. Hence, we WLOG assume that $u\neq2$. Hence, $u>2$ (since
$u\geq2$) and therefore $u\geq4$ (since $u$ is an even integer). In other
words, $u-2\geq2$. Moreover, $u-2$ is an even integer (since $u$ is an even
integer). But our induction hypothesis says that Observation 2 holds for
$n<u$. Hence, we can apply Observation 2 to $n=u-2$ (since $u-2$ is an even
integer satisfying $u-2\geq2$ and $u-2<u$). Thus, we obtain
\[
a_{u-2}=\left(  m+1\right)  \underbrace{a_{\left(  u-2\right)  -1}}_{=a_{u-3}%
}-\underbrace{a_{\left(  u-2\right)  -2}}_{=a_{u-4}}=\left(  m+1\right)
a_{u-3}-a_{u-4}.
\]
In other words, $a_{u-2}+a_{u-4}=\left(  m+1\right)  a_{u-3}$. Now,
Observation 1 yields%
\begin{equation}
\left(  a_{u}+a_{u-2}\right)  a_{u-3}=\underbrace{\left(  a_{u-2}%
+a_{u-4}\right)  }_{=\left(  m+1\right)  a_{u-3}}a_{u-1}=\left(  m+1\right)
a_{u-3}a_{u-1}. \label{sol.rec.ML49408.o2.pf.2}%
\end{equation}
But the number $a_{u-3}$ is positive (since $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ is a sequence of positive integers) and thus nonzero; hence,
we can cancel $a_{u-3}$ from the equality (\ref{sol.rec.ML49408.o2.pf.2}). We
thus find $a_{u}+a_{u-2}=\left(  m+1\right)  a_{u-1}$. In other words,
$a_{u}=\left(  m+1\right)  a_{u-1}-a_{u-2}$. This completes our induction
step. Thus, Observation 2 is proved.]

[\textit{Proof of Observation 3:} We shall prove Observation 3 by strong
induction on $n$:

\textit{Induction step:} Let $u$ be an odd integer such that $u\geq2$. Assume
(as the induction hypothesis) that Observation 3 holds for $n<u$. We must
prove that Observation 3 holds for $n=u$. In other words, we must prove that
$a_{u}=\left(  q+1\right)  a_{u-1}-a_{u-2}$.

If $u=3$, then this is easy to check\footnote{\textit{Proof.} Assume that
$u=3$. Thus, $a_{u}=a_{3}=m+k$ and $a_{u-1}=a_{3-1}=a_{2}=m$ and
$a_{u-2}=a_{3-2}=a_{1}=1$. Hence, $\left(  q+1\right)  \underbrace{a_{u-1}%
}_{=m}-\underbrace{a_{u-2}}_{=1}=\left(  q+1\right)  m-1=m+\underbrace{mq}%
_{=k+1}-1=m+\left(  k+1\right)  -1=m+k$. Comparing this with $a_{u}=m+k$, we
find $a_{u}=\left(  q+1\right)  a_{u-1}-a_{u-2}$. Thus, $a_{u}=\left(
q+1\right)  a_{u-1}-a_{u-2}$ is proved under the assumption that $u=3$.}.
Hence, we WLOG assume that $u\neq3$. Also, $u\neq2$ (since $u$ is odd), so
that $u>2$ (since $u\geq2$) and therefore $u\geq3$ (since $u$ is an integer).
Combining this with $u\neq3$, we obtain $u>3$, and thus $u\geq4$ (since $u$ is
an integer). In other words, $u-2\geq2$. Moreover, $u-2$ is an odd integer
(since $u$ is an odd integer). But our induction hypothesis says that
Observation 3 holds for $n<u$. Hence, we can apply Observation 3 to $n=u-2$
(since $u-2$ is an odd integer satisfying $u-2\geq2$ and $u-2<u$). Thus, we
obtain
\[
a_{u-2}=\left(  q+1\right)  \underbrace{a_{\left(  u-2\right)  -1}}_{=a_{u-3}%
}-\underbrace{a_{\left(  u-2\right)  -2}}_{=a_{u-4}}=\left(  q+1\right)
a_{u-3}-a_{u-4}.
\]
In other words, $a_{u-2}+a_{u-4}=\left(  q+1\right)  a_{u-3}$. Now,
Observation 1 yields%
\begin{equation}
\left(  a_{u}+a_{u-2}\right)  a_{u-3}=\underbrace{\left(  a_{u-2}%
+a_{u-4}\right)  }_{=\left(  q+1\right)  a_{u-3}}a_{u-1}=\left(  q+1\right)
a_{u-3}a_{u-1}. \label{sol.rec.ML49408.o3.pf.2}%
\end{equation}
But the number $a_{u-3}$ is positive (since $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ is a sequence of positive integers) and thus nonzero; hence,
we can cancel $a_{u-3}$ from the equality (\ref{sol.rec.ML49408.o3.pf.2}). We
thus find $a_{u}+a_{u-2}=\left(  q+1\right)  a_{u-1}$. In other words,
$a_{u}=\left(  q+1\right)  a_{u-1}-a_{u-2}$. This completes our induction
step. Thus, Observation 3 is proved.]

It is now straightforward to solve Exercise \ref{exe.rec.ML49408} by
induction. Indeed, we must show that%
\begin{equation}
a_{n}\text{ is an integer} \label{sol.rec.ML49408.anint}%
\end{equation}
for each $n\in\mathbb{N}$. We shall prove (\ref{sol.rec.ML49408.anint}) by
strong induction on $n$:

\textit{Induction step:} Let $u\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.rec.ML49408.anint}) holds for $n<u$. We must prove
that (\ref{sol.rec.ML49408.anint}) holds for $n=u$. In other words, we must
prove that $a_{u}$ is an integer. If $u=0$ or $u=1$, then this is clear
(because $a_{0}=1$ and $a_{1}=1$ are integers). Thus, we WLOG assume that we
have neither $u=0$ nor $u=1$. Hence, we must have $u\geq2$ (since
$u\in\mathbb{N}$). Thus, $u-1\in\mathbb{N}$ and $u-2\in\mathbb{N}$. Our
induction hypothesis readily yields that $a_{u-1}$ and $a_{u-2}$ are
integers\footnote{\textit{Proof.} Our induction hypothesis says that
(\ref{sol.rec.ML49408.anint}) holds for $n<u$. Hence,
(\ref{sol.rec.ML49408.anint}) holds for $n=u-2$ (since $u-2\in\mathbb{N}$ and
$u-2<u$). In other words, $a_{u-2}$ is an integer. The same argument (applied
to $u-1$ instead of $u-2$) shows that $a_{u-1}$ is an integer.}. Now, we are
in one of the following two cases:

\textit{Case 1:} The integer $u$ is even.

\textit{Case 2:} The integer $u$ is odd.

Let us first consider Case 1. In this case, the integer $u$ is even. Hence,
Observation 2 (applied to $n=u$) yields $a_{u}=\left(  m+1\right)
a_{u-1}-a_{u-2}$. The right hand side of this equality is an integer (since
$m$, $a_{u-1}$ and $a_{u-2}$ are integers); thus, the left hand side is an
integer as well. In other words, $a_{u}$ is an integer. Thus, we have shown
that $a_{u}$ is an integer in Case 1.

Let us now consider Case 2. In this case, the integer $u$ is odd. Hence,
Observation 3 (applied to $n=u$) yields $a_{u}=\left(  q+1\right)
a_{u-1}-a_{u-2}$. The right hand side of this equality is an integer (since
$q$, $a_{u-1}$ and $a_{u-2}$ are integers); thus, the left hand side is an
integer as well. In other words, $a_{u}$ is an integer. Thus, we have shown
that $a_{u}$ is an integer in Case 2.

We have now proven that $a_{u}$ is an integer in both Cases 1 and 2. Hence,
$a_{u}$ always is an integer. This completes the induction step. Thus,
(\ref{sol.rec.ML49408.anint}) is proved. In other words, Exercise
\ref{exe.rec.ML49408} is solved.
\end{proof}

Note that we have not actually used the Hint in the above solution: We did
show that the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ satisfies
an $\left(  a,b\right)  $-recurrence-like equation in which the coefficients
depend on the parity of the position (Observations 2 and 3); but this is not
the same as proving that each of the two subsequences $\left(  a_{0}%
,a_{2},a_{4},a_{6},\ldots\right)  $ and $\left(  a_{1},a_{3},a_{5}%
,a_{7},\ldots\right)  $ is $\left(  a,b\right)  $-recurrent for some integers
$a$ and $b$ (as suggested in the Hint). However, the latter statement is true
and not hard to prove: Namely, both subsequences $\left(  a_{0},a_{2}%
,a_{4},a_{6},\ldots\right)  $ and $\left(  a_{1},a_{3},a_{5},a_{7}%
,\ldots\right)  $ are $\left(  mq+m+q-1,-1\right)  $-recurrent. In other
words, we have%
\[
a_{n}=\left(  mq+m+q-1\right)  a_{n-2}-a_{n-4}%
\]
for each integer $n\geq4$. The proof of this fact (best made using
Observations 2 and 3 alone, forgetting the original definition of our
sequence) is left to the reader.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seq.geo-in-ari}}

\begin{proof}
[Discussion of Exercise \ref{exe.seq.geo-in-ari}.]Exercise
\ref{exe.seq.geo-in-ari} was proposed by N. B. Vasiljev in the \textit{Kvant}
journal (Kvant problem M202,
\href{http://kvant.mccme.ru/1973/05/zadachnik_kvanta_matematika.htm}{posed in
Kvant 5/1973},
\href{http://kvant.mccme.ru/1974/01/resheniya_zadachnika_kvanta_ma.htm}{solved
in Kvant 1/1974}). The following solution sketch is taken from that journal
(see also \url{https://artofproblemsolving.com/community/c6h16467p114645} for
a discussion of the problem):

\begin{proof}
[Solution to Exercise \ref{exe.seq.geo-in-ari} (sketched).]Let $A_{a,d}$
denote the arithmetic progression \newline$\left(  a,a+d,a+2d,a+3d,\ldots
\right)  $ (that is, the infinite arithmetic progression with difference $d$
and starting entry $a$). We thus must show that this sequence $A_{a,d}$
contains an infinite geometric progression as a subsequence if and only if
$\dfrac{a}{d}\in\mathbb{Q}$. In other words, we must prove the following two claims:

\begin{statement}
\textit{Claim 1:} If $\dfrac{a}{d}\in\mathbb{Q}$, then the arithmetic
progression $A_{a,d}$ contains an infinite geometric progression as a subsequence.
\end{statement}

\begin{statement}
\textit{Claim 2:} If the arithmetic progression $A_{a,d}$ contains an infinite
geometric progression as a subsequence, then $\dfrac{a}{d}\in\mathbb{Q}$.
\end{statement}

[\textit{Proof of Claim 1:} Assume that $\dfrac{a}{d}\in\mathbb{Q}$. Pick an
$m\in\mathbb{N}$ satisfying $m>-\dfrac{a}{d}$. (Such an $m$ clearly exists.)
Set $b=a+md$. Thus, $\dfrac{b}{d}=\dfrac{a+md}{d}=\underbrace{\dfrac{a}{d}%
}_{\in\mathbb{Q}}+\underbrace{m}_{\in\mathbb{N}\subseteq\mathbb{Q}}%
\in\mathbb{Q}$. Furthermore, $\dfrac{b}{d}=\dfrac{a}{d}+m>0$ (since
$m>-\dfrac{a}{d}$), so that $b\neq0$.

We know that $\dfrac{b}{d}$ is a positive rational number (since $\dfrac{b}%
{d}>0$ and $\dfrac{b}{d}\in\mathbb{Q}$). Hence, we can write $\dfrac{b}{d}$ in
the form $\dfrac{b}{d}=\dfrac{s}{r}$ for two \textbf{positive} integers $s$
and $r$. Consider these $s$ and $r$. From $\dfrac{b}{d}=\dfrac{s}{r}$, we
obtain $ds=br$.

Let $q=1+r$. Then, $q=1+r>1$ (since $r$ is positive), so that $q$ is a
positive integer.

Now, I claim that the geometric progression $\left(  bq^{0},bq^{1}%
,bq^{2},bq^{3},\ldots\right)  $ is a subsequence of $A_{a,d}$. Indeed, in
order to show this, I set%
\[
i_{n}=m+s\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)
\ \ \ \ \ \ \ \ \ \ \text{for each }n\in\mathbb{N}.
\]
Then, $i_{n}\in\mathbb{N}$ for each $n\in\mathbb{N}$ (since $m,s,q\in
\mathbb{N}$) and we have $i_{0}<i_{1}<i_{2}<\cdots$ (this follows easily from
the fact that $s$ and $q$ are positive). Hence, the sequence%
\[
\left(  a+i_{0}d,a+i_{1}d,a+i_{2}d,a+i_{3}d,\ldots\right)
\]
is a subsequence of the sequence $A_{a,d}$ (since the sequence $A_{a,d}$
consists of the numbers $a+id$ for all $i\in\mathbb{N}$).

However, for each $n\in\mathbb{N}$, we have%
\begin{align*}
a+\underbrace{i_{n}}_{=m+s\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)  }d  &
=a+\left(  m+s\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)  \right)  d\\
&  =\underbrace{a+md}_{=b}+\underbrace{s\left(  q^{0}+q^{1}+\cdots
+q^{n-1}\right)  d}_{=ds\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right)  }\\
&  =b+\underbrace{ds}_{=br}\left(  q^{0}+q^{1}+\cdots+q^{n-1}\right) \\
&  =b+b\underbrace{r}_{\substack{=q-1\\\text{(since }q=1+r\text{)}}}\left(
q^{0}+q^{1}+\cdots+q^{n-1}\right) \\
&  =b+b\underbrace{\left(  q-1\right)  \left(  q^{0}+q^{1}+\cdots
+q^{n-1}\right)  }_{\substack{=q^{n}-1\\\text{(by Exercise
\ref{exe.ind.geoser-b}, applied to }q\text{ instead of }b\text{)}}}\\
&  =b+b\left(  q^{n}-1\right)  =bq^{n}%
\end{align*}
and thus%
\[
bq^{n}=a+i_{n}d.
\]
In other words,
\begin{equation}
\left(  bq^{0},bq^{1},bq^{2},bq^{3},\ldots\right)  =\left(  a+i_{0}%
d,a+i_{1}d,a+i_{2}d,a+i_{3}d,\ldots\right)  . \label{sol.seq.geo-in-ari.b=a}%
\end{equation}
Now recall that $\left(  a+i_{0}d,a+i_{1}d,a+i_{2}d,a+i_{3}d,\ldots\right)  $
is a subsequence of $A_{a,d}$. In view of (\ref{sol.seq.geo-in-ari.b=a}), this
rewrites as follows: The geometric progression $\left(  bq^{0},bq^{1}%
,bq^{2},bq^{3},\ldots\right)  $ is a subsequence of $A_{a,d}$. Hence, the
arithmetic progression $A_{a,d}$ contains an infinite geometric progression as
a subsequence. This proves Claim 1.]

[\textit{Proof of Claim 2:} We shall show a stronger statement: If the
arithmetic progression $A_{a,d}$ contains a \textbf{three-term} geometric
progression $\left(  bq^{0},bq^{1},bq^{2}\right)  $ as a subsequence, then
$\dfrac{a}{d}\in\mathbb{Q}$.

Indeed, assume that the arithmetic progression $A_{a,d}$ contains a three-term
geometric progression $\left(  bq^{0},bq^{1},bq^{2}\right)  $ as a
subsequence. In other words, there exist reals $b$ and $q$ and nonnegative
integers $i,j,k$ satisfying $i<j<k$ and%
\[
bq^{0}=a+id,\ \ \ \ \ \ \ \ \ \ bq^{1}=a+jd,\ \ \ \ \ \ \ \ \ \ bq^{2}=a+kd.
\]
Consider these $b$, $q$, $i$, $j$ and $k$. Now,%
\[
\left(  bq^{0}\right)  \left(  bq^{2}\right)  -\left(  bq^{1}\right)
^{2}=b^{2}q^{2}-b^{2}q^{2}=0,
\]
so that%
\begin{align*}
0  &  =\underbrace{\left(  bq^{0}\right)  }_{=a+id}\underbrace{\left(
bq^{2}\right)  }_{=a+kd}-\left(  \underbrace{bq^{1}}_{=a+jd}\right)
^{2}=\left(  a+id\right)  \left(  a+kd\right)  -\left(  a+jd\right)  ^{2}\\
&  =\left(  i-2j+k\right)  ad+\left(  ik-j^{2}\right)  d^{2}=d\cdot\left(
\left(  i-2j+k\right)  a+\left(  ik-j^{2}\right)  d\right)  .
\end{align*}
We can cancel $d$ from this equality (since $d\neq0$), and thus obtain
\[
0=\left(  i-2j+k\right)  a+\left(  ik-j^{2}\right)  d.
\]
In other words,%
\begin{equation}
\left(  i-2j+k\right)  a=-\left(  ik-j^{2}\right)  d.
\label{sol.seq.geo-in-ari.c2.pf.5}%
\end{equation}
If we knew that $i-2j+k\neq0$, then we could divide the equality
(\ref{sol.seq.geo-in-ari.c2.pf.5}) by $d\left(  i-2j+k\right)  $ (since
$d\neq0$), and thus obtain%
\[
\dfrac{a}{d}=\dfrac{-\left(  ik-j^{2}\right)  }{i-2j+k}\in\mathbb{Q}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }i,j,k\text{ are integers}\right)  ,
\]
which would complete the proof of Claim 2. Thus, it remains to show that
$i-2j+k\neq0$.

Indeed, assume the contrary. Thus, $i-2j+k=0$, so that $2j=i+k$ and therefore
$j=\dfrac{i+k}{2}$. Hence,
\[
ik-j^{2}=ik-\left(  \dfrac{i+k}{2}\right)  ^{2}=-\left(  \dfrac{k-i}%
{2}\right)  ^{2}>0
\]
(since $k-i>0$ (because $i<k$)). Hence, $ik-j^{2}\neq0$. Thus, both factors
$ik-j^{2}$ and $d$ on the right hand side of (\ref{sol.seq.geo-in-ari.c2.pf.5}%
) are nonzero (since $d\neq0$). Hence, the entire right hand side of
(\ref{sol.seq.geo-in-ari.c2.pf.5}) is nonzero. Thus, the left hand side is
nonzero as well. That is, $\left(  i-2j+k\right)  a\neq0$. But this
contradicts $\underbrace{\left(  i-2j+k\right)  }_{=0}a=0$. This contradiction
shows that our assumption was false. Hence, $i-2j+k\neq0$ is proved, and our
proof of Claim 2 is complete.]
\end{proof}

A few words are in order about the somewhat baroque construction of $m$ and
$b$ in the proof of Claim 1. When the numbers $a$ and $d$ have the same sign
and $a$ is nonzero, we don't need to go through this ordeal; we can just set
$m=0$ and $b=a$ and start our geometric subsequence directly at the first
entry of $A_{a,d}$ (that is, start it with $a$). However, if $a$ and $d$ have
different signs, then an infinite geometric subsequence of $A_{a,d}$ cannot
start with $a$, since only finitely many entries of $A_{a,d}$ have the same
sign as $a$ (but a geometric subsequence starting with $a$ would have
infinitely many such entries). Thus, we need to throw away the first few
entries of $A_{a,d}$ until we are only left with entries that are nonzero and
have the same sign as $d$. This is what $m$ and $b$ are for. Namely, $m$ is
the number of entries we need to throw away, and $b$ is the new first entry
after throwing away.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.laurent.mse3586309b}}

\begin{proof}
[Discussion of Exercise \ref{exe.laurent.mse3586309b}.]As usual, part
\textbf{(b)} of the exercise is hard on its own, but becomes easy once part
\textbf{(a)} has been solved. Part \textbf{(a)}, meanwhile, is fairly easy to
prove by induction. Here is a detailed solution:

\begin{proof}
[Solution to Exercise \ref{exe.laurent.mse3586309b}.]We begin by computing the
first $9$ entries of our sequence.

From (\ref{eq.exe.laurent.mse3586309b.bas}), we obtain $x_{0}=1$ and $x_{1}=1$
and $x_{2}=1$ and $x_{3}=1$ and $x_{4}=1$ and $x_{5}=1$. Applying
(\ref{eq.exe.laurent.mse3586309b.rec}) to $n=6$, we find%
\begin{align*}
x_{6}  &  =\dfrac{x_{6-3}\left(  x_{6-1}+x_{6-5}\right)  }{x_{6-6}}%
=\dfrac{x_{3}\left(  x_{5}+x_{1}\right)  }{x_{0}}\\
&  =\dfrac{1\left(  1+1\right)  }{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}x_{3}=1\text{ and }x_{5}=1\text{ and }x_{1}=1\text{ and }x_{0}=1\right) \\
&  =2.
\end{align*}
Applying (\ref{eq.exe.laurent.mse3586309b.rec}) to $n=7$, we find%
\begin{align*}
x_{7}  &  =\dfrac{x_{7-3}\left(  x_{7-1}+x_{7-5}\right)  }{x_{7-6}}%
=\dfrac{x_{4}\left(  x_{6}+x_{2}\right)  }{x_{1}}\\
&  =\dfrac{1\left(  2+1\right)  }{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}x_{4}=1\text{ and }x_{6}=2\text{ and }x_{2}=1\text{ and }x_{1}=1\right) \\
&  =3.
\end{align*}
Applying (\ref{eq.exe.laurent.mse3586309b.rec}) to $n=8$, we find%
\begin{align*}
x_{8}  &  =\dfrac{x_{8-3}\left(  x_{8-1}+x_{8-5}\right)  }{x_{8-6}}%
=\dfrac{x_{5}\left(  x_{7}+x_{3}\right)  }{x_{2}}\\
&  =\dfrac{1\left(  3+1\right)  }{1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}x_{5}=1\text{ and }x_{7}=3\text{ and }x_{3}=1\text{ and }x_{2}=1\right) \\
&  =4.
\end{align*}
We have thus computed the values of $x_{0},x_{1},\ldots,x_{8}$. From these
values, we see immediately that $x_{0},x_{1},\ldots,x_{8}$ are integers.

We now proceed to solving both parts of the exercise. \medskip

\textbf{(a)} We proceed by induction on $n$:

\textit{Induction base:} A straightforward computation shows that Exercise
\ref{exe.laurent.mse3586309b} \textbf{(a)} holds for $n=8$%
\ \ \ \ \footnote{Here are the details of this computation: Comparing
\[
\underbrace{x_{8}}_{=4}+\underbrace{x_{8-4}}_{=x_{4}=1}+\underbrace{x_{8-8}%
}_{=x_{0}=1}=4+1+1=6
\]
with%
\[
6\underbrace{x_{8-3}}_{=x_{5}=1}\ \ \underbrace{x_{8-4}}_{=x_{4}%
=1}\ \ \underbrace{x_{8-5}}_{=x_{3}=1}=6,
\]
we obtain $x_{8}+x_{8-4}+x_{8-8}=6x_{8-3}x_{8-4}x_{8-5}$. In other words,
Exercise \ref{exe.laurent.mse3586309b} \textbf{(a)} holds for $n=8$.}.

\textit{Induction step:} Let $m\geq9$ be an integer. Assume (as the induction
hypothesis) that Exercise \ref{exe.laurent.mse3586309b} \textbf{(a)} holds for
$n=m-1$. We must prove that Exercise \ref{exe.laurent.mse3586309b}
\textbf{(a)} holds for $n=m$.

Our induction hypothesis says that Exercise \ref{exe.laurent.mse3586309b}
\textbf{(a)} holds for $n=m-1$. In other words, we have%
\[
x_{m-1}+x_{\left(  m-1\right)  -4}+x_{\left(  m-1\right)  -8}=6x_{\left(
m-1\right)  -3}x_{\left(  m-1\right)  -4}x_{\left(  m-1\right)  -5}.
\]
We can rewrite this as%
\begin{equation}
x_{m-1}+x_{m-5}+x_{m-9}=6x_{m-4}x_{m-5}x_{m-6}
\label{sol.laurent.mse3586309b.b.IH}%
\end{equation}
(since $\left(  m-1\right)  -4=m-5$ and $\left(  m-1\right)  -8=m-9$ and
$\left(  m-1\right)  -3=m-4$ and $\left(  m-1\right)  -5=m-6$).

We have $m\geq9\geq6$. Hence, from (\ref{eq.exe.laurent.mse3586309b.rec})
(applied to $n=m$), we obtain $x_{m}=\dfrac{x_{m-3}\left(  x_{m-1}%
+x_{m-5}\right)  }{x_{m-6}}$, so that%
\begin{equation}
x_{m-6}x_{m}=x_{m-3}\left(  x_{m-5}+x_{m-1}\right)  .
\label{sol.laurent.mse3586309b.b.1}%
\end{equation}


We have $m-3 \geq6$ (since $m \geq9 = 6+3$). Thus, from
(\ref{eq.exe.laurent.mse3586309b.rec}) (applied to $n=m-3$), we obtain
\[
x_{m-3}=\dfrac{x_{\left(  m-3\right)  -3}\left(  x_{\left(  m-3\right)
-1}+x_{\left(  m-3\right)  -5}\right)  }{x_{\left(  m-3\right)  -6}}%
=\dfrac{x_{m-6}\left(  x_{m-4}+x_{m-8}\right)  }{x_{m-9}}%
\]
(since $\left(  m-3\right)  -3=m-6$ and $\left(  m-3\right)  -1=m-4$ and
$\left(  m-3\right)  -5=m-8$ and $\left(  m-3\right)  -6=m-9$). Thus,%
\begin{equation}
x_{m-3}x_{m-9}=x_{m-6}\left(  x_{m-4}+x_{m-8}\right)  .
\label{sol.laurent.mse3586309b.b.2}%
\end{equation}


Now,%
\begin{align}
&  x_{m-6}\left(  x_{m}+x_{m-4}+x_{m-8}\right) \nonumber\\
&  =\underbrace{x_{m-6}x_{m}}_{\substack{=x_{m-3}\left(  x_{m-5}%
+x_{m-1}\right)  \\\text{(by (\ref{sol.laurent.mse3586309b.b.1}))}%
}}+\underbrace{x_{m-6}\left(  x_{m-4}+x_{m-8}\right)  }_{\substack{=x_{m-3}%
x_{m-9}\\\text{(by (\ref{sol.laurent.mse3586309b.b.2}))}}}\nonumber\\
&  =x_{m-3}\left(  x_{m-5}+x_{m-1}\right)  +x_{m-3}x_{m-9}=x_{m-3}%
\underbrace{\left(  x_{m-1}+x_{m-5}+x_{m-9}\right)  }_{\substack{=6x_{m-4}%
x_{m-5}x_{m-6}\\\text{(by (\ref{sol.laurent.mse3586309b.b.IH}))}}}\nonumber\\
&  =x_{m-3}\cdot6x_{m-4}x_{m-5}x_{m-6}=6x_{m-3}x_{m-4}x_{m-5}x_{m-6}.
\label{sol.laurent.mse3586309b.b.at}%
\end{align}


However, $x_{m-6}$ is a positive rational number (since $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ is a sequence of positive rational numbers), and
thus is nonzero. Hence, we can cancel $x_{m-6}$ from the equality
(\ref{sol.laurent.mse3586309b.b.at}). As a result, we obtain $x_{m}%
+x_{m-4}+x_{m-8}=6x_{m-3}x_{m-4}x_{m-5}$. In other words, Exercise
\ref{exe.laurent.mse3586309b} \textbf{(a)} holds for $n=m$. This completes the
induction step; thus, Exercise \ref{exe.laurent.mse3586309b} \textbf{(a)} is
proved. \medskip

\textbf{(b)} This is a straightforward strong induction on $n$%
.\ \ \ \ \footnote{Here is the proof in detail:
\par
We proceed by strong induction on $n$.
\par
\textit{Induction step:} Fix $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.laurent.mse3586309b} \textbf{(b)} holds for
each $n\in\mathbb{N}$ satisfying $n<k$. We must prove that Exercise
\ref{exe.laurent.mse3586309b} \textbf{(b)} holds for $n=k$. In other words, we
must prove that $x_{k}$ is an integer.
\par
If $k\leq8$, then this is clearly true (since we have shown above that
$x_{0},x_{1},\ldots,x_{8}$ are integers). Thus, for the rest of this induction
step, we WLOG assume that $k>8$. Hence, $k\geq8$. Thus, Exercise
\ref{exe.laurent.mse3586309b} \textbf{(a)} (applied to $n=k$) yields
\begin{equation}
x_{k}+x_{k-4}+x_{k-8}=6x_{k-3}x_{k-4}x_{k-5}.
\label{sol.laurent.mse3586309b.a.rec}%
\end{equation}
\par
From $k\geq8$, we obtain $k-8\in\mathbb{N}$ and $k-4\in\mathbb{N}$ and
$k-3\in\mathbb{N}$ and $k-5\in\mathbb{N}$. Now, recall that Exercise
\ref{exe.laurent.mse3586309b} \textbf{(b)} holds for each $n\in\mathbb{N}$
satisfying $n<k$. Hence, in particular, Exercise \ref{exe.laurent.mse3586309b}
\textbf{(b)} holds for $n=k-8$ (since $k-8\in\mathbb{N}$ and $k-8<k$). In
other words, $x_{k-8}$ is an integer. Similarly, we can see that $x_{k-4}$ is
an integer (since $k-4\in\mathbb{N}$ and $k-4<k$). Similarly, we can see that
$x_{k-3}$ is an integer (since $k-3\in\mathbb{N}$ and $k-3<k$). Similarly, we
can see that $x_{k-5}$ is an integer (since $k-5\in\mathbb{N}$ and $k-5<k$).
Now, solving the equality (\ref{sol.laurent.mse3586309b.a.rec}) for $x_{k}$,
we obtain%
\[
x_{k}=6x_{k-3}x_{k-4}x_{k-5}-x_{k-4}-x_{k-8}.
\]
This shows that $x_{k}$ is an integer (since all the numbers $6$, $x_{k-3}$,
$x_{k-4}$, $x_{k-5}$ and $x_{k-8}$ on the right hand side are integers). In
other words, Exercise \ref{exe.laurent.mse3586309b} \textbf{(b)} holds for
$n=k$. This completes the induction step. Thus, Exercise
\ref{exe.laurent.mse3586309b} \textbf{(b)} is solved.}
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.laurent.mse3586309}}

\begin{proof}
[Discussion of Exercise \ref{exe.laurent.mse3586309}.]On its own, part
\textbf{(a)} of the exercise would be pretty hard (indeed, it
\href{https://math.stackexchange.com/questions/3586309}{stayed unsolved on
math.stackexchange} for a few years). But part \textbf{(b)} provides the
scaffolding that makes it easy. Thus, we will start by solving part
\textbf{(b)} this time.

\begin{proof}
[Solution to Exercise \ref{exe.laurent.mse3586309}.]From
(\ref{eq.exe.laurent.mse3586309.bas}), we know that $a_{0}=2$ and $a_{1}=1$
and $a_{2}=1$ and $a_{3}=1$. Thus, $a_{0}$ is an integer (since $a_{0}%
=2\in\mathbb{Z}$). Applying (\ref{eq.exe.laurent.mse3586309.rec}) to $n=4$, we
find%
\begin{align*}
a_{4}  &  =\dfrac{\left(  a_{4-1}+a_{4-2}\right)  \left(  a_{4-2}%
+a_{4-3}\right)  }{a_{4-4}}=\dfrac{\left(  a_{3}+a_{2}\right)  \left(
a_{2}+a_{1}\right)  }{a_{0}}\\
&  =\dfrac{\left(  1+1\right)  \left(  1+1\right)  }{2}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }a_{3}=1\text{ and }a_{2}=1\text{ and
}a_{1}=1\text{ and }a_{0}=2\right) \\
&  =2.
\end{align*}


Now, let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be the sequence defined
in Exercise \ref{exe.laurent.mse3586309b}. We shall now solve part
\textbf{(b)} of Exercise \ref{exe.laurent.mse3586309} (and then derive part
\textbf{(a)} from it). \medskip

\textbf{(b)} We must prove that%
\begin{equation}
a_{n}=x_{n+2}x_{n+1}x_{n}x_{n-1} \label{sol.laurent.mse3586309.goal}%
\end{equation}
for each $n\geq1$. We shall prove this by strong induction on $n$:

\textit{Induction step:} Let $m\geq1$. Assume (as the induction hypothesis)
that (\ref{sol.laurent.mse3586309.goal}) holds for each $n\geq1$ satisfying
$n<m$. We must prove that (\ref{sol.laurent.mse3586309.goal}) holds for $n=m$.
In other words, we must prove that $a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$.

If $m<5$, then this can easily be checked by hand\footnote{Here are the
details of this verification:
\par
\begin{itemize}
\item We know (from the solution to Exercise \ref{exe.laurent.mse3586309b})
that $x_{0}=1$ and $x_{1}=1$ and $x_{2}=1$ and $x_{3}=1$ and $x_{4}=1$ and
$x_{5}=1$ and $x_{6}=2$.
\par
\item Comparing $\underbrace{x_{1+2}}_{=x_{3}=1}\underbrace{x_{1+1}}%
_{=x_{2}=1}\underbrace{x_{1}}_{=1}\underbrace{x_{1-1}}_{=x_{0}=1}=1$ with
$a_{1}=1$, we obtain $a_{1}=x_{1+2}x_{1+1}x_{1}x_{1-1}$. In other words,
$a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$ holds for $m=1$.
\par
\item Comparing $\underbrace{x_{2+2}}_{=x_{4}=1}\underbrace{x_{2+1}}%
_{=x_{3}=1}\underbrace{x_{2}}_{=1}\underbrace{x_{2-1}}_{=x_{1}=1}=1$ with
$a_{2}=1$, we obtain $a_{2}=x_{2+2}x_{2+1}x_{2}x_{2-1}$. In other words,
$a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$ holds for $m=2$.
\par
\item Comparing $\underbrace{x_{3+2}}_{=x_{5}=1}\underbrace{x_{3+1}}%
_{=x_{4}=1}\underbrace{x_{3}}_{=1}\underbrace{x_{3-1}}_{=x_{2}=1}=1$ with
$a_{3}=1$, we obtain $a_{3}=x_{3+2}x_{3+1}x_{3}x_{3-1}$. In other words,
$a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$ holds for $m=3$.
\par
\item Comparing $\underbrace{x_{4+2}}_{=x_{6}=2}\underbrace{x_{4+1}}%
_{=x_{5}=1}\underbrace{x_{4}}_{=1}\underbrace{x_{4-1}}_{=x_{3}=1}=1$ with
$a_{4}=2$, we obtain $a_{4}=x_{4+2}x_{4+1}x_{4}x_{4-1}$. In other words,
$a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$ holds for $m=4$.
\end{itemize}
\par
Thus, we have showed that $a_{m}=x_{m+2}x_{m+1}x_{m}x_{m-1}$ holds for $m=1$,
for $m=2$, for $m=3$ and for $m=4$. In other words, $a_{m}=x_{m+2}x_{m+1}%
x_{m}x_{m-1}$ holds if $m<5$ (because the only integers $m\geq1$ satisfying
$m<5$ are $1$, $2$, $3$ and $4$).}. Thus, for the rest of this induction step,
we WLOG assume that $m\geq5$. Hence, $m-4\geq5-4=1$ and $m-2\geq m-4\geq1$ and
$m-3\geq m-4\geq1$ and $m-1\geq m-4\geq1$.

Our induction hypothesis says that (\ref{sol.laurent.mse3586309.goal}) holds
for each $n\geq1$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309.goal}) holds for $n=m-4$ (since $m-4\geq1$ and
$m-4<m$). In other words, we have $a_{m-4}=x_{\left(  m-4\right)
+2}x_{\left(  m-4\right)  +1}x_{m-4}x_{\left(  m-4\right)  -1}$. In other
words,%
\begin{equation}
a_{m-4}=x_{m-2}x_{m-3}x_{m-4}x_{m-5} \label{sol.laurent.mse3586309.4}%
\end{equation}
(since $\left(  m-4\right)  +2=m-2$ and $\left(  m-4\right)  +1=m-3$ and
$\left(  m-4\right)  -1=m-5$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309.goal}) holds
for each $n\geq1$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309.goal}) holds for $n=m-3$ (since $m-3\geq1$ and
$m-3<m$). In other words, we have $a_{m-3}=x_{\left(  m-3\right)
+2}x_{\left(  m-3\right)  +1}x_{m-3}x_{\left(  m-3\right)  -1}$. In other
words,%
\begin{equation}
a_{m-3}=x_{m-1}x_{m-2}x_{m-3}x_{m-4} \label{sol.laurent.mse3586309.3}%
\end{equation}
(since $\left(  m-3\right)  +2=m-1$ and $\left(  m-3\right)  +1=m-2$ and
$\left(  m-3\right)  -1=m-4$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309.goal}) holds
for each $n\geq1$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309.goal}) holds for $n=m-2$ (since $m-2\geq1$ and
$m-2<m$). In other words, we have $a_{m-2}=x_{\left(  m-2\right)
+2}x_{\left(  m-2\right)  +1}x_{m-2}x_{\left(  m-2\right)  -1}$. In other
words,%
\begin{equation}
a_{m-2}=x_{m}x_{m-1}x_{m-2}x_{m-3} \label{sol.laurent.mse3586309.2}%
\end{equation}
(since $\left(  m-2\right)  +2=m$ and $\left(  m-2\right)  +1=m-1$ and
$\left(  m-2\right)  -1=m-3$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309.goal}) holds
for each $n\geq1$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309.goal}) holds for $n=m-1$ (since $m-1\geq1$ and
$m-1<m$). In other words, we have $a_{m-1}=x_{\left(  m-1\right)
+2}x_{\left(  m-1\right)  +1}x_{m-1}x_{\left(  m-1\right)  -1}$. In other
words,%
\begin{equation}
a_{m-1}=x_{m+1}x_{m}x_{m-1}x_{m-2} \label{sol.laurent.mse3586309.1}%
\end{equation}
(since $\left(  m-1\right)  +2=m+1$ and $\left(  m-1\right)  +1=m$ and
$\left(  m-1\right)  -1=m-2$).

However, $m\geq5$ entails $m+2\geq5+2=7\geq6$. Thus,
(\ref{eq.exe.laurent.mse3586309b.rec}) (applied to $n=m+2$) yields%
\[
x_{m+2}=\dfrac{x_{\left(  m+2\right)  -3}\left(  x_{\left(  m+2\right)
-1}+x_{\left(  m+2\right)  -5}\right)  }{x_{\left(  m+2\right)  -6}}%
=\dfrac{x_{m-1}\left(  x_{m+1}+x_{m-3}\right)  }{x_{m-4}}%
\]
(since $\left(  m+2\right)  -3=m-1$ and $\left(  m+2\right)  -1=m+1$ and
$\left(  m+2\right)  -5=m-3$ and $\left(  m+2\right)  -6=m-4$). Therefore,%
\begin{equation}
x_{m+2}x_{m-4}=x_{m-1}\left(  x_{m+1}+x_{m-3}\right)  .
\label{sol.laurent.mse3586309.5}%
\end{equation}


Furthermore, $m\geq5$ entails $m+1\geq5+1=6$. Thus,
(\ref{eq.exe.laurent.mse3586309b.rec}) (applied to $n=m+1$) yields%
\[
x_{m+1}=\dfrac{x_{\left(  m+1\right)  -3}\left(  x_{\left(  m+1\right)
-1}+x_{\left(  m+1\right)  -5}\right)  }{x_{\left(  m+1\right)  -6}}%
=\dfrac{x_{m-2}\left(  x_{m}+x_{m-4}\right)  }{x_{m-5}}%
\]
(since $\left(  m+1\right)  -3=m-2$ and $\left(  m+1\right)  -1=m$ and
$\left(  m+1\right)  -5=m-4$ and $\left(  m+1\right)  -6=m-5$). Therefore,%
\begin{equation}
x_{m+1}x_{m-5}=x_{m-2}\left(  x_{m}+x_{m-4}\right)  .
\label{sol.laurent.mse3586309.6}%
\end{equation}


Now,%
\begin{align*}
\underbrace{a_{m-1}}_{\substack{=x_{m+1}x_{m}x_{m-1}x_{m-2}\\\text{(by
(\ref{sol.laurent.mse3586309.1}))}}}+\underbrace{a_{m-2}}_{\substack{=x_{m}%
x_{m-1}x_{m-2}x_{m-3}\\\text{(by (\ref{sol.laurent.mse3586309.2}))}}}  &
=x_{m+1}x_{m}x_{m-1}x_{m-2}+x_{m}x_{m-1}x_{m-2}x_{m-3}\\
&  =x_{m}x_{m-2}\underbrace{x_{m-1}\left(  x_{m+1}+x_{m-3}\right)
}_{\substack{=x_{m+2}x_{m-4}\\\text{(by (\ref{sol.laurent.mse3586309.5}))}}}\\
&  =x_{m}x_{m-2}x_{m+2}x_{m-4}%
\end{align*}
and%
\begin{align*}
\underbrace{a_{m-2}}_{\substack{=x_{m}x_{m-1}x_{m-2}x_{m-3}\\\text{(by
(\ref{sol.laurent.mse3586309.2}))}}}+\underbrace{a_{m-3}}_{\substack{=x_{m-1}%
x_{m-2}x_{m-3}x_{m-4}\\\text{(by (\ref{sol.laurent.mse3586309.3}))}}}  &
=x_{m}x_{m-1}x_{m-2}x_{m-3}+x_{m-1}x_{m-2}x_{m-3}x_{m-4}\\
&  =x_{m-1}x_{m-3}\underbrace{x_{m-2}\left(  x_{m}+x_{m-4}\right)
}_{\substack{=x_{m+1}x_{m-5}\\\text{(by (\ref{sol.laurent.mse3586309.6}))}}}\\
&  =x_{m-1}x_{m-3}x_{m+1}x_{m-5}.
\end{align*}


Now, $m\geq5\geq4$. Hence, (\ref{eq.exe.laurent.mse3586309.rec}) (applied to
$n=m$) yields%
\begin{align*}
a_{m}  &  =\dfrac{\left(  a_{m-1}+a_{m-2}\right)  \left(  a_{m-2}%
+a_{m-3}\right)  }{a_{m-4}}=\dfrac{x_{m}x_{m-2}x_{m+2}x_{m-4}\cdot
x_{m-1}x_{m-3}x_{m+1}x_{m-5}}{x_{m-2}x_{m-3}x_{m-4}x_{m-5}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since }a_{m-1}+a_{m-2}=x_{m}x_{m-2}x_{m+2}x_{m-4}\\
\text{and }a_{m-2}+a_{m-3}=x_{m-1}x_{m-3}x_{m+1}x_{m-5}\\
\text{and }a_{m-4}=x_{m-2}x_{m-3}x_{m-4}x_{m-5}%
\end{array}
\right) \\
&  =x_{m+2}x_{m+1}x_{m}x_{m-1}.
\end{align*}
In other words, (\ref{sol.laurent.mse3586309.goal}) holds for $n=m$. This
completes the induction step. Thus, (\ref{sol.laurent.mse3586309.goal}) is
proved. In other words, Exercise \ref{exe.laurent.mse3586309} \textbf{(b)} is
solved. \medskip

\textbf{(a)} Let $n\in\mathbb{N}$. We must prove that $a_{n}$ is an integer.
If $n=0$, then this is obvious (since we know that $a_{0}$ is an integer).
Thus, for the rest of this proof, we WLOG assume that $n\neq0$. Hence,
$n\geq1$ (since $n\in\mathbb{N}$).

Hence, Exercise \ref{exe.laurent.mse3586309} \textbf{(b)} yields
$a_{n}=x_{n+2}x_{n+1}x_{n}x_{n-1}$. However, for each $m\in\mathbb{N}$, the
number $x_{m}$ is an integer (by Exercise \ref{exe.laurent.mse3586309b}
\textbf{(b)}, applied to $m$ instead of $n$). In other words, all entries of
the sequence $\left(  x_{0},x_{1},x_{2},x_{3},\ldots\right)  $ are integers.
Hence, in particular, the four numbers $x_{n+2},x_{n+1},x_{n},x_{n-1}$ are
integers (since these four numbers are entries of the sequence $\left(
x_{0},x_{1},x_{2},x_{3},\ldots\right)  $). Thus, their product $x_{n+2}%
x_{n+1}x_{n}x_{n-1}$ is an integer as well. In other words, $a_{n}$ is an
integer (since $a_{n}=x_{n+2}x_{n+1}x_{n}x_{n-1}$). This solves Exercise
\ref{exe.laurent.mse3586309} \textbf{(a)}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.laurent.mse3586309c}}

\begin{proof}
[Discussion of Exercise \ref{exe.laurent.mse3586309c}.]Once again, the
\textquotedblleft active ingredient\textquotedblright\ in the exercise is part
\textbf{(b)}; the other two parts will follow easily once part \textbf{(b)} is solved.

\begin{proof}
[Solution to Exercise \ref{exe.laurent.mse3586309c}.]Let $\left(  x_{0}%
,x_{1},x_{2},\ldots\right)  $ be the sequence defined in Exercise
\ref{exe.laurent.mse3586309b}.

\textbf{(b)} We must prove that%
\begin{equation}
b_{n}=x_{n+2}x_{n} \label{sol.laurent.mse3586309c.goal}%
\end{equation}
for each $n\geq0$. We shall prove this by strong induction on $n$:

\textit{Induction step:} Let $m\geq0$. Assume (as the induction hypothesis)
that (\ref{sol.laurent.mse3586309c.goal}) holds for each $n\geq0$ satisfying
$n<m$. We must prove that (\ref{sol.laurent.mse3586309c.goal}) holds for
$n=m$. In other words, we must prove that $b_{m}=x_{m+2}x_{m}$.

If $m<4$, then this is easy to verify directly\footnote{\textit{Proof.} Assume
that $m<4$. We must verify that $b_{m}=x_{m+2}x_{m}$.
\par
We have $m\in\left\{  0,1,2,3\right\}  $ (since $m$ is an integer satisfying
$m\geq0$ and $m<4$).
\par
The equalities (\ref{eq.exe.laurent.mse3586309c.bas}) say that each of the
four numbers $b_{0},b_{1},b_{2},b_{3}$ equals $1$. In other words, $b_{k}=1$
for each $k\in\left\{  0,1,2,3\right\}  $. Applying this to $k=m$, we find
$b_{m}=1$ (since $m\in\left\{  0,1,2,3\right\}  $). On the other hand, $m<4<6$
and therefore $x_{m}=1$ (by (\ref{eq.exe.laurent.mse3586309b.bas}), applied to
$n=m$). Furthermore, $m+2<6$ (since $m<4=6-2$) and therefore $x_{m+2}=1$ (by
(\ref{eq.exe.laurent.mse3586309b.bas}), applied to $n=m+2$). Now, comparing
$b_{m}=1$ with $\underbrace{x_{m}}_{=1}\underbrace{x_{m+2}}_{=1}=1$, we obtain
$b_{m}=x_{m+2}x_{m}$. Qed.}. Thus, for the rest of this induction step, we
WLOG assume that $m\geq4$. Hence, $m-4\geq0$ and $m-3\geq m-4\geq0$ and
$m-2\geq m-4\geq0$ and $m-1\geq m-4\geq0$.

Our induction hypothesis says that (\ref{sol.laurent.mse3586309c.goal}) holds
for each $n\geq0$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309c.goal}) holds for $n=m-4$ (since $m-4\geq0$ and
$m-4<m$). In other words, we have $b_{m-4}=x_{\left(  m-4\right)  +2}x_{m-4}$.
In other words,%
\[
b_{m-4}=x_{m-2}x_{m-4}%
\]
(since $\left(  m-4\right)  +2=m-2$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309c.goal}) holds
for each $n\geq0$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309c.goal}) holds for $n=m-3$ (since $m-3\geq0$ and
$m-3<m$). In other words, we have $b_{m-3}=x_{\left(  m-3\right)  +2}x_{m-3}$.
In other words,%
\[
b_{m-3}=x_{m-1}x_{m-3}%
\]
(since $\left(  m-3\right)  +2=m-1$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309c.goal}) holds
for each $n\geq0$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309c.goal}) holds for $n=m-2$ (since $m-2\geq0$ and
$m-2<m$). In other words, we have $b_{m-2}=x_{\left(  m-2\right)  +2}x_{m-2}$.
In other words,%
\[
b_{m-2}=x_{m}x_{m-2}%
\]
(since $\left(  m-2\right)  +2=m$).

Our induction hypothesis says that (\ref{sol.laurent.mse3586309c.goal}) holds
for each $n\geq0$ satisfying $n<m$. Thus, in particular,
(\ref{sol.laurent.mse3586309c.goal}) holds for $n=m-1$ (since $m-1\geq0$ and
$m-1<m$). In other words, we have $b_{m-1}=x_{\left(  m-1\right)  +2}x_{m-1}$.
In other words,%
\[
b_{m-1}=x_{m+1}x_{m-1}%
\]
(since $\left(  m-1\right)  +2=m+1$).

From $m\geq4$, we obtain $m+2\geq4+2=6$. Hence,
(\ref{eq.exe.laurent.mse3586309b.rec}) (applied to $n=m+2$) yields%
\begin{align}
x_{m+2}  &  =\dfrac{x_{\left(  m+2\right)  -3}\left(  x_{\left(  m+2\right)
-1}+x_{\left(  m+2\right)  -5}\right)  }{x_{\left(  m+2\right)  -6}%
}\nonumber\\
&  =\dfrac{x_{m-1}\left(  x_{m+1}+x_{m-3}\right)  }{x_{m-4}}
\label{sol.laurent.mse3586309c.6}%
\end{align}
(since $\left(  m+2\right)  -3=m-1$ and $\left(  m+2\right)  -1=m+1$ and
$\left(  m+2\right)  -5=m-3$ and $\left(  m+2\right)  -6=m-4$).

However, $m\geq4$. Thus, (\ref{eq.exe.laurent.mse3586309c.rec}) (applied to
$n=m$) yields%
\begin{align*}
b_{m}  &  =\dfrac{b_{m-2}\left(  b_{m-1}+b_{m-3}\right)  }{b_{m-4}}%
=\dfrac{x_{m}x_{m-2}\left(  x_{m+1}x_{m-1}+x_{m-1}x_{m-3}\right)  }%
{x_{m-2}x_{m-4}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{since }b_{m-1}=x_{m+1}x_{m-1}\text{ and }b_{m-2}=x_{m}x_{m-2}\\
\text{and }b_{m-3}=x_{m-1}x_{m-3}\text{ and }b_{m-4}=x_{m-2}x_{m-4}%
\end{array}
\right) \\
&  =\underbrace{\dfrac{x_{m-1}\left(  x_{m+1}+x_{m-3}\right)  }{x_{m-4}}%
}_{\substack{=x_{m+2}\\\text{(by (\ref{sol.laurent.mse3586309c.6}))}}}\cdot
x_{m}=x_{m+2}x_{m}.
\end{align*}
In other words, (\ref{sol.laurent.mse3586309c.goal}) holds for $n=m$. This
completes the induction step. Thus, (\ref{sol.laurent.mse3586309c.goal}) is
proven. In other words, Exercise \ref{exe.laurent.mse3586309c} \textbf{(b)} is
solved. \medskip

\textbf{(a)} Let $n\in\mathbb{N}$. We must prove that $b_{n}$ is an integer.

Exercise \ref{exe.laurent.mse3586309c} \textbf{(b)} yields $b_{n}=x_{n+2}%
x_{n}$. However, for each $m\in\mathbb{N}$, the number $x_{m}$ is an integer
(by Exercise \ref{exe.laurent.mse3586309b} \textbf{(b)}, applied to $m$
instead of $n$). In other words, all entries of the sequence $\left(
x_{0},x_{1},x_{2},x_{3},\ldots\right)  $ are integers. Hence, in particular,
the two numbers $x_{n+2}$ and $x_{n}$ are integers (since these two numbers
are entries of the sequence $\left(  x_{0},x_{1},x_{2},x_{3},\ldots\right)
$). Thus, their product $x_{n+2}x_{n}$ is an integer as well. In other words,
$b_{n}$ is an integer (since $b_{n}=x_{n+2}x_{n}$). This solves Exercise
\ref{exe.laurent.mse3586309c} \textbf{(a)}. \medskip

\textbf{(c)} Let $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ be the sequence
defined in Exercise \ref{exe.laurent.mse3586309}. Let $n\geq1$ be an integer.

Exercise \ref{exe.laurent.mse3586309c} \textbf{(b)} yields $b_{n}=x_{n+2}%
x_{n}$. Also, we have $n-1\geq0$ (since $n\geq1$). Hence, Exercise
\ref{exe.laurent.mse3586309c} \textbf{(b)} (applied to $n-1$ instead of $n$)
yields $b_{n-1}=x_{\left(  n-1\right)  +2}x_{n-1}=x_{n+1}x_{n-1}$ (since
$\left(  n-1\right)  +2=n+1$). Thus,%
\[
\underbrace{b_{n}}_{=x_{n+2}x_{n}}\ \ \underbrace{b_{n-1}}_{=x_{n+1}x_{n-1}%
}=x_{n+2}x_{n}x_{n+1}x_{n-1}=x_{n+2}x_{n+1}x_{n}x_{n-1}.
\]
On the other hand, Exercise \ref{exe.laurent.mse3586309} \textbf{(b)} yields%
\[
a_{n}=x_{n+2}x_{n+1}x_{n}x_{n-1}.
\]
Comparing these two equalities, we obtain $a_{n}=b_{n}b_{n-1}$. This solves
Exercise \ref{exe.laurent.mse3586309c} \textbf{(c)}.
\end{proof}
\end{proof}

\subsection{Homework set \#5 discussion}

The following are discussions of the problems on homework set \#5 (Section
\ref{sect.hw5}).

\subsubsection{Discussion of Exercise \ref{exe.binom.fusscat-1}}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.fusscat-1}.]We shall show a more
general result (due to Hermite):

\begin{proposition}
\label{prop.binom.gcd-integrality-2}Let $n,m\in\mathbb{Z}$. Then:

\textbf{(a)} We have $n+1-m\mid\gcd\left(  n+1,m\right)  \cdot\dbinom{n}{m}$.

\textbf{(b)} If $m\neq n+1$, then $\dfrac{\gcd\left(  n+1,m\right)  }%
{n+1-m}\dbinom{n}{m}\in\mathbb{Z}$.
\end{proposition}

This proposition is a sort of counterpart to Exercise
\ref{exe.binom.gcd-integrality} \textbf{(b)}.

\begin{proof}
[Proof of Proposition \ref{prop.binom.gcd-integrality-2}.]\textbf{(a)}
Applying Lemma \ref{lem.binom.neighbors} \textbf{(c)} to $n+1$ and $m$ instead
of $n$ and $k$, we obtain%
\[
\left(  n+1\right)  \dbinom{\left(  n+1\right)  -1}{m}=\underbrace{\left(
\left(  n+1\right)  -m\right)  }_{=n+1-m}\dbinom{n+1}{m}=\left(  n+1-m\right)
\dbinom{n+1}{m}.
\]
In view of $\left(  n+1\right)  -1=n$, this rewrites as
\begin{equation}
\left(  n+1\right)  \dbinom{n}{m}=\left(  n+1-m\right)  \dbinom{n+1}{m}.
\label{pf.prop.binom.gcd-integrality-2.1}%
\end{equation}
But $\dbinom{n+1}{m}$ is an integer (since Theorem \ref{thm.binom.ZZ} yields
that $\dbinom{n+1}{m}\in\mathbb{Z}$). Hence, the equality
(\ref{pf.prop.binom.gcd-integrality-2.1}) reveals that%
\[
n+1-m\mid\left(  n+1\right)  \dbinom{n}{m}.
\]
Thus, Theorem \ref{thm.ent.gcd.cancel} (applied to $a=n+1-m$, $b=n+1$ and
$c=\dbinom{n}{m}$) yields%
\begin{equation}
n+1-m\mid\gcd\left(  n+1-m,n+1\right)  \cdot\dbinom{n}{m}.
\label{pf.prop.binom.gcd-integrality-2.2}%
\end{equation}


But Proposition \ref{prop.ent.gcd.props1} \textbf{(b)} (applied to $a=n+1-m$
and $b=n+1$) yields
\begin{align*}
\gcd\left(  n+1-m,n+1\right)   &  =\gcd\left(  n+1,\underbrace{n+1-m}%
_{=1\left(  n+1\right)  +\left(  -m\right)  }\right) \\
&  =\gcd\left(  n+1,1\left(  n+1\right)  +\left(  -m\right)  \right) \\
&  =\gcd\left(  n+1,-m\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.gcd.props1} \textbf{(c)},}\\
\text{applied to }a=n+1\text{, }b=-m\text{ and }u=1
\end{array}
\right) \\
&  =\gcd\left(  n+1,m\right)
\end{align*}
(by Proposition \ref{prop.ent.gcd.props1} \textbf{(h)}, applied to $a=n+1$ and
$b=m$). Therefore, (\ref{pf.prop.binom.gcd-integrality-2.2}) rewrites as
\[
n+1-m\mid\gcd\left(  n+1,m\right)  \cdot\dbinom{n}{m}.
\]
This proves Proposition \ref{prop.binom.gcd-integrality-2} \textbf{(a)}.

\textbf{(b)} Assume that $m\neq n+1$. Thus, $n+1-m\neq0$. Hence, the fraction
$\dfrac{\gcd\left(  n+1,m\right)  }{n+1-m}$ is well-defined.

But $n+1-m\neq0$. Hence, Proposition \ref{prop.ent.div.1} \textbf{(d)}
(applied to $a=n+1-m$ and $b=\gcd\left(  n+1,m\right)  \cdot\dbinom{n}{m}$)
yields that $n+1-m\mid\gcd\left(  n+1,m\right)  \cdot\dbinom{n}{m}$ if and
only if $\dfrac{\gcd\left(  n+1,m\right)  \cdot\dbinom{n}{m}}{n+1-m}%
\in\mathbb{Z}$. Therefore, $\dfrac{\gcd\left(  n+1,m\right)  \cdot\dbinom
{n}{m}}{n+1-m}\in\mathbb{Z}$ (since $n+1-m\mid\gcd\left(  n+1,m\right)
\cdot\dbinom{n}{m}$). Therefore,%
\[
\dfrac{\gcd\left(  n+1,m\right)  }{n+1-m}\dbinom{n}{m}=\dfrac{\gcd\left(
n+1,m\right)  \cdot\dbinom{n}{m}}{n+1-m}\in\mathbb{Z}.
\]
This proves Proposition \ref{prop.binom.gcd-integrality-2} \textbf{(b)}.
\end{proof}

Proposition \ref{prop.binom.gcd-integrality-2} \textbf{(a)} quickly yields
Exercise \ref{exe.binom.fusscat-1}:

\begin{proof}
[Solution to Exercise \ref{exe.binom.fusscat-1}.]Exercise
\ref{exe.ent.coprime.01} \textbf{(a)} (applied to $a=n$) yields $1\perp n$.
According to Proposition \ref{prop.ent.coprime.perp-symm}, this entails
$n\perp1$.

Proposition \ref{prop.binom.gcd-integrality-2} \textbf{(a)} (applied to
$\left(  a+1\right)  n$ and $n$ instead of $n$ and $m$) yields
\[
\left(  a+1\right)  n+1-n\mid\gcd\left(  \left(  a+1\right)  n+1,n\right)
\cdot\dbinom{\left(  a+1\right)  n}{n}.
\]
In view of%
\begin{align*}
\gcd\left(  \left(  a+1\right)  n+1,n\right)   &  =\gcd\left(  n,\left(
a+1\right)  n+1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.gcd.props1} \textbf{(b)},}\\
\text{applied to }\left(  a+1\right)  n+1\text{ and }n\text{ instead of
}a\text{ and }b
\end{array}
\right) \\
&  =\gcd\left(  n,1\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Proposition \ref{prop.ent.gcd.props1} \textbf{(c)},}\\
\text{applied to }n\text{, }1\text{ and }a+1\text{ instead of }a\text{,
}b\text{ and }u
\end{array}
\right) \\
&  =1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }n\perp1\right)
\end{align*}
and%
\[
\left(  a+1\right)  n+1-n=an+1,
\]
this rewrites as%
\[
an+1\mid1\cdot\dbinom{\left(  a+1\right)  n}{n}.
\]
In other words, $an+1\mid\dbinom{\left(  a+1\right)  n}{n}$. This solves
Exercise \ref{exe.binom.fusscat-1}.
\end{proof}

A more explicit solution of Exercise \ref{exe.binom.fusscat-1} is also
possible: Namely, a simple computation (using Lemma \ref{lem.binom.neighbors}
\textbf{(c)}) reveals that%
\[
\dfrac{1}{an+1}\dbinom{\left(  a+1\right)  n}{n}=\left(  a+1\right)
\dbinom{\left(  a+1\right)  n}{n}-a\dbinom{\left(  a+1\right)  n+1}{n}.
\]
But the right hand side of this equality is an integer. Thus, the left hand
side is an integer as well; in other words, $an+1\mid\dbinom{\left(
a+1\right)  n}{n}$.

Note that Exercise \ref{exe.binom.fusscat-1} shows that the number $\dfrac
{1}{an+1}\dbinom{\left(  a+1\right)  n}{n}$ is an integer for any
$a,n\in\mathbb{N}$. This number is known as a \textit{Fuss-Catalan number}
(see, e.g., \cite[Additional problem A14]{Stanley-Cat}).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.findiff.poly1}}

\begin{proof}
[Discussion of Exercise \ref{exe.findiff.poly1}.]Exercise
\ref{exe.findiff.poly1} is an introduction to the so-called \textit{finite
differences} of polynomials. Given a polynomial $P$, it is common to refer to
$\Delta P$ as the \textit{first difference} of $P$, and to $\Delta^{m}P$ as
the $m$\textit{-th difference} of $P$. These differences $\Delta P$ and
$\Delta^{m}P$ of a polynomial $P$ are discrete analogues of the derivatives
$f^{\prime}$ and $f^{\left(  m\right)  }$ of a function $f$. Exercise
\ref{exe.findiff.poly1} barely scratches the surface of the concept; more can
be found in \cite[\S 2.6 and \S 5.3, Trick 2]{GKP} and in \cite[Exercise
6]{19s-mt3s}\footnote{Beware of unusual notations: In \cite[Exercise
6]{19s-mt3s}, I write $P\left[  a\right]  $ (rather than $P\left(  a\right)
$) for the value of a polynomial $P$ at a number $a$ (this serves to avoid it
being confused for a product), and I write $P^{\Delta}$ for $\Delta P$.}.
Finite differences can be applied not just to polynomials, but also to any
functions, and in some more general form than in Exercise
\ref{exe.findiff.poly1} (for example, instead of $P\left(  x\right)  -P\left(
x-1\right)  $ we can consider $P\left(  x\right)  -P\left(  x-r\right)  $ for
any fixed number $r$); they are used a lot in numerical mathematics.

We shall give what is likely the shortest solution to Exercise
\ref{exe.findiff.poly1}. Various other arguments are possible.

\begin{proof}
[Solution to Exercise \ref{exe.findiff.poly1}.]\textbf{(a)} Write the
polynomial $P$ in the form $P=\sum_{i=0}^{m}c_{i}x^{i}$ for some constants
$c_{0},c_{1},\ldots,c_{m}$. Thus, $P\left(  x\right)  =P=\sum_{i=0}^{m}%
c_{i}x^{i}$. Substituting $x-1$ for $x$ in this equality, we obtain $P\left(
x-1\right)  =\sum_{i=0}^{m}c_{i}\left(  x-1\right)  ^{i}$. Now, the definition
of $\Delta P$ yields%
\begin{align}
\left(  \Delta P\right)  \left(  x\right)   &  =\underbrace{P\left(  x\right)
}_{=\sum_{i=0}^{m}c_{i}x^{i}}-\underbrace{P\left(  x-1\right)  }_{=\sum
_{i=0}^{m}c_{i}\left(  x-1\right)  ^{i}}\nonumber\\
&  =\sum_{i=0}^{m}c_{i}x^{i}-\sum_{i=0}^{m}c_{i}\left(  x-1\right)
^{i}\nonumber\\
&  =\sum_{i=0}^{m}c_{i}\left(  x^{i}-\left(  x-1\right)  ^{i}\right)  .
\label{sol.findiff.poly1.a.1}%
\end{align}


Now, let us rewrite the differences $x^{i}-\left(  x-1\right)  ^{i}$ on the
right hand side of this equality. Namely, for each $i\in\left\{
0,1,\ldots,m\right\}  $, we have%
\begin{align*}
\left(  x-1\right)  ^{i}  &  =\left(  x+\left(  -1\right)  \right)
^{i}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }x-1=x+\left(  -1\right)  \right)
\\
&  =\sum_{k=0}^{i}\dbinom{i}{k}x^{k}\left(  -1\right)  ^{i-k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.binom.binom}, applied to
}n=i\text{ and }y=-1\right) \\
&  =\sum_{k=0}^{i}\left(  -1\right)  ^{i-k}\dbinom{i}{k}x^{k}=\sum_{k=0}%
^{i-1}\left(  -1\right)  ^{i-k}\dbinom{i}{k}x^{k}+\underbrace{\left(
-1\right)  ^{k-k}}_{=\left(  -1\right)  ^{0}=1}\underbrace{\dbinom{k}{k}%
}_{\substack{=1\\\text{(by (\ref{eq.thm.binom.sym.nn}))}}}x^{i}\\
&  =\sum_{k=0}^{i-1}\left(  -1\right)  ^{i-k}\dbinom{i}{k}x^{k}+x^{i}%
\end{align*}
and therefore%
\begin{align}
x^{i}-\left(  x-1\right)  ^{i}  &  =-\sum_{k=0}^{i-1}\left(  -1\right)
^{i-k}\dbinom{i}{k}x^{k}=\sum_{k=0}^{i-1}\underbrace{\left(  -\left(
-1\right)  ^{i-k}\right)  }_{=\left(  -1\right)  ^{i-k+1}}\dbinom{i}{k}%
x^{k}\nonumber\\
&  =\sum_{k=0}^{i-1}\left(  -1\right)  ^{i-k+1}\dbinom{i}{k}x^{k}.
\label{sol.findiff.poly1.a.3}%
\end{align}
Hence, (\ref{sol.findiff.poly1.a.1}) becomes%
\begin{align}
\left(  \Delta P\right)  \left(  x\right)   &  =\sum_{i=0}^{m}c_{i}%
\underbrace{\left(  x^{i}-\left(  x-1\right)  ^{i}\right)  }_{\substack{=\sum
_{k=0}^{i-1}\left(  -1\right)  ^{i-k+1}\dbinom{i}{k}x^{k}\\\text{(by
(\ref{sol.findiff.poly1.a.3}))}}}\nonumber\\
&  =\sum_{i=0}^{m}c_{i}\sum_{k=0}^{i-1}\left(  -1\right)  ^{i-k+1}\dbinom
{i}{k}x^{k}. \label{sol.findiff.poly1.a.5}%
\end{align}


Now, we notice that the right hand side of (\ref{sol.findiff.poly1.a.5}) is a
sum of powers $x^{k}$ of $x$ (multiplied by constants)\footnote{Note that a
single power $x^{k}$ may appear multiple times in the sum.}. Moreover, all
powers $x^{k}$ that appear in this sum satisfy $k\leq m-1$%
\ \ \ \ \footnote{Indeed, if $x^{k}$ appears in this sum, then $k\in\left\{
0,1,\ldots,i-1\right\}  $ for some $i\in\left\{  0,1,\ldots,m\right\}  $; but
this implies
\begin{align*}
k  &  \leq\underbrace{i}_{\substack{\leq m\\\text{(since }i\in\left\{
0,1,\ldots,m\right\}  \text{)}}}-1\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}k\in\left\{  0,1,\ldots,i-1\right\}  \right) \\
&  \leq m-1.
\end{align*}
}. Thus, the right hand side of (\ref{sol.findiff.poly1.a.5}) is a sum of
powers $x^{k}$ (multiplied by constants) with $k\leq m-1$. In other words, the
right hand side of (\ref{sol.findiff.poly1.a.5}) is a polynomial in $x$ of
degree $\leq m-1$. Therefore, so is the left hand side of
(\ref{sol.findiff.poly1.a.5}). In other words, $\left(  \Delta P\right)
\left(  x\right)  $ is a polynomial in $x$ of degree $\leq m-1$. In other
words, the polynomial $\Delta P$ has degree $\leq m-1$. This solves Exercise
\ref{exe.findiff.poly1} \textbf{(a)}.

\textbf{(b)} This follows by induction on $n$, using the (already solved)
Exercise \ref{exe.findiff.poly1} \textbf{(a)} in the induction step. Here are
the details:

Forget that we fixed $m$ and $P$. The following claim follows from Exercise
\ref{exe.findiff.poly1} \textbf{(a)}:

\begin{statement}
\textit{Claim 1:} Let $m\in\mathbb{Z}$. Let $P$ be a polynomial in a single
variable $x$. Assume that $P$ has degree $\leq m$. Then, the polynomial
$\Delta P$ has degree $\leq m-1$.
\end{statement}

Now, we must prove the following claim:

\begin{statement}
\textit{Claim 2:} Let $m\in\mathbb{Z}$ and $n\in\mathbb{N}$. Let $P$ be a
polynomial in a single variable $x$. Assume that $P$ has degree $\leq m$.
Then, the polynomial $\Delta^{n}P$ has degree $\leq m-n$.
\end{statement}

[\textit{Proof of Claim 2:} We proceed by induction on $n$:

\textit{Induction base:} It is easy to see that Claim 2 holds for
$n=0$\ \ \ \ \footnote{\textit{Proof.} The polynomial $\Delta^{0}P$ is just
equal to $P$ (by its definition) and therefore has degree $\leq m$ (by
assumption). In other words, the polynomial $\Delta^{0}P$ has degree $\leq
m-0$ (since $m=m-0$). In other words, Claim 2 holds for $n=0$.}.

\textit{Induction step:} Let $k\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 2 holds for $n=k$. We must prove that Claim 2 holds for
$n=k+1$.

We have assumed that Claim 2 holds for $n=k$. In other words, the polynomial
$\Delta^{k}P$ has degree $\leq m-k$. The definition of $\Delta^{k+1}P$ yields
$\Delta^{k+1}P=\Delta\left(  \Delta^{k}P\right)  $. But Claim 1 (applied to
$m-k$ and $\Delta^{k}P$ instead of $m$ and $P$) shows that the polynomial
$\Delta\left(  \Delta^{k}P\right)  $ has degree $\leq m-k-1$ (since the
polynomial $\Delta^{k}P$ has degree $\leq m-k$). Since $\Delta^{k+1}%
P=\Delta\left(  \Delta^{k}P\right)  $ and $m-k-1=m-\left(  k+1\right)  $, we
can rewrite this as follows: The polynomial $\Delta^{k+1}P$ has degree $\leq
m-\left(  k+1\right)  $. In other words, Claim 2 holds for $n=k+1$. This
completes the induction step. Thus, Claim 2 is proven.]

Having proved Claim 2, we thus have solved Exercise \ref{exe.findiff.poly1}
\textbf{(b)}.

\textbf{(c)} This is similar to the standard inductive proof of the Binomial
Theorem (as done, e.g., in \cite[solution to Exercise 3.6]{detnotes}):

We shall prove Exercise \ref{exe.findiff.poly1} \textbf{(c)} by induction on
$n$:

\textit{Induction base:} We have $\Delta^{0}P=P$ (by the definition of
$\Delta^{0}P$) and thus%
\[
\left(  \Delta^{0}P\right)  \left(  x\right)  =P\left(  x\right)  =\sum
_{k=0}^{0}\left(  -1\right)  ^{k}\dbinom{0}{k}P\left(  x-k\right)
\]
(since $\sum_{k=0}^{0}\left(  -1\right)  ^{k}\dbinom{0}{k}P\left(  x-k\right)
=\underbrace{\left(  -1\right)  ^{0}}_{=1}\underbrace{\dbinom{0}{0}}%
_{=1}P\left(  \underbrace{x-0}_{=x}\right)  =P\left(  x\right)  $). In other
words, Exercise \ref{exe.findiff.poly1} \textbf{(c)} holds for $n=0$.

\textit{Induction step:} Let $i\in\mathbb{N}$. Assume (as the induction
hypothesis) that Exercise \ref{exe.findiff.poly1} \textbf{(c)} holds for
$n=i$. We must prove that Exercise \ref{exe.findiff.poly1} \textbf{(c)} holds
for $n=i+1$.

The definition of $\Delta^{i+1}P$ yields $\Delta^{i+1}P=\Delta\left(
\Delta^{\left(  i+1\right)  -1}P\right)  =\Delta\left(  \Delta^{i}P\right)  $
(since $\left(  i+1\right)  -1=i$). Thus,%
\begin{align}
\left(  \Delta^{i+1}P\right)  \left(  x\right)   &  =\left(  \Delta\left(
\Delta^{i}P\right)  \right)  \left(  x\right) \nonumber\\
&  =\left(  \Delta^{i}P\right)  \left(  x\right)  -\left(  \Delta^{i}P\right)
\left(  x-1\right)  \label{sol.findiff.poly1.c.1}%
\end{align}
(by the definition of $\Delta\left(  \Delta^{i}P\right)  $). We now want to
get explicit formulas for the two terms on the right hand side of this equality.

We have assumed that Exercise \ref{exe.findiff.poly1} \textbf{(c)} holds for
$n=i$. In other words, we have%
\begin{equation}
\left(  \Delta^{i}P\right)  \left(  x\right)  =\sum_{k=0}^{i}\left(
-1\right)  ^{k}\dbinom{i}{k}P\left(  x-k\right)  .
\label{sol.findiff.poly1.c.2}%
\end{equation}
Substituting $x-1$ for $x$ in this equality, we obtain%
\begin{align}
\left(  \Delta^{i}P\right)  \left(  x-1\right)   &  =\sum_{k=0}^{i}\left(
-1\right)  ^{k}\dbinom{i}{k}P\left(  x-1-k\right) \nonumber\\
&  =\sum_{k=1}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(
\underbrace{x-1-\left(  k-1\right)  }_{=x-k}\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k-1\text{ for
}k\text{ in the sum}\right) \nonumber\\
&  =\sum_{k=1}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(
x-k\right)  . \label{sol.findiff.poly1.c.3}%
\end{align}


We want to subtract the equality (\ref{sol.findiff.poly1.c.3}) from the
equality (\ref{sol.findiff.poly1.c.2}). In order for the result to be
simplifiable, it would be good to have the two summations have the same
limits. Fortunately, this is not hard to achieve: We just need to stretch the
summations to range from $0$ to $i+1$.

To wit, we have $i+1>i$ and thus $\dbinom{i}{i+1}=0$ (by Proposition
\ref{prop.binom.0}, applied to $i$ and $i+1$ instead of $n$ and $k$). Now,%
\begin{align*}
&  \sum_{k=0}^{i+1}\left(  -1\right)  ^{k}\dbinom{i}{k}P\left(  x-k\right) \\
&  =\left(  -1\right)  ^{i+1}\underbrace{\dbinom{i}{i+1}}_{=0}P\left(
x-\left(  i+1\right)  \right)  +\sum_{k=0}^{i}\left(  -1\right)  ^{k}%
\dbinom{i}{k}P\left(  x-k\right) \\
&  =\underbrace{\left(  -1\right)  ^{i+1}0P\left(  x-\left(  i+1\right)
\right)  }_{=0}+\sum_{k=0}^{i}\left(  -1\right)  ^{k}\dbinom{i}{k}P\left(
x-k\right) \\
&  =\sum_{k=0}^{i}\left(  -1\right)  ^{k}\dbinom{i}{k}P\left(  x-k\right)  .
\end{align*}
Comparing this with (\ref{sol.findiff.poly1.c.2}), we obtain%
\begin{equation}
\left(  \Delta^{i}P\right)  \left(  x\right)  =\sum_{k=0}^{i+1}\left(
-1\right)  ^{k}\dbinom{i}{k}P\left(  x-k\right)  .
\label{sol.findiff.poly1.c.2b}%
\end{equation}


Furthermore, we have $-1\notin\mathbb{N}$ and thus $\dbinom{i}{-1}=0$ (by
(\ref{eq.def.binom.def.b}), applied to $i$ and $-1$ instead of $n$ and $k$).
Now,%
\begin{align*}
&  \sum_{k=0}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(  x-k\right)
\\
&  =\left(  -1\right)  ^{0-1}\underbrace{\dbinom{i}{0-1}}_{=\dbinom{i}{-1}%
=0}P\left(  x-0\right)  +\sum_{k=1}^{i+1}\left(  -1\right)  ^{k-1}\dbinom
{i}{k-1}P\left(  x-k\right) \\
&  =\underbrace{\left(  -1\right)  ^{0-1}0P\left(  x-0\right)  }_{=0}%
+\sum_{k=1}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(  x-k\right)
\\
&  =\sum_{k=1}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(
x-k\right)  .
\end{align*}
Comparing this with (\ref{sol.findiff.poly1.c.3}), we obtain%
\begin{equation}
\left(  \Delta^{i}P\right)  \left(  x-1\right)  =\sum_{k=0}^{i+1}\left(
-1\right)  ^{k-1}\dbinom{i}{k-1}P\left(  x-k\right)  .
\label{sol.findiff.poly1.c.3b}%
\end{equation}


Now, (\ref{sol.findiff.poly1.c.1}) becomes%
\begin{align}
\left(  \Delta^{i+1}P\right)  \left(  x\right)   &  =\left(  \Delta
^{i}P\right)  \left(  x\right)  -\left(  \Delta^{i}P\right)  \left(
x-1\right) \nonumber\\
&  =\sum_{k=0}^{i+1}\left(  -1\right)  ^{k}\dbinom{i}{k}P\left(  x-k\right)
-\sum_{k=0}^{i+1}\left(  -1\right)  ^{k-1}\dbinom{i}{k-1}P\left(  x-k\right)
\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have subtracted the equality (\ref{sol.findiff.poly1.c.3b})}\\
\text{from the equality (\ref{sol.findiff.poly1.c.2b})}%
\end{array}
\right) \nonumber\\
&  =\sum_{k=0}^{i+1}\left(  \left(  -1\right)  ^{k}\dbinom{i}{k}P\left(
x-k\right)  -\underbrace{\left(  -1\right)  ^{k-1}}_{=-\left(  -1\right)
^{k}}\dbinom{i}{k-1}P\left(  x-k\right)  \right) \nonumber\\
&  =\sum_{k=0}^{i+1}\underbrace{\left(  \left(  -1\right)  ^{k}\dbinom{i}%
{k}P\left(  x-k\right)  -\left(  -\left(  -1\right)  ^{k}\right)  \dbinom
{i}{k-1}P\left(  x-k\right)  \right)  }_{=\left(  -1\right)  ^{k}\left(
\dbinom{i}{k}+\dbinom{i}{k-1}\right)  P\left(  x-k\right)  }\nonumber\\
&  =\sum_{k=0}^{i+1}\left(  -1\right)  ^{k}\left(  \dbinom{i}{k}+\dbinom
{i}{k-1}\right)  P\left(  x-k\right)  . \label{sol.findiff.poly1.c.6}%
\end{align}
But each $k\in\mathbb{Z}$ satisfies%
\begin{align}
\dbinom{i+1}{k}  &  =\dbinom{i+1-1}{k-1}+\dbinom{i+1-1}{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.binom.rec}, applied
to }n=i+1\right) \nonumber\\
&  =\dbinom{i}{k-1}+\dbinom{i}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}i+1-1=i\right) \nonumber\\
&  =\dbinom{i}{k}+\dbinom{i}{k-1}. \label{sol.findiff.poly1.c.7}%
\end{align}
Hence, (\ref{sol.findiff.poly1.c.6}) becomes%
\begin{align*}
\left(  \Delta^{i+1}P\right)  \left(  x\right)   &  =\sum_{k=0}^{i+1}\left(
-1\right)  ^{k}\underbrace{\left(  \dbinom{i}{k}+\dbinom{i}{k-1}\right)
}_{\substack{=\dbinom{i+1}{k}\\\text{(by (\ref{sol.findiff.poly1.c.7}))}%
}}P\left(  x-k\right) \\
&  =\sum_{k=0}^{i+1}\left(  -1\right)  ^{k}\dbinom{i+1}{k}P\left(  x-k\right)
.
\end{align*}
In other words, Exercise \ref{exe.findiff.poly1} \textbf{(c)} holds for
$n=i+1$. This completes the induction step. Hence, Exercise
\ref{exe.findiff.poly1} \textbf{(c)} is solved.

\textbf{(d)} Let $n\in\mathbb{N}$ satisfy $n>m$. Then, Exercise
\ref{exe.findiff.poly1} \textbf{(b)} shows that the polynomial $\Delta^{n}P$
has degree $\leq m-n$. But $m-n<0$ (since $n>m$); hence, the only polynomial
that has degree $\leq m-n$ is the zero polynomial $0$. Therefore, the
polynomial $\Delta^{n}P$ is the zero polynomial $0$ (since $\Delta^{n}P$ has
degree $\leq m-n$). In other words, $\Delta^{n}P=0$. Thus, $\left(  \Delta
^{n}P\right)  \left(  x\right)  =0$. But Exercise \ref{exe.findiff.poly1}
\textbf{(c)} yields $\left(  \Delta^{n}P\right)  \left(  x\right)  =\sum
_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(  x-k\right)  $. Hence,%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}P\left(  x-k\right)
=\left(  \Delta^{n}P\right)  \left(  x\right)  =0.
\]
This solves Exercise \ref{exe.findiff.poly1} \textbf{(d)}.

\textbf{(e)} Set $d_{i}=\left(  -1\right)  ^{i-1}\dbinom{m+1}{i}$ for each
$i\in\left\{  1,2,\ldots,m+1\right\}  $.

We have $m+1>m$. Hence, Exercise \ref{exe.findiff.poly1} \textbf{(d)} (applied
to $n=m+1$) yields%
\begin{equation}
\sum_{k=0}^{m+1}\left(  -1\right)  ^{k}\dbinom{m+1}{k}P\left(  x-k\right)  =0.
\label{sol.findiff.poly1.e.1}%
\end{equation}


Now, let $n\geq m+1$ be an integer. Then, substituting $n$ for $x$ in
(\ref{sol.findiff.poly1.e.1}), we obtain%
\[
\sum_{k=0}^{m+1}\left(  -1\right)  ^{k}\dbinom{m+1}{k}P\left(  n-k\right)
=0.
\]
Hence,%
\begin{align*}
0  &  =\sum_{k=0}^{m+1}\left(  -1\right)  ^{k}\dbinom{m+1}{k}P\left(
n-k\right) \\
&  =\underbrace{\left(  -1\right)  ^{0}}_{=1}\underbrace{\dbinom{m+1}{0}%
}_{\substack{=1\\\text{(by (\ref{eq.exa.binom.small.nC0}),}\\\text{applied to
}m+1\text{ instead of }n\text{)}}}P\left(  \underbrace{n-0}_{=n}\right)
+\sum_{k=1}^{m+1}\underbrace{\left(  -1\right)  ^{k}}_{=-\left(  -1\right)
^{k-1}}\dbinom{m+1}{k}P\left(  n-k\right) \\
&  =P\left(  n\right)  +\sum_{k=1}^{m+1}\left(  -\left(  -1\right)
^{k-1}\right)  \dbinom{m+1}{k}P\left(  n-k\right) \\
&  =P\left(  n\right)  -\sum_{k=1}^{m+1}\left(  -1\right)  ^{k-1}\dbinom
{m+1}{k}P\left(  n-k\right)  ,
\end{align*}
so that%
\begin{align*}
P\left(  n\right)   &  =\sum_{k=1}^{m+1}\underbrace{\left(  -1\right)
^{k-1}\dbinom{m+1}{k}}_{\substack{=d_{k}\\\text{(since }d_{k}=\left(
-1\right)  ^{k-1}\dbinom{m+1}{k}\\\text{(by the definition of }d_{k}\text{))}%
}}P\left(  n-k\right)  =\sum_{k=1}^{m+1}d_{k}P\left(  n-k\right) \\
&  =d_{1}P\left(  n-1\right)  +d_{2}P\left(  n-2\right)  +\cdots
+d_{m+1}P\left(  n-\left(  m+1\right)  \right)  .
\end{align*}


Now, forget that we fixed $n$. We thus have shown that%
\[
P\left(  n\right)  =d_{1}P\left(  n-1\right)  +d_{2}P\left(  n-2\right)
+\cdots+d_{m+1}P\left(  n-\left(  m+1\right)  \right)
\]
for each integer $n\geq m+1$. In other words, the sequence $\left(  P\left(
0\right)  ,P\left(  1\right)  ,P\left(  2\right)  ,\ldots\right)  $ is
$\left(  d_{1},d_{2},\ldots,d_{m+1}\right)  $-recurrent (by the definition of
\textquotedblleft$\left(  d_{1},d_{2},\ldots,d_{m+1}\right)  $%
-recurrent\textquotedblright). This solves Exercise \ref{exe.findiff.poly1}
\textbf{(e)}.
\end{proof}

Let us briefly state three more properties of finite differences. We will need
a notation: If $Q$ is a polynomial in a single variable, and if $i\in
\mathbb{Z}$, then $\left[  x^{i}\right]  \left(  Q\right)  $ shall denote the
coefficient of $x^{i}$ in $Q$. (For example, if $Q\left(  x\right)
=x^{4}+7x-3$, then $\left[  x^{5}\right]  \left(  Q\right)  =0$ and $\left[
x^{4}\right]  \left(  Q\right)  =1$ and $\left[  x^{3}\right]  \left(
Q\right)  =0$ and $\left[  x^{0}\right]  \left(  Q\right)  =-3$ and $\left[
x^{-1}\right]  \left(  Q\right)  =0$.) Now, here are a few more properties of
finite differences:

\begin{proposition}
\label{prop.findiff.poly2a}Let $m\in\mathbb{N}$. Let $P$ be a polynomial in a
single variable $x$. Assume that $P$ has degree $\leq m$. Then:

\textbf{(a)} We have $\left[  x^{m-1}\right]  \left(  \Delta P\right)
=m\cdot\left[  x^{m}\right]  \left(  P\right)  $.

\textbf{(b)} We have $\left[  x^{m-n}\right]  \left(  \Delta^{n}P\right)
=n!\dbinom{m}{n}\cdot\left[  x^{m}\right]  \left(  P\right)  $.

\textbf{(c)} We have%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{m}{k}P\left(  x-k\right)
=m!\cdot\left[  x^{m}\right]  \left(  P\right)  .
\]

\end{proposition}

Proposition \ref{prop.findiff.poly2a} \textbf{(a)} can be proved by retracing
the above solution to Exercise \ref{exe.findiff.poly1} \textbf{(a)} and
analyzing the appearances of $x^{m-1}$ on the right hand side of
(\ref{sol.findiff.poly1.a.5}) (namely, $x^{m-1}$ appears only once on this
right hand side, with coefficient $\underbrace{c_{m}}_{=\left[  x^{m}\right]
\left(  P\right)  }\underbrace{\left(  -1\right)  ^{m-\left(  m-1\right)  +1}%
}_{=1}\underbrace{\dbinom{m}{m-1}}_{=m}=\left[  x^{m}\right]  \left(
P\right)  \cdot m=m\cdot\left[  x^{m}\right]  \left(  P\right)  $).
Proposition \ref{prop.findiff.poly2a} \textbf{(b)} can be proved by induction
on $n$ using Proposition \ref{prop.findiff.poly2a} \textbf{(a)}, just as we
proved Exercise \ref{exe.findiff.poly1} \textbf{(b)} by induction using
Exercise \ref{exe.findiff.poly1} \textbf{(a)}. Finally, Proposition
\ref{prop.findiff.poly2a} \textbf{(c)} follows by applying both Proposition
\ref{prop.findiff.poly2a} \textbf{(b)} and Exercise \ref{exe.findiff.poly1}
\textbf{(c)} to $n=m$ (and recalling that a polynomial having degree $\leq0$
must be a constant polynomial).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.binom.sum-frac-akbk}}

\begin{proof}
[Discussion of Exercise \ref{exe.binom.sum-frac-akbk}.]Here is the answer:

\begin{proposition}
\label{prop.binom.sum-frac-akbk}Let $a,b,c\in\mathbb{N}$ be such that $c\leq
b$ and $a\leq b$. Then,%
\[
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}=\dfrac{\dbinom{a}{c}\left(
b+1-c\right)  }{\dbinom{b}{c}\left(  b+1-a\right)  }.
\]

\end{proposition}

In order to prove this, we will need the following identity: If $n,i,j\in
\mathbb{N}$ satisfy $j\leq n$, then%
\begin{equation}
\dbinom{n}{j}\dbinom{j}{i}=\dbinom{n}{i}\dbinom{n-i}{j-i}.
\label{sol.binom.sum-frac-akbk.trirev}%
\end{equation}
This fact is a particular case of the \textit{trinomial revision formula}
(\cite[Proposition 3.23]{detnotes}), but let us give a proof of it here,
seeing that we have already done most of the work:

[\textit{Proof of (\ref{sol.binom.sum-frac-akbk.trirev}):} In the case when
$i\leq j$, we have already proved (\ref{sol.binom.sum-frac-akbk.trirev}) in
the solution of Exercise \ref{exe.binom.noncoprime-ML770} above (indeed, the
equality (\ref{sol.binom.sum-frac-akbk.trirev}) becomes precisely the equality
(\ref{sol.binom.noncoprime-ML770.tri-rev}) in this case). Thus, for the rest
of this proof, we WLOG assume that we don't have $i\leq j$. Hence, $i>j$.
Therefore, Proposition \ref{prop.binom.0} (applied to $i$ and $j$ instead of
$k$ and $n$) yields $\dbinom{j}{i}=0$. Also, $j-i<0$ (since $i>j$) and thus
$j-i\notin\mathbb{N}$. Hence, (\ref{eq.def.binom.def.b}) (applied to $n-i$ and
$j-i$ instead of $n$ and $k$) yields $\dbinom{n-i}{j-i}=0$. Now, comparing
$\dbinom{n}{j}\underbrace{\dbinom{j}{i}}_{=0}=0$ with $\dbinom{n}%
{i}\underbrace{\dbinom{n-i}{j-i}}_{=0}=0$, we obtain $\dbinom{n}{j}\dbinom
{j}{i}=\dbinom{n}{i}\dbinom{n-i}{j-i}$. This proves
(\ref{sol.binom.sum-frac-akbk.trirev}).]

\begin{proof}
[Proof of Proposition \ref{prop.binom.sum-frac-akbk}.]First, we shall show
that certain denominators are nonzero. Indeed, we have $a\leq b<b+1$ and thus
$b+1-a>0$, so that $b+1-a\neq0$. Furthermore, each $k\in\left\{
c,c+1,\ldots,b\right\}  $ satisfies $\dbinom{b}{k}\neq0$%
\ \ \ \ \footnote{\textit{Proof.} Let $k\in\left\{  c,c+1,\ldots,b\right\}  $.
Then, $k\geq c$ and $k\leq b$. From $k\geq c\geq0$ (since $c\in\mathbb{N}$),
we obtain $k\in\mathbb{N}$. Hence, Theorem \ref{thm.binom.fac} (applied to
$n=b$) yields $\dbinom{b}{k}=\dfrac{b!}{k!\cdot\left(  b-k\right)  !}\neq0$
(since $b!\neq0$ (because $b!$ is a positive integer)).}. Applying this to
$k=c$, we obtain $\dbinom{b}{c}\neq0$ (since $c\in\left\{  c,c+1,\ldots
,b\right\}  $ (because $c\leq b$)). Hence, we have shown that all the three
denominators $b+1-a$, $\dbinom{b}{k}$ and $\dbinom{b}{c}$ appearing in
Proposition \ref{prop.binom.sum-frac-akbk} are nonzero. The fractions are
therefore well-defined.

Now, let $k\in\left\{  c,c+1,\ldots,b\right\}  $. Then, $c\leq k\leq b$ and
thus $k\geq c\geq0$ (since $c\in\mathbb{N}$), so that $k\in\mathbb{N}$. Hence,
(\ref{sol.binom.sum-frac-akbk.trirev}) (applied to $n=b$, $i=k$ and $j=a$)
yields that%
\begin{equation}
\dbinom{b}{a}\dbinom{a}{k}=\dbinom{b}{k}\dbinom{b-k}{a-k}
\label{sol.binom.sum-frac-akbk.baak}%
\end{equation}
(since $a\leq b$).

It is easy to see that both numbers $\dbinom{b}{a}$ and $\dbinom{b}{k}$ are
nonzero\footnote{\textit{Proof.} We have $a\in\mathbb{N}$ and $b\in\mathbb{N}$
and $a\leq b$. Hence, Theorem \ref{thm.binom.fac} (applied to $b$ and $a$
instead of $n$ and $k$) yields $\dbinom{b}{a}=\dfrac{b!}{a!\cdot\left(
b-a\right)  !}\neq0$ (since $b!\neq0$ (because $b!$ is a positive integer)).
Also, we have $k\in\mathbb{N}$ and $k\leq b$. Hence, Theorem
\ref{thm.binom.fac} (applied to $n=b$) yields $\dbinom{b}{k}=\dfrac
{b!}{k!\cdot\left(  b-k\right)  !}\neq0$ (since $b!\neq0$ (because $b!$ is a
positive integer)). Thus, we have now seen that both $\dbinom{b}{a}$ and
$\dbinom{b}{k}$ are nonzero.}. Hence, their product $\dbinom{b}{a}\dbinom
{b}{k}$ is nonzero. We can therefore divide the equality
(\ref{sol.binom.sum-frac-akbk.baak}) by this product $\dbinom{b}{a}\dbinom
{b}{k}$. As a result, we obtain%
\begin{equation}
\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}=\dfrac{\dbinom{b-k}{a-k}}{\dbinom{b}{a}%
}=\dfrac{1}{\dbinom{b}{a}}\dbinom{b-k}{a-k}.
\label{sol.binom.sum-frac-akbk.baakdiv}%
\end{equation}


Furthermore, $b-k\in\mathbb{N}$ (since $k\leq b$). Thus, Theorem
\ref{thm.binom.sym} (applied to $b-k$ and $a-k$ instead of $n$ and $k$) yields
$\dbinom{b-k}{a-k}=\dbinom{b-k}{\left(  b-k\right)  -\left(  a-k\right)
}=\dbinom{b-k}{b-a}$ (since $\left(  b-k\right)  -\left(  a-k\right)  =b-a$).
Hence, (\ref{sol.binom.sum-frac-akbk.baakdiv}) rewrites as
\begin{equation}
\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}=\dfrac{1}{\dbinom{b}{a}}\dbinom{b-k}%
{b-a}. \label{sol.binom.sum-frac-akbk.baakdiv2}%
\end{equation}


Forget that we fixed $k$. We thus have proved
(\ref{sol.binom.sum-frac-akbk.baakdiv2}) for each $k\in\left\{  c,c+1,\ldots
,b\right\}  $.

We have $c\in\left\{  c,c+1,\ldots,b\right\}  $ (since $c\leq b$). Hence,
applying (\ref{sol.binom.sum-frac-akbk.baakdiv2}) to $k=c$, we obtain%
\begin{equation}
\dfrac{\dbinom{a}{c}}{\dbinom{b}{c}}=\dfrac{1}{\dbinom{b}{a}}\dbinom{b-c}%
{b-a}. \label{sol.binom.sum-frac-akbk.baakdiv2c}%
\end{equation}


Now, summing the equality (\ref{sol.binom.sum-frac-akbk.baakdiv}) over all
$k\in\left\{  c,c+1,\ldots,b\right\}  $, we obtain
\begin{align}
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}  &  =\sum_{k=c}^{b}%
\dfrac{1}{\dbinom{b}{a}}\dbinom{b-k}{b-a}=\dfrac{1}{\dbinom{b}{a}}\sum
_{k=c}^{b}\dbinom{b-k}{b-a}\nonumber\\
&  =\dfrac{1}{\dbinom{b}{a}}\sum_{i=0}^{b-c}\dbinom{i}{b-a}%
\label{sol.binom.sum-frac-akbk.3}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }i\text{ for
}b-k\text{ in the sum}\right)  .\nonumber
\end{align}
But we have $b-c\in\mathbb{N}$ (since $c\leq b$) and $b-a\in\mathbb{N}$ (since
$a\leq b$). Thus, Exercise \ref{exe.binom.hock-neg-hock} \textbf{(a)} (applied
to $b-c$ and $b-a$ instead of $n$ and $k$) yields%
\begin{equation}
\sum_{i=0}^{b-c}\dbinom{i}{b-a}=\dbinom{b-c+1}{b-a+1}.
\label{sol.binom.sum-frac-akbk.hock}%
\end{equation}
Meanwhile, $b-\underbrace{c}_{\leq b}+1\geq b-b+1=1>0$, so that $b-c+1\in
\mathbb{N}$. Also, $b-\underbrace{a}_{\leq b}+1\geq b-b+1=1>0$ and thus
$b-a+1\in\mathbb{N}$. Hence, Exercise \ref{exe.binom.gcd-integrality}
\textbf{(a)} (applied to $b-c+1$ and $b-a+1$ instead of $n$ and $m$) yields%
\[
\dfrac{b-a+1}{b-c+1}\dbinom{b-c+1}{b-a+1}=\dbinom{b-c}{b-a}.
\]
Solving this equality for $\dbinom{b-c+1}{b-a+1}$, we obtain%
\begin{equation}
\dbinom{b-c+1}{b-a+1}=\dfrac{b-c+1}{b-a+1}\dbinom{b-c}{b-a}.
\label{sol.binom.sum-frac-akbk.qu1}%
\end{equation}
(Here, we have been able to divide by $b-a+1$ and by $b-c+1$, because both
numbers $b-c+1$ and $b-a+1$ are nonzero (since $b-c+1>0$ and $b-a+1>0$).)

Now, (\ref{sol.binom.sum-frac-akbk.hock}) becomes%
\[
\sum_{i=0}^{b-c}\dbinom{i}{b-a}=\dbinom{b-c+1}{b-a+1}=\dfrac{b-c+1}%
{b-a+1}\dbinom{b-c}{b-a}%
\]
(by (\ref{sol.binom.sum-frac-akbk.qu1})). Hence,
(\ref{sol.binom.sum-frac-akbk.3}) becomes%
\begin{align*}
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}  &  =\dfrac{1}{\dbinom
{b}{a}}\underbrace{\sum_{i=0}^{b-c}\dbinom{i}{b-a}}_{=\dfrac{b-c+1}%
{b-a+1}\dbinom{b-c}{b-a}}=\dfrac{1}{\dbinom{b}{a}}\cdot\dfrac{b-c+1}%
{b-a+1}\dbinom{b-c}{b-a}\\
&  =\underbrace{\dfrac{b-c+1}{b-a+1}}_{=\dfrac{b+1-c}{b+1-a}}\cdot
\underbrace{\dfrac{1}{\dbinom{b}{a}}\dbinom{b-c}{b-a}}_{\substack{=\dfrac
{\dbinom{a}{c}}{\dbinom{b}{c}}\\\text{(by
(\ref{sol.binom.sum-frac-akbk.baakdiv2c}))}}}=\dfrac{b+1-c}{b+1-a}\cdot
\dfrac{\dbinom{a}{c}}{\dbinom{b}{c}}=\dfrac{\dbinom{a}{c}\left(  b+1-c\right)
}{\dbinom{b}{c}\left(  b+1-a\right)  }.
\end{align*}
This proves Proposition \ref{prop.binom.sum-frac-akbk}.
\end{proof}

We note that the condition $a\leq b$ in Proposition
\ref{prop.binom.sum-frac-akbk} is surprisingly crucial. If $a>b$, then the
claim of Proposition \ref{prop.binom.sum-frac-akbk} may be false even when the
denominator is nonzero. Here are some examples of formulas for $\sum_{k=c}%
^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}$ when $a>b$:

\begin{itemize}
\item For $a=b+1$, we have%
\[
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}=\sum_{k=c}^{b}%
\dfrac{\dbinom{b+1}{k}}{\dbinom{b}{k}}=\sum_{k=c}^{b}\dfrac{b+1}{b-k+1}%
=\sum_{i=0}^{b-c}\dfrac{b+1}{i+1}=\left(  b+1\right)  \sum_{i=0}^{b-c}%
\dfrac{1}{i+1}.
\]
Thus, an explicit formula for $\sum_{k=c}^{b}\dfrac{\dbinom{b+1}{k}}%
{\dbinom{b}{k}}$ (without summation signs) would imply an explicit formula for
the so-called
\textit{\href{https://en.wikipedia.org/wiki/Harmonic_number}{\textit{harmonic
numbers}}} $H_{n}:=\sum_{i=0}^{n-1}\dfrac{1}{i+1}=\dfrac{1}{1}+\dfrac{1}%
{2}+\cdots+\dfrac{1}{n}$. Is there an explicit formula for the harmonic
numbers? The answer depends on how you define \textquotedblleft explicit
formula\textquotedblright. For some meanings of this word, it has been proved
that an explicit formula does not exist (see, e.g.,
\url{https://math.stackexchange.com/a/52579/} and the references therein). But
if you accept, e.g., floor functions, then you can show that%
\begin{align*}
H_{n}  &  =G_{n}-\left(  n+1\right)  \left\lfloor \dfrac{G_{n}}{n+1}%
\right\rfloor ,\ \ \ \ \ \ \ \ \ \ \text{where}\\
G_{n}  &  =\dfrac{\dbinom{n+\left(  n+1\right)  !}{n}-1}{\left(  n+1\right)
!}.
\end{align*}
This is not hard to prove; but is there any chance for $H_{n}$ to be easier to
compute using this formula than using the definition?

\item For $a=b+2$, we have%
\begin{align*}
\sum_{k=c}^{b}\dfrac{\dbinom{a}{k}}{\dbinom{b}{k}}  &  =\sum_{k=c}^{b}%
\dfrac{\dbinom{b+2}{k}}{\dbinom{b}{k}}=\sum_{k=c}^{b}\dfrac{\left(
b+1\right)  \left(  b+2\right)  }{\left(  b-k+1\right)  \left(  b-k+2\right)
}\\
&  =\sum_{i=0}^{b-c}\dfrac{\left(  b+1\right)  \left(  b+2\right)  }{\left(
i+1\right)  \left(  i+2\right)  }=\sum_{i=1}^{b-c+1}\dfrac{\left(  b+1\right)
\left(  b+2\right)  }{i\left(  i+1\right)  }\\
&  =\left(  b+1\right)  \left(  b+2\right)  \underbrace{\sum_{i=1}%
^{b-c+1}\dfrac{1}{i\left(  i+1\right)  }}_{\substack{=\dfrac{b-c+1}%
{b-c+2}\\\text{(by (\ref{sol.series.iip1.Sn=}))}}}=\left(  b+1\right)  \left(
b+2\right)  \cdot\dfrac{b-c+1}{b-c+2}.
\end{align*}

\end{itemize}

Let us also list formulas for some higher values of $a$, in the particular
case when $c=0$:%
\begin{align*}
\sum_{k=0}^{b}\dfrac{\dbinom{b+2}{k}}{\dbinom{b}{k}}  &  =\left(  b+1\right)
^{2};\\
\sum_{k=0}^{b}\dfrac{\dbinom{b+3}{k}}{\dbinom{b}{k}}  &  =\dfrac{1}{4}\left(
b+1\right)  ^{2}\left(  b+4\right)  ;\\
\sum_{k=0}^{b}\dfrac{\dbinom{b+4}{k}}{\dbinom{b}{k}}  &  =\dfrac{1}{18}\left(
b+1\right)  ^{2}\left(  b^{2}+8b+18\right)  ;\\
\sum_{k=0}^{b}\dfrac{\dbinom{b+5}{k}}{\dbinom{b}{k}}  &  =\dfrac{1}{96}\left(
b+1\right)  ^{2}\left(  b+6\right)  \left(  b^{2}+7b+16\right)  ;\\
\sum_{k=0}^{b}\dfrac{\dbinom{b+6}{k}}{\dbinom{b}{k}}  &  =\dfrac{1}%
{600}\left(  b+1\right)  ^{2}\left(  b^{4}+19b^{3}+136b^{2}+444b+600\right)  .
\end{align*}
Do you see any patterns? (I'm seeing some, but no general rule.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.vor57var1}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.vor57var1}.]Here is the answer: For each
$n\in\mathbb{N}$, we have%
\begin{equation}
a_{n}=%
\begin{cases}
q^{2^{n}-1}\left(  s+\dfrac{1}{q}\right)  ^{2^{n}}-\dfrac{1}{q}, & \text{if
}q\neq0;\\
2^{n}s, & \text{if }q=0.
\end{cases}
\label{sol.seqs.vor57var1.ans}%
\end{equation}


\textit{Proof of (\ref{sol.seqs.vor57var1.ans}):} We are in one of the
following two cases:

\textit{Case 1:} We have $q=0$.

\textit{Case 2:} We have $q\neq0$.

Let us first consider Case 1. In this case, we have $q=0$. We must show that
$a_{n}=2^{n}s$ for each $n\in\mathbb{N}$. The definition of our sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ shows that $a_{n}=a_{n-1}\left(
qa_{n-1}+2\right)  $ for each integer $n\geq1$. Thus, for each integer
$n\geq1$, we have
\[
a_{n}=a_{n-1}\left(  \underbrace{q}_{=0}a_{n-1}+2\right)  =a_{n-1}%
\underbrace{\left(  0a_{n-1}+2\right)  }_{=2}=a_{n-1}\cdot2=2a_{n-1}.
\]
In other words, the sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ is a
geometric progression with ratio $2$. Hence, for each $n\in\mathbb{N}$, we
have $a_{n}=2^{n}\underbrace{a_{0}}_{=s}=2^{n}s$. Thus,
(\ref{sol.seqs.vor57var1.ans}) is proved in Case 1.

Let us now consider Case 2. In this case, we have $q\neq0$. We must prove that%
\begin{equation}
a_{n}=q^{2^{n}-1}\left(  s+\dfrac{1}{q}\right)  ^{2^{n}}-\dfrac{1}{q}
\label{sol.seqs.vor57var1.ans2}%
\end{equation}
for each $n\in\mathbb{N}$.

Set%
\begin{equation}
b_{n}=a_{n}+\dfrac{1}{q} \label{sol.seqs.vor57var1.bn=}%
\end{equation}
for each $n\in\mathbb{N}$. Thus, $b_{0}=\underbrace{a_{0}}_{=s}+\dfrac{1}%
{q}=s+\dfrac{1}{q}$. The definition of our sequence $\left(  a_{0},a_{1}%
,a_{2},\ldots\right)  $ shows that $a_{n}=a_{n-1}\left(  qa_{n-1}+2\right)  $
for each integer $n\geq1$. Thus, for each integer $n\geq1$, we have
\begin{align}
b_{n}  &  =a_{n}+\dfrac{1}{q}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the
definition of }b_{n}\right) \nonumber\\
&  =a_{n-1}\left(  qa_{n-1}+2\right)  +\dfrac{1}{q}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }a_{n}=a_{n-1}\left(  qa_{n-1}+2\right)  \right) \nonumber\\
&  =\dfrac{1}{q}\underbrace{\left(  q^{2}a_{n-1}^{2}+2qa_{n-1}+1\right)
}_{=\left(  qa_{n-1}+1\right)  ^{2}}=\dfrac{1}{q}\left(  qa_{n-1}+1\right)
^{2}=q\cdot\left(  a_{n-1}+\dfrac{1}{q}\right)  ^{2}\nonumber\\
&  =q\cdot b_{n-1}^{2} \label{sol.seqs.vor57var1.4}%
\end{align}
(since the definition of $b_{n-1}$ yields $a_{n-1}+\dfrac{1}{q}=b_{n-1}$).

From this, we can easily see that%
\begin{equation}
b_{n}=q^{2^{n}-1}b_{0}^{2^{n}} \label{sol.seqs.vor57var1.5}%
\end{equation}
for each $n\in\mathbb{N}$.\ \ \ \ \footnote{\textit{Proof of
(\ref{sol.seqs.vor57var1.5}):} Let us prove (\ref{sol.seqs.vor57var1.5}) by
induction on $n$:
\par
\textit{Induction base:} We have $2^{0}=1$ and thus $q^{2^{0}-1}b_{0}^{2^{0}%
}=\underbrace{q^{1-1}}_{=q^{0}=1}b_{0}^{1}=b_{0}^{1}=b_{0}$. In other words,
$b_{0}=q^{2^{0}-1}b_{0}^{2^{0}}$. In other words, (\ref{sol.seqs.vor57var1.5})
holds for $n=0$.
\par
\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{sol.seqs.vor57var1.5}) holds for $n=m-1$. We
must prove that (\ref{sol.seqs.vor57var1.5}) holds for $n=m$.
\par
We have assumed that (\ref{sol.seqs.vor57var1.5}) holds for $n=m-1$. In other
words, $b_{m-1}=q^{2^{m-1}-1}b_{0}^{2^{m-1}}$. Now,
(\ref{sol.seqs.vor57var1.4}) (applied to $n=m$) yields%
\begin{align*}
b_{m}  &  =q\cdot b_{m-1}^{2}=q\cdot\left(  q^{2^{m-1}-1}b_{0}^{2^{m-1}%
}\right)  ^{2}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }b_{m-1}=q^{2^{m-1}%
-1}b_{0}^{2^{m-1}}\right) \\
&  =q\cdot\underbrace{\left(  q^{2^{m-1}-1}\right)  ^{2}}%
_{\substack{=q^{2\cdot\left(  2^{m-1}-1\right)  }=q^{2\cdot2^{m-1}-2}%
=q^{2^{m}-2}\\\text{(since }2\cdot2^{m-1}=2^{m}\text{)}}}\cdot
\underbrace{\left(  b_{0}^{2^{m-1}}\right)  ^{2}}_{\substack{=b_{0}%
^{2\cdot2^{m-1}}=b_{0}^{2^{m}}\\\text{(since }2\cdot2^{m-1}=2^{m}\text{)}}}\\
&  =\underbrace{q\cdot q^{2^{m}-2}}_{=q^{1+\left(  2^{m}-2\right)  }%
=q^{2^{m}-1}}\cdot b_{0}^{2^{m}}=q^{2^{m}-1}b_{0}^{2^{m}}.
\end{align*}
In other words, (\ref{sol.seqs.vor57var1.5}) holds for $n=m$. This completes
the induction step. Thus, (\ref{sol.seqs.vor57var1.5}) is proved.} Now, for
each $n\in\mathbb{N}$, we have
\begin{align*}
a_{n}  &  =\underbrace{b_{n}}_{\substack{=q^{2^{n}-1}b_{0}^{2^{n}}\\\text{(by
(\ref{sol.seqs.vor57var1.5}))}}}-\dfrac{1}{q}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{sol.seqs.vor57var1.bn=})}\right) \\
&  =q^{2^{n}-1}b_{0}^{2^{n}}-\dfrac{1}{q}=q^{2^{n}-1}\left(  s+\dfrac{1}%
{q}\right)  ^{2^{n}}-\dfrac{1}{q}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}b_{0}=s+\dfrac{1}{q}\right)  .
\end{align*}
This proves (\ref{sol.seqs.vor57var1.ans2}). In other words,
(\ref{sol.seqs.vor57var1.ans}) is proved in Case 1.

Hence, (\ref{sol.seqs.vor57var1.ans}) is proved in both Cases 1 and 2, thus
holds in full generality.

The formula (\ref{sol.seqs.vor57var1.ans}) can be rewritten in two further
ways:%
\begin{align*}
a_{n}  &  =%
\begin{cases}
\dfrac{\left(  sq+1\right)  ^{2^{n}}-1}{q}, & \text{if }q\neq0;\\
2^{n}s, & \text{if }q=0
\end{cases}
\\
&  =\sum_{k=1}^{2^{n}}\dbinom{2^{n}}{k}s^{k}q^{k-1}.
\end{align*}
(The last equality sign is easy to prove using the binomial theorem.)

[\textit{Remark:} The above solution is not unmotivated. The reason for
defining $b_{n}=a_{n}+\dfrac{1}{q}$ was to complete the square on the right
hand side of $a_{n}=a_{n-1}\left(  qa_{n-1}+2\right)  $; indeed,
$a_{n-1}\left(  qa_{n-1}+2\right)  +\dfrac{1}{q}=\dfrac{1}{q}\left(
qa_{n-1}+1\right)  ^{2}$ ensures that the right hand side becomes a square
after addition of $\dfrac{1}{q}$, and this reveals that the numbers
$b_{n}=a_{n}+\dfrac{1}{q}$ behave more predictably than the numbers $a_{n}$.]
\end{proof}

\begin{noncompile}
The real source for this exercise: Vornicu, Algebra 57: Define a sequence
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ of reals recursively by%
\begin{align*}
a_{0}  &  =3,\ \ \ \ \ \ \ \ \ \ \text{and}\\
a_{n}  &  =\dfrac{3a_{n-1}^{2}+1}{2}-a_{n-1}\ \ \ \ \ \ \ \ \ \ \text{for each
integer }n\geq1.
\end{align*}
Find an explicit formula for $a_{n}$.

(Idea: complete the square: $a_{n}-\dfrac{1}{3}=\dfrac{3}{2}\left(
a_{n-1}-\dfrac{1}{3}\right)  ^{2}$. )

Generalize: Setting $a=a_{n}$ and $b=a_{n-1}$, want $a-u=q\left(  b-u\right)
^{2}$. This is equivalent to $a=\left(  b-2u\right)  qb+\left(  qu+1\right)
u$.

The above exercise is the case when $qu+1=0$.
\end{noncompile}

\subsubsection{Discussion of Exercise \ref{exe.seqs.rec-ff}}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.rec-ff}.]The answer is:%
\begin{equation}
a_{n}=f_{2f_{n}}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq1,
\label{sol.seqs.rec-ff.ans}%
\end{equation}
where $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ is the Fibonacci sequence
(as defined in Definition \ref{def.fibonacci}).

In order to prove this, we need a lemma:

\begin{lemma}
\label{lem.fib.fn-mfnpm}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Let $n,m\in\mathbb{N}$ satisfy $n\geq m$. Then,%
\[
f_{n-m}f_{n+m}=f_{n}^{2}-\left(  -1\right)  ^{n+m}f_{m}^{2}.
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.fib.fn-mfnpm}.]The Fibonacci sequence $\left(
f_{0},f_{1},f_{2},\ldots\right)  $ is $\left(  1,1\right)  $-recurrent and
satisfies $f_{0}=0$. Thus, Exercise \ref{exe.rec.xn-mynpm} (applied to $a=1$
and $x_{i}=f_{i}$ and $y_{i}=f_{i}$) yields that%
\[
f_{n-m}f_{n+m}=\underbrace{f_{n}f_{n}}_{=f_{n}^{2}}-\left(  -1\right)
^{n+m}\underbrace{f_{m}f_{m}}_{=f_{m}^{2}}=f_{n}^{2}-\left(  -1\right)
^{n+m}f_{m}^{2}.
\]
This proves Lemma \ref{lem.fib.fn-mfnpm}.
\end{proof}

Let us now prove (\ref{sol.seqs.rec-ff.ans}):

[\textit{Proof of (\ref{sol.seqs.rec-ff.ans}):} We proceed by strong induction
on $n$:

\textit{Induction step:} Let $m\geq1$ be an integer. Assume (as the induction
hypothesis) that (\ref{sol.seqs.rec-ff.ans}) holds for $n<m$. We must prove
that (\ref{sol.seqs.rec-ff.ans}) holds for $n=m$. In other words, we must
prove that $a_{m}=f_{2f_{m}}$.

This is easily checked by hand if $m\in\left\{  1,2,3\right\}  $ (indeed,
$a_{1}=1=f_{2}=f_{2\cdot f_{1}}$ and $a_{2}=1=f_{2}=f_{2\cdot f_{2}}$ and
$a_{3}=3=f_{4}=f_{2\cdot f_{3}}$). Thus, for the rest of this proof, we WLOG
assume that $m\notin\left\{  1,2,3\right\}  $. Hence, $m\geq4$. Thus, the
recursive definition of our sequence $\left(  a_{1},a_{2},a_{3},\ldots\right)
$ yields%
\begin{equation}
a_{m}=\dfrac{a_{m-1}^{2}-a_{m-2}^{2}}{a_{m-3}}.
\label{sol.seqs.rec-ff.ans.pf.1}%
\end{equation}
But $m\geq4$ entails that $m-3\geq1$. Also, $m-3<m$. Hence, our induction
hypothesis shows that (\ref{sol.seqs.rec-ff.ans}) holds for $n=m-3$. In other
words, we have $a_{m-3}=f_{2f_{m-3}}$. Similarly, $a_{m-2}=f_{2f_{m-2}}$ and
$a_{m-1}=f_{2f_{m-1}}$. In view of these three equalities, we can rewrite
(\ref{sol.seqs.rec-ff.ans.pf.1}) as%
\begin{equation}
a_{m}=\dfrac{f_{2f_{m-1}}^{2}-f_{2f_{m-2}}^{2}}{f_{2f_{m-3}}}.
\label{sol.seqs.rec-ff.ans.pf.2}%
\end{equation}


However, the definition of the Fibonacci sequence yields that $f_{n}%
=f_{n-1}+f_{n-2}$ for each $n\geq2$. Thus, $f_{m}=f_{m-1}+f_{m-2}$ and
$f_{m-1}=f_{m-2}+f_{m-3}$. The latter equality entails $f_{m-3}=f_{m-1}%
-f_{m-2}$, so that $f_{m-1}-f_{m-2}=f_{m-3}\geq0$ (since all Fibonacci numbers
are nonnegative) and therefore $f_{m-1}\geq f_{m-2}$, so that $2f_{m-1}%
\geq2f_{m-2}$. Thus, we can apply Lemma \ref{lem.fib.fn-mfnpm} to $2f_{m-1}$
and $2f_{m-2}$ instead of $n$ and $m$. We thus obtain%
\[
f_{2f_{m-1}-2f_{m-2}}f_{2f_{m-1}+2f_{m-2}}=f_{2f_{m-1}}^{2}%
-\underbrace{\left(  -1\right)  ^{2f_{m-1}+2f_{m-2}}}%
_{\substack{=1\\\text{(since }2f_{m-1}+2f_{m-2}\\\text{is clearly even)}%
}}f_{2f_{m-2}}^{2}=f_{2f_{m-1}}^{2}-f_{2f_{m-2}}^{2}.
\]
Therefore,%
\[
f_{2f_{m-1}}^{2}-f_{2f_{m-2}}^{2}=f_{2f_{m-1}-2f_{m-2}}f_{2f_{m-1}+2f_{m-2}%
}=f_{2f_{m-3}}f_{2f_{m}}%
\]
(since $2f_{m-1}+2f_{m-2}=2\underbrace{\left(  f_{m-1}+f_{m-2}\right)
}_{=f_{m}}=2f_{m}$ and $2f_{m-1}-2f_{m-2}=2\underbrace{\left(  f_{m-1}%
-f_{m-2}\right)  }_{=f_{m-3}}=2f_{m-3}$). Solving this equation for
$f_{2f_{m}}$, we obtain $f_{2f_{m}}=\dfrac{f_{2f_{m-1}}^{2}-f_{2f_{m-2}}^{2}%
}{f_{2f_{m-3}}}$ (here, we are using the fact that $f_{2f_{m-3}}\neq0$, which
follows from $2\underbrace{f_{m-3}}_{\geq1}\geq2$). Comparing this with
(\ref{sol.seqs.rec-ff.ans.pf.2}), we obtain $a_{m}=f_{2f_{m}}$. This completes
the induction step. Thus, (\ref{sol.seqs.rec-ff.ans}) is proved.]

The problem is thus solved. We note that the sequence $\left(  a_{1}%
,a_{2},a_{3},\ldots\right)  $ is \href{https://oeis.org/A101361}{Sequence
A101361 in the OEIS}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ext.zeckendorf}}

\begin{proof}
[Discussion of Exercise \ref{exe.ext.zeckendorf}.]Exercise
\ref{exe.ext.zeckendorf} is the \textit{Zeckendorf theorem}; it appears, e.g.,
in \cite[Theorem 2.4]{Gri-zecke}. The proof given in \cite[\S 2]{Gri-zecke} is
rather similar to our proof of Theorem \ref{thm.ext.base-2.eu} above. (See
\cite[detailed version]{Gri-zecke} for a more detailed writeup of this proof.
A brief sketch also appears in \cite[\S 6.6]{GKP}, and a fairly similar proof
is found in \cite{Hender16}. A different -- combinatorial -- proof is found in
\url{https://planetmath.org/combinatorialproofofzeckendorfstheorem} . Yet
another proof is found in \cite{Chen08}.) See \cite{Hoggat72} and
\cite{Lengye06} for two (different!) generalizations.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ext.studs-strong}}

\begin{proof}
[Discussion of Exercise \ref{exe.ext.studs-strong}.]Let us sketch the solution.

The lecturer makes the first announcement at the moment the first student is
leaving. Any student who, at this moment, has not entered the classroom yet
will be called \textit{late}. The lecturer makes the second announcement when
the first \textbf{late} student leaves\footnote{or, in the case when there are
no late students, at the end of class}. We claim that these two announcements
are sufficient -- i.e., each student hears (at least) one of them.

Indeed, assume the contrary. Thus, there exists a student $s$ who hears
neither the first nor the second announcement. Consider this student $s$. Let
$f$ be the first student to leave the classroom, and let $\ell$ be the first
\textbf{late} student to leave the classroom (we assume that $\ell$ exists;
the other case is even easier\footnote{In fact, if $\ell$ does not exist, then
there are no late students at all, and therefore every student hears the first
announcement.}). Now, we shall prove that no two of the three students $s$,
$f$ and $\ell$ are ever together in the room.

Indeed, the student $\ell$ is late, and thus does not enter the classroom
until after $f$ has left (by the definition of \textquotedblleft
late\textquotedblright). Hence, $f$ and $\ell$ are never together in the room.
Moreover, the student $s$ cannot have left before $f$ (since $f$ was first to
leave), and thus cannot have entered before $f$ has left (since otherwise, $s$
would have witnessed the leaving of $f$, and thus would have heard the first
announcement, contradicting our definition of $s$). In other words, $s$ is
late. Hence, $s$ cannot have left before $\ell$ (since $\ell$ was the first
\textbf{late} student to leave), and thus cannot have entered before $\ell$
has left (since otherwise, $s$ would have witnessed the leaving of $\ell$, and
thus would have heard the second announcement, contradicting our definition of
$s$). Hence, $s$ has entered after $\ell$ has left. Therefore, $s$ and $\ell$
are never together in the room. Moreover, $s$ and $f$ are never together in
the room (since $s$ cannot have entered before $f$ has left, as we have seen above).

We have now shown that $f$ and $\ell$ are never together in the room; that $s$
and $\ell$ are never together in the room; and that $s$ and $f$ are never
together in the room. In other words, no two of the three students $s$, $f$
and $\ell$ are ever together in the room. This contradicts the assumption that
among any three (distinct) students, there are at least two that are together
in the room at some moment.\footnote{Here we have used the fact that the three
students $s$, $f$ and $\ell$ are indeed distinct (which is clear, since no two
of them are ever together in the room).} This contradiction shows that our
assumption was false. Hence, we have shown that each student hears (at least)
one of the two announcements. Thus, we have solved Exercise
\ref{exe.ext.studs-strong} (and, with it, solved Exercise \ref{exe.ext.studs} again).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ext.studs-fml-k}}

\begin{proof}
[Discussion of Exercise \ref{exe.ext.studs-fml-k}.]We shall first sketch the
solution, then formalize it in detail.

Let us first restate the exercise in terms of $n$ students and a
lecturer:\footnote{The assumption that \textquotedblleft for any $k$ distinct
elements $i_{1},i_{2},\ldots,i_{k}\in\left\{  1,2,\ldots,n\right\}  $, at
least two of the $k$ intervals $I_{i_{1}},I_{i_{2}},\ldots,I_{i_{k}}$
intersect\textquotedblright\ thus becomes \textquotedblleft among any $k$
distinct students, there are at least two that are together in the room at
some moment\textquotedblright.}

\begin{statement}
\textit{Restated exercise:} Let $n$ and $k$ be positive integers with $k\geq
2$. A lecture is attended by $n$ students. Each student enters the classroom
once and leaves it once (and does not come back). We know that among any $k$
distinct students, there are at least two that are together in the room at
some moment. The lecturer wants to make an announcement that every student
will hear. Prove that the lecturer can pick $k-1$ moments at which to make the
announcement so that each student will hear it. (We assume that the
announcement takes no time -- i.e., if a student leaves at the same moment
that another student enters, the lecturer can make the announcement at this
moment and both students will hear it.)
\end{statement}

We solve this restated exercise using the following method (which generalizes
our above solution to Exercise \ref{exe.ext.studs-strong}):

\begin{itemize}
\item The lecturer makes the first announcement when the first student leaves.
Any student who, at this moment, has not entered the classroom yet will be
called \textit{late}.

\item The lecturer makes the second announcement when the first \textbf{late}
student leaves\footnote{or, in the case when there are no late students, at
the end of class}. Any student who, at this moment, has not entered the
classroom yet will be called \textit{doubly late}.

\item The lecturer makes the second announcement when the first \textbf{doubly
late} student leaves\footnote{Again, if there are no doubly late students,
then this announcement will be made at the end of class (and likewise for all
future announcements).}. Any student who, at this moment, has not entered the
classroom yet will be called \textit{triply late}.

\item And so on.
\end{itemize}

\noindent The lecturer stops this process after $k-1$ announcements. We claim
that each student will have heard (at least) one of these $k-1$ announcements.
Indeed, if there was a student $s$ who hears none of them, then we could show
(similarly to how we did this in the above solution of Exercise
\ref{exe.ext.studs-strong}) that there would be $k$ students no two of whom
had ever been in the classroom at the same time (namely, the student $s$, the
first student to leave, the first late student to leave, the first doubly late
student to leave, etc.). To be fully precise, this argument would have to be
tweaked for the case when (e.g.) there are no doubly late students at all; but
this is fairly easy.

A conceptually simpler (but essentially equivalent) way to solve Exercise
\ref{exe.ext.studs-fml-k} is by induction on $k$. The idea (again stated in
terms of students) is to make the first announcement when the first student
leaves, and then forget about all students who have heard this announcement.
The remaining students have the property that among any $k-1$ of them, there
are at least two that are together in the room at some moment (because the
first student that has left has not overlapped with any of them); thus, by the
induction hypothesis, $k-2$ announcements will suffice for them. Altogether,
the lecturer will thus make $1+\left(  k-2\right)  =k-1$ announcements and be
heard by each student.

Here is a rigorous way to state this proof:\footnote{Unfortunately, this is a
good example of a proof that heavily increases in length and decreases in
readability when it is formalized. Arguably, it could be that it is just
\textbf{me} formalizing it badly (suggestions for improvement are greatly
encouraged!); but it is a sad empirical fact that this happens to most writers
with most proofs in combinatorics.}

\begin{proof}
[Solution to Exercise \ref{exe.ext.studs-fml-k} (formal version).]Forget that
we fixed $n$, $k$ and $I_{1},I_{2},\ldots,I_{n}$. We must solve Exercise
\ref{exe.ext.studs-fml-k}. We shall proceed by induction on $k$.

\textit{Induction base:} Let us show that Exercise \ref{exe.ext.studs-fml-k}
holds for $k=2$. In other words, let us verify the following claim:

\begin{statement}
\textit{Claim 1:} Let $n$ be a positive integer. Let $I_{1},I_{2},\ldots
,I_{n}$ be $n$ nonempty finite closed intervals on the real axis. Assume that
for any $2$ distinct elements $i_{1},i_{2}\in\left\{  1,2,\ldots,n\right\}  $,
at least two of the $2$ intervals $I_{i_{1}},I_{i_{2}}$ intersect. Then, there
exist $2-1$ reals $a_{1},a_{2},\ldots,a_{2-1}$ such that each of the intervals
$I_{1},I_{2},\ldots,I_{n}$ contains at least one of $a_{1},a_{2}%
,\ldots,a_{2-1}$.
\end{statement}

[\textit{Proof of Claim 1:} Write each interval $I_{m}$ as $\left[
p_{m},q_{m}\right]  $ for two reals $p_{m}$ and $q_{m}$. Thus, each
$m\in\left\{  1,2,\ldots,n\right\}  $ satisfies
\begin{equation}
I_{m}=\left[  p_{m},q_{m}\right]  \label{sol.ext.studs-fml-k.IB.ipq}%
\end{equation}
and therefore $\left[  p_{m},q_{m}\right]  =I_{m}\neq\varnothing$ (since
$I_{m}$ is nonempty), so that
\begin{equation}
p_{m}\leq q_{m}\text{.} \label{sol.ext.studs-fml-k.IB.pleq}%
\end{equation}


Let
\begin{equation}
b=\min\left\{  q_{1},q_{2},\ldots,q_{n}\right\}  .
\label{sol.ext.studs-fml-k.IB.b=}%
\end{equation}
We shall show that each of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains
$b$.

Indeed, let $j\in\left\{  1,2,\ldots,n\right\}  $. We shall show that $b\in
I_{j}$.

We have
\[
b=\min\left\{  q_{1},q_{2},\ldots,q_{n}\right\}  \in\left\{  q_{1}%
,q_{2},\ldots,q_{n}\right\}
\]
(since the minimum of a set always lies in this set). In other words, there
exists some $k\in\left\{  1,2,\ldots,n\right\}  $ such that $b=q_{k}$.
Consider this $k$.

Applying (\ref{sol.ext.studs-fml-k.IB.ipq}) to $m=k$, we obtain $I_{k}=\left[
p_{k},q_{k}\right]  $. But applying (\ref{sol.ext.studs-fml-k.IB.pleq}) to
$m=k$, we obtain $p_{k}\leq q_{k}$. Hence, $q_{k}\in\left[  p_{k}%
,q_{k}\right]  =I_{k}$, so that $b=q_{k}\in I_{k}$.

Now, our goal is to show that $b\in I_{j}$. If $j=k$, then this follows
directly from $b\in I_{k}$. Thus, for the rest of this proof, we WLOG assume
that $j\neq k$. Thus, $j$ and $k$ are two distinct elements of $\left\{
1,2,\ldots,n\right\}  $.

Recall our assumption that for any $2$ distinct elements $i_{1},i_{2}%
\in\left\{  1,2,\ldots,n\right\}  $, at least two of the $2$ intervals
$I_{i_{1}},I_{i_{2}}$ intersect. Applying this to $i_{1}=j$ and $i_{2}=k$, we
conclude that at least two of the $2$ intervals $I_{j},I_{k}$ intersect (since
$j,k$ are $2$ distinct elements of $\left\{  1,2,\ldots,n\right\}  $). In
other words, the two intervals $I_{j}$ and $I_{k}$ intersect (since the only
way to pick two of the $2$ intervals $I_{j},I_{k}$ is to pick $I_{j}$ and
$I_{k}$). In other words, $I_{j}\cap I_{k}\neq\varnothing$.

Recall that $I_{k}=\left[  p_{k},q_{k}\right]  $. Also,
(\ref{sol.ext.studs-fml-k.IB.ipq}) (applied to $m=j$) yields $I_{j}=\left[
p_{j},q_{j}\right]  $. Recall that $I_{j}\cap I_{k}\neq\varnothing$. In other
words, there exists some $c\in I_{j}\cap I_{k}$. Consider this $c$. From $c\in
I_{j}\cap I_{k}\subseteq I_{j}=\left[  p_{j},q_{j}\right]  $, we obtain $c\geq
p_{j}$. From $c\in I_{j}\cap I_{k}\subseteq I_{k}=\left[  p_{k},q_{k}\right]
$, we obtain $c\leq q_{k}$. Hence, $q_{k}\geq c\geq p_{j}$. Recalling that
$b=q_{k}$, we thus obtain $b=q_{k}\geq p_{j}$.

We have $b=\min\left\{  q_{1},q_{2},\ldots,q_{n}\right\}  $. In other words,
$b$ is the \textbf{smallest} of the $n$ numbers $q_{1},q_{2},\ldots,q_{n}$.
Hence, $b\leq q_{i}$ for each $i\in\left\{  1,2,\ldots,n\right\}  $. Applying
this to $i=j$, we find $b\leq q_{j}$. Combining this with $b\geq p_{j}$, we
obtain $b\in\left[  p_{j},q_{j}\right]  =I_{j}$.

Forget that we fixed $j$. We thus have shown that $b\in I_{j}$ for each
$j\in\left\{  1,2,\ldots,n\right\}  $. In other words, each of the intervals
$I_{1},I_{2},\ldots,I_{n}$ contains $b$. Thus, there exists a real $a_{1}$
such that each of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at least
one of $a_{1}$ (namely, $a_{1}=b$). In other words, there exist $2-1$ reals
$a_{1},a_{2},\ldots,a_{2-1}$ such that each of the intervals $I_{1}%
,I_{2},\ldots,I_{n}$ contains at least one of $a_{1},a_{2},\ldots,a_{2-1}$
(because $2-1$ reals $a_{1},a_{2},\ldots,a_{2-1}$ are the same as a single
real $a_{1}$). This proves Claim 1.]

Claim 1 is precisely the claim of Exercise \ref{exe.ext.studs-fml-k} for
$k=2$; thus, Exercise \ref{exe.ext.studs-fml-k} holds for $k=2$ (since we have
proved Claim 1). This completes the induction base.

\textit{Induction step:} Fix an integer $\ell\geq2$. Assume (as the induction
hypothesis) that Exercise \ref{exe.ext.studs-fml-k} holds for $k=\ell$. We
must prove that Exercise \ref{exe.ext.studs-fml-k} holds for $k=\ell+1$.

We have assumed that Exercise \ref{exe.ext.studs-fml-k} holds for $k=\ell$. In
other words, the following claim holds:

\begin{statement}
\textit{Claim 2:} Let $n$ be a positive integer. Let $I_{1},I_{2},\ldots
,I_{n}$ be $n$ nonempty finite closed intervals on the real axis. Assume that
for any $\ell$ distinct elements $i_{1},i_{2},\ldots,i_{\ell}\in\left\{
1,2,\ldots,n\right\}  $, at least two of the $\ell$ intervals $I_{i_{1}%
},I_{i_{2}},\ldots,I_{i_{\ell}}$ intersect. Then, there exist $\ell-1$ reals
$a_{1},a_{2},\ldots,a_{\ell-1}$ such that each of the intervals $I_{1}%
,I_{2},\ldots,I_{n}$ contains at least one of $a_{1},a_{2},\ldots,a_{\ell-1}$.
\end{statement}

We must prove that Exercise \ref{exe.ext.studs-fml-k} holds for $k=\ell+1$. In
other words, we must prove the following claim:

\begin{statement}
\textit{Claim 3:} Let $n$ be a positive integer. Let $I_{1},I_{2},\ldots
,I_{n}$ be $n$ nonempty finite closed intervals on the real axis. Assume that
for any $\ell+1$ distinct elements $i_{1},i_{2},\ldots,i_{\ell+1}\in\left\{
1,2,\ldots,n\right\}  $, at least two of the $\ell+1$ intervals $I_{i_{1}%
},I_{i_{2}},\ldots,I_{i_{\ell+1}}$ intersect. Then, there exist $\ell$ reals
$a_{1},a_{2},\ldots,a_{\ell}$ such that each of the intervals $I_{1}%
,I_{2},\ldots,I_{n}$ contains at least one of $a_{1},a_{2},\ldots,a_{\ell}$.
\end{statement}

[\textit{Proof of Claim 3:} Write each interval $I_{m}$ as $\left[
p_{m},q_{m}\right]  $ for two reals $p_{m}$ and $q_{m}$. Thus, each
$m\in\left\{  1,2,\ldots,n\right\}  $ satisfies
\begin{equation}
I_{m}=\left[  p_{m},q_{m}\right]  \label{sol.ext.studs-fml-k.IS.ipq}%
\end{equation}
and therefore $\left[  p_{m},q_{m}\right]  =I_{m}\neq\varnothing$ (since
$I_{m}$ is nonempty), so that
\begin{equation}
p_{m}\leq q_{m}\text{.} \label{sol.ext.studs-fml-k.IS.pleq}%
\end{equation}


Let
\begin{equation}
b=\min\left\{  q_{1},q_{2},\ldots,q_{n}\right\}  .
\label{sol.ext.studs-fml-k.IS.b=}%
\end{equation}
Thus, $b$ is the \textbf{smallest} among the $n$ numbers $q_{1},q_{2}%
,\ldots,q_{n}$. Hence,%
\begin{equation}
b\leq q_{j}\ \ \ \ \ \ \ \ \ \ \text{for each }j\in\left\{  1,2,\ldots
,n\right\}  . \label{sol.ext.studs-fml-k.IS.bleq}%
\end{equation}


We note that our situation is symmetric in the $n$ intervals $I_{1}%
,I_{2},\ldots,I_{n}$; that is, we can permute these $n$ intervals arbitrarily
(as long as we accordingly permute the $n$ numbers $p_{1},p_{2},\ldots,p_{n}$
and the $n$ numbers $q_{1},q_{2},\ldots,q_{n}$) without changing our
assumptions or the claim we are trying to prove. Hence, we can WLOG assume
that we have
\begin{equation}
p_{1}\geq p_{2}\geq\cdots\geq p_{n} \label{sol.ext.studs-fml-k.IS.ieqs}%
\end{equation}
(since we can always achieve this by appropriately permuting $I_{1}%
,I_{2},\ldots,I_{n}$). Assume this.

We have $b=\min\left\{  q_{1},q_{2},\ldots,q_{n}\right\}  \in\left\{
q_{1},q_{2},\ldots,q_{n}\right\}  $ (since the minimum of a set always belongs
to this set). In other words, there exists some $k\in\left\{  1,2,\ldots
,n\right\}  $ such that $b=q_{k}$. Consider this $k$. Applying
(\ref{sol.ext.studs-fml-k.IS.pleq}) to $m=k$, we obtain $p_{k}\leq q_{k}=b$
(since $b=q_{k}$). Thus, there exists some $i\in\left\{  1,2,\ldots,n\right\}
$ such that $p_{i}\leq b$ (namely, $i=k$). Let $s$ be the \textbf{smallest}
such $i$. Thus, we have $p_{s}\leq b$, but none of the numbers $p_{1}%
,p_{2},\ldots,p_{s-1}$ is $\leq b$.

It is now easy to see that each of the intervals $I_{s},I_{s+1},\ldots,I_{n}$
contains $b$\ \ \ \ \footnote{\textit{Proof.} Let $j\in\left\{  s,s+1,\ldots
,n\right\}  $. We shall show that $b\in I_{j}$.
\par
Indeed, (\ref{sol.ext.studs-fml-k.IS.ipq}) (applied to $m=j$) yields
$I_{j}=\left[  p_{j},q_{j}\right]  $. Now, $j\in\left\{  s,s+1,\ldots
,n\right\}  $, so that $s\leq j\leq n$. But (\ref{sol.ext.studs-fml-k.IS.ieqs}%
) shows that $p_{\alpha}\geq p_{\beta}$ for any two elements $\alpha$ and
$\beta$ of $\left\{  1,2,\ldots,n\right\}  $ satisfying $\alpha\leq\beta$.
Applying this to $\alpha=s$ and $\beta=j$, we find $p_{s}\geq p_{j}$ (since
$s\leq j$), so that $p_{j}\leq p_{s}\leq b$. Hence, $b\geq p_{j}$. But
(\ref{sol.ext.studs-fml-k.IS.bleq}) yields $b\leq q_{j}$. Combining this with
$b\geq p_{j}$, we find $b\in\left[  p_{j},q_{j}\right]  =I_{j}$.
\par
Forget that we fixed $j$. We thus have shown that $b\in I_{j}$ for each
$j\in\left\{  s,s+1,\ldots,n\right\}  $. In other words, each of the intervals
$I_{s},I_{s+1},\ldots,I_{n}$ contains $b$.}. If $s=1$, then Claim 3 now easily
follows\footnote{\textit{Proof.} Assume that $s=1$. We have just shown that
each of the intervals $I_{s},I_{s+1},\ldots,I_{n}$ contains $b$. In view of
$s=1$, we can rewrite this as follows: Each of the intervals $I_{1}%
,I_{2},\ldots,I_{n}$ contains $b$. In other words, each of the intervals
$I_{1},I_{2},\ldots,I_{n}$ contains at least one of the $\ell$ reals
$\underbrace{b,b,\ldots,b}_{\ell\text{ times}}$ (since $\ell\geq2\geq1$).
Hence, there exist $\ell$ reals $a_{1},a_{2},\ldots,a_{\ell}$ such that each
of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at least one of
$a_{1},a_{2},\ldots,a_{\ell}$ (namely, $a_{i}=b$ for each $i\in\left\{
1,2,\ldots,\ell\right\}  $). This proves Claim 3. Thus, Claim 3 is proved
under the assumption that $s=1$.}. Hence, for the rest of the proof, we WLOG
assume that $s\neq1$. Hence, $s>1$ (since $s\in\left\{  1,2,\ldots,n\right\}
$). Thus, $s-1>0$, so that $s-1$ is a positive integer. Also, $s\in\left\{
1,2,\ldots,n\right\}  $, so that $s\leq n$ and thus $s-1\leq s\leq n$. Hence,
$\left\{  1,2,\ldots,s-1\right\}  \subseteq\left\{  1,2,\ldots,n\right\}  $.

If $u\in\left\{  1,2,\ldots,s-1\right\}  $, then%
\begin{equation}
\text{the intervals }I_{u}\text{ and }I_{k}\text{ do not intersect.}
\label{sol.ext.studs-fml-k.IS.uk-not}%
\end{equation}


[\textit{Proof of (\ref{sol.ext.studs-fml-k.IS.uk-not}):} Let $u\in\left\{
1,2,\ldots,s-1\right\}  $. We must show that the intervals $I_{u}$ and $I_{k}$
do not intersect.

Assume the contrary. Thus, the intervals $I_{u}$ and $I_{k}$ intersect. In
other words, $I_{u}\cap I_{k}\neq\varnothing$. Hence, there exists some $c\in
I_{u}\cap I_{k}$. Consider this $c$. We have $c\in I_{u}\cap I_{k}\subseteq
I_{u}=\left[  p_{u},q_{u}\right]  $ (by (\ref{sol.ext.studs-fml-k.IS.ipq}),
applied to $m=u$). Thus, $c\geq p_{u}$, so that $p_{u}\leq c$. We have $c\in
I_{u}\cap I_{k}\subseteq I_{k}=\left[  p_{k},q_{k}\right]  $ (by
(\ref{sol.ext.studs-fml-k.IS.ipq}), applied to $m=k$). Thus, $c\leq q_{k}=b$
(since $b=q_{k}$). Hence, $p_{u}\leq c\leq b$. However, $p_{u}$ is one of the
numbers $p_{1},p_{2},\ldots,p_{s-1}$ (since $u\in\left\{  1,2,\ldots
,s-1\right\}  $). Hence, $p_{u}$ is not $\leq b$ (since we have shown that
none of the numbers $p_{1},p_{2},\ldots,p_{s-1}$ is $\leq b$). This
contradicts $p_{u}\leq b$. This contradiction shows that our assumption was
false. Hence, (\ref{sol.ext.studs-fml-k.IS.uk-not}) is proven.]

We recall our assumption that%
\begin{equation}
\left(
\begin{array}
[c]{c}%
\text{for any }\ell+1\text{ distinct elements }i_{1},i_{2},\ldots,i_{\ell
+1}\in\left\{  1,2,\ldots,n\right\}  \text{,}\\
\text{at least two of the }\ell+1\text{ intervals }I_{i_{1}},I_{i_{2}}%
,\ldots,I_{i_{\ell+1}}\text{ intersect}%
\end{array}
\right)  . \label{sol.ext.studs-fml-k.IS.isa}%
\end{equation}
We shall now prove that%
\begin{equation}
\left(
\begin{array}
[c]{c}%
\text{for any }\ell\text{ distinct elements }i_{1},i_{2},\ldots,i_{\ell}%
\in\left\{  1,2,\ldots,s-1\right\}  \text{,}\\
\text{at least two of the }\ell\text{ intervals }I_{i_{1}},I_{i_{2}}%
,\ldots,I_{i_{\ell}}\text{ intersect}%
\end{array}
\right)  . \label{sol.ext.studs-fml-k.IS.isb}%
\end{equation}


[\textit{Proof of (\ref{sol.ext.studs-fml-k.IS.isb}):} Let $i_{1},i_{2}%
,\ldots,i_{\ell}\in\left\{  1,2,\ldots,s-1\right\}  $ be $\ell$ distinct
elements. We must prove that at least two of the $\ell$ intervals $I_{i_{1}%
},I_{i_{2}},\ldots,I_{i_{\ell}}$ intersect.

Assume the contrary. Thus, no two of the $\ell$ intervals $I_{i_{1}},I_{i_{2}%
},\ldots,I_{i_{\ell}}$ intersect. Moreover, if $g\in\left\{  1,2,\ldots
,\ell\right\}  $, then $i_{g}\in\left\{  1,2,\ldots,s-1\right\}  $ (since
$i_{1},i_{2},\ldots,i_{\ell}\in\left\{  1,2,\ldots,s-1\right\}  $), and
therefore the intervals $I_{i_{g}}$ and $I_{k}$ do not intersect (by
(\ref{sol.ext.studs-fml-k.IS.uk-not}), applied to $u=i_{g}$). In other words,
none of the intervals $I_{i_{1}},I_{i_{2}},\ldots,I_{i_{\ell}}$ intersects
$I_{k}$.

We note that $i_{1},i_{2},\ldots,i_{\ell}$ are $\ell$ distinct elements of
$\left\{  1,2,\ldots,s-1\right\}  $ and therefore are $\ell$ distinct elements
of $\left\{  1,2,\ldots,n\right\}  $ (since $\left\{  1,2,\ldots,s-1\right\}
\subseteq\left\{  1,2,\ldots,n\right\}  $). We extend the $\ell$-tuple
$\left(  i_{1},i_{2},\ldots,i_{\ell}\right)  $ to an $\left(  \ell+1\right)
$-tuple $\left(  i_{1},i_{2},\ldots,i_{\ell+1}\right)  $ by setting
$i_{\ell+1}=k$. Thus, $i_{1},i_{2},\ldots,i_{\ell+1}$ are $\ell+1$ elements of
$\left\{  1,2,\ldots,n\right\}  $ (because $i_{1},i_{2},\ldots,i_{\ell}$ are
$\ell$ elements of $\left\{  1,2,\ldots,n\right\}  $, and because $i_{\ell
+1}=k\in\left\{  1,2,\ldots,n\right\}  $). Furthermore, these $\ell+1$
elements $i_{1},i_{2},\ldots,i_{\ell+1}$ are distinct\footnote{\textit{Proof.}
Assume the contrary. Thus, two of the $\ell+1$ elements $i_{1},i_{2}%
,\ldots,i_{\ell+1}$ are equal. In other words, there exist two numbers
$\alpha,\beta\in\left\{  1,2,\ldots,\ell+1\right\}  $ with $\alpha<\beta$ and
$i_{\alpha}=i_{\beta}$. Consider these $\alpha$ and $\beta$.
\par
We have $\alpha<\beta\leq\ell+1$ (since $\beta\in\left\{  1,2,\ldots
,\ell+1\right\}  $), so that $\alpha\leq\left(  \ell+1\right)  -1$ (since
$\alpha$ and $\ell+1$ are integers). Thus, $\alpha\leq\left(  \ell+1\right)
-1=\ell$, so that $\alpha\in\left\{  1,2,\ldots,\ell\right\}  $ (since
$\alpha\in\left\{  1,2,\ldots,\ell+1\right\}  \subseteq\left\{  1,2,3,\ldots
\right\}  $). Therefore, $i_{\alpha}$ is one of the $\ell$ elements
$i_{1},i_{2},\ldots,i_{\ell}$. Hence, $i_{\alpha}\in\left\{  1,2,\ldots
,s-1\right\}  $ (since $i_{1},i_{2},\ldots,i_{\ell}$ are elements of $\left\{
1,2,\ldots,s-1\right\}  $). Hence, (\ref{sol.ext.studs-fml-k.IS.uk-not})
(applied to $u=i_{\alpha}$) yields that the intervals $I_{i_{\alpha}}$ and
$I_{k}$ do not intersect. In other words, $I_{i_{\alpha}}\cap I_{k}%
=\varnothing$.
\par
If we had $\beta=\ell+1$, then we would have
\begin{align*}
i_{\alpha}  &  =i_{\beta}=i_{\ell+1}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}\beta=\ell+1\right) \\
&  =k,
\end{align*}
which would entail $I_{i_{\alpha}}\cap I_{k}=I_{k}\cap I_{k}=I_{k}%
\neq\varnothing$ (since the interval $I_{k}$ is nonempty), which would
contradict $I_{i_{\alpha}}\cap I_{k}=\varnothing$. Thus, we cannot have
$\beta=\ell+1$. Hence, $\beta\neq\ell+1$. From $\beta\in\left\{
1,2,\ldots,\ell+1\right\}  $ and $\beta\neq\ell+1$, we obtain $\beta
\in\left\{  1,2,\ldots,\ell+1\right\}  \setminus\left\{  \ell+1\right\}
=\left\{  1,2,\ldots,\ell\right\}  $.
\par
Thus, we know that $\alpha$ and $\beta$ are two distinct elements of $\left\{
1,2,\ldots,\ell\right\}  $ (since $\alpha\in\left\{  1,2,\ldots,\ell\right\}
$ and $\beta\in\left\{  1,2,\ldots,\ell\right\}  $ and $\alpha<\beta$). Hence,
$i_{\alpha}\neq i_{\beta}$ (since the $\ell$ elements $i_{1},i_{2}%
,\ldots,i_{\ell}$ are distinct). This contradicts $i_{\alpha}=i_{\beta}$. This
contradiction shows that our assumption was wrong, qed.}. Hence,
(\ref{sol.ext.studs-fml-k.IS.isa}) yields that at least two of the $\ell+1$
intervals $I_{i_{1}},I_{i_{2}},\ldots,I_{i_{\ell+1}}$ intersect. In other
words, there exist two numbers $\alpha,\beta\in\left\{  1,2,\ldots
,\ell+1\right\}  $ with $\alpha<\beta$ and with the property that the
intervals $I_{i_{\alpha}}$ and $I_{i_{\beta}}$ intersect. Consider these
$\alpha$ and $\beta$.

We have $\alpha<\beta\leq\ell+1$ (since $\beta\in\left\{  1,2,\ldots
,\ell+1\right\}  $), so that $\alpha\leq\left(  \ell+1\right)  -1$ (since
$\alpha$ and $\ell+1$ are integers). Thus, $\alpha\leq\left(  \ell+1\right)
-1=\ell$, so that $\alpha\in\left\{  1,2,\ldots,\ell\right\}  $ (since
$\alpha\in\left\{  1,2,\ldots,\ell+1\right\}  \subseteq\left\{  1,2,3,\ldots
\right\}  $). Therefore, $i_{\alpha}$ is one of the $\ell$ elements
$i_{1},i_{2},\ldots,i_{\ell}$. Hence, $i_{\alpha}\in\left\{  1,2,\ldots
,s-1\right\}  $ (since $i_{1},i_{2},\ldots,i_{\ell}$ are elements of $\left\{
1,2,\ldots,s-1\right\}  $). Hence, (\ref{sol.ext.studs-fml-k.IS.uk-not})
(applied to $u=i_{\alpha}$) yields that the intervals $I_{i_{\alpha}}$ and
$I_{k}$ do not intersect.

However, the intervals $I_{i_{\alpha}}$ and $I_{i_{\beta}}$ intersect. If we
had $i_{\beta}=k$, then this would entail that the intervals $I_{i_{\alpha}}$
and $I_{k}$ intersect; but this would contradict the fact that the intervals
$I_{i_{\alpha}}$ and $I_{k}$ do not intersect. Hence, we cannot have
$i_{\beta}=k$. Thus, we have $i_{\beta}\neq k$.

If we had $\beta=\ell+1$, then we would have $i_{\beta}=i_{\ell+1}=k$, which
would contradict $i_{\beta}\neq k$. Thus, we cannot have $\beta=\ell+1$.
Hence, $\beta\neq\ell+1$. From $\beta\in\left\{  1,2,\ldots,\ell+1\right\}  $
and $\beta\neq\ell+1$, we obtain $\beta\in\left\{  1,2,\ldots,\ell+1\right\}
\setminus\left\{  \ell+1\right\}  =\left\{  1,2,\ldots,\ell\right\}  $.

Thus, we know that $\alpha$ and $\beta$ are two distinct elements of $\left\{
1,2,\ldots,\ell\right\}  $ (since $\alpha\in\left\{  1,2,\ldots,\ell\right\}
$ and $\beta\in\left\{  1,2,\ldots,\ell\right\}  $ and $\alpha<\beta$). Hence,
the intervals $I_{i_{\alpha}}$ and $I_{i_{\beta}}$ do not intersect (since no
two of the $\ell$ intervals $I_{i_{1}},I_{i_{2}},\ldots,I_{i_{\ell}}$
intersect). This contradicts the fact that the intervals $I_{i_{\alpha}}$ and
$I_{i_{\beta}}$ intersect. This contradiction shows that our assumption was
wrong. Hence, we have shown that at least two of the $\ell$ intervals
$I_{i_{1}},I_{i_{2}},\ldots,I_{i_{\ell}}$ intersect. This proves
(\ref{sol.ext.studs-fml-k.IS.isb}).]

Now, (\ref{sol.ext.studs-fml-k.IS.isb}) shows that for any $\ell$ distinct
elements $i_{1},i_{2},\ldots,i_{\ell}\in\left\{  1,2,\ldots,s-1\right\}  $, at
least two of the $\ell$ intervals $I_{i_{1}},I_{i_{2}},\ldots,I_{i_{\ell}}$
intersect. Hence, we can apply Claim 2 to $s-1$ instead of $n$ (since $s-1$ is
a positive integer, and since $I_{1},I_{2},\ldots,I_{s-1}$ are $s-1$ nonempty
finite closed intervals on the real axis). As a result, we conclude that there
exist $\ell-1$ reals $a_{1},a_{2},\ldots,a_{\ell-1}$ such that each of the
intervals $I_{1},I_{2},\ldots,I_{s-1}$ contains at least one of $a_{1}%
,a_{2},\ldots,a_{\ell-1}$. Consider these $\ell-1$ reals $a_{1},a_{2}%
,\ldots,a_{\ell-1}$. Extend the $\left(  \ell-1\right)  $-tuple $\left(
a_{1},a_{2},\ldots,a_{\ell-1}\right)  $ to an $\ell$-tuple $\left(
a_{1},a_{2},\ldots,a_{\ell}\right)  $ by setting $a_{\ell}=b$.

Now, it is easy to see that for each $h\in\left\{  1,2,\ldots,n\right\}  $,
\begin{equation}
\text{the interval }I_{h}\text{ contains at least one of }a_{1},a_{2}%
,\ldots,a_{\ell}. \label{sol.ext.studs-fml-k.IS.Iicts}%
\end{equation}


[\textit{Proof of (\ref{sol.ext.studs-fml-k.IS.Iicts}):} Let $h\in\left\{
1,2,\ldots,n\right\}  $. We must prove that the interval $I_{h}$ contains at
least one of $a_{1},a_{2},\ldots,a_{\ell}$. We are in one of the following two cases:

\textit{Case 1:} We have $h<s$.

\textit{Case 2:} We have $h\geq s$.

Let us first consider Case 1. In this case, we have $h<s$. Thus, $h\leq s-1$
(since $h$ and $s$ are integers), so that $h\in\left\{  1,2,\ldots
,s-1\right\}  $ (since $h\in\left\{  1,2,\ldots,n\right\}  \subseteq\left\{
1,2,3,\ldots\right\}  $). Thus, $I_{h}$ is one of the intervals $I_{1}%
,I_{2},\ldots,I_{s-1}$.

Recall that each of the intervals $I_{1},I_{2},\ldots,I_{s-1}$ contains at
least one of $a_{1},a_{2},\ldots,a_{\ell-1}$. Hence, $I_{h}$ contains at least
one of $a_{1},a_{2},\ldots,a_{\ell-1}$ (since $I_{h}$ is one of the intervals
$I_{1},I_{2},\ldots,I_{s-1}$). Therefore, $I_{h}$ contains at least one of
$a_{1},a_{2},\ldots,a_{\ell}$. Thus, (\ref{sol.ext.studs-fml-k.IS.Iicts}) is
proved in Case 1.

Let us now consider Case 2. In this case, we have $h\geq s$. Thus,
$h\in\left\{  s,s+1,\ldots,n\right\}  $ (since $h\in\left\{  1,2,\ldots
,n\right\}  $ entails $h\leq n$). Therefore, $I_{h}$ is one of the intervals
$I_{s},I_{s+1},\ldots,I_{n}$.

Recall that each of the intervals $I_{s},I_{s+1},\ldots,I_{n}$ contains $b$.
Hence, $I_{h}$ contains $b$ (since $I_{h}$ is one of the intervals
$I_{s},I_{s+1},\ldots,I_{n}$). In other words, $I_{h}$ contains $a_{\ell}$
(since $a_{\ell}=b$). Hence, $I_{h}$ contains at least one of $a_{1}%
,a_{2},\ldots,a_{\ell}$. Thus, (\ref{sol.ext.studs-fml-k.IS.Iicts}) is proved
in Case 2.

We have now proved (\ref{sol.ext.studs-fml-k.IS.Iicts}) in each of the two
Cases 1 and 2. Thus, (\ref{sol.ext.studs-fml-k.IS.Iicts}) always holds.]

So we have shown that for each $h\in\left\{  1,2,\ldots,n\right\}  $, the
interval $I_{h}$ contains at least one of $a_{1},a_{2},\ldots,a_{\ell}$. In
other words, each of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at
least one of $a_{1},a_{2},\ldots,a_{\ell}$.

Now, we have found $\ell$ reals $a_{1},a_{2},\ldots,a_{\ell}$ with the
property that each of the intervals $I_{1},I_{2},\ldots,I_{n}$ contains at
least one of $a_{1},a_{2},\ldots,a_{\ell}$. Hence, such $\ell$ reals exist.
This proves Claim 3.]

Now, Claim 3 is proved; in other words, we have proved that Exercise
\ref{exe.ext.studs-fml-k} holds for $k=\ell+1$. This completes the induction
step. Thus, Exercise \ref{exe.ext.studs-fml-k} is solved.
\end{proof}

We note that, if Exercise \ref{exe.ext.studs-fml-k} is restated in terms of
students and lecturers, then the $\ell$ numbers $a_{1},a_{2},\ldots,a_{\ell}$
constructed in the above solution (i.e., the $\ell$ moments at which the
lecturer needs to make their announcement) will be known to the lecturer as
soon as they arrive, at least if the number $n$ is known to the lecturer. (If
the number $n$ is not known, a little tweak has to be made.)

We note furthermore that Exercise \ref{exe.ext.studs-fml-k} has a
generalization, in which the words \textquotedblleft at least
two\textquotedblright\ are replaced by \textquotedblleft at least
$q$\textquotedblright\ for some fixed integer $q\geq2$. See \cite[Exercise
437]{Gunder10} for this generalization. (Note that it is not hard to recover
this generalization from Exercise \ref{exe.ext.studs-fml-k}.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ext.periodic-nonneg}}

\begin{proof}
[Discussion of Exercise \ref{exe.ext.periodic-nonneg}.]Exercise
\ref{exe.ext.periodic-nonneg} can easily be reduced to Exercise
\ref{exe.ext.cars-circular}:

\begin{proof}
[First solution to Exercise \ref{exe.ext.periodic-nonneg} (sketched).]Let $C$
be a positive real number large enough that all of the $n$ numbers
$C+x_{0},C+x_{1},\ldots,C+x_{n-1}$ are positive.

Consider a circular track with $n$ gas stations on it. The $n$ gas stations
are labelled $0,1,\ldots,n-1$ (in the order in which a car would encounter
them when driving around the track). Assume that the gas stations are placed
at equal distances (i.e., the distance between any two consecutive gas
stations is the same), and driving from any gas station to the next consumes
$C$ gallons of gas. Thus, a car needs $nC$ gallons of gas in total to complete
the entire track.

Assume that gas station $i$ has $C+x_{i}$ gallons of gas available. Then, the
$n$ gas stations have just enough gas for a car to complete the entire track
(indeed, the total amount of gas in the stations is%
\begin{align*}
&  \left(  C+x_{0}\right)  +\left(  C+x_{1}\right)  +\cdots+\left(
C+x_{n-1}\right) \\
&  =nC+\underbrace{\left(  x_{0}+x_{1}+\cdots+x_{n-1}\right)  }_{=0}=nC+0=nC,
\end{align*}
which is exactly what the car needs to complete the track).

Now, Exercise \ref{exe.ext.cars-circular} yields that at least one of these
$n$ gas stations has the property that if the car starts at this gas station
with an initially empty gas tank, then it can traverse the entire track
without ever running out of gas\footnote{provided that it refuels at every gas
station it comes across (including the one at which it starts)}. Let $k$ be
this gas station. Then, for each $m\in\left\{  k+1,k+2,\ldots,k+n\right\}  $,
we have%
\[
\left(  C+x_{k}\right)  +\left(  C+x_{k+1}\right)  +\cdots+\left(
C+x_{m-1}\right)  \geq\left(  m-k\right)  C,
\]
since the car has made it from gas station $k$ to gas station $m$ (collecting
$\left(  C+x_{k}\right)  +\left(  C+x_{k+1}\right)  +\cdots+\left(
C+x_{m-1}\right)  $ gallons of gas along the way, and using up $\left(
m-k\right)  C$ gallons) without running out of gas. This inequality rewrites
as%
\[
\left(  m-k\right)  C+\left(  x_{k}+x_{k+1}+\cdots+x_{m-1}\right)  \geq\left(
m-k\right)  C.
\]
Subtracting $\left(  m-k\right)  C$ from both sides of this inequality, we
obtain%
\[
x_{k}+x_{k+1}+\cdots+x_{m-1}\geq0.
\]
Thus, we have shown that the inequality $x_{k}+x_{k+1}+\cdots+x_{m-1}\geq0$
holds for each $m\in\left\{  k+1,k+2,\ldots,k+n\right\}  $. Renaming $m$ as
$m+1$, we thus conclude that the inequality $x_{k}+x_{k+1}+\cdots+x_{m}\geq0$
holds for each $m\in\left\{  k,k+1,\ldots,k+n-1\right\}  $.

However, recall that the sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $
is $n$-periodic and satisfies $x_{0}+x_{1}+\cdots+x_{n-1}=0$. Thus, it is
easily seen that the sum of \textbf{any} $n$ consecutive entries of the
sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $0$. Thus,
\begin{equation}
x_{m+1}+x_{m+2}+\cdots+x_{m+n}=0 \label{sol.ext.periodic-nonneg.1st.4}%
\end{equation}
for each $m\in\mathbb{N}$. From this, we can easily conclude that the sequence%
\[
\left(  x_{k},x_{k}+x_{k+1},x_{k}+x_{k+1}+x_{k+2},x_{k}+x_{k+1}+x_{k+2}%
+x_{k+3},\ldots\right)
\]
(that is, the sequence of all sums of the form $x_{k}+x_{k+1}+\cdots+x_{m}$
with $m\geq k$) is $n$-periodic as well (because any $m\geq k$ satisfies%
\begin{align*}
x_{k}+x_{k+1}+\cdots+x_{m+n}  &  =\left(  x_{k}+x_{k+1}+\cdots+x_{m}\right)
+\underbrace{\left(  x_{m+1}+x_{m+2}+\cdots+x_{m+n}\right)  }%
_{\substack{=0\\\text{(by (\ref{sol.ext.periodic-nonneg.1st.4}))}}}\\
&  =x_{k}+x_{k+1}+\cdots+x_{m}%
\end{align*}
). But the first $n$ entries of this sequence are nonnegative (since
$x_{k}+x_{k+1}+\cdots+x_{m}\geq0$ holds for each $m\in\left\{  k,k+1,\ldots
,k+n-1\right\}  $). Hence, all its entries are nonnegative (because it is
$n$-periodic). In other words, the inequality $x_{k}+x_{k+1}+\cdots+x_{m}%
\geq0$ holds for each $m\geq k$. This solves Exercise
\ref{exe.ext.periodic-nonneg}.
\end{proof}

The following second solution may appear very different from the first, but in
truth is closely related: It simply formalizes and applies the idea of our
solution to Exercise \ref{exe.ext.cars-circular} straight to our sequence
$\left(  x_{0},x_{1},x_{2},\ldots\right)  $, without the detour of restating
it in terms of cars and gas stations. The resulting argument is more rigorous
and perhaps also more readable, although less vivid and intuitive.

\begin{proof}
[Second solution to Exercise \ref{exe.ext.periodic-nonneg}.]For each
$m\in\mathbb{N}$, we define a real number%
\begin{equation}
s_{m}=x_{0}+x_{1}+\cdots+x_{m-1}. \label{sol.ext.periodic-nonneg.sm=}%
\end{equation}


The sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is $n$-periodic. In
other words, $n$ is a period of this sequence $\left(  x_{0},x_{1}%
,x_{2},\ldots\right)  $ (by the definition of \textquotedblleft$n$%
-periodic\textquotedblright). In other words, every $i\in\mathbb{N}$ satisfies%
\begin{equation}
x_{i}=x_{i+n} \label{sol.ext.periodic-nonneg.xi-per}%
\end{equation}
(by the definition of a \textquotedblleft period\textquotedblright).

Next, we claim that every $i\in\mathbb{N}$ satisfies%
\begin{equation}
s_{i}=s_{i+n}. \label{sol.ext.periodic-nonneg.si-per}%
\end{equation}


[\textit{Proof of (\ref{sol.ext.periodic-nonneg.si-per}):} We shall prove
(\ref{sol.ext.periodic-nonneg.si-per}) by induction on $i$:

\textit{Induction base:} The definition of $s_{0}$ yields $s_{0}=x_{0}%
+x_{1}+\cdots+x_{0-1}=\left(  \text{empty sum}\right)  =0$. The definition of
$s_{n}$ yields $s_{n}=x_{0}+x_{1}+\cdots+x_{n-1}=0$. Comparing these two
equalities, we obtain $s_{0}=s_{n}=s_{0+n}$ (since $n=0+n$). In other words,
(\ref{sol.ext.periodic-nonneg.si-per}) holds for $i=0$.

\textit{Induction step:} Let $j\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.ext.periodic-nonneg.si-per}) holds for $i=j$. We
must prove that (\ref{sol.ext.periodic-nonneg.si-per}) holds for $i=j+1$. In
other words, we must prove that $s_{j+1}=s_{\left(  j+1\right)  +n}$.

We have assumed that (\ref{sol.ext.periodic-nonneg.si-per}) holds for $i=j$.
In other words, we have $s_{j}=s_{j+n}$.

The definition of $s_{j}$ yields $s_{j}=x_{0}+x_{1}+\cdots+x_{j-1}$. The
definition of $s_{j+1}$ yields%
\begin{align}
s_{j+1}  &  =x_{0}+x_{1}+\cdots+x_{\left(  j+1\right)  -1}\nonumber\\
&  =x_{0}+x_{1}+\cdots+x_{j}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
j+1\right)  -1=j\right) \nonumber\\
&  =\underbrace{\left(  x_{0}+x_{1}+\cdots+x_{j-1}\right)  }_{=s_{j}=s_{j+n}%
}+\underbrace{x_{j}}_{\substack{=x_{j+n}\\\text{(by
(\ref{sol.ext.periodic-nonneg.xi-per}),}\\\text{applied to }i=j\text{)}%
}}=s_{j+n}+x_{j+n}. \label{sol.ext.periodic-nonneg.si-per.pf.1}%
\end{align}


The definition of $s_{j+n}$ yields $s_{j+n}=x_{0}+x_{1}+\cdots+x_{j+n-1}$. The
definition of $s_{j+n+1}$ yields%
\begin{align*}
s_{j+n+1}  &  =x_{0}+x_{1}+\cdots+x_{\left(  j+n+1\right)  -1}\\
&  =x_{0}+x_{1}+\cdots+x_{j+n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
j+n+1\right)  -1=j+n\right) \\
&  =\underbrace{\left(  x_{0}+x_{1}+\cdots+x_{j+n-1}\right)  }_{=s_{j+n}%
}+x_{j+n}=s_{j+n}+x_{j+n}.
\end{align*}
Comparing this with (\ref{sol.ext.periodic-nonneg.si-per.pf.1}), we obtain
$s_{j+1}=s_{j+n+1}=s_{\left(  j+1\right)  +n}$ (since $j+n+1=\left(
j+1\right)  +n$). This completes the induction step. Thus,
(\ref{sol.ext.periodic-nonneg.si-per}) is proven.]

Thus, we have shown that every $i\in\mathbb{N}$ satisfies $s_{i}=s_{i+n}$. In
other words, $n$ is a period of the sequence $\left(  s_{0},s_{1},s_{2}%
,\ldots\right)  $ (by the definition of a \textquotedblleft
period\textquotedblright). In other words, the sequence $\left(  s_{0}%
,s_{1},s_{2},\ldots\right)  $ is $n$-periodic (by the definition of
\textquotedblleft$n$-periodic\textquotedblright).

Pick an element $u\in\left\{  0,1,\ldots,n-1\right\}  $ for which the number
$s_{u}$ is minimum\footnote{This is, again, an application of Theorem
\ref{thm.ext.exist.fin}: Indeed, the set $\left\{  s_{u}\ \mid\ u\in\left\{
0,1,\ldots,n-1\right\}  \right\}  $ is nonempty (since $n$ is positive) and
finite; thus, it has a minimum (by Theorem \ref{thm.ext.exist.fin}). If we
denote this minimum by $g$, then $g\in\left\{  s_{u}\ \mid\ u\in\left\{
0,1,\ldots,n-1\right\}  \right\}  $ (since the minimum of a set always belongs
to this set), and thus there exists some $u\in\left\{  0,1,\ldots,n-1\right\}
$ such that $g=s_{u}$. We pick such a $u$.}. Thus,
\begin{equation}
s_{u}\leq s_{v}\ \ \ \ \ \ \ \ \ \ \text{for each }v\in\left\{  0,1,\ldots
,n-1\right\}  . \label{sol.ext.periodic-nonneg.smsj}%
\end{equation}


Hence, we can easily see that%
\begin{equation}
s_{u}\leq s_{m}\ \ \ \ \ \ \ \ \ \ \text{for each }m\in\mathbb{N}\text{.}
\label{sol.ext.periodic-nonneg.smsj2}%
\end{equation}


[\textit{Proof of (\ref{sol.ext.periodic-nonneg.smsj2}):} Let $m\in\mathbb{N}%
$. Proposition \ref{prop.ent.quorem.props} \textbf{(a)} (applied to $m$
instead of $u$) yields $m\%n\in\left\{  0,1,\ldots,n-1\right\}  $ and
$m\%n\equiv m\operatorname{mod}n$. Hence, (\ref{sol.ext.periodic-nonneg.smsj})
(applied to $v=m\%n$) yields $s_{u}\leq s_{m\%n}$. However, $n$ is a period of
the sequence $\left(  s_{0},s_{1},s_{2},\ldots\right)  $, whereas $m\%n$ and
$m$ are two nonnegative integers satisfying $m\%n\equiv m\operatorname{mod}n$.
Therefore, Theorem \ref{thm.seqs.period.main} \textbf{(e)} (applied to
$\left(  s_{0},s_{1},s_{2},\ldots\right)  $, $s_{i}$, $n$, $m\%n$ and $m$
instead of $u$, $u_{i}$, $a$, $p$ and $q$) yields that $s_{m\%n}=s_{m}$.
Hence, $s_{u}\leq s_{m\%n}=s_{m}$. This proves
(\ref{sol.ext.periodic-nonneg.smsj2}).]

The definition of $s_{u}$ yields $s_{u}=x_{0}+x_{1}+\cdots+x_{u-1}$.

Now, let $m\geq u$ be an integer. Thus, $m\geq u\geq0$, so that $m\in
\mathbb{N}$. Hence, $m+1\in\mathbb{N}$. Thus,
(\ref{sol.ext.periodic-nonneg.smsj2}) (applied to $m+1$ instead of $m$) shows
that
\begin{align*}
s_{u}  &  \leq s_{m+1}=x_{0}+x_{1}+\cdots+x_{\left(  m+1\right)
-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }s_{m+1}\right) \\
&  =x_{0}+x_{1}+\cdots+x_{m}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
m+1\right)  -1=m\right) \\
&  =\underbrace{\left(  x_{0}+x_{1}+\cdots+x_{u-1}\right)  }_{=s_{u}}+\left(
x_{u}+x_{u+1}+\cdots+x_{m}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split the sum after its }u\text{-th addend,}\\
\text{since }0\leq u\leq m+1
\end{array}
\right) \\
&  =s_{u}+\left(  x_{u}+x_{u+1}+\cdots+x_{m}\right)  .
\end{align*}
Subtracting $s_{u}$ from both sides of this inequality, we obtain $0\leq
x_{u}+x_{u+1}+\cdots+x_{m}$. In other words, $x_{u}+x_{u+1}+\cdots+x_{m}\geq0$.

Forget that we fixed $m$. We thus have shown that every $m\geq u$ satisfies
$x_{u}+x_{u+1}+\cdots+x_{m}\geq0$. Hence, there exists some $k\in\left\{
0,1,\ldots,n-1\right\}  $ such that every $m\geq k$ satisfies $x_{k}%
+x_{k+1}+\cdots+x_{m}\geq0$ (namely, $k=u$). This solves Exercise
\ref{exe.ext.periodic-nonneg}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.infdesc.gold}}

\begin{proof}
[Discussion of Exercise \ref{exe.infdesc.gold}.]Here is one possible solution:

\begin{proof}
[Solution to Exercise \ref{exe.infdesc.gold}.]\textbf{(a)} Let $\left(
x,y\right)  $ be a golden pair such that $\left(  x,y\right)  \neq\left(
0,1\right)  $. We must prove that $x-y\geq0$.

Indeed, $\left(  x,y\right)  $ is a golden pair. In other words, $\left(
x,y\right)  $ is a pair of nonnegative integers such that $\left\vert
x^{2}-xy-y^{2}\right\vert =1$ (by the definition of a \textquotedblleft golden
pair\textquotedblright).

Each $z\in\mathbb{R}$ satisfies $z\geq-\left\vert z\right\vert $. Applying
this to $z=x^{2}-xy-y^{2}$, we obtain $x^{2}-xy-y^{2}\geq
-\underbrace{\left\vert x^{2}-xy-y^{2}\right\vert }_{=1}=-1$.

Now, our goal is to show that $x-y\geq0$.

Assume the contrary. Thus, $x-y<0$, so that $x<y$. Hence, $x^{2}<y^{2}$ (since
$x$ and $y$ are nonnegative) and therefore $x^{2}\leq y^{2}-1$ (since $x$ and
$y$ are integers). Moreover, from $x<y$, we obtain $y>x\geq0$ (since $x$ is
nonnegative). If we had $x>0$, we would thus obtain $xy>0$ (since $x>0$ and
$y>0$) and therefore $\underbrace{x^{2}}_{\leq y^{2}-1}-\underbrace{xy}%
_{>0}-y^{2}<y^{2}-1-y^{2}=-1$, which would contradict $x^{2}-xy-y^{2}\geq-1$.
Hence, we cannot have $x>0$. Thus, $x\leq0$. Combining this with $x\geq0$, we
find $x=0$. Hence, $x^{2}-xy-y^{2}=0^{2}-0\cdot y-y^{2}=-y^{2}$, so that
$\left\vert x^{2}-xy-y^{2}\right\vert =\left\vert -y^{2}\right\vert
=\left\vert y^{2}\right\vert =y^{2}$ (since $y^{2}\geq0$). Therefore,
$y^{2}=\left\vert x^{2}-xy-y^{2}\right\vert =1$, so that $y=1$ (since $y$ is
nonnegative). Combining $x=0$ with $y=1$, we find $\left(  x,y\right)
=\left(  0,1\right)  $; but this contradicts $\left(  x,y\right)  \neq\left(
0,1\right)  $. This contradiction shows that our assumption was false. Hence,
we conclude that $x-y\geq0$. This solves Exercise \ref{exe.infdesc.gold}
\textbf{(a)}.

\textbf{(b)} Let $\left(  x,y\right)  $ be a golden pair such that $\left(
x,y\right)  \neq\left(  0,1\right)  $. We must prove that $\left(
y,x-y\right)  $ is a golden pair.

Indeed, $\left(  x,y\right)  $ is a golden pair. In other words, $\left(
x,y\right)  $ is a pair of nonnegative integers such that $\left\vert
x^{2}-xy-y^{2}\right\vert =1$ (by the definition of a \textquotedblleft golden
pair\textquotedblright). Moreover, $x-y\geq0$ (by Exercise
\ref{exe.infdesc.gold} \textbf{(a)}), so that $x-y$ is a nonnegative integer.
Thus, $\left(  y,x-y\right)  $ is a pair of nonnegative integers. A
straightforward computation shows that%
\[
y^{2}-y\left(  x-y\right)  -\left(  x-y\right)  ^{2}=-\left(  x^{2}%
-xy-y^{2}\right)  ,
\]
so that%
\begin{align*}
\left\vert y^{2}-y\left(  x-y\right)  -\left(  x-y\right)  ^{2}\right\vert  &
=\left\vert -\left(  x^{2}-xy-y^{2}\right)  \right\vert =\left\vert
x^{2}-xy-y^{2}\right\vert \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert -z\right\vert
=\left\vert z\right\vert \text{ for each }z\in\mathbb{R}\right) \\
&  =1.
\end{align*}
Hence, $\left(  y,x-y\right)  $ is a pair of nonnegative integers satisfying
$\left\vert y^{2}-y\left(  x-y\right)  -\left(  x-y\right)  ^{2}\right\vert
=1$. In other words, $\left(  y,x-y\right)  $ is a golden pair (by the
definition of a \textquotedblleft golden pair\textquotedblright). This solves
Exercise \ref{exe.infdesc.gold} \textbf{(b)}.

\textbf{(c)} Let $\left(  x,y\right)  $ be a golden pair such that $\left(
x,y\right)  \neq\left(  1,0\right)  $. We must prove that $y>0$.

Indeed, assume the contrary. Thus, $y\leq0$.

However, $\left(  x,y\right)  $ is a golden pair. In other words, $\left(
x,y\right)  $ is a pair of nonnegative integers such that $\left\vert
x^{2}-xy-y^{2}\right\vert =1$ (by the definition of a \textquotedblleft golden
pair\textquotedblright). Now, $y\geq0$ (since $y$ is nonnegative). Combining
this with $y\leq0$, we find $y=0$.

Hence, $x^{2}-xy-y^{2}=x^{2}-x\cdot0-0^{2}=x^{2}$, so that $\left\vert
x^{2}-xy-y^{2}\right\vert =\left\vert x^{2}\right\vert =x^{2}$ (since
$x^{2}\geq0$). Therefore, $x^{2}=\left\vert x^{2}-xy-y^{2}\right\vert =1$, so
that $x=1$ (since $x$ is nonnegative). Combining $x=1$ with $y=0$, we find
$\left(  x,y\right)  =\left(  1,0\right)  $; but this contradicts $\left(
x,y\right)  \neq\left(  1,0\right)  $. This contradiction shows that our
assumption was false. Hence, we conclude that $y>0$. This solves Exercise
\ref{exe.infdesc.gold} \textbf{(c)}.

\textbf{(d)} Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the Fibonacci
sequence (defined as in Definition \ref{def.fibonacci}). We claim the following:

\begin{statement}
\textit{Claim 1:} The golden pairs different from $\left(  0,1\right)  $ are
the pairs $\left(  f_{n+1},f_{n}\right)  $ for $n\in\mathbb{N}$ (that is, the
pairs $\left(  f_{1},f_{0}\right)  $, $\left(  f_{2},f_{1}\right)  $, $\left(
f_{3},f_{2}\right)  $, $\ldots$).
\end{statement}

We shall prove Claim 1 after some preparatory work. First, we prove the easy direction:

\begin{statement}
\textit{Observation 2:} Let $n\in\mathbb{N}$. Then, the pair $\left(
f_{n+1},f_{n}\right)  $ is a golden pair different from $\left(  0,1\right)  $.
\end{statement}

[\textit{Proof of Observation 2:} Clearly, $n+1$ is a positive integer (since
$n\in\mathbb{N}$). Hence, we can apply the Cassini identity (i.e., Exercise
\ref{exe.fib.cassini}) to $n+1$ instead of $n$. We thus find $f_{\left(
n+1\right)  +1}f_{\left(  n+1\right)  -1}-f_{n+1}^{2}=\left(  -1\right)
^{n+1}$. In view of $\left(  n+1\right)  +1=n+2$ and $\left(  n+1\right)
-1=n$, this rewrites as $f_{n+2}f_{n}-f_{n+1}^{2}=\left(  -1\right)  ^{n+1}$.
But the recursive definition of the Fibonacci sequence yields $f_{m}%
=f_{m-1}+f_{m-2}$ for each integer $m\geq2$. Applying this to $m=n+2$, we
obtain $f_{n+2}=\underbrace{f_{\left(  n+2\right)  -1}}_{=f_{n+1}%
}+\underbrace{f_{\left(  n+2\right)  -2}}_{=f_{n}}=f_{n+1}+f_{n}$. Hence,
\[
\underbrace{f_{n+2}}_{=f_{n+1}+f_{n}}f_{n}-f_{n+1}^{2}=\left(  f_{n+1}%
+f_{n}\right)  f_{n}-f_{n+1}^{2}=-\left(  f_{n+1}^{2}-f_{n+1}f_{n}-f_{n}%
^{2}\right)  .
\]
Therefore,%
\[
\left\vert f_{n+2}f_{n}-f_{n+1}^{2}\right\vert =\left\vert -\left(
f_{n+1}^{2}-f_{n+1}f_{n}-f_{n}^{2}\right)  \right\vert =\left\vert f_{n+1}%
^{2}-f_{n+1}f_{n}-f_{n}^{2}\right\vert
\]
(since $\left\vert -z\right\vert =\left\vert z\right\vert $ for each
$z\in\mathbb{R}$). Comparing this with%
\[
\left\vert \underbrace{f_{n+2}f_{n}-f_{n+1}^{2}}_{=\left(  -1\right)  ^{n+1}%
}\right\vert =\left\vert \left(  -1\right)  ^{n+1}\right\vert
=1\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  -1\right)  ^{n+1}\text{ is
either }1\text{ or }-1\right)  ,
\]
we obtain $\left\vert f_{n+1}^{2}-f_{n+1}f_{n}-f_{n}^{2}\right\vert =1$.

It is easy to see that the Fibonacci numbers $f_{1},f_{2},f_{3},\ldots$ are
positive integers. In other words, $f_{m}$ is a positive integer whenever $m$
is a positive integer. Applying this to $m=n+1$, we conclude that $f_{n+1}$ is
a positive integer (since $n+1$ is a positive integer). Hence, $f_{n+1}\neq0$.
Thus, $\left(  f_{n+1},f_{n}\right)  \neq\left(  0,1\right)  $. Also, $f_{n}$
and $f_{n+1}$ are nonnegative integers (since all Fibonacci numbers
$f_{0},f_{1},f_{2},\ldots$ are nonnegative integers). Thus, $\left(
f_{n+1},f_{n}\right)  $ is a pair of nonnegative integers such that
$\left\vert f_{n+1}^{2}-f_{n+1}f_{n}-f_{n}^{2}\right\vert =1$. In other words,
$\left(  f_{n+1},f_{n}\right)  $ is a golden pair (by the definition of a
\textquotedblleft golden pair\textquotedblright). Since we know that $\left(
f_{n+1},f_{n}\right)  \neq\left(  0,1\right)  $, we thus conclude that
$\left(  f_{n+1},f_{n}\right)  $ is a golden pair different from $\left(
0,1\right)  $. This proves Observation 2.]

Now, let us say that a pair $\left(  x,y\right)  $ of two nonnegative integers
is \textit{fibonacci} (this word should be understood as an adjective) if it
has the form $\left(  f_{n+1},f_{n}\right)  $ for some $n\in\mathbb{N}$. Thus,
Observation 2 can be restated as follows:

\begin{statement}
\textit{Observation 3:} Every fibonacci pair is a golden pair different from
$\left(  0,1\right)  $.
\end{statement}

We shall now prove the converse statement:

\begin{statement}
\textit{Observation 4:} If $\left(  x,y\right)  $ is a golden pair different
from $\left(  0,1\right)  $, then $\left(  x,y\right)  $ is fibonacci.
\end{statement}

[\textit{Proof of Observation 4:} If $\left(  x,y\right)  $ is a golden pair,
then $x+y\in\mathbb{N}$ (since $x$ and $y$ are nonnegative integers). Thus, we
can prove Observation 4 by strong induction on $x+y$:

\textit{Induction step:} Let $m\in\mathbb{N}$. Assume (as the induction
hypothesis) that Observation 4 holds for $x+y<m$. We must prove that
Observation 4 holds for $x+y=m$.

We have assumed that Observation 4 holds for $x+y<m$. In other words, if
$\left(  x,y\right)  $ is a golden pair different from $\left(  0,1\right)  $
and satisfying $x+y<m$, then
\begin{equation}
\left(  x,y\right)  \text{ is fibonacci.} \label{sol.infdesc.gold.d.o4.pf.IH}%
\end{equation}


Now, let $\left(  x,y\right)  $ be a golden pair different from $\left(
0,1\right)  $ and satisfying $x+y=m$. We shall prove that $\left(  x,y\right)
$ is fibonacci.

Indeed, if $\left(  x,y\right)  =\left(  1,0\right)  $, this is clear (because
the pair $\left(  1,0\right)  $ is fibonacci\footnote{since $\left(
1,0\right)  =\left(  f_{n+1},f_{n}\right)  $ for $n=0$}). Thus, for the rest
of this proof, we WLOG assume that $\left(  x,y\right)  \neq\left(
1,0\right)  $. Hence, Exercise \ref{exe.infdesc.gold} \textbf{(c)} yields
$y>0$. Thus, $x+y>x$, so that $x<x+y=m$. Furthermore, we have $\left(
x,y\right)  \neq\left(  0,1\right)  $ (since $\left(  x,y\right)  $ is
different from $\left(  0,1\right)  $). Hence, Exercise \ref{exe.infdesc.gold}
\textbf{(b)} yields that $\left(  y,x-y\right)  $ is a golden pair. We have
$\left(  y,x-y\right)  \neq\left(  0,1\right)  $%
\ \ \ \ \footnote{\textit{Proof.} Assume the contrary. Thus, $\left(
y,x-y\right)  =\left(  0,1\right)  $. In other words, $y=0$ and $x-y=1$.
Hence, $x=\underbrace{y}_{=0}+\underbrace{x-y}_{=1}=0+1=1$. Combined with
$y=0$, this yields $\left(  x,y\right)  =\left(  1,0\right)  $; but this
contradicts $\left(  x,y\right)  \neq\left(  1,0\right)  $. This contradiction
shows that our assumption was false. Qed.} and $y+\left(  x-y\right)  =x<m$.

Now, we know that $\left(  y,x-y\right)  $ is a golden pair different from
$\left(  0,1\right)  $ (since $\left(  y,x-y\right)  \neq\left(  0,1\right)
$) and satisfying $y+\left(  x-y\right)  <m$. Hence, we can apply
(\ref{sol.infdesc.gold.d.o4.pf.IH}) to $\left(  y,x-y\right)  $ instead of
$\left(  x,y\right)  $. As a consequence, we conclude that the pair $\left(
y,x-y\right)  $ is fibonacci. In other words, $\left(  y,x-y\right)  $ has the
form $\left(  f_{n+1},f_{n}\right)  $ for some $n\in\mathbb{N}$ (by the
definition of \textquotedblleft fibonacci\textquotedblright). Consider this
$n$, and denote it by $u$. Thus, $u\in\mathbb{N}$ and $\left(  y,x-y\right)
=\left(  f_{u+1},f_{u}\right)  $.

From $\left(  y,x-y\right)  =\left(  f_{u+1},f_{u}\right)  $, we obtain
$y=f_{u+1}$ and $x-y=f_{u}$. Now, $x=\underbrace{y}_{=f_{u+1}}%
+\underbrace{x-y}_{=f_{u}}=f_{u+1}+f_{u}$.

But the recursive definition of the Fibonacci sequence yields $f_{p}%
=f_{p-1}+f_{p-2}$ for each integer $p\geq2$. Applying this to $p=u+2$, we
obtain $f_{u+2}=\underbrace{f_{\left(  u+2\right)  -1}}_{=f_{u+1}%
}+\underbrace{f_{\left(  u+2\right)  -2}}_{=f_{u}}=f_{u+1}+f_{u}$. Hence,
$x=f_{u+1}+f_{u}=f_{u+2}=f_{\left(  u+1\right)  +1}$. Combining this with
$y=f_{u+1}$, we obtain $\left(  x,y\right)  =\left(  f_{\left(  u+1\right)
+1},f_{u+1}\right)  $. Hence, the pair $\left(  x,y\right)  $ has the form
$\left(  f_{n+1},f_{n}\right)  $ for some $n\in\mathbb{N}$ (namely, for
$n=u+1$). In other words, the pair $\left(  x,y\right)  $ is fibonacci (by the
definition of \textquotedblleft fibonacci\textquotedblright).

Forget that we fixed $\left(  x,y\right)  $. We thus have shown that if
$\left(  x,y\right)  $ is a golden pair different from $\left(  0,1\right)  $
and satisfying $x+y=m$, then $\left(  x,y\right)  $ is fibonacci. In other
words, Observation 4 holds for $x+y=m$. This completes the induction step.
Thus, Observation 4 is proved.]

Observation 4 can be restated as follows:

\begin{statement}
\textit{Observation 5:} Every golden pair different from $\left(  0,1\right)
$ is a fibonacci pair.
\end{statement}

Combining this with Observation 3, we conclude that the golden pairs different
from $\left(  0,1\right)  $ are precisely the fibonacci pairs. In other words,
the golden pairs different from $\left(  0,1\right)  $ are precisely the pairs
of the form $\left(  f_{n+1},f_{n}\right)  $ for some $n\in\mathbb{N}$
(because this is how the fibonacci pairs are defined). This proves Claim 1.
Thus, Exercise \ref{exe.infdesc.gold} \textbf{(d)} is solved.
\end{proof}

[\textit{Remark:} Exercise \ref{exe.infdesc.gold} \textbf{(d)} is a result of
Lucas (1876). A proof similar to ours is given in \cite[Lemmas 1, 2,
3]{Jones75}.

Note that our proof is an example of an argument by infinite descent, even
though we have formulated it as a strong induction argument. To see this, it
suffices to rewrite Observation 4 above as \textquotedblleft there exists no
non-fibonacci golden pair different from $\left(  0,1\right)  $%
\textquotedblright, and reframe our proof of Observation 4 as transforming an
(ostensible) non-fibonacci golden pair $\left(  x,y\right)  $ different from
$\left(  0,1\right)  $ into a smaller non-fibonacci golden pair $\left(
y,x-y\right)  $ which is also different from $\left(  0,1\right)  $.
(\textquotedblleft Smaller\textquotedblright\ here means \textquotedblleft
smaller sum of entries\textquotedblright.) We chose to instead organize our
proof as a strong induction argument, in order to avoid the detour through the
contrapositive; but it is probably easiest to find this proof by attempting an
infinite descent.

We have thus solved the equation $\left\vert x^{2}-xy-y^{2}\right\vert =1$ in
nonnegative integers $x$ and $y$. This is an example of a \textit{quadratic
Diophantine equation}, closely connected to the \textit{Pell equation}
$\left\vert x^{2}-5y^{2}\right\vert =1$ (see \cite{AndAnd14} for the
connection). Similar arguments can be used for solving other equations like
this; it is not a coincidence that the solutions in our case were given by the
Fibonacci numbers. Usually, solutions (when they exist) are given by $\left(
u,v\right)  $-recurrent sequences for some values of $u$ and $v$. For example,
the solutions $\left(  x,y\right)  $ of the equation $\left\vert x^{2}%
-2y^{2}\right\vert =1$ in nonnegative integers $x$ and $y$ are precisely the
pairs of the form $\left(  a_{n},b_{n}\right)  $ for $n\in\mathbb{N}$, where
$\left(  a_{0},a_{1},a_{2},\ldots\right)  $ and $\left(  b_{0},b_{1}%
,b_{2},\ldots\right)  $ are the two $\left(  2,1\right)  $-recurrent sequences
with starting values $a_{0}=1$, $a_{1}=1$, $b_{0}=0$ and $b_{1}=1$. (These two
sequences are \href{https://oeis.org/A001333}{A001333} and
\href{https://oeis.org/A000129}{A000129} in the OEIS.) See \cite{Emerso69} for
the proof.

Finally, note that the golden pair $\left(  0,1\right)  $ is not really an
exception from the fibonacci formula $\left(  f_{n+1},f_{n}\right)  $, even
though we have treated it as such in our above solution. Indeed, if we define
$f_{-1}$ as in Exercise \ref{exe.fib.negatives.18f-mt1s-4}, then $\left(
0,1\right)  =\left(  f_{n+1},f_{n}\right)  $ for $n=-1$, and thus the pair
$\left(  0,1\right)  $ becomes fibonacci if we extend the definition of
fibonacci pairs to allow for $n=-1$.]
\end{proof}

\subsection{Homework set \#6 discussion}

The following are discussions of the problems on homework set \#6 (Section
\ref{sect.hw6}).

\subsubsection{Discussion of Exercise \ref{exe.ext.tour-win}}

\begin{proof}
[Discussion of Exercise \ref{exe.ext.tour-win}.]Exercise
\ref{exe.ext.tour-win} is \cite[Exercise 3.13]{Engel} (and also easily seen to
be equivalent to \cite[Chapter 3, Example E11]{Engel}). Its solution is a
copybook example of a use of the Extremal Principle:

\begin{proof}
[Solution to Exercise \ref{exe.ext.tour-win}.]First, we WLOG assume that no
player plays a match against himself. (Indeed, this is arguably clear from
common sense or perhaps implicit in the statement of the problem. But even if
we don't consider this to be clear, we can make this true by forgetting about
all self-matches\footnote{i.e., matches that a player plays against himself}.
That is, throughout the argument below, we pretend that self-matches do not
happen (and, in particular, we ignore their results). It is clear that if the
problem has been solved without taking the self-matches into account, then it
has also been solved with the self-matches, because a player who has (directly
or indirectly) owned all other players will not lose this property if we add
some self-matches. Thus, we can WLOG assume that self-matches don't exist --
i.e., that no player plays a match against himself.)

Define the \textit{score} of a player $d$ to be the number of all players that
$d$ has directly owned. Consider a player $a$ with maximum score. (Such a
player clearly exists, since the set $\left\{  \text{scores of players}%
\right\}  $ is a finite nonempty set of integers and thus has a maximum.) We
shall show that $a$ has (directly or indirectly) owned all other players.

Indeed, let $b$ be a player different from $a$. We shall show that $a$ has
(directly or indirectly) owned $b$.

Indeed, assume the contrary. Thus, $a$ has neither directly owned $b$ nor
indirectly owned $b$.

Hence, in particular, $a$ has not directly owned $b$. In other words, $a$ has
not won a match against $b$ (since \textquotedblleft directly
owning\textquotedblright\ $b$ means winning a match against $b$). However, the
players $a$ and $b$ are distinct (since $b$ is different from $a$), and thus
there must be a match between $a$ and $b$ (since each pair of distinct players
play exactly one match against one another). This match cannot have been won
by $a$ (since $a$ has not won a match against $b$), and thus must have been
won by $b$ (since no match ends with a draw). Hence, $b$ has won a match
against $a$. In other words, $b$ has directly owned $a$ (since
\textquotedblleft directly owning\textquotedblright\ $a$ means winning a match
against $a$).

Let $Y$ be the set of all players that $b$ has directly owned. Thus,%
\begin{align}
\left\vert Y\right\vert  &  =\left(  \text{the number of all players that
}b\text{ has directly owned}\right) \nonumber\\
&  =\left(  \text{the score of }b\right)  \label{sol.ext.tour-win.absY=}%
\end{align}
(since the score of $b$ is defined as the number of all players that $b$ has
directly owned). Moreover, we recall that $b$ has directly owned $a$; in other
words, $a\in Y$ (since $Y$ is the set of all players that $b$ has directly
owned). Hence, $\left\vert Y\setminus\left\{  a\right\}  \right\vert
=\left\vert Y\right\vert -1$.

Let $X$ be the set of all players that $a$ has directly owned. Thus,%
\begin{align*}
\left\vert X\right\vert  &  =\left(  \text{the number of all players that
}a\text{ has directly owned}\right) \\
&  =\left(  \text{the score of }a\right)
\end{align*}
(since the score of $a$ is defined as the number of all players that $a$ has
directly owned). Thus,%
\begin{align*}
\left\vert X\right\vert  &  =\left(  \text{the score of }a\right)  \geq\left(
\text{the score of }b\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }a\text{
has maximum score}\right) \\
&  =\left\vert Y\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.ext.tour-win.absY=})}\right) \\
&  >\left\vert Y\right\vert -1=\left\vert Y\setminus\left\{  a\right\}
\right\vert \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert Y\setminus
\left\{  a\right\}  \right\vert =\left\vert Y\right\vert -1\right)  .
\end{align*}


Thus, we have proved the inequality $\left\vert X\right\vert >\left\vert
Y\setminus\left\{  a\right\}  \right\vert $. Next, we will show that
$X\subseteq Y\setminus\left\{  a\right\}  $, which will clearly contradict
this inequality (and thus give us the contradiction that we want).

Indeed, let $x\in X$. We shall show that $x\in Y\setminus\left\{  a\right\}  $.

We have $x\in X$. In other words, $x$ is a player that $a$ has directly owned
(since $X$ is the set of all players that $a$ has directly owned). In other
words, $x$ is a player that $a$ has won a match against (since
\textquotedblleft directly owning\textquotedblright\ a player means winning a
match against this player). Thus, $a$ has won a match against $x$. Therefore,
$x\neq a$ (since no player plays a match against himself).

Now, we shall show that $x\in Y$. Indeed, assume the contrary.\footnote{You
are reading right: We are doing a proof by contradiction inside a proof by
contradiction. This is perhaps not particularly elegant, but perfectly valid.}
Thus, $x\notin Y$. In other words, $b$ has not directly owned $x$ (since $Y$
is the set of all players that $b$ has directly owned). In other words, $b$
has not won a match against $x$ (since \textquotedblleft directly
owning\textquotedblright\ $x$ means winning a match against $x$).

Recall that $a$ has not directly owned $b$. In other words, $b\notin X$ (since
$X$ is the set of all players that $a$ has directly owned). If we had $x=b$,
then we would thus obtain $x=b\notin X$, which would contradict $x\in X$.
Hence, we cannot have $x=b$. Thus, we have $x\neq b$. Therefore, the players
$x$ and $b$ are distinct, so that there must be a match between $x$ and $b$
(since each pair of distinct players play exactly one match against one
another). This match cannot have been won by $b$ (since $b$ has not won a
match against $x$), and thus must have been won by $x$ (since no match ends
with a draw). Hence, $x$ has won a match against $b$. Recall also that $a$ has
won a match against $x$. Hence, there exists a player $c$ such that $a$ has
won a match against $c$ and $c$ has won a match against $b$ (namely, $c=x$).
In other words, $a$ has indirectly owned $b$ (by the definition of
\textquotedblleft indirectly owned\textquotedblright). This contradicts the
fact that $a$ has neither directly owned $b$ nor indirectly owned $b$. This
contradiction shows that our latest assumption was false. Thus, $x\in Y$ is proved.

Combining $x\in Y$ with $x\neq a$, we find $x\in Y\setminus\left\{  a\right\}
$.

Forget that we fixed $x$. We thus have shown that $x\in Y\setminus\left\{
a\right\}  $ for each $x\in X$. In other words, $X\subseteq Y\setminus\left\{
a\right\}  $. Hence, $\left\vert X\right\vert \leq\left\vert Y\setminus
\left\{  a\right\}  \right\vert $. But this contradicts $\left\vert
X\right\vert >\left\vert Y\setminus\left\{  a\right\}  \right\vert $. This
contradiction shows that our assumption was false. Hence, we have shown that
$a$ has (directly or indirectly) owned $b$.

Forget that we fixed $b$. We thus have shown that if $b$ is any player
different from $a$, then $a$ has (directly or indirectly) owned $b$. In other
words, $a$ has (directly or indirectly) owned all other players. Thus, there
exists a player who has (directly or indirectly) owned all other players
(namely, $a$). This solves Exercise \ref{exe.ext.tour-win}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.infdesc.put1973B1.4}}

\begin{proof}
[Discussion of Exercise \ref{exe.infdesc.put1973B1.4}.]Exercise
\ref{exe.infdesc.put1973B1.4} is a generalization of Exercise
\ref{exe.infdesc.put1973B1.1} (in that its assumptions are weaker, but its
conclusion is the same). We shall solve it by modifying our solution to
Exercise \ref{exe.infdesc.put1973B1.1} as follows:

\begin{proof}
[Solution to Exercise \ref{exe.infdesc.put1973B1.4} (sketched).]Some notations first.

A \textit{solution} will mean an $\left(  2n+1\right)  $-tuple $\left(
a_{1},a_{2},\ldots,a_{2n+1}\right)  $ of integers that has the weaker
splitting property.

A solution $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ will be called
\textit{flat} if all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are equal.
Thus, our goal is to show that every solution is flat. In other words, our
goal is to show that there is no non-flat solution.

A solution $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ will be called
\textit{nonnegative} if all $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$ are nonnegative.

First, we observe the following:

\begin{statement}
\textit{Observation 1':} If there exists a non-flat solution, then there
exists a nonnegative non-flat solution.
\end{statement}

[\textit{Proof of Observation 1':} This can be proved in the same way as
Observation 1 was proved in our solution to Exercise
\ref{exe.infdesc.put1973B1.1}.]

Thanks to Observation 1', we don't need to bother with negative integers if we
don't want to. This will come useful later.

Next, let us study the parity of the integers in a solution:

\begin{statement}
\textit{Observation 2':} If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is
a solution, then the $2n+1$ integers $a_{1},a_{2},\ldots,a_{2n+1}$ all have
the same parity (i.e., are either all even or all odd).
\end{statement}

[\textit{Proof of Observation 2':} This is similar to the proof of Observation
2 in our solution to Exercise \ref{exe.infdesc.put1973B1.1}, but somewhat more
complicated because the weaker splitting property is (as its name suggests)
weaker than the original splitting property. Here are the details:

Let $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ be a solution. Let
$t=a_{1}+a_{2}+\cdots+a_{2n+1}$ be the sum of all its entries. We WLOG assume
that $2n+1>1$ (since otherwise, the claim of Observation 2' is obvious).
Hence, $2n>0$, so that $n>0$ and thus $n\geq1$ (since $n\in\mathbb{N}$).
Therefore, $1\in\left\{  1,2,\ldots,2n\right\}  $.

Thus, the weaker splitting property shows that if the integer $a_{1}$ is
removed (from our $2n+1$ numbers $a_{1},a_{2},\ldots,a_{2n+1}$), then the
remaining $2n$ numbers can be split into two equinumerous heaps with equal
sum. In other words, the $2n$ numbers $a_{2},a_{3},\ldots,a_{2n+1}$ can be
split into two equinumerous heaps with equal sum. Let $s$ be the sum of either
heap. Then, $s$ is an integer (since $a_{2},a_{3},\ldots,a_{2n+1}$ are
integers). But the sum $a_{2}+a_{3}+\cdots+a_{2n+1}$ of all the $2n$ numbers
$a_{2},a_{3},\ldots,a_{2n+1}$ must be $s+s$ (since these $2n$ numbers can be
split into two heaps, each of which has sum $s$). Thus,%
\[
a_{2}+a_{3}+\cdots+a_{2n+1}=s+s=2s\equiv0\operatorname{mod}%
2\ \ \ \ \ \ \ \ \ \ \left(  \text{since }s\text{ is an integer}\right)  .
\]
Hence,%
\[
t=a_{1}+a_{2}+\cdots+a_{2n+1}=a_{1}+\underbrace{\left(  a_{2}+a_{3}%
+\cdots+a_{2n+1}\right)  }_{\equiv0\operatorname{mod}2}\equiv a_{1}%
\operatorname{mod}2,
\]
so that $a_{1}\equiv t\operatorname{mod}2$.

Thus, by removing $a_{1}$ and applying the weaker splitting property, we have
obtained $a_{1}\equiv t\operatorname{mod}2$. But we can apply the same
argument to any of the $2n$ integers $a_{1},a_{2},\ldots,a_{2n}$ in place of
$a_{1}$. Thus, we find that%
\begin{equation}
a_{i}\equiv t\operatorname{mod}2 \label{sol.infdesc.put1973B1.1.o2.pf.3}%
\end{equation}
for each $i\in\left\{  1,2,\ldots,2n\right\}  $. Using
(\ref{eq.exe.ent.mod.k-sum.a}), we now have%
\[
\sum_{i=1}^{2n}\underbrace{a_{i}}_{\substack{\equiv t\operatorname{mod}%
2\\\text{(by (\ref{sol.infdesc.put1973B1.1.o2.pf.3}))}}}\equiv\sum_{i=1}%
^{2n}t=2nt\equiv0\operatorname{mod}2
\]
(since $2\mid2nt$). Now,%
\[
t=a_{1}+a_{2}+\cdots+a_{2n+1}=\underbrace{\left(  a_{1}+a_{2}+\cdots
+a_{2n}\right)  }_{=\sum_{i=1}^{2n}a_{i}\equiv0\operatorname{mod}2}%
+a_{2n+1}\equiv a_{2n+1}\operatorname{mod}2.
\]
Hence, $a_{2n+1}\equiv t\operatorname{mod}2$. Thus, the congruence
(\ref{sol.infdesc.put1973B1.1.o2.pf.3}) holds not only for each $i\in\left\{
1,2,\ldots,2n\right\}  $, but also for $i=2n+1$. Hence, this congruence
(\ref{sol.infdesc.put1973B1.1.o2.pf.3}) holds for each $i\in\left\{
1,2,\ldots,2n+1\right\}  $. As a consequence,

\begin{itemize}
\item if $t$ is even, then all of $a_{1},a_{2},\ldots,a_{2n+1}$ are even;

\item if $t$ is odd, then all of $a_{1},a_{2},\ldots,a_{2n+1}$ are odd.
\end{itemize}

\noindent Thus, $a_{1},a_{2},\ldots,a_{2n+1}$ all have the same parity. This
proves Observation 2'.]

Now, Observation 2' helps us transform non-flat solutions into smaller
non-flat solutions with an appropriate meaning of \textquotedblleft
smaller\textquotedblright. To be more precise, we consider nonnegative
solutions. If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is a nonnegative
solution, then the \textit{weight} of this solution is defined to be the
nonnegative integer $a_{1}+a_{2}+\cdots+a_{2n+1}$. Now we claim:

\begin{statement}
\textit{Observation 3':} If $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)  $ is
a nonnegative non-flat solution, then there exists a nonnegative non-flat
solution with smaller weight than $\left(  a_{1},a_{2},\ldots,a_{2n+1}\right)
$.
\end{statement}

[\textit{Proof of Observation 3':} This can be proved in the same way as
Observation 3 was proved in our solution to Exercise
\ref{exe.infdesc.put1973B1.1}. (Of course, we now need to use Observation 2'
instead of Observation 2.)]

Now, all we need is to reap our rewards. By the Principle of Infinite Descent,
Observation 3' entails that there exists no nonnegative non-flat solution.
Hence, by Observation 1', we conclude that there exists no non-flat solution
either. In other words, any solution is flat. Exercise
\ref{exe.infdesc.put1973B1.4} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.endofunc.th-pq}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.endofunc.th-pq}.]Exercise
\ref{exe.php.endofunc.th-pq} is an easy consequence of Theorem
\ref{thm.php.endofunc.1}:

\begin{proof}
[Solution to Exercise \ref{exe.php.endofunc.th-pq}.]Theorem
\ref{thm.php.endofunc.1} \textbf{(a)} yields that there exist two integers $i$
and $j$ with $0\leq i<j\leq n$ and $f^{i}\left(  x\right)  =f^{j}\left(
x\right)  $. Consider these $i$ and $j$. Set $a=j-i$. We have $a=j-i>0$ (since
$i<j$); thus, $a$ is a positive integer.

Theorem \ref{thm.php.endofunc.1} \textbf{(b)} yields that the sequence
$\left(  f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(
x\right)  ,\ldots\right)  $ is $\left(  j-i\right)  $-periodic. In other
words, the sequence $\left(  f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)
,f^{i+2}\left(  x\right)  ,\ldots\right)  $ is $a$-periodic (since $a=j-i$).
In other words, $a$ is a period of the sequence $\left(  f^{i}\left(
x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)  ,\ldots\right)
$ (by the definition of \textquotedblleft$a$-periodic\textquotedblright).
Thus, if $u$ and $v$ are two nonnegative integers satisfying $u\equiv
v\operatorname{mod}a$, then%
\begin{equation}
f^{i+u}\left(  x\right)  =f^{i+v}\left(  x\right)
\label{sol.php.endofunc.th-pq.per}%
\end{equation}
(by Theorem \ref{thm.seqs.period.main} \textbf{(e)}, applied to $\left(
f^{i}\left(  x\right)  ,f^{i+1}\left(  x\right)  ,f^{i+2}\left(  x\right)
,\ldots\right)  $, $f^{i+m}\left(  x\right)  $, $u$ and $v$ instead of $u$,
$u_{m}$, $p$ and $q$).

Define an integer $s$ by%
\[
s=1+\left(  p-q-i-1\right)  \%a.
\]
Proposition \ref{prop.ent.quorem.props} \textbf{(a)} (applied to $a$ and
$p-q-i-1$ instead of $n$ and $u$) yields that $\left(  p-q-i-1\right)
\%a\in\left\{  0,1,\ldots,a-1\right\}  $ and $\left(  p-q-i-1\right)
\%a\equiv p-q-i-1\operatorname{mod}a$. Now,
\[
s=1+\left(  p-q-i-1\right)  \%a\in\left\{  1,2,\ldots,a\right\}
\]
(since $\left(  p-q-i-1\right)  \%a\in\left\{  0,1,\ldots,a-1\right\}  $), so
that $s\geq1$ and $s\leq a$. Hence, $i+\underbrace{s}_{\leq a=j-i}\leq
i+\left(  j-i\right)  =j\leq n$. Also, $\underbrace{i}_{\geq0}+s\geq s\geq1$.
Combining $i+s\geq1$ with $i+s\leq n$, we find $i+s\in\left\{  1,2,\ldots
,n\right\}  $ (since $i+s$ is an integer). Moreover,%
\[
s=1+\underbrace{\left(  p-q-i-1\right)  \%a}_{\equiv p-q-i-1\operatorname{mod}%
a}\equiv1+\left(  p-q-i-1\right)  =p-q-i\operatorname{mod}a.
\]
Hence,%
\[
\left(  i+2s+q\right)  -\left(  s+p\right)  =\underbrace{s}_{\equiv
p-q-i\operatorname{mod}a}+i+q-p\equiv p-q-i+i+q-p\equiv0\operatorname{mod}a.
\]
In other words, $a\mid\left(  i+2s+q\right)  -\left(  s+p\right)  $. In other
words,
\[
i+2s+q\equiv s+p\operatorname{mod}a.
\]
Thus, (\ref{sol.php.endofunc.th-pq.per}) (applied to $u=i+2s+q$ and $v=s+p$)
yields $f^{i+\left(  i+2s+q\right)  }\left(  x\right)  =f^{i+\left(
s+p\right)  }\left(  x\right)  $. In view of $i+\left(  i+2s+q\right)
=2\left(  i+s\right)  +q$ and $i+\left(  s+p\right)  =\left(  i+s\right)  +p$,
this rewrites as $f^{2\left(  i+s\right)  +q}\left(  x\right)  =f^{\left(
i+s\right)  +p}\left(  x\right)  $. In other words, $f^{\left(  i+s\right)
+p}\left(  x\right)  =f^{2\left(  i+s\right)  +q}\left(  x\right)  $. Since we
know that $i+s\in\left\{  1,2,\ldots,n\right\}  $, we thus conclude that there
exists some $k\in\left\{  1,2,\ldots,n\right\}  $ such that $f^{k+p}\left(
x\right)  =f^{2k+q}\left(  x\right)  $ (namely, $k=i+s$). This solves Exercise
\ref{exe.php.endofunc.th-pq}.
\end{proof}

The above solution may appear unmotivated in places (in particular, how did we
think of defining $s$ as $1+\left(  p-q-i-1\right)  \%a$ ?); however, it can
be found by fairly straightforward reasoning. Indeed, once $i$, $j$ and $a$
have been defined, it is clear that the best bet for a $k\in\left\{
1,2,\ldots,n\right\}  $ satisfying $f^{k+p}\left(  x\right)  =f^{2k+q}\left(
x\right)  $ is to have $k\geq1$ and $k\geq i$ and $k+p\equiv
2k+q\operatorname{mod}a$ (since Theorem \ref{thm.php.endofunc.1} \textbf{(b)}
will then yield $f^{k+p}\left(  x\right)  =f^{2k+q}\left(  x\right)  $). The
easiest way to satisfy $k\geq1$ and $k\geq i$ is by taking $k=i+s$ for some
positive integer $s$. Rewriting the congruence $k+p\equiv
2k+q\operatorname{mod}a$ in terms of this latter $s$, we obtain $i+s+p\equiv
2\left(  i+s\right)  +q\operatorname{mod}a$, which is equivalent to $s\equiv
p-q-i\operatorname{mod}a$. This suggests setting $s=\left(  p-q-i\right)
\%a$, but this would sometimes result in $s=0$, which we don't want (as we
want $s$ to be positive). Thus, we instead set $s=1+\left(  p-q-i-1\right)
\%a$, in order for $s$ to be positive. It remains to verify that the resulting
$k=i+s$ does indeed belong to $\left\{  1,2,\ldots,n\right\}  $. Thus, the
above solution is found.

Let us notice that Theorem \ref{thm.php.endofunc.th} is a particular case of
Exercise \ref{exe.php.endofunc.th-pq}:

\begin{proof}
[Proof of Theorem \ref{thm.php.endofunc.th}.]Exercise
\ref{exe.php.endofunc.th-pq} (applied to $p=0$ and $q=0$) yields that there
exists some $k\in\left\{  1,2,\ldots,n\right\}  $ such that $f^{k+0}\left(
x\right)  =f^{2k+0}\left(  x\right)  $. In other words, there exists some
$k\in\left\{  1,2,\ldots,n\right\}  $ such that $f^{k}\left(  x\right)
=f^{2k}\left(  x\right)  $ (since $k+0=k$ and $2k+0=2k$). This proves Theorem
\ref{thm.php.endofunc.th}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.endofunc.evtl-img2}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.endofunc.evtl-img2}.]The solution to
Exercise \ref{exe.php.endofunc.evtl-img2} is similar to our proof of
Proposition \ref{prop.php.endofunc.evtl-img} \textbf{(c)}, except that we need
to use $\left\vert f^{n}\left(  X\right)  \right\vert \geq1$ instead of
$\left\vert f^{n+1}\left(  X\right)  \right\vert \geq0$. Here are the details:

\begin{proof}
[Solution to Exercise \ref{exe.php.endofunc.evtl-img2}.]Note that
$f^{0}=\operatorname*{id}\nolimits_{X}$, so that $f^{0}\left(  X\right)
=\operatorname*{id}\nolimits_{X}\left(  X\right)  =X$. Hence, $\left\vert
f^{0}\left(  X\right)  \right\vert =\left\vert X\right\vert =n$.

Also, the set $f^{n}\left(  X\right)  $ is nonempty\footnote{\textit{Proof.}
The set $X$ is nonempty. Hence, there exists some $x\in X$. Consider this $x$.
Thus, $f^{n}\left(  x\right)  \in f^{n}\left(  X\right)  $ (since $x\in X$).
Therefore, the set $f^{n}\left(  X\right)  $ has an element (namely,
$f^{n}\left(  x\right)  $), and thus is nonempty. Qed.}. Hence, $\left\vert
f^{n}\left(  X\right)  \right\vert \geq1$.

We shall first show that there exists some $i\in\left\{  0,1,\ldots
,n-1\right\}  $ such that $f^{i}\left(  X\right)  =f^{i+1}\left(  X\right)  $.

Indeed, assume the contrary. Thus, each $i\in\left\{  0,1,\ldots,n-1\right\}
$ satisfies%
\begin{equation}
f^{i}\left(  X\right)  \neq f^{i+1}\left(  X\right)  .
\label{sol.php.endofunc.evtl-img2.ac}%
\end{equation}


Now, let $i\in\left\{  0,1,\ldots,n-1\right\}  $. Then, Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(a)} yields $f^{0}\left(  X\right)
\supseteq f^{1}\left(  X\right)  \supseteq f^{2}\left(  X\right)
\supseteq\cdots$. Thus, $f^{i}\left(  X\right)  \supseteq f^{i+1}\left(
X\right)  $. In other words, $f^{i+1}\left(  X\right)  $ is a subset of
$f^{i}\left(  X\right)  $. Moreover, this subset is \textbf{proper}, because
(\ref{sol.php.endofunc.evtl-img2.ac}) shows that $f^{i}\left(  X\right)  \neq
f^{i+1}\left(  X\right)  $.

It is a well-known fact that if $U$ is a proper subset of a finite set $V$,
then $\left\vert U\right\vert <\left\vert V\right\vert $. Applying this to
$U=f^{i+1}\left(  X\right)  $ and $V=f^{i}\left(  X\right)  $, we obtain
$\left\vert f^{i+1}\left(  X\right)  \right\vert <\left\vert f^{i}\left(
X\right)  \right\vert $ (since $f^{i+1}\left(  X\right)  $ is a proper subset
of the finite set $f^{i}\left(  X\right)  $). This entails $\left\vert
f^{i+1}\left(  X\right)  \right\vert \leq\left\vert f^{i}\left(  X\right)
\right\vert -1$ (since $\left\vert f^{i+1}\left(  X\right)  \right\vert $ and
$\left\vert f^{i}\left(  X\right)  \right\vert $ are integers). In other
words, $\left\vert f^{i+1}\left(  X\right)  \right\vert -\left\vert
f^{i}\left(  X\right)  \right\vert \leq-1$.

Now, forget that we fixed $i$. We thus have proved the inequality $\left\vert
f^{i+1}\left(  X\right)  \right\vert -\left\vert f^{i}\left(  X\right)
\right\vert \leq-1$ for each $i\in\left\{  0,1,\ldots,n-1\right\}  $. Summing
these inequalities over all $i\in\left\{  0,1,\ldots,n-1\right\}  $, we obtain%
\[
\sum_{i=0}^{n}\left(  \left\vert f^{i+1}\left(  X\right)  \right\vert
-\left\vert f^{i}\left(  X\right)  \right\vert \right)  \leq\sum_{i=0}%
^{n-1}\left(  -1\right)  =n\cdot\left(  -1\right)  =-n.
\]
But this contradicts%
\begin{align*}
\sum_{i=0}^{n-1}\left(  \left\vert f^{i+1}\left(  X\right)  \right\vert
-\left\vert f^{i}\left(  X\right)  \right\vert \right)   &  =\left\vert
\underbrace{f^{\left(  n-1\right)  +1}}_{=f^{n}}\left(  X\right)  \right\vert
-\underbrace{\left\vert f^{0}\left(  X\right)  \right\vert }_{=n}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Corollary \ref{cor.seqsum.telesc-pos},}\\
\text{applied to }u=0\text{ and }v=n-1\text{ and }a_{i}=\left\vert
f^{i}\left(  X\right)  \right\vert
\end{array}
\right) \\
&  =\underbrace{\left\vert f^{n}\left(  X\right)  \right\vert }_{\geq1}%
-n\geq1-n>-n.
\end{align*}
This contradiction shows that our assumption was false.

Hence, we have shown that there exists some $i\in\left\{  0,1,\ldots
,n-1\right\}  $ such that $f^{i}\left(  X\right)  =f^{i+1}\left(  X\right)  $.
Consider this $i$.

Now, $i\leq n-1$ (since $i\in\left\{  0,1,\ldots,n-1\right\}  $), so that
$n-1\geq i$. Thus, Proposition \ref{prop.php.endofunc.evtl-img} \textbf{(b)}
(applied to $k=n-1$) yields $f^{i}\left(  X\right)  =f^{n-1}\left(  X\right)
$. However, we also have $n\geq n-1\geq i$. Thus, Proposition
\ref{prop.php.endofunc.evtl-img} \textbf{(b)} (applied to $k=n$) yields
$f^{i}\left(  X\right)  =f^{n}\left(  X\right)  $. Hence, $f^{n}\left(
X\right)  =f^{i}\left(  X\right)  =f^{n-1}\left(  X\right)  $. This solves
Exercise \ref{exe.php.endofunc.evtl-img2}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.endofunc.order-nfac}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.endofunc.order-nfac}.]Here is the
simplest way to solve Exercise \ref{exe.php.endofunc.order-nfac}:

\begin{proof}
[Solution to Exercise \ref{exe.php.endofunc.order-nfac}.]\textbf{(a)} Let
$x\in X$ and $k\in\mathbb{N}$ be such that $f^{k}\left(  x\right)
=f^{2k}\left(  x\right)  $. We must prove that%
\begin{equation}
f^{ik}\left(  x\right)  =f^{k}\left(  x\right)
\label{sol.php.endofunc.order-nfac.a.goal}%
\end{equation}
for every positive integer $i$.

[\textit{Proof of (\ref{sol.php.endofunc.order-nfac.a.goal}):} We shall prove
(\ref{sol.php.endofunc.order-nfac.a.goal}) by induction on $i$:

\textit{Induction base:} We have $f^{1k}\left(  x\right)  =f^{k}\left(
x\right)  $ (since $1k=k$). In other words,
(\ref{sol.php.endofunc.order-nfac.a.goal}) holds for $i=1$.

\textit{Induction step:} Let $j$ be a positive integer. Assume (as the
induction hypothesis) that (\ref{sol.php.endofunc.order-nfac.a.goal}) holds
for $i=j$. We must prove that (\ref{sol.php.endofunc.order-nfac.a.goal}) holds
for $i=j+1$. In other words, we must prove that $f^{\left(  j+1\right)
k}\left(  x\right)  =f^{k}\left(  x\right)  $.

We have assumed that (\ref{sol.php.endofunc.order-nfac.a.goal}) holds for
$i=j$. In other words, we have $f^{jk}\left(  x\right)  =f^{k}\left(
x\right)  $. Now, $\left(  j+1\right)  k=k+jk$, so that%
\[
f^{\left(  j+1\right)  k}=f^{k+jk}=f^{k}\circ f^{jk}%
\]
(since $f^{p+q}=f^{p}\circ f^{q}$ for any $p,q\in\mathbb{N}$). Therefore,%
\begin{equation}
f^{\left(  j+1\right)  k}\left(  x\right)  =\left(  f^{k}\circ f^{jk}\right)
\left(  x\right)  =f^{k}\left(  \underbrace{f^{jk}\left(  x\right)  }%
_{=f^{k}\left(  x\right)  }\right)  =f^{k}\left(  f^{k}\left(  x\right)
\right)  . \label{sol.php.endofunc.order-nfac.a.4}%
\end{equation}
On the other hand, $2k=k+k$, so that $f^{2k}=f^{k+k}=f^{k}\circ f^{k}$ (since
$f^{p+q}=f^{p}\circ f^{q}$ for any $p,q\in\mathbb{N}$). Hence,
\[
f^{2k}\left(  x\right)  =\left(  f^{k}\circ f^{k}\right)  \left(  x\right)
=f^{k}\left(  f^{k}\left(  x\right)  \right)  .
\]
Comparing this with (\ref{sol.php.endofunc.order-nfac.a.4}), we obtain
$f^{\left(  j+1\right)  k}\left(  x\right)  =f^{2k}\left(  x\right)
=f^{k}\left(  x\right)  $ (since $f^{k}\left(  x\right)  =f^{2k}\left(
x\right)  $). This completes the induction step. Thus,
(\ref{sol.php.endofunc.order-nfac.a.goal}) is proved.]

Exercise \ref{exe.php.endofunc.order-nfac} \textbf{(a)} is thus solved.

\textbf{(b)} Let $x\in X$. We shall show that $f^{n!}\left(  x\right)
=f^{2n!}\left(  x\right)  $.

Indeed, Theorem \ref{thm.php.endofunc.th} yields that there exists some
$k\in\left\{  1,2,\ldots,n\right\}  $ such that $f^{k}\left(  x\right)
=f^{2k}\left(  x\right)  $. Consider this $k$.

We have%
\begin{equation}
n!=1\cdot2\cdot\cdots\cdot n=\prod_{i\in\left\{  1,2,\ldots,n\right\}
}i=k\cdot\prod_{\substack{i\in\left\{  1,2,\ldots,n\right\}  ;\\i\neq k}}i
\label{sol.php.endofunc.order-nfac.b.1}%
\end{equation}
(here, we have split off the factor $k$ from the product, because
$k\in\left\{  1,2,\ldots,n\right\}  $). Set $s=\prod_{\substack{i\in\left\{
1,2,\ldots,n\right\}  ;\\i\neq k}}i$. Then, $s$ is a positive integer (since
$s$ is defined as a product of positive integers). Hence, $2s$ is a positive
integer as well.

The equality (\ref{sol.php.endofunc.order-nfac.b.1}) rewrites as $n!=k\cdot s$
(since $s=\prod_{\substack{i\in\left\{  1,2,\ldots,n\right\}  ;\\i\neq k}}i$).
Thus, $n!=k\cdot s=sk$, so that%
\begin{equation}
f^{n!}\left(  x\right)  =f^{sk}\left(  x\right)  =f^{k}\left(  x\right)
\label{sol.php.endofunc.order-nfac.b.3}%
\end{equation}
(by Exercise \ref{exe.php.endofunc.order-nfac} \textbf{(a)}, applied to
$i=s$). Also, $2\underbrace{n!}_{=sk}=2sk$, so that%
\[
f^{2n!}\left(  x\right)  =f^{2sk}\left(  x\right)  =f^{k}\left(  x\right)
\]
(by Exercise \ref{exe.php.endofunc.order-nfac} \textbf{(a)}, applied to
$i=2s$). Comparing this with (\ref{sol.php.endofunc.order-nfac.b.3}), we
obtain $f^{n!}\left(  x\right)  =f^{2n!}\left(  x\right)  $.

Now, forget that we fixed $x$. We thus have proved that $f^{n!}\left(
x\right)  =f^{2n!}\left(  x\right)  $ for each $x\in X$. In other words,
$f^{n!}=f^{2n!}$. This solves Exercise \ref{exe.php.endofunc.order-nfac}
\textbf{(b)}.

\textbf{(c)} Assume that $f$ is a permutation of $X$.

The map $f$ is a permutation, thus bijective (by the definition of a
permutation). Hence, its power $f^{n!}=\underbrace{f\circ f\circ\cdots\circ
f}_{n!\text{ times}}$ is bijective as well (since a composition of bijective
maps is always bijective). Thus, in particular, this map $f^{n!}$ is injective.

Now, let $x\in X$. Exercise \ref{exe.php.endofunc.order-nfac} \textbf{(b)}
yields $f^{n!}=f^{2n!}$. But $2n!=n!+n!$ and thus $f^{2n!}=f^{n!+n!}%
=f^{n!}\circ f^{n!}$. Hence, $f^{n!}=f^{2n!}=f^{n!}\circ f^{n!}$, so that
$f^{n!}\left(  x\right)  =\left(  f^{n!}\circ f^{n!}\right)  \left(  x\right)
=f^{n!}\left(  f^{n!}\left(  x\right)  \right)  $. Therefore, $x=f^{n!}\left(
x\right)  $ (since the map $f^{n!}$ is injective). Consequently,
$f^{n!}\left(  x\right)  =x=\operatorname*{id}\nolimits_{X}\left(  x\right)  $.

Forget that we fixed $x$. We thus have shown that $f^{n!}\left(  x\right)
=\operatorname*{id}\nolimits_{X}\left(  x\right)  $ for each $x\in X$. In
other words, $f^{n!}=\operatorname*{id}\nolimits_{X}$. This solves Exercise
\ref{exe.php.endofunc.order-nfac} \textbf{(c)}.
\end{proof}

[\textit{Remark:} Our above solution to Exercise
\ref{exe.php.endofunc.order-nfac} \textbf{(c)} is not how this exercise is
usually solved. A more common approach to Exercise
\ref{exe.php.endofunc.order-nfac} \textbf{(c)} uses the notion of a
\textit{group} (in the sense of group theory), and the following facts:

\begin{itemize}
\item The group of all permutations of a given $n$-element set $X$ has size
$n!$.

\item If $G$ is a finite group with identity element $e$, then $g^{\left\vert
G\right\vert }=e$ for each $g\in G$.
\end{itemize}

\noindent The first of these two facts is a basic fact in enumerative
combinatorics (see, e.g., our Theorem \ref{thm.enum.perms}, or \cite[Theorem
1.28]{Loehr-BC} or \cite[Corollary 7.82]{detnotes}); the second is a known
result in elementary group theory (see, e.g., \cite[Theorem 9.119]{Loehr-BC}
or \cite[Corollary 10.12]{Elman20} or \cite[Corollary 2.5.9]{Goodman} or
\cite[Corollary 3.2.10]{Steinb06}). Combining these two facts, we conclude
that $f^{n!}=\operatorname*{id}\nolimits_{X}$ for each permutation $f$ of $X$
(since the permutations of $X$ form a finite group with size $n!$ and identity
element $\operatorname*{id}\nolimits_{X}$). This solves Exercise
\ref{exe.php.endofunc.order-nfac} \textbf{(c)} again.]
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.abrec-per.c1-3}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.abrec-per.c1-3}.]This would become really
straightforward if we had used residue classes instead of remainders (i.e.,
the ring $\mathbb{Z}/m$ instead of the set $\left\{  0,1,\ldots,m-1\right\}  $).

\begin{proof}
[Solution to Exercise \ref{exe.php.abrec-per.c1-3}.]We shall use all the
notations that we have introduced in our above solution to Exercise
\ref{exe.php.abrec-per}. We must prove Claims 1, 2 and 3 from this solution.
Let us do this now:

[\textit{Proof of Claim 1:} We have $b\perp m$ (by assumption). In other
words, $\gcd\left(  b,m\right)  =1$ (by the definition of \textquotedblleft
coprime\textquotedblright). But Theorem \ref{thm.ent.gcd.bezout} (applied to
$b$ and $m$ instead of $a$ and $b$) yields that there exist integers
$x\in\mathbb{Z}$ and $y\in\mathbb{Z}$ such that%
\[
\gcd\left(  b,m\right)  =xb+ym.
\]
Consider these $x$ and $y$. Comparing the equalities $\gcd\left(  b,m\right)
=xb+ym$ and $\gcd\left(  b,m\right)  =1$, we obtain%
\[
1=xb+y\underbrace{m}_{\equiv0\operatorname{mod}m}\equiv xb+y\cdot
0=xb=bx\operatorname{mod}m.
\]
In other words,%
\begin{equation}
bx\equiv1\operatorname{mod}m. \label{sol.php.abrec-per.c1-3.C1.pf.1}%
\end{equation}


Now, we define a map $g:M\times M\rightarrow M\times M$ by%
\[
g\left(  \left(  p,q\right)  \right)  =\left(  \overrightarrow{x\left(
q-ap\right)  },p\right)  \ \ \ \ \ \ \ \ \ \ \text{for each }\left(
p,q\right)  \in M\times M.
\]
This is well-defined, since each $\left(  p,q\right)  \in M\times M$ satisfies
$\left(  \overrightarrow{x\left(  q-ap\right)  },p\right)  \in M\times M$
(because $\overrightarrow{x\left(  q-ap\right)  }=\left(  x\left(
q-ap\right)  \right)  \%m\in\left\{  0,1,\ldots,m-1\right\}  =M$ and $p\in M$).

We shall now show that $f\circ g=\operatorname*{id}\nolimits_{M\times M}$.

Indeed, let $\alpha\in M\times M$ be arbitrary. Thus, $\alpha=\left(
p,q\right)  $ for some $p\in M$ and $q\in M$. Consider these $p$ and $q$. From
$\alpha=\left(  p,q\right)  $, we obtain $g\left(  \alpha\right)  =g\left(
\left(  p,q\right)  \right)  =\left(  \overrightarrow{x\left(  q-ap\right)
},p\right)  $ (by the definition of $g$). Set $w=\overrightarrow{x\left(
q-ap\right)  }$. Thus,%
\begin{equation}
w=\overrightarrow{x\left(  q-ap\right)  }\equiv x\left(  q-ap\right)
\operatorname{mod}m \label{sol.php.abrec-per.c1-3.C1.pf.3}%
\end{equation}
(by (\ref{sol.php.abrec-per.ztil=zmodm}), applied to $z=x\left(  q-ap\right)
$). Also,
\[
g\left(  \alpha\right)  =\left(  \overrightarrow{x\left(  q-ap\right)
},p\right)  =\left(  w,p\right)
\]
(since $\overrightarrow{x\left(  q-ap\right)  }=w$). Now,%
\begin{equation}
\left(  f\circ g\right)  \left(  \alpha\right)  =f\left(  \underbrace{g\left(
\alpha\right)  }_{=\left(  w,p\right)  }\right)  =f\left(  \left(  w,p\right)
\right)  =\left(  p,\overrightarrow{ap+bw}\right)
\label{sol.php.abrec-per.c1-3.C1.pf.4}%
\end{equation}
(by the definition of $f$). We will now show that $\overrightarrow{ap+bw}=q$.

Indeed, (\ref{sol.php.abrec-per.ztil=zmodm}) (applied to $z=ap+bw$) yields%
\begin{align*}
\overrightarrow{ap+bw}  &  \equiv ap+b\underbrace{w}_{\substack{\equiv
x\left(  q-ap\right)  \operatorname{mod}m\\\text{(by
(\ref{sol.php.abrec-per.c1-3.C1.pf.3}))}}}\equiv ap+\underbrace{bx}%
_{\substack{\equiv1\operatorname{mod}m\\\text{(by
(\ref{sol.php.abrec-per.c1-3.C1.pf.1}))}}}\left(  q-ap\right) \\
&  \equiv ap+\left(  q-ap\right)  =q\operatorname{mod}m.
\end{align*}
Moreover, $\overrightarrow{ap+bw}\in\left\{  0,1,\ldots,m-1\right\}  $ (since
every integer $z$ satisfies $\overrightarrow{z}=z\%m\in\left\{  0,1,\ldots
,m-1\right\}  $). Hence, Proposition \ref{prop.ent.quorem.props} \textbf{(c)}
(applied to $m$, $q$ and $\overrightarrow{ap+bw}$ instead of $n$, $u$ and $c$)
yields $\overrightarrow{ap+bw}=q\%m$ (since $\overrightarrow{ap+bw}\equiv
q\operatorname{mod}m$).

But from $\left(  p,q\right)  \in M\times M$, we obtain $q\in M=\left\{
0,1,\ldots,m-1\right\}  $. Hence, Proposition \ref{prop.ent.quorem.props}
\textbf{(c)} (applied to $m$, $q$ and $q$ instead of $n$, $u$ and $c$) yields
$q=q\%m$ (since $q\equiv q\operatorname{mod}m$). Comparing this with
$\overrightarrow{ap+bw}=q\%m$, we obtain $\overrightarrow{ap+bw}=q$. Thus,
(\ref{sol.php.abrec-per.c1-3.C1.pf.4}) becomes%
\[
\left(  f\circ g\right)  \left(  \alpha\right)  =\left(
p,\underbrace{\overrightarrow{ap+bw}}_{=q}\right)  =\left(  p,q\right)
=\alpha=\operatorname*{id}\nolimits_{M\times M}\left(  \alpha\right)  .
\]


Forget that we fixed $\alpha$. Thus we have shown that $\left(  f\circ
g\right)  \left(  \alpha\right)  =\operatorname*{id}\nolimits_{M\times
M}\left(  \alpha\right)  $ for each $\alpha\in M\times M$. In other words,
$f\circ g=\operatorname*{id}\nolimits_{M\times M}$.

We could now prove $g\circ f=\operatorname*{id}\nolimits_{M\times M}$ by a
similar argument, and then conclude that the maps $f$ and $g$ are mutually
inverse, whence $f$ is bijective. However, let us instead take a shortcut: The
set $M\times M$ is finite (since $M$ is finite) and clearly satisfies
$\left\vert M\times M\right\vert =\left\vert M\times M\right\vert $. Hence,
Corollary \ref{cor.php.endofunc.fg} (applied to $U=M\times M$ and $V=M\times
M$) yields that the maps $f$ and $g$ are mutually inverse (since $f\circ
g=\operatorname*{id}\nolimits_{M\times M}$). Thus, the map $f$ is invertible,
i.e., bijective. That is, $f$ is a permutation of the set $M\times M$. This
proves Claim 1.]

[\textit{Proof of Claim 2:} Let $i\in\mathbb{N}$. Applying
(\ref{sol.php.abrec-per.ztil=zmodm}) to $z=x_{i+1}$, we obtain
$\overrightarrow{x_{i+1}}\equiv x_{i+1}\operatorname{mod}m$. Hence,
$x_{i+1}\equiv\overrightarrow{x_{i+1}}\operatorname{mod}m$. The same argument
(applied to $x_{i}$ instead of $x_{i+1}$) shows that $x_{i}\equiv
\overrightarrow{x_{i}}\operatorname{mod}m$.

Recall that the sequence $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ is
$\left(  a,b\right)  $-recurrent. In other words, every $n\geq2$ satisfies
$x_{n}=ax_{n-1}+bx_{n-2}$ (by the definition of \textquotedblleft$\left(
a,b\right)  $-recurrent\textquotedblright). Applying this to $n=i+2$, we
obtain $x_{i+2}=a\underbrace{x_{\left(  i+2\right)  -1}}_{=x_{i+1}%
}+b\underbrace{x_{\left(  i+2\right)  -2}}_{=x_{i}}=ax_{i+1}+bx_{i}$. Now,
(\ref{sol.php.abrec-per.ztil=zmodm}) (applied to $z=x_{i+2}$) yields%
\[
x_{i+2}=a\underbrace{x_{i+1}}_{\equiv\overrightarrow{x_{i+1}}%
\operatorname{mod}m}+b\underbrace{x_{i}}_{\equiv\overrightarrow{x_{i}%
}\operatorname{mod}m}\equiv a\overrightarrow{x_{i+1}}+b\overrightarrow{x_{i}%
}\operatorname{mod}m.
\]


Now, Proposition \ref{prop.ent.quo-rem.mod=rem} (applied to $m$, $x_{i+2}$ and
$a\overrightarrow{x_{i+1}}+b\overrightarrow{x_{i}}$ instead of $n$, $u$ and
$v$) yields that $x_{i+2}\equiv a\overrightarrow{x_{i+1}}%
+b\overrightarrow{x_{i}}\operatorname{mod}m$ if and only if $x_{i+2}%
\%m=\left(  a\overrightarrow{x_{i+1}}+b\overrightarrow{x_{i}}\right)  \%m$.
Hence, we have $x_{i+2}\%m=\left(  a\overrightarrow{x_{i+1}}%
+b\overrightarrow{x_{i}}\right)  \%m$ (since we have $x_{i+2}\equiv
a\overrightarrow{x_{i+1}}+b\overrightarrow{x_{i}}\operatorname{mod}m$). The
definition of $\overrightarrow{x_{i+2}}$ now yields%
\begin{equation}
\overrightarrow{x_{i+2}}=x_{i+2}\%m=\left(  a\overrightarrow{x_{i+1}%
}+b\overrightarrow{x_{i}}\right)  \%m=\overrightarrow{a\overrightarrow{x_{i+1}%
}+b\overrightarrow{x_{i}}} \label{sol.php.abrec-per.c1-3.C2.pf.5}%
\end{equation}
(since the definition of $\overrightarrow{a\overrightarrow{x_{i+1}%
}+b\overrightarrow{x_{i}}}$ yields $\overrightarrow{a\overrightarrow{x_{i+1}%
}+b\overrightarrow{x_{i}}}=\left(  a\overrightarrow{x_{i+1}}%
+b\overrightarrow{x_{i}}\right)  \%m$).

Now, the definition of $f$ yields%
\[
f\left(  \left(  \overrightarrow{x_{i}},\overrightarrow{x_{i+1}}\right)
\right)  =\left(  \overrightarrow{x_{i+1}}%
,\underbrace{\overrightarrow{a\overrightarrow{x_{i+1}}+b\overrightarrow{x_{i}%
}}}_{\substack{=\overrightarrow{x_{i+2}}\\\text{(by
(\ref{sol.php.abrec-per.c1-3.C2.pf.5}))}}}\right)  =\left(
\overrightarrow{x_{i+1}},\overrightarrow{x_{i+2}}\right)  .
\]
This proves Claim 2.]

[\textit{Proof of Claim 3:} We shall prove Claim 3 by induction on $i$:

\textit{Induction base:} We have $f^{0}=\operatorname*{id}\nolimits_{M\times
M}$ and thus $f^{0}\left(  \omega\right)  =\operatorname*{id}%
\nolimits_{M\times M}\left(  \omega\right)  =\omega=\left(
\overrightarrow{x_{0}},\overrightarrow{x_{1}}\right)  $ (by the definition of
$\omega$). Now, $\left(  \overrightarrow{x_{0}},\overrightarrow{x_{0+1}%
}\right)  =\left(  \overrightarrow{x_{0}},\overrightarrow{x_{1}}\right)
=f^{0}\left(  \omega\right)  $ (since $f^{0}\left(  \omega\right)  =\left(
\overrightarrow{x_{0}},\overrightarrow{x_{1}}\right)  $). In other words,
Claim 3 holds for $i=0$.

\textit{Induction step:} Let $j\in\mathbb{N}$. Assume (as the induction
hypothesis) that Claim 3 holds for $i=j$. We must show that Claim 3 holds for
$i=j+1$. In other words, we must show that $\left(  \overrightarrow{x_{j+1}%
},\overrightarrow{x_{\left(  j+1\right)  +1}}\right)  =f^{j+1}\left(
\omega\right)  $.

We have assumed that Claim 3 holds for $i=j$. In other words, we have $\left(
\overrightarrow{x_{j}},\overrightarrow{x_{j+1}}\right)  =f^{j}\left(
\omega\right)  $. But $f^{j+1}=f\circ f^{j}$, so that%
\begin{align*}
f^{j+1}\left(  \omega\right)   &  =\left(  f\circ f^{j}\right)  \left(
\omega\right)  =f\left(  \underbrace{f^{j}\left(  \omega\right)  }_{=\left(
\overrightarrow{x_{j}},\overrightarrow{x_{j+1}}\right)  }\right)  =f\left(
\left(  \overrightarrow{x_{j}},\overrightarrow{x_{j+1}}\right)  \right) \\
&  =\left(  \overrightarrow{x_{j+1}},\overrightarrow{x_{j+2}}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by Claim 2, applied to }i=j\right) \\
&  =\left(  \overrightarrow{x_{j+1}},\overrightarrow{x_{\left(  j+1\right)
+1}}\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }j+2=\left(  j+1\right)
+1\right)  .
\end{align*}
In other words, $\left(  \overrightarrow{x_{j+1}},\overrightarrow{x_{\left(
j+1\right)  +1}}\right)  =f^{j+1}\left(  \omega\right)  $. This completes the
induction step. Thus, Claim 3 is proven.]

We have now proved Claims 1, 2 and 3; thus, Exercise
\ref{exe.php.abrec-per.c1-3} is solved.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.abrec-per2}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.abrec-per2}.]The slickest way to solve
Exercise \ref{exe.php.abrec-per2} is probably by using the following variant
of Theorem \ref{thm.php.perm.1} \textbf{(a)}:

\begin{theorem}
\label{thm.php.perm.1a-fixed}Let $X$ be a finite set. Let $n=\left\vert
X\right\vert $. Assume that $n>1$. Let $p\in X$. Let $f:X\rightarrow X$ be a
permutation of $X$ satisfying $f\left(  p\right)  =p$. Let $x\in X$. Then,
there exists a $k\in\left\{  1,2,\ldots,n-1\right\}  $ such that $f^{k}\left(
x\right)  =x$.
\end{theorem}

\begin{proof}
[Proof of Theorem \ref{thm.php.perm.1a-fixed}.]Informally, the idea is the
following: If $x=p$, then this is clear (just set $k=1$). But if $x\neq p$,
then we can \textquotedblleft throw away\textquotedblright\ the element $p$
from the set $X$ (indeed, $f\left(  p\right)  =p$ shows that $p$ does not
\textquotedblleft interfere\textquotedblright\ with the remaining elements of
$X$), and obtain an $\left(  n-1\right)  $-element set $X\setminus\left\{
p\right\}  $, to which we can apply Theorem \ref{thm.php.perm.1} \textbf{(a)}.

Here are the details of this argument: It is easy to see that Theorem
\ref{thm.php.perm.1a-fixed} holds if $x=p$\ \ \ \ \footnote{\textit{Proof.}
Assume that $x=p$. Note that $n-1>0$ (since $n>1$), so that $n-1$ is a
positive integer. Hence, $1\in\left\{  1,2,\ldots,n-1\right\}  $. Furthermore,
$\underbrace{f^{1}}_{=f}\left(  p\right)  =f\left(  p\right)  =p$. In other
words, $f^{1}\left(  x\right)  =x$ (since $x=p$). So the element $1\in\left\{
1,2,\ldots,n-1\right\}  $ satisfies $f^{1}\left(  x\right)  =x$. Hence, there
exists a $k\in\left\{  1,2,\ldots,n-1\right\}  $ such that $f^{k}\left(
x\right)  =x$ (namely, $k=1$). In other words, the claim of Theorem
\ref{thm.php.perm.1a-fixed} holds. Thus, Theorem \ref{thm.php.perm.1a-fixed}
is proved under the assumption that $x=p$.}. Hence, for the rest of this
proof, we WLOG assume that $x\neq p$.

The map $f$ is a permutation of $X$; thus, $f$ is a bijection. Hence, $f$ is
bijective, thus injective.

Set $Y=X\setminus\left\{  p\right\}  $. Thus, $\left\vert Y\right\vert
=\left\vert X\setminus\left\{  p\right\}  \right\vert =\left\vert X\right\vert
-1$ (since $p\in X$), so that $\left\vert Y\right\vert =\underbrace{\left\vert
X\right\vert }_{=n}-1=n-1$. In particular, the set $Y$ is finite.

Combining $x\in X$ with $x\neq p$, we obtain $x\in X\setminus\left\{
p\right\}  =Y$ (since $Y=X\setminus\left\{  p\right\}  $).

For each $y\in Y$, we have $f\left(  y\right)  \in Y$%
\ \ \ \ \footnote{\textit{Proof.} Let $y\in Y$. Then, $y\in Y=X\setminus
\left\{  p\right\}  $; in other words, $y\in X$ and $y\neq p$.
\par
But the map $f$ is injective. Therefore, if we had $f\left(  y\right)
=f\left(  p\right)  $, then we would have $y=p$, which would contradict $y\neq
p$. Hence, we cannot have $f\left(  y\right)  =f\left(  p\right)  $.
Therefore, $f\left(  y\right)  \neq f\left(  p\right)  =p$. Combining
$f\left(  y\right)  \in X$ with $f\left(  y\right)  \neq p$, we obtain
$f\left(  y\right)  \in X\setminus\left\{  p\right\}  =Y$. Qed.}. Thus, we can
define the map%
\begin{align*}
g:Y  &  \rightarrow Y,\\
y  &  \mapsto f\left(  y\right)  .
\end{align*}
This map $g$ is \textquotedblleft essentially just\textquotedblright\ the map
$f$, except with the element $p$ removed from its domain and target.

It is easy to see (by a straightforward induction) that
\begin{equation}
g^{k}\left(  x\right)  =f^{k}\left(  x\right)  \ \ \ \ \ \ \ \ \ \ \text{for
each }k\in\mathbb{N}. \label{pf.thm.php.perm.1a-fixed.gkfk}%
\end{equation}
\footnote{\textit{Proof of (\ref{pf.thm.php.perm.1a-fixed.gkfk}):} We shall
prove (\ref{pf.thm.php.perm.1a-fixed.gkfk}) by induction on $k$:
\par
\textit{Induction base:} We have $g^{0}=\operatorname*{id}\nolimits_{Y}$ and
thus $g^{0}\left(  x\right)  =\operatorname*{id}\nolimits_{Y}\left(  x\right)
=x$. Also, $f^{0}=\operatorname*{id}\nolimits_{X}$ and thus $f^{0}\left(
x\right)  =\operatorname*{id}\nolimits_{X}\left(  x\right)  =x$. Hence,
$g^{0}\left(  x\right)  =x=f^{0}\left(  x\right)  $. In other words,
(\ref{pf.thm.php.perm.1a-fixed.gkfk}) holds for $k=0$.
\par
\textit{Induction step:} Let $\ell\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{pf.thm.php.perm.1a-fixed.gkfk}) holds for $k=\ell$. We
must prove that (\ref{pf.thm.php.perm.1a-fixed.gkfk}) holds for $k=\ell+1$. In
other words, we must prove that $g^{\ell+1}\left(  x\right)  =f^{\ell
+1}\left(  x\right)  $.
\par
We have assumed that (\ref{pf.thm.php.perm.1a-fixed.gkfk}) holds for $k=\ell$.
In other words, $g^{\ell}\left(  x\right)  =f^{\ell}\left(  x\right)  $. Now,%
\begin{align*}
\underbrace{g^{\ell+1}}_{=g\circ g^{\ell}}\left(  x\right)   &  =\left(
g\circ g^{\ell}\right)  \left(  x\right)  =g\left(  \underbrace{g^{\ell
}\left(  x\right)  }_{=f^{\ell}\left(  x\right)  }\right)  =g\left(  f^{\ell
}\left(  x\right)  \right) \\
&  =f\left(  f^{\ell}\left(  x\right)  \right)  \ \ \ \ \ \ \ \ \ \ \left(
\text{by the definition of }g\right) \\
&  =\underbrace{\left(  f\circ f^{\ell}\right)  }_{=f^{\ell+1}}\left(
x\right)  =f^{\ell+1}\left(  x\right)  .
\end{align*}
This completes the induction step. Thus, (\ref{pf.thm.php.perm.1a-fixed.gkfk})
is proved.}

The map $g$ is injective\footnote{\textit{Proof.} This is a straightforward
consequence of the fact that $f$ is injective. In more detail: Let $a,b\in Y$
satisfy $g\left(  a\right)  =g\left(  b\right)  $. The definition of $g$
yields $g\left(  a\right)  =f\left(  a\right)  $ and $g\left(  b\right)
=f\left(  b\right)  $. Hence, $f\left(  a\right)  =g\left(  a\right)
=g\left(  b\right)  =f\left(  b\right)  $. Since $f$ is injective, this
entails $a=b$. Now, forget that we fixed $a,b$. We thus have shown that if
$a,b\in Y$ satisfy $g\left(  a\right)  =g\left(  b\right)  $, then $a=b$. In
other words, the map $g$ is injective.}. Thus, $g:Y\rightarrow Y$ is an
injective map. Hence, Corollary \ref{cor.php.endofunc.perm} \textbf{(a)
}(applied to $Y$ and $g$ instead of $X$ and $f$) yields that $g$ is a
permutation of $Y$. Hence, Theorem \ref{thm.php.perm.1} \textbf{(a)} (applied
to $Y$, $n-1$ and $g$ instead of $X$, $n$ and $f$) yields that there exists a
$k\in\left\{  1,2,\ldots,n-1\right\}  $ such that $g^{k}\left(  x\right)  =x$
(since $n-1=\left\vert Y\right\vert $ and $x\in Y$). In view of
(\ref{pf.thm.php.perm.1a-fixed.gkfk}), this rewrites as follows: There exists
a $k\in\left\{  1,2,\ldots,n-1\right\}  $ such that $f^{k}\left(  x\right)
=x$. This proves Theorem \ref{thm.php.perm.1a-fixed}.
\end{proof}

Now, we can solve Exercise \ref{exe.php.abrec-per2}:

\begin{proof}
[Solution to Exercise \ref{exe.php.abrec-per2}.]We shall use all notations
introduced in our above solution to Exercise \ref{exe.php.abrec-per}.

The definition of $\overrightarrow{0}$ yields $\overrightarrow{0}=0\%m=0$.
Now, the definition of $f$ yields%
\begin{align*}
f\left(  \left(  0,0\right)  \right)   &  =\left(  0,\overrightarrow{a\cdot
0+b\cdot0}\right)  =\left(  0,\overrightarrow{0}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }a\cdot0+b\cdot0=0\right) \\
&  =\left(  0,0\right)  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }%
\overrightarrow{0}=0\right)  .
\end{align*}
We also know (from Claim 1 in our solution to Exercise \ref{exe.php.abrec-per}%
) that the map $f$ is bijective. Hence, $f$ is a permutation of the set
$M\times M$. Moreover, from $m>1$, we obtain $m^{2}>1$. Hence, we can apply
Theorem \ref{thm.php.perm.1a-fixed} to $X=M\times M$, $n=m^{2}$, $p=\left(
0,0\right)  $ and $x=\omega$ (since $\left\vert M\times M\right\vert =m^{2}$).
This yields that there exists a $k\in\left\{  1,2,\ldots,m^{2}-1\right\}  $
such that $f^{k}\left(  \omega\right)  =\omega$. Consider this $k$.

Now, it is easy to see that the sequence $\left(  x_{0}\%m,x_{1}%
\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic (indeed, this can be shown
exactly as in the solution to Exercise \ref{exe.php.abrec-per}). Thus, we have
found a $k\in\left\{  1,2,\ldots,m^{2}-1\right\}  $ such that the sequence
$\left(  x_{0}\%m,x_{1}\%m,x_{2}\%m,\ldots\right)  $ is $k$-periodic. This
solves Exercise \ref{exe.php.abrec-per2}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.nt.bw2004-9}}

\begin{proof}
[Discussion of Exercise \ref{exe.nt.bw2004-9}.]Exercise \ref{exe.nt.bw2004-9}
was problem 9 on the
\href{http://www.math.olympiaadid.ut.ee/eng/html/?id=bw}{Baltic Way
mathematical contest} 2004; it has been discussed in \cite[Aufgabe
2.20]{ngrin} and in \url{https://artofproblemsolving.com/community/c6h20213} .
We can regard it as a more complicated variant of Exercise \ref{exe.nt.p1}
(the solution uses the same idea, but more work is needed to apply it). The
following is probably the simplest solution:

\begin{proof}
[Solution to Exercise \ref{exe.nt.bw2004-9}.]Define $n+1$ integers
$b_{0},b_{1},\ldots,b_{n}$ as follows:

\begin{itemize}
\item For each $i\in\left\{  0,1,\ldots,n-1\right\}  $, set
\begin{equation}
b_{i}=a_{1}+a_{2}+\cdots+a_{i}. \label{sol.nt.bw2004-9.bi=}%
\end{equation}
(Thus, $b_{1}=a_{1}$ and $b_{0}=\left(  \text{empty sum}\right)  =0$.)

\item Set
\begin{equation}
b_{n}=a_{2}. \label{sol.nt.bw2004-9.bn=}%
\end{equation}

\end{itemize}

Recall that the remainder of an integer $u$ upon division by $n$ is denoted by
$u\%n$. Now, the $n+1$ remainders
\[
b_{0}\%n,\ \ b_{1}\%n,\ \ b_{2}\%n,\ \ \ldots,\ \ b_{n}\%n
\]
are $n+1$ elements of the $n$-element set $\left\{  0,1,\ldots,n-1\right\}  $
(since they are remainders upon division by $n$), and thus at least two of
them must be equal (by the Pigeonhole Principle\footnote{To be more specific:
by Corollary \ref{cor.php.php-inj-dist} (applied to $n+1$, $\left\{
0,1,\ldots,n-1\right\}  $ and $b_{i-1}\%n$ instead of $m$, $V$ and $a_{i}$%
).}). In other words, there exist two integers $u$ and $v$ with $0\leq u<v\leq
n$ and $b_{u}\%n=b_{v}\%n$. Consider these $u$ and $v$. From $u<v$, we obtain
$u+1\leq v$. Also, $0\leq u$, thus $1\leq u+1\leq v\leq n$. Hence, both $u+1$
and $v$ belong to $\left\{  1,2,\ldots,n\right\}  $. Moreover, from $u+1\leq
v$, we see that the set $\left\{  u+1,u+2,\ldots,v\right\}  $ is nonempty.

We have $u<v\leq n$ and thus $u\in\left\{  0,1,\ldots,n-1\right\}  $ (since
$u$ is a nonnegative integer). Therefore, (\ref{sol.nt.bw2004-9.bi=}) (applied
to $i=u$) yields $b_{u}=a_{1}+a_{2}+\cdots+a_{u}$. Furthermore, $\left\{
1,2,\ldots,u\right\}  \subseteq\left\{  1,2,\ldots,n-1\right\}  $ (since
$u\in\left\{  0,1,\ldots,n-1\right\}  $).

The integers $b_{v}$ and $b_{u}$ leave the same remainder when divided by $n$
(since $b_{v}\%n=b_{u}\%n$); thus, $b_{v}\equiv b_{u}\operatorname{mod}n$ (by
Proposition \ref{prop.ent.quo-rem.mod=rem}, applied to $b_{v}$ and $b_{u}$
instead of $u$ and $v$). In other words, $n\mid b_{v}-b_{u}$.

Now, we are in one of the following two cases:

\textit{Case 1:} We have $v\neq n$.

\textit{Case 2:} We have $v=n$.

Let us consider Case 1 first. In this case, we have $v\neq n$. Hence, $v<n$
(since $v\leq n$), so that $v\leq n-1$ (since $v$ and $n$ are integers). Thus,
$v\in\left\{  0,1,\ldots,n-1\right\}  $ (since $0\leq v$). Therefore,
(\ref{sol.nt.bw2004-9.bi=}) (applied to $i=v$) yields $b_{v}=a_{1}%
+a_{2}+\cdots+a_{v}$. Also, the set $\left\{  u+1,u+2,\ldots,v\right\}  $ is
nonempty (as we have seen) and is a subset of $\left\{  1,2,\ldots
,n-1\right\}  $ (since $1\leq u+1$ and $v\leq n-1$).

Now, recall that $n\mid b_{v}-b_{u}$. In view of%
\begin{align*}
\underbrace{b_{v}}_{=a_{1}+a_{2}+\cdots+a_{v}}-\underbrace{b_{u}}%
_{=a_{1}+a_{2}+\cdots+a_{u}}  &  =\left(  a_{1}+a_{2}+\cdots+a_{v}\right)
-\left(  a_{1}+a_{2}+\cdots+a_{u}\right) \\
&  =a_{u+1}+a_{u+2}+\cdots+a_{v}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}u<v\right) \\
&  =\sum_{i\in\left\{  u+1,u+2,\ldots,v\right\}  }a_{i},
\end{align*}
this rewrites as $n\mid\sum_{i\in\left\{  u+1,u+2,\ldots,v\right\}  }a_{i}$.
Since we know that $\left\{  u+1,u+2,\ldots,v\right\}  $ is a nonempty subset
of $\left\{  1,2,\ldots,n-1\right\}  $, we can thus conclude that there exists
a nonempty subset $I$ of $\left\{  1,2,\ldots,n-1\right\}  $ such that
$n\mid\sum_{i\in I}a_{i}$ (namely, $I=\left\{  u+1,u+2,\ldots,v\right\}  $).
Hence, Exercise \ref{exe.nt.bw2004-9} is solved in Case 1.

Let us now consider Case 2. In this case, we have $v=n$. Thus, $b_{v}%
=b_{n}=a_{2}$ (by (\ref{sol.nt.bw2004-9.bn=})). Recall that%
\[
n\mid\underbrace{b_{v}}_{=a_{2}}-b_{u}=a_{2}-b_{u}\mid-\left(  a_{2}%
-b_{u}\right)  =b_{u}-a_{2}.
\]


Note that $n\geq3$, so that $n-1\geq2\geq1$ and thus $1\in\left\{
0,1,\ldots,n-1\right\}  $. Hence, (\ref{sol.nt.bw2004-9.bi=}) (applied to
$i=1$) yields $b_{1}=a_{1}$. If we had $u=1$, then we would have $b_{u}%
=b_{1}=a_{1}$ and therefore
\[
n\mid\underbrace{b_{u}}_{=a_{1}}-a_{2}=a_{1}-a_{2},
\]
which would contradict the assumption $n\nmid a_{1}-a_{2}$. Hence, we cannot
have $u=1$. Thus, we have $u\neq1$.

We are now in one of the following two subcases:

\textit{Subcase 2.1:} We have $u=0$.

\textit{Subcase 2.2:} We have $u\neq0$.

Let us consider Subcase 2.1 first. In this subcase, we have $u=0$. But
$0\in\left\{  0,1,\ldots,n-1\right\}  $ (since $n-1\geq1\geq0$); therefore,
(\ref{sol.nt.bw2004-9.bi=}) (applied to $i=0$) yields $b_{0}=a_{1}%
+a_{2}+\cdots+a_{0}=\left(  \text{empty sum}\right)  =0$. Now, from $u=0$, we
obtain $b_{u}=b_{0}=0$. But
\[
n\mid\underbrace{b_{v}}_{=a_{2}}-\underbrace{b_{u}}_{=0}=a_{2}=\sum
_{i\in\left\{  2\right\}  }a_{i}.
\]
Note that $2\in\left\{  1,2,\ldots,n-1\right\}  $ (because $n-1\geq2$), and
therefore $\left\{  2\right\}  $ is a nonempty subset of $\left\{
1,2,\ldots,n-1\right\}  $. Thus, we conclude that there exists a nonempty
subset $I$ of $\left\{  1,2,\ldots,n-1\right\}  $ such that $n\mid\sum_{i\in
I}a_{i}$ (namely, $I=\left\{  2\right\}  $), because we have $n\mid\sum
_{i\in\left\{  2\right\}  }a_{i}$. Hence, Exercise \ref{exe.nt.bw2004-9} is
solved in Subcase 2.1.

Let us finally consider Subcase 2.2. In this subcase, we have $u\neq0$. But
$u$ is a nonnegative integer (since $0\leq u$) and satisfies $u\neq0$ and
$u\neq1$. Hence, $u\geq2$. Thus, $2\in\left\{  1,2,\ldots,u\right\}  $.
Moreover, the set $\left\{  1,2,\ldots,u\right\}  \setminus\left\{  2\right\}
$ contains (at least) the element $1$, and thus is nonempty. This nonempty set
$\left\{  1,2,\ldots,u\right\}  \setminus\left\{  2\right\}  $ is furthermore
a subset of $\left\{  1,2,\ldots,n-1\right\}  $ (since $\left\{
1,2,\ldots,u\right\}  \setminus\left\{  2\right\}  \subseteq\left\{
1,2,\ldots,u\right\}  \subseteq\left\{  1,2,\ldots,n-1\right\}  $).

Recall that%
\[
b_{u}=a_{1}+a_{2}+\cdots+a_{u}=\sum_{i\in\left\{  1,2,\ldots,u\right\}  }%
a_{i}=a_{2}+\sum_{i\in\left\{  1,2,\ldots,u\right\}  \setminus\left\{
2\right\}  }a_{i}%
\]
(here, we have split off the addend for $i=2$ from the sum, since
$2\in\left\{  1,2,\ldots,u\right\}  $). Therefore,%
\begin{equation}
b_{u}-a_{2}=\sum_{i\in\left\{  1,2,\ldots,u\right\}  \setminus\left\{
2\right\}  }a_{i}. \label{sol.nt.bw2004-9.c2.2.1}%
\end{equation}


Now, recall that $n\mid b_{u}-a_{2}$. In view of (\ref{sol.nt.bw2004-9.c2.2.1}%
), this rewrites as $n\mid\sum_{i\in\left\{  1,2,\ldots,u\right\}
\setminus\left\{  2\right\}  }a_{i}$. Since we know that $\left\{
1,2,\ldots,u\right\}  \setminus\left\{  2\right\}  $ is a nonempty subset of
$\left\{  1,2,\ldots,n-1\right\}  $, we can thus conclude that there exists a
nonempty subset $I$ of $\left\{  1,2,\ldots,n-1\right\}  $ such that
$n\mid\sum_{i\in I}a_{i}$ (namely, $I=\left\{  1,2,\ldots,u\right\}
\setminus\left\{  2\right\}  $). Hence, Exercise \ref{exe.nt.bw2004-9} is
solved in Subcase 2.2.

We have now solved Exercise \ref{exe.nt.bw2004-9} in both Subcases 2.1 and
2.2. Hence, Exercise \ref{exe.nt.bw2004-9} holds in Case 2.

We have now solved Exercise \ref{exe.nt.bw2004-9} in both Cases 1 and 2. Thus,
the solution to Exercise \ref{exe.nt.bw2004-9} is complete.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.jacobi}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.jacobi}.]Exercise \ref{exe.php.jacobi}
\textbf{(c)} is one of the simplest parts of the
\href{https://en.wikipedia.org/wiki/Equidistribution_theorem}{\textit{equidistribution
theorem}} (and Exercise \ref{exe.php.jacobi} \textbf{(a)} and Exercise
\ref{exe.php.jacobi} \textbf{(b)} are weaker versions of it, which are useful
as stepping stones in the solution of Exercise \ref{exe.php.jacobi}
\textbf{(c)}). A deeper part of the equidistribution theorem claims that if
$x\in\mathbb{R}$ is irrational, then the sequence $\left(
\operatorname*{frac}\left(  0x\right)  ,\operatorname*{frac}\left(  1x\right)
,\operatorname*{frac}\left(  2x\right)  ,\ldots\right)  $ is uniformly
distributed on the half-open interval $\left[  0,1\right)  $ (that is, roughly
speaking, its entries are equally likely to end up near any point of this
interval\footnote{Don't mistake this for a rigorous statement.}). However,
Exercise \ref{exe.php.jacobi} \textbf{(c)} is already useful enough for some
applications. Exercise \ref{exe.php.jacobi} \textbf{(d)} is a sample
application of Exercise \ref{exe.php.jacobi} \textbf{(c)}.

Our solution to Exercise \ref{exe.php.jacobi} \textbf{(a)} will rely on the
following two simple properties of floors and fractional parts:

\begin{lemma}
\label{lem.frac.explicit}Let $x\in\mathbb{R}$ and $r\in\mathbb{Z}$ satisfy
$r\leq x<r+1$. Then, $\left\lfloor x\right\rfloor =r$ and
$\operatorname*{frac}x=x-r$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.frac.explicit}.]We know that $r$ is an integer (since
$r\in\mathbb{Z}$). This integer $r$ is $\leq x$ (since $r\leq x$), whereas the
next integer $r+1$ is no longer $\leq x$ (since $x<r+1$). Hence, $r$ is the
largest integer that is $\leq x$. In other words, $r$ is $\left\lfloor
x\right\rfloor $ (since $\left\lfloor x\right\rfloor $ was defined to be the
largest integer that is $\leq x$). In other words, $\left\lfloor
x\right\rfloor =r$. Furthermore, the definition of $\operatorname*{frac}x$
yields $\operatorname*{frac}x=x-\underbrace{\left\lfloor x\right\rfloor }%
_{=r}=x-r$. Thus, Lemma \ref{lem.frac.explicit} is proved.
\end{proof}

\begin{lemma}
\label{lem.frac.fraca-b}Let $a,b\in\mathbb{R}$. Then:

\textbf{(a)} If $\operatorname*{frac}a\geq\operatorname*{frac}b$, then
$\operatorname*{frac}\left(  a-b\right)  =\operatorname*{frac}%
a-\operatorname*{frac}b$.

\textbf{(b)} If $\operatorname*{frac}a<\operatorname*{frac}b$, then
$\operatorname*{frac}\left(  a-b\right)  =\operatorname*{frac}%
a-\operatorname*{frac}b+1$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.frac.fraca-b}.]Let $p=\left\lfloor a\right\rfloor $
and $q=\left\lfloor b\right\rfloor $. Thus, $p$ and $q$ are integers (since
the floor of any real number is an integer). In other words, $p\in\mathbb{Z}$
and $q\in\mathbb{Z}$. Hence, $p-q\in\mathbb{Z}$ and $p-q-1\in\mathbb{Z}$.

The definition of $\operatorname*{frac}a$ yields $\operatorname*{frac}%
a=a-\underbrace{\left\lfloor a\right\rfloor }_{=p}=a-p$. The definition of
$\operatorname*{frac}b$ yields $\operatorname*{frac}%
b=b-\underbrace{\left\lfloor b\right\rfloor }_{=q}=b-q$.

The chain of inequalities (\ref{sol.floor.hermite.lem1}) (applied to $x=a$)
says that $\left\lfloor a\right\rfloor \leq a<\left\lfloor a\right\rfloor +1$.
In view of $p=\left\lfloor a\right\rfloor $, this rewrites as $p\leq a<p+1$.
The same argument (applied to $b$ and $q$ instead of $a$ and $p$) yields
$q\leq b<q+1$.

\textbf{(a)} Assume that $\operatorname*{frac}a\geq\operatorname*{frac}b$.
This rewrites as $a-p\geq b-q$ (since $\operatorname*{frac}a=a-p$ and
$\operatorname*{frac}b=b-q$). In other words, $a+q\geq b+p$. In other words,
$a-b\geq p-q$. That is, $p-q\leq a-b$. Moreover, $\underbrace{a}%
_{<p+1}-\underbrace{b}_{\substack{\geq q\\\text{(since }q\leq b\text{)}%
}}<p+1-q=p-q+1$. Hence, $p-q\leq a-b<p-q+1$. Therefore, Lemma
\ref{lem.frac.explicit} (applied to $x=a-b$ and $r=p-q$) yields that
$\left\lfloor a-b\right\rfloor =p-q$ and $\operatorname*{frac}\left(
a-b\right)  =\left(  a-b\right)  -\left(  p-q\right)  $. Hence,%
\[
\operatorname*{frac}\left(  a-b\right)  =\left(  a-b\right)  -\left(
p-q\right)  =\underbrace{\left(  a-p\right)  }%
_{\substack{=\operatorname*{frac}a\\\text{(since }\operatorname*{frac}%
a=a-p\text{)}}}-\underbrace{\left(  b-q\right)  }%
_{\substack{=\operatorname*{frac}b\\\text{(since }\operatorname*{frac}%
b=b-q\text{)}}}=\operatorname*{frac}a-\operatorname*{frac}b.
\]
This proves Lemma \ref{lem.frac.fraca-b} \textbf{(a)}.

\textbf{(b)} Assume that $\operatorname*{frac}a<\operatorname*{frac}b$. This
rewrites as $a-p<b-q$ (since $\operatorname*{frac}a=a-p$ and
$\operatorname*{frac}b=b-q$). In other words, $a+q<b+p$. In other words,
$a-b<p-q$. Hence, $a-b<p-q=\left(  p-q-1\right)  +1$. Moreover,
$\underbrace{a}_{\substack{\geq p\\\text{(since }p\leq a\text{)}%
}}-\underbrace{b}_{<q+1}>p-\left(  q+1\right)  =p-q-1$. Hence, $p-q-1\leq
a-b<\left(  p-q-1\right)  +1$. Therefore, Lemma \ref{lem.frac.explicit}
(applied to $x=a-b$ and $r=p-q-1$) yields that $\left\lfloor a-b\right\rfloor
=p-q-1$ and $\operatorname*{frac}\left(  a-b\right)  =\left(  a-b\right)
-\left(  p-q-1\right)  $. Hence,%
\begin{align*}
\operatorname*{frac}\left(  a-b\right)   &  =\left(  a-b\right)  -\left(
p-q-1\right)  =\underbrace{\left(  a-p\right)  }%
_{\substack{=\operatorname*{frac}a\\\text{(since }\operatorname*{frac}%
a=a-p\text{)}}}-\underbrace{\left(  b-q\right)  }%
_{\substack{=\operatorname*{frac}b\\\text{(since }\operatorname*{frac}%
b=b-q\text{)}}}+1\\
&  =\operatorname*{frac}a-\operatorname*{frac}b+1.
\end{align*}
This proves Lemma \ref{lem.frac.fraca-b} \textbf{(b)}.
\end{proof}

\begin{proof}
[Solution to Exercise \ref{exe.php.jacobi}.]\textbf{(a)} Let $x\in\mathbb{R}$.
Let $n$ be a positive integer.

The numbers $\dfrac{1}{n},\dfrac{2}{n},\ldots,\dfrac{n-1}{n}$ subdivide the
half-open interval $\left[  0,1\right)  $ into $n$ equally sized segments.
Denote these segments (themselves half-open intervals) by $I_{1},I_{2}%
,\ldots,I_{n}$. More precisely: Define $n$ half-open intervals $I_{1}%
,I_{2},\ldots,I_{n}$ by%
\[
I_{1}=\left[  \dfrac{0}{n},\dfrac{1}{n}\right)  ,\ \ \ \ \ \ \ \ \ \ \ \ I_{2}%
=\left[  \dfrac{1}{n},\dfrac{2}{n}\right)  ,\ \ \ \ \ \ \ \ \ \ \ \ \ldots
,\ \ \ \ \ \ \ \ \ \ \ \ I_{n}=\left[  \dfrac{n-1}{n},\dfrac{n}{n}\right)
\]
(that is, $I_{k}=\left[  \dfrac{k-1}{n},\dfrac{k}{n}\right)  $ for each
$k\in\left\{  1,2,\ldots,n\right\}  $). The union of these $n$ intervals is
$I_{1}\cup I_{2}\cup\cdots\cup I_{n}=\left[  0,1\right)  $; furthermore, these
$n$ intervals $I_{1},I_{2},\ldots,I_{n}$ are disjoint. Hence, each number
$y\in\left[  0,1\right)  $ lies in exactly one of these $n$ intervals
$I_{1},I_{2},\ldots,I_{n}$.

Now, consider the $n+1$ numbers $\operatorname*{frac}\left(  0x\right)
,\operatorname*{frac}\left(  1x\right)  ,\ldots,\operatorname*{frac}\left(
nx\right)  $. Each of these $n+1$ numbers belongs to $\left[  0,1\right)  $
(since $\operatorname*{frac}z\in\left[  0,1\right)  $ for each $z\in
\mathbb{R}$), and thus must lie in one of the $n$ intervals $I_{1}%
,I_{2},\ldots,I_{n}$ (since we know that each number $y\in\left[  0,1\right)
$ lies in exactly one of these $n$ intervals $I_{1},I_{2},\ldots,I_{n}$).
Hence, by the Pigeonhole Principle, we see that at least two of these $n+1$
numbers $\operatorname*{frac}\left(  0x\right)  ,\operatorname*{frac}\left(
1x\right)  ,\ldots,\operatorname*{frac}\left(  nx\right)  $ must belong to one
and the same of the $n$ intervals $I_{1},I_{2},\ldots,I_{n}$%
\ \ \ \ \footnote{Here is this argument in more detail:
\par
Let $i\in\left\{  0,1,\ldots,n\right\}  $. Then,
\begin{align*}
\operatorname*{frac}\left(  ix\right)   &  \in\left[  0,1\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\operatorname*{frac}z\in\left[
0,1\right)  \text{ for each }z\in\mathbb{R}\right) \\
&  =I_{1}\cup I_{2}\cup\cdots\cup I_{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since
}I_{1}\cup I_{2}\cup\cdots\cup I_{n}=\left[  0,1\right)  \right)  .
\end{align*}
Hence, there exists some $k\in\left\{  1,2,\ldots,n\right\}  $ such that
$\operatorname*{frac}\left(  ix\right)  \in I_{k}$. Fix such a $k$, and denote
it by $b_{i}$. (Note that this $k$ is unique, since the $n$ intervals
$I_{1},I_{2},\ldots,I_{n}$ are disjoint; but we will not need this in our
argument.)
\par
Forget that we fixed $i$. We thus have defined an element $b_{i}\in\left\{
1,2,\ldots,n\right\}  $ for each $i\in\left\{  0,1,\ldots,n\right\}  $. In
other words, we have defined $n+1$ elements $b_{0},b_{1},\ldots,b_{n}%
\in\left\{  1,2,\ldots,n\right\}  $. Hence, Corollary
\ref{cor.php.php-inj-dist} (applied to $\left\{  1,2,\ldots,n\right\}  $,
$n+1$ and $b_{i-1}$ instead of $V$, $m$ and $a_{i}$) yields that at least two
of these $n+1$ elements $b_{0},b_{1},\ldots,b_{n}$ are equal. In other words,
there exist two numbers $i,j\in\left\{  0,1,\ldots,n\right\}  $ such that
$i<j$ and $b_{i}=b_{j}$. Consider these $i,j$.
\par
Our definition of $b_{i}$ shows that $b_{i}$ is a $k\in\left\{  1,2,\ldots
,n\right\}  $ satisfying $\operatorname*{frac}\left(  ix\right)  \in I_{k}$.
Hence, $\operatorname*{frac}\left(  ix\right)  \in I_{b_{i}}$. The same
argument (applied to $j$ instead of $i$) yields $\operatorname*{frac}\left(
jx\right)  \in I_{b_{j}}$. In view of $b_{i}=b_{j}$, this rewrites as
$\operatorname*{frac}\left(  jx\right)  \in I_{b_{i}}$.
\par
Now, both $\operatorname*{frac}\left(  ix\right)  $ and $\operatorname*{frac}%
\left(  jx\right)  $ belong to $I_{b_{i}}$. Hence, $\operatorname*{frac}%
\left(  ix\right)  $ and $\operatorname*{frac}\left(  jx\right)  $ belong to
one and the same of the $n$ intervals $I_{1},I_{2},\ldots,I_{n}$ (namely, to
$I_{b_{i}}$). Since $i<j$, this shows that at least two of these $n+1$ numbers
$\operatorname*{frac}\left(  0x\right)  ,\operatorname*{frac}\left(
1x\right)  ,\ldots,\operatorname*{frac}\left(  nx\right)  $ must belong to one
and the same of the $n$ intervals $I_{1},I_{2},\ldots,I_{n}$.
\par
Note that we have not used the fact that the intervals $I_{1},I_{2}%
,\ldots,I_{n}$ are disjoint.}. In other words, there exist two elements $i$
and $j$ of $\left\{  0,1,\ldots,n\right\}  $ such that $i<j$ and such that the
two numbers $\operatorname*{frac}\left(  ix\right)  $ and
$\operatorname*{frac}\left(  jx\right)  $ belong to one and the same of the
$n$ intervals $I_{1},I_{2},\ldots,I_{n}$. Consider these $i$ and $j$.

The two numbers $\operatorname*{frac}\left(  ix\right)  $ and
$\operatorname*{frac}\left(  jx\right)  $ belong to one and the same of the
$n$ intervals $I_{1},I_{2},\ldots,I_{n}$. In other words, there exists some
$k\in\left\{  1,2,\ldots,n\right\}  $ such that $\operatorname*{frac}\left(
ix\right)  $ and $\operatorname*{frac}\left(  jx\right)  $ belong to $I_{k}$.
Consider this $k$.

We know that $\operatorname*{frac}\left(  ix\right)  $ belongs to $I_{k}$.
Hence, $\operatorname*{frac}\left(  ix\right)  \in I_{k}=\left[  \dfrac
{k-1}{n},\dfrac{k}{n}\right)  $ (by the definition of $I_{k}$). In other
words, $\operatorname*{frac}\left(  ix\right)  \geq\dfrac{k-1}{n}$ and
$\operatorname*{frac}\left(  ix\right)  <\dfrac{k}{n}$. The same argument
(applied to $j$ instead of $i$) shows that $\operatorname*{frac}\left(
jx\right)  \geq\dfrac{k-1}{n}$ and $\operatorname*{frac}\left(  jx\right)
<\dfrac{k}{n}$.

Now, $j-i$ is a positive integer (since $i$ and $j$ are integers satisfying
$i<j$). We now claim that%
\begin{equation}
\operatorname*{frac}\left(  \left(  j-i\right)  x\right)  \text{ is either
}<\dfrac{1}{n}\text{ or }>\dfrac{n-1}{n}. \label{sol.php.jacobi.a.fracj-i}%
\end{equation}


[\textit{Proof of (\ref{sol.php.jacobi.a.fracj-i}):} We are in one of the
following two cases:

\textit{Case 1:} We have $\operatorname*{frac}\left(  jx\right)
\geq\operatorname*{frac}\left(  ix\right)  $.

\textit{Case 2:} We have $\operatorname*{frac}\left(  jx\right)
<\operatorname*{frac}\left(  ix\right)  $.

Let us first consider Case 1. In this case, we have $\operatorname*{frac}%
\left(  jx\right)  \geq\operatorname*{frac}\left(  ix\right)  $. Hence, Lemma
\ref{lem.frac.fraca-b} \textbf{(a)} (applied to $a=jx$ and $b=ix$) yields
\[
\operatorname*{frac}\left(  jx-ix\right)  =\underbrace{\operatorname*{frac}%
\left(  jx\right)  }_{<\dfrac{k}{n}}-\underbrace{\operatorname*{frac}\left(
ix\right)  }_{\geq\dfrac{k-1}{n}}<\dfrac{k}{n}-\dfrac{k-1}{n}=\dfrac{1}{n}.
\]
In view of $jx-ix=\left(  j-i\right)  x$, this rewrites as
$\operatorname*{frac}\left(  \left(  j-i\right)  x\right)  <\dfrac{1}{n}$.
Hence, $\operatorname*{frac}\left(  \left(  j-i\right)  x\right)  $ is either
$<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$. Thus, (\ref{sol.php.jacobi.a.fracj-i})
is proved in Case 1.

Let us now consider Case 2. In this case, we have $\operatorname*{frac}\left(
jx\right)  <\operatorname*{frac}\left(  ix\right)  $. Hence, Lemma
\ref{lem.frac.fraca-b} \textbf{(b)} (applied to $a=jx$ and $b=ix$) yields
\[
\operatorname*{frac}\left(  jx-ix\right)  =\underbrace{\operatorname*{frac}%
\left(  jx\right)  }_{\geq\dfrac{k-1}{n}}-\underbrace{\operatorname*{frac}%
\left(  ix\right)  }_{<\dfrac{k}{n}}+1>\dfrac{k-1}{n}-\dfrac{k}{n}%
+1=\dfrac{n-1}{n}.
\]
In view of $jx-ix=\left(  j-i\right)  x$, this rewrites as
$\operatorname*{frac}\left(  \left(  j-i\right)  x\right)  >\dfrac{n-1}{n}$.
Hence, $\operatorname*{frac}\left(  \left(  j-i\right)  x\right)  $ is either
$<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$. Thus, (\ref{sol.php.jacobi.a.fracj-i})
is proved in Case 2.

We have now proved (\ref{sol.php.jacobi.a.fracj-i}) in both Cases 1 and 2.
Hence, (\ref{sol.php.jacobi.a.fracj-i}) always holds.]

Now, recall that $j-i$ is a positive integer. Furthermore,
(\ref{sol.php.jacobi.a.fracj-i}) shows that $\operatorname*{frac}\left(
\left(  j-i\right)  x\right)  $ is either $<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}%
$. Hence, there exists a positive integer $m$ such that $\operatorname*{frac}%
\left(  mx\right)  $ is either $<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$ (namely,
$m=j-i$). This solves Exercise \ref{exe.php.jacobi} \textbf{(a)}.

\textbf{(b)} Let $x\in\mathbb{R}$. Let $n$ be a positive integer. Exercise
\ref{exe.php.jacobi} \textbf{(a)} yields that there exists a positive integer
$m$ such that $\operatorname*{frac}\left(  mx\right)  $ is either $<\dfrac
{1}{n}$ or $>\dfrac{n-1}{n}$. Consider this $m$, and denote it by $p$. Thus,
$p$ is a positive integer such that $\operatorname*{frac}\left(  px\right)  $
is either $<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$.

We must prove that there exists a positive integer $m$ such that
$\operatorname*{frac}\left(  mx\right)  <\dfrac{1}{n}$. If
$\operatorname*{frac}\left(  px\right)  <\dfrac{1}{n}$, then this is
immediately clear (since we can just take $m=p$). Thus, for the rest of this
proof, we WLOG assume that we don't have $\operatorname*{frac}\left(
px\right)  <\dfrac{1}{n}$. In other words, $\operatorname*{frac}\left(
px\right)  $ is not $<\dfrac{1}{n}$. Hence, $\operatorname*{frac}\left(
px\right)  $ is $>\dfrac{n-1}{n}$ (since we know that $\operatorname*{frac}%
\left(  px\right)  $ is either $<\dfrac{1}{n}$ or $>\dfrac{n-1}{n}$). In other
words, $\operatorname*{frac}\left(  px\right)  >\dfrac{n-1}{n}$.

But every $z\in\mathbb{R}$ satisfies $\operatorname*{frac}z<1$. Hence,
$\operatorname*{frac}\left(  px\right)  <1$, so that $1-\operatorname*{frac}%
\left(  px\right)  >0$. Thus, $\dfrac{1}{1-\operatorname*{frac}\left(
px\right)  }$ is a well-defined positive real. Hence, there exists an integer
$u$ such that $u>\dfrac{1}{1-\operatorname*{frac}\left(  px\right)  }$ (for
example, we can take $u=\left\lfloor \dfrac{1}{1-\operatorname*{frac}\left(
px\right)  }\right\rfloor +1$). Consider this $u$. Clearly, $u>\dfrac
{1}{1-\operatorname*{frac}\left(  px\right)  }>0$ (since
$1-\operatorname*{frac}\left(  px\right)  $ is positive), so that $u$ is
positive. Also, from $u>\dfrac{1}{1-\operatorname*{frac}\left(  px\right)  }$,
we obtain $\dfrac{1}{u}<1-\operatorname*{frac}\left(  px\right)  $ (since $u$
and $1-\operatorname*{frac}\left(  px\right)  $ are positive) and thus
\[
\dfrac{1}{u}<1-\underbrace{\operatorname*{frac}\left(  px\right)  }%
_{>\dfrac{n-1}{n}}<1-\dfrac{n-1}{n}=\dfrac{1}{n}.
\]


Now, let us apply Exercise \ref{exe.php.jacobi} \textbf{(a)} to $px$ and $u$
instead of $x$ and $n$. We thus conclude that there exists a positive integer
$m$ such that $\operatorname*{frac}\left(  mpx\right)  $ is either $<\dfrac
{1}{u}$ or $>\dfrac{u-1}{u}$. Consider this $m$, and denote it by $r$. Thus,
$r$ is a positive integer such that $\operatorname*{frac}\left(  rpx\right)  $
is either $<\dfrac{1}{u}$ or $>\dfrac{u-1}{u}$.

The product $rp$ is a positive integer (since $r$ and $p$ are positive
integers). We must prove that there exists a positive integer $m$ such that
$\operatorname*{frac}\left(  mx\right)  <\dfrac{1}{n}$. If
$\operatorname*{frac}\left(  rpx\right)  <\dfrac{1}{n}$, then this is
immediately clear (since we can just take $m=rp$). Thus, for the rest of this
proof, we WLOG assume that we don't have $\operatorname*{frac}\left(
rpx\right)  <\dfrac{1}{n}$. Hence, we have $\operatorname*{frac}\left(
rpx\right)  \geq\dfrac{1}{n}>\dfrac{1}{u}$ (since $\dfrac{1}{u}<\dfrac{1}{n}%
$). Therefore, $\operatorname*{frac}\left(  rpx\right)  $ is not $<\dfrac
{1}{u}$. Hence, $\operatorname*{frac}\left(  rpx\right)  $ is $>\dfrac{u-1}%
{u}$ (since we know that $\operatorname*{frac}\left(  rpx\right)  $ is either
$<\dfrac{1}{u}$ or $>\dfrac{u-1}{u}$). In other words, $\operatorname*{frac}%
\left(  rpx\right)  >\dfrac{u-1}{u}$.

Now,
\begin{align}
\operatorname*{frac}\left(  rpx\right)   &  >\dfrac{u-1}{u}=1-\dfrac{1}%
{u}>1-\left(  1-\operatorname*{frac}\left(  px\right)  \right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\dfrac{1}{u}<1-\operatorname*{frac}%
\left(  px\right)  \right) \nonumber\\
&  =\operatorname*{frac}\left(  px\right)  . \label{sol.php.jacobi.b.fracrpx}%
\end{align}
If we had $r=1$, then we would have $\operatorname*{frac}\left(
\underbrace{r}_{=1}px\right)  =\operatorname*{frac}\left(  px\right)  $, which
would contradict (\ref{sol.php.jacobi.b.fracrpx}). Hence, we cannot have
$r=1$. Thus, $r>1$ (since $r$ is a positive integer), so that $r-1$ is a
positive integer. Thus, $\left(  r-1\right)  p$ is a positive integer (since
$p$ is a positive integer). Moreover, (\ref{sol.php.jacobi.b.fracrpx}) entails
$\operatorname*{frac}\left(  rpx\right)  \geq\operatorname*{frac}\left(
px\right)  $. Hence, Lemma \ref{lem.frac.fraca-b} \textbf{(a)} (applied to
$a=rpx$ and $b=px$) yields
\[
\operatorname*{frac}\left(  rpx-px\right)  =\underbrace{\operatorname*{frac}%
\left(  rpx\right)  }_{\substack{<1\\\text{(since }\operatorname*{frac}%
z<1\\\text{for each }z\in\mathbb{R}\text{)}}}-\underbrace{\operatorname*{frac}%
\left(  px\right)  }_{>\dfrac{n-1}{n}}<1-\dfrac{n-1}{n}=\dfrac{1}{n}.
\]
In view of $rpx-px=\left(  r-1\right)  px$, this rewrites as
$\operatorname*{frac}\left(  \left(  r-1\right)  px\right)  <\dfrac{1}{n}$.

Thus, $\left(  r-1\right)  p$ is a positive integer and satisfies
$\operatorname*{frac}\left(  \left(  r-1\right)  px\right)  <\dfrac{1}{n}$.
Hence, there exists a positive integer $m$ such that $\operatorname*{frac}%
\left(  mx\right)  <\dfrac{1}{n}$ (namely, $m=\left(  r-1\right)  p$). This
solves Exercise \ref{exe.php.jacobi} \textbf{(b)}.

\textbf{(c)} Let $x\in\mathbb{R}$. Let $\varepsilon$ be a positive real. Thus,
$\dfrac{1}{\varepsilon}$ is a well-defined positive real. Hence, there exists
some integer $n$ such that $n>\dfrac{1}{\varepsilon}$ (for example, we can
take $n=\left\lfloor \dfrac{1}{\varepsilon}\right\rfloor +1$). Consider this
$n$. Note that $n>\dfrac{1}{\varepsilon}>0$ (since $\varepsilon$ is positive);
thus, $n$ is positive. Furthermore, from $n>\dfrac{1}{\varepsilon}$, we obtain
$\dfrac{1}{n}<\varepsilon$ (since $n$ and $\varepsilon$ are positive).

Exercise \ref{exe.php.jacobi} \textbf{(b)} shows that there exists a positive
integer $m$ such that $\operatorname*{frac}\left(  mx\right)  <\dfrac{1}{n}$.
This positive integer $m$ must then also satisfy $\operatorname*{frac}\left(
mx\right)  <\varepsilon$ (since it satisfies $\operatorname*{frac}\left(
mx\right)  <\dfrac{1}{n}<\varepsilon$). Hence, there exists a positive integer
$m$ such that $\operatorname*{frac}\left(  mx\right)  <\varepsilon$. This
solves Exercise \ref{exe.php.jacobi} \textbf{(c)}.

\textbf{(d)} Here is where we will need a bit of analysis. We will use the
following two well-known facts about the sine function:

\begin{statement}
\textit{Fact 1:} If $x$ is a nonnegative real, then $\sin x\leq x$.
\end{statement}

\begin{statement}
\textit{Fact 2:} If $x\in\mathbb{R}$ and $j\in\mathbb{Z}$, then $\sin\left(
x+2\pi j\right)  =\sin x$.
\end{statement}

Note that Fact 2 is a consequence of the fact that the function $\sin$ has
period $2\pi$. We can easily use these two facts to derive the following:

\begin{statement}
\textit{Fact 3:} If $z\in\mathbb{R}$, then $\sin z=\sin\left(  2\pi
\operatorname*{frac}\left(  \dfrac{z}{2\pi}\right)  \right)  $.
\end{statement}

[\textit{Proof of Fact 3:} Let $z\in\mathbb{R}$. Then, $\left\lfloor \dfrac
{z}{2\pi}\right\rfloor $ is an integer\footnote{since a floor of a real number
is always an integer}. Now, the definition of $\operatorname*{frac}\left(
\dfrac{z}{2\pi}\right)  $ yields $\operatorname*{frac}\left(  \dfrac{z}{2\pi
}\right)  =\dfrac{z}{2\pi}-\left\lfloor \dfrac{z}{2\pi}\right\rfloor $. Hence,
$\dfrac{z}{2\pi}=\operatorname*{frac}\left(  \dfrac{z}{2\pi}\right)
+\left\lfloor \dfrac{z}{2\pi}\right\rfloor $. Multiplying both sides of this
equality by $2\pi$, we find%
\[
z=2\pi\left(  \operatorname*{frac}\left(  \dfrac{z}{2\pi}\right)
+\left\lfloor \dfrac{z}{2\pi}\right\rfloor \right)  =2\pi\operatorname*{frac}%
\left(  \dfrac{z}{2\pi}\right)  +2\pi\left\lfloor \dfrac{z}{2\pi}\right\rfloor
.
\]
Hence,%
\[
\sin z=\sin\left(  2\pi\operatorname*{frac}\left(  \dfrac{z}{2\pi}\right)
+2\pi\left\lfloor \dfrac{z}{2\pi}\right\rfloor \right)  =\sin\left(
2\pi\operatorname*{frac}\left(  \dfrac{z}{2\pi}\right)  \right)
\]
(by Fact 2, applied to $x=2\pi\operatorname*{frac}\left(  \dfrac{z}{2\pi
}\right)  $ and $j=\left\lfloor \dfrac{z}{2\pi}\right\rfloor $), since
$\left\lfloor \dfrac{z}{2\pi}\right\rfloor $ is an integer. This proves Fact 3.]

Let $\varepsilon$ be a positive real. Let $z$ be a real. We must show that
there exists a positive integer $m$ such that $0\leq\sin\left(  mz\right)
<\varepsilon$.

Indeed, we WLOG assume that $\varepsilon\leq\pi$ (since otherwise, we can
simply replace $\varepsilon$ by the positive real $\min\left\{  \varepsilon
,\pi\right\}  $, which is no larger than $\varepsilon$).

The real $\dfrac{\varepsilon}{2\pi}$ is positive (since $\varepsilon$ and
$2\pi$ are positive). Hence, Exercise \ref{exe.php.jacobi} \textbf{(c)}
(applied to $\dfrac{z}{2\pi}$ and $\dfrac{\varepsilon}{2\pi}$ instead of $x$
and $\varepsilon$) yields that there exists a positive integer $m$ such that
$\operatorname*{frac}\left(  m\cdot\dfrac{z}{2\pi}\right)  <\dfrac
{\varepsilon}{2\pi}$. Consider this $m$. We have
\[
\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  =\operatorname*{frac}%
\left(  m\cdot\dfrac{z}{2\pi}\right)  <\dfrac{\varepsilon}{2\pi}.
\]
Multiplying both sides of this inequality by $2\pi$, we obtain%
\begin{equation}
2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  <\varepsilon\leq\pi.
\label{sol.php.jacobi.d.4}%
\end{equation}
But $\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  \geq0$ (since
$\operatorname*{frac}y\geq0$ for each $y\in\mathbb{R}$) and thus
$2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  \geq0$. Combining
this with (\ref{sol.php.jacobi.d.4}), we obtain $2\pi\operatorname*{frac}%
\left(  \dfrac{mz}{2\pi}\right)  \in\left[  0,\pi\right)  $, so that
\begin{equation}
\sin\left(  2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  \right)
\geq0. \label{sol.php.jacobi.d.3}%
\end{equation}


Now, Fact 3 (applied to $mz$ instead of $z$) yields%
\begin{align}
\sin\left(  mz\right)   &  =\sin\left(  2\pi\operatorname*{frac}\left(
\dfrac{mz}{2\pi}\right)  \right) \label{sol.php.jacobi.d.5}\\
&  \geq0\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{sol.php.jacobi.d.3}%
)}\right)  .\nonumber
\end{align}


Also, recall that $2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)
\geq0$; thus, Fact 1 (applied to $x=2\pi\operatorname*{frac}\left(  \dfrac
{mz}{2\pi}\right)  $) yields%
\[
\sin\left(  2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  \right)
\leq2\pi\operatorname*{frac}\left(  \dfrac{mz}{2\pi}\right)  <\varepsilon.
\]
Thus, (\ref{sol.php.jacobi.d.5}) becomes%
\[
\sin\left(  mz\right)  =\sin\left(  2\pi\operatorname*{frac}\left(  \dfrac
{mz}{2\pi}\right)  \right)  <\varepsilon.
\]
Combining this with $\sin\left(  mz\right)  \geq0$, we obtain $0\leq
\sin\left(  mz\right)  <\varepsilon$.

Thus, we have found a positive integer $m$ such that $0\leq\sin\left(
mz\right)  <\varepsilon$. Hence, such an $m$ exists. This solves Exercise
\ref{exe.php.jacobi} \textbf{(d)}.
\end{proof}

See \url{https://artofproblemsolving.com/community/c4h15415p109278} for
slightly different solution to Exercise \ref{exe.php.jacobi} \textbf{(d)}
(using the continuity of $\sin$ instead of Fact 1).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.php.k-ints}}

\begin{proof}
[Discussion of Exercise \ref{exe.php.k-ints}.]I have taken Exercise
\ref{exe.php.k-ints} from
\url{https://artofproblemsolving.com/community/c6h15141} . Here is my solution:

\begin{proof}
[Solution to Exercise \ref{exe.php.k-ints} (sketched).]We claim that the
smallest positive real $\varepsilon$ such that the entire set $R$ can be
covered with $5$ \textbf{closed} intervals of length $\varepsilon$ each is
$\dfrac{1}{10}$. In order to prove this, we need to prove the following two claims:

\begin{statement}
\textit{Claim 1:} The entire set $R$ can be covered with $5$ closed intervals
of length $\dfrac{1}{10}$ each.
\end{statement}

\begin{statement}
\textit{Claim 2:} Let $\varepsilon$ be a positive real such that the entire
set $R$ can be covered with $5$ closed intervals of length $\varepsilon$ each.
Then, $\varepsilon\geq\dfrac{1}{10}$.
\end{statement}

[\textit{Proof of Claim 1:} Define five closed intervals $A,B,C,D,E$ by%
\[
A=\left[  0,\dfrac{1}{10}\right]  ,\ \ \ \ \ \ \ \ \ \ B=\left[  \dfrac{1}%
{10},\dfrac{1}{5}\right]  ,\ \ \ \ \ \ \ \ \ \ C=\left[  \dfrac{1}{4}%
,\dfrac{7}{20}\right]  ,\ \ \ \ \ \ \ \ \ \ D=\left[  \dfrac{1}{2},\dfrac
{3}{5}\right]  ,\ \ \ \ \ \ \ \ \ \ E=\left[  \dfrac{9}{10},1\right]  .
\]
These five intervals $A,B,C,D,E$ have length $\dfrac{1}{10}$ each, and
together cover the entire set $R$ (indeed, the interval $A$ contains all
numbers $\dfrac{1}{s}$ with $s\geq10$; the interval $B$ contains the numbers
$\dfrac{1}{9},\dfrac{1}{8},\dfrac{1}{7},\dfrac{1}{6},\dfrac{1}{5}$; the
interval $C$ contains the numbers $\dfrac{1}{4},\dfrac{1}{3}$; the interval
$D$ contains the number $\dfrac{1}{2}$; the interval $E$ contains the number
$1$). Thus, the entire set $R$ can be covered with $5$ closed intervals of
length $\dfrac{1}{10}$ each (namely, with the $5$ intervals $A,B,C,D,E$). This
proves Claim 1.]

[\textit{Proof of Claim 2:} Assume the contrary. Thus, $\varepsilon<\dfrac
{1}{10}$. In other words, $\dfrac{1}{10}-\varepsilon>0$. Hence, $\dfrac
{1}{\dfrac{1}{10}-\varepsilon}$ is a well-defined positive real. Hence, there
exists an integer $N$ such that $N>\dfrac{1}{\dfrac{1}{10}-\varepsilon}$ (for
example, $N=\left\lfloor \dfrac{1}{\dfrac{1}{10}-\varepsilon}\right\rfloor
+1$). Consider this $N$. We have $N>\dfrac{1}{\dfrac{1}{10}-\varepsilon}>0$
(since $\dfrac{1}{10}-\varepsilon>0$). Also, from $N>\dfrac{1}{\dfrac{1}%
{10}-\varepsilon}$, we obtain $\dfrac{1}{N}<\dfrac{1}{10}-\varepsilon$ (since
$N$ and $\dfrac{1}{10}-\varepsilon$ are positive). Hence, $\varepsilon
<\dfrac{1}{10}-\dfrac{1}{N}$, so that $\dfrac{1}{10}-\dfrac{1}{N}>\varepsilon$.

We have assumed that the entire set $R$ can be covered with $5$ closed
intervals of length $\varepsilon$ each. In other words, there exist $5$ closed
intervals $A,B,C,D,E$ of length $\varepsilon$ each such that these $5$
intervals cover the entire set $R$. Consider these $5$ intervals $A,B,C,D,E$.

Now, consider the $6$ numbers%
\[
\dfrac{1}{1},\ \ \ \ \ \dfrac{1}{2},\ \ \ \ \ \dfrac{1}{3},\ \ \ \ \ \dfrac
{1}{5},\ \ \ \ \ \dfrac{1}{10},\ \ \ \ \ \dfrac{1}{N}.
\]
These $6$ numbers all belong to $R$, and therefore each of them belongs to (at
least) one of the $5$ intervals $A,B,C,D,E$ (since these $5$ intervals cover
the entire set $R$). Hence, by the Pigeonhole Principle, we conclude that at
least two of these $6$ numbers belong to one and the same of the $5$ intervals
$A,B,C,D,E$. These two numbers therefore belong to a common interval of length
$\varepsilon$ (since each of the $5$ intervals $A,B,C,D,E$ has length
$\varepsilon$), and thus their difference (if we subtract the smaller one from
the larger) must be $\leq\varepsilon$. But this contradicts the fact that no
two of the $6$ numbers%
\[
\dfrac{1}{1},\ \ \ \ \ \dfrac{1}{2},\ \ \ \ \ \dfrac{1}{3},\ \ \ \ \ \dfrac
{1}{5},\ \ \ \ \ \dfrac{1}{10},\ \ \ \ \ \dfrac{1}{N}%
\]
have a difference that is $\leq\varepsilon$ (indeed, the differences between
consecutive numbers in this list are
\begin{align*}
\dfrac{1}{1}-\dfrac{1}{2}  &  =\dfrac{1}{2}>\dfrac{1}{10}>\varepsilon,\\
\dfrac{1}{2}-\dfrac{1}{3}  &  =\dfrac{1}{6}>\dfrac{1}{10}>\varepsilon,\\
\dfrac{1}{3}-\dfrac{1}{5}  &  =\dfrac{2}{15}>\dfrac{1}{10}>\varepsilon,\\
\dfrac{1}{5}-\dfrac{1}{10}  &  =\dfrac{1}{10}>\varepsilon,\\
\dfrac{1}{10}-\dfrac{1}{N}  &  >\varepsilon,
\end{align*}
and therefore the differences between non-consecutive numbers in this list are
even larger, since the list is in decreasing order). This contradiction shows
that our assumption was false. Thus, Claim 2 is proved.]

With Claim 1 and Claim 2 both proved, we thus have solved Exercise
\ref{exe.php.k-ints}.
\end{proof}
\end{proof}

\subsection{Homework set \#7 discussion}

The following are discussions of the problems on homework set \#7 (Section
\ref{sect.hw7}).

\subsubsection{Discussion of Exercise \ref{exe.enum.Fixfg}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.Fixfg}.]Exercise \ref{exe.enum.Fixfg} is
a minor generalization of \cite[Exercise 2 \textbf{(a)}]{17f-hw6s}. The
solution (essentially copied from \cite[Exercise 2 \textbf{(a)}]{17f-hw6s}) is
a textbook application of the bijection principle:

\begin{proof}
[Solution to Exercise \ref{exe.enum.Fixfg} (sketched).]We have $g\left(
x\right)  \in\operatorname*{Fix}\left(  g\circ f\right)  $ for each
$x\in\operatorname*{Fix}\left(  f\circ g\right)  $%
\ \ \ \ \footnote{\textit{Proof.} Let $x\in\operatorname*{Fix}\left(  f\circ
g\right)  $. We must show that $g\left(  x\right)  \in\operatorname*{Fix}%
\left(  g\circ f\right)  $.
\par
We know that $x\in\operatorname*{Fix}\left(  f\circ g\right)  $. In other
words, $x$ is a fixed point of $f\circ g$ (since $\operatorname*{Fix}\left(
f\circ g\right)  $ is defined as the set of all fixed points of $f\circ g$).
In other words, $x\in V$ and $\left(  f\circ g\right)  \left(  x\right)  =x$.
Thus, $f\left(  g\left(  x\right)  \right)  =\left(  f\circ g\right)  \left(
x\right)  =x$. Hence,%
\[
\left(  g\circ f\right)  \left(  g\left(  x\right)  \right)  =g\left(
\underbrace{f\left(  g\left(  x\right)  \right)  }_{=x}\right)  =g\left(
x\right)  .
\]
In other words, $g\left(  x\right)  $ is a fixed point of $g\circ f$. In other
words, $g\left(  x\right)  \in\operatorname*{Fix}\left(  g\circ f\right)  $
(since $\operatorname*{Fix}\left(  g\circ f\right)  $ is defined as the set of
all fixed points of $g\circ f$). This completes our proof.}. The same argument
(applied to $V$, $U$, $g$ and $f$ instead of $U$, $V$, $f$ and $g$) shows that
$f\left(  x\right)  \in\operatorname*{Fix}\left(  f\circ g\right)  $ for each
$x\in\operatorname*{Fix}\left(  g\circ f\right)  $.

Let $\gamma$ be the map%
\[
\operatorname*{Fix}\left(  f\circ g\right)  \rightarrow\operatorname*{Fix}%
\left(  g\circ f\right)  ,\ \ \ \ \ \ \ \ \ \ x\mapsto g\left(  x\right)  .
\]
(This is well-defined, because $g\left(  x\right)  \in\operatorname*{Fix}%
\left(  g\circ f\right)  $ for each $x\in\operatorname*{Fix}\left(  f\circ
g\right)  $.)

Let $\varphi$ be the map%
\[
\operatorname*{Fix}\left(  g\circ f\right)  \rightarrow\operatorname*{Fix}%
\left(  f\circ g\right)  ,\ \ \ \ \ \ \ \ \ \ x\mapsto f\left(  x\right)  .
\]
(This is well-defined, because $f\left(  x\right)  \in\operatorname*{Fix}%
\left(  f\circ g\right)  $ for each $x\in\operatorname*{Fix}\left(  g\circ
f\right)  $.)

We have $\varphi\circ\gamma=\operatorname*{id}$%
\ \ \ \ \footnote{\textit{Proof.} Let $x\in\operatorname*{Fix}\left(  f\circ
g\right)  $. Thus, $\gamma\left(  x\right)  =g\left(  x\right)  $ (by the
definition of $\gamma$). But $\gamma\left(  x\right)  \in\operatorname*{Fix}%
\left(  g\circ f\right)  $, so that $\varphi\left(  \gamma\left(  x\right)
\right)  =f\left(  \gamma\left(  x\right)  \right)  $ (by the definition of
$\varphi$).
\par
We have $x\in\operatorname*{Fix}\left(  f\circ g\right)  $. In other words,
$x$ is a fixed point of $f\circ g$ (since $\operatorname*{Fix}\left(  f\circ
g\right)  $ is defined as the set of all fixed points of $f\circ g$). In other
words, $x\in V$ and $\left(  f\circ g\right)  \left(  x\right)  =x$. Now,%
\[
\left(  \varphi\circ\gamma\right)  \left(  x\right)  =\varphi\left(
\gamma\left(  x\right)  \right)  =f\left(  \underbrace{\gamma\left(  x\right)
}_{=g\left(  x\right)  }\right)  =f\left(  g\left(  x\right)  \right)
=\left(  f\circ g\right)  \left(  x\right)  =x=\operatorname*{id}\left(
x\right)  .
\]
\par
Now, forget that we fixed $x$. We thus have proven that $\left(  \varphi
\circ\gamma\right)  \left(  x\right)  =\operatorname*{id}\left(  x\right)  $
for each $x\in\operatorname*{Fix}\left(  f\circ g\right)  $. In other words,
$\varphi\circ\gamma=\operatorname*{id}$.}. The same argument (applied to $V$,
$U$, $g$, $f$, $\gamma$ and $\varphi$ instead of $U$, $V$, $f$, $g$, $\varphi$
and $\gamma$) shows that $\gamma\circ\varphi=\operatorname*{id}$.

The maps $\varphi$ and $\gamma$ are mutually inverse (since $\varphi
\circ\gamma=\operatorname*{id}$ and $\gamma\circ\varphi=\operatorname*{id}$),
and thus are bijections. Hence, we have found a bijection $\operatorname*{Fix}%
\left(  f\circ g\right)  \rightarrow\operatorname*{Fix}\left(  g\circ
f\right)  $ (namely, $\gamma$). Hence, $\left\vert \operatorname*{Fix}\left(
f\circ g\right)  \right\vert =\left\vert \operatorname*{Fix}\left(  g\circ
f\right)  \right\vert $. This solves Exercise \ref{exe.enum.Fixfg}.
\end{proof}

A few remarks are in order:

\begin{itemize}
\item The assumption that $U$ and $V$ are finite in Exercise
\ref{exe.enum.Fixfg} is unnecessary (we have never used it in the above solution).

\item It is \textbf{not} true that every three maps $f,g,h$ from a finite set
$S$ to $S$ satisfy $\left\vert \operatorname*{Fix}\left(  f\circ g\circ
h\right)  \right\vert =\left\vert \operatorname*{Fix}\left(  g\circ f\circ
h\right)  \right\vert $. See \cite[Exercise 2 \textbf{(b)}]{17f-hw6s} for a counterexample.

\item Exercise \ref{exe.enum.Fixfg} is a combinatorial analogue of the
following fact from linear algebra: If $A$ is an $n\times m$-matrix and $B$ is
an $m\times n$-matrix (so that both products $AB$ and $BA$ are well-defined),
then
\begin{equation}
\operatorname*{Tr}\left(  AB\right)  =\operatorname*{Tr}\left(  BA\right)
\label{eq.sol.enum.Fixfg.tr}%
\end{equation}
(where $\operatorname*{Tr}M$ denotes the \textit{trace} of a square matrix
$M$, that is, the sum of all diagonal entries of $M$). This is not just an
analogy; it is in fact possible to derive Exercise \ref{exe.enum.Fixfg} by
applying (\ref{eq.sol.enum.Fixfg.tr}) to two appropriate matrices! See
\cite[Remark 0.11]{17f-hw6s} for this derivation. This yields another solution
to Exercise \ref{exe.enum.Fixfg}.
\end{itemize}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.num-of-even-divs-even}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.num-of-even-divs-even}.]Exercise
\ref{exe.ent.num-of-even-divs-even} is a somewhat more sophisticated variant
of Exercise \ref{exe.ent.num-of-divs-even}, and can easily be reduced to the latter:

\begin{proof}
[Solution to Exercise \ref{exe.ent.num-of-even-divs-even}.]We are in one of
the following two cases:

\textit{Case 1:} The integer $n$ is even.

\textit{Case 2:} The integer $n$ is odd.

Let us first consider Case 1. In this case, the integer $n$ is even. Thus,
$2\mid n$, so that $n/2\in\mathbb{Z}$.

If $d$ is an even positive divisor of $n$, then $d/2$ is a positive divisor of
$n/2$\ \ \ \ \footnote{\textit{Proof.} Let $d$ be an even positive divisor of
$n$. Then, $2\mid d$ (since $d$ is even), so that $d/2\in\mathbb{Z}$.
Moreover, there exists an integer $c$ such that $n=dc$ (since $d$ is a divisor
of $n$). Consider this $c$. We have $\underbrace{n}_{=dc}/2=dc/2=\left(
d/2\right)  c$. Hence, $d/2\mid n/2$ (since $c$ is an integer). That is, $d/2$
is a divisor of $n/2$. Moreover, $d/2$ is positive (since $d$ is positive). We
have thus shown that $d/2$ is a positive divisor of $n/2$. Qed.}. Hence, the
map%
\begin{align*}
\Phi:\left\{  \text{even positive divisors of }n\right\}   &  \rightarrow
\left\{  \text{positive divisors of }n/2\right\}  ,\\
d  &  \mapsto d/2
\end{align*}
is well-defined. Consider this map $\Phi$.

If $u$ is a positive divisor of $n/2$, then $2u$ is an even positive divisor
of $n$\ \ \ \ \footnote{\textit{Proof.} Let $u$ be a positive divisor of
$n/2$. Then, $u$ is an integer, so that $2u$ is an even integer. Moreover,
$2u$ is positive (since $u$ is positive). Furthermore, there exists some
integer $c$ such that $n/2=uc$ (since $u$ is a divisor of $n/2$). Consider
this $c$. From $n/2=uc$, we obtain $n=2uc=\left(  2u\right)  c$. Hence, $2u$
is a divisor of $n$ (since $c$ is an integer). Thus, $2u$ is an even positive
divisor of $n$ (since $2u$ is even and positive). Qed.}. Hence, the map%
\begin{align*}
\Psi:\left\{  \text{positive divisors of }n/2\right\}   &  \rightarrow\left\{
\text{even positive divisors of }n\right\}  ,\\
u  &  \mapsto2u
\end{align*}
is well-defined. Consider this map $\Psi$.

The maps $\Phi$ and $\Psi$ are mutually inverse. (Indeed, the map $\Phi$
divides its argument by $2$, whereas the map $\Psi$ multiplies its argument by
$2$. Thus, clearly these two maps undo each other.)

Now, the map $\Phi$ is invertible (since the maps $\Phi$ and $\Psi$ are
mutually inverse), and thus is a bijection. Hence, we have found a bijection
\[
\Phi:\left\{  \text{even positive divisors of }n\right\}  \rightarrow\left\{
\text{positive divisors of }n/2\right\}  .
\]
The bijection principle thus yields%
\[
\left\vert \left\{  \text{even positive divisors of }n\right\}  \right\vert
=\left\vert \left\{  \text{positive divisors of }n/2\right\}  \right\vert .
\]
In other words, the number of even positive divisors of $n$ equals the number
of positive divisors of $n/2$.

However, $n/2$ is positive (since $n$ is positive) and is an integer (since
$n/2\in\mathbb{Z}$). Thus, Exercise \ref{exe.ent.num-of-divs-even} (applied to
$n/2$ instead of $n$) yields that the number of positive divisors of $n/2$ is
even if and only if $n/2$ is not a perfect square. Since the number of even
positive divisors of $n$ equals the number of positive divisors of $n/2$, we
can rewrite this as follows: The number of even positive divisors of $n$ is
even if and only if $n/2$ is not a perfect square. Thus, Exercise
\ref{exe.ent.num-of-even-divs-even} is solved in Case 1.

Let us now consider Case 2. In this case, the integer $n$ is odd. Thus,
$2\nmid n$, so that $n/2\notin\mathbb{Z}$. In other words, $n/2$ is not an
integer. Hence, $n/2$ is not a perfect square (since each perfect square is an integer).

Moreover, the number $n$ has no even positive
divisors\footnote{\textit{Proof.} Let $d$ be an even positive divisor of $n$.
We shall derive a contradiction.
\par
Indeed, $2\mid d$ (since $d$ is even) and $d\mid n$ (since $d$ is a divisor of
$n$). Hence, $2\mid d\mid n$. But this contradicts $2\nmid n$.
\par
Forget that we fixed $d$. We thus have found a contradiction for each even
positive divisor $d$ of $n$. Hence, there exist no even positive divisors of
$n$. In other words, the number $n$ has no even positive divisors.}. Thus, the
number of even positive divisors of $n$ is $0$. Hence, the number of even
positive divisors of $n$ is even (since $0$ is even).

We thus conclude that the number of even positive divisors of $n$ is even if
and only if $n/2$ is not a perfect square (because we know that the number of
even positive divisors of $n$ is even, and we also know that $n/2$ is not a
perfect square). Thus, Exercise \ref{exe.ent.num-of-even-divs-even} is solved
in Case 2.

We have now solved Exercise \ref{exe.ent.num-of-even-divs-even} in both Cases
1 and 2. This completes the solution to Exercise
\ref{exe.ent.num-of-even-divs-even}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.IMO1981-2-ca}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.IMO1981-2-ca}.]Exercise
\ref{exe.enum.IMO1981-2-ca} is essentially Problem 2 on the
\href{https://prase.cz/kalva/imo/isoln/isoln812.html}{International
Mathematical Olympiad 1981} (except that the latter problem asked for the
average instead of the sum of the $\min S$; but one question is easily reduced
to the other). We give two solutions:

\begin{proof}
[First solution to Exercise \ref{exe.enum.IMO1981-2-ca}.]We have $r\neq0$
(since $r$ is positive). If $S$ is a subset of $\left[  n\right]  $ satisfying
$\left\vert S\right\vert =r$, then the set $S$ is nonempty (since $\left\vert
S\right\vert =r\neq0$) and therefore its minimum $\min S$ exists. This minimum
$\min S$ is an element of $S$ and therefore an element of $\left[  n\right]  $
(since $S$ is a subset of $\left[  n\right]  $). Hence, we can split the sum
$\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S$ according to the value of $\min S$ as follows:%
\begin{align*}
\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S  &  =\sum_{k\in\left[  n\right]  }\ \ \sum
\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r;\\\min S=k}}\underbrace{\min S}_{=k}=\sum_{k\in\left[  n\right]
}\ \ \underbrace{\sum\limits_{\substack{S\subseteq\left[  n\right]
;\\\left\vert S\right\vert =r;\\\min S=k}}k}_{=\left(  \text{\# of subsets
}S\text{ of }\left[  n\right]  \text{ satisfying }\left\vert S\right\vert
=r\text{ and }\min S=k\right)  \cdot k}\\
&  =\sum_{k\in\left[  n\right]  }\left(  \text{\# of subsets }S\text{ of
}\left[  n\right]  \text{ satisfying }\left\vert S\right\vert =r\text{ and
}\min S=k\right)  \cdot k.
\end{align*}


Now, let us fix $k\in\left[  n\right]  $. We shall now compute the \# of
subsets $S$ of $\left[  n\right]  $ satisfying $\left\vert S\right\vert =r$
and $\min S=k$.

For the sake of brevity, let us introduce some terminology:

\begin{itemize}
\item A \textit{red set} will mean a subset $S$ of $\left[  n\right]  $
satisfying $\left\vert S\right\vert =r$ and $\min S=k$.

\item A \textit{blue set} will mean an $\left(  r-1\right)  $-element subset
of $\left\{  k+1,k+2,\ldots,n\right\}  $.
\end{itemize}

The blue sets are easy to count (see the next paragraph), whereas the red sets
are what we want to count. We shall soon find a bijection between $\left\{
\text{red sets}\right\}  $ and $\left\{  \text{blue sets}\right\}  $, and
therefore we will know how many red sets there are.

First, let us count the blue sets. Note that $k\in\left[  n\right]  $ entails
$1\leq k\leq n$; hence, we have $n-k\in\mathbb{N}$, and the set $\left\{
k+1,k+2,\ldots,n\right\}  $ is an $\left(  n-k\right)  $-element set. Theorem
\ref{thm.binom.comb} (applied to $n-k$, $\left\{  k+1,k+2,\ldots,n\right\}  $
and $r-1$ instead of $n$, $S$ and $k$) thus yields%
\begin{align*}
\dbinom{n-k}{r-1}  &  =\left(  \text{the number of }\left(  r-1\right)
\text{-element subsets of }\left\{  k+1,k+2,\ldots,n\right\}  \right) \\
&  =\left(  \text{\# of }\left(  r-1\right)  \text{-element subsets of
}\left\{  k+1,k+2,\ldots,n\right\}  \right)  .
\end{align*}
However, from the definition of a \textquotedblleft blue set\textquotedblright%
, we see that%
\[
\left(  \text{\# of blue sets}\right)  =\left(  \text{\# of }\left(
r-1\right)  \text{-element subsets of }\left\{  k+1,k+2,\ldots,n\right\}
\right)  .
\]
Comparing these two equalities, we thus find%
\begin{equation}
\left(  \text{\# of blue sets}\right)  =\dbinom{n-k}{r-1}.
\label{sol.enum.IMO1981-2-ca.1st.3}%
\end{equation}


Now, let us construct a bijection between $\left\{  \text{red sets}\right\}  $
and $\left\{  \text{blue sets}\right\}  $. We shall present the proof in
maximum possible detail, in order to show at least once what one needs to
check when claiming the existence of a bijection; in practice, the actual
checking can often be done easily in one's head (certainly this is true in the
case at hand), and thus the definition of the bijection may well be sufficient.

If $U$ is a red set, then $U\setminus\left\{  k\right\}  $ is a blue
set\footnote{\textit{Proof.} Let $U$ be a red set. We must show that
$U\setminus\left\{  k\right\}  $ is a blue set.
\par
We know that $U$ is a red set. In other words, $U$ is a subset $S$ of $\left[
n\right]  $ satisfying $\left\vert S\right\vert =r$ and $\min S=k$ (by the
definition of a \textquotedblleft red set\textquotedblright). In other words,
$U$ is a subset of $\left[  n\right]  $ and satisfies $\left\vert U\right\vert
=r$ and $\min U=k$. Hence, $k=\min U\in U$ (since the minimum of a set always
belongs to this set) and therefore $\left\vert U\setminus\left\{  k\right\}
\right\vert =\underbrace{\left\vert U\right\vert }_{=r}-1=r-1$. In other
words, $U\setminus\left\{  k\right\}  $ is an $\left(  r-1\right)  $-element
set.
\par
Next, let $u\in U\setminus\left\{  k\right\}  $. Thus, $u\in U$ and $u\neq k$.
We have $u\in U\subseteq\left[  n\right]  $ (since $U$ is a subset of $\left[
n\right]  $); that is, $u$ is an integer satisfying $1\leq u\leq n$. But $k$
is the minimum of the set $U$ (since $k=\min U$), and therefore is $\leq$ to
any element of $U$. In other words, $k\leq v$ for each $v\in U$. Applying this
to $v=u$, we obtain $k\leq u$. Thus, $u\geq k$, so that $u>k$ (since $u\neq
k$) and therefore $u\geq k+1$ (since $u$ and $k$ are integers). Combining this
with $u\leq n$, we obtain $u\in\left\{  k+1,k+2,\ldots,n\right\}  $ (since $u$
is an integer).
\par
Forget that we fixed $u$. We thus have shown that $u\in\left\{  k+1,k+2,\ldots
,n\right\}  $ for each $u\in U\setminus\left\{  k\right\}  $. In other words,
$U\setminus\left\{  k\right\}  $ is a subset of $\left\{  k+1,k+2,\ldots
,n\right\}  $. Hence, we have shown that $U\setminus\left\{  k\right\}  $ is
an $\left(  r-1\right)  $-element subset of $\left\{  k+1,k+2,\ldots
,n\right\}  $. In other words, $U\setminus\left\{  k\right\}  $ is a blue set
(by the definition of a \textquotedblleft blue set\textquotedblright). Qed.}.
Hence, we can define a map%
\begin{align*}
\Phi:\left\{  \text{red sets}\right\}   &  \rightarrow\left\{  \text{blue
sets}\right\}  ,\\
U  &  \mapsto U\setminus\left\{  k\right\}  .
\end{align*}
Consider this map $\Phi$.

If $V$ is a blue set, then $V\cup\left\{  k\right\}  $ is a red
set\footnote{\textit{Proof.} Let $V$ be a blue set. We must show that
$V\cup\left\{  k\right\}  $ is a red set.
\par
We know that $V$ is a blue set. In other words, $V$ is an $\left(  r-1\right)
$-element subset of $\left\{  k+1,k+2,\ldots,n\right\}  $ (by the definition
of a \textquotedblleft blue set\textquotedblright). In other words,
$V\subseteq\left\{  k+1,k+2,\ldots,n\right\}  $ and $\left\vert V\right\vert
=r-1$.
\par
If we had $k\in V$, then we would have $k\in V\subseteq\left\{  k+1,k+2,\ldots
,n\right\}  $ and thus $k\geq k+1>k$, which is absurd. Thus, we cannot have
$k\in V$. Hence, $k\notin V$, so that $\left\vert V\cup\left\{  k\right\}
\right\vert =\left\vert V\right\vert +1=r$ (since $\left\vert V\right\vert
=r-1$). Moreover, the two sets $V$ and $\left\{  k\right\}  $ are subsets of
$\left\{  k,k+1,\ldots,n\right\}  $ (since $V\subseteq\left\{  k+1,k+2,\ldots
,n\right\}  \subseteq\left\{  k,k+1,\ldots,n\right\}  $ and $\left\{
k\right\}  \subseteq\left\{  k,k+1,\ldots,n\right\}  $ (because $k\leq n$));
therefore, their union $V\cup\left\{  k\right\}  $ is a subset of $\left\{
k,k+1,\ldots,n\right\}  $ as well. Hence, each element of $V\cup\left\{
k\right\}  $ belongs to the set $\left\{  k,k+1,\ldots,n\right\}  $ and
therefore is $\geq k$. Moreover, $k$ is an element of $V\cup\left\{
k\right\}  $ (since $k\in\left\{  k\right\}  \subseteq V\cup\left\{
k\right\}  $). Thus, we have shown that $k$ is an element of $V\cup\left\{
k\right\}  $ and has the property that each element of $V\cup\left\{
k\right\}  $ is $\geq k$. In other words, $k$ is the \textbf{smallest} element
of $V\cup\left\{  k\right\}  $. In other words, $k=\min\left(  V\cup\left\{
k\right\}  \right)  $. Hence, $\min\left(  V\cup\left\{  k\right\}  \right)
=k$.
\par
Furthermore, the two sets $V$ and $\left\{  k\right\}  $ are subsets of
$\left[  n\right]  $ (since $V\subseteq\left\{  k+1,k+2,\ldots,n\right\}
\subseteq\left\{  k,k+1,\ldots,n\right\}  \subseteq\left\{  1,2,\ldots
,n\right\}  =\left[  n\right]  $ and $\left\{  k\right\}  \subseteq\left[
n\right]  $ (since $k\in\left[  n\right]  $)); therefore, their union
$V\cup\left\{  k\right\}  $ is a subset of $\left[  n\right]  $ as well.
\par
Now, we have shown that $V\cup\left\{  k\right\}  $ is a subset of $\left[
n\right]  $ and satisfies $\left\vert V\cup\left\{  k\right\}  \right\vert =r$
and $\min\left(  V\cup\left\{  k\right\}  \right)  =k$. In other words,
$V\cup\left\{  k\right\}  $ is a subset $S$ of $\left[  n\right]  $ satisfying
$\left\vert S\right\vert =r$ and $\min S=k$. In other words, $V\cup\left\{
k\right\}  $ is a red set (by the definition of a \textquotedblleft red
set\textquotedblright). Qed.}. Hence, we can define a map%
\begin{align*}
\Psi:\left\{  \text{blue sets}\right\}   &  \rightarrow\left\{  \text{red
sets}\right\}  ,\\
V  &  \mapsto V\cup\left\{  k\right\}  .
\end{align*}
Consider this map $\Psi$.

We have $\Phi\circ\Psi=\operatorname*{id}$\ \ \ \ \footnote{\textit{Proof.}
Let $V\in\left\{  \text{blue sets}\right\}  $. Thus, $V$ is a blue set. In
other words, $V$ is an $\left(  r-1\right)  $-element subset of $\left\{
k+1,k+2,\ldots,n\right\}  $ (by the definition of a \textquotedblleft blue
set\textquotedblright). In other words, $V\subseteq\left\{  k+1,k+2,\ldots
,n\right\}  $ and $\left\vert V\right\vert =r-1$.
\par
If we had $k\in V$, then we would have $k\in V\subseteq\left\{  k+1,k+2,\ldots
,n\right\}  $ and thus $k\geq k+1>k$, which is absurd. Thus, we cannot have
$k\in V$. Hence, $k\notin V$, so that $\left(  V\cup\left\{  k\right\}
\right)  \setminus\left\{  k\right\}  =V$. Now, we have $\Psi\left(  V\right)
=V\cup\left\{  k\right\}  $ (by the definition of $\Psi$), and furthermore
\begin{align*}
\left(  \Phi\circ\Psi\right)  \left(  V\right)   &  =\Phi\left(  \Psi\left(
V\right)  \right)  =\underbrace{\left(  \Psi\left(  V\right)  \right)
}_{=V\cup\left\{  k\right\}  }\setminus\left\{  k\right\}
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }\Phi\right) \\
&  =\left(  V\cup\left\{  k\right\}  \right)  \setminus\left\{  k\right\}
=V=\operatorname*{id}\left(  V\right)  .
\end{align*}
\par
Forget that we fixed $V$. We thus have shown that $\left(  \Phi\circ
\Psi\right)  \left(  V\right)  =\operatorname*{id}\left(  V\right)  $ for each
$V\in\left\{  \text{blue sets}\right\}  $. In other words, $\Phi\circ
\Psi=\operatorname*{id}$.} and $\Psi\circ\Phi=\operatorname*{id}%
$\ \ \ \ \footnote{\textit{Proof.} Let $U\in\left\{  \text{red sets}\right\}
$. Thus, $U$ is a red set. In other words, $U$ is a subset $S$ of $\left[
n\right]  $ satisfying $\left\vert S\right\vert =r$ and $\min S=k$ (by the
definition of a \textquotedblleft red set\textquotedblright). In other words,
$U$ is a subset of $\left[  n\right]  $ and satisfies $\left\vert U\right\vert
=r$ and $\min U=k$. Hence, $k=\min U\in U$ (since the minimum of a set always
belongs to this set). Therefore, $\left(  U\setminus\left\{  k\right\}
\right)  \cup\left\{  k\right\}  =U$. Now, we have $\Phi\left(  U\right)
=U\setminus\left\{  k\right\}  $ (by the definition of $\Phi$), and
furthermore
\begin{align*}
\left(  \Psi\circ\Phi\right)  \left(  U\right)   &  =\Psi\left(  \Phi\left(
U\right)  \right)  =\underbrace{\left(  \Phi\left(  U\right)  \right)
}_{=U\setminus\left\{  k\right\}  }\cup\left\{  k\right\}
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }\Psi\right) \\
&  =\left(  U\setminus\left\{  k\right\}  \right)  \cup\left\{  k\right\}
=U=\operatorname*{id}\left(  U\right)  .
\end{align*}
\par
Forget that we fixed $U$. We thus have shown that $\left(  \Psi\circ
\Phi\right)  \left(  U\right)  =\operatorname*{id}\left(  U\right)  $ for each
$U\in\left\{  \text{red sets}\right\}  $. In other words, $\Psi\circ
\Phi=\operatorname*{id}$.}. Thus, the two maps $\Phi$ and $\Psi$ are mutually
inverse. Hence, the map $\Phi$ is invertible, i.e., is a bijection. Now, the
bijection principle yields $\left\vert \left\{  \text{red sets}\right\}
\right\vert =\left\vert \left\{  \text{blue sets}\right\}  \right\vert $
(since $\Phi:\left\{  \text{red sets}\right\}  \rightarrow\left\{  \text{blue
sets}\right\}  $ is a bijection). Hence,
\[
\left(  \text{\# of red sets}\right)  =\left\vert \left\{  \text{red
sets}\right\}  \right\vert =\left\vert \left\{  \text{blue sets}\right\}
\right\vert =\left(  \text{\# of blue sets}\right)  =\dbinom{n-k}{r-1}%
\]
(by (\ref{sol.enum.IMO1981-2-ca.1st.3})). Comparing this with%
\begin{align*}
\left(  \text{\# of red sets}\right)   &  =\left(  \text{\# of subsets
}S\text{ of }\left[  n\right]  \text{ satisfying }\left\vert S\right\vert
=r\text{ and }\min S=k\right) \\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of a \textquotedblleft
red set\textquotedblright}\right)  ,
\end{align*}
we obtain%
\begin{align}
&  \left(  \text{\# of subsets }S\text{ of }\left[  n\right]  \text{
satisfying }\left\vert S\right\vert =r\text{ and }\min S=k\right) \nonumber\\
&  =\dbinom{n-k}{r-1}. \label{sol.enum.IMO1981-2-ca.1st.7}%
\end{align}


Now, forget that we fixed $k$. We thus have proved
(\ref{sol.enum.IMO1981-2-ca.1st.7}) for each $k\in\left[  n\right]  $. Now,
recall that%
\begin{align}
\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S  &  =\sum_{k\in\left[  n\right]  }\underbrace{\left(  \text{\# of
subsets }S\text{ of }\left[  n\right]  \text{ satisfying }\left\vert
S\right\vert =r\text{ and }\min S=k\right)  }_{\substack{=\dbinom{n-k}%
{r-1}\\\text{(by (\ref{sol.enum.IMO1981-2-ca.1st.7}))}}}\cdot k\nonumber\\
&  =\sum_{k\in\left[  n\right]  }\dbinom{n-k}{r-1}\cdot k.
\label{sol.enum.IMO1981-2-ca.1st.9}%
\end{align}


Now, let us compute the sum on the right hand side of this equality.

We have $r-1\in\mathbb{N}$ (since $r$ is a positive integer). Hence, Exercise
\ref{exe.binom.ud-Vander} (applied to $x=1$ and $y=r-1$) yields%
\begin{align*}
\dbinom{n+1}{1+\left(  r-1\right)  +1}  &  =\sum_{k=0}^{n}\underbrace{\dbinom
{k}{1}}_{\substack{=k\\\text{(by (\ref{eq.exa.binom.small.nC1}),}%
\\\text{applied to }k\\\text{instead of }n\text{)}}}\dbinom{n-k}{r-1}%
=\sum_{k=0}^{n}k\dbinom{n-k}{r-1}\\
&  =\underbrace{0\dbinom{n-0}{r-1}}_{=0}+\sum_{k=1}^{n}k\dbinom{n-k}%
{r-1}=\underbrace{\sum_{k=1}^{n}}_{\substack{=\sum_{k\in\left[  n\right]
}\\\text{(since }\left\{  1,2,\ldots,n\right\}  =\left[  n\right]  \text{)}%
}}\underbrace{k\dbinom{n-k}{r-1}}_{=\dbinom{n-k}{r-1}\cdot k}\\
&  =\sum_{k\in\left[  n\right]  }\dbinom{n-k}{r-1}\cdot k.
\end{align*}
Comparing this with (\ref{sol.enum.IMO1981-2-ca.1st.9}), we obtain%
\[
\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S=\dbinom{n+1}{1+\left(  r-1\right)  +1}=\dbinom{n+1}{r+1}%
\]
(since $1+\left(  r-1\right)  =r$). This solves Exercise
\ref{exe.enum.IMO1981-2-ca}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.enum.IMO1981-2-ca} (sketched).]We
proceed by double counting. The things we shall count are the $\left(
r+1\right)  $-element subsets of the set $\left\{  0,1,\ldots,n\right\}  $.
How many such subsets are there? Here are two ways to answer this question:

\textit{First way:} The set $\left\{  0,1,\ldots,n\right\}  $ is an $\left(
n+1\right)  $-element set; thus, an easy application of Theorem
\ref{thm.binom.comb} yields
\begin{align}
&  \left(  \text{\# of }\left(  r+1\right)  \text{-element subsets of
}\left\{  0,1,\ldots,n\right\}  \right) \nonumber\\
&  =\dbinom{n+1}{r+1}. \label{sol.enum.IMO1981-2-ca.2nd.1}%
\end{align}


\textit{Second way:} If $U$ is an $\left(  r+1\right)  $-element subset of
$\left\{  0,1,\ldots,n\right\}  $, then we define the \textit{tail} of $U$ to
be the set $U\setminus\left\{  \min U\right\}  $. That is, the tail of $U$ is
defined to be $U$ with the smallest element removed.\footnote{For example, if
$U=\left\{  2,4,6,7\right\}  $, then the tail of $U$ is $\left\{
4,6,7\right\}  $.} It is easy to see that if $U$ is an $\left(  r+1\right)
$-element subset of $\left\{  0,1,\ldots,n\right\}  $, then the tail of $U$ is
an $r$-element subset of $\left[  n\right]  $ (indeed, removing the smallest
element from $U$ clearly reduces the size of $U$ by $1$, and furthermore all
the remaining elements are positive\footnote{because if one of them was $0$,
then it would be the smallest element of $U$ and thus would have been removed}
and therefore belong to $\left[  n\right]  $). Hence, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of }\left(  r+1\right)  \text{-element subsets of
}\left\{  0,1,\ldots,n\right\}  \right) \\
&  =\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert
S\right\vert =r}}\left(  \text{\# of }\left(  r+1\right)  \text{-element
subsets of }\left\{  0,1,\ldots,n\right\}  \text{ with tail }S\right)  .
\end{align*}


Now, let $S$ be an $r$-element subset of $\left[  n\right]  $. What is the \#
of $\left(  r+1\right)  $-element subsets of $\left\{  0,1,\ldots,n\right\}  $
with tail $S$ ? Clearly, any such subset must contain all $r$ elements of $S$
as well as one extra element; this extra element must furthermore be smaller
than $\min S$ (in order for $S$ to be the tail of the subset). Thus, any
$\left(  r+1\right)  $-element subset of $\left\{  0,1,\ldots,n\right\}  $
with tail $S$ must have the form $S\cup\left\{  i\right\}  $ for some
$i\in\left\{  0,1,\ldots,\min S-1\right\}  $. Conversely, any set of the
latter form is an $\left(  r+1\right)  $-element subset of $\left\{
0,1,\ldots,n\right\}  $ with tail $S$ (check this!). Thus, the $\left(
r+1\right)  $-element subsets of $\left\{  0,1,\ldots,n\right\}  $ with tail
$S$ are the $\min S$ sets%
\[
S\cup\left\{  0\right\}  ,\ \ \ S\cup\left\{  1\right\}  ,\ \ \ S\cup\left\{
2\right\}  ,\ \ \ \ldots,\ \ \ S\cup\left\{  \min S-1\right\}  .
\]
Hence,%
\begin{align}
&  \left(  \text{\# of }\left(  r+1\right)  \text{-element subsets of
}\left\{  0,1,\ldots,n\right\}  \text{ with tail }S\right) \nonumber\\
&  =\min S. \label{sol.enum.IMO1981-2-ca.2nd.5}%
\end{align}


Now, forget that we fixed $S$. We thus have proved
(\ref{sol.enum.IMO1981-2-ca.2nd.5}) for each $r$-element subset $S$ of
$\left[  n\right]  $. Now, recall that%
\begin{align*}
&  \left(  \text{\# of }\left(  r+1\right)  \text{-element subsets of
}\left\{  0,1,\ldots,n\right\}  \right) \\
&  =\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert
S\right\vert =r}}\underbrace{\left(  \text{\# of }\left(  r+1\right)
\text{-element subsets of }\left\{  0,1,\ldots,n\right\}  \text{ with tail
}S\right)  }_{\substack{=\min S\\\text{(by (\ref{sol.enum.IMO1981-2-ca.2nd.5}%
))}}}\\
&  =\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert
S\right\vert =r}}\min S.
\end{align*}


Comparing this with (\ref{sol.enum.IMO1981-2-ca.2nd.1}), we obtain%
\[
\sum\limits_{\substack{S\subseteq\left[  n\right]  ;\\\left\vert S\right\vert
=r}}\min S=\dbinom{n+1}{r+1}.
\]
This solves Exercise \ref{exe.enum.IMO1981-2-ca} again.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.comps.no-1}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.comps.no-1}.]We shall call a tuple
\textit{onefree} if it does not contain $1$ as an entry. Thus, Exercise
\ref{exe.enum.comps.no-1} asks for the \# of onefree compositions of $n$. Here
is the answer:

\begin{proposition}
\label{prop.sol.enum.comps.no-1}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)
$ be the Fibonacci sequence (defined as in Definition \ref{def.fibonacci}).
Then,%
\begin{equation}
\left(  \text{\# of onefree compositions of }n\right)  =f_{n-1}
\label{sol.enum.comps.no-1.goal}%
\end{equation}
for each positive integer $n$.
\end{proposition}

We shall outline three proofs of Proposition \ref{prop.sol.enum.comps.no-1}:

\begin{proof}
[First proof of Proposition \ref{prop.sol.enum.comps.no-1} (sketched).]We
proceed by strong induction on $n$:

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Proposition \ref{prop.sol.enum.comps.no-1} holds
for $n<m$. We must prove that Proposition \ref{prop.sol.enum.comps.no-1} holds
for $n=m$. In other words, we must prove that $\left(  \text{\# of onefree
compositions of }m\right)  =f_{m-1}$.

If $m=1$ or $m=2$, then this is easy to check\footnote{\textit{Proof.} There
are no onefree compositions of $1$ (since the only composition of $1$ is
$\left(  1\right)  $, which is clearly not onefree). That is, we have $\left(
\text{\# of onefree compositions of }1\right)  =0$. Comparing this with
$f_{1-1}=f_{0}=0$, we obtain $\left(  \text{\# of onefree compositions of
}1\right)  =f_{1-1}$. Hence, $\left(  \text{\# of onefree compositions of
}m\right)  =f_{m-1}$ holds for $m=1$.
\par
The only onefree composition of $2$ is $\left(  2\right)  $ (since the only
compositions of $2$ are $\left(  1,1\right)  $ and $\left(  2\right)  $, but
$\left(  1,1\right)  $ is not onefree). Thus, we have $\left(  \text{\# of
onefree compositions of }2\right)  =1$. Comparing this with $f_{2-1}=f_{1}=1$,
we obtain $\left(  \text{\# of onefree compositions of }2\right)  =f_{2-1}$.
Hence, $\left(  \text{\# of onefree compositions of }m\right)  =f_{m-1}$ holds
for $m=2$.
\par
We have thus proved that $\left(  \text{\# of onefree compositions of
}m\right)  =f_{m-1}$ holds for $m=1$ and for $m=2$.}. Thus, for the rest of
this proof, we WLOG assume that we have neither $m=1$ nor $m=2$. Hence,
$m\geq3$ (since $m$ is a positive integer). Therefore, $m-1$ and $m-2$ are
positive integers. Moreover, from $m\geq3$, we obtain $m-1\geq2$.

Definition \ref{def.fibonacci} yields that $f_{n}=f_{n-1}+f_{n-2}$ for all
$n\geq2$. We can apply this to $n=m-1$ (since $m-1\geq2$), and thus obtain
\begin{equation}
f_{m-1}=\underbrace{f_{\left(  m-1\right)  -1}}_{=f_{m-2}}%
+\underbrace{f_{\left(  m-1\right)  -2}}_{=f_{m-3}}=f_{m-2}+f_{m-3}.
\label{pf.prop.sol.enum.comps.no-1.1st.fibrec}%
\end{equation}


We know that $m-1$ is a positive integer satisfying $m-1<m$. Hence,
Proposition \ref{prop.sol.enum.comps.no-1} holds for $n=m-1$ (since our
induction hypothesis says that Proposition \ref{prop.sol.enum.comps.no-1}
holds for $n<m$). In other words, we have%
\begin{equation}
\left(  \text{\# of onefree compositions of }m-1\right)  =f_{\left(
m-1\right)  -1}. \label{pf.prop.sol.enum.comps.no-1.1st.IH1}%
\end{equation}


The same argument (applied to $m-2$ instead of $m-1$) yields%
\begin{equation}
\left(  \text{\# of onefree compositions of }m-2\right)  =f_{\left(
m-2\right)  -1}. \label{pf.prop.sol.enum.comps.no-1.1st.IH2}%
\end{equation}


Now, if $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a onefree composition
of $m$, then we necessarily have $k\geq1$\ \ \ \ \footnote{\textit{Proof.} Let
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ be a onefree composition of $m$.
Then, $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a composition of $m$,
that is, a tuple of positive integers whose sum is $m$ (by the definition of a
\textquotedblleft composition\textquotedblright). In other words, $a_{1}%
,a_{2},\ldots,a_{k}$ are positive integers satisfying $a_{1}+a_{2}%
+\cdots+a_{k}=m$.
\par
If we had $k=0$, then we would have $a_{1}+a_{2}+\cdots+a_{k}=a_{1}%
+a_{2}+\cdots+a_{0}=\left(  \text{empty sum}\right)  =0$, which would
contradict $a_{1}+a_{2}+\cdots+a_{k}=m>0$. Hence, we cannot have $k=0$. Thus,
$k\neq0$, so that $k\geq1$ (since $k\in\mathbb{N}$). Qed.}, and therefore its
first entry $a_{1}$ is well-defined. We say that a onefree composition
$\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ of $m$ is

\begin{itemize}
\item \textit{green} if $a_{1}=2$;

\item \textit{red} if $a_{1}\neq2$.
\end{itemize}

Each onefree composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ of $m$ is
either green or red (since it satisfies either $a_{1}=2$ or $a_{1}\neq2$), but
cannot be both at the same time. Hence, the sum rule yields%
\begin{align}
&  \left(  \text{\# of onefree compositions of }m\right) \nonumber\\
&  =\left(  \text{\# of green onefree compositions of }m\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of red onefree compositions of
}m\right)  . \label{pf.prop.sol.enum.comps.no-1.1st.sum1}%
\end{align}
We shall now compute the two addends on the right hand side.

If $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a green onefree composition
of $m$, then $\left(  a_{2},a_{3},\ldots,a_{k}\right)  $ is a onefree
composition of $m-2$\ \ \ \ \footnote{\textit{Proof.} Let $\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  $ be a green onefree composition of $m$. Then,
$a_{1}=2$ (since $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is green).
Moreover, $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a composition of $m$,
that is, a tuple of positive integers whose sum is $m$ (by the definition of a
\textquotedblleft composition\textquotedblright). In other words, $a_{1}%
,a_{2},\ldots,a_{k}$ are positive integers satisfying $a_{1}+a_{2}%
+\cdots+a_{k}=m$. Hence,%
\[
m=a_{1}+a_{2}+\cdots+a_{k}=\underbrace{a_{1}}_{=2}+\left(  a_{2}+a_{3}%
+\cdots+a_{k}\right)  =2+\left(  a_{2}+a_{3}+\cdots+a_{k}\right)  ,
\]
so that $a_{2}+a_{3}+\cdots+a_{k}=m-2$.
\par
The positive integers $a_{1},a_{2},\ldots,a_{k}$ are distinct from $1$ (since
the composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is onefree, i.e.,
does not contain $1$ as an entry). Thus, in particular, the positive integers
$a_{2},a_{3},\ldots,a_{k}$ are distinct from $1$. Now, $\left(  a_{2}%
,a_{3},\ldots,a_{k}\right)  $ is a tuple of positive integers whose sum is
$m-2$ (since $a_{2}+a_{3}+\cdots+a_{k}=m-2$); in other words, $\left(
a_{2},a_{3},\ldots,a_{k}\right)  $ is a composition of $m-2$ (by the
definition of a \textquotedblleft composition\textquotedblright). This
composition $\left(  a_{2},a_{3},\ldots,a_{k}\right)  $ doesn't contain $1$ as
an entry (since the positive integers $a_{2},a_{3},\ldots,a_{k}$ are distinct
from $1$); in other words, it is onefree. Hence, $\left(  a_{2},a_{3}%
,\ldots,a_{k}\right)  $ is a onefree composition of $m-2$, qed.}. Hence, we
can define a map%
\begin{align*}
\Phi:\left\{  \text{green onefree compositions of }m\right\}   &
\rightarrow\left\{  \text{onefree compositions of }m-2\right\}  ,\\
\left(  a_{1},a_{2},\ldots,a_{k}\right)   &  \mapsto\left(  a_{2},a_{3}%
,\ldots,a_{k}\right)  .
\end{align*}
It is easy to see that this map $\Phi$ is a bijection\footnote{Indeed, we can
easily construct a map inverse to $\Phi$: Namely, if $\left(  b_{1}%
,b_{2},\ldots,b_{\ell}\right)  $ is a onefree composition of $m-2$, then
$\left(  2,b_{1},b_{2},\ldots,b_{\ell}\right)  $ is a green onefree
composition of $m$ (check this!). Thus, the map%
\begin{align*}
\Psi:\left\{  \text{onefree compositions of }m-2\right\}   &  \rightarrow
\left\{  \text{green onefree compositions of }m\right\}  ,\\
\left(  b_{1},b_{2},\ldots,b_{\ell}\right)   &  \mapsto\left(  2,b_{1}%
,b_{2},\ldots,b_{\ell}\right)
\end{align*}
is well-defined. It is straightforward to see that the maps $\Phi$ and $\Psi$
are mutually inverse. Thus, the map $\Phi$ is invertible, i.e., is a
bijection.}. Hence, the bijection principle yields%
\[
\left\vert \left\{  \text{green onefree compositions of }m\right\}
\right\vert =\left\vert \left\{  \text{onefree compositions of }m-2\right\}
\right\vert .
\]


\noindent Thus,%
\begin{align}
&  \left(  \text{\# of green onefree compositions of }m\right) \nonumber\\
&  =\left\vert \left\{  \text{green onefree compositions of }m\right\}
\right\vert \nonumber\\
&  =\left\vert \left\{  \text{onefree compositions of }m-2\right\}
\right\vert \nonumber\\
&  =\left(  \text{\# of onefree compositions of }m-2\right) \nonumber\\
&  =f_{\left(  m-2\right)  -1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.prop.sol.enum.comps.no-1.1st.IH2})}\right) \nonumber\\
&  =f_{m-3}. \label{pf.prop.sol.enum.comps.no-1.1st.numgreen}%
\end{align}


Next, let us count the red onefree compositions of $m$.

If $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a red onefree composition of
$m$, then $\left(  a_{1}-1,a_{2},a_{3},\ldots,a_{k}\right)  $ is a onefree
composition of $m-1$\ \ \ \ \footnote{\textit{Proof.} Let $\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  $ be a red onefree composition of $m$. Then,
$a_{1}\neq2$ (since $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is red).
Moreover, $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a composition of $m$,
that is, a tuple of positive integers whose sum is $m$ (by the definition of a
\textquotedblleft composition\textquotedblright). In other words, $a_{1}%
,a_{2},\ldots,a_{k}$ are positive integers satisfying $a_{1}+a_{2}%
+\cdots+a_{k}=m$. Comparing $a_{1}+a_{2}+\cdots+a_{k}=m$ with%
\[
a_{1}+a_{2}+\cdots+a_{k}=\underbrace{a_{1}}_{=1+\left(  a_{1}-1\right)
}+\left(  a_{2}+a_{3}+\cdots+a_{k}\right)  =1+\left(  a_{1}-1\right)  +\left(
a_{2}+a_{3}+\cdots+a_{k}\right)  ,
\]
we obtain $1+\left(  a_{1}-1\right)  +\left(  a_{2}+a_{3}+\cdots+a_{k}\right)
=m$. Hence, $\left(  a_{1}-1\right)  +\left(  a_{2}+a_{3}+\cdots+a_{k}\right)
=m-1$.
\par
The positive integers $a_{1},a_{2},\ldots,a_{k}$ are distinct from $1$ (since
the composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is onefree, i.e.,
does not contain $1$ as an entry). Thus, in particular, the positive integer
$a_{1}$ is distinct from $1$, and the positive integers $a_{2},a_{3}%
,\ldots,a_{k}$ are distinct from $1$.
\par
The positive integer $a_{1}$ is distinct from $1$, and thus must be $\geq2$.
Hence, $a_{1}-1\geq1$. This shows that $a_{1}-1$ is a positive integer.
Moreover, $a_{1}-1\neq1$ (since $a_{1}\neq2$); thus, the number $a_{1}-1$ is
distinct from $1$. Since we also know that the numbers $a_{2},a_{3}%
,\ldots,a_{k}$ are distinct from $1$, we thus conclude that the numbers
$a_{1}-1,a_{2},a_{3},\ldots,a_{k}$ are distinct from $1$.
\par
We now know that $a_{1}-1$ is a positive integer, and that $a_{2},a_{3}%
,\ldots,a_{k}$ are positive integers as well. Hence, $\left(  a_{1}%
-1,a_{2},a_{3},\ldots,a_{k}\right)  $ is a tuple of positive integers.
Moreover, $\left(  a_{1}-1,a_{2},a_{3},\ldots,a_{k}\right)  $ is a tuple of
positive integers whose sum is $m-1$ (since $\left(  a_{1}-1\right)  +\left(
a_{2}+a_{3}+\cdots+a_{k}\right)  =m-1$); in other words, $\left(
a_{1}-1,a_{2},a_{3},\ldots,a_{k}\right)  $ is a composition of $m-1$ (by the
definition of a \textquotedblleft composition\textquotedblright). This
composition $\left(  a_{1}-1,a_{2},a_{3},\ldots,a_{k}\right)  $ doesn't
contain $1$ as an entry (since the numbers $a_{1}-1,a_{2},a_{3},\ldots,a_{k}$
are distinct from $1$); in other words, it is onefree. Hence, $\left(
a_{1}-1,a_{2},a_{3},\ldots,a_{k}\right)  $ is a onefree composition of $m-1$,
qed.}. Hence, we can define a map%
\begin{align*}
\Phi^{\prime}:\left\{  \text{red onefree compositions of }m\right\}   &
\rightarrow\left\{  \text{onefree compositions of }m-1\right\}  ,\\
\left(  a_{1},a_{2},\ldots,a_{k}\right)   &  \mapsto\left(  a_{1}%
-1,a_{2},a_{3},\ldots,a_{k}\right)  .
\end{align*}
It is easy to see that this map $\Phi^{\prime}$ is a
bijection\footnote{Indeed, we can easily construct a map inverse to
$\Phi^{\prime}$: Namely, if $\left(  b_{1},b_{2},\ldots,b_{\ell}\right)  $ is
a onefree composition of $m-1$, then the tuple $\left(  b_{1}+1,b_{2}%
,b_{3},\ldots,b_{\ell}\right)  $ is well-defined (this requires proving that
$\ell\geq1$; check this!) and is a red onefree composition of $m$ (check
this!). Thus, the map%
\begin{align*}
\Psi^{\prime}:\left\{  \text{onefree compositions of }m-1\right\}   &
\rightarrow\left\{  \text{red onefree compositions of }m\right\}  ,\\
\left(  b_{1},b_{2},\ldots,b_{\ell}\right)   &  \mapsto\left(  b_{1}%
+1,b_{2},b_{3},\ldots,b_{\ell}\right)
\end{align*}
is well-defined. It is straightforward to see that the maps $\Phi^{\prime}$
and $\Psi^{\prime}$ are mutually inverse. Thus, the map $\Phi^{\prime}$ is
invertible, i.e., is a bijection.}. Hence, the bijection principle yields%
\[
\left\vert \left\{  \text{red onefree compositions of }m\right\}  \right\vert
=\left\vert \left\{  \text{onefree compositions of }m-1\right\}  \right\vert
.
\]


\noindent Thus,%
\begin{align}
&  \left(  \text{\# of red onefree compositions of }m\right) \nonumber\\
&  =\left\vert \left\{  \text{red onefree compositions of }m\right\}
\right\vert \nonumber\\
&  =\left\vert \left\{  \text{onefree compositions of }m-1\right\}
\right\vert \nonumber\\
&  =\left(  \text{\# of onefree compositions of }m-1\right) \nonumber\\
&  =f_{\left(  m-1\right)  -1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{pf.prop.sol.enum.comps.no-1.1st.IH1})}\right) \nonumber\\
&  =f_{m-2}. \label{pf.prop.sol.enum.comps.no-1.1st.numred}%
\end{align}


Now, (\ref{pf.prop.sol.enum.comps.no-1.1st.sum1}) becomes%
\begin{align*}
&  \left(  \text{\# of onefree compositions of }m\right) \\
&  =\underbrace{\left(  \text{\# of green onefree compositions of }m\right)
}_{\substack{=f_{m-3}\\\text{(by
(\ref{pf.prop.sol.enum.comps.no-1.1st.numgreen}))}}}+\underbrace{\left(
\text{\# of red onefree compositions of }m\right)  }_{\substack{=f_{m-2}%
\\\text{(by (\ref{pf.prop.sol.enum.comps.no-1.1st.numred}))}}}\\
&  =f_{m-3}+f_{m-2}=f_{m-2}+f_{m-3}=f_{m-1}\ \ \ \ \ \ \ \ \ \ \left(
\text{by (\ref{pf.prop.sol.enum.comps.no-1.1st.fibrec})}\right)  .
\end{align*}
In other words, Proposition \ref{prop.sol.enum.comps.no-1} holds for $n=m$.
This completes the induction step; thus, Proposition
\ref{prop.sol.enum.comps.no-1} is proved.
\end{proof}

\begin{proof}
[Second proof of Proposition \ref{prop.sol.enum.comps.no-1} (sketched).]We
proceed by strong induction on $n$:

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Proposition \ref{prop.sol.enum.comps.no-1} holds
for $n<m$. We must prove that Proposition \ref{prop.sol.enum.comps.no-1} holds
for $n=m$. In other words, we must prove that $\left(  \text{\# of onefree
compositions of }m\right)  =f_{m-1}$.

If $m=1$ or $m=2$, then this is easy to check. Thus, for the rest of this
proof, we WLOG assume that we have neither $m=1$ nor $m=2$. Hence, $m\geq3$
(since $m$ is a positive integer), so that $m-3\geq0$.

If $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a onefree composition of
$m$, then we necessarily have $k\geq1$\ \ \ \ \footnote{This follows from the
positivity of $m$. See the first proof of Proposition
\ref{prop.sol.enum.comps.no-1} above for the details of the argument.}, and
therefore its first entry $a_{1}$ is well-defined. This first entry $a_{1}$
must be a positive integer (since $a_{1},a_{2},\ldots,a_{k}$ are positive
integers) and satisfies $a_{1}\neq1$ (since the composition $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $ is onefree). Hence, it satisfies $a_{1}%
\geq2$ (since any positive integer that is $\neq1$ must be $\geq2$). It
furthermore satisfies $a_{1}\leq m$\ \ \ \ \footnote{\textit{Proof.} The
numbers $a_{1},a_{2},\ldots,a_{k}$ are positive integers; hence, none of them
cannot exceed their sum. In particular, this shows that $a_{1}\leq a_{1}%
+a_{2}+\cdots+a_{k}=m$ (since $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a
composition of $m$, that is, a tuple of positive integers whose sum is $m$).},
and thus $a_{1}\in\left\{  2,3,\ldots,m\right\}  $ (since $a_{1}\geq2$ and
$a_{1}\leq m$). Hence, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of onefree compositions of }m\right) \\
&  =\sum_{r\in\left\{  2,3,\ldots,m\right\}  }\left(  \text{\# of onefree
compositions }\left(  a_{1},a_{2},\ldots,a_{k}\right)  \text{ of }m\text{ such
that }a_{1}=r\right)  .
\end{align*}


Now, let us fix some $r\in\left\{  2,3,\ldots,m\right\}  $. We shall compute%
\[
\left(  \text{\# of onefree compositions }\left(  a_{1},a_{2},\ldots
,a_{k}\right)  \text{ of }m\text{ such that }a_{1}=r\right)  .
\]


Indeed, it is not hard to see that the map
\begin{align*}
&  \left\{  \text{onefree compositions }\left(  a_{1},a_{2},\ldots
,a_{k}\right)  \text{ of }m\text{ such that }a_{1}=r\right\} \\
\rightarrow &  \left\{  \text{onefree compositions of }m-r\right\}
\end{align*}
that sends each $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ to $\left(
a_{2},a_{3},\ldots,a_{k}\right)  $ is a bijection\footnote{Its inverse map, of
course, sends each onefree composition $\left(  b_{1},b_{2},\ldots,b_{\ell
}\right)  $ of $m-r$ to the onefree composition $\left(  r,b_{1},b_{2}%
,\ldots,b_{\ell}\right)  $ of $m$.}. Thus, the bijection principle yields%
\begin{align*}
&  \left\vert \left\{  \text{onefree compositions }\left(  a_{1},a_{2}%
,\ldots,a_{k}\right)  \text{ of }m\text{ such that }a_{1}=r\right\}
\right\vert \\
&  =\left\vert \left\{  \text{onefree compositions of }m-r\right\}
\right\vert .
\end{align*}
In other words,%
\begin{align}
&  \left(  \text{\# of onefree compositions }\left(  a_{1},a_{2},\ldots
,a_{k}\right)  \text{ of }m\text{ such that }a_{1}=r\right) \nonumber\\
&  =\left(  \text{\# of onefree compositions of }m-r\right)  .
\label{pf.prop.sol.enum.comps.no-1.2nd.4}%
\end{align}


Forget that we fixed $r$. We thus have proved
(\ref{pf.prop.sol.enum.comps.no-1.2nd.4}) for each $r\in\left\{
2,3,\ldots,m\right\}  $. Now,
\begin{align*}
&  \left(  \text{\# of onefree compositions of }m\right) \\
&  =\underbrace{\sum_{r\in\left\{  2,3,\ldots,m\right\}  }}_{=\sum_{r=2}^{m}%
}\underbrace{\left(  \text{\# of onefree compositions }\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  \text{ of }m\text{ such that }a_{1}=r\right)
}_{\substack{=\left(  \text{\# of onefree compositions of }m-r\right)
\\\text{(by (\ref{pf.prop.sol.enum.comps.no-1.2nd.4}))}}}\\
&  =\sum_{r=2}^{m}\left(  \text{\# of onefree compositions of }m-r\right) \\
&  =\underbrace{\sum_{r=2}^{m-1}\left(  \text{\# of onefree compositions of
}m-r\right)  }_{\substack{=\sum_{n=1}^{m-2}\left(  \text{\# of onefree
compositions of }n\right)  \\\text{(here, we have substituted }n\text{ for
}m-r\text{ in the sum)}}}\\
&  \ \ \ \ \ \ \ \ \ \ +\underbrace{\left(  \text{\# of onefree compositions
of }m-m\right)  }_{\substack{=1\\\text{(since }m-m=0\text{, and thus the only
onefree composition of }m-m\text{ is the empty tuple }\left(  {}\right)
\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split off the addend for }r=m\text{ from the sum}\\
\text{(this addend was indeed in the sum, because }m\geq3\geq2\text{)}%
\end{array}
\right) \\
&  =\sum_{n=1}^{m-2}\underbrace{\left(  \text{\# of onefree compositions of
}n\right)  }_{\substack{=f_{n-1}\\\text{(by our induction hypothesis, since
}n\leq m-2<m\text{)}}}+1\\
&  =\underbrace{\sum_{n=1}^{m-2}f_{n-1}}_{\substack{=f_{0}+f_{1}%
+\cdots+f_{m-3}\\=f_{m-1}-1\\\text{(by Exercise \ref{exe.fibonacci.first-sum}
(applied to }n=m-3\text{),}\\\text{since }m-3\geq0\text{)}}}+1=f_{m-1}%
-1+1=f_{m-1}.
\end{align*}
This is precisely what we needed to show. Thus, the induction step is
complete, so that Proposition \ref{prop.sol.enum.comps.no-1} is proved.
\end{proof}

Our third proof of Proposition \ref{prop.sol.enum.comps.no-1} will be
bijective (i.e., it will rely on a bijection). Crucial to this proof will be
the following combinatorial interpretation of Fibonacci numbers:

\begin{proposition}
\label{prop.fib.lac-interval}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $
be the Fibonacci sequence. Let $n\in\mathbb{N}$ and $a\in\mathbb{Z}$. Then,%
\[
\left(  \text{\# of lacunar subsets of }\left[  a+1,a+n\right]  \right)
=f_{n+2},
\]
where $\left[  a+1,a+n\right]  $ denotes the $n$-element set $\left\{
a+1,a+2,\ldots,a+n\right\}  $.
\end{proposition}

\begin{proof}
[Hints to the proof of Proposition \ref{prop.fib.lac-interval}.](See
\cite[proof of Proposition 1.4.18]{19fco} for details.) Proposition
\ref{prop.fib.lac-interval} can easily be derived from Theorem
\ref{thm.fib.lac}. Indeed, the set $\left[  a+1,a+n\right]  $ (where we are
using the notations of Proposition \ref{prop.fib.lac-interval}) is just the
set $\left[  n\right]  $ shifted to the right by $a$ units (if we visualize
these sets on the real axis); in more formal language, there is a bijection
from $\left[  n\right]  $ to $\left[  a+1,a+n\right]  $ that sends each
$i\in\left[  n\right]  $ to $a+i$. This bijection gives rise to a bijection
from $\left\{  \text{lacunar subsets of }\left[  n\right]  \right\}  $ to
$\left\{  \text{lacunar subsets of }\left[  a+1,a+n\right]  \right\}  $
(namely, we apply the same shift to each element of our lacunar subset). Thus,
the bijection principle yields
\begin{align*}
&  \left(  \text{\# of lacunar subsets of }\left[  a+1,a+n\right]  \right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)
=f_{n+2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Theorem \ref{thm.fib.lac}%
}\right)  .
\end{align*}
This proves Proposition \ref{prop.fib.lac-interval}.
\end{proof}

\begin{proof}
[Third proof of Proposition \ref{prop.sol.enum.comps.no-1} (sketched).]Let $n$
be a positive integer. We WLOG assume that $n\geq3$ (since the other cases can
easily be checked by hand). Thus, $n-3\in\mathbb{N}$.

Consider the map
\[
C:\left\{  \text{compositions of }n\right\}  \rightarrow\left\{  \text{subsets
of }\left[  n-1\right]  \right\}
\]
defined in the proof of Theorem \ref{thm.enum.comps}. We recall (from said
proof) that this map $C$ is a bijection; thus, it has an inverse map $C^{-1}$.

Now, the following two claims are crucial:\footnote{In the following, the
notation $\left[  p,q\right]  $ for two integers $p$ and $q$ shall denote the
set $\left\{  p,p+1,\ldots,q\right\}  \subseteq\mathbb{Z}$.}

\begin{statement}
\textit{Claim 1:} Let $a$ be a onefree composition of $n$. Then, $C\left(
a\right)  $ is a lacunar subset of $\left[  2,n-2\right]  $.
\end{statement}

\begin{statement}
\textit{Claim 2:} Let $U$ be a lacunar subset of $\left[  2,n-2\right]  $.
Then, $C^{-1}\left(  U\right)  $ is a onefree composition of $n$.
\end{statement}

[\textit{Proof of Claim 1:} The composition $a$ is onefree; in other words, it
does not contain $1$ as an entry (by the definition of \textquotedblleft
onefree\textquotedblright).

Write the composition $a$ in the form $a=\left(  a_{1},a_{2},\ldots
,a_{k}\right)  $. Then, $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a
composition of $n$. In other words, $\left(  a_{1},a_{2},\ldots,a_{k}\right)
$ is a tuple of positive integers whose sum is $n$. Hence, the numbers
$a_{1},a_{2},\ldots,a_{k}$ are positive integers and satisfy $a_{1}%
+a_{2}+\cdots+a_{k}=n$.

The numbers $a_{1},a_{2},\ldots,a_{k}$ are the entries of the composition $a$
(since $a=\left(  a_{1},a_{2},\ldots,a_{k}\right)  $), and therefore are
distinct from $1$ (since this composition $a$ does not contain $1$ as an
entry). Hence, these numbers $a_{1},a_{2},\ldots,a_{k}$ are $\geq2$ (since
they are positive integers).

Now, the definition of $C\left(  a\right)  $ yields%
\[
C\left(  a\right)  =\left\{  a_{1}+a_{2}+\cdots+a_{i}\ \mid\ i\in\left\{
1,2,\ldots,k-1\right\}  \right\}  .
\]
Hence, it is easy to see that $C\left(  a\right)  $ is a subset of $\left[
2,n-2\right]  $\ \ \ \ \footnote{\textit{Proof.} Let $p\in C\left(  a\right)
$. We shall show that $p\in\left[  2,n-2\right]  $.
\par
We have $p\in C\left(  a\right)  =\left\{  a_{1}+a_{2}+\cdots+a_{i}%
\ \mid\ i\in\left\{  1,2,\ldots,k-1\right\}  \right\}  $. In other words,
$p=a_{1}+a_{2}+\cdots+a_{i}$ for some $i\in\left\{  1,2,\ldots,k-1\right\}  $.
Consider this $i$.
\par
We have $i\geq1$ (since $i\in\left\{  1,2,\ldots,k-1\right\}  $). Thus,
$a_{1}$ is an addend of the sum $a_{1}+a_{2}+\cdots+a_{i}$. But $a_{1}%
+a_{2}+\cdots+a_{i}$ is a sum of positive integers (since $a_{1},a_{2}%
,\ldots,a_{k}$ are positive integers), and thus is $\geq$ to any of its
addends. Hence, $a_{1}+a_{2}+\cdots+a_{i}\geq a_{1}$ (since $a_{1}$ is an
addend of this sum). Now, $p=a_{1}+a_{2}+\cdots+a_{i}\geq a_{1}\geq2$ (since
the numbers $a_{1},a_{2},\ldots,a_{k}$ are $\geq2$).
\par
We have $i\leq k-1$ (since $i\in\left\{  1,2,\ldots,k-1\right\}  $). Thus, the
sum $a_{1}+a_{2}+\cdots+a_{k-1}$ contains all $i$ addends of the sum
$a_{1}+a_{2}+\cdots+a_{i}$ and possibly a few more. Since all these extra
addends are positive (because $a_{1},a_{2},\ldots,a_{k}$ are positive
integers), we thus conclude that $a_{1}+a_{2}+\cdots+a_{k-1}\geq a_{1}%
+a_{2}+\cdots+a_{i}$ (because a sum can only get larger if we add some extra
positive addends). Hence,%
\begin{align*}
a_{1}+a_{2}+\cdots+a_{i}  &  \leq a_{1}+a_{2}+\cdots+a_{k-1}\\
&  =\underbrace{\left(  a_{1}+a_{2}+\cdots+a_{k}\right)  }_{=n}%
-\underbrace{a_{k}}_{\substack{\geq2\\\text{(since the numbers }a_{1}%
,a_{2},\ldots,a_{k}\text{ are }\geq2\text{)}}}\\
&  \leq n-2.
\end{align*}
Hence, $p=a_{1}+a_{2}+\cdots+a_{i}\leq n-2$.
\par
Combining $p\geq2$ with $p\leq n-2$, we obtain $p\in\left[  2,n-2\right]  $.
\par
Forget that we fixed $p$. We thus have shown that $p\in\left[  2,n-2\right]  $
for each $p\in C\left(  a\right)  $. Hence, $C\left(  a\right)  $ is a subset
of $\left[  2,n-2\right]  $.}. Furthermore, the set $C\left(  a\right)  $ is
lacunar\footnote{\textit{Proof.} Assume the contrary. Thus, the set $C\left(
a\right)  $ is not lacunar; in other words, the set $C\left(  a\right)  $
contains two consecutive integers (by the definition of \textquotedblleft
lacunar\textquotedblright). Let $p$ and $q$ be these two consecutive integers
(in some order). Thus, $p\in C\left(  a\right)  $ and $q\in C\left(  a\right)
$.
\par
We have $p\in C\left(  a\right)  =\left\{  a_{1}+a_{2}+\cdots+a_{i}%
\ \mid\ i\in\left\{  1,2,\ldots,k-1\right\}  \right\}  $. In other words,
there exists some $u\in\left\{  1,2,\ldots,k-1\right\}  $ such that
$p=a_{1}+a_{2}+\cdots+a_{u}$. Consider this $u$.
\par
We have $q\in C\left(  a\right)  =\left\{  a_{1}+a_{2}+\cdots+a_{i}%
\ \mid\ i\in\left\{  1,2,\ldots,k-1\right\}  \right\}  $. In other words,
there exists some $v\in\left\{  1,2,\ldots,k-1\right\}  $ such that
$q=a_{1}+a_{2}+\cdots+a_{v}$. Consider this $v$.
\par
We WLOG assume that $u\leq v$ (since otherwise, we can just swap $u$ with $v$,
while simultaneously swapping $p$ with $q$). Note that $p\neq q$ (since $p$
and $q$ are consecutive integers), so that $u\neq v$ (because if we had $u=v$,
then we would have $a_{1}+a_{2}+\cdots+a_{u}=a_{1}+a_{2}+\cdots+a_{v}$, which
would contradict $a_{1}+a_{2}+\cdots+a_{u}=p\neq q=a_{1}+a_{2}+\cdots+a_{v}$).
Combining this with $u\leq v$, we obtain $u<v$. Now,%
\begin{align*}
q  &  =a_{1}+a_{2}+\cdots+a_{v}=\underbrace{\left(  a_{1}+a_{2}+\cdots
+a_{u}\right)  }_{=p}+\left(  a_{u+1}+a_{u+2}+\cdots+a_{v}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{since }u\leq v\right) \\
&  =p+\left(  a_{u+1}+a_{u+2}+\cdots+a_{v}\right)  .
\end{align*}
But $a_{v}$ is an addend of the sum $a_{u+1}+a_{u+2}+\cdots+a_{v}$ (since
$u<v$). However, $a_{u+1}+a_{u+2}+\cdots+a_{v}$ is a sum of positive integers
(since $a_{1},a_{2},\ldots,a_{k}$ are positive integers), and thus is $\geq$
to any of its addends. Hence, $a_{u+1}+a_{u+2}+\cdots+a_{v}\geq a_{v}$ (since
$a_{v}$ is an addend of this sum). Also, $a_{v}\geq2$ (since the numbers
$a_{1},a_{2},\ldots,a_{k}$ are $\geq2$). Now,%
\[
q=p+\underbrace{\left(  a_{u+1}+a_{u+2}+\cdots+a_{v}\right)  }_{\geq a_{v}%
\geq2}\geq p+2.
\]
That is, the integer $q$ is at least by $2$ larger than $p$. Hence, $p$ and
$q$ cannot be consecutive integers. This contradicts the fact that $p$ and $q$
are consecutive integers. This contradiction shows that our assumption was
false. Qed.}. This completes the proof of Claim 1.]

[\textit{Proof of Claim 2:} I shall be somewhat brief and handwavy, but I
trust the reader to be able to formalize this argument by now.

The set $U$ is a subset of $\left[  2,n-2\right]  $ and thus a subset of
$\left[  n-1\right]  $ (since $\left[  2,n-2\right]  \subseteq\left[
n-1\right]  $). Hence, $C^{-1}\left(  U\right)  $ is a well-defined
composition of $n$.

Recall how the inverse map $C^{-1}$ of $C$ was described in the proof of
Theorem \ref{thm.enum.comps}: If $I$ is any subset of $\left[  n-1\right]  $,
then the elements of $I$ subdivide the interval $\left[  0,n\right]  $ into
several blocks; the composition $C^{-1}\left(  I\right)  $ is formed by the
lengths of these blocks (from left to right).

Applying this to $I=U$, we see that the composition $C^{-1}\left(  U\right)  $
is formed by the lengths of the blocks into which the elements of $U$
subdivide the interval $\left[  0,n\right]  $.\ \ \ \ \footnote{Let us again
illustrate this on an example, this time making sure to pick a lacunar subset
of $\left[  2,n-2\right]  $. Namely, set $n=14$ and $U=\left\{
2,4,7,11\right\}  $. Then, the elements of $U$ subdivide the interval $\left[
0,n\right]  =\left[  0,14\right]  $ into $5$ blocks as follows:%
\[%
%TCIMACRO{\TeXButton{tikz composition from intervals}{\begin{tikzpicture}%
%[scale=1]
%\draw[->, gray] (-0.3,0) -- (14.3,0);
%\node(0) at (0 cm, 0 cm) {};
%\node(2) at (2 cm, 0 cm) {};
%\node(4) at (4 cm, 0 cm) {};
%\node(7) at (7 cm, 0 cm) {};
%\node(11) at (11 cm, 0 cm) {};
%\node(14) at (14 cm, 0 cm) {};
%\node[blue] (a) at (1 cm, 0.5 cm) {$2$};
%\node[blue] (b) at (3 cm, 0.5 cm) {$2$};
%\node[blue] (c) at (5.5 cm, 0.5 cm) {$3$};
%\node[blue] (d) at (9 cm, 0.5 cm) {$4$};
%\node[blue] (e) at (12.5 cm, 0.5 cm) {$3$};
%\fill(0) circle (1pt) node[below] {$0$};
%\fill(2) circle (1pt) node[below] {$2$};
%\fill(4) circle (1pt) node[below] {$4$};
%\fill(7) circle (1pt) node[below] {$7$};
%\fill(11) circle (1pt) node[below] {$11$};
%\fill(14) circle (1pt) node[below] {$14$};
%\draw[->, blue] (0.1,0.5) -- (0.85,0.5);
%\draw[->, blue] (2.9,0.5) -- (1.15,0.5);
%\draw[->, blue] (2.1,0.5) -- (2.85,0.5);
%\draw[->, blue] (3.9,0.5) -- (3.15,0.5);
%\draw[->, blue] (4.1,0.5) -- (5.35,0.5);
%\draw[->, blue] (6.9,0.5) -- (5.65,0.5);
%\draw[->, blue] (7.1,0.5) -- (8.85,0.5);
%\draw[->, blue] (10.9,0.5) -- (9.15,0.5);
%\draw[->, blue] (11.1,0.5) -- (12.35,0.5);
%\draw[->, blue] (13.9,0.5) -- (12.65,0.5);
%\draw[very thick, red] (0,0) -- (0,1);
%\draw[very thick, red] (2,0) -- (2,1);
%\draw[very thick, red] (4,0) -- (4,1);
%\draw[very thick, red] (7,0) -- (7,1);
%\draw[very thick, red] (11,0) -- (11,1);
%\draw[very thick, red] (14,0) -- (14,1);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=1]
\draw[->, gray] (-0.3,0) -- (14.3,0);
\node(0) at (0 cm, 0 cm) {};
\node(2) at (2 cm, 0 cm) {};
\node(4) at (4 cm, 0 cm) {};
\node(7) at (7 cm, 0 cm) {};
\node(11) at (11 cm, 0 cm) {};
\node(14) at (14 cm, 0 cm) {};
\node[blue] (a) at (1 cm, 0.5 cm) {$2$};
\node[blue] (b) at (3 cm, 0.5 cm) {$2$};
\node[blue] (c) at (5.5 cm, 0.5 cm) {$3$};
\node[blue] (d) at (9 cm, 0.5 cm) {$4$};
\node[blue] (e) at (12.5 cm, 0.5 cm) {$3$};
\fill(0) circle (1pt) node[below] {$0$};
\fill(2) circle (1pt) node[below] {$2$};
\fill(4) circle (1pt) node[below] {$4$};
\fill(7) circle (1pt) node[below] {$7$};
\fill(11) circle (1pt) node[below] {$11$};
\fill(14) circle (1pt) node[below] {$14$};
\draw[->, blue] (0.1,0.5) -- (0.85,0.5);
\draw[->, blue] (2.9,0.5) -- (1.15,0.5);
\draw[->, blue] (2.1,0.5) -- (2.85,0.5);
\draw[->, blue] (3.9,0.5) -- (3.15,0.5);
\draw[->, blue] (4.1,0.5) -- (5.35,0.5);
\draw[->, blue] (6.9,0.5) -- (5.65,0.5);
\draw[->, blue] (7.1,0.5) -- (8.85,0.5);
\draw[->, blue] (10.9,0.5) -- (9.15,0.5);
\draw[->, blue] (11.1,0.5) -- (12.35,0.5);
\draw[->, blue] (13.9,0.5) -- (12.65,0.5);
\draw[very thick, red] (0,0) -- (0,1);
\draw[very thick, red] (2,0) -- (2,1);
\draw[very thick, red] (4,0) -- (4,1);
\draw[very thick, red] (7,0) -- (7,1);
\draw[very thick, red] (11,0) -- (11,1);
\draw[very thick, red] (14,0) -- (14,1);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
The lengths of these blocks are $2,2,3,4,3$ (from left to right). Thus, the
composition $C^{-1}\left(  U\right)  $ is $\left(  2,2,3,4,3\right)  $.} We
shall show that each of these blocks has length $\geq2$.

Indeed, this is obvious if $U=\varnothing$ (because in this case, there is
only one block (namely, $\left[  0,n\right]  $), and it has length $n\geq
3\geq2$). Hence, for the rest of this proof, we WLOG assume that
$U\neq\varnothing$; thus, the set $U$ has a smallest element $\min U$ and a
largest element $\max U$. Note that $\min U\in U\subseteq\left[  2,n-2\right]
$, so that $\min U\geq2$. Also, $\max U\in U\subseteq\left[  2,n-2\right]  $
and thus $\max U\leq n-2$. Note that the set $U$ is lacunar; thus, any two
distinct elements of $U$ are at least a distance of $2$ apart (on the real axis).

Now, consider the blocks into which the elements of $U$ subdivide the interval
$\left[  0,n\right]  $. The first of these blocks is $\left[  0,\min U\right]
$, and thus has length $\min U-0=\min U\geq2$. The last of these blocks is
$\left[  \max U,n\right]  $, and thus has length $n-\underbrace{\max U}_{\leq
n-2}\geq n-\left(  n-2\right)  =2$. Each of the remaining blocks begins and
ends at two (distinct) elements of $U$, and thus has length $\geq2$ (since any
two distinct elements of $U$ are at least a distance of $2$ apart (on the real
axis)). Combining these results, we conclude that each of our blocks has
length $\geq2$. Hence, none of our blocks has length $1$.

Now, recall that the composition $C^{-1}\left(  U\right)  $ is formed by the
lengths of these blocks. Since none of our blocks has length $1$, we thus
conclude that the composition $C^{-1}\left(  U\right)  $ does not contain $1$
as an entry. In other words, the composition $C^{-1}\left(  U\right)  $ is
onefree. This proves Claim 2.]

Now, Claim 1 shows that we can define a map%
\begin{align*}
\overline{C}:\left\{  \text{onefree compositions of }n\right\}   &
\rightarrow\left\{  \text{lacunar subsets of }\left[  2,n-2\right]  \right\}
,\\
a  &  \mapsto C\left(  a\right)  .
\end{align*}
Claim 2 shows that we can define a map%
\begin{align*}
\overline{D}:\left\{  \text{lacunar subsets of }\left[  2,n-2\right]
\right\}   &  \rightarrow\left\{  \text{onefree compositions of }n\right\}
,\\
U  &  \mapsto C^{-1}\left(  U\right)  .
\end{align*}
These two maps $\overline{C}$ and $\overline{D}$ are restrictions of the maps
$C$ and $C^{-1}$ (respectively), and thus are mutually inverse (since the maps
$C$ and $C^{-1}$ are mutually inverse). Hence, the map $\overline{C}$ is
invertible, i.e., is a bijection. The bijection principle thus yields%
\begin{align*}
&  \left\vert \left\{  \text{onefree compositions of }n\right\}  \right\vert
\\
&  =\left\vert \left\{  \text{lacunar subsets of }\left[  2,n-2\right]
\right\}  \right\vert \\
&  =\left(  \text{\# of lacunar subsets of }\left[  \underbrace{2}%
_{=1+1},\underbrace{n-2}_{=1+\left(  n-3\right)  }\right]  \right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  1+1,1+\left(  n-3\right)
\right]  \right) \\
&  =f_{\left(  n-3\right)  +2}\ \ \ \ \ \ \ \ \ \ \left(  \text{by Proposition
\ref{prop.fib.lac-interval} (applied to }1\text{ and }n-3\text{ instead of
}a\text{ and }n\text{)}\right) \\
&  =f_{n-1}.
\end{align*}
In other words, $\left(  \text{\# of onefree compositions of }n\right)
=f_{n-1}$. This proves Proposition \ref{prop.sol.enum.comps.no-1} again.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.comps.parts}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.comps.parts}.]Exercise
\ref{exe.enum.comps.parts} is a well-known problem, appearing in some form in
almost any text on combinatorics. See, for instance, \cite[Problem
31]{YagYag64}, \cite[\S 1.2]{Stanley-EC1} or \cite[Theorem 4.2]{AndFen04}. We
note that Exercise \ref{exe.enum.comps.parts} \textbf{(b)} is commonly used in
commutative algebra, since the weak compositions of $n$ into $k$ parts are in
bijection with the degree-$n$ monomials in $k$ variables $x_{1},x_{2}%
,\ldots,x_{k}$ (namely, a weak composition $\left(  a_{1},a_{2},\ldots
,a_{k}\right)  $ of $n$ into $k$ parts corresponds to the monomial
$x_{1}^{a_{1}}x_{2}^{a_{2}}\cdots x_{k}^{a_{k}}$).

\textbf{(a)} We claim that%
\[
\left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right)
=\dbinom{n-1}{n-k}=\dbinom{n-1}{k-1}.
\]
Even more generally, we can allow $n$ to be $0$ and get the following:

\begin{theorem}
\label{thm.binom.compos.count}Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$. Then,%
\begin{align}
&  \left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right)
\nonumber\\
&  =\dbinom{n-1}{n-k}\label{eq.thm.binom.compos.count.r1}\\
&  =%
\begin{cases}
\dbinom{n-1}{k-1}, & \text{if }n>0;\\
\left[  k=0\right]  , & \text{if }n=0.
\end{cases}
\label{eq.thm.binom.compos.count.r2}%
\end{align}

\end{theorem}

We refer to \cite[\S 2.10.1]{19fco} for two proofs of Theorem
\ref{thm.binom.compos.count}. Here, we shall just briefly outline one of the proofs:

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.compos.count}.]The case when
$n=0$ is straightforward busywork (and is not part of Exercise
\ref{exe.enum.comps.parts} anyway), so we WLOG assume that $n\neq0$. Thus, $n$
is a positive integer.

Likewise, we leave the case $k=0$ to the reader (again, noting that this case
is straightforward), so we WLOG assume that $k\neq0$. Hence, $k$ is a positive integer.

Consider the map
\[
C:\left\{  \text{compositions of }n\right\}  \rightarrow\left\{  \text{subsets
of }\left[  n-1\right]  \right\}
\]
defined in the proof of Theorem \ref{thm.enum.comps}. We recall (from said
proof) that this map $C$ is a bijection; thus, it has an inverse map $C^{-1}$.

Now, the following two claims are crucial:

\begin{statement}
\textit{Claim 1:} Let $a$ be a composition of $n$ into $k$ parts. Then,
$C\left(  a\right)  $ is a $\left(  k-1\right)  $-element subset of $\left[
n-1\right]  $.
\end{statement}

\begin{statement}
\textit{Claim 2:} Let $U$ be a $\left(  k-1\right)  $-element subset of
$\left[  n-1\right]  $. Then, $C^{-1}\left(  U\right)  $ is a composition of
$n$ into $k$ parts.
\end{statement}

The reader will have no trouble proving these two claims. Now, Claim 1 shows
that we can define a map%
\begin{align*}
\overline{C}:\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\}  ,\\
a  &  \mapsto C\left(  a\right)  .
\end{align*}
Claim 2 shows that we can define a map%
\begin{align*}
\overline{D}:\left\{  \left(  k-1\right)  \text{-element subsets of }\left[
n-1\right]  \right\}   &  \rightarrow\left\{  \text{compositions of }n\text{
into }k\text{ parts}\right\}  ,\\
U  &  \mapsto C^{-1}\left(  U\right)  .
\end{align*}
These two maps $\overline{C}$ and $\overline{D}$ are restrictions of the maps
$C$ and $C^{-1}$ (respectively), and thus are mutually inverse. Hence, the map
$\overline{C}$ is invertible, i.e., is a bijection. The bijection principle
thus yields%
\begin{align*}
&  \left\vert \left\{  \text{compositions of }n\text{ into }k\text{
parts}\right\}  \right\vert \\
&  =\left\vert \left\{  \left(  k-1\right)  \text{-element subsets of }\left[
n-1\right]  \right\}  \right\vert \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}\left[  n-1\right]  \right) \\
&  =\dbinom{n-1}{k-1}\ \ \ \ \ \ \ \ \ \ \left(  \text{by an application of
Theorem \ref{thm.binom.comb}}\right) \\
&  =\dbinom{n-1}{\left(  n-1\right)  -\left(  k-1\right)  }%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by an application of Theorem
\ref{thm.binom.sym}}\right) \\
&  =\dbinom{n-1}{n-k}.
\end{align*}
Theorem \ref{thm.binom.compos.count} follows.
\end{proof}

\textbf{(b)} We claim that%
\begin{align*}
&  \left(  \text{\# of weak compositions of }n\text{ into }k\text{
parts}\right) \\
&  =\dbinom{n+k-1}{n}=%
\begin{cases}
\dbinom{n+k-1}{k-1}, & \text{if }k>0;\\
0, & \text{if }k=0.
\end{cases}
\end{align*}
Even more generally, we can allow $n$ to be $0$ and get the following:

\begin{theorem}
\label{thm.binom.wecompos.count}Let $n\in\mathbb{N}$ and $k\in\mathbb{N}$.
Then,%
\begin{align}
&  \left(  \text{\# of weak compositions of }n\text{ into }k\text{
parts}\right) \nonumber\\
&  =\dbinom{n+k-1}{n}\label{eq.thm.binom.wecompos.count.r1}\\
&  =%
\begin{cases}
\dbinom{n+k-1}{k-1}, & \text{if }k>0;\\
\left[  n=0\right]  , & \text{if }k=0.
\end{cases}
\label{eq.thm.binom.wecompos.count.r2}%
\end{align}

\end{theorem}

We refer to \cite[\S 2.10.3]{19fco} for a detailed proof of Theorem
\ref{thm.binom.wecompos.count}. Here, let us just briefly outline it:

\begin{proof}
[Hints to the proof of Theorem \ref{thm.binom.wecompos.count}.]If $\left(
a_{1},a_{2},\ldots,a_{k}\right)  $ is a weak composition of $n$ into $k$
parts, then $\left(  a_{1}+1,a_{2}+1,\ldots,a_{k}+1\right)  $ is a composition
of $n+k$ into $k$ parts\footnote{because adding $1$ to a nonnegative integer
yields a positive integer, and because%
\[
\left(  a_{1}+1\right)  +\left(  a_{2}+1\right)  +\cdots+\left(
a_{k}+1\right)  =\underbrace{\left(  a_{1}+a_{2}+\cdots+a_{k}\right)  }%
_{=n}+\underbrace{\underbrace{\left(  1+1+\cdots+1\right)  }_{k\text{ times}}%
}_{=k}=n+k
\]
}. Thus, there is a map%
\begin{align*}
\left\{  \text{weak compositions of }n\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \text{compositions 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*}
It is easy to see that this map is a bijection. The bijection principle
therefore shows that
\begin{align*}
&  \left(  \text{\# of weak compositions of }n\text{ into }k\text{
parts}\right) \\
&  =\left(  \text{\# of compositions of }n+k\text{ into }k\text{ parts}\right)
\\
&  =\dbinom{n+k-1}{n+k-k}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.thm.binom.compos.count.r1}) (applied to }n+k\text{ instead of
}n\text{)}\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*}
(where the last equality sign follows from an application of Theorem
\ref{thm.binom.sym} in the case when $k>0$, and can be checked by hand in the
case when $k=0$). Theorem \ref{thm.binom.wecompos.count} thus follows.
\end{proof}

The equality (\ref{eq.thm.binom.wecompos.count.r1}) can also be proved by
induction (see \cite[\S 19.3]{Jarvin20} or \cite[Exercise 3.15]{detnotes} for
such proofs) or by a direct counting argument (see \cite[proof of Theorem 4.2
(b)]{AndFen04} or \cite[\S 19.3]{Jarvin20} for this).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.rior-gkp}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.rior-gkp}.]Exercise
\ref{exe.enum.rior-gkp} is \cite[Exercise 5.65]{GKP} or \cite[Problem
1.14]{Tomesc85}; I have also seen it called \textit{Riordan's identity}. We
first give an algebraic solution (using the telescope principle), then a
combinatorial solution (via double counting).

\begin{proof}
[First solution to Exercise \ref{exe.enum.rior-gkp}.]For each $k\in\left\{
0,1,\ldots,n\right\}  $, we define a number%
\begin{equation}
b_{k}=n\dbinom{n-1}{k}\dfrac{k!}{n^{k}}. \label{sol.enum.rior-gkp.bk=}%
\end{equation}
Now, we claim that%
\begin{equation}
\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  !}{n^{k}}=b_{k}-b_{k+1}
\label{sol.enum.rior-gkp.4}%
\end{equation}
for each $k\in\left\{  0,1,\ldots,n-1\right\}  $.

[\textit{Proof of (\ref{sol.enum.rior-gkp.4}):} Let $k\in\left\{
0,1,\ldots,n-1\right\}  $. The definition of $b_{k+1}$ yields%
\begin{align*}
b_{k+1}  &  =n\dbinom{n-1}{k+1}\dfrac{\left(  k+1\right)  !}{n^{k+1}}%
=n\dbinom{n-1}{k+1}\dfrac{\left(  k+1\right)  \cdot k!}{n^{k}\cdot n}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  k+1\right)  !=\left(
k+1\right)  \cdot k!\text{ and }n^{k+1}=n^{k}\cdot n\right) \\
&  =\underbrace{\left(  k+1\right)  \dbinom{n-1}{k+1}}_{\substack{=\left(
\left(  n-1\right)  -k\right)  \dbinom{n-1}{k}\\\text{(by Lemma
\ref{lem.binom.neighbors} \textbf{(b)}}\\\text{(applied to }n-1\text{ instead
of }n\text{))}}}\dfrac{k!}{n^{k}}=\left(  \left(  n-1\right)  -k\right)
\dbinom{n-1}{k}\dfrac{k!}{n^{k}}.
\end{align*}
Subtracting this equality from (\ref{sol.enum.rior-gkp.bk=}), we find%
\begin{align*}
b_{k}-b_{k+1}  &  =n\dbinom{n-1}{k}\dfrac{k!}{n^{k}}-\left(  \left(
n-1\right)  -k\right)  \dbinom{n-1}{k}\dfrac{k!}{n^{k}}\\
&  =\underbrace{\left(  n-\left(  \left(  n-1\right)  -k\right)  \right)
}_{=k+1}\dbinom{n-1}{k}\dfrac{k!}{n^{k}}=\left(  k+1\right)  \dbinom{n-1}%
{k}\dfrac{k!}{n^{k}}\\
&  =\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  \cdot k!}{n^{k}}=\dbinom{n-1}%
{k}\dfrac{\left(  k+1\right)  !}{n^{k}}%
\end{align*}
(since $\left(  k+1\right)  \cdot k!=\left(  k+1\right)  !$). This proves
(\ref{sol.enum.rior-gkp.4}).]

Now,%
\begin{align}
&  \sum_{k=0}^{n-1}\underbrace{\dbinom{n-1}{k}\dfrac{\left(  k+1\right)
!}{n^{k}}}_{\substack{=b_{k}-b_{k+1}\\\text{(by (\ref{sol.enum.rior-gkp.4}))}%
}}\nonumber\\
&  =\sum_{k=0}^{n-1}\underbrace{\left(  b_{k}-b_{k+1}\right)  }_{=\left(
-b_{k+1}\right)  -\left(  -b_{k}\right)  }=\sum_{k=0}^{n-1}\left(  \left(
-b_{k+1}\right)  -\left(  -b_{k}\right)  \right)  =\sum_{i=0}^{n-1}\left(
\left(  -b_{i+1}\right)  -\left(  -b_{i}\right)  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed the summation index
}k\text{ as }i\right) \nonumber\\
&  =\left(  -b_{\left(  n-1\right)  +1}\right)  -\left(  -b_{0}\right)
\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by Corollary \ref{cor.seqsum.telesc-pos}
(applied to }u=0\text{, }v=n-1\text{ and }a_{i}=-b_{i}\text{)}\right)
\nonumber\\
&  =b_{0}-b_{\left(  n-1\right)  +1}\nonumber\\
&  =b_{0}-b_{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  n-1\right)
+1=n\right)  . \label{sol.enum.rior-gkp.8}%
\end{align}


However, the definition of $b_{0}$ yields%
\[
b_{0}=n\underbrace{\dbinom{n-1}{0}}_{\substack{=1\\\text{(by
(\ref{eq.exa.binom.small.nC0})}\\\text{(applied to }n-1\text{ instead of
}n\text{))}}}\dfrac{0!}{n^{0}}=n\cdot\dfrac{0!}{n^{0}}=n\cdot\underbrace{0!}%
_{=1}/\underbrace{n^{0}}_{=1}=n.
\]
Furthermore, it is easy to see that $b_{n}=0$\ \ \ \ \footnote{\textit{Proof.}
If $n=0$, then $b_{n}=b_{0}=n=0$. Thus, for the rest of this proof of
$b_{n}=0$, we WLOG assume that $n\neq0$. Hence, $n$ is a positive integer
(since $n\in\mathbb{N}$), so that $n-1\in\mathbb{N}$. Therefore, Proposition
\ref{prop.binom.0} (applied to $n-1$ and $n$ instead of $n$ and $k$) yields
$\dbinom{n-1}{n}=0$ (since $n>n-1$). Now, the definition of $b_{n}$ yields%
\[
b_{n}=n\underbrace{\dbinom{n-1}{n}}_{=0}\dfrac{n!}{n^{n}}=0.
\]
Qed.}. Hence, (\ref{sol.enum.rior-gkp.8}) becomes%
\[
\sum_{k=0}^{n-1}\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  !}{n^{k}%
}=\underbrace{b_{0}}_{=n}-\underbrace{b_{n}}_{=0}=n.
\]
This solves Exercise \ref{exe.enum.rior-gkp}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.enum.rior-gkp} (sketched).]It is easy to
solve Exercise \ref{exe.enum.rior-gkp} in the case when $n=0$ (indeed, it
boils down to $0=0$ in this case). Thus, for the rest of this solution, we
WLOG assume that $n\neq0$. Hence, $n\geq1$.

If $a=\left(  a_{1},a_{2},\ldots,a_{n}\right)  \in\left[  n\right]  ^{n}$ is
an $n$-tuple, then there exists an $i\in\left[  n\right]  $ such that the $i$
entries $a_{1},a_{2},\ldots,a_{i}$ are distinct (indeed, $i=1$ always fits the
bill, since the single entry $a_{1}$ is distinct). We define the \textit{wit}
of an $n$-tuple $a=\left(  a_{1},a_{2},\ldots,a_{n}\right)  \in\left[
n\right]  ^{n}$ to be the largest $i\in\left[  n\right]  $ such that the $i$
entries $a_{1},a_{2},\ldots,a_{i}$ are distinct. Thus, roughly speaking, the
wit of an $n$-tuple measures \textquotedblleft how long the $n$-tuple can
avoid repeating its own entries\textquotedblright. For example, the $9$-tuple
$\left(  3,1,6,2,4,1,5,2\right)  $ has wit $5$ (since its first $5$ entries
$3,1,6,2,4$ are distinct, while its first $6$ entries $3,1,6,2,4,1$ are not).
Likewise, the $7$-tuple $\left(  3,1,3,2,4,5,3\right)  $ has wit $2$.

For any $k\in\left[  n\right]  $, we have
\begin{align}
&  \left(  \text{\# of }n\text{-tuples }a\in\left[  n\right]  ^{n}\text{ with
wit }k\right) \nonumber\\
&  =\dbinom{n-1}{k-1}k!\cdot n^{n-k}. \label{sol.enum.rior-gkp.patcount}%
\end{align}


[\textit{Proof of (\ref{sol.enum.rior-gkp.patcount}):} Let $k\in\left[
n\right]  $. We need to prove the equality (\ref{sol.enum.rior-gkp.patcount}).

We have $k\leq n$ (since $k\in\left[  n\right]  $). Thus, we are in one of the
two cases $k<n$ and $k=n$. We shall only handle the case $k<n$ in the
following; the case $k=n$ is similar (but easier) and we leave it to the reader.

So let us assume that $k<n$. An $n$-tuple $a=\left(  a_{1},a_{2},\ldots
,a_{n}\right)  \in\left[  n\right]  ^{n}$ has wit $k$ if and only if its first
$k$ entries $a_{1},a_{2},\ldots,a_{k}$ are distinct while its $\left(
k+1\right)  $-st entry $a_{k+1}$ equals one of these first $k$
entries\footnote{This is where we need $k<n$: If we had $k=n$, then there
would be no $\left(  k+1\right)  $-st entry $a_{k+1}$.}. Thus, the following
decision procedure can be used to construct an $n$-tuple $a=\left(
a_{1},a_{2},\ldots,a_{n}\right)  \in\left[  n\right]  ^{n}$ with wit $k$:

\begin{itemize}
\item First, we choose the first $k$ entries $a_{1},a_{2},\ldots,a_{k}$ of
$a$, one after the other (keeping in mind that they have to be distinct). This
procedure involves $k$ decisions, and it is easy to count how many options
there are in each decision: There are $n$ options for choosing $a_{1}$ (since
$a_{1}$ has to be an element of $\left[  n\right]  $); there are $n-1$ options
for choosing $a_{2}$ (since $a_{2}$ has to be an element of $\left[  n\right]
$ distinct from $a_{1}$); there are $n-2$ options for choosing $a_{3}$ (since
$a_{3}$ has to be an element of $\left[  n\right]  $ distinct from both the
two distinct elements $a_{1}$ and $a_{2}$); and so on.

After these $k$ decisions, the first $k$ entries $a_{1},a_{2},\ldots,a_{k}$ of
our $n$-tuple $a$ have been chosen.

\item Next, we choose the $\left(  k+1\right)  $-st entry $a_{k+1}$ of $a$.
This entry has to equal one of the first $k$ entries $a_{1},a_{2},\ldots
,a_{k}$. Since these first $k$ entries $a_{1},a_{2},\ldots,a_{k}$ are
distinct, we thus have $k$ options for choosing $a_{k+1}$.

\item Finally, we choose the remaining $n-k-1$ entries $a_{k+2},a_{k+3}%
,\ldots,a_{n}$ of $a$. These entries can be arbitrary elements of $\left[
n\right]  $ (they need not be distinct from anything or equal to anything);
thus, there are $n$ options for choosing each of them.
\end{itemize}

\noindent The dependent product rule shows that the total \# of possibilities
for making these choices is%
\begin{align*}
&  n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)  \cdot
k\cdot\underbrace{nn\cdots n}_{n-k-1\text{ times}}\\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)  \cdot
k\cdot n^{n-k-1}.
\end{align*}
Hence,
\begin{align}
&  \left(  \text{\# of }n\text{-tuples }a\in\left[  n\right]  ^{n}\text{ with
wit }k\right) \nonumber\\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)  \cdot
k\cdot n^{n-k-1}. \label{pf.sol.enum.rior-gkp.patcount.4}%
\end{align}
On the other hand, from $k\geq1$, we have $k-1\in\mathbb{N}$ and thus%
\begin{align*}
&  \underbrace{\dbinom{n-1}{k-1}}_{\substack{=\dfrac{\left(  n-1\right)
\left(  n-2\right)  \left(  n-3\right)  \cdots\left(  \left(  n-1\right)
-\left(  k-1\right)  +1\right)  }{\left(  k-1\right)  !}\\\text{(by
(\ref{eq.def.binom.def.a}) (applied to }n-1\text{ and }k-1\text{ instead of
}n\text{ and }k\text{))}}}\underbrace{k!}_{=k\cdot\left(  k-1\right)  !}%
\cdot\underbrace{n^{n-k}}_{=n\cdot n^{n-k-1}}\\
&  =\dfrac{\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)
\cdots\left(  \left(  n-1\right)  -\left(  k-1\right)  +1\right)  }{\left(
k-1\right)  !}\cdot k\left(  k-1\right)  !\cdot n\cdot n^{n-k-1}\\
&  =\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)  \cdots
\underbrace{\left(  \left(  n-1\right)  -\left(  k-1\right)  +1\right)
}_{=n-k+1}\cdot kn\cdot n^{n-k-1}\\
&  =\left(  n-1\right)  \left(  n-2\right)  \left(  n-3\right)  \cdots\left(
n-k+1\right)  \cdot kn\cdot n^{n-k-1}\\
&  =\underbrace{n\cdot\left(  n-1\right)  \left(  n-2\right)  \left(
n-3\right)  \cdots\left(  n-k+1\right)  }_{=n\left(  n-1\right)  \left(
n-2\right)  \cdots\left(  n-k+1\right)  }\cdot k\cdot n^{n-k-1}\\
&  =n\left(  n-1\right)  \left(  n-2\right)  \cdots\left(  n-k+1\right)  \cdot
k\cdot n^{n-k-1}.
\end{align*}
Comparing this with (\ref{pf.sol.enum.rior-gkp.patcount.4}), we find%
\begin{equation}
\left(  \text{\# of }n\text{-tuples }a\in\left[  n\right]  ^{n}\text{ with wit
}k\right)  =\dbinom{n-1}{k-1}k!\cdot n^{n-k}.\nonumber
\end{equation}
This proves (\ref{sol.enum.rior-gkp.patcount}).]

Now, the wit of an $n$-tuple $a\in\left[  n\right]  ^{n}$ is an element of
$\left[  n\right]  $. Hence, the sum rule yields%
\begin{align*}
&  \left(  \text{\# of }n\text{-tuples }a\in\left[  n\right]  ^{n}\right) \\
&  =\sum_{k=1}^{n}\underbrace{\left(  \text{\# of }n\text{-tuples }a\in\left[
n\right]  ^{n}\text{ with wit }k\right)  }_{\substack{=\dbinom{n-1}%
{k-1}k!\cdot n^{n-k}\\\text{(by (\ref{sol.enum.rior-gkp.patcount}))}}}\\
&  =\sum_{k=1}^{n}\dbinom{n-1}{k-1}k!\cdot n^{n-k}=\sum_{k=0}^{n-1}%
\underbrace{\dbinom{n-1}{\left(  k+1\right)  -1}}_{=\dbinom{n-1}{k}}\left(
k+1\right)  !\cdot\underbrace{n^{n-\left(  k+1\right)  }}_{=n^{n-1-k}%
=\dfrac{n^{n-1}}{n^{k}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k+1\text{ for
}k\text{ in the sum}\right) \\
&  =\sum_{k=0}^{n-1}\dbinom{n-1}{k}\left(  k+1\right)  !\cdot\dfrac{n^{n-1}%
}{n^{k}}=n^{n-1}\cdot\sum_{k=0}^{n-1}\dbinom{n-1}{k}\dfrac{\left(  k+1\right)
!}{n^{k}}.
\end{align*}
Thus,%
\[
n^{n-1}\cdot\sum_{k=0}^{n-1}\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  !}%
{n^{k}}=\left(  \text{\# of }n\text{-tuples }a\in\left[  n\right]
^{n}\right)  =\left\vert \left[  n\right]  ^{n}\right\vert =n^{n}.
\]
Dividing both sides of this equality by $n^{n-1}$, we obtain%
\[
\sum_{k=0}^{n-1}\dbinom{n-1}{k}\dfrac{\left(  k+1\right)  !}{n^{k}}=n.
\]
Thus, Exercise \ref{exe.enum.rior-gkp} is solved again.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.shapiro}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.shapiro}.]Exercise
\ref{exe.enum.shapiro} is part of \cite[Problem 1.10]{Riorda68}; it also
appears implicitly in \cite[Proposition 3.1]{Shapir76} (since it is easily
seen that $\dfrac{1}{2}\dbinom{2n}{n}=\dbinom{2n-1}{n}$ when $n$ is a positive
integer). We shall give a purely algebraic solution:

\begin{proof}
[Solution to Exercise \ref{exe.enum.shapiro}.]For each $k\in\left\{
0,1,\ldots,n\right\}  $, we have%
\begin{align*}
&  \underbrace{k}_{=n-\left(  n-k\right)  }\dbinom{2n}{n-k}\\
&  =\left(  n-\left(  n-k\right)  \right)  \dbinom{2n}{n-k}\\
&  =n\underbrace{\dbinom{2n}{n-k}}_{\substack{=\dbinom{2n-1}{n-k-1}%
+\dbinom{2n-1}{n-k}\\\text{(by Theorem \ref{thm.binom.rec}}\\\text{(applied to
}2n\text{ and }n-k\text{ instead of }n\text{ and }k\text{))}}%
}-\underbrace{\left(  n-k\right)  \dbinom{2n}{n-k}}_{\substack{=2n\dbinom
{2n-1}{n-k-1}\\\text{(since Lemma \ref{lem.binom.neighbors} \textbf{(a)}%
}\\\text{(applied to }2n\text{ and }n-k\text{ instead of }n\text{ and
}k\text{)}\\\text{yields }2n\dbinom{2n-1}{n-k-1}=\left(  n-k\right)
\dbinom{2n}{n-k}\text{)}}}\\
&  =n\left(  \dbinom{2n-1}{n-k-1}+\dbinom{2n-1}{n-k}\right)  -2n\dbinom
{2n-1}{n-k-1}\\
&  =n\left(  \dbinom{2n-1}{n-k}-\dbinom{2n-1}{n-k-1}\right)  =n\left(
\dbinom{2n-1}{n-k}-\dbinom{2n-1}{n-\left(  k+1\right)  }\right)
\end{align*}
(since $n-k-1=n-\left(  k+1\right)  $). Summing this equality over all
$k\in\left\{  0,1,\ldots,n\right\}  $, we obtain%
\begin{align}
&  \sum_{k=0}^{n}k\dbinom{2n}{n-k}\nonumber\\
&  =\sum_{k=0}^{n}n\left(  \dbinom{2n-1}{n-k}-\dbinom{2n-1}{n-\left(
k+1\right)  }\right) \nonumber\\
&  =n\sum_{k=0}^{n}\left(  \dbinom{2n-1}{n-k}-\dbinom{2n-1}{n-\left(
k+1\right)  }\right)  . \label{sol.enum.shapiro.1}%
\end{align}


Now,%
\begin{align*}
&  \sum_{k=0}^{n}\underbrace{\left(  \dbinom{2n-1}{n-k}-\dbinom{2n-1}%
{n-\left(  k+1\right)  }\right)  }_{=\left(  -\dbinom{2n-1}{n-\left(
k+1\right)  }\right)  -\left(  -\dbinom{2n-1}{n-k}\right)  }\\
&  =\sum_{k=0}^{n}\left(  \left(  -\dbinom{2n-1}{n-\left(  k+1\right)
}\right)  -\left(  -\dbinom{2n-1}{n-k}\right)  \right) \\
&  =\sum_{i=0}^{n}\left(  \left(  -\dbinom{2n-1}{n-\left(  i+1\right)
}\right)  -\left(  -\dbinom{2n-1}{n-i}\right)  \right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed
the summation index }k\text{ as }i\right) \\
&  =\left(  -\dbinom{2n-1}{n-\left(  n+1\right)  }\right)  -\left(
-\dbinom{2n-1}{n-0}\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Corollary \ref{cor.seqsum.telesc-pos}}\\
\text{(applied to }u=0\text{ and }v=n\text{ and }a_{i}=-\dbinom{2n-1}%
{n-i}\text{)}%
\end{array}
\right) \\
&  =\dbinom{2n-1}{n-0}-\dbinom{2n-1}{n-\left(  n+1\right)  }=\dbinom{2n-1}%
{n}-\underbrace{\dbinom{2n-1}{-1}}_{\substack{=0\\\text{(by
(\ref{eq.def.binom.def.b})}\\\text{(since }-1\notin\mathbb{N}\text{))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{since }n-0=n\text{
and }n-\left(  n+1\right)  =-1\right) \\
&  =\dbinom{2n-1}{n}.
\end{align*}
Hence, (\ref{sol.enum.shapiro.1}) rewrites as%
\[
\sum_{k=0}^{n}k\dbinom{2n}{n-k}=n\dbinom{2n-1}{n}.
\]
This solves Exercise \ref{exe.enum.shapiro}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.bin-inv}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.bin-inv}.]Exercise
\ref{exe.enum.bin-inv} is one of the facts known as the \textit{binomial
inversion formula}. An equivalent fact appears in \cite[Exercise 3.18
\textbf{(a)}]{detnotes} and in \cite[Exercise 6]{17f-hw4s}\footnote{The
differences between \cite[Exercise 3.18 \textbf{(a)}]{detnotes},
\cite[Exercise 6]{17f-hw4s} and our Exercise \ref{exe.enum.bin-inv} are
insubstantial: Our Exercise \ref{exe.enum.bin-inv} is stated for two
\textbf{infinite} sequences $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ and
$\left(  g_{0},g_{1},g_{2},\ldots\right)  $, whereas \cite[Exercise 3.18
\textbf{(a)}]{detnotes} and \cite[Exercise 6]{17f-hw4s} are stated for two
\textbf{finite} sequences (i.e., tuples) $\left(  f_{0},f_{1},\ldots
,f_{N}\right)  $ and $\left(  g_{0},g_{1},\ldots,g_{N}\right)  $ (which are
called $\left(  a_{0},a_{1},\ldots,a_{N}\right)  $ and $\left(  b_{0}%
,b_{1},\ldots,b_{N}\right)  $ in \cite[Exercise 6]{17f-hw4s}). The proofs
given in \cite{detnotes} and \cite{17f-hw4s} for \cite[Exercise 3.18
\textbf{(a)}]{detnotes} and \cite[Exercise 6]{17f-hw4s} apply to Exercise
\ref{exe.enum.bin-inv} (once some obvious changes are made).}. For
convenience, let me show an adaptation of the proof of \cite[Exercise
6]{17f-hw4s}.

First, I will need the following lemma:

\begin{lemma}
\label{lem.binom.1-1cor}Let $n\in\mathbb{N}$. Let $i\in\left\{  0,1,\ldots
,n\right\}  $. Then,%
\[
\sum_{j=i}^{n}\left(  -1\right)  ^{j+i}\dbinom{n}{j}\dbinom{j}{i}=\left[
i=n\right]  .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom.1-1cor}.]We have $i\in\left\{  0,1,\ldots
,n\right\}  $, so that $i\leq n$ and $i\in\mathbb{N}$. From $i\leq n$, we
obtain $n-i\geq0$. Thus, $n-i\in\mathbb{N}$.

Let $j\in\left\{  i,i+1,\ldots,n\right\}  $. Then, $j\geq i\geq0$. Therefore,
Theorem \ref{prop.binom.trin-revNN} (applied to $a=j$ and $b=i$) yields%
\begin{equation}
\dbinom{n}{j}\dbinom{j}{i}=\dbinom{n}{i}\dbinom{n-i}{j-i}.
\label{pf.cor.binom.1-1cor.1}%
\end{equation}
Also, $j+i\equiv j-i\operatorname{mod}2$ (since $\left(  j+i\right)  -\left(
j-i\right)  =2i$ is even). Thus, $\left(  -1\right)  ^{j+i}=\left(  -1\right)
^{j-i}$. Multiplying this equality by (\ref{pf.cor.binom.1-1cor.1}), we obtain%
\begin{equation}
\left(  -1\right)  ^{j+i}\dbinom{n}{j}\dbinom{j}{i}=\left(  -1\right)
^{j-i}\dbinom{n}{i}\dbinom{n-i}{j-i}. \label{pf.cor.binom.1-1cor.2}%
\end{equation}


Now, forget that we fixed $j$. We thus have proven the equality
(\ref{pf.cor.binom.1-1cor.2}) for each $j\in\left\{  i,i+1,\ldots,n\right\}
$. Summing this equality over all $j\in\left\{  i,i+1,\ldots,n\right\}  $, we
obtain%
\begin{align}
\sum_{j=i}^{n}\left(  -1\right)  ^{j+i}\dbinom{n}{j}\dbinom{j}{i}  &
=\sum_{j=i}^{n}\left(  -1\right)  ^{j-i}\dbinom{n}{i}\dbinom{n-i}{j-i}%
=\sum_{k=0}^{n-i}\left(  -1\right)  ^{k}\dbinom{n}{i}\dbinom{n-i}%
{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k\text{ for
}j-i\text{ in the sum}\right) \nonumber\\
&  =\dbinom{n}{i}\underbrace{\sum_{k=0}^{n-i}\left(  -1\right)  ^{k}%
\dbinom{n-i}{k}}_{\substack{=\left[  n-i=0\right]  \\\text{(by Proposition
\ref{prop.binom.sum-alt-row} (applied to }n-i\text{ instead of }n\text{))}%
}}\nonumber\\
&  =\dbinom{n}{i}\left[  n-i=0\right]  . \label{pf.cor.binom.1-1cor.4}%
\end{align}
But it is easy to see that%
\begin{equation}
\dbinom{n}{i}\left[  n-i=0\right]  =\left[  i=n\right]
\label{pf.cor.binom.1-1cor.5}%
\end{equation}
\footnote{\textit{Proof of (\ref{pf.cor.binom.1-1cor.5}):} We are in one of
the following two cases:
\par
\textit{Case 1:} We have $i\neq n$.
\par
\textit{Case 2:} We have $i=n$.
\par
Let us consider Case 1 first. In this case, we have $i\neq n$. In other words,
$n\neq i$. Hence, $n-i\neq0$. Thus, $\left[  n-i=0\right]  =0$, so that
$\dbinom{n}{i}\underbrace{\left[  n-i=0\right]  }_{=0}=0$. Comparing this with
$\left[  i=n\right]  =0$ (since $i\neq n$), we obtain $\dbinom{n}{i}\left[
n-i=0\right]  =\left[  i=n\right]  $. Hence, (\ref{pf.cor.binom.1-1cor.5}) is
proven in Case 1.
\par
Now, let us consider Case 2. In this case, we have $i=n$. In other words,
$n=i$. Thus, $n-i=0$. Thus, $\left[  n-i=0\right]  =1$. Also, from $i=n$, we
obtain $\dbinom{n}{i}=\dbinom{n}{n}=1$ (by (\ref{eq.thm.binom.sym.nn})).
Hence, $\underbrace{\dbinom{n}{i}}_{=1}\underbrace{\left[  n-i=0\right]
}_{=1}=1$. Comparing this with $\left[  i=n\right]  =1$ (since $i=n$), we
obtain $\dbinom{n}{i}\left[  n-i=0\right]  =\left[  i=n\right]  $. Hence,
(\ref{pf.cor.binom.1-1cor.5}) is proven in Case 2.
\par
We thus have proven (\ref{pf.cor.binom.1-1cor.5}) in each of the two Cases 1
and 2. Thus, (\ref{pf.cor.binom.1-1cor.5}) always holds.}. Thus,
(\ref{pf.cor.binom.1-1cor.4}) becomes%
\[
\sum_{j=i}^{n}\left(  -1\right)  ^{j+i}\dbinom{n}{j}\dbinom{j}{i}=\dbinom
{n}{i}\left[  n-i=0\right]  =\left[  i=n\right]  .
\]
This proves Lemma \ref{lem.binom.1-1cor}.
\end{proof}

We are now ready for the solution to Exercise \ref{exe.enum.bin-inv}:

\begin{proof}
[Solution to Exercise \ref{exe.enum.bin-inv}.]We have assumed that%
\begin{equation}
g_{n}=\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}f_{i}
\label{sol.enum.bin-inv.ass}%
\end{equation}
for each $n\in\mathbb{N}$.

Now, let $n\in\mathbb{N}$. Then,%
\begin{align*}
\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}g_{i}  &  =\sum_{j=0}%
^{n}\left(  -1\right)  ^{j}\dbinom{n}{j}\underbrace{g_{j}}_{\substack{=\sum
_{i=0}^{j}\left(  -1\right)  ^{i}\dbinom{j}{i}f_{i}\\\text{(by
(\ref{sol.enum.bin-inv.ass}), applied to }j\\\text{instead of }n\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed the summation index
}i\text{ as }j\right) \\
&  =\sum_{j=0}^{n}\left(  -1\right)  ^{j}\dbinom{n}{j}\sum_{i=0}^{j}\left(
-1\right)  ^{i}\dbinom{j}{i}f_{i}\\
&  =\underbrace{\sum_{j=0}^{n}\ \ \sum_{i=0}^{j}}_{\substack{=\sum_{i=0}%
^{n}\ \ \sum_{j=i}^{n}\\\text{(by (\ref{eq.sum.fubini.triangle2}))}}}\left(
-1\right)  ^{j}\underbrace{\dbinom{n}{j}\left(  -1\right)  ^{i}}_{=\left(
-1\right)  ^{i}\dbinom{n}{j}}\dbinom{j}{i}f_{i}\\
&  =\sum_{i=0}^{n}\ \ \sum_{j=i}^{n}\underbrace{\left(  -1\right)  ^{j}\left(
-1\right)  ^{i}}_{=\left(  -1\right)  ^{j+i}}\dbinom{n}{j}\dbinom{j}{i}%
f_{i}=\sum_{i=0}^{n}\ \ \sum_{j=i}^{n}\left(  -1\right)  ^{j+i}\dbinom{n}%
{j}\dbinom{j}{i}f_{i}\\
&  =\sum_{i=0}^{n}\underbrace{\left(  \sum_{j=i}^{n}\left(  -1\right)
^{j+i}\dbinom{n}{j}\dbinom{j}{i}\right)  }_{\substack{=\left[  i=n\right]
\\\text{(by Lemma \ref{lem.binom.1-1cor})}}}f_{i}\\
&  =\sum_{i=0}^{n}\left[  i=n\right]  f_{i}=\underbrace{\left[  n=n\right]
}_{\substack{=1\\\text{(since }n=n\text{)}}}f_{n}+\sum_{i=0}^{n-1}%
\underbrace{\left[  i=n\right]  }_{\substack{=0\\\text{(since }i\neq
n\\\text{(because }i\leq n-1<n\text{))}}}f_{i}\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split off the addend for }i=n\\
\text{from the sum}%
\end{array}
\right) \\
&  =f_{n}+\underbrace{\sum_{i=0}^{n-1}0f_{i}}_{=0}=f_{n}.
\end{align*}
In other words, $f_{n}=\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}%
g_{i}$. This solves Exercise \ref{exe.enum.bin-inv}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.-1/2trick}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.-1/2trick}.]Exercise
\ref{exe.enum.-1/2trick} is \cite[Exercise 3]{18f-hw3s}. Its part \textbf{(a)}
also appears in \cite[Exercise 3.2 \textbf{(b)}]{detnotes} and in
\cite[(5.37)]{GKP}, whereas its part \textbf{(b)} also appears in
\cite[Exercise 3.23 \textbf{(a)}]{detnotes}, in \cite[Identity 154]{Spivey19}
and in \cite[(5.39)]{GKP}. The solution I shall give below is copied almost
verbatim from \cite{18f-hw3s}. Note that the solution to part \textbf{(b)} is
probably one of the nicest illustrations of the \textquotedblleft substitute
non-integer values into the Chu--Vandermonde identity, and simplify the
result\textquotedblright\ strategy. Combinatorial solutions to Exercise
\ref{exe.enum.-1/2trick} \textbf{(b)} also exist, but are much more
complicated (some such proofs are sketched in \cite{Sved84} as well as in the
math.stackexchange discussions
\url{https://math.stackexchange.com/questions/72367} and
\url{https://math.stackexchange.com/a/360780} ).

\begin{proof}
[Solution to Exercise \ref{exe.enum.-1/2trick}.]\textbf{(a)} From
$n\in\mathbb{N}$, we obtain $2n\geq n$ and $2n\in\mathbb{N}$. Hence, Theorem
\ref{thm.binom.fac} (applied to $2n$ and $n$ instead of $n$ and $k$) yields%
\begin{align*}
\dbinom{2n}{n}  &  =\dfrac{\left(  2n\right)  !}{n!\cdot\left(  2n-n\right)
!}=\dfrac{\left(  2n\right)  !}{n!\cdot n!}=\dfrac{1}{n!n!}\underbrace{\left(
2n\right)  !}_{\substack{=1\cdot2\cdot\cdots\cdot\left(  2n\right)  \\=\left(
1\cdot3\cdot5\cdot\cdots\cdot\left(  2n-1\right)  \right)  \cdot\left(
2\cdot4\cdot6\cdot\cdots\cdot\left(  2n\right)  \right)  \\\text{(here, we
have split the product into}\\\text{the product of its odd factors
and}\\\text{the product of its even factors)}}}\\
&  =\dfrac{1}{n!n!}\underbrace{\left(  1\cdot3\cdot5\cdot\cdots\cdot\left(
2n-1\right)  \right)  }_{=\prod_{i=0}^{n-1}\left(  2i+1\right)  }%
\cdot\underbrace{\left(  2\cdot4\cdot6\cdot\cdots\cdot\left(  2n\right)
\right)  }_{=\prod_{i=1}^{n}\left(  2i\right)  =2^{n}\prod_{i=1}^{n}i}\\
&  =\dfrac{1}{n!n!}\left(  \prod_{i=0}^{n-1}\left(  2i+1\right)  \right)
\cdot2^{n}\underbrace{\prod_{i=1}^{n}i}_{=n!}=\dfrac{1}{n!n!}\left(
\prod_{i=0}^{n-1}\left(  2i+1\right)  \right)  \cdot2^{n}n!\\
&  =\dfrac{2^{n}}{n!}\prod_{i=0}^{n-1}\left(  2i+1\right)  .
\end{align*}
Solving this equality for $\prod_{i=0}^{n-1}\left(  2i+1\right)  $, we obtain%
\begin{equation}
\prod_{i=0}^{n-1}\left(  2i+1\right)  =\dbinom{2n}{n}/\dfrac{2^{n}}{n!}%
=\dfrac{n!}{2^{n}}\dbinom{2n}{n}. \label{sol.enum.-1/2trick.a.2}%
\end{equation}


For each $a\in\mathbb{Q}$, we have%
\begin{align*}
\dbinom{a}{n}  &  =\dfrac{a\left(  a-1\right)  \left(  a-2\right)
\cdots\left(  a-n+1\right)  }{n!}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by (\ref{eq.def.binom.def.a}) (applied to }a\text{ and }n\\
\text{instead of }n\text{ and }k\text{)}%
\end{array}
\right) \\
&  =\dfrac{\prod_{i=0}^{n-1}\left(  a-i\right)  }{n!}=\dfrac{1}{n!}\prod
_{i=0}^{n-1}\left(  a-i\right)  .
\end{align*}
Applying this to $a=-1/2$, we obtain%
\begin{align*}
\dbinom{-1/2}{n}  &  =\dfrac{1}{n!}\prod_{i=0}^{n-1}\underbrace{\left(
-1/2-i\right)  }_{=\dfrac{2i+1}{-2}}=\dfrac{1}{n!}\prod_{i=0}^{n-1}%
\dfrac{2i+1}{-2}=\dfrac{1}{n!}\cdot\dfrac{\prod_{i=0}^{n-1}\left(
2i+1\right)  }{\left(  -2\right)  ^{n}}\\
&  =\dfrac{1}{n!}\cdot\dfrac{1}{\left(  -2\right)  ^{n}}\underbrace{\prod
_{i=0}^{n-1}\left(  2i+1\right)  }_{\substack{=\dfrac{n!}{2^{n}}\dbinom{2n}%
{n}\\\text{(by (\ref{sol.enum.-1/2trick.a.2}))}}}=\dfrac{1}{n!}\cdot\dfrac
{1}{\left(  -2\right)  ^{n}}\cdot\dfrac{n!}{2^{n}}\dbinom{2n}{n}%
=\underbrace{\dfrac{1}{\left(  -2\right)  ^{n}\cdot2^{n}}}_{=\left(
\dfrac{-1}{4}\right)  ^{n}}\dbinom{2n}{n}\\
&  =\left(  \dfrac{-1}{4}\right)  ^{n}\dbinom{2n}{n}.
\end{align*}
This solves Exercise \ref{exe.enum.-1/2trick} \textbf{(a)}.

\textbf{(b)} Theorem \ref{thm.binom.vanderRR} (applied to $x=-1/2$ and
$y=-1/2$) yields%
\[
\dbinom{\left(  -1/2\right)  +\left(  -1/2\right)  }{n}=\sum_{k=0}^{n}%
\dbinom{-1/2}{k}\dbinom{-1/2}{n-k}.
\]
Comparing this with%
\[
\dbinom{\left(  -1/2\right)  +\left(  -1/2\right)  }{n}=\dbinom{-1}{n}=\left(
-1\right)  ^{n}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{eq.exa.binom.small.-1Ck}), applied to }k=n\right)  ,
\]
we obtain%
\begin{align*}
\left(  -1\right)  ^{n}  &  =\sum_{k=0}^{n}\underbrace{\dbinom{-1/2}{k}%
}_{\substack{=\left(  \dfrac{-1}{4}\right)  ^{k}\dbinom{2k}{k}\\\text{(by
Exercise \ref{exe.enum.-1/2trick} \textbf{(a)},}\\\text{applied to }k\text{
instead of }n\text{)}}}\ \ \underbrace{\dbinom{-1/2}{n-k}}_{\substack{=\left(
\dfrac{-1}{4}\right)  ^{n-k}\dbinom{2\left(  n-k\right)  }{n-k}\\\text{(by
Exercise \ref{exe.enum.-1/2trick} \textbf{(a)},}\\\text{applied to }n-k\text{
instead of }n\text{)}}}\\
&  =\sum_{k=0}^{n}\underbrace{\left(  \dfrac{-1}{4}\right)  ^{k}\left(
\dfrac{-1}{4}\right)  ^{n-k}}_{=\left(  \dfrac{-1}{4}\right)  ^{n}}\dbinom
{2k}{k}\dbinom{2\left(  n-k\right)  }{n-k}=\left(  \dfrac{-1}{4}\right)
^{n}\sum_{k=0}^{n}\dbinom{2k}{k}\dbinom{2\left(  n-k\right)  }{n-k}.
\end{align*}
Multiplying both sides of this equality by $\left(  -4\right)  ^{n}$, we
obtain%
\[
\left(  -4\right)  ^{n}\left(  -1\right)  ^{n}=\underbrace{\left(  -4\right)
^{n}\left(  \dfrac{-1}{4}\right)  ^{n}}_{=1}\sum_{k=0}^{n}\dbinom{2k}%
{k}\dbinom{2\left(  n-k\right)  }{n-k}=\sum_{k=0}^{n}\dbinom{2k}{k}%
\dbinom{2\left(  n-k\right)  }{n-k}.
\]
Hence,%
\[
\sum_{k=0}^{n}\dbinom{2k}{k}\dbinom{2\left(  n-k\right)  }{n-k}=\left(
-4\right)  ^{n}\left(  -1\right)  ^{n}=4^{n}.
\]
This solves Exercise \ref{exe.enum.-1/2trick} \textbf{(b)}.
\end{proof}

We end this discussion by mentioning two binomial identities similar to
Exercise \ref{exe.enum.-1/2trick} \textbf{(b)}:

\begin{itemize}
\item For each $n\in\mathbb{N}$, we have%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{2k}{k}\dbinom{2\left(
n-k\right)  }{n-k}=%
\begin{cases}
2^{n}\dbinom{n}{n/2}, & \text{if }n\text{ is even};\\
0, & \text{if }n\text{ is odd.}%
\end{cases}
\]
This appears in \cite[Exercise 3.23 \textbf{(b)}]{detnotes}.

\item For each $n\in\mathbb{N}$ and $u\in\mathbb{C}$, we have%
\begin{equation}
\sum_{k=0}^{n}\dbinom{2k-u}{k}\dbinom{2\left(  n-k\right)  +u}{n-k}=4^{n}.
\label{sol.enum.-1/2trick.bgen}%
\end{equation}
This is a result of Duarte and De Oliveira (\cite[Theorem]{DuaOli13}). I give
a detailed proof in \cite[Exercise 1]{19fco-mt2s} (where I require
$u\in\mathbb{R}$ instead of $u\in\mathbb{C}$, but this makes no difference).
Note that Exercise \ref{exe.enum.-1/2trick} \textbf{(b)} is the particular
case of this identity (\ref{sol.enum.-1/2trick.bgen}) for $u=0$. However, our
above solution to Exercise \ref{exe.enum.-1/2trick} \textbf{(b)} does not
appear to adapt to the more general identity (\ref{sol.enum.-1/2trick.bgen}).
\end{itemize}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.ILL83exe30}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.ILL83exe30}.]Exercise
\ref{exe.enum.ILL83exe30} was on the
\href{http://www2.arnes.si/~tekmovanja/Ma/Longlist.pdf}{IMO Longlist 1983}
(which means it was proposed for the IMO in 1983 but did not get into the
shortlist). To us, it is an easy consequence of Exercise
\ref{exe.enum.coin-sum-2k}. For convenience, we front-load part of our
solution as a self-contained lemma:

\begin{lemma}
\label{lem.sol.enum.ILL83exe30.1}Let $x$ and $y$ be two positive integers such
that $x^{2}-x=y^{2}-y$. Then, $x=y$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.enum.ILL83exe30.1}.]We have $x\geq1$ (since $x$
is a positive integer) and $y>0$ (since $y$ is a positive integer), thus
$\underbrace{x}_{\geq1}+\underbrace{y}_{>0}>1+0=1$. Hence, $x+y-1>0$, so that
$x+y-1\neq0$.

Now, recall that $x^{2}-x=y^{2}-y$. Hence, $\left(  x^{2}-x\right)  -\left(
y^{2}-y\right)  =0$. Comparing this with
\begin{align*}
\left(  x^{2}-x\right)  -\left(  y^{2}-y\right)   &  =\underbrace{x^{2}-y^{2}%
}_{=\left(  x+y\right)  \left(  x-y\right)  }-\left(  x-y\right)  =\left(
x+y\right)  \left(  x-y\right)  -\left(  x-y\right) \\
&  =\left(  x+y-1\right)  \left(  x-y\right)  ,
\end{align*}
we obtain $\left(  x+y-1\right)  \left(  x-y\right)  =0$. We can divide this
equality by $x+y-1$ (since $x+y-1\neq0$), and thus obtain $x-y=0$. In other
words, $x=y$. This proves Lemma \ref{lem.sol.enum.ILL83exe30.1}.
\end{proof}

(An alternative proof of Lemma \ref{lem.sol.enum.ILL83exe30.1} could be given
using Viete's theorem, as the $x^{2}-x=y^{2}-y$ condition means that $x$ and
$y$ are two roots of the polynomial $X^{2}-X-c$ for $c=x^{2}-x=y^{2}-y$.
However, this would be overkill compared to the completely pedestrian proof
given above.)

\begin{proof}
[Solution to Exercise \ref{exe.enum.ILL83exe30}.]We need to show the following
two claims:

\begin{statement}
\textit{Claim 1:} There is \textbf{at least one} sequence $\left(  u_{0}%
,u_{1},u_{2},\ldots\right)  $ of positive integers such that%
\[
u_{n}^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}u_{n-r}\ \ \ \ \ \ \ \ \ \ \text{for
all }n\in\mathbb{N}.
\]

\end{statement}

\begin{statement}
\textit{Claim 2:} There is \textbf{at most one} sequence $\left(  u_{0}%
,u_{1},u_{2},\ldots\right)  $ of positive integers such that%
\begin{equation}
u_{n}^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}u_{n-r}\ \ \ \ \ \ \ \ \ \ \text{for
all }n\in\mathbb{N}. \label{sol.enum.-1/2trick.c2.2}%
\end{equation}

\end{statement}

[\textit{Proof of Claim 1:} We shall show that the sequence $\left(
2^{0},2^{1},2^{2},\ldots\right)  $ fits the bill.

Indeed, this sequence $\left(  2^{0},2^{1},2^{2},\ldots\right)  $ is clearly a
sequence of positive integers. For each $n\in\mathbb{N}$, we have%
\begin{align*}
\sum_{r=0}^{n}\dbinom{n+r}{r}\underbrace{2^{n-r}}_{=\dfrac{2^{n}}{2^{r}}}  &
=\sum_{r=0}^{n}\dbinom{n+r}{r}\dfrac{2^{n}}{2^{r}}=2^{n}\cdot\sum_{r=0}%
^{n}\dbinom{n+r}{r}\dfrac{1}{2^{r}}=2^{n}\cdot\underbrace{\sum_{k=0}%
^{n}\dbinom{n+k}{k}\dfrac{1}{2^{k}}}_{\substack{=2^{n}\\\text{(by Exercise
\ref{exe.enum.coin-sum-2k})}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed the summation index
}r\text{ as }k\right) \\
&  =2^{n}\cdot2^{n}=\left(  2^{n}\right)  ^{2}.
\end{align*}
Thus, $\left(  2^{n}\right)  ^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}2^{n-r}$ for
all $n\in\mathbb{N}$. Hence, there is \textbf{at least one} sequence $\left(
u_{0},u_{1},u_{2},\ldots\right)  $ of positive integers such that%
\[
u_{n}^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}u_{n-r}\ \ \ \ \ \ \ \ \ \ \text{for
all }n\in\mathbb{N}%
\]
(namely, $\left(  u_{0},u_{1},u_{2},\ldots\right)  =\left(  2^{0},2^{1}%
,2^{2},\ldots\right)  $). This proves Claim 1.]

[\textit{Proof of Claim 2:} Let $\left(  v_{0},v_{1},v_{2},\ldots\right)  $
and $\left(  w_{0},w_{1},w_{2},\ldots\right)  $ be two sequences $\left(
u_{0},u_{1},u_{2},\ldots\right)  $ of positive integers satisfying
(\ref{sol.enum.-1/2trick.c2.2}). We shall show that $\left(  v_{0},v_{1}%
,v_{2},\ldots\right)  =\left(  w_{0},w_{1},w_{2},\ldots\right)  $.

Indeed, we claim that%
\begin{equation}
v_{j}=w_{j}\ \ \ \ \ \ \ \ \ \ \text{for each }j\in\mathbb{N}\text{.}
\label{sol.enum.-1/2trick.c2.2.pf.1}%
\end{equation}


[\textit{Proof of (\ref{sol.enum.-1/2trick.c2.2.pf.1}):} We shall prove
(\ref{sol.enum.-1/2trick.c2.2.pf.1}) by strong induction on $j$:

\textit{Induction step:} Let $n\in\mathbb{N}$. Assume (as the induction
hypothesis) that (\ref{sol.enum.-1/2trick.c2.2.pf.1}) holds for $j<n$. We must
prove that (\ref{sol.enum.-1/2trick.c2.2.pf.1}) holds for $j=n$. In other
words, we must prove that $v_{n}=w_{n}$.

We know that $\left(  v_{0},v_{1},v_{2},\ldots\right)  $ is a sequence
$\left(  u_{0},u_{1},u_{2},\ldots\right)  $ satisfying
(\ref{sol.enum.-1/2trick.c2.2}). Thus, (\ref{sol.enum.-1/2trick.c2.2}) holds
for $u_{i}=v_{i}$. Therefore,%
\[
v_{n}^{2}=\sum_{r=0}^{n}\dbinom{n+r}{r}v_{n-r}=\underbrace{\dbinom{n+0}{0}%
}_{\substack{=1\\\text{(by (\ref{eq.exa.binom.small.nC0}))}}%
}\underbrace{v_{n-0}}_{=v_{n}}+\sum_{r=1}^{n}\dbinom{n+r}{r}v_{n-r}=v_{n}%
+\sum_{r=1}^{n}\dbinom{n+r}{r}v_{n-r}.
\]
Thus,%
\begin{equation}
v_{n}^{2}-v_{n}=\sum_{r=1}^{n}\dbinom{n+r}{r}v_{n-r}.
\label{sol.enum.-1/2trick.c2.2.pf.1.pf.3}%
\end{equation}
The same argument (applied to $\left(  w_{0},w_{1},w_{2},\ldots\right)  $
instead of $\left(  v_{0},v_{1},v_{2},\ldots\right)  $) yields%
\begin{equation}
w_{n}^{2}-w_{n}=\sum_{r=1}^{n}\dbinom{n+r}{r}w_{n-r}.
\label{sol.enum.-1/2trick.c2.2.pf.1.pf.4}%
\end{equation}


However, our induction hypothesis says that
(\ref{sol.enum.-1/2trick.c2.2.pf.1}) holds for $j<n$. In other words,
$v_{j}=w_{j}$ holds for each $j<n$. In other words, $v_{j}=w_{j}$ holds for
each $j\in\left\{  0,1,\ldots,n-1\right\}  $. Substituting $n-r$ for $j$ in
this result, we conclude the following:%
\[
v_{n-r}=w_{n-r}\ \ \ \ \ \ \ \ \ \ \text{holds for each }r\in\left\{
1,2,\ldots,n\right\}  .
\]
Hence, the right hand sides of the equalities
(\ref{sol.enum.-1/2trick.c2.2.pf.1.pf.3}) and
(\ref{sol.enum.-1/2trick.c2.2.pf.1.pf.4}) are equal. Thus, their left hand
sides are equal as well. In other words, $v_{n}^{2}-v_{n}=w_{n}^{2}-w_{n}$.
Moreover, $v_{n}$ is a positive integer (since $\left(  v_{0},v_{1}%
,v_{2},\ldots\right)  $ is a sequence of positive integers), and $w_{n}$ is a
positive integer (similarly). Thus, Lemma \ref{lem.sol.enum.ILL83exe30.1}
(applied to $x=v_{n}$ and $y=w_{n}$) yields that $v_{n}=w_{n}$. This is
precisely what we needed to prove. Thus, the induction step is complete.
Hence, (\ref{sol.enum.-1/2trick.c2.2.pf.1}) is proved.]

Now, we have proved (\ref{sol.enum.-1/2trick.c2.2.pf.1}); in other words, we
have shown that $\left(  v_{0},v_{1},v_{2},\ldots\right)  =\left(  w_{0}%
,w_{1},w_{2},\ldots\right)  $.

Forget that we fixed $\left(  v_{0},v_{1},v_{2},\ldots\right)  $ and $\left(
w_{0},w_{1},w_{2},\ldots\right)  $. We thus have shown that if $\left(
v_{0},v_{1},v_{2},\ldots\right)  $ and $\left(  w_{0},w_{1},w_{2}%
,\ldots\right)  $ are two sequences $\left(  u_{0},u_{1},u_{2},\ldots\right)
$ of positive integers satisfying (\ref{sol.enum.-1/2trick.c2.2}), then
$\left(  v_{0},v_{1},v_{2},\ldots\right)  =\left(  w_{0},w_{1},w_{2}%
,\ldots\right)  $. In other words, there is \textbf{at most one} such sequence
$\left(  u_{0},u_{1},u_{2},\ldots\right)  $. Thus, Claim 2 is proved.]

Having proved Claim 1 and Claim 2, we have thus solved Exercise
\ref{exe.enum.ILL83exe30}.
\end{proof}
\end{proof}

\subsection{Homework set \#8 discussion}

The following are discussions of the problems on homework set \#8 (Section
\ref{sect.hw8}).

\subsubsection{Discussion of Exercise \ref{exe.ent.sum1xy-eng}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.sum1xy-eng}.]Exercise
\ref{exe.ent.sum1xy-eng} appears in \cite[Exercise 8.33]{Engel} and in
\cite[Exercise 2.10.19]{19s}. We shall outline two solutions for it: a
relatively elegant one and a relatively straightforward one.

\begin{proof}
[First solution to Exercise \ref{exe.ent.sum1xy-eng} (sketched).](See
\cite[solution to Exercise 2.10.19]{19s} for the details of this solution.) We
shall show that $\sum_{\left(  x,y\right)  \in Z}\ \ \dfrac{1}{xy}=1$.

Let $W$ be the set of all pairs $\left(  x,y\right)  \in\left[  n\right]
^{2}$ satisfying $x\perp y$ and $x+y\leq n$. Any pair $\left(  x,y\right)
\in\left[  n\right]  ^{2}$ satisfying $x\perp y$ must satisfy either $x+y\leq
n$ or $x+y>n$ (but not both at the same time), and thus must belong to exactly
one of the two sets $W$ and $Z$. Hence, we can split the sum $\sum
_{\substack{\left(  x,y\right)  \in\left[  n\right]  ^{2};\\x\perp
y}}\ \ \dfrac{1}{xy}$ as follows:%
\begin{equation}
\sum_{\substack{\left(  x,y\right)  \in\left[  n\right]  ^{2};\\x\perp
y}}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{xy}%
+\sum_{\left(  x,y\right)  \in Z}\ \ \dfrac{1}{xy}.
\label{sol.ent.sum1xy-eng.1st.1}%
\end{equation}


On the other hand, let $A$ be the set of all pairs $\left(  x,y\right)
\in\left[  n\right]  ^{2}$ satisfying $x\perp y$ and $x<y$. Let $B$ be the set
of all pairs $\left(  x,y\right)  \in\left[  n\right]  ^{2}$ satisfying
$x\perp y$ and $x=y$. Let $C$ be the set of all pairs $\left(  x,y\right)
\in\left[  n\right]  ^{2}$ satisfying $x\perp y$ and $x>y$.

Now, any pair $\left(  x,y\right)  \in\left[  n\right]  ^{2}$ satisfying
$x\perp y$ must satisfy exactly one of the three relations $x<y$ and $x=y$ and
$x>y$, and thus must belong to exactly one of the three sets $A$, $B$ and $C$.
Thus, we can split the sum $\sum_{\substack{\left(  x,y\right)  \in\left[
n\right]  ^{2};\\x\perp y}}\ \ \dfrac{1}{xy}$ as follows:%
\begin{equation}
\sum_{\substack{\left(  x,y\right)  \in\left[  n\right]  ^{2};\\x\perp
y}}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)  \in A}\ \ \dfrac{1}{xy}%
+\sum_{\left(  x,y\right)  \in B}\ \ \dfrac{1}{xy}+\sum_{\left(  x,y\right)
\in C}\ \ \dfrac{1}{xy}. \label{sol.ent.sum1xy-eng.1st.2}%
\end{equation}


We shall now study the three sums on the right hand side of this equality. We
begin with the first one: We claim that
\begin{equation}
\sum_{\left(  x,y\right)  \in A}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)
\in W}\ \ \dfrac{1}{x\left(  x+y\right)  }.
\label{sol.ent.sum1xy-eng.1st.sumA}%
\end{equation}


[\textit{Proof of (\ref{sol.ent.sum1xy-eng.1st.sumA}):} It is fairly
straightforward to see that the two maps%
\begin{align*}
f:W  &  \rightarrow A,\\
\left(  u,v\right)   &  \mapsto\left(  u,u+v\right)
\end{align*}
and%
\begin{align*}
g:A  &  \rightarrow W,\\
\left(  u,v\right)   &  \mapsto\left(  u,v-u\right)
\end{align*}
are well-defined\footnote{Proving this is fairly easy: The only part that is
not completely trivial is showing that $u\perp v$ implies $u\perp u+v$ and
$u\perp v-u$. But this can easily be derived from Proposition
\ref{prop.ent.gcd.props1} (indeed, Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} entails $\gcd\left(  u,u+v\right)  =\gcd\left(  u,v\right)  $ and
$\gcd\left(  u,v-u\right)  =\gcd\left(  u,v\right)  $).} and mutually
inverse\footnote{This is completely straightforward to check.}. Hence, these
two maps are bijections. In particular, this means that $f$ is a bijection.
Hence, we can substitute $\left(  u,u+v\right)  $ for $\left(  x,y\right)  $
in the sum $\sum_{\left(  x,y\right)  \in A}\ \ \dfrac{1}{xy}$. We thus
obtain
\[
\sum_{\left(  x,y\right)  \in A}\ \ \dfrac{1}{xy}=\sum_{\left(  u,v\right)
\in W}\ \ \dfrac{1}{u\left(  u+v\right)  }=\sum_{\left(  x,y\right)  \in
W}\ \ \dfrac{1}{x\left(  x+y\right)  }%
\]
(here, we have renamed the summation index $\left(  u,v\right)  $ as $\left(
x,y\right)  $). This proves (\ref{sol.ent.sum1xy-eng.1st.sumA}).]

Next, we claim that
\begin{equation}
\sum_{\left(  x,y\right)  \in C}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)
\in W}\ \ \dfrac{1}{y\left(  x+y\right)  }.
\label{sol.ent.sum1xy-eng.1st.sumC}%
\end{equation}


[\textit{Proof of (\ref{sol.ent.sum1xy-eng.1st.sumC}):} This is similar to the
proof of (\ref{sol.ent.sum1xy-eng.1st.sumA}). It is fairly straightforward to
see that the two maps%
\begin{align*}
f:W  &  \rightarrow C,\\
\left(  u,v\right)   &  \mapsto\left(  u+v,v\right)
\end{align*}
and%
\begin{align*}
g:C  &  \rightarrow W,\\
\left(  u,v\right)   &  \mapsto\left(  u-v,v\right)
\end{align*}
are well-defined\footnote{Proving this is fairly easy: The only part that is
not completely trivial is showing that $u\perp v$ implies $u+v\perp v$ and
$u-v\perp v$. But this can easily be derived from Proposition
\ref{prop.ent.gcd.props1} (indeed, Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} entails $\gcd\left(  v,u+v\right)  =\gcd\left(  v,u\right)  $ and
$\gcd\left(  v,u-v\right)  =\gcd\left(  v,u\right)  $).} and mutually
inverse\footnote{This is completely straightforward to check.}. Hence, these
two maps are bijections. In particular, this means that $f$ is a bijection.
Hence, we can substitute $\left(  u+v,v\right)  $ for $\left(  x,y\right)  $
in the sum $\sum_{\left(  x,y\right)  \in C}\ \ \dfrac{1}{xy}$. We thus
obtain
\[
\sum_{\left(  x,y\right)  \in C}\ \ \dfrac{1}{xy}=\sum_{\left(  u,v\right)
\in W}\ \ \underbrace{\dfrac{1}{\left(  u+v\right)  v}}_{=\dfrac{1}{v\left(
u+v\right)  }}=\sum_{\left(  u,v\right)  \in W}\ \ \dfrac{1}{v\left(
u+v\right)  }=\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{y\left(
x+y\right)  }%
\]
(here, we have renamed the summation index $\left(  u,v\right)  $ as $\left(
x,y\right)  $). This proves (\ref{sol.ent.sum1xy-eng.1st.sumC}).]

Next, we claim that%
\begin{equation}
\sum_{\left(  x,y\right)  \in B}\ \ \dfrac{1}{xy}=1.
\label{sol.ent.sum1xy-eng.1st.sumB}%
\end{equation}


[\textit{Proof of (\ref{sol.ent.sum1xy-eng.1st.sumB}):} The set $B$ consists
of all pairs $\left(  x,y\right)  \in\left[  n\right]  ^{2}$ satisfying
$x\perp y$ and $x=y$. In other words, $B$ consists of all pairs $\left(
x,x\right)  \in\left[  n\right]  ^{2}$ satisfying $x\perp x$ (since the
condition $x=y$ allows us to rewrite the pair $\left(  x,y\right)  $ as
$\left(  x,x\right)  $). However, the only such pair is $\left(  1,1\right)  $
(indeed, a positive integer $x$ always satisfies $\gcd\left(  x,x\right)  =x$,
and therefore will satisfy $x\perp x$ if and only if $x=1$). Hence,
$B=\left\{  \left(  1,1\right)  \right\}  $. Consequently,%
\[
\sum_{\left(  x,y\right)  \in B}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)
\in\left\{  \left(  1,1\right)  \right\}  }\ \ \dfrac{1}{xy}=\dfrac{1}%
{1\cdot1}=1.
\]
This proves (\ref{sol.ent.sum1xy-eng.1st.sumB}).]

Now, (\ref{sol.ent.sum1xy-eng.1st.2}) becomes%
\begin{align*}
\sum_{\substack{\left(  x,y\right)  \in\left[  n\right]  ^{2};\\x\perp
y}}\ \ \dfrac{1}{xy}  &  =\underbrace{\sum_{\left(  x,y\right)  \in
A}\ \ \dfrac{1}{xy}}_{\substack{=\sum_{\left(  x,y\right)  \in W}\ \ \dfrac
{1}{x\left(  x+y\right)  }\\\text{(by (\ref{sol.ent.sum1xy-eng.1st.sumA}))}%
}}+\underbrace{\sum_{\left(  x,y\right)  \in B}\ \ \dfrac{1}{xy}%
}_{\substack{=1\\\text{(by (\ref{sol.ent.sum1xy-eng.1st.sumB}))}%
}}+\underbrace{\sum_{\left(  x,y\right)  \in C}\ \ \dfrac{1}{xy}%
}_{\substack{=\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{y\left(
x+y\right)  }\\\text{(by (\ref{sol.ent.sum1xy-eng.1st.sumC}))}}}\\
&  =\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{x\left(  x+y\right)
}+1+\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{y\left(  x+y\right)  }\\
&  =\underbrace{\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{x\left(
x+y\right)  }+\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{y\left(
x+y\right)  }}_{=\sum_{\left(  x,y\right)  \in W}\left(  \dfrac{1}{x\left(
x+y\right)  }+\dfrac{1}{y\left(  x+y\right)  }\right)  }+1\\
&  =\sum_{\left(  x,y\right)  \in W}\underbrace{\left(  \dfrac{1}{x\left(
x+y\right)  }+\dfrac{1}{y\left(  x+y\right)  }\right)  }_{=\dfrac
{y+x}{xy\left(  x+y\right)  }=\dfrac{1}{xy}}+1=\sum_{\left(  x,y\right)  \in
W}\ \ \dfrac{1}{xy}+1.
\end{align*}
Comparing this with (\ref{sol.ent.sum1xy-eng.1st.1}), we obtain%
\[
\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{xy}+\sum_{\left(  x,y\right)
\in Z}\ \ \dfrac{1}{xy}=\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{xy}+1
\]
Subtracting $\sum_{\left(  x,y\right)  \in W}\ \ \dfrac{1}{xy}$ from both
sides of this equality, we obtain $\sum_{\left(  x,y\right)  \in Z}%
\ \ \dfrac{1}{xy}=1$. This solves Exercise \ref{exe.ent.sum1xy-eng}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ent.sum1xy-eng} (sketched).]Let us
rename the set $Z$ as $Z_{n}$, to stress its dependence on $n$. Thus, we must
compute $\sum\limits_{\left(  x,y\right)  \in Z_{n}}\ \ \dfrac{1}{xy}$. We
claim that%
\[
\sum\limits_{\left(  x,y\right)  \in Z_{n}}\ \ \dfrac{1}{xy}=1.
\]


We shall prove this by induction on $n$:

\textit{Induction base:} It is easy to see that $\sum\limits_{\left(
x,y\right)  \in Z_{n}}\ \ \dfrac{1}{xy}=1$ for $n=1$ (since the only element
of $Z_{1}$ is the pair $\left(  1,1\right)  $).

\textit{Induction step:} Let $m>1$ be an integer. Assume (as the induction
hypothesis) that $\sum\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac
{1}{xy}=1$. We must prove that $\sum\limits_{\left(  x,y\right)  \in Z_{m}%
}\ \ \dfrac{1}{xy}=1$.

We shall achieve this by analyzing how $Z_{m}$ differs from $Z_{m-1}$. Recall
the definitions of these two sets:

\begin{itemize}
\item The set $Z_{m}$ consists of all pairs $\left(  x,y\right)  \in\left[
m\right]  ^{2}$ satisfying $x\perp y$ and $x+y>m$.

\item The set $Z_{m-1}$ consists of all pairs $\left(  x,y\right)  \in\left[
m-1\right]  ^{2}$ satisfying $x\perp y$ and $x+y>m-1$.
\end{itemize}

Thus, roughly speaking, the sets $Z_{m}$ and $Z_{m-1}$ agree in
\textquotedblleft most\textquotedblright\ of their elements. To make this more
precise, let us see which elements of $Z_{m}$ fail to belong to $Z_{m-1}$:

\begin{itemize}
\item An element $\left(  x,y\right)  \in Z_{m}$ will always belong to
$Z_{m-1}$, unless one of $x$ and $y$ equals $m$ (because $x+y>m$ always
implies $x+y>m-1$, whereas $\left(  x,y\right)  \in\left[  m\right]  ^{2}$
implies $\left(  x,y\right)  \in\left[  m-1\right]  ^{2}$ unless one of $x$
and $y$ equals $m$). Hence, the sum $\sum\limits_{\left(  x,y\right)  \in
Z_{m}}\ \ \dfrac{1}{xy}$ can be split as follows:%
\begin{equation}
\sum\limits_{\left(  x,y\right)  \in Z_{m}}\ \ \dfrac{1}{xy}=\sum
\limits_{\substack{\left(  x,y\right)  \in Z_{m};\\\left(  x,y\right)  \in
Z_{m-1}}}\ \ \dfrac{1}{xy}+\sum\limits_{\substack{\left(  x,y\right)  \in
Z_{m};\\\text{one of }x\text{ and }y\text{ equals }m}}\dfrac{1}{xy}.
\label{sol.ent.sum1xy-eng.2nd.1}%
\end{equation}

\end{itemize}

We can likewise analyze which elements of $Z_{m-1}$ fail to belong to $Z_{m}$:

\begin{itemize}
\item An element $\left(  x,y\right)  \in Z_{m-1}$ will always belong to
$Z_{m}$, unless $x+y=m$ (because $x+y>m-1$ implies $x+y>m$ unless $x+y=m$,
whereas $\left(  x,y\right)  \in\left[  m-1\right]  ^{2}$ always implies
$\left(  x,y\right)  \in\left[  m\right]  ^{2}$). Hence, the sum
$\sum\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac{1}{xy}$ can be split
as follows:%
\begin{equation}
\sum\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac{1}{xy}=\sum
\limits_{\substack{\left(  x,y\right)  \in Z_{m-1};\\\left(  x,y\right)  \in
Z_{m}}}\ \ \dfrac{1}{xy}+\sum\limits_{\substack{\left(  x,y\right)  \in
Z_{m-1};\\x+y=m}}\ \ \dfrac{1}{xy}. \label{sol.ent.sum1xy-eng.2nd.2}%
\end{equation}

\end{itemize}

Now, subtracting (\ref{sol.ent.sum1xy-eng.2nd.2}) from
(\ref{sol.ent.sum1xy-eng.2nd.1}), we obtain%
\begin{align}
&  \sum\limits_{\left(  x,y\right)  \in Z_{m}}\ \ \dfrac{1}{xy}-\sum
\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac{1}{xy}\nonumber\\
&  =\left(  \sum\limits_{\substack{\left(  x,y\right)  \in Z_{m};\\\left(
x,y\right)  \in Z_{m-1}}}\ \ \dfrac{1}{xy}+\sum\limits_{\substack{\left(
x,y\right)  \in Z_{m};\\\text{one of }x\text{ and }y\text{ equals }m}%
}\dfrac{1}{xy}\right)  -\left(  \sum\limits_{\substack{\left(  x,y\right)  \in
Z_{m-1};\\\left(  x,y\right)  \in Z_{m}}}\ \ \dfrac{1}{xy}+\sum
\limits_{\substack{\left(  x,y\right)  \in Z_{m-1};\\x+y=m}}\ \ \dfrac{1}%
{xy}\right) \nonumber\\
&  =\underbrace{\sum\limits_{\substack{\left(  x,y\right)  \in Z_{m};\\\left(
x,y\right)  \in Z_{m-1}}}\ \ \dfrac{1}{xy}-\sum\limits_{\substack{\left(
x,y\right)  \in Z_{m-1};\\\left(  x,y\right)  \in Z_{m}}}\ \ \dfrac{1}{xy}%
}_{\substack{=0\\\text{(since these two sums are equal)}}}+\underbrace{\sum
\limits_{\substack{\left(  x,y\right)  \in Z_{m};\\\text{one of }x\text{ and
}y\text{ equals }m}}}_{=\sum_{\substack{\left(  x,y\right)  \in\left[
m\right]  ^{2};\\x\perp y;\\\left(  x=m\text{ or }y=m\right)  }}}\dfrac{1}%
{xy}-\underbrace{\sum\limits_{\substack{\left(  x,y\right)  \in Z_{m-1}%
;\\x+y=m}}}_{=\sum_{\substack{\left(  x,y\right)  \in\left[  m-1\right]
^{2};\\x\perp y;\\x+y=m}}}\ \ \dfrac{1}{xy}\nonumber\\
&  =\sum_{\substack{\left(  x,y\right)  \in\left[  m\right]  ^{2};\\x\perp
y;\\\left(  x=m\text{ or }y=m\right)  }}\ \ \dfrac{1}{xy}-\sum
_{\substack{\left(  x,y\right)  \in\left[  m-1\right]  ^{2};\\x\perp
y;\\x+y=m}}\ \ \dfrac{1}{xy}. \label{sol.ent.sum1xy-eng.2nd.1-2}%
\end{align}


Now, let us simplify the first sum on the right hand side. A pair $\left(
x,y\right)  \in\left[  m\right]  ^{2}$ satisfying $x\perp y$ cannot satisfy
$x=m$ and $y=m$ simultaneously (because this would mean that $m\perp m$, but
this is impossible because of $m>1$). Hence, we can split the sum
$\sum_{\substack{\left(  x,y\right)  \in\left[  m\right]  ^{2};\\x\perp
y;\\\left(  x=m\text{ or }y=m\right)  }}\ \ \dfrac{1}{xy}$ as follows:%
\begin{align}
\sum_{\substack{\left(  x,y\right)  \in\left[  m\right]  ^{2};\\x\perp
y;\\\left(  x=m\text{ or }y=m\right)  }}\ \ \dfrac{1}{xy}  &
=\underbrace{\sum_{\substack{\left(  x,y\right)  \in\left[  m\right]
^{2};\\x\perp y;\\x=m\text{ but not }y=m}}\ \ \dfrac{1}{xy}}_{\substack{=\sum
_{\substack{y\in\left[  m\right]  ;\\m\perp y;\\\text{not }y=m}}\ \ \dfrac
{1}{my}\\=\sum_{\substack{y\in\left[  m-1\right]  ;\\m\perp y}}\ \ \dfrac
{1}{my}}}+\underbrace{\sum_{\substack{\left(  x,y\right)  \in\left[  m\right]
^{2};\\x\perp y;\\y=m\text{ but not }x=m}}\ \ \dfrac{1}{xy}}_{\substack{=\sum
_{\substack{x\in\left[  m\right]  ;\\x\perp m;\\\text{not }x=m}}\ \ \dfrac
{1}{xm}\\=\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac
{1}{xm}}}\nonumber\\
&  =\underbrace{\sum_{\substack{y\in\left[  m-1\right]  ;\\m\perp
y}}\ \ \dfrac{1}{my}}_{\substack{=\sum_{\substack{x\in\left[  m-1\right]
;\\m\perp m-x}}\ \ \dfrac{1}{m\left(  m-x\right)  }\\\text{(here, we have
substituted }m-x\text{ for }y\text{ in the sum)}}}+\sum_{\substack{x\in\left[
m-1\right]  ;\\x\perp m}}\ \ \dfrac{1}{xm}\nonumber\\
&  =\underbrace{\sum_{\substack{x\in\left[  m-1\right]  ;\\m\perp m-x}%
}}_{\substack{=\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp
m}}\\\text{(since it is not hard}\\\text{to see that }m\perp m-x\text{
is}\\\text{equivalent to }x\perp m\text{)}}}\ \ \dfrac{1}{m\left(  m-x\right)
}+\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac{1}%
{xm}\nonumber\\
&  =\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac
{1}{m\left(  m-x\right)  }+\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp
m}}\ \ \dfrac{1}{xm}=\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp
m}}\underbrace{\left(  \dfrac{1}{m\left(  m-x\right)  }+\dfrac{1}{xm}\right)
}_{=\dfrac{1}{x\left(  m-x\right)  }}\nonumber\\
&  =\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac
{1}{x\left(  m-x\right)  }. \label{sol.ent.sum1xy-eng.2nd.3}%
\end{align}
Meanwhile, the second sum on the right hand side of
(\ref{sol.ent.sum1xy-eng.2nd.1-2}) rewrites as follows:%
\begin{align}
\sum_{\substack{\left(  x,y\right)  \in\left[  m-1\right]  ^{2};\\x\perp
y;\\x+y=m}}\ \ \dfrac{1}{xy}  &  =\underbrace{\sum_{\substack{x\in\left[
m-1\right]  ;\\x\perp m-x}}}_{\substack{=\sum_{\substack{x\in\left[
m-1\right]  ;\\x\perp m}}\\\text{(since it is not hard}\\\text{to see that
}x\perp m-x\text{ is}\\\text{equivalent to }x\perp m\text{)}}}\ \ \dfrac
{1}{x\left(  m-x\right)  }\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have substituted }\left(  x,m-x\right) \\
\text{for }\left(  x,y\right)  \text{ in the sum, since the}\\
\text{condition }x+y=m\text{ allows rewriting }y\text{ as }m-x
\end{array}
\right) \nonumber\\
&  =\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac
{1}{x\left(  m-x\right)  }. \label{sol.ent.sum1xy-eng.2nd.4}%
\end{align}


In view of (\ref{sol.ent.sum1xy-eng.2nd.3}) and
(\ref{sol.ent.sum1xy-eng.2nd.4}), we can rewrite
(\ref{sol.ent.sum1xy-eng.2nd.1-2}) as%
\[
\sum\limits_{\left(  x,y\right)  \in Z_{m}}\ \ \dfrac{1}{xy}-\sum
\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac{1}{xy}=\sum
_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}}\ \ \dfrac{1}{x\left(
m-x\right)  }-\sum_{\substack{x\in\left[  m-1\right]  ;\\x\perp m}%
}\ \ \dfrac{1}{x\left(  m-x\right)  }=0.
\]
Hence,%
\[
\sum\limits_{\left(  x,y\right)  \in Z_{m}}\ \ \dfrac{1}{xy}=\sum
\limits_{\left(  x,y\right)  \in Z_{m-1}}\ \ \dfrac{1}{xy}%
=1\ \ \ \ \ \ \ \ \ \ \left(  \text{by the induction hypothesis}\right)  .
\]
This completes the induction step. Thus, Exercise \ref{exe.ent.sum1xy-eng} is
solved again.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.lunes-and-perms}}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.lunes-and-perms}.]First and foremost:
The two parts of Exercise \ref{exe.enum.lunes-and-perms} come from different
subjects, but agree in the rough idea of their solution, which is to compute
the area of a shape (in part \textbf{(a)}) or the size of a set (in part
\textbf{(b)}) by first computing the area of a larger shape or the size of a
larger set, and then subtracting the part that was overcounted. In the case of
the size of a finite set (which is what we have in part \textbf{(b)}), this is
a trick we have used many times before (always relying on the difference rule
-- i.e., on Theorem \ref{thm.enum.diff}). In the case of the area of a shape,
the conceptual grounding is more sophisticated (areas require measure theory
to rigorously define, whereas the size of a finite set is one of the most
basic notions in mathematics); but the idea is the same.

\begin{proof}
[Solution to Exercise \ref{exe.enum.lunes-and-perms} (sketched).]\textbf{(a)}
The two half-circles subdivide the quarter-circle into four regions. We denote
the areas of these four regions by $b,r,x,y$ in the following way:%
\[%
%TCIMACRO{\TeXButton{tikz lunes}{\begin{tikzpicture}[scale=2]
%\node(A) at (0, 0) {};
%\node(B) at (2, 0) {};
%\node(C) at (0, 2) {};
%\fill(A) circle (1pt) node[left] {$A$};
%\fill(B) circle (1pt) node[right] {$B$};
%\fill(C) circle (1pt) node[left] {$C$};
%\draw
%(2, 0) arc[radius=2, start angle=0, end angle=90] (0, 2) arc[radius=1, start angle=90, end angle=0] (1, 1) arc[radius=1, start angle=90, end angle=0];
%\draw
%(1, 1) arc[radius=1, start angle=0, end angle=-90] (0, 0) arc[radius=1, start angle=180, end angle=90] ;
%\draw(2, 0) -- (0, 0) -- (0, 2);
%\node(area-b) at (0.5, 0.5) {$b$};
%\node(area-b) at (1.2, 1.2) {$r$};
%\node(area-b) at (0.5, 1.3) {$x$};
%\node(area-b) at (1.3, 0.5) {$y$};
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2]
\node(A) at (0, 0) {};
\node(B) at (2, 0) {};
\node(C) at (0, 2) {};
\fill(A) circle (1pt) node[left] {$A$};
\fill(B) circle (1pt) node[right] {$B$};
\fill(C) circle (1pt) node[left] {$C$};
\draw
(2, 0) arc[radius=2, start angle=0, end angle=90] (0, 2) arc[radius=1, start angle=90, end angle=0] (1, 1) arc[radius=1, start angle=90, end angle=0];
\draw
(1, 1) arc[radius=1, start angle=0, end angle=-90] (0, 0) arc[radius=1, start angle=180, end angle=90] ;
\draw(2, 0) -- (0, 0) -- (0, 2);
\node(area-b) at (0.5, 0.5) {$b$};
\node(area-b) at (1.2, 1.2) {$r$};
\node(area-b) at (0.5, 1.3) {$x$};
\node(area-b) at (1.3, 0.5) {$y$};
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
\footnote{Here is how to define $b,r,x,y$ without referencing the picture: We
shall refer to the semicircle with diameter $AB$ as the \textit{lower
semicircle}. We shall refer to the semicircle with diameter $AC$ as the
\textit{upper semicircle}. Let $\mathbb{A}\left(  U\right)  $ denote the area
of any shape $U$. Now, we set%
\begin{align*}
b  &  =\mathbb{A}\left(  \left(  \text{lower semicircle}\right)  \cap\left(
\text{upper semicircle}\right)  \right)  ;\\
r  &  =\mathbb{A}\left(  \left(  \text{quarter-circle}\right)  \setminus
\left(  \left(  \text{lower semicircle}\right)  \cup\left(  \text{upper
semicircle}\right)  \right)  \right)  ;\\
x  &  =\mathbb{A}\left(  \left(  \text{upper semicircle}\right)
\setminus\left(  \text{lower semicircle}\right)  \right)  ;\\
y  &  =\mathbb{A}\left(  \left(  \text{lower semicircle}\right)
\setminus\left(  \text{upper semicircle}\right)  \right)  .
\end{align*}
} Thus, the area of the red region is $r$, whereas the area of the blue region
is $b$. We claim that $r=b$.

Indeed, let $a=\left\vert AB\right\vert =\left\vert AC\right\vert $. Thus, the
quarter-circle has radius $a$; hence, its area is $\dfrac{1}{4}\pi a^{2}$. In
other words,%
\begin{equation}
b+r+x+y=\dfrac{1}{4}\pi a^{2} \label{sol.enum.lunes-and-perms.a.1}%
\end{equation}
(since the quarter-circle has been subdivided into four regions with areas
$b,r,x,y$, and thus its area is $b+r+x+y$).

However, the lower semicircle has diameter $AB$ and thus radius $\dfrac{1}%
{2}\underbrace{\left\vert AB\right\vert }_{=a}=\dfrac{1}{2}a$. Hence, its area
is $\dfrac{1}{2}\pi\left(  \dfrac{1}{2}a\right)  ^{2}=\dfrac{1}{8}\pi a^{2}$.
In other words,
\begin{equation}
b+y=\dfrac{1}{8}\pi a^{2} \label{sol.enum.lunes-and-perms.a.2}%
\end{equation}
(since the lower semicircle has been subdivided into two regions with areas
$b$ and $y$, and thus its area is $b+y$).

A similar argument (using the upper semicircle instead of the lower one) shows
that $b+x=\dfrac{1}{8}\pi a^{2}$. Subtracting this equality from
(\ref{sol.enum.lunes-and-perms.a.1}), we obtain $\left(  b+r+x+y\right)
-\left(  b+x\right)  =\dfrac{1}{4}\pi a^{2}-\dfrac{1}{8}\pi a^{2}$. This
simplifies to $r+y=\dfrac{1}{8}\pi a^{2}$. Comparing this with
(\ref{sol.enum.lunes-and-perms.a.2}), we obtain $r+y=b+y$. Hence, $r=b$. This
solves Exercise \ref{exe.enum.lunes-and-perms} \textbf{(a)}.

\textbf{(b)} Exercise \ref{exe.enum.lunes-and-perms} \textbf{(b)} is
\cite[Lemma 0.3]{17f-hw8s}, where I give three proofs. The shortest of them is
the second proof, which I will now reproduce:

The map $\sigma$ is a permutation of $\left[  n\right]  $, thus a bijection
$\left[  n\right]  \rightarrow\left[  n\right]  $. Hence, it has an inverse
map $\sigma^{-1}$. Now, the map%
\begin{align*}
\left\{  i\in\left[  n\right]  \ \mid\ \sigma\left(  i\right)  \geq j\right\}
&  \rightarrow\left\{  i\in\left[  n\right]  \ \mid\ i\geq j\right\}  ,\\
i  &  \mapsto\sigma\left(  i\right)
\end{align*}
is clearly well-defined. Furthermore, this map is a bijection (indeed, its
inverse sends each $i$ to $\sigma^{-1}\left(  i\right)  $). Hence, the
bijection principle yields%
\[
\left\vert \left\{  i\in\left[  n\right]  \ \mid\ \sigma\left(  i\right)  \geq
j\right\}  \right\vert =\left\vert \left\{  i\in\left[  n\right]
\ \mid\ i\geq j\right\}  \right\vert .
\]
In other words,%
\[
\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }%
\sigma\left(  i\right)  \geq j\right)  =\left(  \text{\# of all }i\in\left[
n\right]  \text{ satisfying }i\geq j\right)  .
\]


We have%
\begin{align*}
&  \left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying
}\underbrace{i\geq j>\sigma\left(  i\right)  }_{\Longleftrightarrow\ \left(
i\geq j\text{ but \textbf{not} }\sigma\left(  i\right)  \geq j\right)
}\right) \\
&  =\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j\text{ but \textbf{not} }\sigma\left(  i\right)  \geq j\right) \\
&  =\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j\right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  \text{\# of all }i\in\left[  n\right]  \text{
satisfying }i\geq j\text{ and }\sigma\left(  i\right)  \geq j\right)
\end{align*}
(by the difference rule) and%
\begin{align*}
&  \left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying
}\underbrace{\sigma\left(  i\right)  \geq j>i}_{\Longleftrightarrow\ \left(
\sigma\left(  i\right)  \geq j\text{ but \textbf{not} }i\geq j\right)
}\right) \\
&  =\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }%
\sigma\left(  i\right)  \geq j\text{ but \textbf{not} }i\geq j\right) \\
&  =\underbrace{\left(  \text{\# of all }i\in\left[  n\right]  \text{
satisfying }\sigma\left(  i\right)  \geq j\right)  }_{\substack{=\left(
\text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq j\right)
\\\text{(this has been shown above)}}}\\
&  \ \ \ \ \ \ \ \ \ \ -\left(  \text{\# of all }i\in\left[  n\right]  \text{
satisfying }\underbrace{\sigma\left(  i\right)  \geq j\text{ and }i\geq
j}_{\Longleftrightarrow\ \left(  i\geq j\text{ and }\sigma\left(  i\right)
\geq j\right)  }\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the difference
rule}\right) \\
&  =\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j\right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  \text{\# of all }i\in\left[  n\right]  \text{
satisfying }i\geq j\text{ and }\sigma\left(  i\right)  \geq j\right)  .
\end{align*}
Comparing these two equalities, we obtain%
\[
\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j>\sigma\left(  i\right)  \right)  =\left(  \text{\# of all }i\in\left[
n\right]  \text{ satisfying }\sigma\left(  i\right)  \geq j>i\right)  .
\]
This solves Exercise \ref{exe.enum.lunes-and-perms} \textbf{(b)}.
\end{proof}

Let us illustrate the claim of Exercise \ref{exe.enum.lunes-and-perms}
\textbf{(b)} on an example:

\begin{example}
Let $n=12$ and let $j=6$. Let $\sigma$ be the permutation of $\left[
n\right]  $ that sends $1,2,3,4,5,6,7,8,9,10,11,12$ to
$9,2,6,4,8,10,1,3,7,5,12,11$, respectively. As in Example
\ref{exa.php.endofunc.1} and Example \ref{exa.php.endofunc.2}, we can
represent $\sigma$ by a diagram:%
\[%
%TCIMACRO{\TeXButton{tikz permutation with cycles}{\begin{tikzpicture}%
%[->,shorten >=1pt,auto, thick,main node/.style={circle,fill=blue!20,draw}]
%\node[main node] (1) at (2, 1) {1};
%\node[main node] (3) at (4, 1) {3};
%\node[main node] (2) at (6, 1) {2};
%\node[main node] (5) at (8, 1) {5};
%\node[main node] (4) at (10, 1) {4};
%\node[main node] (7) at (0, -1) {7};
%\node[main node] (9) at (2, -1) {9};
%\node[main node] (6) at (4, -1) {6};
%\node[main node] (10) at (6, -1) {10};
%\node[main node] (8) at (8, -1) {8};
%\node[main node] (12) at (10, -1) {12};
%\node[main node] (11) at (12, -1) {11};
%\draw[-, red] (-1, 0) edge (13, 0);
%\path[-{Stealth[length=4mm]}]
%(1) edge [bend left] (9)
%(9) edge [bend left] (7)
%(7) edge [bend left] (1);
%\path[-{Stealth[length=4mm]}]
%(3) edge [bend right] (6)
%(6) edge [bend right] (10)
%(10) edge (5)
%(5) edge [bend left] (8)
%(8) edge (3);
%\path[-{Stealth[length=4mm]}]
%(2) edge [loop right] (2);
%\path[-{Stealth[length=4mm]}]
%(4) edge [loop right] (4);
%\path[-{Stealth[length=4mm]}]
%(12) edge [bend right] (11)
%(11) edge [bend right] (12);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}%
[->,shorten >=1pt,auto, thick,main node/.style={circle,fill=blue!20,draw}]
\node[main node] (1) at (2, 1) {1};
\node[main node] (3) at (4, 1) {3};
\node[main node] (2) at (6, 1) {2};
\node[main node] (5) at (8, 1) {5};
\node[main node] (4) at (10, 1) {4};
\node[main node] (7) at (0, -1) {7};
\node[main node] (9) at (2, -1) {9};
\node[main node] (6) at (4, -1) {6};
\node[main node] (10) at (6, -1) {10};
\node[main node] (8) at (8, -1) {8};
\node[main node] (12) at (10, -1) {12};
\node[main node] (11) at (12, -1) {11};
\draw[-, red] (-1, 0) edge (13, 0);
\path[-{Stealth[length=4mm]}]
(1) edge [bend left] (9)
(9) edge [bend left] (7)
(7) edge [bend left] (1);
\path[-{Stealth[length=4mm]}]
(3) edge [bend right] (6)
(6) edge [bend right] (10)
(10) edge (5)
(5) edge [bend left] (8)
(8) edge (3);
\path[-{Stealth[length=4mm]}]
(2) edge [loop right] (2);
\path[-{Stealth[length=4mm]}]
(4) edge [loop right] (4);
\path[-{Stealth[length=4mm]}]
(12) edge [bend right] (11)
(11) edge [bend right] (12);
\end{tikzpicture}%
%EndExpansion
\ \ .
\]
Here, we have drawn the $j-1$ nodes $1,2,\ldots,j-1$ above the red line, and
drawn the remaining $n-j+1$ nodes $j,j+1,\ldots,n$ below the red line. Now,%
\[
\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }i\geq
j>\sigma\left(  i\right)  \right)
\]
is the \# of all arrows that cross the red line from bottom to top, whereas%
\[
\left(  \text{\# of all }i\in\left[  n\right]  \text{ satisfying }%
\sigma\left(  i\right)  \geq j>i\right)
\]
is the \# of all arrows that cross the red line from top to bottom. (We assume
that no arrow crosses the red line more than once; this can be achieved, e.g.,
by making all arrows straight.) Hence, Exercise \ref{exe.enum.lunes-and-perms}
\textbf{(b)} says that the \# of arrows crossing the red line from bottom to
top equals the \# of arrows crossing the red line from top to bottom. Stated
in this way, this feels rather intuitive -- particularly if one remembers that
the arrows form several disjoint cycles, and each cycle must enter the top
region as often as it leaves it. It is essentially a manifestation of the
\textquotedblleft what goes in must come out\textquotedblright\ principle.
This thinking can actually be made rigorous, leading to a different solution
to Exercise \ref{exe.enum.lunes-and-perms} \textbf{(b)}. (See \cite[Third
proof of Lemma 0.3]{17f-hw8s} for this solution.)
\end{example}
\end{proof}

\subsection{Homework set \#9 discussion}

The following are discussions of the problems on homework set \#9 (Section
\ref{sect.hw9}).

\subsubsection{Discussion of Exercise \ref{exe.enum.first-even} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.first-even}.]Exercise
\ref{exe.enum.first-even} is \cite[Exercise 1]{18s-mt2s}. For the sake of
completeness, let us copy the solution from \cite{18s-mt2s}. We will first
need an auxiliary concept:

\begin{definition}
Let $n\in\mathbb{N}$ and $d\in\mathbb{N}$. Let $h\in\left[  d\right]  $. An
$n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[  d\right]  ^{n}$
will be called $h$\textit{-even} if the number $h$ occurs in it an even number
of times (i.e., the number of $i\in\left[  n\right]  $ satisfying $x_{i}=h$ is
even). (For example, the $3$-tuple $\left(  1,4,4\right)  $ is $4$-even and
$3$-even but not $1$-even.)
\end{definition}

This definition generalizes the concept of \textquotedblleft$1$%
-even\textquotedblright\ used in Exercise \ref{exe.enum.1-even}. Let us now
state the following generalization of Exercise \ref{exe.enum.1-even}:

\begin{proposition}
\label{prop.count.first-even.k-even}Let $n\in\mathbb{N}$, and let $d$ be a
positive integer. Let $h\in\left[  d\right]  $. Then, the \# of $h$-even
$n$-tuples in $\left[  d\right]  ^{n}$ is $\dfrac{1}{2}\left(  d^{n}+\left(
d-2\right)  ^{n}\right)  $.
\end{proposition}

Indeed, Exercise \ref{exe.enum.1-even} is the particular case of Proposition
\ref{prop.count.first-even.k-even} for $h=1$; but conversely, Proposition
\ref{prop.count.first-even.k-even} can be derived from Exercise
\ref{exe.enum.1-even} by \textquotedblleft renaming $1$ as $h$%
\textquotedblright.

\begin{fineprint}
Here is a rigorous way to make this \textquotedblleft
renaming\textquotedblright\ argument:

\begin{proof}
[Proof of Proposition \ref{prop.count.first-even.k-even} (sketched).]There is
clearly some permutation $\sigma$ of $\left[  d\right]  $ such that
$\sigma\left(  1\right)  =h$. (For example, we can let $\sigma$ be the
transposition swapping $1$ with $h$ when $h\neq1$, and otherwise we can just
set $\sigma=\operatorname*{id}$.) Fix such a $\sigma$. It is easy to see that
the map%
\begin{align*}
\left[  d\right]  ^{n}  &  \rightarrow\left[  d\right]  ^{n},\\
\left(  x_{1},x_{2},\ldots,x_{n}\right)   &  \mapsto\left(  \sigma\left(
x_{1}\right)  ,\sigma\left(  x_{2}\right)  ,\ldots,\sigma\left(  x_{n}\right)
\right)
\end{align*}
(that is, the map that applies $\sigma$ to each entry of an $n$-tuple in
$\left[  d\right]  ^{n}$) is a bijection (since $\sigma$ is a bijection).
Furthermore, an $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  \in\left[
d\right]  ^{n}$ is $1$-even if and only if its image $\left(  \sigma\left(
x_{1}\right)  ,\sigma\left(  x_{2}\right)  ,\ldots,\sigma\left(  x_{n}\right)
\right)  $ under this bijection is $h$-even (because the number $1$ occurs in
the $n$-tuple $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ at the same
positions at which the number $\sigma\left(  1\right)  =h$ occurs in the
$n$-tuple $\left(  \sigma\left(  x_{1}\right)  ,\sigma\left(  x_{2}\right)
,\ldots,\sigma\left(  x_{n}\right)  \right)  $). Thus, there is a bijection%
\begin{align*}
\left\{  1\text{-even }n\text{-tuples in }\left[  d\right]  ^{n}\right\}   &
\rightarrow\left\{  h\text{-even }n\text{-tuples in }\left[  d\right]
^{n}\right\}  ,\\
\left(  x_{1},x_{2},\ldots,x_{n}\right)   &  \mapsto\left(  \sigma\left(
x_{1}\right)  ,\sigma\left(  x_{2}\right)  ,\ldots,\sigma\left(  x_{n}\right)
\right)  .
\end{align*}
Hence, we can use the bijection principle to see that%
\begin{align*}
\left\vert \left\{  h\text{-even }n\text{-tuples in }\left[  d\right]
^{n}\right\}  \right\vert  &  =\left\vert \left\{  1\text{-even }%
n\text{-tuples in }\left[  d\right]  ^{n}\right\}  \right\vert \\
&  =\left(  \text{\# of }1\text{-even }n\text{-tuples in }\left[  d\right]
^{n}\right) \\
&  =\dfrac{1}{2}\left(  d^{n}+\left(  d-2\right)  ^{n}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by our solution to Exercise
\ref{exe.enum.1-even}}\right)  .
\end{align*}
In other words, the \# of $h$-even $n$-tuples in $\left[  d\right]  ^{n}$ is
$\dfrac{1}{2}\left(  d^{n}+\left(  d-2\right)  ^{n}\right)  $. This proves
Proposition \ref{prop.count.first-even.k-even}.

(Alternatively, of course, Proposition \ref{prop.count.first-even.k-even} can
be proved in the same way as we solved Exercise \ref{exe.enum.1-even}, just
with all \textquotedblleft$1$\textquotedblright s in the appropriate places
replaced by \textquotedblleft$h$\textquotedblright s.)
\end{proof}
\end{fineprint}

\begin{proof}
[Solution to Exercise \ref{exe.enum.first-even} (sketched).]We first make the
following claim:

\begin{statement}
\textit{Observation 1:} Let $h\in\left[  d\right]  $. Then, the \# of $\left(
n-1\right)  $-tuples in $\left[  d\right]  ^{n-1}$ that are \textbf{not}
$h$-even is $\dfrac{1}{2}\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)  $.
\end{statement}

[\textit{Proof of Observation 1:} Proposition
\ref{prop.count.first-even.k-even} (applied to $n-1$ instead of $n$) shows
that the \# of $h$-even $\left(  n-1\right)  $-tuples in $\left[  d\right]
^{n-1}$ is $\dfrac{1}{2}\left(  d^{n-1}+\left(  d-2\right)  ^{n-1}\right)  $.
In other words,%
\[
\left(  \text{\# of }h\text{-even }\left(  n-1\right)  \text{-tuples in
}\left[  d\right]  ^{n-1}\right)  =\dfrac{1}{2}\left(  d^{n-1}+\left(
d-2\right)  ^{n-1}\right)  .
\]


Now, the difference rule yields%
\begin{align*}
&  \left(  \text{\# of }\left(  n-1\right)  \text{-tuples in }\left[
d\right]  ^{n-1}\text{ that are \textbf{not} }h\text{-even}\right) \\
&  =\underbrace{\left(  \text{\# of all }\left(  n-1\right)  \text{-tuples in
}\left[  d\right]  ^{n-1}\right)  }_{=d^{n-1}}-\underbrace{\left(  \text{\# of
}h\text{-even }\left(  n-1\right)  \text{-tuples in }\left[  d\right]
^{n-1}\right)  }_{=\dfrac{1}{2}\left(  d^{n-1}+\left(  d-2\right)
^{n-1}\right)  }\\
&  =d^{n-1}-\dfrac{1}{2}\left(  d^{n-1}+\left(  d-2\right)  ^{n-1}\right)
=\dfrac{1}{2}\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)  .
\end{align*}
In other words, the \# of $\left(  n-1\right)  $-tuples in $\left[  d\right]
^{n-1}$ that are \textbf{not} $h$-even is $\dfrac{1}{2}\left(  d^{n-1}-\left(
d-2\right)  ^{n-1}\right)  $. This proves Observation 1.]

We can construct each first-even $n$-tuple $\left(  x_{1},x_{2},\ldots
,x_{n}\right)  $ in $\left[  d\right]  ^{n}$ as follows:

\begin{itemize}
\item First, we choose the value of $x_{1}$. We denote this value by $h$.
There are $d$ options for this decision (since this value must belong to
$\left[  d\right]  $).

\item Next, we choose the $\left(  n-1\right)  $-tuple $\left(  x_{2}%
,x_{3},\ldots,x_{n}\right)  $. Note that the entry $h=x_{1}$ must occur an
\textbf{odd} number of times in this $\left(  n-1\right)  $-tuple $\left(
x_{2},x_{3},\ldots,x_{n}\right)  $ (because we want the $n$-tuple $\left(
x_{1},x_{2},\ldots,x_{n}\right)  $ to be first-even, so that $x_{1}$ must
occur an \textbf{even} number of times in this $n$-tuple; but the $\left(
n-1\right)  $-tuple $\left(  x_{2},x_{3},\ldots,x_{n}\right)  $ is missing its
very first occurrence, and thus must contain it an \textbf{odd} number of
times). In other words, the $\left(  n-1\right)  $-tuple $\left(  x_{2}%
,x_{3},\ldots,x_{n-1}\right)  $ must \textbf{not} be $h$-even. Thus, there are
$\dfrac{1}{2}\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)  $ options for
this decision (since Observation 1 yields that the number of $\left(
n-1\right)  $-tuples in $\left[  d\right]  ^{n-1}$ that are \textbf{not}
$h$-even is $\dfrac{1}{2}\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)  $).
\end{itemize}

Hence, the dependent product rule shows that the total \# of first-even
$n$-tuples $\left(  x_{1},x_{2},\ldots,x_{n}\right)  $ in $\left[  d\right]
^{n}$ is
\[
d\cdot\dfrac{1}{2}\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)
=\dfrac{1}{2}d\left(  d^{n-1}-\left(  d-2\right)  ^{n-1}\right)  .
\]
This solves Exercise \ref{exe.enum.first-even}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.2n-2kchoosen+p} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.2n-2kchoosen+p}.]Exercise
\ref{exe.enum.2n-2kchoosen+p} is a generalization of
\url{https://math.stackexchange.com/questions/897948} (which is the particular
case for $p=1$). Let me sketch a combinatorial and two algebraic solutions:

\begin{proof}
[First solution to Exercise \ref{exe.enum.2n-2kchoosen+p} (sketched).]Let $S$
be the $2n$-element set $\left\{  -1,-2,\ldots,-n\right\}  \cup\left\{
1,2,\ldots,n\right\}  $. Let $U$ be the set of all $\left(  n+p\right)
$-element subsets of $S$. For each $i\in\left[  n\right]  $, we let $A_{i}$ be
the set of all $J\in U$ that contain neither $i$ nor $-i$ (that is, that
satisfy $i\notin J$ and $-i\notin J$). The Principle of Inclusion and
Exclusion (specifically, Theorem \ref{thm.enum.pie.b.props}) shows that
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right)  . \label{sol.enum.2n-2kchoosen+p.1st.pie}%
\end{align}


Now, let us compute both the left and the right hand side of this equality,
and see what it then turns into.

The left hand side is an easy counting problem: We have%
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  =\left(  \text{\# of }J\in U\text{ satisfying }J\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed
the index }x\text{ as }J\right) \nonumber\\
&  =\left(  \text{\# of }J\in U\text{ such that each }i\in\left[  n\right]
\text{ satisfies either }i\in J\text{ or }-i\in J\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
}A_{i}\right) \nonumber\\
&  =\dbinom{n}{p}\cdot2^{n-p}. \label{sol.enum.2n-2kchoosen+p.1st.L}%
\end{align}
Indeed, the last equality sign here follows from the dependent product rule,
since the following decision procedure can be used to construct a set $J\in U$
such that each $i\in\left[  n\right]  $ satisfies either $i\in J$ or $-i\in J$:

\begin{itemize}
\item We choose the $p$ elements $i\in\left[  n\right]  $ for which $J$ will
contain \textbf{both} $i$ and $-i$. (Make sure you understand why there should
be exactly $p$ such elements!) There are $\dbinom{n}{p}$ options for this decision.

\item For each of the remaining $n-p$ elements $i\in\left[  n\right]  $, we
decide whether $J$ will contain $i$ or $-i$. (Indeed, $J$ will have to contain
exactly one of $i$ and $-i$ for each of these $i$.) These are $n-p$ decisions,
and each of them allows for $2$ options; thus, we have $2^{n-p}$ options here
in total.
\end{itemize}

The right hand side of (\ref{sol.enum.2n-2kchoosen+p.1st.pie}) is even easier
to compute: If $I$ is any subset of $\left[  n\right]  $, then%
\begin{align}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{ for all
}i\in I\right) \nonumber\\
&  =\left(  \text{\# of }J\in U\text{ satisfying }J\in A_{i}\text{ for all
}i\in I\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have renamed
the index }x\text{ as }J\right) \nonumber\\
&  =\left(  \text{\# of }J\in U\text{ such that each }i\in\left[  n\right]
\text{ satisfies neither }i\in J\text{ nor }-i\in J\right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of
}A_{i}\right) \nonumber\\
&  =\left(  \text{\# of }\left(  n+p\right)  \text{-element subsets }J\text{
of }S\setminus\left(  \pm I\right)  \right) \nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{where }\pm I\text{
denotes the set }I\cup\left\{  -i\ \mid\ i\in I\right\}  \right) \nonumber\\
&  =\dbinom{2n-2\left\vert I\right\vert }{n+p}
\label{sol.enum.2n-2kchoosen+p.1st.R}%
\end{align}
(since $\left\vert S\setminus\left(  \pm I\right)  \right\vert
=\underbrace{\left\vert S\right\vert }_{=2n}-\underbrace{\left\vert \pm
I\right\vert }_{=2\left\vert I\right\vert }=2n-2\left\vert I\right\vert $).
Hence,%
\begin{align}
&  \sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\underbrace{\left(  \text{\# of }x\in U\text{ satisfying }x\in
A_{i}\text{ for all }i\in I\right)  }_{\substack{=\dbinom{2n-2\left\vert
I\right\vert }{n+p}\\\text{(by (\ref{sol.enum.2n-2kchoosen+p.1st.R}))}%
}}\nonumber\\
&  =\underbrace{\sum_{I\subseteq\left[  n\right]  }}_{=\sum_{k=0}^{n}%
\ \ \sum_{\substack{I\subseteq\left[  n\right]  ;\\\left\vert I\right\vert
=k}}}\left(  -1\right)  ^{\left\vert I\right\vert }\dbinom{2n-2\left\vert
I\right\vert }{n+p}=\sum_{k=0}^{n}\ \ \underbrace{\sum_{\substack{I\subseteq
\left[  n\right]  ;\\\left\vert I\right\vert =k}}\left(  -1\right)
^{\left\vert I\right\vert }\dbinom{2n-2\left\vert I\right\vert }{n+p}%
}_{=\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}}\nonumber\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}.
\label{sol.enum.2n-2kchoosen+p.1st.R2}%
\end{align}
Hence, (\ref{sol.enum.2n-2kchoosen+p.1st.pie}) becomes%
\begin{align*}
&  \left(  \text{\# of }x\in U\text{ satisfying }x\notin A_{i}\text{ for all
}i\in\left[  n\right]  \right) \\
&  =\sum_{I\subseteq\left[  n\right]  }\left(  -1\right)  ^{\left\vert
I\right\vert }\left(  \text{\# of }x\in U\text{ satisfying }x\in A_{i}\text{
for all }i\in I\right) \\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}%
{n+p}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.enum.2n-2kchoosen+p.1st.R2})}\right)  .
\end{align*}
Comparing this with (\ref{sol.enum.2n-2kchoosen+p.1st.L}), we obtain%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}%
=\dbinom{n}{p}\cdot2^{n-p}=2^{n-p}\dbinom{n}{p}.
\]
This solves Exercise \ref{exe.enum.2n-2kchoosen+p}.
\end{proof}

Our second solution to Exercise \ref{exe.enum.2n-2kchoosen+p} is algebraic; it
uses induction on $n$. The main ingredient is the following simple lemma
(which is generally quite useful for recursively simplifying sums of the form
$\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}a_{k}$):

\begin{lemma}
\label{lem.binom.findiff.manual-step}Let $n$ be a positive integer. Let
$a_{0},a_{1},\ldots,a_{n}$ be any $n+1$ numbers. Then,%
\[
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}a_{k}=\sum_{k=0}%
^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}\left(  a_{k}-a_{k+1}\right)  .
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom.findiff.manual-step}.]We have%
\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 Theorem
\ref{thm.binom.rec})}}}a_{k}\nonumber\\
&  =\sum_{k=0}^{n}\underbrace{\left(  -1\right)  ^{k}\left(  \dbinom{n-1}%
{k-1}+\dbinom{n-1}{k}\right)  a_{k}}_{=\left(  -1\right)  ^{k}\dbinom
{n-1}{k-1}a_{k}+\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}}\nonumber\\
&  =\sum_{k=0}^{n}\left(  \left(  -1\right)  ^{k}\dbinom{n-1}{k-1}%
a_{k}+\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}\right) \nonumber\\
&  =\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}+\sum_{k=0}%
^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}.
\label{pf.lem.binom.findiff.manual-step.1}%
\end{align}


Now, $0-1=-1\notin\mathbb{N}$ and thus $\dbinom{n-1}{0-1}=0$ (by an
application of (\ref{eq.def.binom.def.b})). Now,%
\begin{align}
&  \sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}\nonumber\\
&  =\left(  -1\right)  ^{0}\underbrace{\dbinom{n-1}{0-1}}_{=0}a_{0}+\sum
_{k=1}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split off the addend for
}k=0\text{ from the sum}\right) \nonumber\\
&  =\underbrace{\left(  -1\right)  ^{0}0a_{0}}_{=0}+\sum_{k=1}^{n}\left(
-1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}\nonumber\\
&  =\sum_{k=1}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}=\sum
_{k=0}^{n-1}\underbrace{\left(  -1\right)  ^{k+1}}_{=-\left(  -1\right)  ^{k}%
}\underbrace{\dbinom{n-1}{\left(  k+1\right)  -1}}_{=\dbinom{n-1}{k}}%
a_{k+1}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k+1\text{ for
}k\text{ in the sum}\right) \nonumber\\
&  =\sum_{k=0}^{n-1}\left(  -\left(  -1\right)  ^{k}\right)  \dbinom{n-1}%
{k}a_{k+1}=-\sum_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k+1}.
\label{pf.lem.binom.findiff.manual-step.2}%
\end{align}


Also, $n\geq1$ (since $n$ is a positive integer), so that $n-1\in\mathbb{N}$.
Hence, Proposition \ref{prop.binom.0} (applied to $n-1$ and $n$ instead of $n$
and $k$) yields $\dbinom{n-1}{n}=0$ (since $n>n-1$). Now,%
\begin{align}
&  \sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}\nonumber\\
&  =\left(  -1\right)  ^{n}\underbrace{\dbinom{n-1}{n}}_{=0}a_{n}+\sum
_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split off the addend for
}k=n\text{ from the sum}\right) \nonumber\\
&  =\underbrace{\left(  -1\right)  ^{n}0a_{n}}_{=0}+\sum_{k=0}^{n-1}\left(
-1\right)  ^{k}\dbinom{n-1}{k}a_{k}\nonumber\\
&  =\sum_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}.
\label{pf.lem.binom.findiff.manual-step.3}%
\end{align}


Now, (\ref{pf.lem.binom.findiff.manual-step.1}) becomes%
\begin{align*}
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}a_{k}  &  =\underbrace{\sum
_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k-1}a_{k}}_{\substack{=-\sum
_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k+1}\\\text{(by
(\ref{pf.lem.binom.findiff.manual-step.2}))}}}+\underbrace{\sum_{k=0}%
^{n}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}}_{\substack{=\sum_{k=0}%
^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}\\\text{(by
(\ref{pf.lem.binom.findiff.manual-step.3}))}}}\\
&  =-\sum_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k+1}+\sum
_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}\\
&  =\sum_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k}-\sum
_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k+1}\\
&  =\sum_{k=0}^{n-1}\underbrace{\left(  \left(  -1\right)  ^{k}\dbinom{n-1}%
{k}a_{k}-\left(  -1\right)  ^{k}\dbinom{n-1}{k}a_{k+1}\right)  }_{=\left(
-1\right)  ^{k}\dbinom{n-1}{k}\left(  a_{k}-a_{k+1}\right)  }\\
&  =\sum_{k=0}^{n-1}\left(  -1\right)  ^{k}\dbinom{n-1}{k}\left(
a_{k}-a_{k+1}\right)  .
\end{align*}
This proves Lemma \ref{lem.binom.findiff.manual-step}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.enum.2n-2kchoosen+p}.]Forget that we
fixed $n$ and $p$. We proceed by induction on $n$:

\textit{Induction base:} It is straightforward to see that each $p\in
\mathbb{Z}$ satisfies%
\begin{equation}
\dbinom{0}{p}=2^{0-p}\dbinom{0}{p}. \label{sol.enum.2n-2kchoosen+p.2nd.IB.1}%
\end{equation}
\footnote{\textit{Proof of (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}):} Let
$p\in\mathbb{Z}$. We are in one of the following three cases:
\par
\textit{Case 1:} We have $p=0$.
\par
\textit{Case 2:} We have $p>0$.
\par
\textit{Case 3:} We have $p<0$.
\par
Let us first consider Case 1. In this case, we have $p=0$. Thus,
$2^{0-p}=2^{0-0}=2^{0}=1$, so that $\underbrace{2^{0-p}}_{=1}\dbinom{0}%
{p}=\dbinom{0}{p}$. Thus, (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) holds.
Hence, we have proved (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) in Case 1.
\par
Let us now consider Case 2. In this case, we have $p>0$. Thus, Proposition
\ref{prop.binom.0} (applied to $0$ and $p$ instead of $n$ and $k$) yields that
$\dbinom{0}{p}=0$. Comparing this with $2^{0-p}\underbrace{\dbinom{0}{p}}%
_{=0}=0$, we obtain $\dbinom{0}{p}=2^{0-p}\dbinom{0}{p}$. Hence, we have
proved (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) in Case 2.
\par
Finally, let us consider Case 3. In this case, we have $p<0$. Thus,
$p\notin\mathbb{N}$, so that $\dbinom{0}{p}=0$ (by an application of
(\ref{eq.def.binom.def.b})). Comparing this with $2^{0-p}\underbrace{\dbinom
{0}{p}}_{=0}=0$, we obtain $\dbinom{0}{p}=2^{0-p}\dbinom{0}{p}$. Hence, we
have proved (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) in Case 3.
\par
We have now proved (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) in all three Cases
1, 2 and 3. Thus, (\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1}) always holds.}
Hence, it is easy to see that Exercise \ref{exe.enum.2n-2kchoosen+p} holds for
$n=0$\ \ \ \ \footnote{\textit{Proof.} For each $p\in\mathbb{Z}$, we have%
\begin{align*}
\sum_{k=0}^{0}\left(  -1\right)  ^{k}\dbinom{0}{k}\dbinom{2\cdot0-2k}{0+p}  &
=\underbrace{\left(  -1\right)  ^{0}}_{=1}\underbrace{\dbinom{0}{0}}%
_{=1}\underbrace{\dbinom{2\cdot0-2\cdot0}{0+p}}_{\substack{=\dbinom{0}%
{p}\\\text{(since }2\cdot0-2\cdot0=0\text{ and }0+p=p\text{)}}}\\
&  =\dbinom{0}{p}=2^{0-p}\dbinom{0}{p}\ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.enum.2n-2kchoosen+p.2nd.IB.1})}\right)  .
\end{align*}
In other words, Exercise \ref{exe.enum.2n-2kchoosen+p} holds for $n=0$.}.

\textit{Induction step:} Let $m$ be a positive integer. Assume (as the
induction hypothesis) that Exercise \ref{exe.enum.2n-2kchoosen+p} holds for
$n=m-1$. We must prove that Exercise \ref{exe.enum.2n-2kchoosen+p} holds for
$n=m$.

We have assumed that Exercise \ref{exe.enum.2n-2kchoosen+p} holds for $n=m-1$.
In other words, each $p\in\mathbb{Z}$ satisfies%
\begin{equation}
\sum_{k=0}^{m-1}\left(  -1\right)  ^{k}\dbinom{m-1}{k}\dbinom{2\left(
m-1\right)  -2k}{m-1+p}=2^{m-1-p}\dbinom{m-1}{p}.
\label{sol.enum.2n-2kchoosen+p.2nd.IH}%
\end{equation}


Now, let $p\in\mathbb{Z}$. Then, Lemma \ref{lem.binom.findiff.manual-step}
(applied to $n=m$ and $a_{k}=\dbinom{2m-2k}{m+p}$) yields%
\begin{align}
&  \sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{m}{k}\dbinom{2m-2k}%
{m+p}\nonumber\\
&  =\sum_{k=0}^{m-1}\left(  -1\right)  ^{k}\dbinom{m-1}{k}\left(
\dbinom{2m-2k}{m+p}-\dbinom{2m-2\left(  k+1\right)  }{m+p}\right)  .
\label{sol.enum.2n-2kchoosen+p.2nd.2}%
\end{align}


We shall now simplify the difference $\dbinom{2m-2k}{m+p}-\dbinom{2m-2\left(
k+1\right)  }{m+p}$ on the right side of this equality.

Indeed, it is easy to see that every $n\in\mathbb{R}$ and $i\in\mathbb{R}$
satisfy%
\begin{equation}
\dbinom{n}{i}-\dbinom{n-2}{i}=\dbinom{n-2}{i-2}+2\dbinom{n-2}{i-1}
\label{sol.enum.2n-2kchoosen+p.2nd.rec2}%
\end{equation}
\footnote{\textit{Proof of (\ref{sol.enum.2n-2kchoosen+p.2nd.rec2}):} Let
$n\in\mathbb{R}$ and $i\in\mathbb{R}$. Then, Theorem \ref{thm.binom.rec}
(applied to $k=i$) yields%
\begin{align*}
\dbinom{n}{i}  &  =\underbrace{\dbinom{n-1}{i-1}}_{\substack{=\dbinom
{n-1-1}{i-1-1}+\dbinom{n-1-1}{i-1}\\\text{(by Theorem \ref{thm.binom.rec}%
,}\\\text{applied to }n-1\text{ and }i-1\\\text{instead of }n\text{ and
}k\text{)}}}+\underbrace{\dbinom{n-1}{i}}_{\substack{=\dbinom{n-1-1}%
{i-1}+\dbinom{n-1-1}{i}\\\text{(by Theorem \ref{thm.binom.rec},}%
\\\text{applied to }n-1\text{ and }i\\\text{instead of }n\text{ and }%
k\text{)}}}\\
&  =\dbinom{n-1-1}{i-1-1}+\dbinom{n-1-1}{i-1}+\dbinom{n-1-1}{i-1}%
+\dbinom{n-1-1}{i}\\
&  =\dbinom{n-1-1}{i-1-1}+2\dbinom{n-1-1}{i-1}+\dbinom{n-1-1}{i}\\
&  =\dbinom{n-2}{i-2}+2\dbinom{n-2}{i-1}+\dbinom{n-2}{i}%
\end{align*}
(since $n-1-1=n-2$ and $i-1-1=i-2$). Subtracting $\dbinom{n-2}{i}$ from both
sides of this equality, we obtain%
\[
\dbinom{n}{i}-\dbinom{n-2}{i}=\dbinom{n-2}{i-2}+2\dbinom{n-2}{i-1}.
\]
Thus, (\ref{sol.enum.2n-2kchoosen+p.2nd.rec2}) is proven.}.

Now, for each $k\in\mathbb{Z}$, we have%
\begin{align}
&  \dbinom{2m-2k}{m+p}-\dbinom{2m-2\left(  k+1\right)  }{m+p}\nonumber\\
&  =\dbinom{2m-2k}{m+p}-\dbinom{2m-2k-2}{m+p}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }2m-2\left(  k+1\right)  =2m-2k-2\right) \nonumber\\
&  =\dbinom{2m-2k-2}{m+p-2}+2\dbinom{2m-2k-2}{m+p-1}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{by
(\ref{sol.enum.2n-2kchoosen+p.2nd.rec2}) (applied to }n=2m-2k\text{ and
}i=m+p\text{)}\right) \nonumber\\
&  =\dbinom{2\left(  m-1\right)  -2k}{\left(  m-1\right)  +\left(  p-1\right)
}+2\dbinom{2\left(  m-2\right)  -2k}{\left(  m-1\right)  +p}.
\label{sol.enum.2n-2kchoosen+p.2nd.diff}%
\end{align}
(since $m+p-2=\left(  m-1\right)  +\left(  p-1\right)  $ and $m+p-1=\left(
m-1\right)  +p$ and $2m-2k-2=2\left(  m-1\right)  -2k$). Hence,
(\ref{sol.enum.2n-2kchoosen+p.2nd.2}) becomes%
\begin{align*}
&  \sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{m}{k}\dbinom{2m-2k}{m+p}\\
&  =\sum_{k=0}^{m-1}\left(  -1\right)  ^{k}\dbinom{m-1}{k}\underbrace{\left(
\dbinom{2m-2k}{m+p}-\dbinom{2m-2\left(  k+1\right)  }{m+p}\right)
}_{\substack{=\dbinom{2\left(  m-1\right)  -2k}{\left(  m-1\right)  +\left(
p-1\right)  }+2\dbinom{2\left(  m-2\right)  -2k}{\left(  m-1\right)
+p}\\\text{(by (\ref{sol.enum.2n-2kchoosen+p.2nd.diff}))}}}\\
&  =\sum_{k=0}^{m-1}\underbrace{\left(  -1\right)  ^{k}\dbinom{m-1}{k}\left(
\dbinom{2\left(  m-1\right)  -2k}{\left(  m-1\right)  +\left(  p-1\right)
}+2\dbinom{2\left(  m-2\right)  -2k}{\left(  m-1\right)  +p}\right)
}_{=\left(  -1\right)  ^{k}\dbinom{m-1}{k}\dbinom{2\left(  m-1\right)
-2k}{\left(  m-1\right)  +\left(  p-1\right)  }+2\cdot\left(  -1\right)
^{k}\dbinom{m-1}{k}\dbinom{2\left(  m-2\right)  -2k}{\left(  m-1\right)  +p}%
}\\
&  =\sum_{k=0}^{m-1}\left(  \left(  -1\right)  ^{k}\dbinom{m-1}{k}%
\dbinom{2\left(  m-1\right)  -2k}{\left(  m-1\right)  +\left(  p-1\right)
}+2\cdot\left(  -1\right)  ^{k}\dbinom{m-1}{k}\dbinom{2\left(  m-2\right)
-2k}{\left(  m-1\right)  +p}\right) \\
&  =\underbrace{\sum_{k=0}^{m-1}\left(  -1\right)  ^{k}\dbinom{m-1}{k}%
\dbinom{2\left(  m-1\right)  -2k}{\left(  m-1\right)  +\left(  p-1\right)  }%
}_{\substack{=2^{m-1-\left(  p-1\right)  }\dbinom{m-1}{p-1}\\\text{(by
(\ref{sol.enum.2n-2kchoosen+p.2nd.IH}), applied to }p-1\text{ instead of
}p\text{)}}}\\
&  \ \ \ \ \ \ \ \ \ \ +2\cdot\underbrace{\sum_{k=0}^{m-1}\left(  -1\right)
^{k}\dbinom{m-1}{k}\dbinom{2\left(  m-2\right)  -2k}{\left(  m-1\right)  +p}%
}_{\substack{=2^{m-1-p}\dbinom{m-1}{p}\\\text{(by
(\ref{sol.enum.2n-2kchoosen+p.2nd.IH}))}}}\\
&  =\underbrace{2^{m-1-\left(  p-1\right)  }}_{\substack{=2^{m-p}%
\\\text{(since }m-1-\left(  p-1\right)  =m-p\text{)}}}\dbinom{m-1}%
{p-1}+\underbrace{2\cdot2^{m-1-p}}_{\substack{=2^{\left(  m-1-p\right)
+1}=2^{m-p}\\\text{(since }\left(  m-1-p\right)  +1=m-p\text{)}}}\dbinom
{m-1}{p}\\
&  =2^{m-p}\dbinom{m-1}{p-1}+2^{m-p}\dbinom{m-1}{p}=2^{m-p}\left(
\dbinom{m-1}{p-1}+\dbinom{m-1}{p}\right)  .
\end{align*}
Comparing this with%
\[
2^{m-p}\underbrace{\dbinom{m}{p}}_{\substack{=\dbinom{m-1}{p-1}+\dbinom
{m-1}{p}\\\text{(by Theorem \ref{thm.binom.rec},}\\\text{applied to }n=m\text{
and }k=p\text{)}}}=2^{m-p}\left(  \dbinom{m-1}{p-1}+\dbinom{m-1}{p}\right)  ,
\]
we obtain%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{m}{k}\dbinom{2m-2k}{m+p}%
=2^{m-p}\dbinom{m}{p}.
\]


Forget that we fixed $p$. We thus have shown that every $p\in\mathbb{Z}$
satisfies%
\[
\sum_{k=0}^{m}\left(  -1\right)  ^{k}\dbinom{m}{k}\dbinom{2m-2k}{m+p}%
=2^{m-p}\dbinom{m}{p}.
\]
In other words, Exercise \ref{exe.enum.2n-2kchoosen+p} holds for $n=m$. This
completes the induction step. Thus, Exercise \ref{exe.enum.2n-2kchoosen+p} is
solved again.
\end{proof}

Our third solution to Exercise \ref{exe.enum.2n-2kchoosen+p} is algebraic as
well, but unlike our rather down-to-earth second solution above, it relies on
several binomial identities (while avoiding the use of induction). The first
one is the following identity (\cite[\S 6.6, Theorem 6.13]{19fco-hw3s}):

\begin{lemma}
\label{lem.binom.dividiff-x-iCq}Let $p\in\mathbb{N}$ and $q\in\mathbb{R}$.
Then,
\[
\sum_{i=0}^{p}\left(  -1\right)  ^{i}\dbinom{p}{i}\dbinom{x-i}{q}=\dbinom
{x-p}{q-p}\ \ \ \ \ \ \ \ \ \ \text{for all $x\in\mathbb{R}$.}%
\]

\end{lemma}

\begin{proof}
[References to the proof of Lemma \ref{lem.binom.dividiff-x-iCq}.]Lemma
\ref{lem.binom.dividiff-x-iCq} is proved in \cite[\S 6.6, Theorem
6.13]{19fco-hw3s}. (The proof proceeds by first reducing it to the case
$q\in\mathbb{N}$, which constitutes \cite[Exercise 6]{19fco-hw3s}, and then
solving the latter exercise in four different ways. The fourth solution is
particularly of note, as it involves finite differences of integer sequences,
which are a variation on the finite differences of polynomials we have seen in
Example \ref{exe.findiff.poly1}. It can easily be rewritten in terms of the latter.)
\end{proof}

Our next binomial identity is a mashup of Corollary \ref{cor.binom.2pown} with
the trinomial revision formula:

\begin{lemma}
\label{lem.binom.2pown-p}Let $n\in\mathbb{N}$ and $p\in\mathbb{Z}$. Then,%
\[
\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{k}{p}=2^{n-p}\dbinom{n}{p}.
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom.2pown-p}.]We are in one of the following three cases:

\textit{Case 1:} We have $p<0$.

\textit{Case 2:} We have $p>n$.

\textit{Case 3:} We have neither $p<0$ nor $p>n$.

Let us first consider Case 1. In this case, we have $p<0$. Thus,
$p\notin\mathbb{N}$. Hence, (\ref{eq.def.binom.def.b}) (applied to $k=p$)
yields $\dbinom{n}{p}=0$. Hence, $2^{n-p}\underbrace{\dbinom{n}{p}}_{=0}=0$.
Comparing this with
\[
\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{\dbinom{k}{p}}_{\substack{=0\\\text{(by
(\ref{eq.def.binom.def.b}),}\\\text{since }p\notin\mathbb{N}\text{)}}%
}=\sum_{k=0}^{n}\dbinom{n}{k}0=0,
\]
we obtain $\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{k}{p}=2^{n-p}\dbinom{n}{p}$.
Thus, Lemma \ref{lem.binom.2pown-p} is proved in Case 1.

Let us next consider Case 2. In this case, we have $p>n$. Hence, $\dbinom
{n}{p}=0$ (by Proposition \ref{prop.binom.0}, applied to $k=p$).

Let $k\in\left\{  0,1,\ldots,n\right\}  $. Then, $k\leq n<p$ (since $p>n$),
thus $p>k$. Hence, Proposition \ref{prop.binom.0} (applied to $k$ and $p$
instead of $n$ and $k$) yields $\dbinom{k}{p}=0$. Hence, $\dbinom{n}%
{k}\underbrace{\dbinom{k}{p}}_{=0}=0$.

Forget that we fixed $k$. We thus have proved the equality $\dbinom{n}%
{k}\dbinom{k}{p}=0$ for each $k\in\left\{  0,1,\ldots,n\right\}  $. Summing
these equalities over all $k\in\left\{  0,1,\ldots,n\right\}  $, we obtain
$\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{k}{p}=\sum_{k=0}^{n}0=0$. Comparing this
with $2^{n-p}\underbrace{\dbinom{n}{p}}_{=0}=0$, we obtain $\sum_{k=0}%
^{n}\dbinom{n}{k}\dbinom{k}{p}=2^{n-p}\dbinom{n}{p}$. Thus, Lemma
\ref{lem.binom.2pown-p} is proved in Case 2.

Let us finally consider Case 3. In this case, we have neither $p<0$ nor $p>n$.
Hence, we have $p\geq0$ (since we don't have $p<0$) and $p\leq n$ (since we
don't have $p>n$). From $p\leq n$, we obtain $n\geq p$, and thus
$n-p\in\mathbb{N}$. Also, from $p\geq0$, we obtain $-p\leq0\leq n-p$ (since
$n-p\in\mathbb{N}$) and $p\in\mathbb{N}$. Now,
\begin{align}
\sum_{k=0}^{n}\underbrace{\dbinom{n}{k}\dbinom{k}{p}}_{\substack{=\dbinom
{n}{p}\dbinom{n-p}{k-p}\\\text{(by Proposition \ref{prop.binom.trin-revNN}%
}\\\text{(applied to }a=k\text{ and }b=p\text{))}}}  &  =\sum_{k=0}^{n}%
\dbinom{n}{p}\dbinom{n-p}{k-p}\nonumber\\
&  =\dbinom{n}{p}\sum_{k=0}^{n}\dbinom{n-p}{k-p}.
\label{pf.lem.binom.2pown-p.c3.2}%
\end{align}


However, each $k\in\left\{  -p,-p+1,\ldots,-1\right\}  $ satisfies
$k\notin\mathbb{N}$ (since $k\leq-1<0$) and thus
\begin{equation}
\dbinom{n-p}{k}=0 \label{pf.lem.binom.2pown-p.c3.3}%
\end{equation}
(by (\ref{eq.def.binom.def.b})). Now,%
\begin{align*}
\sum_{k=0}^{n}\dbinom{n-p}{k-p}  &  =\sum_{k=-p}^{n-p}\dbinom{n-p}%
{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have substituted }k\text{ for
}k-p\text{ in the sum}\right) \\
&  =\sum_{k=-p}^{-1}\underbrace{\dbinom{n-p}{k}}_{\substack{=0\\\text{(by
(\ref{eq.def.binom.def.b})}\\\text{(since }k\notin\mathbb{N}\text{))}%
}}+\underbrace{\sum_{k=0}^{n-p}\dbinom{n-p}{k}}_{\substack{=2^{n-p}\\\text{(by
Corollary \ref{cor.binom.2pown}}\\\text{(applied to }n-p\text{ instead of
}n\text{))}}}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split the sum at }k=0\text{
(since }-p\leq0\leq n-p\text{)}\right) \\
&  =\underbrace{\sum_{k=-p}^{-1}0}_{=0}+2^{n-p}=2^{n-p}.
\end{align*}
Thus, (\ref{pf.lem.binom.2pown-p.c3.2}) becomes%
\[
\sum_{k=0}^{n}\dbinom{n}{k}\dbinom{k}{p}=\dbinom{n}{p}\underbrace{\sum
_{k=0}^{n}\dbinom{n-p}{k-p}}_{=2^{n-p}}=\dbinom{n}{p}2^{n-p}=2^{n-p}\dbinom
{n}{p}.
\]
Thus, Lemma \ref{lem.binom.2pown-p} is proved in Case 3.

We have now proved Lemma \ref{lem.binom.2pown-p} in all three Cases 1, 2 and
3. Thus, Lemma \ref{lem.binom.2pown-p} always holds.
\end{proof}

We need yet another simple binomial identity (a \textquotedblleft
symmetric\textquotedblright\ form of the trinomial revision formula for
nonnegative integer arguments):

\begin{lemma}
\label{lem.binom.trinom-rev-symm}Let $n,i,k\in\mathbb{N}$. Then,%
\[
\dbinom{n}{i}\dbinom{n-i}{k}=\dbinom{n}{k}\dbinom{n-k}{i}.
\]

\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.binom.trinom-rev-symm}.]Theorem
\ref{thm.binom.trin-revRR} (applied to $a=n-i$ and $b=k$) yields%
\begin{equation}
\dbinom{n}{n-i}\dbinom{n-i}{k}=\dbinom{n}{k}\dbinom{n-k}{\left(  n-i\right)
-k}. \label{pf.lem.binom.trinom-rev-symm.1}%
\end{equation}
However, Theorem \ref{thm.binom.sym} (applied to $i$ instead of $k$) yields%
\[
\dbinom{n}{i}=\dbinom{n}{n-i}.
\]
Multiplying both sides of this equality by $\dbinom{n-i}{k}$, we obtain%
\begin{align}
\dbinom{n}{i}\dbinom{n-i}{k}  &  =\dbinom{n}{n-i}\dbinom{n-i}{k}\nonumber\\
&  =\dbinom{n}{k}\dbinom{n-k}{\left(  n-i\right)  -k}%
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.lem.binom.trinom-rev-symm.1}%
)}\right)  . \label{pf.lem.binom.trinom-rev-symm.2a}%
\end{align}


Now, we are in one of the following two cases:

\textit{Case 1:} We have $k\leq n$.

\textit{Case 2:} We have $k>n$.

Let us first consider Case 1. In this case, we have $k\leq n$. Thus,
$n-k\in\mathbb{N}$. Hence, Theorem \ref{thm.binom.sym} (applied to $n-k$ and
$i$ instead of $n$ and $k$) yields%
\begin{equation}
\dbinom{n-k}{i}=\dbinom{n-k}{\left(  n-k\right)  -i}=\dbinom{n-k}{\left(
n-i\right)  -k} \label{pf.lem.binom.trinom-rev-symm.3}%
\end{equation}
(since $\left(  n-k\right)  -i=\left(  n-i\right)  -k$). Now,
(\ref{pf.lem.binom.trinom-rev-symm.2a}) becomes%
\[
\dbinom{n}{i}\dbinom{n-i}{k}=\dbinom{n}{k}\underbrace{\dbinom{n-k}{\left(
n-i\right)  -k}}_{\substack{=\dbinom{n-k}{i}\\\text{(by
(\ref{pf.lem.binom.trinom-rev-symm.3}))}}}=\dbinom{n}{k}\dbinom{n-k}{i}.
\]
Thus, Lemma \ref{lem.binom.trinom-rev-symm} is proved in Case 1.

Let us now consider Case 2. In this case, we have $k>n$. Thus, $\dbinom{n}%
{k}=0$ (by Proposition \ref{prop.binom.0}). Now,
(\ref{pf.lem.binom.trinom-rev-symm.2a}) becomes%
\[
\dbinom{n}{i}\dbinom{n-i}{k}=\underbrace{\dbinom{n}{k}}_{=0}\dbinom
{n-k}{\left(  n-i\right)  -k}=0.
\]
Comparing this with $\underbrace{\dbinom{n}{k}}_{=0}\dbinom{n-k}{i}=0$, we
obtain%
\[
\dbinom{n}{i}\dbinom{n-i}{k}=\dbinom{n}{k}\dbinom{n-k}{i}.
\]
Thus, Lemma \ref{lem.binom.trinom-rev-symm} is proved in Case 2.

We have thus proved Lemma \ref{lem.binom.trinom-rev-symm} in both Cases 1 and
2. Thus, Lemma \ref{lem.binom.trinom-rev-symm} always holds.
\end{proof}

\begin{proof}
[Third solution to Exercise \ref{exe.enum.2n-2kchoosen+p} (sketched).]It is
easy to see that Exercise \ref{exe.enum.2n-2kchoosen+p} holds if
$n+p<0$\ \ \ \ \footnote{\textit{Proof.} Assume that $n+p<0$. Then,
$n+p\notin\mathbb{N}$. Hence, each $k\in\left\{  0,1,\ldots,n\right\}  $
satisfies $\dbinom{2n-2k}{n+p}=0$ (by (\ref{eq.def.binom.def.b})). Thus,%
\begin{equation}
\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\underbrace{\dbinom
{2n-2k}{n+p}}_{=0}=\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}0=0.
\label{sol.enum.2n-2kchoosen+p.fn1.1}%
\end{equation}
On the other hand, $p=\underbrace{\left(  n+p\right)  }_{<0}-\underbrace{n}%
_{>0}<0$ and thus $p\notin\mathbb{N}$. Hence, $\dbinom{n}{p}=0$ (by
(\ref{eq.def.binom.def.b})). Thus,
\[
2^{n-p}\underbrace{\dbinom{n}{p}}_{=0}=0.
\]
Comparing this with (\ref{sol.enum.2n-2kchoosen+p.fn1.1}), we obtain
$\sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}%
=2^{n-p}\dbinom{n}{p}$. Hence, Exercise \ref{exe.enum.2n-2kchoosen+p} is
solved under the assumption that $n+p<0$.}. Thus, we WLOG assume that
$n+p\geq0$. Hence, $n+p\in\mathbb{N}$ (since $n+p$ is an integer).

Now, we have%
\begin{align*}
&  \sum_{k=0}^{n}\left(  -1\right)  ^{k}\dbinom{n}{k}\dbinom{2n-2k}{n+p}\\
&  =\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}\underbrace{\dbinom
{2n-2i}{n+p}}_{\substack{=\dbinom{\left(  n-i\right)  +\left(  n-i\right)
}{n+p}\\=\sum_{k=0}^{n+p}\dbinom{n-i}{k}\dbinom{n-i}{n+p-k}\\\text{(by
Proposition \ref{prop.binom.vanderNN},}\\\text{applied to }n-i\text{,
}n-i\text{ and }n+p\text{ instead of }x\text{, }y\text{ and }n\text{)}}}\\
&  =\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}\underbrace{\sum
_{k=0}^{n+p}\dbinom{n-i}{k}\dbinom{n-i}{n+p-k}}_{\substack{=\sum_{k=0}%
^{n}\dbinom{n-i}{k}\dbinom{n-i}{n+p-k}\\\text{(here, we have changed the upper
range of the summation;}\\\text{indeed, it is not hard to see that all addends
with }k>n\\\text{are zero, as are all addends with }k>n+p\text{, so that the
value}\\\text{of the sum is not affected by our change)}}}\\
&  =\sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}{i}\sum_{k=0}^{n}%
\dbinom{n-i}{k}\dbinom{n-i}{n+p-k}\\
&  =\sum_{k=0}^{n}\ \ \sum_{i=0}^{n}\left(  -1\right)  ^{i}\underbrace{\dbinom
{n}{i}\dbinom{n-i}{k}}_{\substack{=\dbinom{n}{k}\dbinom{n-k}{i}\\\text{(by
Lemma \ref{lem.binom.trinom-rev-symm})}}}\dbinom{n-i}{n+p-k}\\
&  =\sum_{k=0}^{n}\ \ \sum_{i=0}^{n}\left(  -1\right)  ^{i}\dbinom{n}%
{k}\dbinom{n-k}{i}\dbinom{n-i}{n+p-k}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{\sum_{i=0}^{n}\left(  -1\right)
^{i}\dbinom{n-k}{i}\dbinom{n-i}{n+p-k}}_{\substack{=\sum_{i=0}^{n-k}\left(
-1\right)  ^{i}\dbinom{n-k}{i}\dbinom{n-i}{n+p-k}\\\text{(here, we removed all
addends with }i>n-k\text{,}\\\text{since these addends were }0\text{ anyway)}%
}}\\
&  =\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{\sum_{i=0}^{n-k}\left(  -1\right)
^{i}\dbinom{n-k}{i}\dbinom{n-i}{n+p-k}}_{\substack{=\dbinom{n-\left(
n-k\right)  }{\left(  n+p-k\right)  -\left(  n-k\right)  }\\\text{(by Lemma
\ref{lem.binom.dividiff-x-iCq},}\\\text{applied to }p=n-k\text{ and
}q=n+p-k\text{ and }x=n\text{)}}}
\end{align*}%
\[
=\sum_{k=0}^{n}\dbinom{n}{k}\underbrace{\dbinom{n-\left(  n-k\right)
}{\left(  n+p-k\right)  -\left(  n-k\right)  }}_{=\dbinom{k}{p}}=\sum
_{k=0}^{n}\dbinom{n}{k}\dbinom{k}{p}=2^{n-p}\dbinom{n}{p}%
\]
(by Lemma \ref{lem.binom.2pown-p}). This solves Exercise
\ref{exe.enum.2n-2kchoosen+p} again.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.enum.ISL1991pbm11} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.enum.ISL1991pbm11}.]Exercise
\ref{exe.enum.ISL1991pbm11} is problem 11 from the
\href{https://prase.cz/kalva/short/sh91.html}{IMO Shortlist 1991} (except that
we have replaced the number $1991$ by $n$). The key to the solution is the
following variant (and corollary) of Proposition \ref{prop.rec.binom-fib}:

\begin{proposition}
\label{prop.rec.binom-fib-divk}Let $a$ and $b$ be two numbers such that
$a\neq0$. Let $\left(  x_{0},x_{1},x_{2},\ldots\right)  $ be an $\left(
a,b\right)  $-recurrent sequence with $x_{0}=0$ and $x_{1}=1$. Let
$n\in\left\{  1,2,3,\ldots\right\}  $. Then,%
\[
\dfrac{1}{n}\left(  x_{n+1}+bx_{n-1}\right)  =\sum_{k=0}^{n-1}\dfrac{1}%
{n-k}\dbinom{n-k}{k}a^{n-2k}b^{k}.
\]

\end{proposition}

\begin{proof}
[Proof of Proposition \ref{prop.rec.binom-fib-divk}.]We have $n>0$ (since
$n\in\left\{  1,2,3,\ldots\right\}  $). Thus, $\dbinom{0}{n}=0$ (by
Proposition \ref{prop.binom.0}, applied to $0$ and $n$ instead of $n$ and $k$).

We have $n\in\left\{  1,2,3,\ldots\right\}  \subseteq\left\{  -1,0,1,\ldots
\right\}  $. Thus, Proposition \ref{prop.rec.binom-fib} yields%
\begin{align}
x_{n+1}  &  =\sum_{k=0}^{n}\dbinom{n-k}{k}a^{n-2k}b^{k}\nonumber\\
&  =\sum_{k=0}^{n-1}\dbinom{n-k}{k}a^{n-2k}b^{k}+\underbrace{\dbinom{n-n}{n}%
}_{=\dbinom{0}{n}=0}a^{n-2n}b^{n}\nonumber\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split off the addend for
}k=n\text{ from the sum}\right) \nonumber\\
&  =\sum_{k=0}^{n-1}\dbinom{n-k}{k}a^{n-2k}b^{k}+\underbrace{0a^{n-2n}b^{n}%
}_{=0}\nonumber\\
&  =\sum_{k=0}^{n-1}\dbinom{n-k}{k}a^{n-2k}b^{k}.
\label{pf.prop.rec.binom-fib-divk.xp1}%
\end{align}


From $n\in\left\{  1,2,3,\ldots\right\}  $, we obtain $n-2\in\left\{
-1,0,1,\ldots\right\}  $. Hence, Proposition \ref{prop.rec.binom-fib} (applied
to $n-2$ instead of $n$) yields%
\begin{align*}
x_{\left(  n-2\right)  +1}  &  =\sum_{k=0}^{n-2}\dbinom{n-2-k}{k}a^{\left(
n-2\right)  -2k}b^{k}\\
&  =\sum_{k=1}^{n-1}\underbrace{\dbinom{n-2-\left(  k-1\right)  }{k-1}%
}_{\substack{=\dbinom{n-k-1}{k-1}\\\text{(since }n-2-\left(  k-1\right)
=n-k-1\text{)}}}\underbrace{a^{\left(  n-2\right)  -2\left(  k-1\right)  }%
}_{\substack{=a^{n-2k}\\\text{(since }\left(  n-2\right)  -2\left(
k-1\right)  =n-2k\text{)}}}b^{k-1}\\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have
substituted }k-1\text{ for }k\text{ in the sum}\right) \\
&  =\sum_{k=1}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k-1}.
\end{align*}
Multiplying both sides of this equality by $b$, we find%
\begin{align*}
bx_{\left(  n-2\right)  +1}  &  =b\sum_{k=1}^{n-1}\dbinom{n-k-1}{k-1}%
a^{n-2k}b^{k-1}=\sum_{k=1}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}%
\underbrace{bb^{k-1}}_{=b^{k}}\\
&  =\sum_{k=1}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k}.
\end{align*}
Comparing this with%
\begin{align*}
\sum_{k=0}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k}  &  =\underbrace{\dbinom
{n-0-1}{0-1}}_{\substack{=0\\\text{(by (\ref{eq.def.binom.def.b}%
)}\\\text{(since }0-1\notin\mathbb{N}\text{))}}}a^{n-2\cdot0}b^{0}+\sum
_{k=1}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k}\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split off the addend for
}k=0\text{ from the sum}\right) \\
&  =\underbrace{0a^{n-2\cdot0}b^{0}}_{=0}+\sum_{k=1}^{n-1}\dbinom{n-k-1}%
{k-1}a^{n-2k}b^{k}\\
&  =\sum_{k=1}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k},
\end{align*}
we obtain%
\begin{equation}
\sum_{k=0}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k}=bx_{\left(  n-2\right)
+1}=bx_{n-1} \label{pf.prop.rec.binom-fib-divk.bxm1}%
\end{equation}
(since $\left(  n-2\right)  +1=n-1$).

However, every $k\in\left\{  0,1,\ldots,n-1\right\}  $ satisfies%
\begin{equation}
\dfrac{1}{n-k}\dbinom{n-k}{k}=\dfrac{1}{n}\left(  \dbinom{n-k}{k}%
+\dbinom{n-k-1}{k-1}\right)  . \label{pf.prop.rec.binom-fib-divk.1}%
\end{equation}


[\textit{Proof of (\ref{pf.prop.rec.binom-fib-divk.1}):} Let $k\in\left\{
0,1,\ldots,n-1\right\}  $. Then, $k\leq n-1<n$, so that $k\neq n$ and thus
$n-k\neq0$. Thus, we can divide by $n-k$. Also, we can divide by $n$ (since
$n>k\geq0$ and thus $n\neq0$).

Now, Lemma \ref{lem.binom.neighbors} (applied to $n-k$ instead of $n$) yields
\begin{equation}
\left(  n-k\right)  \dbinom{n-k-1}{k-1}=k\dbinom{n-k}{k}.
\label{pf.prop.rec.binom-fib-divk.1.pf.1}%
\end{equation}
Now,%
\begin{align*}
\dfrac{1}{n-k}\dbinom{n-k}{k}-\dfrac{1}{n}\dbinom{n-k}{k}  &
=\underbrace{\left(  \dfrac{1}{n-k}-\dfrac{1}{n}\right)  }_{=\dfrac
{k}{n\left(  n-k\right)  }}\dbinom{n-k}{k}=\dfrac{k}{n\left(  n-k\right)
}\dbinom{n-k}{k}\\
&  =\dfrac{1}{n\left(  n-k\right)  }\underbrace{k\dbinom{n-k}{k}%
}_{\substack{=\left(  n-k\right)  \dbinom{n-k-1}{k-1}\\\text{(by
(\ref{pf.prop.rec.binom-fib-divk.1.pf.1}))}}}\\
&  =\dfrac{1}{n\left(  n-k\right)  }\left(  n-k\right)  \dbinom{n-k-1}%
{k-1}=\dfrac{1}{n}\dbinom{n-k-1}{k-1}.
\end{align*}
Adding $\dfrac{1}{n}\dbinom{n-k}{k}$ to both sides of this equality, we find%
\[
\dfrac{1}{n-k}\dbinom{n-k}{k}=\dfrac{1}{n}\dbinom{n-k}{k}+\dfrac{1}{n}%
\dbinom{n-k-1}{k-1}=\dfrac{1}{n}\left(  \dbinom{n-k}{k}+\dbinom{n-k-1}%
{k-1}\right)  .
\]
This proves (\ref{pf.prop.rec.binom-fib-divk.1}).]

Now,
\begin{align*}
&  \sum_{k=0}^{n-1}\underbrace{\dfrac{1}{n-k}\dbinom{n-k}{k}}%
_{\substack{=\dfrac{1}{n}\left(  \dbinom{n-k}{k}+\dbinom{n-k-1}{k-1}\right)
\\\text{(by (\ref{pf.prop.rec.binom-fib-divk.1}))}}}a^{n-2k}b^{k}\\
&  =\sum_{k=0}^{n-1}\dfrac{1}{n}\left(  \dbinom{n-k}{k}+\dbinom{n-k-1}%
{k-1}\right)  a^{n-2k}b^{k}\\
&  =\dfrac{1}{n}\sum_{k=0}^{n-1}\left(  \dbinom{n-k}{k}+\dbinom{n-k-1}%
{k-1}\right)  a^{n-2k}b^{k}\\
&  =\dfrac{1}{n}\underbrace{\sum_{k=0}^{n-1}\dbinom{n-k}{k}a^{n-2k}b^{k}%
}_{\substack{=x_{n+1}\\\text{(by (\ref{pf.prop.rec.binom-fib-divk.xp1}))}%
}}+\dfrac{1}{n}\underbrace{\sum_{k=0}^{n-1}\dbinom{n-k-1}{k-1}a^{n-2k}b^{k}%
}_{\substack{=bx_{n-1}\\\text{(by (\ref{pf.prop.rec.binom-fib-divk.bxm1}))}%
}}\\
&  =\dfrac{1}{n}x_{n+1}+\dfrac{1}{n}bx_{n-1}=\dfrac{1}{n}\left(
x_{n+1}+bx_{n-1}\right)  .
\end{align*}
This proves Proposition \ref{prop.rec.binom-fib-divk}.
\end{proof}

Now, solving Exercise \ref{exe.enum.ISL1991pbm11} is a matter of finding the
right $\left(  a,b\right)  $-recurrent sequence:

\begin{proof}
[Solution to Exercise \ref{exe.enum.ISL1991pbm11} (sketched).]Set $a=1$ and
$b=-1$. Thus, $a=1\neq0$.

Consider the sequence $\left(  g_{0},g_{1},g_{2},\ldots\right)  $ defined in
Example \ref{exa.seqs.period.6}. This sequence $\left(  g_{0},g_{1}%
,g_{2},\ldots\right)  $ is $\left(  1,-1\right)  $-recurrent. In other words,
it is $\left(  a,b\right)  $-recurrent (since $a=1$ and $b=-1$). Moreover, it
satisfies $g_{0}=0$ and $g_{1}=1$. Thus, Proposition
\ref{prop.rec.binom-fib-divk} (applied to $x_{i}=g_{i}$) yields%
\begin{align*}
\dfrac{1}{n}\left(  g_{n+1}+bg_{n-1}\right)   &  =\sum_{k=0}^{n-1}\dfrac
{1}{n-k}\dbinom{n-k}{k}\underbrace{a^{n-2k}}_{\substack{=1^{n-2k}%
\\\text{(since }a=1\text{)}}}\underbrace{b^{k}}_{\substack{=\left(  -1\right)
^{k}\\\text{(since }b=-1\text{)}}}\\
&  =\sum_{k=0}^{n-1}\dfrac{1}{n-k}\dbinom{n-k}{k}\underbrace{1^{n-2k}}%
_{=1}\left(  -1\right)  ^{k}=\sum_{k=0}^{n-1}\dfrac{\left(  -1\right)  ^{k}%
}{n-k}\dbinom{n-k}{k}\\
&  =\sum_{i=0}^{n-1}\dfrac{\left(  -1\right)  ^{i}}{n-i}\dbinom{n-i}{i}.
\end{align*}
Hence,%
\[
\sum_{i=0}^{n-1}\dfrac{\left(  -1\right)  ^{i}}{n-i}\dbinom{n-i}{i}=\dfrac
{1}{n}\left(  g_{n+1}+\underbrace{b}_{=-1}g_{n-1}\right)  =\dfrac{1}{n}\left(
g_{n+1}-g_{n-1}\right)  .
\]


Thus, in order to solve Exercise \ref{exe.enum.ISL1991pbm11}, it suffices to
prove the equality%
\begin{equation}
g_{n+1}-g_{n-1}=\left(  -1\right)  ^{\left(  n+1\right)  //3}\left(  1+\left[
3\mid n\right]  \right)  . \label{eq.sol.enum.ISL1991pbm11.seqs-eq}%
\end{equation}
But this is entirely straightforward: Both sides of this equality depend only
on the remainder $n\%6$ (not on $n$ itself), because the sequence $\left(
g_{0},g_{1},g_{2},\ldots\right)  $ is $6$-periodic (as we have seen in Example
\ref{exa.seqs.period.6}). Thus, in order to prove it for all positive integers
$n$, it suffices to prove it for all $n\in\left\{  1,2,3,4,5,6\right\}  $ only
(since these $6$ values of $n$ represent all possible remainders that $n\%6$
can take). But this can be done mechanically.\footnote{Here are a few more
details: Let us forget that we fixed $n$. Thus, we must prove
(\ref{eq.sol.enum.ISL1991pbm11.seqs-eq}) for all positive integers $n$. In
other words, we must prove that the two sequences%
\[
\left(  g_{n+1}-g_{n-1}\right)  _{n\in\left\{  1,2,3,\ldots\right\}  }=\left(
g_{2}-g_{0},g_{3}-g_{1},g_{4}-g_{2},g_{5}-g_{3},g_{6}-g_{4},\ldots\right)
\]
and%
\begin{align*}
&  \left(  \left(  -1\right)  ^{\left(  n+1\right)  //3}\left(  1+\left[
3\mid n\right]  \right)  \right)  _{n\in\left\{  1,2,3,\ldots\right\}  }\\
&  =\left(  \left(  -1\right)  ^{2//3}\left(  1+\left[  3\mid1\right]
\right)  ,\left(  -1\right)  ^{3//3}\left(  1+\left[  3\mid2\right]  \right)
,\left(  -1\right)  ^{4//3}\left(  1+\left[  3\mid3\right]  \right)
,\ldots\right)
\end{align*}
are identical. But both of these two sequences are $6$-periodic (indeed, the
sequence $\left(  g_{n+1}-g_{n-1}\right)  _{n\in\left\{  1,2,3,\ldots\right\}
}$ is $6$-periodic because the sequence $\left(  g_{0},g_{1},g_{2}%
,\ldots\right)  $ is $6$-periodic; meanwhile, the sequence $\left(  \left(
-1\right)  ^{\left(  n+1\right)  //3}\left(  1+\left[  3\mid n\right]
\right)  \right)  _{n\in\left\{  1,2,3,\ldots\right\}  }$ is $6$-periodic
because it is straightforward to see that%
\begin{align*}
\left(  -1\right)  ^{\left(  n+1\right)  //3}  &  =%
\begin{cases}
1, & \text{if }n\%6\in\left\{  0,1,5\right\}  ;\\
-1, & \text{if }n\%6\in\left\{  2,3,4\right\}
\end{cases}
\ \ \ \ \ \ \ \ \ \ \text{and}\\
1+\left[  3\mid n\right]   &  =%
\begin{cases}
1, & \text{if }n\%6\in\left\{  1,2,4,5\right\}  ;\\
2, & \text{if }n\%6\in\left\{  0,3\right\}
\end{cases}
\end{align*}
for each $n\in\mathbb{Z}$). Hence, in order to prove that these two sequences
are identical, it suffices to show that they agree in their first $6$ entries.
But this is mechanical.} This solves Exercise \ref{exe.enum.ISL1991pbm11}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.inv.chocbar} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.inv.chocbar}.]Exercise \ref{exe.inv.chocbar}
is a quickie. The answers to both parts \textbf{(a)} and \textbf{(b)} are
\textquotedblleft$mn-1$ moves\textquotedblright. No matter how you are
breaking up the chocolate, you will always have it broken down into $1\times
1$-pieces after $mn-1$ moves (no fewer, no more).

Indeed, any time you make a move, the \# of pieces of chocolate increases by
$1$. Thus, it will take precisely $mn-1$ moves to get this \# from its initial
value $1$ to its final value $mn$ (which it has to take if we have broken up
the entire bar into $1\times1$-squares; after all, the total area of the
chocolate is invariant).
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.inv.circle-6-sectors} (TODO:
add details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.inv.circle-6-sectors}.]Exercise
\ref{exe.inv.circle-6-sectors} is a simple application of invariants.

Indeed, if a state has the numbers $a,b,c,d,e,f$ written into the $6$ sectors
as follows:%
\[%
%TCIMACRO{\TeXButton{tikz circle with sectors}{\begin{tikzpicture}[scale=2.5]
%\coordinate(a) at ({cos(0)}, {sin(0)}) {};
%\coordinate(b) at ({cos(360/6)}, {sin(360/6)}) {};
%\coordinate(c) at ({cos(2*360/6)}, {sin(2*360/6)}) {};
%\coordinate(d) at ({cos(3*360/6)}, {sin(3*360/6)}) {};
%\coordinate(e) at ({cos(4*360/6)}, {sin(4*360/6)}) {};
%\coordinate(f) at ({cos(5*360/6)}, {sin(5*360/6)}) {};
%\draw(d) -- (a);
%\draw(e) -- (b);
%\draw(f) -- (c);
%\node at (-0.5, 0.3) {$a$};
%\node at (0, 0.6) {$b$};
%\node at (0.5, 0.3) {$c$};
%\node at (0.5, -0.3) {$d$};
%\node at (0, -0.6) {$e$};
%\node at (-0.5, -0.3) {$f$};
%\draw(0,0) circle [radius=1];
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}[scale=2.5]
\coordinate(a) at ({cos(0)}, {sin(0)}) {};
\coordinate(b) at ({cos(360/6)}, {sin(360/6)}) {};
\coordinate(c) at ({cos(2*360/6)}, {sin(2*360/6)}) {};
\coordinate(d) at ({cos(3*360/6)}, {sin(3*360/6)}) {};
\coordinate(e) at ({cos(4*360/6)}, {sin(4*360/6)}) {};
\coordinate(f) at ({cos(5*360/6)}, {sin(5*360/6)}) {};
\draw(d) -- (a);
\draw(e) -- (b);
\draw(f) -- (c);
\node at (-0.5, 0.3) {$a$};
\node at (0, 0.6) {$b$};
\node at (0.5, 0.3) {$c$};
\node at (0.5, -0.3) {$d$};
\node at (0, -0.6) {$e$};
\node at (-0.5, -0.3) {$f$};
\draw(0,0) circle [radius=1];
\end{tikzpicture}%
%EndExpansion
\ \ ,
\]
then we define the \textit{fingerprint} of this state as the number
$a-b+c-d+e-f$.

It is easy to see that each move leaves the fingerprint of the state unchanged
(since, for example,
\[
\left(  a+1\right)  -\left(  b+1\right)  +c-d+e-f=a-b+c-d+e-f
\]
for any numbers $a,b,c,d,e,f$). The fingerprint of the initial state (in which
the numbers are $1,0,1,0,0,0$) is $1-0+1-0+0-0=2$; thus, it remains $2$
throughout the process. Hence, it can never become $0$. This entails that the
numbers can never all become equal (because if all numbers are equal, then the
fingerprint of the state is $a-a+a-a+a-a=0$). In other words, you cannot
ensure that all six sectors have the same number written in them. This solves
Exercise \ref{exe.inv.circle-6-sectors}.

Exercise \ref{exe.inv.circle-6-sectors} is \cite[Chapter 1, Example E3]{Engel}.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.inv.chips-and-cents} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.inv.chips-and-cents}.]The word
\textquotedblleft maximum\textquotedblright\ is a red herring. In truth, no
matter what moves you make, the number of cents you will have gained by the
end of the procedure (i.e., by the time you are left with $n$ heaps) is always
$\dbinom{n}{2}$. Here are two ways to prove this:

\textit{First proof:} Apply strong induction on $n$. Let's say that in the
first move, you split the original heap (with $n$ chips) into one heap with
$a$ chips and one heap with $b$ chips; thus you gain $ab$ cents. Note that
$a+b=n$ and $a<n$ and $b<n$. Then you keep making moves, until you have
disassembled both heaps into many one-chip heaps. By the induction hypothesis,
we know that you gain $\dbinom{a}{2}$ cents from disassembling the $a$-chip
heap (since $a<n$) and that you gain $\dbinom{b}{2}$ cents from disassembling
the $b$-chip heap (since $b<n$). Hence, in total, you gain $ab+\dbinom{a}%
{2}+\dbinom{b}{2}$ cents. But since $ab+\dbinom{a}{2}+\dbinom{b}{2}=\dbinom
{n}{2}$ (check this!), this shows that you gain $\dbinom{n}{2}$ cents. This
completes the induction step.

\textit{Second proof:} Let me define a \textit{dispersed couple} to mean a set
$\left\{  u,v\right\}  $ of two chips that lie in different heaps. Of course,
this concept depends on the state. In the initial state, there are no
dispersed couples, since all chips lie in the same heap. In the end state
(when you are left with $n$ heaps, each containing exactly one chip), there
are precisely $\dbinom{n}{2}$ dispersed couples (since any two distinct chips
form a dispersed couple). Thus, any set $\left\{  u,v\right\}  $ of two chips
becomes a dispersed couple in one of your moves (and then remains a dispersed
couple forever, since there are no moves that would bring chips from different
heaps back together). Furthermore, the number of cents you gain from a move is
precisely the number of dispersed couples that are created by this move (i.e.,
the number of sets $\left\{  u,v\right\}  $ of two chips that were not a
dispersed couple before the move, but are a dispersed couple after the move).
Thus, the total number of cents you gain during the game is the total number
of dispersed couples created by the end of the game. But this latter number is
$\dbinom{n}{2}$ (since the initial state has no dispersed couples, whereas the
end state has $\dbinom{n}{2}$ of them). This, again, proves our claim.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.inv.j19-1} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.inv.j19-1}.]Exercise \ref{exe.inv.j19-1} is
Exercise 1 on the
\href{https://web.evanchen.cc/exams/JMO-2019-notes.pdf}{USAJMO 2019}. For now,
I refer there (or to
\url{https://artofproblemsolving.com/wiki/index.php/2019_USAJMO_Problems/Problem_1}
or to
\url{https://www.maa.org/sites/default/files/pdf/AMC/usamo/2019/2019-USAJMO-Solutions.pdf}
) for the solution.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.inv.sandpileZZ-1} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.inv.sandpileZZ-1}.]Exercise
\ref{exe.inv.sandpileZZ-1} is not just superficially similar to Exercise
\ref{exe.inv.sandpileZZ-2}; it can also be solved by the same kind of
reasoning. I shall outline the solution briefly, mostly just focussing on what
is different:

\begin{proof}
[Solution to Exercise \ref{exe.inv.sandpileZZ-1} (sketched).]Let $V$ be the
set of all violinists. We identify any state with the finite subset%
\[
\left\{  \left(  i,v\right)  \ \mid\ i\in\mathbb{Z}\text{, and }v\text{ is a
violinist staying in room }i\right\}
\]
of $\mathbb{Z}\times V$. Thus, states are finite subsets of $\mathbb{Z}\times
V$. For example, the state shown in (\ref{eq.exe.inv.sandpileZZ-1.exa1}) is
the subset%
\[
\left\{  \left(  3,a\right)  ,\left(  3,b\right)  ,\left(  4,c\right)
,\left(  5,d\right)  ,\left(  5,e\right)  \right\}
\]
of $\mathbb{Z}\times V$ (assuming that the cells shown in
(\ref{eq.exe.inv.sandpileZZ-1.exa1}) correspond to the rooms $1,2,\ldots,11$).
For another example, the subset $\left\{  \left(  1,\alpha\right)  ,\left(
1,\beta\right)  ,\left(  4,\gamma\right)  \right\}  $ of $\mathbb{Z}\times V$
(with $\alpha,\beta,\gamma$ being three distinct violinists) is the state in
which the two violinists $\alpha$ and $\beta$ are staying in room $1$ and the
violinist $\gamma$ is staying in room $4$ (and there are no other violinists
in the hotel).

Thus, any move removes two pairs of the form $\left(  i,\alpha\right)  $ and
$\left(  i,\beta\right)  $ from the state and inserts the two pairs $\left(
i-1,\alpha\right)  $ and $\left(  i+1,\beta\right)  $ into the state. (Here,
of course, $\alpha$ is the violinist that moves to room $i-1$, and $\beta$ is
the violinist that moves to room $i+1$.)

If $S\subseteq\mathbb{Z}\times V$ is any state, then $\operatorname*{Occ}S$
shall denote the set of all occupied rooms in $S$. Thus,%
\[
\operatorname*{Occ}S=\left\{  i\ \mid\ \left(  i,v\right)  \in S\right\}  .
\]
This is a finite subset of $\mathbb{Z}$.

We define the \textit{entropy} of a state $S$ to be the sum $\sum_{\left(
i,v\right)  \in S}2^{i}$ (recalling that $S$ is a finite subset of
$\mathbb{Z}\times V$). This is a rational number (since the sum is finite).

It is easy to see that this entropy increases each night. In other words:

\begin{statement}
\textit{Claim 1:} Whenever two violinists move apart, the entropy of the state increases.
\end{statement}

[\textit{Proof of Claim 1:} Similar to the proof of Claim 1 in the solution to
Exercise \ref{exe.inv.sandpileZZ-2}.]

\medskip Once again (as in the solution to Exercise \ref{exe.inv.sandpileZZ-2}%
), this is useful but not sufficient to solve the exercise. Again, we need to
show that only finitely many possible states can be reached.

Let us do this. We let $N$ be the \# of violinists in the hotel. (Clearly,
this \# does not change during the process.) We shall show that the violinists
never move \textquotedblleft too far\textquotedblright\ away from their
original rooms; more precisely, they will always stay within $2N$ rooms of the
interval between the leftmost and the rightmost room occupied in the initial
state. We shall now make this precise.

Let $S_{0}$ be the initial state. Consider a sequence of $g$ (successive)
moves, starting from state $S_{0}$ and leading to states $S_{1},S_{2}%
,S_{3},\ldots,S_{g}$ in this order (i.e., the first move transforms state
$S_{0}$ into state $S_{1}$; the next move transforms state $S_{1}$ into state
$S_{2}$; and so on). As in the solution to Exercise \ref{exe.inv.sandpileZZ-2}%
, we have
\begin{equation}
N=\left\vert S_{0}\right\vert =\left\vert S_{1}\right\vert =\cdots=\left\vert
S_{g}\right\vert . \label{sol.inv.sandpileZZ-1.N=}%
\end{equation}


We WLOG assume that $N>0$. Thus, the sets $S_{0},S_{1},\ldots,S_{g}$ are
nonempty finite sets (because (\ref{sol.inv.sandpileZZ-1.N=}) shows that each
of them has $N$ elements); therefore, so are the sets $\operatorname*{Occ}%
\left(  S_{0}\right)  ,\operatorname*{Occ}\left(  S_{1}\right)  ,\ldots
,\operatorname*{Occ}\left(  S_{g}\right)  $. Hence, the minima and maxima of
these latter sets $\operatorname*{Occ}\left(  S_{0}\right)
,\operatorname*{Occ}\left(  S_{1}\right)  ,\ldots,\operatorname*{Occ}\left(
S_{g}\right)  $ are well-defined. Let $\alpha=\min\left(  \operatorname*{Occ}%
\left(  S_{0}\right)  \right)  $ and $\omega=\max\left(  \operatorname*{Occ}%
\left(  S_{0}\right)  \right)  $. (Note that the sets $\operatorname*{Occ}%
\left(  S_{0}\right)  ,\operatorname*{Occ}\left(  S_{1}\right)  ,\ldots
,\operatorname*{Occ}\left(  S_{g}\right)  $ are going to play some of the
roles that the sets $S_{0},S_{1},\ldots,S_{g}$ used to play in our solution to
Exercise \ref{exe.inv.sandpileZZ-2}. In the latter solution, violinists could
not be roommates, which is why we didn't have to introduce
$\operatorname*{Occ}S$.)

Now, we shall see that the violinists don't spread \textquotedblleft too
fast\textquotedblright\ through the hotel. To be more specific, we claim the following:

\begin{statement}
\textit{Claim 2:} We have $\min\left(  \operatorname*{Occ}\left(
S_{i+1}\right)  \right)  \geq\min\left(  \operatorname*{Occ}\left(
S_{i}\right)  \right)  -1$ for each $i\in\left\{  0,1,\ldots,g-1\right\}  $.
\end{statement}

[\textit{Proof of Claim 2:} This is similar to proving Claim 2 in the solution
of Exercise \ref{exe.inv.sandpileZZ-2}, but easier, since no violinist moves
by more than $1$ room in a single night.]

\medskip We next introduce another notation. If $S$ is any finite subset of
$\mathbb{Z}$, then we define the subset $S^{0+}$ of $\mathbb{Z}$ by%
\[
S^{0+}=S\cup\left\{  s+1\ \mid\ s\in S\right\}  =\left\{  i\in\mathbb{Z}%
\ \mid\ i\in S\text{ or }i-1\in S\right\}  .
\]
In other words, $S^{0+}$ is the set of all integers $i$ that belong to $S$
themselves or have their left neighbor $i-1$ belong to $S$. Clearly, for any
finite subset $S$ of $\mathbb{Z}$, we have
\begin{equation}
\left\vert S^{0+}\right\vert \leq2\cdot\left\vert S\right\vert
\label{sol.inv.sandpileZZ-1.S-0+.size}%
\end{equation}
(this follows easily from (\ref{eq.rmk.enum.sum-nondj.eq})) and%
\begin{equation}
S\subseteq S^{0+}. \label{sol.inv.sandpileZZ-1.S-0+.cts}%
\end{equation}


Our next claim shows that if at least one of two consecutive rooms is occupied
at some point, then this property will remain valid in all future states (even
though it will not always be the same room that is occupied, or even the same
\# of rooms):

\begin{statement}
\textit{Claim 3:} We have $\left(  \operatorname*{Occ}\left(  S_{i}\right)
\right)  ^{0+}\subseteq\left(  \operatorname*{Occ}\left(  S_{i+1}\right)
\right)  ^{0+}$ for each $i\in\left\{  0,1,\ldots,g-1\right\}  $.
\end{statement}

[\textit{Proof of Claim 3:} This is similar to proving Claim 3 in the solution
of Exercise \ref{exe.inv.sandpileZZ-2}, but easier, since we only need to take
care of two (not three) adjacent rooms.]

\medskip Let us draw some conclusions from Claim 3. It is \textbf{not} true
that $\operatorname*{Occ}\left(  S_{0}\right)  \subseteq\operatorname*{Occ}%
\left(  S_{1}\right)  \subseteq\cdots\subseteq\operatorname*{Occ}\left(
S_{g}\right)  $, since an occupied room can become unoccupied after a move.
However, Claim 3 shows that we have%
\begin{equation}
\left(  \operatorname*{Occ}\left(  S_{0}\right)  \right)  ^{0+}\subseteq
\left(  \operatorname*{Occ}\left(  S_{1}\right)  \right)  ^{0+}\subseteq
\cdots\subseteq\left(  \operatorname*{Occ}\left(  S_{g}\right)  \right)
^{0+}. \label{sol.inv.sandpileZZ-1.c3cor}%
\end{equation}
In words, this is saying that if a room or the next room to its right is
occupied at some time, then it will always remain the case that this room or
the next room is occupied.

In the rest of this solution, we shall use the notation $\left[  p,q\right]  $
for the integer interval $\left\{  p,p+1,\ldots,q\right\}  $, just as we did
in the solution of Exercise \ref{exe.inv.sandpileZZ-2}.

Our next claim will show that the leftmost occupied room will always remain to
the right of the room $\alpha-2N$ (so it cannot \textquotedblleft wander
off\textquotedblright\ to the left too far):

\begin{statement}
\textit{Claim 4:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$\min\left(  \operatorname*{Occ}\left(  S_{m}\right)  \right)  >\alpha-2N$.
\end{statement}

[\textit{Proof of Claim 4:} This is similar to proving Claim 4 in the solution
of Exercise \ref{exe.inv.sandpileZZ-2}. This time, we need to use $\left\vert
\operatorname*{Occ}\left(  S_{m}\right)  \right\vert \leq\left\vert
S_{m}\right\vert =N$.]

\begin{statement}
\textit{Claim 5:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$\max\left(  \operatorname*{Occ}\left(  S_{m}\right)  \right)  <\omega+2N$.
\end{statement}

[\textit{Proof of Claim 5:} This is similar to proving Claim 5 in the solution
of Exercise \ref{exe.inv.sandpileZZ-2}.]

\medskip Now, Claim 4 and Claim 5 can be combined to the following:

\begin{statement}
\textit{Claim 6:} Let $m\in\left\{  0,1,\ldots,g\right\}  $. Then,
$S_{m}\subseteq\left[  \alpha-2N+1,\omega+2N-1\right]  \times V$.
\end{statement}

[\textit{Proof of Claim 6:} Using Claim 4 and Claim 5, it is easy to see that
$\operatorname*{Occ}\left(  S_{m}\right)  \subseteq\left[  \alpha
-2N+1,\omega+2N-1\right]  $ (indeed, this can be proved just as we showed
Claim 6 in the solution of Exercise \ref{exe.inv.sandpileZZ-2}). However, it
is easy to see that $S\subseteq\left(  \operatorname*{Occ}S\right)  \times V$
for any state $S\subseteq\mathbb{Z}\times V$ (indeed, this follows from the
definition of $\operatorname*{Occ}S$). Applying this to $S=S_{m}$, we obtain%
\[
S_{m}\subseteq\underbrace{\operatorname*{Occ}\left(  S_{m}\right)
}_{\subseteq\left[  \alpha-2N+1,\omega+2N-1\right]  }\times V\subseteq\left[
\alpha-2N+1,\omega+2N-1\right]  \times V.
\]
This proves Claim 6.]

\medskip We note that $\omega=\max\left(  \operatorname*{Occ}\left(
S_{0}\right)  \right)  \geq\min\left(  \operatorname*{Occ}\left(
S_{0}\right)  \right)  =\alpha$ and thus $\underbrace{\omega}_{\geq\alpha
}+\underbrace{2N-1}_{\substack{>-2N+1\\\text{(since }N>0\text{)}}%
}>\alpha-2N+1$. Hence, the interval $\left[  \alpha-2N+1,\omega+2N-1\right]  $
is nonempty, and its size is%
\[
\left\vert \left[  \alpha-2N+1,\omega+2N-1\right]  \right\vert =\left(
\omega+2N-1\right)  -\left(  \alpha-2N+1\right)  +1=\omega-\alpha+4N-1.
\]


Now, we can use (e.g.) the pigeonhole principle: Claim 1 entails that the
entropy of the state increases with every move. Thus,%
\[
\left(  \text{the entropy of }S_{0}\right)  <\left(  \text{the entropy of
}S_{1}\right)  <\cdots<\left(  \text{the entropy of }S_{g}\right)  .
\]
Hence, the entropies of the $g+1$ states $S_{0},S_{1},\ldots,S_{g}$ are
distinct. Therefore, these $g+1$ states $S_{0},S_{1},\ldots,S_{g}$ must
themselves be distinct. However, all these $g+1$ states $S_{0},S_{1}%
,\ldots,S_{g}$ are subsets of the set $\left[  \alpha-2N+1,\omega+2N-1\right]
\times V$ (by Claim 6). Hence, we have found $g+1$ distinct subsets of the set
$\left[  \alpha-2N+1,\omega+2N-1\right]  \times V$. By the pigeonhole
principle, this entails that%
\begin{align*}
g+1  &  \leq\left(  \text{\# of all subsets of }\left[  \alpha-2N+1,\omega
+2N-1\right]  \times V\right) \\
&  =2^{\left\vert \left[  \alpha-2N+1,\omega+2N-1\right]  \times V\right\vert
}=2^{\left\vert \left[  \alpha-2N+1,\omega+2N-1\right]  \right\vert
\cdot\left\vert V\right\vert }=2^{\left(  \omega-\alpha+4N-1\right)
\cdot\left\vert V\right\vert }\\
&  \ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left\vert \left[  \alpha
-2N+1,\omega+2N-1\right]  \right\vert =\omega-\alpha+4N-1\right)  .
\end{align*}
In other words, $g\leq2^{\left(  \omega-\alpha+4N-1\right)  \cdot\left\vert
V\right\vert }-1$.

Now, forget that we fixed $g$ and $S_{1},S_{2},\ldots,S_{g}$. We thus have
shown that any sequence of $g$ (successive) moves, starting from state $S_{0}%
$, must satisfy $g\leq2^{\left(  \omega-\alpha+4N-1\right)  \cdot\left\vert
V\right\vert }-1$. In other words, there is no sequence of (successive) moves,
starting from state $S_{0}$, that has more than $2^{\left(  \omega
-\alpha+4N-1\right)  \cdot\left\vert V\right\vert }-1$ moves. In other words,
the moves cannot go on for more than $2^{\left(  \omega-\alpha+4N-1\right)
\cdot\left\vert V\right\vert }$ nights (if the initial state is $S_{0}$).
Hence, the moving will stop after a finite number of days. This solves
Exercise \ref{exe.inv.sandpileZZ-1}.
\end{proof}

Let me mention a major difference between Exercise \ref{exe.inv.sandpileZZ-1}
and Exercise \ref{exe.inv.sandpileZZ-2}: In Exercise
\ref{exe.inv.sandpileZZ-1}, if we treat the violinists as indistinguishable,
then the final state (i.e., the set of rooms that are occupied after the
moving has stopped) is independent of the moves! That is, it does not matter
which pairs of violinists choose to move apart first; in all possible
scenarios, the rooms that end up occupied at the end will be the same. This
result (which differs dramatically from the behavior of final states in
Exercise \ref{exe.inv.sandpileZZ-2}) appears, e.g., in \cite[Proposition
5.2.1]{Klivan18} (in much greater generality); it is part of the theory of the
chip-firing game (also known as the abelian sandpile model) on graphs. There
are now two books (\cite{CorPer18}, \cite{Klivan18}) out on this theory; in
particular, \cite[\S 5.3]{Klivan18} explicitly describes the final state in
Exercise \ref{exe.inv.sandpileZZ-1} in the case when all violinists start out
in the same room.
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.tn-3tn-4-int} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.tn-3tn-4-int}.]Exercise
\ref{exe.seqs.tn-3tn-4-int} is a particular case of the following more general
exercise (which, in turn, can be regarded as a particular case of
\cite[Theorem 3.10, \textquotedblleft extreme polynomial\textquotedblright%
]{AlCuHu16}):

\begin{exercise}
\label{exe.inv.intseq.gale4}Fix a positive integer $k\geq2$ and two integers
$u\in\mathbb{N}$ and $v\in\mathbb{N}$. Define a sequence $\left(  a_{0}%
,a_{1},a_{2},\ldots\right)  $ of positive rational numbers recursively by
setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale4.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{a_{n-1}a_{n-k+1}+u\left(  a_{n-1}+a_{n-2}+\cdots
+a_{n-k+1}\right)  +v}{a_{n-k}}\label{eq.exe.inv.intseq.gale4.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}


Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{proof}
[Solution to Exercise \ref{exe.inv.intseq.gale4} (sketched).]This is similar
to the above solution to Exercise \ref{exe.inv.intseq.gale1}, so we restrict
ourselves to an outline.

Again, we begin by playing around with the recursive equation.

Let $n$ be an integer satisfying $n\geq k+1$. Thus, $n\geq n-1\geq k$ (since
$n\geq k+1$); hence, (\ref{eq.exe.inv.intseq.gale4.rec}) holds. Multiplying
both sides of (\ref{eq.exe.inv.intseq.gale4.rec}) by $a_{n-k}$, we obtain%
\begin{equation}
a_{n}a_{n-k}=a_{n-1}a_{n-k+1}+u\left(  a_{n-1}+a_{n-2}+\cdots+a_{n-k+1}%
\right)  +v. \label{sol.inv.intseq.gale4.rec1}%
\end{equation}
The same argument (applied to $n-1$ instead of $n$) yields%
\[
a_{n-1}a_{n-k-1}=a_{n-2}a_{n-k}+u\left(  a_{n-2}+a_{n-3}+\cdots+a_{n-k}%
\right)  +v.
\]
Subtracting this equality from (\ref{sol.inv.intseq.gale4.rec1}), we find
\begin{align*}
a_{n}a_{n-k}-a_{n-1}a_{n-k-1}  &  =\left(  a_{n-1}a_{n-k+1}+u\left(
a_{n-1}+a_{n-2}+\cdots+a_{n-k+1}\right)  +v\right) \\
&  \ \ \ \ \ \ \ \ \ \ -\left(  a_{n-2}a_{n-k}+u\left(  a_{n-2}+a_{n-3}%
+\cdots+a_{n-k}\right)  +v\right) \\
&  =a_{n-1}a_{n-k+1}-a_{n-2}a_{n-k}+ua_{n-1}-ua_{n-k}.
\end{align*}
Adding $a_{n-2}a_{n-k}+ua_{n-k}+a_{n-1}a_{n-k-1}$ to both sides of this
equality, we obtain%
\[
a_{n}a_{n-k}+a_{n-2}a_{n-k}+ua_{n-k}=a_{n-1}a_{n-k-1}+a_{n-1}a_{n-k+1}%
+ua_{n-1}.
\]
In other words,%
\[
a_{n-k}\left(  a_{n}+a_{n-2}+u\right)  =a_{n-1}\left(  a_{n-k+1}%
+a_{n-k-1}+u\right)  .
\]
Dividing both sides of this equality by $a_{n-1}a_{n-k}$, we obtain%
\begin{equation}
\dfrac{a_{n}+a_{n-2}+u}{a_{n-1}}=\dfrac{a_{n-k+1}+a_{n-k-1}+u}{a_{n-k}}.
\label{sol.inv.intseq.gale4.rec4}%
\end{equation}


Now, forget that we fixed $n$. We thus have proved the equality
(\ref{sol.inv.intseq.gale4.rec4}) for each integer $n\geq k+1$.

Now, let us define a number%
\begin{equation}
b_{n}=\dfrac{a_{n}+a_{n-2}+u}{a_{n-1}} \label{sol.inv.intseq.gale4.bn=}%
\end{equation}
for each integer $n\geq2$. Thus, we have defined a sequence $\left(
b_{2},b_{3},b_{4},\ldots\right)  $ of rational numbers. It is easy to see that
$b_{2},b_{3},\ldots,b_{k}$ are integers (since $a_{k-1},a_{k-2},\ldots,a_{0}$
are all equal to $1$, and thus all denominators involved in computing
$b_{2},b_{3},\ldots,b_{k}$ are $1$s).

Now, the equality (\ref{sol.inv.intseq.gale4.rec4}) entails that%
\[
b_{n}=b_{n-\left(  k-1\right)  }%
\]
for each integer $n\geq k+1$ (because its left hand side is $b_{n}$, while its
right hand side is $b_{n-\left(  k-1\right)  }$). In other words,
$b_{m+\left(  k-1\right)  }=b_{m}$ for each integer $m\geq2$. In other words,
the sequence $\left(  b_{2},b_{3},b_{4},\ldots\right)  $ is $\left(
k-1\right)  $-periodic. Thus, each entry of this sequence equals one of the
first $k-1$ entries $b_{2},b_{3},\ldots,b_{k}$ of this sequence. Since the
first $k-1$ entries $b_{2},b_{3},\ldots,b_{k}$ of this sequence are integers
(as we have seen above), we thus conclude that each entry of this sequence is
an integer. In other words, $b_{2},b_{3},b_{4},\ldots$ are integers.

From here on, we argue similarly to our above solution to Exercise
\ref{exe.inv.intseq.gale1}: Solving the equality
(\ref{sol.inv.intseq.gale4.bn=}) for $a_{n}$, we obtain%
\[
a_{n}=b_{n}a_{n-1}-a_{n-2}-u\ \ \ \ \ \ \ \ \ \ \text{for each integer }%
n\geq2.
\]
Using this equality (and the fact that $b_{2},b_{3},b_{4},\ldots$ are
integers), we can prove (by a straightforward strong induction on $n$) that
$a_{n}$ is a positive integer for each $n\in\mathbb{N}$ (because the induction
hypothesis yields that $a_{n-1}$ and $a_{n-2}$ are integers, so that
$b_{n}a_{n-1}-a_{n-2}-u$ is an integer, and the positivity follows from the
statement of the exercise). Thus, Exercise \ref{exe.inv.intseq.gale4} is solved.
\end{proof}

Exercise \ref{exe.seqs.tn-3tn-4-int} is a particular case of Exercise
\ref{exe.inv.intseq.gale4}. (Namely, if we set $k=4$ and $u=0$ and $v=1$ in
Exercise \ref{exe.inv.intseq.gale4}, then the sequence $\left(  a_{0}%
,a_{1},a_{2},\ldots\right)  $ becomes the sequence $\left(  t_{0},t_{1}%
,t_{2},\ldots\right)  $ from Exercise \ref{exe.seqs.tn-3tn-4-int}.)
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.seqs.q-t-3-int} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.seqs.q-t-3-int}.]This is similar to the above
solution to Exercise \ref{exe.inv.intseq.gale4}, so we restrict ourselves to
an outline.

Let $n$ be an integer satisfying $n\geq4$. The definition of the sequence
$\left(  t_{0},t_{1},t_{2},\ldots\right)  $ yields%
\[
t_{n}=\dfrac{t_{n-1}^{2}+qt_{n-1}t_{n-2}+t_{n-2}^{2}}{t_{n-3}},
\]
so that%
\[
t_{n}t_{n-3}=t_{n-1}^{2}+qt_{n-1}t_{n-2}+t_{n-2}^{2}.
\]
The same argument (applied to $n-1$ instead of $n$) yields%
\[
t_{n-1}t_{n-4}=t_{n-2}^{2}+qt_{n-2}t_{n-3}+t_{n-3}^{2}.
\]
Subtracting this equality from the previous one, we find%
\begin{align*}
t_{n}t_{n-3}-t_{n-1}t_{n-4}  &  =\left(  t_{n-1}^{2}+qt_{n-1}t_{n-2}%
+t_{n-2}^{2}\right)  -\left(  t_{n-2}^{2}+qt_{n-2}t_{n-3}+t_{n-3}^{2}\right)
\\
&  =t_{n-1}^{2}+qt_{n-1}t_{n-2}-qt_{n-2}t_{n-3}-t_{n-3}^{2}.
\end{align*}
Adding $qt_{n-2}t_{n-3}+t_{n-3}^{2}+t_{n-1}t_{n-4}+qt_{n-1}t_{n-3}$ to both
sides of this equality, we obtain%
\begin{align*}
&  t_{n}t_{n-3}+qt_{n-2}t_{n-3}+t_{n-3}^{2}+qt_{n-1}t_{n-3}\\
&  =t_{n-1}^{2}+qt_{n-1}t_{n-2}+t_{n-1}t_{n-4}+qt_{n-1}t_{n-3}.
\end{align*}
In other words,%
\[
t_{n-3}\left(  t_{n}+qt_{n-1}+qt_{n-2}+t_{n-3}\right)  =t_{n-1}\left(
t_{n-1}+qt_{n-2}+qt_{n-3}+t_{n-4}\right)  .
\]
Dividing both sides of this equality by $t_{n-1}t_{n-2}t_{n-3}$, we obtain%
\begin{equation}
\dfrac{t_{n}+qt_{n-1}+qt_{n-2}+t_{n-3}}{t_{n-1}t_{n-2}}=\dfrac{t_{n-1}%
+qt_{n-2}+qt_{n-3}+t_{n-4}}{t_{n-2}t_{n-3}}. \label{sol.seqs.q-t-3-int.rec4}%
\end{equation}


Now, forget that we fixed $n$. We thus have proved the equality
(\ref{sol.seqs.q-t-3-int.rec4}) for each integer $n\geq4$.

Now, let us define a number%
\[
b_{n}=\dfrac{t_{n}+qt_{n-1}+qt_{n-2}+t_{n-3}}{t_{n-1}t_{n-2}}%
\]
for each integer $n\geq3$. Thus, we have defined a sequence $\left(
b_{3},b_{4},b_{5},\ldots\right)  $ of rational numbers. It is easy to see that
$b_{3}$ is an integer (since $t_{2}=1$ and $t_{1}=1$ and $t_{3}\in\mathbb{Z}$).

Now, the equality (\ref{sol.seqs.q-t-3-int.rec4}) entails that%
\[
b_{n}=b_{n-1}%
\]
for each integer $n\geq4$ (because its left hand side is $b_{n}$, while its
right hand side is $b_{n-1}$). In other words, $b_{3}=b_{4}=b_{5}=\cdots$.
Hence, all entries $b_{3},b_{4},b_{5},\ldots$ of the sequence $\left(
b_{3},b_{4},b_{5},\ldots\right)  $ are integers (since $b_{3}$ is an integer).

From here on, we can conclude our solution to Exercise
\ref{exe.seqs.q-t-3-int} similarly to our above solution to Exercise
\ref{exe.inv.intseq.gale4}.

Having solved Exercise \ref{exe.seqs.q-t-3-int}, let me point out two
generalizations (although I only know how to solve one).

Exercise \ref{exe.seqs.q-t-3-int} is a particular case (for $k=3$) of the
following more general exercise:

\begin{exercise}
\label{exe.inv.intseq.gale5}Fix a positive integer $k\geq2$ and an integer
$q\in\mathbb{N}$. Define a sequence $\left(  a_{0},a_{1},a_{2},\ldots\right)
$ of positive rational numbers recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale5.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{\left(  a_{n-1}^{2}+a_{n-2}^{2}+\cdots+a_{n-k+1}^{2}\right)
+q\sum_{1\leq i<j\leq k-1}a_{n-i}a_{n-j}}{a_{n-k}}%
\label{eq.exe.inv.intseq.gale5.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}


Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{noncompile}
TODO: Solution for this one! Idea: $b_{n}=b_{n-1}$ for
\[
b_{n}=\dfrac{a_{n}+a_{n-k}+q\sum_{i=1}^{k-1}a_{n-i}}{a_{n-1}a_{n-2}\cdots
a_{n-k+1}}.
\]

\end{noncompile}

Also, Exercise \ref{exe.seqs.q-t-3-int} is a particular case (for $k=3$) of
the following more general exercise:

\begin{exercise}
\label{exe.inv.intseq.gale6}Fix some $k\in\left\{  2,3,4\right\}  $ and an
integer $q\in\mathbb{N}$. Define a sequence $\left(  a_{0},a_{1},a_{2}%
,\ldots\right)  $ of positive rational numbers recursively by setting%
\begin{equation}
a_{n}=1\ \ \ \ \ \ \ \ \ \ \text{for each }n<k
\label{eq.exe.inv.intseq.gale6.start}%
\end{equation}
and%
\begin{align}
a_{n}  &  =\dfrac{\left(  a_{n-1}^{2}+a_{n-2}^{2}+\cdots+a_{n-k+1}^{2}\right)
+qa_{n-1}a_{n-k+1}}{a_{n-k}}\label{eq.exe.inv.intseq.gale6.rec}\\
&  \ \ \ \ \ \ \ \ \ \ \text{for each }n\geq k.\nonumber
\end{align}


Prove that $a_{n}$ is a positive integer for each integer $n\geq0$.
\end{exercise}

\begin{noncompile}
TODO: Solution for this one!
\end{noncompile}

Exercise \ref{exe.inv.intseq.gale5} and Exercise \ref{exe.inv.intseq.gale6}
can be solved along the same lines as our above solution to Exercise
\ref{exe.seqs.q-t-3-int}. (Alas, Exercise \ref{exe.inv.intseq.gale6} becomes
false for $k=5$ (indeed, for $q=1$ and $k=5$, we have $a_{11}\notin\mathbb{Z}%
$); this spoils the pattern somewhat.)
\end{proof}

\subsection{Homework set \#10A discussion}

The following are discussions of the problems on homework set \#10A
(Subsection \ref{subsect.hw10a}).

\subsubsection{Discussion of Exercise \ref{exe.ent.prime.uu-vv}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.prime.uu-vv}.]The key to Exercise
\ref{exe.ent.prime.uu-vv} is to recall the identity $u^{2}-v^{2}=\left(
u-v\right)  \left(  u+v\right)  $. So the exercise is about writing $n$ as a
product of two integers of the form $u-v$ and $u+v$. When can two integers be
written in the form $u-v$ and $u+v$ ? The answer to this turns out to be
\textquotedblleft exactly when they are congruent modulo $2$ (that is, have
the same parity)\textquotedblright. Let us state this as a lemma\footnote{Note
the similarity to Lemma \ref{lem.xy-ab} (which we will not, however, use
here).}:

\begin{lemma}
\label{lem.sol.ent.prime.uu-vv.1}Let $a$ and $b$ be two integers. Then:

\textbf{(a)} If $a\equiv b\operatorname{mod}2$, then there exist two integers
$u,v\in\mathbb{Z}$ such that $u+v=a$ and $u-v=b$.

\textbf{(b)} If there exist two integers $u,v\in\mathbb{Z}$ such that $u+v=a$
and $u-v=b$, then $a\equiv b\operatorname{mod}2$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.ent.prime.uu-vv.1}.]\textbf{(a)} Assume that
$a\equiv b\operatorname{mod}2$. Let $x=\dfrac{a+b}{2}$ and $y=\dfrac{a-b}{2}$.
Thus, $x+y=\dfrac{a+b}{2}+\dfrac{a-b}{2}=a$ and $x-y=\dfrac{a+b}{2}%
-\dfrac{a-b}{2}=b$.

From $a\equiv b\operatorname{mod}2$, we obtain $2\mid a-b$, and thus
$\dfrac{a-b}{2}\in\mathbb{Z}$. In other words, $y\in\mathbb{Z}$ (since
$y=\dfrac{a-b}{2}$). Also, from $x+y=a$, we obtain $x=a-y\in\mathbb{Z}$ (since
$a\in\mathbb{Z}$ and $y\in\mathbb{Z}$). We thus know that $x$ and $y$ are
integers (since $x\in\mathbb{Z}$ and $y\in\mathbb{Z}$) and satisfy $x+y=a$ and
$x-y=b$. Hence, there exist two integers $u,v\in\mathbb{Z}$ such that $u+v=a$
and $u-v=b$ (namely, $u=x$ and $v=y$). This proves Lemma
\ref{lem.sol.ent.prime.uu-vv.1} \textbf{(a)}.

\textbf{(b)} Assume that there exist two integers $u,v\in\mathbb{Z}$ such that
$u+v=a$ and $u-v=b$. Consider these $u$ and $v$. From $u+v=a$, we obtain%
\[
a=u+v=u-v+\underbrace{2}_{\equiv0\operatorname{mod}2}v\equiv
u-v+0v=u-v=b\operatorname{mod}2.
\]
This proves Lemma \ref{lem.sol.ent.prime.uu-vv.1} \textbf{(b)}.
\end{proof}

With Lemma \ref{lem.sol.ent.prime.uu-vv.1} in hand, we can quickly reduce
Exercise \ref{exe.ent.prime.uu-vv} to showing that $n$ can be written as a
product of two integers that have the same parity if and only if
$n\not \equiv 2\operatorname{mod}4$. But this is easy to check:

\begin{itemize}
\item If $n$ is divisible by $4$, then $n=2\cdot\dfrac{n}{2}$ is a way to
write $n$ as a product of two integers that have the same parity.

\item If $n$ is odd, then $n=1\cdot n$ is a way to write $n$ as a product of
two integers that have the same parity.

\item On the other hand, if $n$ is neither divisible by $4$ nor odd, then we
cannot write $n$ as a product $ab$ of two integers $a$ and $b$ that have the
same parity, because such a product must either be divisible by $4$ (if $a$
and $b$ are both even) or be odd (if $a$ and $b$ are both odd).
\end{itemize}

\noindent Now, it remains to observe that the statement \textquotedblleft$n$
is either divisible by $4$ or odd\textquotedblright\ is equivalent to
\textquotedblleft$n\not \equiv 2\operatorname{mod}4$\textquotedblright.

Just for the sake of completeness, here is a detailed version of the solution
we just outlined:

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.uu-vv}.]We are in one of the
following three cases:

\textit{Case 1:} We have $4\mid n$.

\textit{Case 2:} We have $2\nmid n$.

\textit{Case 3:} We have neither $4\mid n$ nor $2\nmid n$.

Let us first consider Case 1. In this case, we have $4\mid n$. Thus,
$n\%4=0$\ \ \ \ \footnote{\textit{Proof.} Proposition
\ref{prop.ent.quorem.props} \textbf{(b)} (applied to $4$ and $n$ instead of
$n$ and $u$) shows that we have $4\mid n$ if and only if $n\%4=0$. Thus, we
have $n\%4=0$ (since $4\mid n$).}. Hence, $n\not \equiv 2\operatorname{mod}%
4$\ \ \ \ \footnote{\textit{Proof.} Assume the contrary. Thus, $n\equiv
2\operatorname{mod}4$, so that $2\equiv n\operatorname{mod}4$. Hence,
Proposition \ref{prop.ent.quorem.props} \textbf{(c)} (applied to $4$, $n$ and
$2$ instead of $n$, $u$ and $c$) yields $2=n\%4$ (since $2\in\left\{
0,1,\ldots,4-1\right\}  $). Hence, $n\%4=2\neq0$. This contradicts $n\%4=0$.
This contradiction shows that our assumption was false; qed.}.

From $4\mid n$, we obtain $\dfrac{n}{4}\in\mathbb{Z}$. Thus, $2\cdot\dfrac
{n}{4}$ is an even integer. In other words, $\dfrac{n}{2}$ is an even integer
(since $2\cdot\dfrac{n}{4}=\dfrac{n}{2}$). Therefore, $\dfrac{n}{2}%
\equiv0\equiv2\operatorname{mod}2$. Hence, Lemma
\ref{lem.sol.ent.prime.uu-vv.1} \textbf{(a)} (applied to $a=\dfrac{n}{2}$ and
$b=2$) yields that there exist two integers $u,v\in\mathbb{Z}$ such that
$u+v=\dfrac{n}{2}$ and $u-v=2$ (since $\dfrac{n}{2}$ and $2$ are integers).
These two integers $u$ and $v$ must necessarily satisfy $n=u^{2}-v^{2}$ (since
$u^{2}-v^{2}=\underbrace{\left(  u-v\right)  }_{=2}\underbrace{\left(
u+v\right)  }_{=\dfrac{n}{2}}=2\cdot\dfrac{n}{2}=n$). Hence, $n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}$.

Thus, we have shown that both statements \textquotedblleft$n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}%
$\textquotedblright\ and \textquotedblleft$n\not \equiv 2\operatorname{mod}%
4$\textquotedblright\ are true (since we have shown that $n\not \equiv
2\operatorname{mod}4$). Therefore, these two statements are equivalent. In
other words, $n$ can be represented in the form $n=u^{2}-v^{2}$ for some
$u,v\in\mathbb{Z}$ if and only if $n\not \equiv 2\operatorname{mod}4$. Thus,
Exercise \ref{exe.ent.prime.uu-vv} is solved in Case 1.

Let us next consider Case 2. In this case, we have $2\nmid n$. In other words,
$n$ is odd. Hence, $n\not \equiv 2\operatorname{mod}4$%
\ \ \ \ \footnote{\textit{Proof.} Assume the contrary. Thus, $n\equiv
2\operatorname{mod}4$. Hence, Proposition \ref{prop.ent.mod.basics}
\textbf{(e)} (applied to $n$, $2$, $4$ and $2$ instead of $a$, $b$, $n$ and
$m$) yields $n\equiv2\operatorname{mod}2$ (since $2\mid4$). Hence,
$n\equiv2\equiv0\operatorname{mod}2$; in other words, $n$ is even. That is,
$2\mid n$. This contradicts $2\nmid n$. This contradiction shows that our
assumption was false; qed.}.

On the other hand, $n\equiv1\operatorname{mod}2$ (since $n$ is odd).
Therefore, Lemma \ref{lem.sol.ent.prime.uu-vv.1} \textbf{(a)} (applied to
$a=n$ and $b=1$) yields that there exist two integers $u,v\in\mathbb{Z}$ such
that $u+v=n$ and $u-v=1$. These two integers $u$ and $v$ must necessarily
satisfy $n=u^{2}-v^{2}$ (since $u^{2}-v^{2}=\underbrace{\left(  u-v\right)
}_{=1}\underbrace{\left(  u+v\right)  }_{=n}=1\cdot n=n$). Hence, $n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}$.

Thus, we have shown that both statements \textquotedblleft$n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}%
$\textquotedblright\ and \textquotedblleft$n\not \equiv 2\operatorname{mod}%
4$\textquotedblright\ are true (since we have shown that $n\not \equiv
2\operatorname{mod}4$). Therefore, these two statements are equivalent. In
other words, $n$ can be represented in the form $n=u^{2}-v^{2}$ for some
$u,v\in\mathbb{Z}$ if and only if $n\not \equiv 2\operatorname{mod}4$. Thus,
Exercise \ref{exe.ent.prime.uu-vv} is solved in Case 2.

Finally, let us consider Case 3. In this case, we have neither $4\mid n$ nor
$2\nmid n$. Thus, $4\nmid n$ (since we don't have $4\mid n$) and $2\mid n$
(since we don't have $2\nmid n$). From $2\mid n$, we obtain $\dfrac{n}{2}%
\in\mathbb{Z}$. In other words, $\dfrac{n}{2}$ is an integer. This integer
$\dfrac{n}{2}$ cannot be even\footnote{\textit{Proof.} Assume the contrary.
Thus, the integer $\dfrac{n}{2}$ is even. In other words, $2\mid\dfrac{n}{2}$;
therefore, $\dfrac{\left(  \dfrac{n}{2}\right)  }{2}\in\mathbb{Z}$. In other
words, $\dfrac{n}{4}\in\mathbb{Z}$ (since $\dfrac{\left(  \dfrac{n}{2}\right)
}{2}=\dfrac{n}{4}$). Hence, $4\mid n$. But this contradicts $4\nmid n$. This
contradiction shows that our assumption was false; qed.}, and therefore must
be odd. Hence, we have $n\equiv2\operatorname{mod}4$%
\ \ \ \ \footnote{\textit{Proof.} The integer $\dfrac{n}{2}$ is odd. In other
words, $\dfrac{n}{2}=2u+1$ for some $u\in\mathbb{Z}$. Consider this $u$.
Multiplying the equality $\dfrac{n}{2}=2u+1$ by $2$, we obtain $n=2\left(
2u+1\right)  =\underbrace{4}_{\equiv0\operatorname{mod}4}u+2\equiv
0u+2=2\operatorname{mod}4$.}. Thus, we don't have $n\not \equiv
2\operatorname{mod}4$. Also, we have $n\equiv0\operatorname{mod}2$ (since
$2\mid n$).

Now, let $u,v\in\mathbb{Z}$ be integers satisfying $n=u^{2}-v^{2}$. We shall
derive a contradiction. Indeed, set $a=u+v$ and $b=u-v$. Thus, Lemma
\ref{lem.sol.ent.prime.uu-vv.1} \textbf{(b)} yields $a\equiv
b\operatorname{mod}2$ (since $u+v=a$ and $u-v=b$). Also, $n=u^{2}%
-v^{2}=\underbrace{\left(  u+v\right)  }_{=a}\underbrace{\left(  u-v\right)
}_{=b}=ab$. If the integer $b$ was odd, then we would have $b\equiv
1\operatorname{mod}2$ and therefore $n=\underbrace{a}_{\equiv b\equiv
1\operatorname{mod}2}\ \ \underbrace{b}_{\equiv1\operatorname{mod}2}%
\equiv1\cdot1=1\not \equiv 0\operatorname{mod}2$, which would contradict
$n\equiv0\operatorname{mod}2$. Hence, the integer $b$ cannot be odd. Thus, $b$
must be even. In other words, $b=2q$ for some integer $q$. Consider this $q$.
Also, $a\equiv b\equiv0\operatorname{mod}2$ (since $b$ is even); hence, the
integer $a$ is even. In other words, $a=2p$ for some integer $p$. Consider
this $p$. Now, $n=\underbrace{a}_{=2p}\underbrace{b}_{=2q}=\left(  2p\right)
\left(  2q\right)  =4pq$ shows that $4\mid n$; but this contradicts $4\nmid n$.

Forget that we fixed $u,v$. We thus have obtained a contradiction for any two
integers $u,v\in\mathbb{Z}$ satisfying $n=u^{2}-v^{2}$. Hence, no two such
integers $u,v$ exist. In other words, $n$ cannot be represented in the form
$n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}$.

Thus, we have shown that both statements \textquotedblleft$n$ can be
represented in the form $n=u^{2}-v^{2}$ for some $u,v\in\mathbb{Z}%
$\textquotedblright\ and \textquotedblleft$n\not \equiv 2\operatorname{mod}%
4$\textquotedblright\ are false (since we have shown that we don't have
$n\not \equiv 2\operatorname{mod}4$). Therefore, these two statements are
equivalent. In other words, $n$ can be represented in the form $n=u^{2}-v^{2}$
for some $u,v\in\mathbb{Z}$ if and only if $n\not \equiv 2\operatorname{mod}%
4$. Thus, Exercise \ref{exe.ent.prime.uu-vv} is solved in Case 3.

We have now solved Exercise \ref{exe.ent.prime.uu-vv} in all three Cases 1, 2
and 3. Thus, our solution to Exercise \ref{exe.ent.prime.uu-vv} is complete.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.prime.uv-u2} (TODO: add
details!)}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.prime.uv-u2}.]I don't remember where I
found Exercise \ref{exe.ent.prime.uv-u2}. It is, in some sense, a (noticeably)
harder version of Exercise \ref{exe.ent.prime.uu-vv}. I will only sketch the
solution, after first outhousing part of it into the following lemma:

\begin{lemma}
\label{lem.sol.ent.prime.uv-u2.1}Let $n$ be a positive integer that is neither
a prime nor a power of $2$. Then, there exist two integers $a\geq3$ and
$b\geq3$ satisfying $2n=ab$ and $a\not \equiv b\operatorname{mod}2$.
\end{lemma}

\begin{proof}
[Proof of Lemma \ref{lem.sol.ent.prime.uv-u2.1} (sketched).]First of all, we
recall that $n$ is not a power of $2$. Hence, the number $n$ has at least one
odd prime divisor $d$ (since otherwise, the prime factorization of $n$ would
only consist of $2$'s, but this would mean that $n$ is a power of $2$).
Consider such a $d$. Thus, $n=de$ for some positive integer $e$ (since $d$ is
a positive divisor of $n$). Moreover, $d\geq3$ (since $d$ is an odd prime).
Note that $n\neq d$ (since $n$ is not a prime, but $d$ is a prime), and thus
$e\neq1$ (since otherwise, we would have $e=1$ and thus $n=d\underbrace{e}%
_{=1}=d$, which would contradict $n\neq d$). Hence, $e\geq2$ (since $e$ is a
positive integer) and thus $2e\geq2\cdot2=4\geq3$.

Now, from $n=de$, we obtain $2n=2de=d\left(  2e\right)  $. Moreover, the two
integers $d$ and $2e$ satisfy $d\geq3$ and $2e\geq3$ and $d\not \equiv
2e\operatorname{mod}2$ (since $d$ is odd while $2e$ is even). Hence, there
exist two integers $a\geq3$ and $b\geq3$ satisfying $2n=ab$ and $a\not \equiv
b\operatorname{mod}2$ (namely, $a=d$ and $b=2e$). This proves Lemma
\ref{lem.sol.ent.prime.uv-u2.1}.
\end{proof}

We can now solve Exercise \ref{exe.ent.prime.uv-u2}:

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.uv-u2} (sketched).]We must prove the
following two claims:

\begin{statement}
\textit{Claim 1:} If $n$ can be represented in the form $n=uv-\dbinom{u}{2}$
for some $u,v\in\mathbb{Z}$ satisfying $v\geq u\geq3$, then $n$ is neither a
prime nor a power of $2$.
\end{statement}

\begin{statement}
\textit{Claim 2:} If $n$ is neither a prime nor a power of $2$, then $n$ can
be represented in the form $n=uv-\dbinom{u}{2}$ for some $u,v\in\mathbb{Z}$
satisfying $v\geq u\geq3$.
\end{statement}

[\textit{Proof of Claim 1:} Assume that $n$ can be represented in the form
$n=uv-\dbinom{u}{2}$ for some $u,v\in\mathbb{Z}$ satisfying $v\geq u\geq3$.
Consider these $u,v$. Thus,
\[
n=uv-\underbrace{\dbinom{u}{2}}_{=\dfrac{u\left(  u-1\right)  }{2}}%
=uv-\dfrac{u\left(  u-1\right)  }{2}=u\left(  v-\dfrac{u-1}{2}\right)  .
\]
Multiplying this equality by $2$, we get%
\[
2n=2u\left(  v-\dfrac{u-1}{2}\right)  =u\left(  2v-u+1\right)  .
\]


Set $w=2v-u+1$. Then, $2n=u\underbrace{\left(  2v-u+1\right)  }_{=w}=uw$.
Hence, $u$ and $w$ are divisors of $2n$. Both of these divisors are $\geq3$
(since $u\geq3$ and $w=2\underbrace{v}_{\geq u}-u+\underbrace{1}_{\geq0}%
\geq2u-u+0=u\geq3$), and furthermore have different parity (since their
difference $u-\underbrace{w}_{=2v-u+1}=u-\left(  2v-u+1\right)  =2\left(
u-v\right)  -1$ is odd). Thus, one of these two divisors must be odd. Hence,
$2n$ has an odd divisor that is $\geq3$ (since both of these divisors are
$\geq3$). This shows that $2n$ is not a power of $2$ (since a power of $2$ has
no odd divisor that is $\geq3$\ \ \ \ \footnote{This is easiest to see using
prime factorization.}). Hence, $n$ is not a power of $2$ either.

It remains to show that $n$ is not a prime. Indeed, assume the contrary. Thus,
$n$ is a prime. Hence, from $n\mid2n=uw$, we conclude that we have $n\mid u$
or $n\mid w$ (by Theorem \ref{thm.ent.prime.pab}, applied to $p=n$, $a=u$ and
$b=w$). If $n\mid u$, then $u\geq n$ (since $u\geq3$ is positive) and
therefore $2n=\underbrace{u}_{\geq n}\underbrace{w}_{\geq3}\geq n\cdot
3=3n>2n$, which is clearly absurd. The same argument (with the roles of $u$
and $w$ interchanged) yields an absurd conclusion if $n\mid w$. Thus, neither
$n\mid u$ nor $n\mid w$ can hold. This contradicts the fact that we have
$n\mid u$ or $n\mid w$. This contradiction completes our proof of Claim 1.]

[\textit{Proof of Claim 2:} Assume that $n$ is neither a prime nor a power of
$2$. Thus, Lemma \ref{lem.sol.ent.prime.uv-u2.1} shows that there exist two
integers $a\geq3$ and $b\geq3$ satisfying $2n=ab$ and $a\not \equiv
b\operatorname{mod}2$. Consider these $a$ and $b$.

We WLOG assume that $b\geq a$ (since we can otherwise achieve this by swapping
$a$ with $b$).

We have $a\not \equiv b\operatorname{mod}2$. In other words, $2\nmid a-b$.
Thus, $a-b$ is odd, so that we have $a-b\equiv1\operatorname{mod}2$. However,
$a+b\equiv a-b\operatorname{mod}2$ (since $\left(  a+b\right)  -\left(
a-b\right)  =2b$ is clearly even). Therefore, $a+b\equiv a-b\equiv
1\operatorname{mod}2$. In other words, $a+b$ is odd. Hence, $a+b-1$ is even,
so that $\dfrac{a+b-1}{2}\in\mathbb{Z}$.

Set $u=a$ and $v=\dfrac{a+b-1}{2}$. Then, both $u$ and $v$ are integers (since
$u=a\in\mathbb{Z}$ and $v=\dfrac{a+b-1}{2}\in\mathbb{Z}$). Moreover, the
definitions of $u$ and $v$ yield
\[
u\left(  2v-u+1\right)  =a\left(  2\cdot\dfrac{a+b-1}{2}-a+1\right)  =ab=2n.
\]
Solving this equality for $n$, we find%
\[
n=\dfrac{u\left(  2v-u+1\right)  }{2}=uv-\underbrace{\dfrac{u\left(
u-1\right)  }{2}}_{=\dbinom{u}{2}}=uv-\dbinom{u}{2}.
\]
Furthermore, $u=a\geq3$. Moreover,
\begin{align*}
v  &  =\dfrac{a+b-1}{2}\geq\dfrac{a+a-1}{2}\ \ \ \ \ \ \ \ \ \ \left(
\text{since }b\geq a\right) \\
&  =\underbrace{a}_{=u}-\underbrace{\dfrac{1}{2}}_{<1}>u-1
\end{align*}
and thus $v\geq u$ (since $v$ and $u$ are integers). Hence, $v\geq u\geq3$.
Thus, $n$ can be represented in the form $n=uv-\dbinom{u}{2}$ for some
$u,v\in\mathbb{Z}$ satisfying $v\geq u\geq3$ (indeed, we have just found such
$u,v$). This proves Claim 2.]

With Claim 1 and 2 proved, we have solved Exercise \ref{exe.ent.prime.uv-u2}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.prime.pchoosek}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.prime.pchoosek}.]Both parts of Exercise
\ref{exe.ent.prime.pchoosek} are important results in number theory (see,
e.g., \cite[Corollary 5.6]{fleck} and \cite[Proposition 3.1]{fleck}). Let us
give two solutions:

\begin{proof}
[First solution to Exercise \ref{exe.ent.prime.pchoosek}.]\textbf{(a)} Let
$k\in\left\{  1,2,\ldots,p-1\right\}  $. Thus, $k\in\left\{  1,2,\ldots
,p-1\right\}  \subseteq\left\{  0,1,\ldots,p-1\right\}  $ and $p\equiv
0\operatorname{mod}p$. Hence, Exercise \ref{exe.ent.prime.achoosek} (applied
to $a=p$ and $b=0$) yields%
\begin{equation}
\dbinom{p}{k}\equiv\dbinom{0}{k}\operatorname{mod}p.
\label{sol.ent.prime.pchoosek.a.1st.1}%
\end{equation}


However, from $k\in\left\{  1,2,\ldots,p-1\right\}  $, we obtain $k\geq1>0$.
Hence, Proposition \ref{prop.binom.0} (applied to $n=0$) yields $\dbinom{0}%
{k}=0$. Thus, (\ref{sol.ent.prime.pchoosek.a.1st.1}) rewrites as $\dbinom
{p}{k}\equiv0\operatorname{mod}p$. In other words, $p\mid\dbinom{p}{k}$. This
solves Exercise \ref{exe.ent.prime.pchoosek} \textbf{(a)}.

\textbf{(b)} Let $k\in\left\{  0,1,\ldots,p-1\right\}  $. It is clear that
$\underbrace{p}_{\equiv0\operatorname{mod}p}-1\equiv0-1=-1\operatorname{mod}%
p$. Hence, Exercise \ref{exe.ent.prime.achoosek} (applied to $a=p-1$ and
$b=-1$) yields%
\[
\dbinom{p-1}{k}\equiv\dbinom{-1}{k}=\left(  -1\right)  ^{k}\operatorname{mod}%
p\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{eq.exa.binom.small.-1Ck})}\right)
.
\]
This solves Exercise \ref{exe.ent.prime.pchoosek} \textbf{(b)}.
\end{proof}

\begin{proof}
[Second solution to Exercise \ref{exe.ent.prime.pchoosek}.]\textbf{(a)} Let
$k\in\left\{  1,2,\ldots,p-1\right\}  $. Then, Exercise
\ref{exe.binom.gcd-integrality} \textbf{(b)} (applied to $n=p$ and $m=k$)
yields
\begin{equation}
\dfrac{\gcd\left(  p,k\right)  }{p}\dbinom{p}{k}\in\mathbb{Z}.
\label{sol.ent.prime.pchoosek.a.2nd.1}%
\end{equation}
However, $k$ is coprime to $p$ (by Proposition
\ref{prop.ent.prime.each-i-coprime}, applied to $i=k$). In other words,
$\gcd\left(  k,p\right)  =1$. Now, Proposition \ref{prop.ent.gcd.props1}
\textbf{(b)} (applied to $a=p$ and $b=k$) yields $\gcd\left(  p,k\right)
=\gcd\left(  k,p\right)  =1$. Hence, $\dfrac{\gcd\left(  p,k\right)  }%
{p}\dbinom{p}{k}=\dfrac{1}{p}\dbinom{p}{k}=\dfrac{\dbinom{p}{k}}{p}$. Thus,
(\ref{sol.ent.prime.pchoosek.a.2nd.1}) rewrites as follows:%
\[
\dfrac{\dbinom{p}{k}}{p}\in\mathbb{Z}.
\]
In other words, $p\mid\dbinom{p}{k}$. This solves Exercise
\ref{exe.ent.prime.pchoosek} \textbf{(a)} again.

\textbf{(b)} We proceed by induction on $k$:

\textit{Induction base:} We have $\dbinom{p-1}{0}=1$ (by
(\ref{eq.exa.binom.small.nC0}), applied to $n=p-1$) and $\left(  -1\right)
^{0}=1$. Thus, $\dbinom{p-1}{0}=1\equiv1=\left(  -1\right)  ^{0}%
\operatorname{mod}p$. In other words, Exercise \ref{exe.ent.prime.pchoosek}
\textbf{(b)} holds for $k=0$.

\textit{Induction step:} Let $m\in\left\{  1,2,\ldots,p-1\right\}  $. Assume
(as the induction hypothesis) that Exercise \ref{exe.ent.prime.pchoosek}
\textbf{(a)} holds for $k=m-1$. We must show that Exercise
\ref{exe.ent.prime.pchoosek} \textbf{(b)} holds for $k=m$.

We have assumed that Exercise \ref{exe.ent.prime.pchoosek} \textbf{(b)} holds
for $k=m-1$. In other words, $\dbinom{p-1}{m-1}\equiv\left(  -1\right)
^{m-1}\operatorname{mod}p$.

But Exercise \ref{exe.ent.prime.pchoosek} \textbf{(a)} (applied to $k=m$)
yields $p\mid\dbinom{p}{m}$. In other words, $\dbinom{p}{m}\equiv
0\operatorname{mod}p$. In view of%
\[
\dbinom{p}{m}=\dbinom{p-1}{m-1}+\dbinom{p-1}{m}\ \ \ \ \ \ \ \ \ \ \left(
\text{by Theorem \ref{thm.binom.rec}, applied to }n=p\text{ and }k=m\right)
,
\]
this rewrites as $\dbinom{p-1}{m-1}+\dbinom{p-1}{m}\equiv0\operatorname{mod}%
p$. In other words,%
\[
\dbinom{p-1}{m}\equiv-\underbrace{\dbinom{p-1}{m-1}}_{\equiv\left(  -1\right)
^{m-1}\operatorname{mod}p}\equiv-\left(  -1\right)  ^{m-1}=\left(  -1\right)
^{m}\operatorname{mod}p.
\]
In other words, Exercise \ref{exe.ent.prime.pchoosek} \textbf{(b)} holds for
$k=m$. This completes the induction step. Thus, Exercise
\ref{exe.ent.prime.pchoosek} \textbf{(b)} is solved (again).
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.prime.sum-ik-1}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.prime.sum-ik-1}.]Exercise
\ref{exe.ent.prime.sum-ik-1} is a classical and important fact (in particular,
it is the main tool in the proof of
\href{https://en.wikipedia.org/wiki/Chevalley-Warning_theorem#Proof_of_Warning's_theorem}{the
Chevalley--Warning theorem}). The following solution, which strategically uses
our Corollary \ref{cor.enum.maps.surj-cor}, is probably the
shortest:\footnote{See \cite[proof of Lemma 3.8]{lucascong} for a different
solution.}

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.sum-ik-1}.]From $k\in\left\{
0,1,\ldots,p-2\right\}  $, we obtain $k\leq p-2<p-1$. Hence, Corollary
\ref{cor.enum.maps.surj-cor} \textbf{(a)} (applied to $n=p-1$ and $m=k$)
yields%
\[
\sum_{i=0}^{p-1}\left(  -1\right)  ^{p-1-i}\dbinom{p-1}{i}i^{k}=0.
\]
However,
\begin{align*}
\sum_{i=0}^{p-1}\left(  -1\right)  ^{p-1-i}\underbrace{\dbinom{p-1}{i}%
}_{\substack{\equiv\left(  -1\right)  ^{i}\operatorname{mod}p\\\text{(by
Exercise \ref{exe.ent.prime.pchoosek} \textbf{(b)}}\\\text{(applied to
}i\text{ instead of }k\text{))}}}i^{k}  &  \equiv\sum_{i=0}^{p-1}%
\underbrace{\left(  -1\right)  ^{p-1-i}\left(  -1\right)  ^{i}}%
_{\substack{=\left(  -1\right)  ^{\left(  p-1-i\right)  +i}=\left(  -1\right)
^{p-1}\\\text{(since }\left(  p-1-i\right)  +i=p-1\text{)}}}i^{k}\\
&  =\sum_{i=0}^{p-1}\left(  -1\right)  ^{p-1}i^{k}=\left(  -1\right)
^{p-1}\sum_{i=0}^{p-1}i^{k},
\end{align*}
so that%
\[
\left(  -1\right)  ^{p-1}\sum_{i=0}^{p-1}i^{k}\equiv\sum_{i=0}^{p-1}\left(
-1\right)  ^{p-1-i}\dbinom{p-1}{i}i^{k}=0\operatorname{mod}p.
\]
Multiplying both sides of this congruence by $\left(  -1\right)  ^{p-1}$, we
find%
\[
\left(  -1\right)  ^{p-1}\left(  -1\right)  ^{p-1}\sum_{i=0}^{p-1}i^{k}%
\equiv\left(  -1\right)  ^{p-1}0=0\operatorname{mod}p.
\]
In view of
\[
\underbrace{\left(  -1\right)  ^{p-1}\left(  -1\right)  ^{p-1}}%
_{\substack{=\left(  \left(  -1\right)  ^{p-1}\right)  ^{2}=\left(  -1\right)
^{2\left(  p-1\right)  }=1\\\text{(since }2\left(  p-1\right)  \text{ is
even)}}}\sum_{i=0}^{p-1}i^{k}=\sum_{i=0}^{p-1}i^{k},
\]
this rewrites as $\sum_{i=0}^{p-1}i^{k}\equiv0\operatorname{mod}p$. This
solves Exercise \ref{exe.ent.prime.sum-ik-1}.
\end{proof}
\end{proof}

\subsubsection{Discussion of Exercise \ref{exe.ent.prime.mich12plus}}

\begin{proof}
[Discussion of Exercise \ref{exe.ent.prime.mich12plus}.]Exercise
\ref{exe.ent.prime.mich12plus} is Problem \#10501 \textbf{(b)} from the
American Mathematical Monthly (suggested by Roger B. Eggleton; see
\cite{EggWes98} for the solution); it also appears (in a fairly representative
particular case) as
\href{https://cms.math.ca/wp-content/uploads/crux-pdfs/CRUXv23n7.pdf}{problem
\#2175 in Crux Mathematicorum} (proposed by Christopher J. Bradley). See
\href{https://oeis.org/A063647}{OEIS Sequence A063647} for more references.

\begin{proof}
[Solution to Exercise \ref{exe.ent.prime.mich12plus}.]Let $U$ denote the set
of all pairs $\left(  j,k\right)  $ of positive integers satisfying $\dfrac
{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$. Then, $\left\vert U\right\vert $ is the \#
of such pairs. Thus, $\left\vert U\right\vert =u$ (since $u$ was defined to be
the \# of such pairs).

Let $V$ be the set of all integers $i\in\left[  n-1\right]  $ satisfying
$i\mid n^{2}$.

For each $\left(  j,k\right)  \in U$, we have $n-j\in V$%
\ \ \ \ \footnote{\textit{Proof.} Let $\left(  j,k\right)  \in U$. Thus,
$\left(  j,k\right)  $ is a pair of positive integers satisfying $\dfrac{1}%
{j}-\dfrac{1}{k}=\dfrac{1}{n}$ (by the definition of $U$). From $\dfrac{1}%
{j}-\dfrac{1}{k}=\dfrac{1}{n}$, we obtain $\dfrac{1}{j}-\dfrac{1}{k}-\dfrac
{1}{n}=0$. Now,%
\[
\left(  n-j\right)  \left(  n+k\right)  -n^{2}=kn-jn-jk=njk\underbrace{\left(
\dfrac{1}{j}-\dfrac{1}{k}-\dfrac{1}{n}\right)  }_{=0}=0.
\]
Hence, $\left(  n-j\right)  \left(  n+k\right)  =n^{2}$. Thus, $n-j\mid n^{2}$
(since $n-j$ and $n+k$ are integers). Moreover, $j\geq1$ (since $j$ is a
positive integer), so that $n-\underbrace{j}_{\geq1}\leq n-1$. On the other
hand, $n+k$ is a positive integer (since $n$ and $k$ are positive integers).
Hence, $n+k\neq0$. Thus, from $\left(  n-j\right)  \left(  n+k\right)  =n^{2}%
$, we obtain $n-j=\dfrac{n^{2}}{n+k}$. Thus, $n-j$ is positive (since $n$ and
$n+k$ are positive). Combining this with $n-j\leq n-1$, we obtain $0<n-j\leq
n-1$. Thus, $n-j\in\left\{  1,2,\ldots,n-1\right\}  $ (since $n-j$ is an
integer). In other words, $n-j\in\left[  n-1\right]  $ (since $\left[
n-1\right]  =\left\{  1,2,\ldots,n-1\right\}  $).
\par
We now know that $n-j$ is an integer and satisfies $n-j\in\left[  n-1\right]
$ and $n-j\mid n^{2}$. In other words, $n-j$ is an integer $i\in\left[
n-1\right]  $ satisfying $i\mid n^{2}$. In other words, $n-j\in V$ (since $V$
is the set of all integers $i\in\left[  n-1\right]  $ satisfying $i\mid n^{2}%
$). Qed.}. Hence, we can define a map%
\begin{align*}
f:U  &  \rightarrow V,\\
\left(  j,k\right)   &  \mapsto n-j.
\end{align*}
Consider this map $f$.

We shall now construct an inverse to this map $f$. Indeed, if $x\in V$, then
$\left(  n-x,\dfrac{n^{2}}{x}-n\right)  \in U$%
\ \ \ \ \footnote{\textit{Proof.} Let $x\in V$. Thus, $x$ is an integer
$i\in\left[  n-1\right]  $ satisfying $i\mid n^{2}$ (since $V$ was defined to
be the set of all such integers $i$). In other words, $x$ is an integer
satisfying $x\in\left[  n-1\right]  $ and $x\mid n^{2}$.
\par
From $x\in\left[  n-1\right]  =\left\{  1,2,\ldots,n-1\right\}  $, we obtain
$1\leq x\leq n-1$. Hence, $x\geq1>0$. Thus, $x\neq0$. Hence, from $x\mid
n^{2}$, we obtain $\dfrac{n^{2}}{x}\in\mathbb{Z}$. Hence, $\dfrac{n^{2}}%
{x}-n\in\mathbb{Z}$ as well (since $n\in\mathbb{Z}$). In other words,
$\dfrac{n^{2}}{x}-n$ is an integer.
\par
Moreover, $x\leq n-1<n$, so that $\dfrac{n^{2}}{x}>\dfrac{n^{2}}{n}$ (since
$n^{2}>0$ (because $n$ is positive)). Hence, $\dfrac{n^{2}}{x}>\dfrac{n^{2}%
}{n}=n$, so that $\dfrac{n^{2}}{x}-n>0$. Hence, $\dfrac{n^{2}}{x}-n$ is a
positive integer (since we already know that $\dfrac{n^{2}}{x}-n$ is an
integer). Also, $n-x>0$ (since $x<n$), so that $n-x$ is a positive integer
(since $n-x$ is an integer).
\par
Now, we know that $\left(  n-x,\dfrac{n^{2}}{x}-n\right)  $ is a pair of
positive integers (since $n-x$ and $\dfrac{n^{2}}{x}-n$ are positive integers)
satisfying $\dfrac{1}{n-x}-\dfrac{1}{\dfrac{n^{2}}{x}-n}=\dfrac{1}{n}$ (this
equality can be checked by a straightforward computation). In other words,
$\left(  n-x,\dfrac{n^{2}}{x}-n\right)  $ is a pair $\left(  j,k\right)  $ of
positive integers satisfying $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$. In
other words, $\left(  n-x,\dfrac{n^{2}}{x}-n\right)  \in U$ (since $U$ is the
set of all such pairs $\left(  j,k\right)  $). Qed.}. Hence, we can define a
map%
\begin{align*}
g:V  &  \rightarrow U,\\
x  &  \mapsto\left(  n-x,\dfrac{n^{2}}{x}-n\right)  .
\end{align*}
Consider this map $g$.

Now, $f\circ g=\operatorname*{id}$\ \ \ \ \footnote{\textit{Proof.} Let $x\in
V$. Then, the definition of $g$ yields $g\left(  x\right)  =\left(
n-x,\dfrac{n^{2}}{x}-n\right)  $. Applying the map $f$ to both sides of this
equality, we find%
\[
f\left(  g\left(  x\right)  \right)  =f\left(  \left(  n-x,\dfrac{n^{2}}%
{x}-n\right)  \right)  =n-\left(  n-x\right)  =x=\operatorname*{id}\left(
x\right)  .
\]
Hence, $\left(  f\circ g\right)  \left(  x\right)  =f\left(  g\left(
x\right)  \right)  =\operatorname*{id}\left(  x\right)  $.
\par
Forget that we fixed $x$. We thus have shown that $\left(  f\circ g\right)
\left(  x\right)  =\operatorname*{id}\left(  x\right)  $ for each $x\in V$. In
other words, $f\circ g=\operatorname*{id}$.} and $g\circ f=\operatorname*{id}%
$\ \ \ \ \footnote{\textit{Proof.} Let $y\in U$. Then, $y$ is a pair $\left(
j,k\right)  $ of positive integers satisfying $\dfrac{1}{j}-\dfrac{1}%
{k}=\dfrac{1}{n}$ (since $U$ is the set of all such pair $\left(  j,k\right)
$). Consider this $\left(  j,k\right)  $. Thus, $y=\left(  j,k\right)  $.
\par
Solving the equality $\dfrac{1}{j}-\dfrac{1}{k}=\dfrac{1}{n}$ for $k$, we
obtain
\begin{equation}
k=\dfrac{1}{\dfrac{1}{j}-\dfrac{1}{n}}=\dfrac{jn}{n-j}.
\label{sol.ent.prime.mich12plusv.fn-gf.1}%
\end{equation}
\par
Applying the map $g\circ f$ to both sides of the equality $y=\left(
j,k\right)  $, we obtain%
\begin{align*}
\left(  g\circ f\right)  \left(  y\right)   &  =\left(  g\circ f\right)
\left(  \left(  j,k\right)  \right)  =g\left(  \underbrace{f\left(
j,k\right)  }_{\substack{=n-j\\\text{(by the definition of }f\text{)}%
}}\right)  =g\left(  n-j\right) \\
&  =\left(  \underbrace{n-\left(  n-j\right)  }_{=j},\underbrace{\dfrac{n^{2}%
}{n-j}-n}_{\substack{=\dfrac{jn}{n-j}=k\\\text{(by
(\ref{sol.ent.prime.mich12plusv.fn-gf.1}))}}}\right)
\ \ \ \ \ \ \ \ \ \ \left(  \text{by the definition of }g\right) \\
&  =\left(  j,k\right)  =y=\operatorname*{id}\left(  y\right)  .
\end{align*}
\par
Forget that we fixed $y$. We thus have shown that $\left(  g\circ f\right)
\left(  y\right)  =\operatorname*{id}\left(  y\right)  $ for each $y\in U$. In
other words, $g\circ f=\operatorname*{id}$.}. Thus, the two maps $f$ and $g$
are mutually inverse. Hence, the map $f$ is invertible, i.e., is bijective. In
other words, $f$ is a bijection from $U$ to $V$. Hence, the bijection
principle yields $\left\vert U\right\vert =\left\vert V\right\vert $.

Now, recall that $\left\vert U\right\vert =u$. Hence,%
\[
u=\left\vert U\right\vert =\left\vert V\right\vert =\left(  \text{the \# of
all integers }i\in\left[  n-1\right]  \text{ satisfying }i\mid n^{2}\right)
\]
(since $V$ is the set of all integers $i\in\left[  n-1\right]  $ satisfying
$i\mid n^{2}$). This solves Exercise \ref{exe.ent.prime.mich12plus}.
\end{proof}

As an aside, it is easy to solve Exercise \ref{exe.ent.prime.mich12} again
using Exercise \ref{exe.ent.prime.mich12plus}. (We leave the details to the
mythical interested reader.)
\end{proof}

\bigskip

\newpage

\begin{thebibliography}{9999999999}                                                                                       %


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

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

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

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

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

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

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

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

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

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

\bibitem[18s-hw2s]{18s-hw2s}Darij Grinberg, \textit{UMN Spring 2018 Math 4707
homework set \#2 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw2s.pdf}

\bibitem[18s-hw3s]{18s-hw3s}Darij Grinberg, \textit{UMN Spring 2018 Math 4707
homework set \#3 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/18s/hw3s.pdf}

\bibitem[18s-mt1s]{18s-mt1s}Darij Grinberg, \textit{UMN Spring 2018 Math 4707
midterm \#1 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt1s.pdf}

\bibitem[18s-mt2s]{18s-mt2s}Darij Grinberg, \textit{UMN Spring 2018 Math 4707
midterm \#2 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/18s/mt2s.pdf}

\bibitem[19s]{19s}Darij Grinberg, \textit{Introduction to Modern Algebra (UMN
Spring 2019 Math 4281 notes)}, 1 October 2020.\newline\url{http://www.cip.ifi.lmu.de/~grinberg/t/19s/notes.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[19s-mt3s]{19s-mt3s}Darij Grinberg, \textit{UMN Spring 2019 Math 4281
midterm \#3 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19s/mt3s.pdf}

\bibitem[19fco]{19fco}Darij Grinberg, \textit{Enumerative Combinatorics
(Drexel Fall 2019 Math 222 notes)}, 18 September 2020.\newline\url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/n/n.pdf}

\bibitem[19fco-hw0s]{19fco-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[19fco-hw2s]{19fco-hw2s}Darij Grinberg, \textit{Drexel Fall 2019 Math
222 homework set \#2 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/hw2s.pdf}

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

\bibitem[19fco-mt2s]{19fco-mt2s}Darij Grinberg, \textit{Drexel Fall 2019 Math
222 midterm \#2 with solutions}, \url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/mt2s.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-57265-8}{Martin Aigner, G\"{u}nter M.
Ziegler, \textit{Proofs from the Book}, 6th edition, Springer 2018.}

\bibitem[AlCuHu16]{AlCuHu16}%
\href{https://doi.org/10.1007/s10801-015-0647-5}{Joshua Alman, Cesar Cuenca,
Jiaoyang Huang, \textit{Laurent phenomenon sequences}, Journal of Algebraic
Combinatorics \textbf{43} (2016), pp. 589--633}.

\bibitem[AleKur91]{AleKur91}P. Alekseev, L. Kurlyandchik, \textit{Summa
minimumov i minimum summy}, Kvant 1991/3, pp. 49--55.\newline\url{http://kvant.mccme.ru/1991/03/summa_minimumov_i_minimum_summ.htm}

\bibitem[AndAnd03]{AndAnd03}%
\href{https://ravuthleang12.files.wordpress.com/2013/08/360-problems-for-mathematical-contest.pdf}{Titu
Andreescu, Dorin Andrica, \textit{360 Problems for Mathematical Contests}, Gil
2003}.

\bibitem[AndAnd14]{AndAnd14}%
\href{https://content.sciendo.com/downloadpdf/journals/auom/22/3/article-p5.xml}{Titu
Andreescu, Dorin Andrica, \textit{Equations with Solution in Terms of
Fibonacci and Lucas Sequences}, An. St. Univ. Ovidius Constanta \textbf{22}
(3), 2014, pp. 5--12}.

\bibitem[AndCri17]{AndCri17}\href{https://bookstore.ams.org/xyz-25}{Titu
Andreescu, Vlad Crisan, \textit{Mathematical Induction: A powerful and elegant
method of proof}, XYZ Press 2017}.

\bibitem[AndDos10]{AndDos}\href{https://bookstore.ams.org/xyz-13}{Titu
Andreescu, Gabriel Dospinescu, \textit{Problems from the Book}, 2nd edition,
XYZ Press 2010}.

\bibitem[AndDos12]{AndDosS}\href{https://bookstore.ams.org/xyz-6}{Titu
Andreescu, Gabriel Dospinescu, \textit{Straight from the Book}, XYZ Press
2012}.

\bibitem[AndEne11]{AndEne11}%
\href{ftp://kubacki.waw.pl/Titu_Andreescu-Mathematical_Olympiad_Treasures.pdf}{Titu
Andreescu, Bogdan Enescu, \textit{Mathematical Olympiad Treasures}, 2nd
edition, Birkh\"{a}user 2011}.

\bibitem[AndEri04]{AndEri04}%
\href{https://doi.org/10.1017/CBO9781139167239}{George E. Andrews, Kimmo
Eriksson, \textit{Integer Partitions}, Cambridge University Press 2004}.

\bibitem[AndFen04]{AndFen04}%
\href{https://doi.org/10.1007/978-0-8176-8154-8}{Titu Andreescu, Zuming Feng,
\textit{A Path to Combinatorics for Undergraduates: Counting Strategies},
Springer 2004.}

\bibitem[AndTet18]{AndTet18}\href{https://bookstore.ams.org/xyz-31/}{Titu
Andreescu, Marian Tetiva, \textit{Sums and Products}, XYZ Press 2018}.

\bibitem[AnDoMu17]{AnDoMu17}\href{https://bookstore.ams.org/xyz-27/}{Titu
Andreescu, Gabriel Dospinescu, Oleg Mushkarov, \textit{Number Theory: Concepts
and Problems}, XYZ Press 2017}.

\bibitem[AnFeLe01]{AnFeLe01}%
\href{https://mathematicalolympiads.files.wordpress.com/2012/08/andreescu-contests-around-the-world-2000-2001.pdf}{Titu
Andreescu, Zuming Feng, George Lee, Jr. (eds.), \textit{Mathematical Olympiads
2000--2001: Problems and Solutions From Around the World}, MAA 2002}.

\bibitem[Armstro19]{Armstro19}Drew Armstrong, \textit{MTH 309: Discrete
Mathematics, Summer 2019}, 9 August 2019.\newline\url{https://www.math.miami.edu/~armstrong/309sum19.php}

\bibitem[Bartle15]{Bartle15}%
\href{https://web.math.ucsb.edu/~padraic/notes.html}{Padraic Bartlett,
\textit{various courses}, 2015}.

\bibitem[BecGeo10]{BecGeo10}Matthias Beck, Ross Geoghegan, \textit{The Art of
Proof: Basic Training for Deeper Mathematics}, Springer 2010.\newline\url{http://math.sfsu.edu/beck/aop.html}

\bibitem[BeDeQu11]{BeDeQu11}\href{https://doi.org/10.37236/2008}{Arthur T.
Benjamin, Halcyon Derks, Jennifer J. Quinn, \textit{The Combinatorialization
of Linear Recurrences}, The Electronic Journal of Combinatorics \textbf{18(2)}
(2011), \#P12}.

\bibitem[BenPlo08]{BenPlo08}%
\href{https://www.fq.math.ca/Papers1/46_47-1/Benjamin_11-08.pdf}{Arthur T.
Benjamin and Sean S. Plott, \textit{A combinatorial approach to Fibonomial
coefficients}, Fibonacci Quarterly \textbf{46/47}, issue 1, pp. 7--9}.

\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[BenQui08]{BenQui08}%
\href{https://math.hmc.edu/benjamin/wp-content/uploads/sites/5/2019/06/An-Alternate-Approach-to-Alternating-Sums.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[BiFoFo95]{BiFoFo95}Wang Zheng Bing, Robert Fokkink, Wan Fokkink,
\textit{A Relation Between Partitions and the Number of Divisors}, The
American Mathematical Monthly \textbf{102}, No. 4 (Apr., 1995), pp.
345--347.\newline\url{https://www.cs.vu.nl/~wanf/pubs/partition.pdf}

\bibitem[BMPrWe09]{BMPrWe09}\href{https://doi.org/10.37236/214}{Mireille
Bousquet-M\'{e}lou, James Propp, Julian West, \textit{Perfect matchings for
the three-term Gale-Robinson sequences}, The Electronic Journal of
Combinatorics \textbf{16} (2009), \#R125}.

\bibitem[Bogart17]{Bogart17}Kenneth P. Bogart, \textit{Combinatorics Through
Guided Discovery}, 2017.\newline\url{http://bogart.openmathbooks.org/}\newline
Solutions available at \url{https://math.dartmouth.edu/news-resources/electronic/kpbogart/FDL-bogart/kpbogart-FDL.tar.gz}

\bibitem[Bogomo19]{ctk}Alexander Bogomolny, \textit{Cut the Knot},
2019.\newline\url{https://www.cut-the-knot.org/}\newline Use
\href{https://web.archive.org/}{the Wayback Machine} for some links that have disappeared.

\bibitem[Bollob10]{Bollob10}%
\href{https://doi.org/10.1017/CBO9780511816574}{B\'{e}la Bollob\'{a}s,
\textit{The Art of Mathematics: Coffee Time in Memphis}, Cambridge University
Press, 3rd printing 2010.}

\bibitem[Bona17]{Bona17}\href{https://doi.org/10.1142/10258}{Mikl\'{o}s
B\'{o}na, \textit{A walk through combinatorics : an introduction to
enumeration and graph theory}, World Scientific 2017}.

\bibitem[BorMea16]{BorMea16}%
\href{https://doi.org/10.1007/s10801-016-0670-1}{Peter Borg, Karen Meagher,
\textit{The Katona cycle proof of the Erd\"{o}s--Ko--Rado theorem and its
possibilities}, Journal of Algebraic Combinatorics \textbf{43}(4), 915--939}.

\bibitem[Bossae20]{Bossae20}Jens Bossaert, \textit{Curiosa Mathematica}, 27
March 2020.\newline\url{https://users.ugent.be/~jebossae/docs/curiosa_2.pdf}

\bibitem[BoyDip12]{BoyDip12}William E. Boyce, Richard C. DiPrima,
\textit{Elementary Differential Equations}, 10th edition, Wiley 2012.

\bibitem[BraTho05]{BraTho05}David M. Bradley, Hugh Thomas, \textit{Peg Jumping
for Fun and Profit}, arXiv:math/0411275v2.\newline\url{https://arxiv.org/abs/math/0411275v2}

\bibitem[Brown20]{Brown20}K. S. Brown, \textit{A Quasi-Periodic Sequence}, 10
May 2020, MathPages.\newline\url{https://www.mathpages.com/home/kmath162/kmath162.htm}

\bibitem[Bruald09]{Bruald09}%
\href{https://newsite.kashanu.ac.ir/Files/IntroductoryCombinatorics.pdf}{Richard
A. Brualdi, \textit{Introductory Combinatorics}, 5th edition, Pearson 2009}.

\bibitem[Burton11]{Burton11}%
\href{https://cdchester.co.uk/wp-content/uploads/2018/02/david-m-burton-elementary-number-theory-mcgraw-hill-education-2010.pdf}{David
M. Burton, \textit{Elementary Number Theory}, 7th edition, McGraw-Hill 2011}.

\bibitem[Caminh18]{Caminh18}%
\href{https://doi.org/10.1007/978-3-319-77977-5}{Antonio Caminha Muniz Neto,
\textit{An Excursion through Elementary Mathematics, Volume III: Discrete
Mathematics and Polynomial Algebra}, Springer 2018}.

\bibitem[Carl17]{Carl17}%
\href{https://doi.org/10.1007/978-3-658-18250-2}{Merlin Carl, \textit{Wie
kommt man drauf? Einf\"{u}hrung in das mathematische Probleml\"{o}sen},
Springer 2017}.\newline See
\href{http://www.springer.com/cda/content/document/cda_downloaddocument/Zusatzmaterial.pdf?SGWID=0-0-45-1618128-p181063970}{the
Springer book page} for solutions and additional exercises.

\bibitem[CarSpe04]{CarSpe04}%
\href{https://www.combinatorics.org/ojs/index.php/eljc/article/view/v11i1r73}{Gabriel
D. Carroll, David Speyer, \textit{The Cube Recurrence}, The Electronic Journal
of Combinatorics \textbf{11} (2014), \#R73}.

\bibitem[ChaSed97]{ChaSed97}%
\href{https://www.jstor.org/stable/10.4169/j.ctt19b9mbq}{Gengzhe Chang, Thomas
W. Sederberg, \textit{Over and Over Again}, Anneli Lax New Mathematical
Library \textbf{39}, The Mathematical Association of America 1997}.

\bibitem[Chen08]{Chen08}%
\href{https://sms.math.nus.edu.sg/smsmedley/Vol-34-1/Andrews's argument proves a theorem of Zeckendorf (Kuo-Jye Chen).pdf}{Kuo-Jye
Chen, \textit{Andrews's argument proves a theorem of Zeckendorf}, Mathematical
Medley \textbf{34} (2008), no. 1, pp. 13--15.}

\bibitem[Chen20]{ChenEvan}Evan Chen, \textit{various notes and problem
collections on mathematical olympiads}, \url{https://web.evanchen.cc/} . See,
in particular, the OTIS Excerpts ( \url{https://web.evanchen.cc/excerpts.html} ).

\bibitem[Cirtoa06]{Cirtoa06}%
\href{https://cut-the-knot.org/arithmetic/algebra/VasileCirtoaje.pdf}{Vasile
Cirtoaje, \textit{Algebraic inequalities: old and new methods}, Gil, Zal\u{a}u
2006}.

\bibitem[ClaHef04]{ClaHef04}W. Edwin Clark, Jim Hefferon, \textit{Elementary
Number Theory}, 5 January 2004.\newline\url{http://joshua.smcvt.edu/numbertheory/book.pdf}

\bibitem[Cohen78]{Cohen78}Daniel I. A. Cohen, \textit{Basic techniques of
combinatorial theory}, John Wiley \& Sons 1978.

\bibitem[CoLiOs15]{CoLiOs15}%
\href{https://doi.org/10.1007/978-3-319-16721-3}{David A. Cox, John Little,
Donal O'Shea, \textit{Ideals, Varieties, and Algorithms: An Introduction to
Computational Algebraic Geometry and Commutative Algebra}, 4th edition,
Springer 2015}.

\bibitem[Comtet74]{Comtet74}%
\href{https://doi.org/10.1007/978-94-010-2196-8}{Louis Comtet,
\textit{Advanced Combinatorics: The Art of Finite and Infinite Expansions}, D.
Reidel Publishing Company, 1974.}

\bibitem[ConradE]{Conrad-Euler}Keith Conrad, \textit{Euler's theorem}.\newline\url{https://kconrad.math.uconn.edu/blurbs/ugradnumthy/eulerthm.pdf}

\bibitem[CorPer18]{CorPer18}\href{https://bookstore.ams.org/mbk-114/}{Scott
Corry, David Perkinson, \textit{Divisors and Sandpiles: An Introduction to
Chip-Firing}, AMS 2018}.\newline See
\url{https://web.archive.org/web/20180428212224/http://people.reed.edu/~davidp/divisors_and_sandpiles/draft_01.28.2018.pdf}
for a preprint.

\bibitem[CraPom05]{CraPom05}%
\href{https://doi.org/10.1007/0-387-28979-8}{Richard Crandall, Carl Pomerance,
\textit{Prime Numbers: A Computational Perspective}, 2nd edition, Springer
2005}.

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

\bibitem[Dijkst80]{Dijkst80}Edsger W. Dijkstra, \textit{On a theorem by Lambek
and Moser}, Report EWD753, 1980.\newline\url{https://www.cs.utexas.edu/users/EWD/ewd07xx/EWD753.PDF}

\bibitem[DJMP11]{IMOcomp}%
\href{http://mathksar.weebly.com/uploads/1/4/4/0/14403348/the-imo-compendium-1959_2009.pdf}{Dusan
Djukic, Vladimir Jankovic, Ivan Matic, Nikola Petrovic, \textit{The IMO
Compendium: A Collection of Problems Suggested for The International
Mathematical Olympiads: 1959-2009}, 2nd edition, Springer 2011}.\newline See
\url{https://www.imomath.com/index.php?options=350&lmm=0} for errata.

\bibitem[DLPS16]{DLPS16}Birgit van Dalen, Julian Lyczak, Quintijn Puite,
Merlijn Staps, \textit{Finaletraining Wiskunde Olympiade}, 21 November
2016.\newline\url{https://www.wiskundeolympiade.nl/phocadownload/finaletraining/finaletraining_binnenwerk_uitwerkingen.pdf}

\bibitem[DuaOli13]{DuaOli13}Rui Duarte, Ant\'{o}nio Guedes de Oliveira,
\textit{A short proof of a famous combinatorial identity},
arXiv:1307.6693v1.\newline\url{https://arxiv.org/abs/1307.6693v1}

\bibitem[Dudley12]{Dudley12}%
\href{https://www.isinj.com/mt-usamo/Elementary Number Theory - Underwood Dudley (2008).pdf}{Underwood
Dudley, \textit{Elementary Number Theory}, 2nd edition, Courier 2012}.

\bibitem[DynUsp06]{DynUsp06}E. B. Dynkin, V. A. Uspenskii,
\textit{Mathematical Conversations: Multicolor Problems, Problems in the
Theory of Numbers, and Random Walks}, Dover 2006.

\bibitem[Edward05]{Edwards-Essays}%
\href{https://doi.org/10.1007/b138656}{Harold M. Edwards, \textit{Essays in
Constructive Mathematics}, Springer 2005}.\newline See
\url{https://www.math.nyu.edu/faculty/edwardsh/eserrata.pdf} for errata.

\bibitem[EggWes98]{EggWes98}\href{https://doi.org/10.2307/2589730}{Roger B.
Eggleton, Western Maryland College Problems Group, \textit{AMM problem \#10501
with solution}, The American Mathematical Monthly, \textbf{105} (4), pp. 372}.

\bibitem[Elman20]{Elman20}Richard Elman, \textit{Lectures on Abstract
Algebra}, 28 September 2020.\newline\url{https://www.math.ucla.edu/~rse/algebra_book.pdf}

\bibitem[Emerso69]{Emerso69}%
\href{https://www.fq.math.ca/Scanned/7-3/emerson.pdf}{Edgar I. Emerson,
\textit{Recurrent sequences in the equation }$DQ^{2}=R^{2}+N$, Fibonacci
Quarterly \textbf{7} (1969), issue 3, pp. 231--242}.

\bibitem[Engel97]{Engel97}%
\href{https://doi.org/10.1017/CBO9780511574719}{Konrad Engel, \textit{Sperner
theory}, Cambridge University Press 1997}.

\bibitem[Engel98]{Engel}%
\href{https://mathematicalolympiads.files.wordpress.com/2012/08/75427434-problem-books-in-mathematics-problem-solving-strategies.pdf}{Arthur
Engel, \textit{Problem-Solving Strategies}, Springer 1998}.

\bibitem[ErdSze78]{ErdSze78}P. Erd\"{o}s, G. Szekeres, \textit{Some Number
Theoretic Problems on Binomial Coefficients}, Australian Math. Soc. Gazette
\textbf{5} (1978), pp. 97--99.\newline\url{http://bsmath.hu/~p_erdos/1978-46.pdf}

\bibitem[Euler190]{Euler190}%
\href{https://scholarlycommons.pacific.edu/euler-works/190/}{Leonhard Euler,
\textit{Consideratio quarumdam serierum, quae singularibus proprietatibus sunt
praeditae}, Novi Commentarii academiae scientiarum Petropolitanae \textbf{3},
pp. 86--108, Euler archive \#E190}.

\bibitem[Excali97]{Excali97}%
\href{https://www.math.ust.hk/excalibur/v4_n1.pdf}{Anon, \textit{A Proof of
The Lambek and Moser Theorem}, Mathematical Excalibur \textbf{4} (1),
1997--1998, p. 2}.

\bibitem[FinRos16]{FinRos16}%
\href{https://doi.org/10.1007/978-3-319-43875-7}{Benjamin Fine, Gerhard
Rosenberger, \textit{Number theory: An introduction via the distribution of
primes}, 2nd edition, Birkh\"{a}user 2016}.

\bibitem[FomZel02]{FomZel02}%
\href{https://doi.org/10.1006/aama.2001.0770}{Sergey Fomin, Andrei Zelevinsky,
\textit{The Laurent Phenomenon}, Advances in Applied Mathematics \textbf{28}
(2002), pp. 119--144.}

\bibitem[Foucar12]{Foucar12}Simon Foucart, \textit{Notes on Problem Solving},
2012.\newline\url{https://www.math.tamu.edu/~foucart/teaching/notes/PbSolving.pdf}

\bibitem[Frankl20]{Frankl20}\href{https://arxiv.org/abs/2011.14252v1}{Peter
Frankl, \textit{Old and new applications of Katona's circle},
arXiv:2011.14252v1}.

\bibitem[Gale98]{Gale98}\href{https://doi.org/10.1007/978-1-4612-2192-0}{David
Gale, \textit{Tracking the automatic ant and other mathematical explorations},
Springer 1998}.

\bibitem[GalQua20]{GalQua20}Jean Gallier and Jocelyn Quaintance,
\textit{Algebra, Topology, Differential Calculus, and Optimization Theory For
Computer Science and Engineering}, 22 March 2020.\newline\url{https://www.cis.upenn.edu/~jean/gbooks/geomath.html}

\bibitem[Galvin17]{Galvin17}David Galvin, \textit{Basic discrete mathematics},
13 December 2017.\newline%
\url{http://www-users.math.umn.edu/~dgrinber/comb/60610lectures2017-Galvin.pdf}
\newline(The URL might change, and the text may get updated. In order to
reliably obtain the version of 13 December 2017, you can use the archive.org
Wayback Machine:
\url{https://web.archive.org/web/20180205122609/http://www-users.math.umn.edu/~dgrinber/comb/60610lectures2017-Galvin.pdf}
.)

\bibitem[Galvin20]{Galvin20}David Galvin, \textit{Notre Dame Math 43900:
Problem Solving in Math}, lecture notes (work in progress),\newline%
\url{https://www3.nd.edu/~dgalvin1/43900/43900_F20/index.html} (follow the
overleaf link, once there allow javascript and note the \textquotedblleft
Download PDF\textquotedblright\ button).

\bibitem[Gardne91]{Gardne91}Martin Gardner, \textit{Fractal Music, Hypercards
and More...}, W. H. Freeman \& Co. 1991.

\bibitem[GelAnd17]{GelAnd}%
\href{https://doi.org/10.1007/978-3-319-58988-6}{R\u{a}zvan Gelca, Titu
Andreescu, \textit{Putnam and Beyond}, 2nd edition, Springer 2017}.

\bibitem[Golomb76]{Golomb76}%
\href{https://doi.org/10.1080/0025570X.1976.11976573}{Solomon W. Golomb,
\textit{The \textquotedblleft Sales Tax\textquotedblright\ Theorem},
Mathematics Magazine \textbf{49} (1976), no. 4, pp. 187--189}.

\bibitem[GolTch83]{GolTch83}%
\href{https://doi.org/10.1016/0165-4896(83)90023-9}{E. Goles, M. Tchuente,
\textit{Iterative behaviour of generalized majority functions}, Mathematical
Social Sciences \textbf{4} (1983), pp. 197--204}.

\bibitem[Goodma15]{Goodman}Frederick M. Goodman, \textit{Algebra: Abstract and
Concrete}, edition 2.6, 1 May 2015.\newline%
\url{http://homepage.math.uiowa.edu/~goodman/algebrabook.dir/book.2.6.pdf} .

\bibitem[Gould72]{Gould72}\href{https://www.fq.math.ca/10-6.html}{H. W. Gould,
\textit{A new greatest common divisor property of the binomial coefficients},
Fibonacci Quarterly \textbf{10} (1972), issue 6, pp. 579--584 and 628, errata
in \textbf{11} (1973), issue 2, p. 168}.

\bibitem[Granvi05]{Granvi05}Andrew Granville, \textit{Binomial coefficients
modulo prime powers}, preprint.\newline\url{https://web.archive.org/web/20181024055320/http://ebooks.bharathuniv.ac.in/gdlc1/gdlc1/Engineering Merged Library v3.0/Andrew Granville/Binomial Coefficients Modulo Prime Powers (5579)/Binomial Coefficients Modulo Prime Powers - Andrew Granville.pdf}

\bibitem[Grinbe07]{Grinbe-vor-schur}Darij Grinberg, \textit{The Vornicu-Schur
inequality and its variations}, 13 August 2007.\newline\url{http://www.cip.ifi.lmu.de/~grinberg/VornicuS.pdf}

\bibitem[Grinbe08]{ngrin}Natalia Grinberg, \textit{L\"{o}sungsstrategien:
Mathematik f\"{u}r Nachdenker}, Harri Deutsch 2008.

\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]{floor}%
\href{https://www.cip.ifi.lmu.de/~grinberg/floor.pdf}{Darij Grinberg,
\textit{18.781 (Spring 2016): Floor and arithmetic functions}, 13 April 2019}.

\bibitem[Grinbe18]{Gri-zecke}\href{https://arxiv.org/abs/1103.4507v2}{Darij
Grinberg, \textit{Zeckendorf family identities generalized},
arXiv:1103.4507v2, 10 June 2018}.

\bibitem[Grinbe19a]{lucascong}%
\href{https://www.cip.ifi.lmu.de/~grinberg/lucascong.pdf}{Darij Grinberg,
\textit{The Lucas and Babbage congruences}, 10 January 2019}.

\bibitem[Grinbe19b]{mse2779502}Darij Grinberg, \textit{math.stackexchange
answer \#2786815 (answer to \textquotedblleft The selection of a linear
recurrent sequence over the field is LRS too\textquotedblright)}, Mathematics
Stack Exchange.\newline\url{https://math.stackexchange.com/q/2786815}

\bibitem[Grinbe19c]{fleck}%
\href{https://www.cip.ifi.lmu.de/~grinberg/fleck.pdf}{Darij Grinberg,
\textit{Fleck's binomial congruence using circulant matrices}, 14 July 2019}.

\bibitem[GriSne07]{GriSne07}%
\href{https://math.dartmouth.edu/~prob/prob/prob.pdf}{Charles M. Grinstead, J.
Laurie Snell, \textit{Introduction to Probability}, 2nd edition, 4 July 2006}.

\bibitem[GrKnPa94]{GKP}%
\href{https://www.csie.ntu.edu.tw/~r97002/temp/Concrete Mathematics 2e.pdf}{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[Guicha20]{Guicha20}David Guichard, \textit{An Introduction to
Combinatorics and Graph Theory}, 30 January 2020.\newline\url{https://www.whitman.edu/mathematics/cgt_online/book/}

\bibitem[Gunder10]{Gunder10}%
\href{https://www.routledge.com/Handbook-of-Mathematical-Induction-Theory-and-Applications/Gunderson/p/book/9781138199019}{David
S. Gunderson, \textit{Handbook of Mathematical Induction: Theory and
Applications}, CRC Press 2010}.

\bibitem[Hadama09]{Hadam09}Jacques Hadamard, \textit{Lessons in Geometry: I.
Plane Geometry}, AMS 2008.\newline\url{https://bookstore.ams.org/mbk-57}

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

\bibitem[Harju11]{Harju11}Tero Harju, \textit{Lecture Notes in Combinatorial
Enumeration}, 12 June 2016.\newline\url{https://users.utu.fi/harju/combinenum/combinenum11.htm}

\bibitem[Heffer20]{Heffer20}Jim Hefferon, \textit{Linear Algebra}, 4th edition
2020.\newline\url{http://joshua.smcvt.edu/linearalgebra}

\bibitem[Hender16]{Hender16}Nik Henderson, \textit{What is Zeckendorf's
Theorem?}, 23 July 2016.\newline\url{https://math.osu.edu/sites/math.osu.edu/files/henderson_zeckendorf.pdf}

\bibitem[HilHog72]{HilHog72}\href{https://www.fq.math.ca/10-6.html}{A. P.
Hillman and V. E. Hoggatt, Jr., \textit{A Proof of Gould's Pascal Hexagon
Conjecture}, Fibonacci Quarterly \textbf{10} (1972), issue 6, pp. 579--584 and
598}.

\bibitem[Hoggat72]{Hoggat72}%
\href{https://www.fq.math.ca/Scanned/10-1/hoggatt2.pdf}{V. E. Hoggatt, Jr.,
\textit{Generalized Zeckendorf theorem}, Fibonacci Quarterly \textbf{10}
(1972), issue 1, pp. 89--93}.

\bibitem[Honsbe12]{Honsbe12}%
\href{https://www.jstor.org/stable/10.4169/j.ctt19b9m2k}{Ross Honsberger,
\textit{Episodes in Nineteenth and Twentieth Century Euclidean Geometry}, MAA
2012}.

\bibitem[Honsbe70]{Honsbe70}Ross Honsberger, \textit{Ingenuity in
Mathematics}, MAA 1970.

\bibitem[Hung07]{Hung07}%
\href{http://refkol.ro/matek/mathbooks/!Books!/Secrets in Inequalities (volume 1) Pham Kim Hung.pdf}{Pham
Kim Hung, \textit{Secrets in Inequalities, volume 1}, GIL 2007}.

\bibitem[Ivanov08]{Ivanov08}Nikolai V. Ivanov, \textit{Linear Recurrences}, 17
January 2008.\newline\url{https://nikolaivivanov.files.wordpress.com/2014/02/ivanov2008arecurrence.pdf}

\bibitem[Ivanov18]{Ivanov18}\href{http://www.ams.org/books/nml/052/}{O. A.
Ivanov, \textit{Portal through Mathematics}, Anneli Lax New Mathematical
Library \textbf{52}, MAA Press 2018}.

\bibitem[Jarvin20]{Jarvin20}Olli J\"{a}rviniemi, \textit{Ollin Opas
Olympiatason Ongelmanratkaisuun}, 9 November 2020.\newline\url{https://matematiikkakilpailut.fi/kirjallisuus/OOOO.pdf}

\bibitem[Jones75]{Jones75}%
\href{https://www.fq.math.ca/Scanned/13-1/jones.pdf}{James P. Jones,
\textit{Diophantine Representation of the Fibonacci numbers}, Fibonacci
Quarterly \textbf{13} (1975), issue 1, pp. 84--88}.

\bibitem[Joyce17]{Joyce17}David Joyce, \textit{Introduction to Modern
Algebra}, 5 December 2017.\newline\url{https://mathcs.clarku.edu/~djoyce/ma225/algebra.pdf}

\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[Jukna11]{Jukna11}%
\href{https://doi.org/10.1007/978-3-642-17364-6}{Stasys Jukna,
\textit{Extremal Combinatorics with Applications in Computer Science}, 2nd
edition, Springer 2011}.\newline See
\url{http://www.thi.informatik.uni-frankfurt.de/~jukna/EC_Book_2nd/index.html}
for a draft and errata.

\bibitem[Kamp15]{Kamp15}%
\href{https://doi.org/10.1080/10236198.2015.1113272}{Peter H. van der Kamp,
\textit{Somos-4 and Somos-5 are arithmetic divisibility sequences}, Journal of
Difference Equations and Applications \textbf{22} (2016), issue 4}. See
\href{https://arxiv.org/abs/1505.00194v1}{arXiv:1505.00194v1} for a preprint.

\bibitem[Kedlay20]{Kedlay20}Kiran Kedlaya et al., \textit{The Putnam archive},
2020.\newline\url{https://kskedlaya.org/putnam-archive/}

\bibitem[Klivan18]{Klivan18}%
\href{http://www.dam.brown.edu/people/cklivans/chipfiring.html}{Caroline J.
Klivans, \textit{The Mathematics of Chip-Firing}, CRC Press 2018}.

\bibitem[Knapp16]{Knapp1}Anthony W. Knapp, \textit{Basic Algebra}, digital
second edition 2016.\newline\url{http://www.math.stonybrook.edu/~aknapp/download.html}

\bibitem[LamMos54]{LamMos54}\href{https://doi.org/10.2307/2308078}{Joachim
Lambek, Leo Moser, \textit{Inverse and Complementary Sequences of Natural
Numbers}, The American Mathematical Monthly, \textbf{61} (7), Aug-Sep 1954,
pp. 454--458}.

\bibitem[Larson83]{Larson83}%
\href{https://doi.org/10.1007/978-1-4612-5498-0}{Loren C. Larson,
\textit{Problem-Solving Through Problems}, Springer 1983}.

\bibitem[Lee07]{Lee07}Hojoo Lee, \textit{Topics in Inequalities: Theorems and
Techniques}, 8 August 2007.\newline\url{https://www.isinj.com/mt-usamo/Topics in Inequalities 1st edition - Hojoo Lee (2007).pdf}

\bibitem[LeeShi19]{LeeShi19}%
\href{https://doi.org/10.11568/kjm.2019.27.2.525}{Jonghyeon Lee, Heesung Shin,
\textit{The chromatic polynomial for cycle graphs}, Korean J. Math.
\textbf{27}, No 2 (2019) pp. 525--534},
\href{https://arxiv.org/abs/1907.04320v1}{arXiv:1907.04320v1}.

\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[LeLoPo08]{infinity}Hojoo Lee, Tom Lovering, and Cosmin Pohoata,
\textit{Infinity}, 19 October 2008.\newline\url{http://prac.im.pwr.wroc.pl/~kwasnicki/pl/o/infinity.pdf}

\bibitem[Lengye06]{Lengye06}%
\href{https://www.fq.math.ca/Papers1/44-4/quarttamas04_2006.pdf}{Tam\'{a}s
Lengyel, \textit{A counting based proof of the generalized Zeckendorf's
theorem}, Fibonacci Quarterly \textbf{44} (2006), issue 4, pp. 324--325.}

\bibitem[Liu68]{Liu68}C. L. Liu, \textit{Introduction to Combinatorial
Mathematics}, McGraw--Hill 1968.

\bibitem[Liu85]{Liu85}C. L. Liu, \textit{Elements of discrete mathematics},
2nd edition, McGraw--Hill 1985.

\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[Loehr19]{Loehr-proofs}Nicholas A. Loehr, \textit{An Introduction to
Mathematical Proofs}, CRC Press 2020.\newline See
\url{https://personal.math.vt.edu/nloehr/prfbook.html} for errata and solutions.

\bibitem[Macgil17]{Macgil17}Gary MacGillivray, \textit{Discrete Math Study
Materials}, 2017.\newline\url{https://www.math.uvic.ca/faculty/gmacgill/guide/index.html}

\bibitem[Malouf92]{Malouf92}%
\href{https://doi.org/10.1016/0012-365X(92)90714-Q}{Janice L. Malouf,
\textit{An integer sequence from a rational recursion}, Discrete Mathematics
\textbf{110} (1992), pp. 257--261}.

\bibitem[Markus83]{Markus83}%
\href{https://archive.org/details/recursion-sequences}{Aleksei Ivanovich
Markushevich, \textit{Recursion sequences}, Mir Publishers, Moscow, 2nd
printing 1983}.

\bibitem[Mazur10]{Mazur10}\href{https://bookstore.ams.org/text-17}{David R.
Mazur, \textit{Combinatorics: A Guided Tour}, MAA 2010}.

\bibitem[Mcclea17]{Mcclea17}\href{https://bookstore.ams.org/nml-50/}{John
McCleary, \textit{Exercises in (Mathematical) Style: Stories of Binomial
Coefficients}, 2nd printing, MAA Press 2018}.

\bibitem[Melian01]{Melian01}Mar\'{\i}a Victoria Meli\'{a}n, \textit{Linear
recurrence relations with constant coefficients}, 9 April 2001.\newline\url{http://matematicas.uam.es/~mavi.melian/CURSO_15_16/web_Discreta/recurrence.pdf}

\bibitem[MerJoh19]{MerJoh19}%
\href{https://doi.org/10.1080/00029890.2019.1642074}{Mircea Merca, Warren P.
Johnson, \textit{American Mathematical Monthly problem \#12022 with solution},
The American Mathematical Monthly, 126:8 (2019), pp. 755--763}.

\bibitem[Mildor06]{Mildor06}Thomas J. Mildorf, \textit{Olympiad Inequalities},
4 August 2006.\newline\url{https://www.isinj.com/mt-usamo/Olympiad Inequalities - Thomas Mildorf (2006).pdf}

\bibitem[Narkie00]{Narkie00}%
\href{https://doi.org/10.1007/978-3-662-13157-2}{W\l adys\l aw Narkiewicz,
\textit{The Development of Prime Number Theory: From Euclid to Hardy and
Littlewood}, Springer 2000}.

\bibitem[Neale17]{Neale17}%
\href{http://people.maths.ox.ac.uk/neale/ClosingtheGap.html}{Vicky Neale,
\textit{Closing the Gap: The Quest to Understand Prime Numbers}, Oxford
University Press 2017}.

\bibitem[Negut05]{Negut05}%
\href{https://darithmathblog.files.wordpress.com/2017/01/problems_for_the_mathematical_olympiads__andrei_negut.pdf}{Andrei
Negut, \textit{Problems for the Mathematical Olympiads}, Gil 2005}.

\bibitem[Newste20]{Newste20}Clive Newstead, \textit{An Infinite Descent into
Pure Mathematics}, version 0.5 preview, 26 September 2020.\newline\url{https://infinitedescent.xyz}

\bibitem[NiZuMo91]{NiZuMo91}Ivan Niven, Herbert S. Zuckerman, Hugh L.
Montgomery, \textit{An Introduction to the Theory of Numbers}, 5th edition,
Wiley 1991.\newline See
\url{http://www-personal.umich.edu/~hlm/nzm/index.html} for errata and supplements.

\bibitem[Pak10]{Pak10}Igor Pak, \textit{Lectures on Discrete and Polyhedral
Geometry}, 20 April 2010.\newline\url{https://www.math.ucla.edu/~pak/geompol8.pdf}

\bibitem[Parvar11]{Parvar11}Amir Hossein Parvardi, \textit{Lifting The
Exponent Lemma (LTE)}, version 6, 7 April 2011.\newline\url{https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.221.5543}

\bibitem[PeWiZe97]{PeWiZe97}Marko Petkov\v{s}ek, Herbert S. Wilf, Doron
Zeilberger, \textit{A=B}, 27 April 1997, A.K. Peters 1996.\newline\url{https://www.math.upenn.edu/~wilf/AeqB.html}

\bibitem[PolSze78]{PolSze78}%
\href{https://doi.org/10.1007/978-3-642-61983-0}{George P\'{o}lya, Gabor
Szeg\H{o}, \textit{Problems and Theorems in Analysis I}, Springer 1978
(reprinted 1998)}.

\bibitem[Polya73]{Polya73}%
\href{http://www.im.ufrj.br/~monica/funcoes/Polya.pdf}{George Polya,
\textit{How to Solve It: A New Aspect of Mathematical Method}, Princeton
University Press, 2nd edition 1973}.

\bibitem[Polya81]{Polya81}%
\href{https://www.isinj.com/mt-usamo/Mathematical Discovery Polya (1981, Wiley).pdf}{George
Polya, \textit{Mathematical Discovery}, combined edition, John Wiley \& Sons
1981}.

\bibitem[Poorte04]{Poorte04}\href{https://arxiv.org/abs/math/0403225v3}{Alfred
J. van der Poorten, \textit{Elliptic curves and continued fractions},
arXiv:math/0403225v3}.

\bibitem[Riorda68]{Riorda68}John Riordan, \textit{Combinatorial Identities},
Robert E. Krieger Publishing Company, Huntington, NY 1979.

\bibitem[RitHee13]{RitHee13}%
\href{https://biblio.ugent.be/publication/4115264/file/4115265.pdf}{Beno\^{\i}t
Rittaud, Albrecht Heeffer, \textit{The Pigeonhole Principle, Two Centuries
Before Dirichlet}, The Mathematical Intelligencer, 36(2), pp. 27--29}.

\bibitem[Rivlin90]{Rivlin90}Theodore J. Rivlin, \textit{Chebyshev Polynomials:
From Approximation Theory to Algebra and Number Theory}, 2nd edition, Wiley 1990.

\bibitem[Russel16]{Russel16}%
\href{https://rucore.libraries.rutgers.edu/rutgers-lib/50145/}{Matthew
Christopher Russell, \textit{Using experimental mathematics to conjecture and
prove theorems in the theory of partitions and commutative and non-commutative
recurrences}, PhD thesis at Rutgers University, 2016}.

\bibitem[Schole05]{kalva}John Scholes aka kalva, \textit{Maths problems}, ca.
2005.\newline The original site is no longer available, but parts of it have
been archived in several places:\newline%
\url{https://webee.technion.ac.il/people/aditya/www.kalva.demon.co.uk/}\newline%
\url{https://prase.cz/kalva/putnam.html}\newline%
\url{https://web.archive.org/web/20070930165736/http://www.kalva.demon.co.uk/}\newline%
\url{https://web.archive.org/web/20020927115327/http://www.kalva.demon.co.uk/}

\bibitem[Shapir76]{Shapir76}%
\href{https://doi.org/10.1016/0012-365X(76)90009-1}{L. W. Shapiro, \textit{A
Catalan triangle}, Discrete Mathematics \textbf{14} (1976), pp. 83--90}.

\bibitem[ShChYa62]{ShChYa62}%
\href{https://www.isinj.com/mt-usamo/USSR Olympiad Problem Book (The) - Shklasrsky, Chentzov, and Yaglom (1993, Dover) (1-1).pdf}{David
Oskarovich Shklarsky, Nikolai Nikolaevich Chentzov, Isaak Moiseevich Yaglom,
\textit{The USSR Olympiad Problem Book}, Freeman 1962 (reprinted by Dover
1993)}.

\bibitem[Smid09]{Smid09}Vita Smid, \textit{Inclusion-Exclusion Principle:
Proof by Mathematical Induction}, 2 December 2009.\newline\url{https://faculty.math.illinois.edu/~nirobles/files453/iep_proof.pdf}

\bibitem[SpeStu09]{SpeStu09}%
\href{https://math.berkeley.edu/~bernd/mathmag.pdf}{David Speyer, Bernd
Sturmfels, \textit{Tropical Mathematics}, Mathematics Magazine \textbf{82}
(2009), pp. 163--173}.

\bibitem[Spivey19]{Spivey19}%
\href{https://www.routledge.com/The-Art-of-Proving-Binomial-Identities/Spivey/p/book/9780815379423}{Michael
Z. Spivey, \textit{The Art of Proving Binomial Identities}, CRC Press 2019}.

\bibitem[SpQuBa20]{SpQuBa20}%
\href{https://doi.org/10.1007/978-3-662-61166-1}{Eckard Specht, Erhard
Quaisser, Patrick Bauermann, \textit{50 Jahre Bundeswettbewerb Mathematik: Die
sch\"{o}nsten Aufgaben}, 2te Auflage, Springer 2020}.

\bibitem[Stanle01]{Stanley-EC2}Richard P. Stanley, \textit{Enumerative
Combinatorics, volume 2}, Cambridge University Press 2001.\newline See
\url{http://math.mit.edu/~rstan/ec/} for errata.

\bibitem[Stanle11]{Stanley-EC1}Richard P. Stanley, \textit{Enumerative
Combinatorics, volume 1}, Second edition, version of 15 July 2011. Available
at \url{http://math.mit.edu/~rstan/ec/} .\newline See
\url{http://math.mit.edu/~rstan/ec/} for errata.

\bibitem[Stanle15]{Stanley-Cat}%
\href{https://doi.org/10.1017/CBO9781139871495}{Richard P. Stanley,
\textit{Catalan Numbers}, 1st edition, Cambridge University Press 2015}.

\bibitem[Steele04]{Steele04}%
\href{http://www.ma.huji.ac.il/~ehudf/courses/Ineq09/The Cauchy-Schwarz Master Class .pdf}{J.
Michael Steele, \textit{The Cauchy--Schwarz Master Class: An Introduction to
the Art of Mathematical Inequalities}, Cambridge University Press
2004}.\newline See
\url{http://www-stat.wharton.upenn.edu/~steele/Publications/Books/CSMC/CSMC_Errata.pdf}
for errata.

\bibitem[Stein09]{Stein09}\href{https://doi.org/10.1007/b13279}{William Stein,
\textit{Elementary Number Theory: Primes, Congruences, and Secrets}, Springer
2009}.

\bibitem[Steinb06]{Steinb06}Mark Steinberger, \textit{Algebra}, 31 August
2006.\newline\url{https://web.archive.org/web/20180821125315/https://www.albany.edu/~mark/algebra.pdf}

\bibitem[Strasz65]{Strasz65}%
\href{https://www.isinj.com/mt-usamo/Mathematical Problems and Puzzles from the Polish Mathematical Olympiads - Straszewicz (1965).pdf}{S.
Straszewicz, \textit{Mathematical Puzzles and Problems from the Polish
Mathematical Olympiads}, Pergamon Press 1965}.

\bibitem[Strick20]{Strick20}Neil Strickland, \textit{Linear mathematics for
applications}, 11 February 2020.\newline\url{https://neilstrickland.github.io/linear_maths/notes/linear_maths.pdf}

\bibitem[Suksom20]{Suksom20}%
\href{https://doi.org/10.1080/0025570X.2020.1790966}{Warut Suksompong,
\textit{Graph Cycles and Olympiad Problems}, Mathematics Magazine \textbf{93}
(2020), pp. 284--287}.

\bibitem[Sved84]{Sved84}\href{https://doi.org/10.1007/BF03026737}{Marta Sved,
\textit{Counting and Recounting: The Aftermath}, The Mathematical
Intelligencer \textbf{6} (1984), no. 2, pp. 44--45}.

\bibitem[Swanso20]{Swanso20}Irene Swanson, \textit{Introduction with Analysis
with Complex Numbers}, 2020.\newline\url{https://web.archive.org/web/20201012174324/https://people.reed.edu/~iswanson/analysisconstructR.pdf}

\bibitem[TAoCP3]{TAoCP3}Donald A. Knuth, \textit{The Art of Computer
Programming, volume 3: Sorting and Searching}, 2nd edition, Addison--Wesley
1998.\newline See \url{https://www-cs-faculty.stanford.edu/~knuth/taocp.html}
for errata.

\bibitem[TAoCP4A]{TAoCP4A}Donald A. Knuth, \textit{The Art of Computer
Programming, volume 4A: Combinatorial Algorithms, Part 1}, Addison--Wesley
2011.\newline See \url{https://www-cs-faculty.stanford.edu/~knuth/taocp.html}
for errata.

\bibitem[TatWin05]{TatWin05}%
\href{https://www.math.ust.hk/excalibur/v10_n4.pdf}{Leung Tat-Wing,
\textit{The Method of Infinite Descent}, Mathematical Excalibur \textbf{10}
(2005), nr. 4}.

\bibitem[Tomesc85]{Tomesc85}%
\href{http://www.mateinfo.net/_files/downloads/tomescu.pdf}{Ioan Tomescu,
\textit{Problems in Combinatorics and Graph Theory}, translated by Robert A.
Melter, John Wiley \& Sons 1985}.

\bibitem[UspHea39]{UspHea39}J. V. Uspensky, M. A. Heaslet, \textit{Elementary
Number Theory}, 1st edition, McGraw-Hill 1939.\newline See
\url{https://projecteuclid.org/euclid.bams/1183502492} for some corrections.

\bibitem[VelWag20]{VelWag20}Daniel J. Velleman, Stan Wagon, \textit{Bicycle or
Unicycle? A Collection of Intriguing Mathematical Puzzles}, AMS/MAA Problem
Books \textbf{36}, MAA Press 2020.

\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)}.

\bibitem[Wagner05]{Wagner05}Carl G. Wagner, \textit{Basic Combinatorics}, 14
February 2005.\newline\url{http://www.math.utk.edu/~wagner/papers/comb.pdf}

\bibitem[Wagner08]{Wagner08}David G. Wagner, \textit{C\&O 330: Introduction to
Combinatorial Enumeration}, 9 August 2008.\newline\url{https://web.archive.org/web/20110124001354/http://www.math.uwaterloo.ca/~dgwagner/MATH249/co330.pdf}

\bibitem[Walker87]{Walker87}%
\href{https://web.archive.org/web/20170809055317/https://www.math.nmsu.edu/~elbert/AbsAlgeb.pdf}{Elbert
A. Walker, \textit{Introduction to Abstract Algebra}, Random House/Birkhauser,
New York, 1987.}

\bibitem[Wallis85]{Wallis85}%
\href{https://echo.mpiwg-berlin.mpg.de/ECHOdocuView?url=/permanent/library/H3GRV5AU/}{John
Wallis, \textit{A Treatise of Algebra}, London 1685}.

\bibitem[Wemyss14]{Wemyss14}Michael Wemyss, \textit{A very elementary proof
that the Somos 5 sequence is integer valued}, 28 April 2014.\newline\url{https://www.maths.gla.ac.uk/~mwemyss/Somos5proof.pdf}

\bibitem[White10a]{White-chrom}Dennis White, \textit{Math 4707: Chromatic
Polynomials}, 3 November 2010.\newline\url{http://www-users.math.umn.edu/~reiner/Classes/Chromatic.pdf}

\bibitem[White10b]{White10}Dennis White, \textit{Math 4707:
Inclusion-Exclusion and Derangements}, 18 October 2010.\newline\url{http://www-users.math.umn.edu/~reiner/Classes/Derangements.pdf}

\bibitem[YagYag64]{YagYag64}Akiva M.\ Yaglom, Isaac M. Yaglom,
\textit{Challenging Mathematical Problems with Elementary Solutions, volume I:
Combinatorial Analysis and Probability Theory}, Holden-Day 1964 (reprinted by
Dover 1987).

\bibitem[YagYag67]{YagYag67}Akiva M.\ Yaglom, Isaac M. Yaglom,
\textit{Challenging Mathematical Problems with Elementary Solutions, volume
II: Problems from Various Branches of Mathematics}, Holden-Day 1967 (reprinted
by Dover 1987).

\bibitem[Yiu12]{Yiu12}Paul Yiu, \textit{Problem Solving and Recreational
Mathematics}, 2 August 2012.\newline\url{http://math.fau.edu/Yiu/Oldwebsites/PSRM2012/00PSRM2012Chapters1to44.pdf}

\bibitem[Zagier96]{Zagier96}Don Zagier, \textit{Problems posed at the St
Andrews Colloquium, 1996}.\newline\url{http://www-groups.mcs.st-andrews.ac.uk/~john/Zagier/Problems.html}

\bibitem[ZawHit09]{ZawHit09}%
\href{https://darithmathblog.files.wordpress.com/2017/04/a-primer-for-math-competition.pdf}{Alexander
Zawaira, Gavin Hitchcock, \textit{A Primer for Mathematics Competitions},
Oxford University Press 2009}.

\bibitem[Zeitz17]{Zeitz17}Paul Zeitz, \textit{The Art and Craft of Problem
Solving}, 3rd edition, Wiley 2017.

\bibitem[Zhao20]{Zhao}Yufei Zhao, \textit{Math Olympiad training handouts},
\url{https://yufeizhao.com/olympiad/} .

\bibitem[Zill17]{Zill17}Dennis G. Zill, \textit{A First Course in Differential
Equations with Modeling Applications}, Cengage 2017.
\end{thebibliography}


\end{document}