\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{ytableau}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Monday, November 13, 2023 21:58:00}
%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}}
\iffalse
\NOEXPAND{\today}{\today}
\NOEXPAND{\sslash}{\sslash}
\NOEXPAND{\numboxed}[2]{\numboxed}
\fi
\ihead{Math 235 Fall 2023, Worksheet 3, version \today}
\ohead{page \thepage}
\cfoot{Darij Grinberg}
\begin{document}
\setcounter{section}{2}

\section{Math 235 Fall 2023, Worksheet 3: The Pigeonhole Principles}

There are several results known as \textquotedblleft the pigeonhole
principle\textquotedblright. They are all fairly trivial facts in elementary
set theory, and are often used (both in mathematics and in everyday logic)
without explicit reference. Here are some of them:

\begin{theorem}
\label{thm.php.1}Assume you have chosen $k$ elements from an $n$-element set
$S$.

\begin{enumerate}
\item[\textbf{(a)}] If $k>n$, then at least two of your chosen elements must
be equal.

\item[\textbf{(b)}] If $k=n$ and no two of your chosen elements are equal,
then you must have chosen all elements of $S$.

\item[\textbf{(c)}] If $k<n$, then there is at least one element of $S$ that
is not among your chosen elements.

\item[\textbf{(d)}] If $k=n$ and each element of $S$ is among your chosen
elements, then no two of your chosen elements are equal.
\end{enumerate}
\end{theorem}

The name \textquotedblleft pigeonhole principle\textquotedblright\ refers to a
widespread illustration of this principle in terms of pigeons and pigeonholes.
Namely, by viewing $S$ as a set of pigeonholes, and your $k$ chosen elements
as $k$ pigeons, you can rewrite Theorem \ref{thm.php.1} as
follows:\footnote{The pigeonhole principles are also known as
\textquotedblleft box principles\textquotedblright\ or \textquotedblleft
Dirichlet's principles\textquotedblright\ among people with a less vivid
imagination.}

\begin{theorem}
\label{thm.php.1pigeon}Assume that $k$ pigeons are nesting in $n$ pigeonholes.

\begin{enumerate}
\item[\textbf{(a)}] If $k>n$, then at least two pigeons share a pigeonhole.

\item[\textbf{(b)}] If $k=n$ and no two pigeons share a pigeonhole, then all
pigeonholes are inhabited.

\item[\textbf{(c)}] If $k<n$, then there is at least one pigeonhole that has
no pigeon.

\item[\textbf{(d)}] If $k=n$ and each pigeonhole is inhabited, then no two
pigeons share a pigeonhole.
\end{enumerate}
\end{theorem}

The most convenient formulation of Theorem \ref{thm.php.1} to use in
mathematical proofs is the following:

\begin{theorem}
\label{thm.php.finset}Let $f:U\rightarrow V$ be a map between two finite sets
$U$ and $V$.

\begin{enumerate}
\item[\textbf{(a)}] If $\left\vert U\right\vert >\left\vert V\right\vert $,
then $f$ cannot be injective.

\item[\textbf{(b)}] If $\left\vert U\right\vert =\left\vert V\right\vert $ and
$f$ is injective, then $f$ is bijective.

\item[\textbf{(c)}] If $\left\vert U\right\vert <\left\vert V\right\vert $,
then $f$ cannot be surjective.

\item[\textbf{(d)}] If $\left\vert U\right\vert =\left\vert V\right\vert $ and
$f$ is surjective, then $f$ is bijective.
\end{enumerate}
\end{theorem}

Some even more elementary facts are occasionally known as \textquotedblleft
the pigeonhole principle\textquotedblright\ as well. For instance:

\begin{theorem}
\label{thm.php.AB}Let $A$ and $B$ be two subsets of a finite set $C$.

\begin{enumerate}
\item[\textbf{(a)}] If $\left\vert A\right\vert +\left\vert B\right\vert
>\left\vert C\right\vert $, then $A\cap B\neq\varnothing$.

\item[\textbf{(b)}] If $\left\vert A\right\vert +\left\vert B\right\vert
=\left\vert C\right\vert $ and $A\cap B=\varnothing$, then $A\cup B=C$.

\item[\textbf{(c)}] If $\left\vert A\right\vert +\left\vert B\right\vert
<\left\vert C\right\vert $, then $A\cup B\neq C$.

\item[\textbf{(d)}] If $\left\vert A\right\vert +\left\vert B\right\vert
=\left\vert C\right\vert $ and $A\cup B=C$, then $A\cap B=\varnothing$.
\end{enumerate}
\end{theorem}

Theorem \ref{thm.php.AB} \textbf{(a)} is actually a trivial corollary of the
fact that $\left\vert A\cup B\right\vert =\left\vert A\right\vert +\left\vert
B\right\vert $ whenever $A$ and $B$ are disjoint (and of the fact that a
larger set cannot fit into a smaller one); however, it is philosophically
similar to Theorem \ref{thm.php.finset} \textbf{(a)}. (Both theorems are
saying something along the lines of \textquotedblleft when things take up too
much space in total, they have to overlap\textquotedblright.) Likewise, the
remaining parts of Theorem \ref{thm.php.AB} are akin to the corresponding
parts of Theorem \ref{thm.php.finset}.

There are more complicated versions of the pigeonhole principle around (but
all based on the same rough ideas). We will encounter one of them on this worksheet.

As before, $\mathbb{N}$ means the set $\left\{  0,1,2,\ldots\right\}  $.

\subsection{Example problems}

Here are a few simple applications of the pigeonhole principle. More can be
found in \cite[Chapter 6]{20f} and in various other sources (some of which are
listed at the beginning of \cite[Chapter 6]{20f}).

\begin{exercise}
\label{exe.php.e1}Prove that there are two people alive right now with the
exact same number of hairs on their heads.
\end{exercise}

\begin{proof}
[Solution idea.]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.finset} \textbf{(a)} 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. We thus conclude that this map cannot be injective,
i.e., it sends two people to the same number. But this means that these two
people have the same number of hairs.

(Alternatively, it suffices to find two baldies.)
\end{proof}

Example \ref{exe.php.e1} is surprisingly old; it appeared in a 1622 book by
Jean Leurechon (see \cite{RitHee13}).

\begin{exercise}
\label{exe.php.e2}Let $X$ be an $n$-element set. Let $f:X\rightarrow X$ be any
map. Let $x\in X$. Prove that there exist two integers $i$ and $j$ such that
$0\leq i<j\leq n$ and $f^{i}\left(  x\right)  =f^{j}\left(  x\right)  $. \medskip

[\textbf{Example:} Let $X$ be the $12$-element set $\left\{  0,1,\ldots
,11\right\}  $, and let $f:X\rightarrow X$ be the map given by the following
picture:%
\[%
%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
\ \ .
\]
(Here, an arrow from node \textquotedblleft$i$\textquotedblright\ to node
\textquotedblleft$j$\textquotedblright\ means that $f\left(  i\right)  =j$.)
Now, if $x=0$, then $f^{1}\left(  x\right)  =f^{4}\left(  x\right)  $, so that
there exist two integers $i$ and $j$ such that $0\leq i<j\leq12$ and
$f^{i}\left(  x\right)  =f^{j}\left(  x\right)  $ (namely, $i=1$ and $j=4$).]
\end{exercise}

\begin{proof}
[Solution idea.]The $n+1$ elements $f^{0}\left(  x\right)  ,\ f^{1}\left(
x\right)  ,\ \ldots,\ f^{n}\left(  x\right)  $ all belong to the $n$-element
set $X$. Hence, Theorem \ref{thm.php.1} \textbf{(a)} (applied to $k=n+1$)
shows that two of them are equal. But this is precisely what we claim.
\end{proof}

\begin{exercise}
\label{exe.php.e3}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{proof}
[Solution idea.]For each $i\in\left\{  0,1,\ldots,n\right\}  $, we let $b_{i}$
be the remainder that the integer $a_{1}+a_{2}+\cdots+a_{i}$ leaves when
divided by $n$. (Note that $a_{1}+a_{2}+\cdots+a_{0}$ is the empty sum, thus
equals $0$.)

Thus, we have defined $n+1$ remainders $b_{0},b_{1},\ldots,b_{n}$. These $n+1$
remainders all are contained in the $n$-element set $\left\{  0,1,\ldots
,n-1\right\}  $, so that Theorem \ref{thm.php.1} \textbf{(a)} yields that two
of them are equal. In other words, there exist integers $i$ and $j$ such that
$0\leq i<j\leq n$ and $b_{i}=b_{j}$. Consider these $i$ and $j$.

The equality $b_{i}=b_{j}$ means that the integers $a_{1}+a_{2}+\cdots+a_{i}$
and $a_{1}+a_{2}+\cdots+a_{j}$ leave the same remainder when divided by $n$.
But this, in turn, entails that their difference is divisible by
$n$\ \ \ \ \footnote{We are here using the following fundamental fact about
remainders: If two integers $u$ and $v$ leave the same remainder when divided
by $n$, then their difference $u-v$ is divisible by $n$. This is just a
restatement of Proposition 2.5.3 on Worksheet 2 (specifically, of the
\textquotedblleft if $u\%n=v\%n$, then $u\equiv v\operatorname{mod}%
n$\textquotedblright\ direction of that proposition).}. However, their
difference is%
\[
\left(  a_{1}+a_{2}+\cdots+a_{i}\right)  -\left(  a_{1}+a_{2}+\cdots
+a_{j}\right)  =-\left(  a_{i+1}+a_{i+2}+\cdots+a_{j}\right)
\]
(since $i<j$). Hence, we have shown that $-\left(  a_{i+1}+a_{i+2}%
+\cdots+a_{j}\right)  $ is divisible by $n$. In other words, $a_{i+1}%
+a_{i+2}+\cdots+a_{j}$ is divisible by $n$ (since the sign of an integer
clearly does not affect divisibility). 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=i+1$ and $q=j$).
\end{proof}

\begin{exercise}
\label{exe.php.e4}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.)

[\textbf{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{exercise}

\footnotetext{Handshakes (a form of greeting popular in the distant past) are
understood to be symmetric: If $a$ shakes $b$'s hands, then $b$ also shakes
$a$'s hands.}

\begin{proof}
[Solution idea.](See \cite[\S 6.2.2]{20f} for details.) 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, the map $f$ is injective. Hence, Theorem
\ref{thm.php.finset} \textbf{(b)} 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$ (why?).

Now, $f\left(  a\right)  =n-1$ shows that $a$ must have shaken everyone's
hands (except for $a$ themselves) (why?). Hence, $a$ must have shaken $b$'s
hands in particular (since $a\neq b$). On the other hand, $f\left(  b\right)
=0$ shows that $b$ must have shaken no hands at all. The previous two
sentences contradict each other. Thus, Exercise \ref{exe.php.e4} is solved.
\end{proof}

One of the more advanced versions of the pigeonhole principle is the following
generalization of Theorem \ref{thm.php.finset} \textbf{(a)}:

\begin{theorem}
\label{thm.php.finset-k}Let $f:U\rightarrow V$ be a map between two finite
sets $U$ and $V$. Let $m\in\mathbb{N}$.

If $\left\vert U\right\vert >m\cdot\left\vert V\right\vert $, then there exist
$m+1$ distinct elements $u_{1},u_{2},\ldots,u_{m+1}$ of $U$ such that%
\[
f\left(  u_{1}\right)  =f\left(  u_{2}\right)  =\cdots=f\left(  u_{m+1}%
\right)  .
\]

\end{theorem}

\begin{fineprint}


\begin{proof}
[Proof of Theorem \ref{thm.php.finset-k}.]Assume that $\left\vert U\right\vert
>m\cdot\left\vert V\right\vert $.

I am sure you will agree that if you sum the number $1$ over all elements of
$U$, you get%
\begin{equation}
\sum_{u\in U}1=\left\vert U\right\vert \cdot1=\left\vert U\right\vert .
\label{pf.thm.php.finset-k.1}%
\end{equation}
However, for each $u\in U$, there is a unique $v\in V$ satisfying $f\left(
u\right)  =v$ (obviously). Thus, we can break up the sum $\sum_{u\in U}1$ as
follows:%
\begin{equation}
\sum_{u\in U}1=\sum_{v\in V}\ \ \sum_{\substack{u\in U;\\f\left(  u\right)
=v}}1. \label{pf.thm.php.finset-k.2}%
\end{equation}


Now, for each $v\in V$, let $n\left(  v\right)  $ be the number of all $u\in
U$ satisfying $f\left(  u\right)  =v$. (In other words, $n\left(  v\right)  $
denotes the number of times that the map $f$ takes the value $v$.) Hence,
(\ref{pf.thm.php.finset-k.2}) becomes
\[
\sum_{u\in U}1=\sum_{v\in V}\ \ \underbrace{\sum_{\substack{u\in U;\\f\left(
u\right)  =v}}1}_{\substack{=n\left(  v\right)  \cdot1\\\text{(since this sum
has }n\left(  v\right)  \text{ many}\\\text{addends, and each addend is
}1\text{)}}}=\sum_{v\in V}n\left(  v\right)  \cdot1=\sum_{v\in V}n\left(
v\right)  .
\]
Thus,%
\begin{align}
\sum_{v\in V}n\left(  v\right)   &  =\sum_{u\in U}1=\left\vert U\right\vert
\ \ \ \ \ \ \ \ \ \ \left(  \text{by (\ref{pf.thm.php.finset-k.1})}\right)
\nonumber\\
&  >m\cdot\left\vert V\right\vert . \label{pf.thm.php.finset-k.3}%
\end{align}


However, if each $v\in V$ would satisfy $n\left(  v\right)  \leq m$, then we
would have
\[
\sum_{v\in V}\underbrace{n\left(  v\right)  }_{\leq m}\leq\sum_{v\in
V}m=\left\vert V\right\vert \cdot m=m\cdot\left\vert V\right\vert ,
\]
which would contradict (\ref{pf.thm.php.finset-k.3}). Thus, it is not true
that each $v\in V$ satisfies $n\left(  v\right)  \leq m$. In other words,
there exists some $v\in V$ that satisfies $n\left(  v\right)  >m$. Consider
this $v$. From $n\left(  v\right)  >m$, we obtain $n\left(  v\right)  \geq
m+1$. In other words, there are at least $m+1$ different elements $u\in U$
satisfying $f\left(  u\right)  =v$ (since $n\left(  v\right)  $ was defined as
the number of such $u$). In other words, there exist $m+1$ distinct elements
$u_{1},u_{2},\ldots,u_{m+1}$ of $U$ such that%
\[
f\left(  u_{1}\right)  =f\left(  u_{2}\right)  =\cdots=f\left(  u_{m+1}%
\right)  =v.
\]
This proves Theorem \ref{thm.php.finset-k}.
\end{proof}
\end{fineprint}

The following exercise is known as the \emph{Erd\"{o}s--Szekeres theorem}:

\begin{exercise}
\label{exe.php.e5}Let $n,m\in\mathbb{N}$. Let $\mathbf{a}=\left(  a_{1}%
,a_{2},\ldots,a_{k}\right)  $ be a sequence of real numbers with length
$k>nm$. Prove that $\mathbf{a}$ has

\begin{itemize}
\item a weakly increasing subsequence of length $n+1$ (i.e., there exist
integers $i_{1},i_{2},\ldots,i_{n+1}$ satisfying $1\leq i_{1}<i_{2}%
<\cdots<i_{n+1}\leq k$ and $a_{i_{1}}\leq a_{i_{2}}\leq\cdots\leq a_{i_{n+1}}%
$), \textbf{or}

\item a strictly decreasing subsequence of length $m+1$ (i.e., there exist
integers $i_{1},i_{2},\ldots,i_{m+1}$ satisfying $1\leq i_{1}<i_{2}%
<\cdots<i_{m+1}\leq k$ and $a_{i_{1}}>a_{i_{2}}>\cdots>a_{i_{m+1}}$).
\end{itemize}

[\textbf{Example:} If $n=2$ and $m=2$ and $\mathbf{a}=\left(
1,4,3,5,2\right)  $, then $\mathbf{a}$ has the strictly decreasing subsequence
$\left(  4,3,2\right)  $ of length $3$. It is easy to construct examples where
$\mathbf{a}$ has a weakly increasing subsequence of length $3$ instead, or
when $\mathbf{a}$ has both.]
\end{exercise}

\begin{proof}
[Solution idea.]Assume the contrary. Thus, $\mathbf{a}$ has neither a weakly
increasing subsequence of length $n+1$ nor a strictly decreasing subsequence
of length $m+1$.

We shall use the notation $\left[  p\right]  $ for the set $\left\{
1,2,\ldots,p\right\}  $, where $p$ is an arbitrary nonnegative integer.

We define a map $f:\left[  k\right]  \rightarrow\left[  n\right]  $ as
follows: For each $j\in\left[  k\right]  $, we let $f\left(  j\right)  $ be
the maximum length of a weakly increasing subsequence of $\left(  a_{1}%
,a_{2},\ldots,a_{j}\right)  $ that ends with $a_{j}$ (that is, the maximum
$p\in\mathbb{N}$ such that there exist integers $i_{1},i_{2},\ldots,i_{p}$
satisfying $1\leq i_{1}<i_{2}<\cdots<i_{p}=j$ and $a_{i_{1}}\leq a_{i_{2}}%
\leq\cdots\leq a_{i_{p}}$). This $f\left(  j\right)  $ really belongs to
$\left[  n\right]  $ (why?\footnote{\textit{Hint:} Recall us \textquotedblleft
assuming the contrary\textquotedblright.}), so this map $f$ is well-defined.

We have $\left\vert \left[  k\right]  \right\vert =k>nm=mn=m\cdot\left\vert
\left[  n\right]  \right\vert $. Hence, Theorem \ref{thm.php.finset-k}
(applied to $U=\left[  k\right]  $ and $V=\left[  n\right]  $) shows that
there exist $m+1$ distinct elements $u_{1},u_{2},\ldots,u_{m+1}$ of $\left[
k\right]  $ such that%
\begin{equation}
f\left(  u_{1}\right)  =f\left(  u_{2}\right)  =\cdots=f\left(  u_{m+1}%
\right)  .\label{sol.php.e5.fs-equal}%
\end{equation}
Consider these $m+1$ elements. WLOG assume that $u_{1}<u_{2}<\cdots<u_{m+1}$.
If some $i\in\left[  m\right]  $ would satisfy $a_{u_{i}}\leq a_{u_{i+1}}$,
then it would satisfy $f\left(  u_{i+1}\right)  \geq f\left(  u_{i}\right)
+1$ (why?\footnote{\textit{Hint:} Recall that $f\left(  u_{i}\right)  $ was
defined as the maximum length of a weakly increasing subsequence of $\left(
a_{1},a_{2},\ldots,a_{u_{i}}\right)  $ that ends with $a_{u_{i}}$. Thus, there
exists such a subsequence having length $f\left(  u_{i}\right)  $. If we had
$a_{u_{i}}\leq a_{u_{i+1}}$, then we could extend this subsequence by
inserting an $a_{u_{i+1}}$ at its end, and would obtain a weakly increasing
subsequence of $\left(  a_{1},a_{2},\ldots,a_{u_{i+1}}\right)  $ that ends
with $a_{u_{i+1}}$. But the maximum length of such a subsequence is $f\left(
u_{i+1}\right)  $.}), which would contradict (\ref{sol.php.e5.fs-equal}).
Hence, the subsequence $\left(  a_{u_{1}},a_{u_{2}},\ldots,a_{u_{m+1}}\right)
$ of $\mathbf{a}$ is strictly decreasing. This contradicts our assumption
(why?). Thus, Exercise \ref{exe.php.e5} is solved.
\end{proof}

\subsection{Class problems}

The following problems are to be discussed during class.

\begin{exercise}
Prove that in the USA (population ca. $332$ million), you can find two people
that have the same birthday and the same last 4 digits of their credit card
number. (Everyone is assumed to have at least one credit card.)
\end{exercise}

Again, we will use the notation $\left[  p\right]  $ for the set $\left\{
1,2,\ldots,p\right\}  $, where $p$ is an arbitrary nonnegative integer.

\begin{exercise}
\label{exe.php.c1}Let $n$ be a positive integer. Let $S$ be an $\left(
n+1\right)  $-element subset of $\left[  2n\right]  $. Prove the following:

\begin{enumerate}
\item[\textbf{(a)}] There exist two distinct elements $s$ and $t$ of $S$ such
that $s=t+n$.

\item[\textbf{(b)}] There exist two distinct elements $s$ and $t$ of $S$ such
that $s-t=1$.

\item[\textbf{(c)}] There exist two distinct elements $s$ and $t$ of $S$ such
that $\gcd\left(  s,t\right)  =1$.

\item[\textbf{(d)}] There exist two distinct elements $s$ and $t$ of $S$ such
that $s\mid t$.
\end{enumerate}
\end{exercise}

The next exercise is slightly geometric. We treat the Euclidean plane as the
vector space $\mathbb{R}^{2}$, identifying each point $p$ on the plane with
the pair $\left(  x_{p},y_{p}\right)  $ of its Cartesian coordinates. A
\emph{lattice point} means a point $p=\left(  x,y\right)  \in\mathbb{R}^{2}$
whose coordinates $x$ and $y$ are integers.

\begin{exercise}
\label{exe.php.c5}Five lattice points are chosen in the plane. Prove that you
can always choose two of these five points such that the midpoint between
these two points is again a lattice point.
\end{exercise}

\begin{exercise}
\label{exe.php.c3}Let $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ be the
Fibonacci sequence. Let $m$ be a positive integer. For each $i\in\mathbb{N}$,
let $g_{i}$ be the remainder of $f_{i}$ upon division by $m$. Prove that the
sequence $\left(  g_{0},g_{1},g_{2},\ldots\right)  $ is purely periodic (i.e.,
there exists a positive integer $N$ such that every $i\in\mathbb{N}$ satisfies
$g_{i+N}=g_{i}$).
\end{exercise}

\begin{exercise}
Given any five points on a sphere, show that some four of them must lie on a
closed hemisphere.

\flushright(63rd Putnam contest 2002, Problem A2)
\end{exercise}

\begin{exercise}
\label{exe.php.c4}Let $m$ and $n$ be two positive integers. At a symposium
long ago, $\dbinom{m+n-2}{m-1}$ scientists have met; some of them have
exchanged handshakes among each other. Prove that

\begin{itemize}
\item you can find $m$ of these scientists that have all shaken each other's
hands, \textbf{or}

\item you can find $n$ of these scientists among which no two have shaken each
other's hands.
\end{itemize}

(We make the same assumptions about handshakes as in Exercise \ref{exe.php.e4}.)
\end{exercise}

\subsection{Homework exercises}

Solve 4 of the 10 exercises below and upload your solutions on gradescope by
October 24.

Don't be worried if your solutions do not use the pigeonhole principle in any
of its forms! Due to the simplicity of the principle, it is fairly easy to
avoid it or use something equivalent.

\begin{exercise}
Let $a,b,c$ be three odd integers. Prove that at least one of the three
integers $ab-1$, $bc-1$ and $ca-1$ is divisible by $4$.
\end{exercise}

\begin{exercise}
\label{exe.php.h1}Let $S$ be a $10$-element subset of the set $\left\{
1,2,\ldots,100\right\}  $. Prove that there exist two disjoint nonempty
subsets $A$ and $B$ of $S$ such that $\sum_{a\in A}a=\sum_{b\in B}b$. (Note
that $A$ and $B$ are allowed to have any positive sizes, including $1$.)
\medskip

[\textbf{Example:} If $S=\left\{  3,9,13,19,26,60,74,80,84,94\right\}  $, then
$\sum_{a\in A}a=\sum_{b\in B}b$ is satisfied for $A=\left\{  3,9,94\right\}  $
and $B=\left\{  26,80\right\}  $ (as well as for various other choices).]
\end{exercise}

\begin{exercise}
\label{exe.php.h2}A number of people have been settled in $n$ apartments
$B_{1},B_{2},\ldots,B_{n}$ (with each person settled in exactly one
apartment). (Roommates are allowed.) Now, all these people are removed from
their apartments and resettled in $n+1$ new apartments $C_{1},C_{2}%
,\ldots,C_{n+1}$ in such a way that none of these $n+1$ new apartments stays empty.

A person is said to have \emph{gained space} if he has fewer roommates after
the resettlement than he used to have before.

Prove that at least two people have gained space.
\end{exercise}

\begin{exercise}
\label{exe.php.h3}Consider any six points on the circumference of a circle
with radius $1$. Prove that some two of these six points have distance $\leq1$.
\end{exercise}

\begin{exercise}
Each lattice point in the Euclidean plane has been colored with one of $n$
colors. Prove that there exists a rectangle whose four vertices are lattice
points all having the same color.
\end{exercise}

\begin{exercise}
Let $\left(  a_{0},a_{1},a_{2},\ldots\right)  $ be the sequence of integers
defined recursively by $a_{0}=0$ and $a_{1}=a_{2}=1$ and
\[
a_{n}=a_{n-1}a_{n-2}+a_{n-3}\ \ \ \ \ \ \ \ \ \ \text{for all }n\geq3.
\]
Let $m$ be a positive integer. For each $i\in\mathbb{N}$, let $b_{i}$ be the
remainder of $a_{i}$ upon division by $m$. Prove that the sequence $\left(
b_{0},b_{1},b_{2},\ldots\right)  $ is purely periodic.
\end{exercise}

\begin{exercise}
Let $n\in\mathbb{N}$. Consider a $2n\times2n$-table. Assume that at most $3n$
of its $\left(  2n\right)  ^{2}$ many squares have been colored black. Prove
that it is possible to remove $n$ rows and $n$ columns from the table in such
a way that no black squares remain in the table. \medskip

[\textbf{Hint:} When $n\geq2$, find two rows and two columns that contain at
least $6$ black squares among them.]
\end{exercise}

\begin{exercise}
Let $n$ be a positive integer.

\begin{enumerate}
\item[\textbf{(a)}] Let $S$ be an $\left(  n+1\right)  $-element subset of
$\left[  2n-1\right]  $. Prove that we can find three distinct elements
$u,v,w$ of $S$ such that $u+v=w$.

\item[\textbf{(b)}] Is this still true if we let $S$ be a subset of $\left[
2n\right]  $ instead of a subset of $\left[  2n-1\right]  $ ?
\end{enumerate}
\end{exercise}

\begin{exercise}
\label{exe.php.h4new}Let $n\geq2$ be an integer. Let $A$ be an $n\times
n$-matrix with real entries.

Assume that in each row of $A$, the sum of the two largest entries is positive.

Is it possible that in each column of $A$, the sum of the two largest entries
is negative?
\end{exercise}

\begin{fineprint}
We remark that Exercise \ref{exe.php.h4new} would not hold if the word
\textquotedblleft two\textquotedblright\ were replaced by \textquotedblleft
three\textquotedblright\ throughout it. For instance, in the $4\times4$-matrix
$\left(
\begin{array}
[c]{cccc}%
-1 & -1 & -7 & 3\\
-1 & -1 & -7 & 3\\
-1 & -1 & 3 & -7\\
-1 & -1 & 3 & -7
\end{array}
\right)  $, each row has a positive sum of its three largest entries, but each
column has a negative sum of its three largest entries. This counterexample
was found by Jonathan Parlett.
\end{fineprint}

The next exercise is more loosely related to the pigeonhole principle (to
Theorem \ref{thm.php.AB} if any):

\begin{exercise}
\label{exe.php.h5}Let $A$ be a rectangular matrix with real entries. Assume
that the entries in each \textbf{row} of $A$ are weakly increasing from left
to right. Now we sort the entries in each \textbf{column} of $A$ so that they
become weakly increasing from top to bottom. (Each entry stays within its
column.) Thus, we obtain a new matrix $B$. Prove that the entries in each
\textbf{row} of $B$ are still weakly increasing from left to right. \medskip

[\textbf{Example:} If $A=\left(
\begin{array}
[c]{ccc}%
1 & 3 & 6\\
2 & 2 & 5\\
1 & 2 & 3
\end{array}
\right)  $, then $B=\left(
\begin{array}
[c]{ccc}%
1 & 2 & 3\\
1 & 2 & 5\\
2 & 3 & 6
\end{array}
\right)  $.]
\end{exercise}

\bigskip

\begin{thebibliography}{99999999}                                                                                         %


\bibitem[Grinbe20]{20f}Darij Grinberg, \textit{Math 235: Mathematical Problem
Solving}, 10 August 2021.\newline\url{https://www.cip.ifi.lmu.de/~grinberg/t/20f/mps.pdf}

\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}.
\end{thebibliography}


\end{document}