\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[breaklinks=True]{hyperref}
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{needspace}
\usepackage{tabls}
\usepackage{tikz}
\usepackage{bbding}
%TCIDATA{OutputFilter=latex2.dll}
%TCIDATA{Version=5.50.0.2960}
%TCIDATA{LastRevised=Sunday, December 24, 2023 13:54:07}
%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}
\usetikzlibrary{shapes}
\usetikzlibrary{decorations.pathmorphing}
\newcounter{exer}
\newcounter{exera}
\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}{\begin{small}}{\end{small}}
\iffalse
\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{convention}[1][Convention]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\newenvironment{question}[1][Question]{\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}
\newcommand\arxiv[1]{\href{http://www.arxiv.org/abs/#1}{\texttt{arXiv:#1}}}
\setlength\tablinesep{3pt}
\setlength\arraylinesep{3pt}
\setlength\extrarulesep{3pt}
\setlength\textheight{22.5cm}
\setlength\textwidth{14.8cm}
\newenvironment{verlong}{}{}
\newenvironment{vershort}{}{}
\newenvironment{noncompile}{}{}
\excludecomment{verlong}
\includecomment{vershort}
\excludecomment{noncompile}
\newcommand{\defn}[1]{{\color{darkred}\emph{#1}}}
\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{\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{\are}{\ar@{-}}
\newcommand{\arebi}[1][]{\ar@{<-}@/_/[#1] \ar@/^/[#1]}
\newcommand{\of}{\text{ of }}
\newtheoremstyle{plainsl}
{8pt plus 2pt minus 4pt}
{8pt plus 2pt minus 4pt}
{\slshape}
{0pt}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}
\theoremstyle{plainsl}
\ihead{Lecture 17, version \today}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\section*{Math 221 Winter 2023, Lecture 17: Enumeration}

\textbf{website:}
\texttt{\href{https://www.cip.ifi.lmu.de/~grinberg/t/23wd}{\texttt{https://www.cip.ifi.lmu.de/\symbol{126}%
grinberg/t/23wd}}}

\setcounter{section}{3}

\section{An introduction to enumeration}

\setcounter{subsection}{8}

\subsection{Lacunar subsets}

\subsubsection{Definition}

Another type of objects that can be counted are the so-called \textbf{lacunar
subsets} (also known as \textbf{sparse subsets} to some authors). Here is
their definition:

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

The word \textquotedblleft lacunar\textquotedblright\ comes from Latin
\textquotedblleft lacuna\textquotedblright\ (= \textquotedblleft
gap\textquotedblright). The idea is that a lacunar set has a \textquotedblleft
gap\textquotedblright\ (or \textquotedblleft buffer zone\textquotedblright)
between any two distinct elements.

For example, the set $\left\{  2,4,7\right\}  $ is lacunar, but the set
$\left\{  2,4,5\right\}  $ is not (since $4$ and $5$ are consecutive
integers). Any $1$-element set of integers is lacunar, and so is the empty set.

Now we can ask ourselves some natural questions: For given $n\in\mathbb{N}$,

\begin{enumerate}
\item how many lacunar subsets does the set $\left[  n\right]  =\left\{
1,2,\ldots,n\right\}  $ have?

\item how many $k$-element lacunar subsets does $\left[  n\right]  $ have for
a given $k\in\mathbb{N}$?

\item what is the largest size of a lacunar subset of $\left[  n\right]  $ ?
\end{enumerate}

We shall answer all these three questions in this section.

\subsubsection{The maximum size of a lacunar subset}

We start with the third question, as it is the easiest one to answer. Recall
the floor notation (Definition 3.3.12 in Lecture 8).

\begin{proposition}
\label{prop.count.lacs.max-size}Let $n\in\mathbb{N}$. Then, the maximum size
of a lacunar subset of $\left[  n\right]  $ is $\left\lfloor \dfrac{n+1}%
{2}\right\rfloor $.
\end{proposition}

\begin{proof}
The set
\begin{align*}
\left\{  \text{all odd numbers in }\left[  n\right]  \right\}   &  =\left\{
\text{all odd integers between }1\text{ and }n\text{ (inclusive)}\right\} \\
&  =\left\{  \text{all odd integers between }0\text{ and }n\text{
(inclusive)}\right\} \\
&  =\left\{  1,3,5,\ldots\right\}  \cap\left[  n\right]
\end{align*}
is a lacunar subset of $\left[  n\right]  $, and has size $\left\lfloor
\dfrac{n+1}{2}\right\rfloor $ (by Proposition 4.2.1 in Lecture 12). Thus, the
size $\left\lfloor \dfrac{n+1}{2}\right\rfloor $ is attainable (for a lacunar
subset of $\left[  n\right]  $).

It remains to show that this size is the largest possible -- i.e., that if $L$
is a lacunar subset of $\left[  n\right]  $, then
\[
\left\vert L\right\vert \leq\left\lfloor \dfrac{n+1}{2}\right\rfloor .
\]


So let $L$ be a lacunar subset of $\left[  n\right]  $. Our goal is to prove
that $\left\vert L\right\vert \leq\left\lfloor \dfrac{n+1}{2}\right\rfloor $.

We shall first prove that $\left\vert L\right\vert \leq\dfrac{n+1}{2}$.

Here are two different ways to prove this (each way illustrates a nice technique):

\begin{proof}
[First proof of $\left\vert L\right\vert \leq\dfrac{n+1}{2}$.]Let $\ell
_{1},\ell_{2},\ldots,\ell_{k}$ be the elements of $L$, listed in increasing
order, so that $L=\left\{  \ell_{1},\ell_{2},\ldots,\ell_{k}\right\}  $ and
$\ell_{1}<\ell_{2}<\cdots<\ell_{k}$. Thus, $\left\vert L\right\vert =k$.

Now, we assume (for the moment) that $k>0$. Thus, $k\geq1$ (since $k$ is an
integer). We have $\ell_{1}\in L\subseteq\left[  n\right]  $, so that
$\ell_{1}\geq1$. Moreover, the elements $\ell_{1}$ and $\ell_{2}$ of $L$
satisfy $\ell_{1}<\ell_{2}$ and $\ell_{2}\neq\ell_{1}+1$ (since $L$ is
lacunar), so that $\ell_{2}\geq\underbrace{\ell_{1}}_{\geq1}+2\geq1+2=3$.
Furthermore, the elements $\ell_{2}$ and $\ell_{3}$ of $L$ satisfy $\ell
_{2}<\ell_{3}$ and $\ell_{3}\neq\ell_{2}+1$ (since $L$ is lacunar), so that
$\ell_{3}\geq\underbrace{\ell_{2}}_{\geq3}+2\geq3+2=5$. Proceeding in the same
way, we find that%
\begin{equation}
\ell_{i}\geq2i-1\ \ \ \ \ \ \ \ \ \ \text{for each }i\in\left[  k\right]  .
\label{pf.prop.count.lacs.max-size.2i-1}%
\end{equation}
(Strictly speaking, this can be proved by induction on $i$. The base case
follows from $\ell_{1}\geq1=2\cdot1-1$, whereas the induction step requires
deriving $\ell_{i+1}\geq2\left(  i+1\right)  -1$ from $\ell_{i}\geq2i-1$,
which can be done by observing that $L$ is lacunar and therefore $\ell
_{i+1}\geq\underbrace{\ell_{i}}_{\geq2i-1}+2\geq2i-1+2=2\left(  i+1\right)
-1$.)

Now, we can apply (\ref{pf.prop.count.lacs.max-size.2i-1}) to $i=k$, and thus
obtain $\ell_{k}\geq2k-1$. However, $\ell_{k}\in L\subseteq\left[  n\right]
$, so that $\ell_{k}\leq n$. Thus, $n\geq\ell_{k}\geq2k-1$, so that
$n+1\geq2k$ and thus $\dfrac{n+1}{2}\geq k$. We have proved this under the
assumption that $k>0$, but this also holds in the opposite case (because if
$k\leq0$, then $\dfrac{n+1}{2}\geq0\geq k$). Thus, we always have $\dfrac
{n+1}{2}\geq k$ (independently of any assumptions). In other words, we have
$\dfrac{n+1}{2}\geq\left\vert L\right\vert $ (since $k=\left\vert L\right\vert
$). In other words, we have $\left\vert L\right\vert \leq\dfrac{n+1}{2}$.
\end{proof}

\begin{proof}
[Second proof of $\left\vert L\right\vert \leq\dfrac{n+1}{2}$.]Define a new
set
\[
L^{+}:=\left\{  \ell+1\ \mid\ \ell\in L\right\}  .
\]
This set $L^{+}$ consists of each element of $L$, incremented by $1$. For
example, if $L=\left\{  3,5,9\right\}  $, then $L^{+}=\left\{  4,6,10\right\}
$. Another way to view $L^{+}$ is as follows:
\[
L^{+}=\left\{  i\in\mathbb{Z}\ \mid\ i-1\in L\right\}
\]
(because an integer $i$ satisfies $i-1\in L$ if and only if it has the form
$\ell+1$ for some $\ell\in L$).

The set $L^{+}$ is just $L$ with each element incremented by $1$. Thus,
$\left\vert L^{+}\right\vert =\left\vert L\right\vert $.

Moreover, since $L$ is a subset of $\left[  n\right]  =\left\{  1,2,\ldots
,n\right\}  $, we conclude that $L^{+}$ is a subset of $\left\{
2,3,\ldots,n+1\right\}  $. Hence, both sets $L$ and $L^{+}$ are subsets of
$\left[  n+1\right]  $. Their union $L\cup L^{+}$ is thus a subset of $\left[
n+1\right]  $ as well. Therefore (by Theorem 4.6.7 \textbf{(a)} in Lecture 16,
applied to $S=\left[  n+1\right]  $ and $T=L\cup L^{+}$), we conclude that
\[
\left\vert L\cup L^{+}\right\vert \leq\left\vert \left[  n+1\right]
\right\vert =n+1.
\]


If the sets $L$ and $L^{+}$ had an element $j$ in common, then both $j-1$ and
$j$ would belong to $L$ (indeed, $j\in L^{+}=\left\{  i\in\mathbb{Z}%
\ \mid\ i-1\in L\right\}  $ would entail $j-1\in L$), which would contradict
the fact that $L$ is lacunar (since $j-1$ and $j$ are two consecutive
integers). Thus, the sets $L$ and $L^{+}$ have no element in common. In other
words, they are disjoint. Hence, by the sum rule (Theorem 4.6.5 in Lecture 16,
applied to $A=L$ and $B=L^{+}$), we have $\left\vert L\cup L^{+}\right\vert
=\left\vert L\right\vert +\underbrace{\left\vert L^{+}\right\vert
}_{=\left\vert L\right\vert }=\left\vert L\right\vert +\left\vert L\right\vert
=2\cdot\left\vert L\right\vert $. Hence,%
\[
2\cdot\left\vert L\right\vert =\left\vert L\cup L^{+}\right\vert \leq n+1.
\]
In other words, $\left\vert L\right\vert \leq\dfrac{n+1}{2}$.
\end{proof}

We have now proved (in two different ways) that $\left\vert L\right\vert
\leq\dfrac{n+1}{2}$. Now, recall the definition of the floor of a real number:
If $x$ is a real number, then $\left\lfloor x\right\rfloor $ is the largest
integer that is $\leq x$. Hence, $\left\lfloor \dfrac{n+1}{2}\right\rfloor $
is the largest integer that is $\leq\dfrac{n+1}{2}$. Therefore, any integer
that is $\leq\dfrac{n+1}{2}$ must also be $\leq\left\lfloor \dfrac{n+1}%
{2}\right\rfloor $. Applying this to the integer $\left\vert L\right\vert $,
we conclude that $\left\vert L\right\vert \leq\left\lfloor \dfrac{n+1}%
{2}\right\rfloor $ (since $\left\vert L\right\vert \leq\dfrac{n+1}{2}$). As
explained above, this completes the proof of Proposition
\ref{prop.count.lacs.max-size}.
\end{proof}

\subsubsection{Counting all lacunar subsets of $\left[  n\right]  $}

Now let us count the lacunar subsets of $\left[  n\right]  $. We shall first
count them all, then count the ones of a given size $k$.

First, a few words about how to find answers to counting questions like this.
For any specific value of $n$, finding the \# of lacunar subsets of $\left[
n\right]  $ is a \textquotedblleft finite problem\textquotedblright: You can
just count them all. Or, better, you can have your computer do this. In
\href{https://www.sagemath.org/}{SageMath} (a computer algebra system, one of
the best suited to combinatorial questions), this takes just a few lines:
\medskip
\begin{verbatim}
  def is_lacunar(S): # test if the set S is lacunar
    return all(i+1 not in S for i in S)

  def num_lacs(n): # number of lacunar subsets of [n]
    return sum(1 for S in Subsets(n) if is_lacunar(S))

  for n in range(10):
    print("For n = " + str(n) + ", the number is " + str(num_lacs(n)))
\end{verbatim}

\medskip The first two lines here speak for themselves (once you know that
\texttt{all} is the universal quantifier\footnote{Generally, SageMath is built
on top of the Python programming language, so you will recognize a lot of
Python syntax.}). The function \texttt{Subsets} computes the set of all
subsets of a given set, or (if we provide it an integer $n$ as input) all
subsets of $\left[  n\right]  $. The \texttt{sum(1 for S in SomeSet)}
construction is just a slick way of counting the elements of \texttt{SomeSet},
exploiting the fact that a sum of the form $1+1+\cdots+1$ equals the number of
its addends. The last two lines are prompting SageMath to compute the \# of
lacunar subsets of $\left[  n\right]  $ for each $n\in\left[  0,9\right]  $
(note that \texttt{range(a, b)} means the integer interval $\left[
a,b-1\right]  $ in SageMath) and to output these $10$ numbers. I refer to
\cite[\S 1.4.3]{19fco} for more hints on the use of SageMath, and to
\href{https://doc.sagemath.org/}{its documentation} for a more systematic
introduction. Note that you can use
\href{https://sagecell.sagemath.org/}{SageMathCell} to easily call SageMath
from your browser (although the computations you call are limited by 30
seconds each, since they happen on the server).

The answers we get from SageMath are interesting:%
\[%
\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
\# of lacunar subsets of $\left[  n\right]  $ & $1$ & $2$ & $3$ & $5$ & $8$ &
$13$ & $21$ & $34$ & $55$ & $89$\\\hline
\end{tabular}
\ \ \ \ .
\]
Haven't we seen these numbers before?

Yes, we have: In Lecture 2, we defined the \textbf{Fibonacci sequence}. This
is the sequence $\left(  f_{0},f_{1},f_{2},\ldots\right)  $ of nonnegative
integers defined recursively by setting%
\begin{align*}
f_{0}  &  =0,\ \ \ \ \ \ \ \ \ \ f_{1}=1,\ \ \ \ \ \ \ \ \ \ \text{and}\\
f_{n}  &  =f_{n-1}+f_{n-2}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq2.
\end{align*}
Its first few entries are%
\[%
\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
$f_{n}$ & $0$ & $1$ & $1$ & $2$ & $3$ & $5$ & $8$ & $13$ & $21$ & $34$ & $55$
& $89$ & $144$ & $233$\\\hline
\end{tabular}
\ \ \ \ .
\]


The two above tables have the same entries, if you discount the fact that the
first two Fibonacci numbers $f_{0}=0$ and $f_{1}=1$ are missing from the
former table. So we have good reasons to suspect that%
\[
\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)  =f_{n+2}%
\]
for each $n\in\mathbb{N}$. And indeed, this is true:

\begin{theorem}
\label{thm.count.lacs.all}For any integer $n\geq-1$, we have%
\[
\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)  =f_{n+2}.
\]
Here, we agree that $\left[  -1\right]  :=\varnothing$. More generally, we
agree that $\left[  k\right]  :=\varnothing$ for any $k\leq0$.
\end{theorem}

\begin{example}
The lacunar subsets of $\left[  4\right]  $ are
\[
\varnothing,\ \ \left\{  1\right\}  ,\ \ \left\{  2\right\}  ,\ \ \left\{
3\right\}  ,\ \ \left\{  4\right\}  ,\ \ \left\{  1,3\right\}  ,\ \ \left\{
1,4\right\}  ,\ \ \left\{  2,4\right\}  .
\]
So there are $8$ of them, as predicted by Theorem \ref{thm.count.lacs.all}
(since $f_{4+2}=f_{6}=8$).
\end{example}

(Are you wondering why we are allowing $n$ to be $-1$ in Theorem
\ref{thm.count.lacs.all}? The answer is \textquotedblleft because we
can\textquotedblright, and more precisely \textquotedblleft because it will
make our induction easier\textquotedblright. The case $n=-1$ is not
interesting by itself; the claim of Theorem \ref{thm.count.lacs.all} in this
case is just that the \# of lacunar subsets of $\varnothing$ is $1$.)

\begin{proof}
[Proof of Theorem \ref{thm.count.lacs.all}.]For any integer $n\geq-1$, let us
set%
\[
\ell_{n}:=\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)
.
\]
Thus, we must prove that
\begin{equation}
\ell_{n}=f_{n+2}\ \ \ \ \ \ \ \ \ \ \text{for each }n\geq-1.
\label{pf.thm.count.lacs.all.goal}%
\end{equation}


We have $\ell_{-1}=1$ (since the set $\left[  -1\right]  =\varnothing$ has
only one lacunar subset, namely $\varnothing$ itself) and $f_{-1+2}=f_{1}=1$.
Hence, $\ell_{-1}=1=f_{-1+2}$. In other words,
(\ref{pf.thm.count.lacs.all.goal}) holds for $n=-1$. A similar computation
shows that (\ref{pf.thm.count.lacs.all.goal}) holds for $n=0$.

Let us next show the following:

\begin{statement}
\textit{Claim 1:} We have $\ell_{n}=\ell_{n-1}+\ell_{n-2}$ for each integer
$n\geq1$.
\end{statement}

\begin{proof}
[Proof of Claim 1.]Let $n\geq1$ be an integer. We shall call a subset of
$\left[  n\right]  $

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

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

Then, the definition of $\ell_{n}$ shows that%
\begin{align*}
\ell_{n}  &  =\left(  \text{\# of lacunar subsets of }\left[  n\right]
\right) \\
&  =\left(  \text{\# of red lacunar subsets of }\left[  n\right]  \right)
+\left(  \text{\# of green lacunar subsets of }\left[  n\right]  \right)
\end{align*}
(by the sum rule, since each lacunar subset of $\left[  n\right]  $ is either
red or green but cannot be both at the same time\footnote{This is the same
argument that has been used in the proof of Theorem 4.7.2 (in Lecture 16).}).

The green lacunar subsets of $\left[  n\right]  $ are just the lacunar subsets
of $\left[  n-1\right]  $ (since \textquotedblleft green\textquotedblright%
\ means \textquotedblleft does not contain $n$\textquotedblright). Thus,%
\begin{align*}
&  \left(  \text{\# of green lacunar subsets of }\left[  n\right]  \right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \right)
=\ell_{n-1}%
\end{align*}
(by the definition of $\ell_{n-1}$).

Counting the red lacunar subsets is trickier. We shall show that their \# is
$\ell_{n-2}$.

If $R$ is a red lacunar subset of $\left[  n\right]  $, then $R$ contains $n$
(by the definition of \textquotedblleft red\textquotedblright), so that $R$
does not contain $n-1$ (by lacunarity), and therefore $R\setminus\left\{
n\right\}  $ is a lacunar subset of $\left[  n-2\right]  $ (since
$R\setminus\left\{  n\right\}  $ contains neither $n$ nor $n-1$). Thus, we
obtain a map%
\begin{align*}
\operatorname*{rem}\nolimits_{n}:\left\{  \text{red lacunar subsets of
}\left[  n\right]  \right\}   &  \rightarrow\left\{  \text{lacunar subsets of
}\left[  n-2\right]  \right\}  ,\\
R  &  \mapsto R\setminus\left\{  n\right\}  .
\end{align*}


Conversely, if $L$ is a lacunar subset of $\left[  n-2\right]  $, then
$L\cup\left\{  n\right\}  $ is a lacunar subset of $\left[  n\right]  $
(indeed, the integer $n-1$ is a \textquotedblleft buffer
zone\textquotedblright\ between the elements of $L$ and the new element $n$,
so that the lacunarity of $L$ is preserved when we insert $n$ into the set),
and is red (since $n\in\left\{  n\right\}  \subseteq L\cup\left\{  n\right\}
$). Thus, we obtain a map%
\begin{align*}
\operatorname*{ins}\nolimits_{n}:\left\{  \text{lacunar subsets of }\left[
n-2\right]  \right\}   &  \rightarrow\left\{  \text{red lacunar subsets of
}\left[  n\right]  \right\}  ,\\
L  &  \mapsto L\cup\left\{  n\right\}  .
\end{align*}


It is easy to see (just as in the proof of Theorem 4.7.2 in Lecture 16) that
the map $\operatorname*{rem}\nolimits_{n}$ is an inverse of
$\operatorname*{ins}\nolimits_{n}$. Thus, the map $\operatorname*{ins}%
\nolimits_{n}$ has an inverse, i.e., is bijective (by Theorem 4.5.7 in Lecture
15). Hence, we have found a bijection%
\[
\text{from }\left\{  \text{lacunar subsets of }\left[  n-2\right]  \right\}
\text{ to }\left\{  \text{red lacunar subsets of }\left[  n\right]  \right\}
\]
(namely, $\operatorname*{ins}\nolimits_{n}$). Therefore, by the bijection
principle, we have%
\[
\left\vert \left\{  \text{lacunar subsets of }\left[  n-2\right]  \right\}
\right\vert =\left\vert \left\{  \text{red lacunar subsets of }\left[
n\right]  \right\}  \right\vert .
\]
In other words,%
\[
\left(  \text{\# of lacunar subsets of }\left[  n-2\right]  \right)  =\left(
\text{\# of red lacunar subsets of }\left[  n\right]  \right)  .
\]
Thus,%
\[
\left(  \text{\# of red lacunar subsets of }\left[  n\right]  \right)
=\left(  \text{\# of lacunar subsets of }\left[  n-2\right]  \right)
=\ell_{n-2}%
\]
(by the definition of $\ell_{n-2}$).

Altogether,%
\begin{align*}
\ell_{n}  &  =\underbrace{\left(  \text{\# of red lacunar subsets of }\left[
n\right]  \right)  }_{=\ell_{n-2}}+\underbrace{\left(  \text{\# of green
lacunar subsets of }\left[  n\right]  \right)  }_{=\ell_{n-1}}\\
&  =\ell_{n-2}+\ell_{n-1}=\ell_{n-1}+\ell_{n-2}.
\end{align*}
This proves Claim 1.
\end{proof}

Now we still need to prove (\ref{pf.thm.count.lacs.all.goal}). In other words,
we need to prove that the two sequences $\left(  \ell_{-1},\ell_{0},\ell
_{1},\ldots\right)  $ and $\left(  f_{1},f_{2},f_{3},\ldots\right)  $ are
identical. But at this point, this is very easy: These two sequences

\begin{itemize}
\item have the same two starting entries $\ell_{-1}=f_{1}$ and $\ell_{0}%
=f_{2}$ (this can be easily checked directly),

\item and satisfy the same recursive equation: namely, each entry of either
sequence is the sum of the preceding two entries (since Claim 1 yields
$\ell_{n}=\ell_{n-1}+\ell_{n-2}$, whereas the definition of the Fibonacci
numbers yields $f_{n+2}=f_{n+1}+f_{n}$).
\end{itemize}

Since a recursively defined sequence is uniquely determined by its starting
entries and its recursive equation, we thus conclude that the two sequences
$\left(  \ell_{-1},\ell_{0},\ell_{1},\ldots\right)  $ and $\left(  f_{1}%
,f_{2},f_{3},\ldots\right)  $ are identical. Thus,
(\ref{pf.thm.count.lacs.all.goal}) follows. This slightly informal argument
can be formalized as a straightforward strong
induction\footnote{\textit{Proof.} Let us prove
(\ref{pf.thm.count.lacs.all.goal}) by strong induction on $n$:
\par
\textit{Base case:} We have already checked that
(\ref{pf.thm.count.lacs.all.goal}) holds for $n=-1$.
\par
\textit{Induction step:} Let $n\geq0$ be an integer. Assume (as the induction
hypothesis) that the claim (\ref{pf.thm.count.lacs.all.goal}) holds for each
of $-1,\ 0,\ 1,\ \ldots,\ n-1$ instead of $n$. We must prove that
(\ref{pf.thm.count.lacs.all.goal}) holds for $n$ as well, i.e., that we have
$\ell_{n}=f_{n+2}$.
\par
If $n=0$, then this follows from the fact (observed above) that
(\ref{pf.thm.count.lacs.all.goal}) holds for $n=0$. It thus remains to
consider the case when $n\neq0$. So let us assume that $n\neq0$. Since
$n\geq0$, we thus obtain $n\geq1$, so that $n-1\geq0$ and $n-2\geq-1$.
\par
In particular, $n-1\geq0\geq-1$. Hence, our induction hypothesis yields that
the claim (\ref{pf.thm.count.lacs.all.goal}) holds for $n-1$ instead of $n$.
In other words, we have $\ell_{n-1}=f_{\left(  n-1\right)  +2}=f_{n+1}$.
\par
Also, our induction hypothesis yields that the claim
(\ref{pf.thm.count.lacs.all.goal}) holds for $n-2$ instead of $n$ (since
$n-2\geq-1$). In other words, we have $\ell_{n-2}=f_{\left(  n-2\right)
+2}=f_{n}$.
\par
Now, Claim 1 yields $\ell_{n}=\underbrace{\ell_{n-1}}_{=f_{n+1}}%
+\underbrace{\ell_{n-2}}_{=f_{n}}=f_{n+1}+f_{n}$. But the recursive definition
of the Fibonacci sequence also yields $f_{n+2}=f_{n+1}+f_{n}$. Comparing these
two equalities, we find $\ell_{n}=f_{n+2}$. In other words,
(\ref{pf.thm.count.lacs.all.goal}) holds for $n$. This completes the induction
step. Thus, (\ref{pf.thm.count.lacs.all.goal}) is proved.}.

Thus we have proved (\ref{pf.thm.count.lacs.all.goal}). In other words, we
have proved Theorem \ref{thm.count.lacs.all} (because we have $\ell
_{n}=\left(  \text{\# of lacunar subsets of }\left[  n\right]  \right)  $).
\end{proof}

\subsubsection{Counting all $k$-element lacunar subsets of $\left[  n\right]
$}

Let us now address the remaining question about lacunar subsets: counting
$k$-element lacunar subsets of $\left[  n\right]  $ for given $n$ and $k$.

Again, we start by asking SageMath for some data:
\begin{verbatim}
  def is_lacunar(S): # test if the set S is lacunar
    return all(i+1 not in S for i in S)

  def num_lacs(n, k): # number of k-element lacunar subsets of [n]
    return sum(1 for S in Subsets(n, k) if is_lacunar(S))

  for n in range(10):
    print("For n = " + str(n) + ", the numbers are " + \
          str([num_lacs(n, k) for k in range(n+1)]))
\end{verbatim}

We obtain the following table:%
\[%
\begin{tabular}
[c]{|c||c|c|c|c|c|c|}\hline
& $k=0$ & $k=1$ & $k=2$ & $k=3$ & $k=4$ & $k=5$\\\hline\hline
$n=0$ & $1$ &  &  &  &  & \\\hline
$n=1$ & $1$ & $1$ &  &  &  & \\\hline
$n=2$ & $1$ & $2$ &  &  &  & \\\hline
$n=3$ & $1$ & $3$ & $1$ &  &  & \\\hline
$n=4$ & $1$ & $4$ & $3$ &  &  & \\\hline
$n=5$ & $1$ & $5$ & $6$ & $1$ &  & \\\hline
$n=6$ & $1$ & $6$ & $10$ & $4$ &  & \\\hline
$n=7$ & $1$ & $7$ & $15$ & $10$ & $1$ & \\\hline
$n=8$ & $1$ & $8$ & $21$ & $20$ & $5$ & \\\hline
$n=9$ & $1$ & $9$ & $28$ & $35$ & $15$ & $1$\\\hline
\end{tabular}
\]
(where each entry is the \# of lacunar $k$-element subsets of $\left[
n\right]  $ for the corresponding values of $n$ and $k$, and where an empty
box means that the corresponding \# is $0$). The many $0$'s are unsurprising
(they are predicted by Proposition \ref{prop.count.lacs.max-size}), and
likewise the values for $k=0$ and $k=1$ are clear (since every subset that has
size $\leq1$ is lacunar). But staring at the table for a bit longer reveals
something subtler: It is a sheared Pascal's triangle! For example, the $n=7$
row contains the numbers $1,7,15,10,1$, which appear along a diagonal in
Pascal's triangle. All the entries are binomial coefficients, and a bit of
work reveals the exact formula:

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

\end{theorem}

For instance, for $n=7$ and $k=3$, this yields
\[
\left(  \text{\# of }3\text{-element lacunar subsets of }\left[  7\right]
\right)  =\dbinom{7+1-3}{3}=\dbinom{5}{3}=10,
\]
which agrees with our above table.

Note that the condition $k\leq n+1$ in Theorem \ref{thm.count.lacs.size} is
needed. If $k>n+1$, then the \# of $k$-element lacunar subsets of $\left[
n\right]  $ is $0$ (since a subset of $\left[  n\right]  $ cannot have more
than $n$ elements, let alone more than $n+1$ elements, and even less so when
it is lacunar), but the binomial coefficient $\dbinom{n+1-k}{k}$ is nonzero
(since the $n+1-k$ on its top is negative).

You can prove Theorem \ref{thm.count.lacs.size} by induction on $n$, using a
similar red/green coloring as in our above proof of Theorem
\ref{thm.count.lacs.all} (and carefully checking that the condition $k\leq
n+1$ is satisfied whenever you apply the induction hypothesis\footnote{This
necessitates a bit of casework.}). Such a proof can be found in \cite[Exercise
3 \textbf{(a)}]{17f-hw2s}\footnote{To be \textbf{very} pedantic:
\cite[Exercise 3 \textbf{(a)}]{17f-hw2s} only states Theorem
\ref{thm.count.lacs.size} in the case when $n\in\mathbb{N}$. But the remaining
case is trivial (since $k\leq n+1$ leads to $k=0$ when $n$ is negative, and
thus we have to count $0$-element subsets of an empty set, which is not a deep
question).}.

There is, however, a nicer proof, which proceeds by constructing a bijection%
\begin{align*}
&  \text{from }\left\{  k\text{-element lacunar subsets of }\left[  n\right]
\right\} \\
&  \text{to }\left\{  k\text{-element subsets of }\left[  n+1-k\right]
\right\}  ,
\end{align*}
and observing that the \# of $k$-element subsets of $\left[  n+1-k\right]  $
is $\dbinom{n+1-k}{k}$ (by Theorem 4.7.4 in Lecture 16). Such a proof has the
advantage of not just proving Theorem \ref{thm.count.lacs.size} but also
explaining \textquotedblleft why\textquotedblright\ it holds (at least if you
consider it as a given that binomial coefficients count $k$-element subsets).

This second proof rests upon a basic feature of finite sets of integers:

\begin{proposition}
\label{prop.intset.inclist-k} Let $k\in\mathbb{N}$. Let $S$ be a $k$-element
set of integers. Then, there exists a unique $k$-tuple $\left(  s_{1}%
,s_{2},\ldots,s_{k}\right)  $ of integers satisfying
\[
\left\{  s_{1},s_{2},\ldots,s_{k}\right\}  =S\ \ \ \ \ \ \ \ \ \ \text{and}%
\ \ \ \ \ \ \ \ \ \ s_{1}<s_{2}<\cdots<s_{k}.
\]

\end{proposition}

This proposition is just saying that if you are given a $k$-element set $S$ of
integers, then there is a unique way to list the elements of $S$ in increasing
order (with no repetitions). Intuitively, this is clear (just write down the
smallest element of $S$, then the second-smallest element, then the
third-smallest, and so on, until you run out of elements; it's not like you
have any other options!). But intuition is not proof. Nevertheless, we will
not stoop down to this low a foundational level here\footnote{A boring and
detailed (but ultimately very simple) proof of Proposition
\ref{prop.intset.inclist-k} can be found in \cite[proof of Theorem
2.46]{detnotes}.}, and just take Proposition \ref{prop.intset.inclist-k} for granted.

In connection with Proposition \ref{prop.intset.inclist-k}, we introduce a notation:

\begin{convention}
\label{conv.intset.inclist-setbrace}Let $s_{1},s_{2},\ldots,s_{k}$ be some
integers. Then, the notation \textquotedblleft$\left\{  s_{1}<s_{2}%
<\cdots<s_{k}\right\}  $\textquotedblright\ shall mean the set $\left\{
s_{1},s_{2},\ldots,s_{k}\right\}  $ and additionally signify that the chain of
inequalities $s_{1}<s_{2}<\cdots<s_{k}$ holds.
\end{convention}

Thus, for example, $\left\{  2<4<5\right\}  $ is the set $\left\{
2,4,5\right\}  $, whereas the expression $\left\{  4<2<5\right\}  $ is meaningless.

Proposition \ref{prop.intset.inclist-k} can now be restated as follows: If
$k\in\mathbb{N}$, then any $k$-element set of integers can be written in the
form $\left\{  s_{1}<s_{2}<\cdots<s_{k}\right\}  $ for a unique $k$-tuple
$\left(  s_{1},s_{2},\ldots,s_{k}\right)  $ of integers.

We are now ready to prove Theorem \ref{thm.count.lacs.size}:

\begin{proof}
[Proof of Theorem \ref{thm.count.lacs.size}.]Let $m:=n+1-k$. Then,
$m=n+1-k\geq0$ (since $k\leq n+1$), so that $\left[  m\right]  $ is an
$m$-element set. Also, $m=n+1-k=n-\left(  k-1\right)  $, so that $m+\left(
k-1\right)  =n$.

Now, if $S=\left\{  s_{1}<s_{2}<\cdots<s_{k}\right\}  $ is a $k$-element
lacunar subset of $\left[  n\right]  $, then $\overleftarrow{S}$ shall mean
the set%
\begin{align*}
&  \left\{  s_{i}-\left(  i-1\right)  \ \mid\ i\in\left[  k\right]  \right\}
\\
&  =\left\{  s_{1},\ s_{2}-1,\ s_{3}-2,\ \ldots,\ s_{k}-\left(  k-1\right)
\right\}  .
\end{align*}
This set $\overleftarrow{S}$ is obtained from $S$ by the following process:

\begin{itemize}
\item Leave the smallest element of $S$ unchanged.

\item Decrease the second-smallest element of $S$ by $1$.

\item Decrease the third-smallest element of $S$ by $2$.

\item And so on, until eventually decreasing the largest (= $k$-th-smallest)
element of $S$ by $k-1$.
\end{itemize}

We refer to this process as the \textbf{compression process}, as it causes the
elements of $S$ to come closer together (in such a way that the distance
between any two \textquotedblleft positionally adjacent\textquotedblright%
\ elements\footnote{We call two elements $i$ and $j$ of $S$ \textquotedblleft%
\textbf{positionally adjacent}\textquotedblright\ if they satisfy $i<j$ but
there are no other elements of $S$ lying between them (i.e., there are no
elements $s\in S$ satisfying $i<s<j$). For example, the elements $4$ and $6$
of the set $\left\{  2,4,6,8\right\}  $ are positionally adjacent, but the
elements $4$ and $6$ of the set $\left\{  2,3,4,5,6\right\}  $ are not (since
the element $5$ lies between them).} of $S$ shrinks by $1$). Consequently, we
call the resulting set $\overleftarrow{S}$ the \textbf{compression} of $S$.
For example, if $S=\left\{  3<5<9<11\right\}  $, then $\overleftarrow{S}%
=\left\{  3<4<7<8\right\}  $. Let us illustrate this example graphically:%
\[%
%TCIMACRO{\TeXButton{tikz compression example}{\begin{tikzpicture}
%\filldraw[fill=cyan!20!white] (0.5, 1.5) rectangle (12, 2.5);
%\node(A3) at (3, 2) {$3$};
%\node(A5) at (5, 2) {$5$};
%\node(A9) at (9, 2) {$9$};
%\node(A11) at (11, 2) {$11$};
%\node(Aname) at (0, 2) {$S$};
%\filldraw[fill=yellow!80!white] (0.5, -0.5) rectangle (9, 0.5);
%\node(B3) at (3, 0) {$3$};
%\node(B4) at (4, 0) {$4$};
%\node(B7) at (7, 0) {$7$};
%\node(B8) at (8, 0) {$8$};
%\node(Bname) at (0, 0) {$\overleftarrow{S}$};
%\draw[->, very thick, red] (A3) -- (B3);
%\draw[->, very thick, red] (A5) -- (B4);
%\draw[->, very thick, red] (A9) -- (B7);
%\draw[->, very thick, red] (A11) -- (B8);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\filldraw[fill=cyan!20!white] (0.5, 1.5) rectangle (12, 2.5);
\node(A3) at (3, 2) {$3$};
\node(A5) at (5, 2) {$5$};
\node(A9) at (9, 2) {$9$};
\node(A11) at (11, 2) {$11$};
\node(Aname) at (0, 2) {$S$};
\filldraw[fill=yellow!80!white] (0.5, -0.5) rectangle (9, 0.5);
\node(B3) at (3, 0) {$3$};
\node(B4) at (4, 0) {$4$};
\node(B7) at (7, 0) {$7$};
\node(B8) at (8, 0) {$8$};
\node(Bname) at (0, 0) {$\overleftarrow{S}$};
\draw[->, very thick, red] (A3) -- (B3);
\draw[->, very thick, red] (A5) -- (B4);
\draw[->, very thick, red] (A9) -- (B7);
\draw[->, very thick, red] (A11) -- (B8);
\end{tikzpicture}%
%EndExpansion
\]
(note that each of the red arrows is slightly more horizontal than the
previous one).

We note the following properties of compression: If $S=\left\{  s_{1}%
<s_{2}<\cdots<s_{k}\right\}  $ is a $k$-element lacunar subset of $\left[
n\right]  $, then its compression $\overleftarrow{S}$ is still a $k$-element
set (i.e., the compression process does not cause any two distinct elements to
\textquotedblleft collide\textquotedblright) and can be written as%
\[
\left\{  s_{1}<s_{2}-1<s_{3}-2<\cdots<s_{k}-\left(  k-1\right)  \right\}
\]
(since $S$ is lacunar, so that any two \textquotedblleft positionally
adjacent\textquotedblright\ elements $s_{i}$ and $s_{i+1}$ of $S$ satisfy
$s_{i}<s_{i+1}-1$ and thus $s_{i}-\left(  i-1\right)  <\left(  s_{i+1}%
-1\right)  -\left(  i-1\right)  =s_{i+1}-i$). Furthermore, $\overleftarrow{S}$
is a subset of $\left[  m\right]  $ (because its smallest element is
$s_{1}\geq1$ (since $s_{1}\in S\subseteq\left[  n\right]  $), whereas its
largest element is $\underbrace{s_{k}}_{\substack{\leq n\\\text{(since }%
s_{k}\in S\subseteq\left[  n\right]  \text{)}}}-\left(  k-1\right)  \leq
n-\left(  k-1\right)  =m$). Thus, we can define a map%
\begin{align*}
\operatorname*{compress}:\left\{  k\text{-element lacunar subsets of }\left[
n\right]  \right\}   &  \rightarrow\left\{  k\text{-element subsets of
}\left[  m\right]  \right\}  ,\\
S  &  \mapsto\overleftarrow{S}.
\end{align*}


Conversely, if $T=\left\{  t_{1}<t_{2}<\cdots<t_{k}\right\}  $ is a
$k$-element subset of $\left[  m\right]  $, then $\overrightarrow{T}$ shall
mean the set%
\begin{align*}
&  \left\{  t_{i}+\left(  i-1\right)  \ \mid\ i\in\left[  k\right]  \right\}
\\
&  =\left\{  t_{1},\ t_{2}+1,\ t_{3}+2,\ \ldots,\ t_{k}+\left(  k-1\right)
\right\}  .
\end{align*}
This set $\overrightarrow{T}$ is obtained from $T$ by the following process:

\begin{itemize}
\item Leave the smallest element of $T$ unchanged.

\item Increase the second-smallest element of $T$ by $1$.

\item Increase the third-smallest element of $T$ by $2$.

\item And so on, until eventually increasing the largest (= $k$-th-smallest)
element of $T$ by $k-1$.
\end{itemize}

We refer to this process as the \textbf{expansion process}, as it causes the
elements of $T$ to drift further apart (in such a way that the distance
between any two \textquotedblleft positionally adjacent\textquotedblright%
\ elements of $T$ increases by $1$). Consequently, we call the resulting set
$\overrightarrow{T}$ the \textbf{expansion} of $T$. For example, if
$T=\left\{  3<4<7<8\right\}  $, then $\overrightarrow{T}=\left\{
3<5<9<11\right\}  $. Let us illustrate this example graphically:%
\[%
%TCIMACRO{\TeXButton{tikz expansion example}{\begin{tikzpicture}
%\filldraw[fill=yellow!80!white] (0.5, 1.5) rectangle (9, 2.5);
%\node(A3) at (3, 2) {$3$};
%\node(A4) at (4, 2) {$4$};
%\node(A7) at (7, 2) {$7$};
%\node(A8) at (8, 2) {$8$};
%\node(Aname) at (0, 2) {$T$};
%\filldraw[fill=cyan!20!white] (0.5, -0.5) rectangle (12, 0.5);
%\node(B3) at (3, 0) {$3$};
%\node(B5) at (5, 0) {$5$};
%\node(B9) at (9, 0) {$9$};
%\node(B11) at (11, 0) {$11$};
%\node(Bname) at (0, 0) {$\overrightarrow{T}$};
%\draw[->, very thick, red] (A3) -- (B3);
%\draw[->, very thick, red] (A4) -- (B5);
%\draw[->, very thick, red] (A7) -- (B9);
%\draw[->, very thick, red] (A8) -- (B11);
%\end{tikzpicture}}}%
%BeginExpansion
\begin{tikzpicture}
\filldraw[fill=yellow!80!white] (0.5, 1.5) rectangle (9, 2.5);
\node(A3) at (3, 2) {$3$};
\node(A4) at (4, 2) {$4$};
\node(A7) at (7, 2) {$7$};
\node(A8) at (8, 2) {$8$};
\node(Aname) at (0, 2) {$T$};
\filldraw[fill=cyan!20!white] (0.5, -0.5) rectangle (12, 0.5);
\node(B3) at (3, 0) {$3$};
\node(B5) at (5, 0) {$5$};
\node(B9) at (9, 0) {$9$};
\node(B11) at (11, 0) {$11$};
\node(Bname) at (0, 0) {$\overrightarrow{T}$};
\draw[->, very thick, red] (A3) -- (B3);
\draw[->, very thick, red] (A4) -- (B5);
\draw[->, very thick, red] (A7) -- (B9);
\draw[->, very thick, red] (A8) -- (B11);
\end{tikzpicture}%
%EndExpansion
\]
(note that each of the red arrows is slightly more horizontal than the
previous one).

We note the following properties of expansion: If $T=\left\{  t_{1}%
<t_{2}<\cdots<t_{k}\right\}  $ is a $k$-element subset of $\left[  m\right]
$, then its expansion $\overrightarrow{T}$ is still a $k$-element set (i.e.,
the expansion process does not cause any two distinct elements to
\textquotedblleft collide\textquotedblright) and can be written as%
\[
\left\{  t_{1}<t_{2}+1<t_{3}+2<\cdots<t_{k}+\left(  k-1\right)  \right\}
\]
(since each $i\in\left[  k-1\right]  $ satisfies $t_{i}<t_{i+1}$ and thus
$t_{i}+\left(  i-1\right)  <t_{i+1}+\left(  i-1\right)  <t_{i+1}+i$).
Furthermore, $\overrightarrow{T}$ is a subset of $\left[  n\right]  $ (because
its smallest element is $t_{1}\geq1$ (since $t_{1}\in T\subseteq\left[
m\right]  $), whereas its largest element is $\underbrace{t_{k}}%
_{\substack{\leq m\\\text{(since }t_{k}\in T\subseteq\left[  m\right]
\text{)}}}+\left(  k-1\right)  \leq m+\left(  k-1\right)  =n$), and is lacunar
(since the expansion process ensures that the distance between any two
\textquotedblleft positionally adjacent\textquotedblright\ elements of $T$ has
been increased by $1$ in $\overrightarrow{T}$, so they can no longer be
consecutive integers). Thus, we can define a map%
\begin{align*}
\operatorname{expand}:\left\{  k\text{-element subsets of }\left[  m\right]
\right\}   &  \rightarrow\left\{  k\text{-element lacunar subsets of }\left[
n\right]  \right\}  ,\\
T  &  \mapsto\overrightarrow{T}.
\end{align*}


It is easy to see that the map $\operatorname{expand}$ is an inverse of
$\operatorname*{compress}$\ \ \ \ \footnote{In fact, each $k$-element subset
$T$ of $\left[  m\right]  $ satisfies $\operatorname*{compress}\left(
\operatorname{expand}T\right)  =T$, because if we write $T$ as $T=\left\{
t_{1}<t_{2}<\cdots<t_{k}\right\}  $, then%
\[
\operatorname{expand}T=\operatorname{expand}\left(  \left\{  t_{1}%
<t_{2}<\cdots<t_{k}\right\}  \right)  =\left\{  t_{1}<t_{2}+1<t_{3}%
+2<\cdots<t_{k}+\left(  k-1\right)  \right\}
\]
and therefore%
\begin{align*}
\operatorname*{compress}\left(  \operatorname{expand}T\right)   &
=\operatorname*{compress}\left(  \left\{  t_{1}<t_{2}+1<t_{3}+2<\cdots
<t_{k}+\left(  k-1\right)  \right\}  \right) \\
&  =\left\{  t_{1}<\left(  t_{2}+1\right)  -1<\left(  t_{3}+2\right)
-2<\cdots<\left(  t_{k}+\left(  k-1\right)  \right)  -\left(  k-1\right)
\right\} \\
&  =\left\{  t_{1}<t_{2}<\cdots<t_{k}\right\}  =T.
\end{align*}
A similar argument shows that any $k$-element lacunar subset $S$ of $\left[
n\right]  $ satisfies $\operatorname{expand}\left(  \operatorname*{compress}%
S\right)  =S$.}. Hence, the map $\operatorname*{compress}$ has an inverse,
i.e., is bijective. Thus, it is a bijection from $\left\{  k\text{-element
lacunar subsets of }\left[  n\right]  \right\}  $ to $\left\{  k\text{-element
subsets of }\left[  m\right]  \right\}  $. Hence, the bijection principle
yields%
\begin{align*}
&  \left(  \text{\# of }k\text{-element lacunar subsets of }\left[  n\right]
\right) \\
&  =\left(  \text{\# of }k\text{-element subsets of }\left[  m\right]  \right)
\\
&  =\dbinom{m}{k}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Theorem 4.7.4 in Lecture 16}\\
\text{(applied to }m\text{ and }\left[  m\right]  \text{ instead of }n\text{
and }S\text{)}%
\end{array}
\right) \\
&  =\dbinom{n+1-k}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }m=n+1-k\right)
.
\end{align*}
This proves Theorem \ref{thm.count.lacs.size}.
\end{proof}

\subsubsection{A corollary}

Combining Theorem \ref{thm.count.lacs.size} with Theorem
\ref{thm.count.lacs.all}, we obtain a curious formula for the Fibonacci
numbers in terms of binomial coefficients:

\begin{corollary}
\label{cor.fib.sum-binom}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}%
+\cdots+\dbinom{n-n}{n}.
\]

\end{corollary}

\begin{example}
For $n=5$, Corollary \ref{cor.fib.sum-binom} says that%
\begin{align*}
f_{6}  &  =\dbinom{6-0}{0}+\dbinom{6-1}{1}+\dbinom{6-2}{2}+\dbinom{6-3}{3}\\
&  \ \ \ \ \ \ \ \ \ \ +\dbinom{6-4}{4}+\dbinom{6-5}{5}+\dbinom{6-6}{6}\\
&  =\dbinom{6}{0}+\dbinom{5}{1}+\dbinom{4}{2}+\dbinom{3}{3}+\dbinom{2}%
{4}+\dbinom{1}{5}+\dbinom{0}{6}\\
&  =1+5+6+1+0+0+0,
\end{align*}
which is indeed true. Of course, the three summands that are $0$ could just as
well be excluded from the sum, and the sum $\sum_{k=0}^{n}\dbinom{n-k}{k}$ in
Corollary \ref{cor.fib.sum-binom} could be replaced by the smaller sum
$\sum_{k=0}^{\left\lfloor n/2\right\rfloor }\dbinom{n-k}{k}$ (since
$\dbinom{n-k}{k}=0$ whenever $\left\lfloor n/2\right\rfloor <k\leq n$); but I
find it more important to keep the sum simple than to minimize the number of
its addends.
\end{example}

\begin{proof}
[Proof of Corollary \ref{cor.fib.sum-binom}.]It is easy to see that any subset
of $\left[  n-1\right]  $ has a size between $0$ and $n$
(inclusive)\footnote{\textit{Proof.} Let $T$ be a subset of $\left[
n-1\right]  $. We must show that $T$ has a size between $0$ and $n$
(inclusive). In other words, we must prove that $\left\vert T\right\vert
\in\left\{  0,1,\ldots,n\right\}  $.
\par
However, we have $T\subseteq\left[  n-1\right]  \subseteq\left[  n\right]  $
and therefore $\left\vert T\right\vert \leq\left\vert \left[  n\right]
\right\vert $ (by Theorem 4.6.7 \textbf{(a)} in Lecture 16, applied to
$S=\left[  n\right]  $). Hence, $\left\vert T\right\vert \leq\left\vert
\left[  n\right]  \right\vert =n$. Since $\left\vert T\right\vert $ is a
nonnegative integer, we thus obtain $\left\vert T\right\vert \in\left\{
0,1,\ldots,n\right\}  $, as desired.}. (Actually, it cannot have size $n$
unless $n=0$, but I find it more convenient to nevertheless include the
\textquotedblleft unnecessary\textquotedblright\ value $n$ among the
theoretically possible sizes; I am not saying that all of these sizes actually
are achievable.)

Now, from $n\in\mathbb{N}$, we obtain $n\geq0$, thus $n-1\geq-1$. Hence,
Theorem \ref{thm.count.lacs.all} (applied to $n-1$ instead of $n$) yields%
\[
\left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \right)
=f_{\left(  n-1\right)  +2}=f_{n+1}.
\]
Therefore,%
\begin{align*}
f_{n+1}  &  =\left(  \text{\# of lacunar subsets of }\left[  n-1\right]
\right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  n-1\right]  \text{ having
size }0\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of lacunar subsets of }\left[
n-1\right]  \text{ having size }1\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of lacunar subsets of }\left[
n-1\right]  \text{ having size }2\right) \\
&  \ \ \ \ \ \ \ \ \ \ +\cdots\\
&  \ \ \ \ \ \ \ \ \ \ +\left(  \text{\# of lacunar subsets of }\left[
n-1\right]  \text{ having size }n\right) \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the sum rule (Theorem 4.6.6 in Lecture 6), since any}\\
\text{subset of }\left[  n-1\right]  \text{ has a size between }0\text{ and
}n\text{ (inclusive)}%
\end{array}
\right) \\
&  =\sum_{k=0}^{n}\underbrace{\left(  \text{\# of lacunar subsets of }\left[
n-1\right]  \text{ having size }k\right)  }_{\substack{=\left(  \text{\# of
}k\text{-element lacunar subsets of }\left[  n-1\right]  \right)
=\dbinom{\left(  n-1\right)  +1-k}{k}\\\text{(by Theorem
\ref{thm.count.lacs.size}, applied to }n-1\text{ instead of }n\\\text{(since
}k\leq n=\left(  n-1\right)  +1\text{))}}}\\
&  =\sum_{k=0}^{n}\dbinom{\left(  n-1\right)  +1-k}{k}=\sum_{k=0}^{n}%
\dbinom{n-k}{k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(  n-1\right)
+1=n\right) \\
&  =\dbinom{n-0}{0}+\dbinom{n-1}{1}+\cdots+\dbinom{n-n}{n}.
\end{align*}
This proves Corollary \ref{cor.fib.sum-binom}.
\end{proof}

\subsubsection{The domino tilings connection}

At the beginning of Chapter 2, I asked for the \# of ways to tile a
$2\times15$-rectangle with dominos (i.e., rectangles of size $1\times2$ or
$2\times1$), such as the following:%
\[
\begin{tikzpicture}[scale=0.8]
\draw (0, 0) rectangle (1, 2);
\draw (1, 0) rectangle (3, 1);
\draw (1, 1) rectangle (3, 2);
\draw (3, 0) rectangle (4, 2);
\draw (4, 0) rectangle (5, 2);
\draw (5, 0) rectangle (7, 1);
\draw (5, 1) rectangle (7, 2);
\draw (7, 0) rectangle (9, 1);
\draw (7, 1) rectangle (9, 2);
\draw (9, 0) rectangle (10, 2);
\draw (10, 0) rectangle (12, 1);
\draw (10, 1) rectangle (12, 2);
\draw (12, 0) rectangle (13, 2);
\draw (13, 0) rectangle (14, 2);
\draw (14, 0) rectangle (15, 2);
\end{tikzpicture}\ \ .
\]
Of course, the same problem can be asked for $n\times m$-rectangles for
arbitrary $n$ and $m$, but we shall focus on the case $n=2$ (that is,
rectangle of height $2$). (See \cite[\S 1.1]{19fco} for some references on the
much harder cases when $n>2$.)

It turns out that the ways to tile a $2\times m$-rectangle with dominos are in
bijection with the lacunar subsets of $\left[  m-1\right]  $. Indeed, if
$\mathcal{T}$ is a way to tile the $2\times m$-rectangle, then we let
$C\left(  \mathcal{T}\right)  $ be the set of all columns (counted from the
left) in which horizontal dominos of $\mathcal{T}$ start (where we say that a
\textbf{horizontal domino} is a domino of height $1$ and width $2$, and it
\textbf{starts} in the leftmost of the two columns that it spans). For
example, if $\mathcal{T}$ is the tiling shown above, then $C\left(
\mathcal{T}\right)  =\left\{  2,6,8,11\right\}  $. Now, it is not hard to see
(but not completely obvious; see \cite[\S 1.4.4, Second proof of Proposition
1.4.9]{19fco}) that the map%
\begin{align*}
\left\{  \text{ways to tile a }2\times m\text{-rectangle with dominos}%
\right\}   &  \rightarrow\left\{  \text{lacunar subsets of }\left[
m-1\right]  \right\}  ,\\
\mathcal{T}  &  \mapsto C\left(  \mathcal{T}\right)
\end{align*}
is a bijection, and therefore the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of ways to tile a }2\times m\text{-rectangle with
dominos}\right) \\
&  =\left(  \text{\# of lacunar subsets of }\left[  m-1\right]  \right)
=f_{m+1}%
\end{align*}
(by Theorem \ref{thm.count.lacs.all}, applied to $n=m-1$). In particular, for
$m=15$, we obtain%
\[
\left(  \text{\# of ways to tile a }2\times15\text{-rectangle with
dominos}\right)  =f_{15+1}=f_{16}=987.
\]


\subsection{Compositions and weak compositions}

Two other useful objects to count are \textbf{compositions} and \textbf{weak
compositions}.

\subsubsection{Compositions}

How many ways are there to write the integer $5$ as a sum of $3$ positive
integers, if the order matters? Since $5$ and $3$ are not very large numbers,
we can just list all these ways:%
\begin{align*}
5  &  =2+2+1=2+1+2=1+2+2\\
&  =3+1+1=1+3+1=1+1+3.
\end{align*}
So there are $6$ such ways.

What if we replace $5$ and $3$ by arbitrary nonnegative integers $n$ and $k$ ?
So we want to count the $k$-tuples $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $
of positive integers satisfying $a_{1}+a_{2}+\cdots+a_{k}=n$. These tuples
have a name:

\begin{definition}
\label{def.count.comps.comps}\textbf{(a)} If $n\in\mathbb{N}$, then a
\textbf{composition of }$n$ shall mean a tuple (i.e., finite list) of positive
integers whose sum is $n$.

\textbf{(b)} If $n,k\in\mathbb{N}$, then a \textbf{composition of }$n$\textbf{
into }$k$\textbf{ parts} shall mean a $k$-tuple of positive integers whose sum
is $n$.

(The word \textquotedblleft composition\textquotedblright\ here is completely
unrelated to the notion of composition of two functions.)
\end{definition}

\begin{example}
\textbf{(a)} The compositions of $5$ into $3$ parts are%
\begin{align*}
&  \left(  2,2,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,1,2\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,2,2\right)  ,\\
&  \left(  3,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,3,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,1,3\right)  .
\end{align*}
These are exactly the $6$ ways we found above (but written as $3$-tuples).

\textbf{(b)} The compositions of $3$ are%
\[
\left(  1,1,1\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  2,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  1,2\right)  ,\ \ \ \ \ \ \ \ \ \ \left(
3\right)  .
\]


\textbf{(c)} The only composition of $0$ is the empty list $\left(  {}\right)
$, which is a $0$-tuple. It is a composition into $0$ parts.
\end{example}

Let us now count compositions of $n$ into $k$ parts. (Later, we will count all
compositions of $n$.) Again, the answer turns out to be a binomial coefficient:

\begin{theorem}
\label{thm.count.comps.comps-nk}Let $n,k\in\mathbb{N}$. Then,%
\begin{equation}
\left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right)
=\dbinom{n-1}{n-k}. \label{eq.thm.count.comps.comps-nk.n-k}%
\end{equation}
If $n>0$, then we furthermore have%
\begin{equation}
\left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right)
=\dbinom{n-1}{k-1}. \label{eq.thm.count.comps.comps-nk.k-1}%
\end{equation}

\end{theorem}

\begin{proof}
[Proof sketch.]The proof is straightforward in the case when $n=0$. (Indeed,
if $n=0$, then the only composition of $n$ is the empty list $\left(
{}\right)  $, and this is a composition of $n$ into $0$ parts. Thus, if $n=0$,
then we have
\[
\left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right)  =%
\begin{cases}
1, & \text{if }k=0;\\
0, & \text{if }k\neq0;
\end{cases}
\]
but we also have%
\[
\dbinom{n-1}{n-k}=\dbinom{0-1}{0-k}=\dbinom{-1}{-k}=%
\begin{cases}
1, & \text{if }k=0;\\
0, & \text{if }k\neq0
\end{cases}
\ \ \ \ \ \ \ \ \ \ \left(  \text{check this!}\right)
\]
in this case, and we obtain (\ref{eq.thm.count.comps.comps-nk.n-k}) by
comparing these two equalities. Thus, Theorem \ref{thm.count.comps.comps-nk}
holds for $n=0$ (because the equality (\ref{eq.thm.count.comps.comps-nk.k-1})
is claimed for $n>0$ only).)

Thus, we only need to consider the case when $n\neq0$. Let us thus focus on
this case. From $n\neq0$, we obtain $n\geq1$ (since $n\in\mathbb{N}$), thus
$n-1\in\mathbb{N}$.

For any composition $a=\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ of $n$ into
$k$ parts, we define the \textbf{partial sum set} $C\left(  a\right)  $ to be
the set%
\begin{align*}
&  \ \left\{  a_{1},\ \ a_{1}+a_{2},\ \ a_{1}+a_{2}+a_{3},\ \ \ldots
,\ \ a_{1}+a_{2}+\cdots+a_{k-1}\right\} \\
=  &  \ \left\{  a_{1}+a_{2}+\cdots+a_{i}\ \mid\ i\in\left[  k-1\right]
\right\}  .
\end{align*}
This set $C\left(  a\right)  $ consists of all the \textquotedblleft partial
sums\textquotedblright\ $a_{1}+a_{2}+\cdots+a_{i}$ of the sum $a_{1}%
+a_{2}+\cdots+a_{k}$, except for the empty partial sum $a_{1}+a_{2}%
+\cdots+a_{0}$ (which is $0$ by definition) and the full sum $a_{1}%
+a_{2}+\cdots+a_{k}$ (which is $n$, since $a$ is a composition of $n$). Thus,
all elements of $C\left(  a\right)  $ are integers between $0$ and $n$
(exclusive) (since they have more addends than the empty partial sum, but
fewer than the full sum\footnote{and since all these addends are positive
(because a composition has positive entries)}). In other words, $C\left(
a\right)  $ is a subset of $\left\{  1,2,\ldots,n-1\right\}  =\left[
n-1\right]  $.

We can visualize the partial sum set $C\left(  a\right)  $ of a composition
$a=\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ as follows: The interval
$\left[  0,n\right]  _{\mathbb{R}}:=\left\{  x\in\mathbb{R}\ \mid\ 0\leq x\leq
n\right\}  $ on the real line has length $n$. If we split this interval into
blocks of lengths $a_{1},a_{2},\ldots,a_{k}$ (from left to right), then the
elements of $C\left(  a\right)  $ are precisely the endpoints of these blocks
(i.e., the points at which one block ends and the next begins), except for the
leftmost endpoint $0$ and the rightmost endpoint $n$. See this picture:%
\[%
%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) {$a_1$};
%\node[blue] (b) at (3.5 cm, 0.5 cm) {$a_2$};
%\node[blue] (c) at (5.0 cm, 0.5 cm) {$\cdots$};
%\node[blue] (d) at (6.5 cm, 0.5 cm) {$a_k$};
%\fill(0) circle (1pt) node[below] {$0$};
%\fill(3) circle (1pt) node[below] {$s_1$};
%\fill(4) circle (1pt) node[below] {$s_2$};
%\node(u) at (5 cm, -0.2 cm) {$\cdots$};
%\fill(6) circle (1pt) node[below] {$s_{k-1}$};
%\fill(7) circle (1pt) node[below] {$n$};
%\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.75,0.5);
%\draw[->, blue] (5.9,0.5) -- (5.25,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) {$a_1$};
\node[blue] (b) at (3.5 cm, 0.5 cm) {$a_2$};
\node[blue] (c) at (5.0 cm, 0.5 cm) {$\cdots$};
\node[blue] (d) at (6.5 cm, 0.5 cm) {$a_k$};
\fill(0) circle (1pt) node[below] {$0$};
\fill(3) circle (1pt) node[below] {$s_1$};
\fill(4) circle (1pt) node[below] {$s_2$};
\node(u) at (5 cm, -0.2 cm) {$\cdots$};
\fill(6) circle (1pt) node[below] {$s_{k-1}$};
\fill(7) circle (1pt) node[below] {$n$};
\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.75,0.5);
\draw[->, blue] (5.9,0.5) -- (5.25,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
\]
(on which the partial sums $a_{1}+a_{2}+\cdots+a_{i}$ are denoted by $s_{i}$).

It is thus easy to see that if $a$ is 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]  $. Thus, we obtain a map%
\begin{align*}
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*}
Furthermore, it is not hard to see that this map $C$ has an
inverse\footnote{This is easiest to see using the visual description of
$C\left(  a\right)  $ that we showed above: Given a $\left(  k-1\right)
$-element subset $I$ of $\left[  n-1\right]  $, we can use the elements of $I$
to subdivide the interval $\left[  0,n\right]  _{\mathbb{R}}$ into $k$ blocks.
The lengths of these blocks (listed from left to right) form a composition $a$
of $n$ into $k$ parts, and this composition satisfies $C\left(  a\right)  =I$.
Moreover, this composition is the only one with this property. Thus, the map
that sends each $\left(  k-1\right)  $-element subset $I$ of $\left[
n-1\right]  $ to the corresponding composition $a$ (whose construction we just
explained) is an inverse map of $C$.
\par
Rigorously, this can be restated as follows: For each $\left(  k-1\right)
$-element subset $I=\left\{  i_{1}<i_{2}<\cdots<i_{k-1}\right\}  $ of $\left[
n-1\right]  $ (where we are using Convention
\ref{conv.intset.inclist-setbrace} again), we can define a composition%
\[
A\left(  I\right)  :=\left(  i_{1}-i_{0},\ i_{2}-i_{1},\ i_{3}-i_{2}%
,\ \ldots,\ i_{k-1}-i_{k-2},\ i_{k}-i_{k-1}\right)  ,
\]
where we set $i_{0}:=0$ and $i_{k}:=n$. Then, the map%
\begin{align*}
A:\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\}  ,\\
I  &  \mapsto A\left(  I\right)
\end{align*}
is easily seen to be an inverse map of $C$. A detailed proof can be found in
\cite[solution to Exercise 1 \textbf{(b)}]{19f-hw0s} (except that the latter
solution does not pay attention to the size of the subset).}, and thus is a
bijection. Hence, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of compositions of }n\text{ into }k\text{ parts}\right) \\
&  =\left(  \text{\# of }\left(  k-1\right)  \text{-element subsets of
}\left[  n-1\right]  \right) \\
&  =\dbinom{n-1}{k-1}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by Theorem 4.7.4 in Lecture 16}\\
\text{(applied to }k-1\text{, }n-1\text{, and }\left[  n-1\right]  \text{
instead of }k\text{, }n\text{ and }S\text{)}%
\end{array}
\right) \\
&  =\dbinom{n-1}{\left(  n-1\right)  -\left(  k-1\right)  }%
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the symmetry of Pascal's triangle}\\
\text{(Theorem 2.5.7 in Lecture 6), since }n-1\in\mathbb{N}%
\end{array}
\right) \\
&  =\dbinom{n-1}{n-k}\ \ \ \ \ \ \ \ \ \ \left(  \text{since }\left(
n-1\right)  -\left(  k-1\right)  =n-k\right)  .
\end{align*}
Thus, both (\ref{eq.thm.count.comps.comps-nk.n-k}) and
(\ref{eq.thm.count.comps.comps-nk.k-1}) have been proved. This completes the
proof of Theorem \ref{thm.count.comps.comps-nk}.
\end{proof}

We can also count all compositions of a given $n$:

\begin{theorem}
\label{thm.count.comps.comps-n}Let $n$ be a positive integer. Then, the \# of
all compositions of $n$ is $2^{n-1}$.
\end{theorem}

\begin{proof}
[Proof sketch.]This can be proved using a similar argument as in Theorem
\ref{thm.count.comps.comps-nk} (but now we need to count all subsets of
$\left[  n-1\right]  $). See \cite[Exercise 1 \textbf{(b)}]{19f-hw0s} for details.
\end{proof}

Note that Theorem \ref{thm.count.comps.comps-n} does not hold for $n=0$ (since
$0$ has $1$ composition, but $2^{0-1}=\dfrac{1}{2}$).

\subsubsection{Weak compositions}

One particularly useful variant of compositions are the so-called \textbf{weak
compositions}. These are defined as tuples of nonnegative integers (i.e., they
differ from compositions in that their entries are allowed to be $0$). In
other words:

\begin{definition}
\textbf{(a)} If $n\in\mathbb{N}$, then a \textbf{weak composition of }$n$
shall mean a tuple of nonnegative integers whose sum is $n$.

\textbf{(b)} If $n,k\in\mathbb{N}$, then a \textbf{weak composition of }%
$n$\textbf{ into }$k$\textbf{ parts} shall mean a $k$-tuple of nonnegative
integers whose sum is $n$.
\end{definition}

For instance:

\begin{itemize}
\item The weak compositions of $2$ into $3$ parts are%
\begin{align*}
&  \left(  1,1,0\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,0,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  0,1,1\right)  ,\\
&  \left(  2,0,0\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  0,2,0\right)
,\ \ \ \ \ \ \ \ \ \ \left(  0,0,2\right)  .
\end{align*}


\item The weak compositions of $2$ into $2$ parts are%
\[
\left(  2,0\right)  ,\ \ \ \ \ \ \ \ \ \ \left(  1,1\right)
,\ \ \ \ \ \ \ \ \ \ \left(  0,2\right)  .
\]
(Note that any composition is a weak composition, but there are usually more
weak compositions than that.)

\item The weak compositions of $1$ are all tuples of the form
\[
\left(  \underbrace{0,0,\ldots,0}_{\text{any number of zeroes}}%
,1,\underbrace{0,0,\ldots,0}_{\text{any number of zeroes}}\right)  .
\]
Here, \textquotedblleft any number\textquotedblright\ allows for the
possibility of \textquotedblleft none\textquotedblright, and in particular the
$1$-tuple $\left(  1\right)  $ is a weak composition of $1$.
\end{itemize}

Counting all weak compositions of a given $n$ is no longer possible, since
there are infinitely many (as we just saw). But we can still count all weak
compositions of a given $n$ into $k$ parts for a given $k$.

\begin{theorem}
\label{thm.count.wcomps.wcomps-nk}Let $n,k\in\mathbb{N}$. Then,%
\[
\left(  \text{\# of weak compositions of }n\text{ into }k\text{ parts}\right)
=\dbinom{n+k-1}{n}.
\]


Moreover, if $n+k>0$ (that is, if $n$ and $k$ are not both $0$), then%
\[
\left(  \text{\# of weak compositions of }n\text{ into }k\text{ parts}\right)
=\dbinom{n+k-1}{k-1}.
\]

\end{theorem}

\begin{proof}
We shall deduce this from Theorem \ref{thm.count.comps.comps-nk}.

Indeed, if $b$ is a nonnegative integer, then $b+1$ is a positive integer.
Thus, if $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ is a weak composition of
$n$ into $k$ parts, then the $k$-tuple $\left(  a_{1}+1,\ a_{2}+1,\ \ldots
,\ a_{k}+1\right)  $ is a composition of $n+k$ into $k$ parts (since the sum
of its entries is%
\begin{align*}
\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)
}_{\substack{=n\\\text{(since }\left(  a_{1},a_{2},\ldots,a_{k}\right)  \text{
is a weak composition of }n\text{)}}}+\,k\\
&  =n+k
\end{align*}
). Thus, the 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*}
is well-defined. Similarly, the map
\begin{align*}
\left\{  \text{compositions of }n+k\text{ into }k\text{ parts}\right\}   &
\rightarrow\left\{  \text{weak compositions of }n\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*}
is well-defined. These two maps are clearly inverses of each other (since
adding $1$ and subtracting $1$ are inverse operations). Therefore, they are
bijections. The bijection principle thus yields%
\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.count.comps.comps-nk.n-k}), applied to }n+k\text{ instead of
}n\right) \\
&  =\dbinom{n+k-1}{n}.
\end{align*}
If $n+k>0$, then $n+k\geq1$ and thus $n+k-1\in\mathbb{N}$, so that this
becomes%
\begin{align*}
&  \left(  \text{\# of weak compositions of }n\text{ into }k\text{
parts}\right) \\
&  =\dbinom{n+k-1}{n}\\
&  =\dbinom{n+k-1}{\left(  n+k-1\right)  -n}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{by the symmetry of Pascal's triangle}\\
\text{(Theorem 2.5.7 in Lecture 6), since }n+k-1\in\mathbb{N}%
\end{array}
\right) \\
&  =\dbinom{n+k-1}{k-1}\ \ \ \ \ \ \ \ \ \ \text{in this case.}%
\end{align*}
Thus, Theorem \ref{thm.count.wcomps.wcomps-nk} is fully proved.
\end{proof}

\begin{thebibliography}{99999999}                                                                                         %


\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[19fco]{19fco}Darij Grinberg, \textit{Enumerative Combinatorics: class
notes (Drexel Fall 2019 Math 222 notes)}, 11 September 2022.\newline\url{http://www.cip.ifi.lmu.de/~grinberg/t/19fco/n/n.pdf}

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

\bibitem[Grinbe20]{detnotes}\href{https://arxiv.org/abs/2008.09862v3}{Darij
Grinberg, \textit{Notes on the combinatorial fundamentals of algebra}, 15
September 2022, arXiv:2008.09862v3}.

\bibitem[Math222]{Math222}Darij Grinberg, \textit{Math 222: Enumerative
Combinatorics, Fall 2022}.\newline\url{https://www.cip.ifi.lmu.de/~grinberg/t/22fco/}
\end{thebibliography}


\end{document}