\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=Saturday, December 24, 2022 20:24:42}
%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 }}
\definecolor{darkgreen}{rgb}{0,.5,0}
\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 222 Fall 2022, Lecture 17: Binomial coefficients}

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

\setcounter{section}{1}

\section{Binomial coefficients (cont'd)}

\setcounter{subsection}{3}

\subsection{Counting maps (cont'd)}

\setcounter{subsubsection}{4}

\setcounter{theo}{10}

\subsubsection{Surjective maps (cont'd)}

Last time, we introduced the notation $\operatorname*{sur}\left(  m,n\right)
$ for the \# of surjections\footnote{\textquotedblleft\textbf{Surjection}%
\textquotedblright\ means \textquotedblleft surjective map\textquotedblright.}
from $\left[  m\right]  $ to $\left[  n\right]  $. We noticed that this is
also the \# of surjective maps from any given $m$-element set to any given
$n$-element set.

Let us now compute this number. We shall do this in two different ways,
obtaining two different recursive formulas.

\bigskip

\textit{1st approach:} Fix $m\in\mathbb{N}$ and a positive integer $n>0$.
Thus, $n\in\left[  n\right]  $.

Given a surjective map $f:\left[  m\right]  \rightarrow\left[  n\right]  $, we
let $J_{f}$ be the set of all $i\in\left[  m\right]  $ such that $f\left(
i\right)  =n$. This $J_{f}$ is a nonempty subset of $\left[  m\right]  $
(nonempty because $f$ is surjective). Thus, by the sum rule, we have%
\begin{align*}
&  \left(  \text{\# of all surjective maps }f:\left[  m\right]  \rightarrow
\left[  n\right]  \right) \\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing}}\left(
\text{\# of all surjective maps }f:\left[  m\right]  \rightarrow\left[
n\right]  \text{ such that }J_{f}=J\right)  .
\end{align*}


Let us now compute the addends in the sum on the RHS.

Fix a nonempty subset $J$ of $\left[  m\right]  $. What is the \# of all
surjective maps $f:\left[  m\right]  \rightarrow\left[  n\right]  $ such that
$J_{f}=J\ $? Imagine trying to construct such a map $f$. Its values $f\left(
j\right)  $ on all elements $j\in J$ are already pre-determined, since each
$j\in J$ has to satisfy $f\left(  j\right)  =n$ (since $j\in J=J_{f}$). Its
remaining values (i.e., its values $f\left(  j\right)  $ with $j\notin J$)
must belong to $\left[  n-1\right]  $ (indeed, they cannot be $n$, since
$j\notin J=J_{f}$). Thus, $f$ has to send each element of $\left[  m\right]
\setminus J$ to some element of $\left[  n-1\right]  $.

Hence, picking a map $f:\left[  m\right]  \rightarrow\left[  n\right]  $ such
that $J_{f}=J$ is tantamount to picking a map from $\left[  m\right]
\setminus J$ to $\left[  n-1\right]  $. Moreover, if we want $f$ to be
surjective, we need to ensure that the latter map from $\left[  m\right]
\setminus J$ to $\left[  n-1\right]  $ is surjective (since any element of
$\left[  n-1\right]  $ that it does not take as a value will not be a value of
$f$ either).

Therefore, in order to construct a surjective map $f:\left[  m\right]
\rightarrow\left[  n\right]  $ such that $J_{f}=J$, all we need to do is to
pick a surjective map from $\left[  m\right]  \setminus J$ to $\left[
n-1\right]  $ (and then to set $f\left(  j\right)  =n$ for all $j\in J$). The
\# of ways to do this is $\operatorname*{sur}\left(  m-\left\vert J\right\vert
,\ n-1\right)  $, since $\left[  m\right]  \setminus J$ is an $\left(
m-\left\vert J\right\vert \right)  $-element set.

Thus, we obtain%
\begin{align}
&  \left(  \text{\# of all surjective maps }f:\left[  m\right]  \rightarrow
\left[  n\right]  \text{ such that }J_{f}=J\right) \nonumber\\
&  =\operatorname*{sur}\left(  m-\left\vert J\right\vert ,\ n-1\right)  .
\label{pf.prop.count-maps.sur.1.1}%
\end{align}


Forget that we fixed $J$. We have proved this equality
(\ref{pf.prop.count-maps.sur.1.1}) for every nonempty subset $J$ of $\left[
m\right]  $. Now let's pick up the above computation again:%
\begin{align*}
&  \left(  \text{\# of all surjective maps }f:\left[  m\right]  \rightarrow
\left[  n\right]  \right) \\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing
}}\underbrace{\left(  \text{\# of all surjective maps }f:\left[  m\right]
\rightarrow\left[  n\right]  \text{ such that }J_{f}=J\right)  }%
_{\substack{=\operatorname*{sur}\left(  m-\left\vert J\right\vert
,\ n-1\right)  \\\text{(by (\ref{pf.prop.count-maps.sur.1.1}))}}}\\
&  =\sum_{\substack{J\subseteq\left[  m\right]  ;\\J\neq\varnothing
}}\operatorname*{sur}\left(  m-\left\vert J\right\vert ,\ n-1\right) \\
&  =\sum_{k=1}^{m}\ \ \sum_{\substack{J\subseteq\left[  m\right]
;\\J\neq\varnothing;\\\left\vert J\right\vert =k}}\operatorname*{sur}\left(
m-\underbrace{\left\vert J\right\vert }_{=k},\ n-1\right)
\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we have split up our sum}\\
\text{by the value }\left\vert J\right\vert \text{, which is}\\
\text{always }\in\left\{  1,2,\ldots,m\right\} \\
\text{because }J\text{ is nonempty}%
\end{array}
\right) \\
&  =\sum_{k=1}^{m}\ \ \underbrace{\sum_{\substack{J\subseteq\left[  m\right]
;\\J\neq\varnothing;\\\left\vert J\right\vert =k}}\operatorname*{sur}\left(
m-k,\ n-1\right)  }_{\substack{=\left(  \text{\# of all nonempty }%
J\subseteq\left[  m\right]  \text{ satisfying }\left\vert J\right\vert
=k\right)  \cdot\operatorname*{sur}\left(  m-k,\ n-1\right)  }}\\
&  =\sum_{k=1}^{m}\underbrace{\left(  \text{\# of all nonempty }%
J\subseteq\left[  m\right]  \text{ satisfying }\left\vert J\right\vert
=k\right)  }_{\substack{=\left(  \text{\# of all }J\subseteq\left[  m\right]
\text{ satisfying }\left\vert J\right\vert =k\right)  \\\text{(since
}k>0\text{ ensures that any }k\text{-element set}\\\text{is automatically
nonempty)}}}\cdot\operatorname*{sur}\left(  m-k,\ n-1\right) \\
&  =\sum_{k=1}^{m}\underbrace{\left(  \text{\# of all }J\subseteq\left[
m\right]  \text{ satisfying }\left\vert J\right\vert =k\right)  }%
_{\substack{=\left(  \text{\# of all }k\text{-element subsets of }\left[
m\right]  \right)  =\dbinom{m}{k}\\\text{(by the combinatorial interpretation
of BCs)}}}\cdot\operatorname*{sur}\left(  m-k,\ n-1\right) \\
&  =\sum_{k=1}^{m}\dbinom{m}{k}\operatorname*{sur}\left(  m-k,\ n-1\right)  .
\end{align*}
Since the LHS of this equality is $\operatorname*{sur}\left(  m,n\right)  $,
we can rewrite this as%
\begin{align*}
\operatorname*{sur}\left(  m,n\right)   &  =\sum_{k=1}^{m}\dbinom{m}%
{k}\operatorname*{sur}\left(  m-k,\ n-1\right) \\
&  =\sum_{j=0}^{m-1}\underbrace{\dbinom{m}{m-j}}_{\substack{=\dbinom{m}%
{j}\\\text{(by the symmetry}\\\text{of Pascal's triangle)}}%
}\operatorname*{sur}\left(  j,\ n-1\right)  \ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we substituted }m-j\\
\text{for }k\text{ in the sum}%
\end{array}
\right) \\
&  =\sum_{j=0}^{m-1}\dbinom{m}{j}\operatorname*{sur}\left(  j,\ n-1\right)  .
\end{align*}


Let's state this as a proposition:

\begin{proposition}
\label{prop.count-maps.sur.1}Let $m\in\mathbb{N}$, and let $n$ be a positive
integer. Then,%
\[
\operatorname*{sur}\left(  m,n\right)  =\sum_{k=1}^{m}\dbinom{m}%
{k}\operatorname*{sur}\left(  m-k,\ n-1\right)  =\sum_{j=0}^{m-1}\dbinom{m}%
{j}\operatorname*{sur}\left(  j,\ n-1\right)  .
\]

\end{proposition}

This already gives a reasonably fast recursive way for computing
$\operatorname*{sur}\left(  m,n\right)  $. But we can do better, by taking a
different approach.

\bigskip

\textit{2nd approach:} Fix two positive integers $m$ and $n$. Let us classify
the surjections (= surjective maps) $f:\left[  m\right]  \rightarrow\left[
n\right]  $ according to the value $f\left(  m\right)  $.

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

\begin{itemize}
\item \textbf{red} if $f\left(  m\right)  =f\left(  i\right)  $ for some
$i\in\left[  m-1\right]  $;

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

For instance, the surjection $f:\left[  4\right]  \rightarrow\left[  3\right]
$ whose one-line notation\footnote{Recall that the one-line notation of a map
$f:\left[  4\right]  \rightarrow\left[  3\right]  $ is the $4$-tuple $\left(
f\left(  1\right)  ,\ f\left(  2\right)  ,\ f\left(  3\right)  ,\ f\left(
4\right)  \right)  $.} is $\left(  2,1,3,2\right)  $ is red (since $f\left(
4\right)  =2$ is also $f\left(  1\right)  $), but the surjection $f:\left[
4\right]  \rightarrow\left[  3\right]  $ whose one-line notation is $\left(
2,1,2,3\right)  $ is not (since $f\left(  4\right)  =3$ is neither $f\left(
1\right)  $ nor $f\left(  2\right)  $ nor $f\left(  3\right)  $).

Here is another way to think of \textquotedblleft red\textquotedblright\ and
\textquotedblleft green\textquotedblright: If we restrict a surjection
$f:\left[  m\right]  \rightarrow\left[  n\right]  $ to the subset $\left[
m-1\right]  $ (that is, if we remove the value $f\left(  m\right)  $), then we
obtain a map from $\left[  m-1\right]  $ to $\left[  n\right]  $ which may or
may not be surjective. If it is, then $f$ is red; if it is not, then $f$ is
green. In other words, $f$ is green if and only if the value $f\left(
m\right)  $ is \textquotedblleft load-bearing\textquotedblright\ for the
surjectivity of $f$. Note that if the map $f$ is green, then its restriction
to $\left[  m-1\right]  $ will not be a surjection from $\left[  m-1\right]  $
to $\left[  n\right]  $, but it will be a surjection from $\left[  m\right]  $
to $\left[  n\right]  \setminus\left\{  f\left(  m\right)  \right\}  $ (since
all elements of $\left[  n\right]  $ except for $f\left(  m\right)  $ will
still be taken as values).

Each surjection $f:\left[  m\right]  \rightarrow\left[  n\right]  $ is either
red or green (but not both). Hence, by the sum rule, we have%
\begin{align*}
&  \left(  \text{\# of surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right) \\
&  =\left(  \text{\# of red surjections }f:\left[  m\right]  \rightarrow
\left[  n\right]  \right)  +\left(  \text{\# of green surjections }f:\left[
m\right]  \rightarrow\left[  n\right]  \right)  .
\end{align*}
Time to compute the addends on the RHS.

\bigskip

Here is a way to construct a red surjection $f:\left[  m\right]
\rightarrow\left[  n\right]  $:

\begin{itemize}
\item First, we choose the value $f\left(  m\right)  $. There are $n$ options
for this, since $f\left(  m\right)  $ can be any element of $\left[  n\right]
$.

\item Then, we choose the remaining values $f\left(  1\right)  ,f\left(
2\right)  ,\ldots,f\left(  m-1\right)  $. This is tantamount to choosing a
surjection from $\left[  m-1\right]  $ to $\left[  n\right]  $ (since the map
$f$ should be red, so that even with the value $f\left(  m\right)  $ removed
it should still be surjective onto $\left[  n\right]  $). Thus, there are
$\operatorname*{sur}\left(  m-1,n\right)  $ options for this.
\end{itemize}

By the dependent product rule\footnote{or by the usual product rule}, the
total \# of possibilities to make these choices is $n\cdot\operatorname*{sur}%
\left(  m-1,\ n\right)  $. Thus,%
\[
\left(  \text{\# of red surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right)  =n\cdot\operatorname*{sur}\left(  m-1,\ n\right)  .
\]


\bigskip

Here is a way to construct a green surjection $f:\left[  m\right]
\rightarrow\left[  n\right]  $:

\begin{itemize}
\item First, we choose the value $f\left(  m\right)  $. There are $n$ options
for this.

\item Then, we choose the remaining values $f\left(  1\right)  ,f\left(
2\right)  ,\ldots,f\left(  m-1\right)  $. This is tantamount to choosing a
surjection from $\left[  m-1\right]  $ to $\left[  n\right]  \setminus\left\{
f\left(  m\right)  \right\}  $ (since $f$ has to be green, so that its value
$f\left(  m\right)  $ cannot be taken by $f$ on any input other than $m$, but
all the other elements of $\left[  n\right]  $ still appear as values). Thus,
there are $\operatorname*{sur}\left(  m-1,\ n-1\right)  $ options for this
(since $\left[  n\right]  \setminus\left\{  f\left(  m\right)  \right\}  $ is
an $\left(  n-1\right)  $-element set).
\end{itemize}

Applying the dependent product rule again\footnote{This time, we do need the
dependent product rule. The usual product rule would not help, since the
options for the values $f\left(  1\right)  ,f\left(  2\right)  ,\ldots
,f\left(  m-1\right)  $ depend on the choice of $f\left(  m\right)  $.}, we
see that%
\[
\left(  \text{\# of green surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right)  =n\cdot\operatorname*{sur}\left(  m-1,\ n-1\right)  .
\]


\bigskip

Altogether, we now have%
\begin{align*}
&  \left(  \text{\# of surjections }f:\left[  m\right]  \rightarrow\left[
n\right]  \right) \\
&  =\underbrace{\left(  \text{\# of red surjections }f:\left[  m\right]
\rightarrow\left[  n\right]  \right)  }_{=n\cdot\operatorname*{sur}\left(
m-1,\ n\right)  }+\underbrace{\left(  \text{\# of green surjections }f:\left[
m\right]  \rightarrow\left[  n\right]  \right)  }_{=n\cdot\operatorname*{sur}%
\left(  m-1,\ n-1\right)  }\\
&  =n\cdot\operatorname*{sur}\left(  m-1,\ n\right)  +n\cdot
\operatorname*{sur}\left(  m-1,\ n-1\right) \\
&  =n\cdot\left(  \operatorname*{sur}\left(  m-1,\ n\right)
+\operatorname*{sur}\left(  m-1,\ n-1\right)  \right)  .
\end{align*}
Since the LHS of this is $\operatorname*{sur}\left(  m,n\right)  $, we can
rewrite this as follows:

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

\end{proposition}

This recursive equation (which is very similar to Pascal's recurrence for BCs,
except for the $n$ factor) makes it easy to fill in a table of
$\operatorname*{sur}\left(  m,n\right)  $ numbers:%
\[
\hspace{-0.3cm}\hspace{-2.015pc} \scalebox{0.9}{
\setlength{\tabcolsep}{1pt}
\begin{tabular}
[c]{ll|ccccccccccccccc}\vphantom{$g^b$} &  & $\phantom{20}$ & $\phantom{20}$ &  &  &  &  &  &  &
$\overset{n=0}{\swarrow}$ & $\phantom{20}$ & $\overset{n=1}{\swarrow}$ &
$\phantom{20}$ & $\overset{n=2}{\swarrow}$ & $\phantom{20}$ &
$\overset{n=3}{\swarrow}$\\\hline
\vphantom{$g^b$} $m=0$ & $\rightarrow$ &  &  &  &  &  &  &  & $1$ &  & $0$ &
& $0$ &  & $0$ & \\
\vphantom{$g^b$} $m=1$ & $\rightarrow$ &  &  &  &  &  &  & $0$ &  & $1$ &  &
$0$ &  & $0$ &  & $0$\\
\vphantom{$g^b$} $m=2$ & $\rightarrow$ &  &  &  &  &  & $0$ &  & $1$ &  & $2$
&  & $0$ &  & $0$ & \\
\vphantom{$g^b$} $m=3$ & $\rightarrow$ &  &  &  &  & $0$ &  & $1$ &  & $6$ &
& $6$ &  & $0$ &  & $0$\\
\vphantom{$g^b$} $m=4$ & $\rightarrow$ &  &  &  & $0$ &  & $1$ &  & $14$ &  &
$36$ &  & $24$ &  & $0$ & \\
\vphantom{$g^b$} $m=5$ & $\rightarrow$ &  &  & $0$ &  & $1$ &  & $30$ &  &
$150$ &  & $240$ &  & $120$ &  & $0$\\
\vphantom{$g^b$} $m=6$ & $\rightarrow$ & $\phantom{15120}$ & $0$ &
$\phantom{15120}$ & $1$ & $\phantom{15120}$ & $62$ & $\phantom{15120}$ & $540$
& $\phantom{15120}$ & $1560$ & $\phantom{15120}$ & $1800$ & $\phantom{15120}$
& $720$ & $\phantom{15120}$\\
\vphantom{$g^b$} $m=7$ & $\rightarrow$ & $0$ & $\phantom{15120}$ & $1$ &
$\phantom{15120}$ & $126$ & $\phantom{15120}$ & $1806$ & $\phantom{15120}$ &
$8400$ & $\phantom{15120}$ & $16800$ & $\phantom{15120}$ & $15120$ &
$\phantom{15120}$ & $5040$\end{tabular}
}
\]


We also observe the following:

\begin{corollary}
\label{cor.count-maps.sur.n!}\textbf{(a)} We have $\operatorname*{sur}\left(
n,n\right)  =n!$ for each $n\in\mathbb{N}$.

\textbf{(b)} The integer $\operatorname*{sur}\left(  m,n\right)  $ is
divisible by $n!$ for each $m,n\in\mathbb{N}$.
\end{corollary}

\begin{proof}
Both parts follow easily by induction using Proposition
\ref{prop.count-maps.sur.2}. (See Corollary 2.4.15 and Exercise 2.4.3 in the
2019 notes for details.)
\end{proof}

\begin{remark}
Let $m,n\in\mathbb{N}$. The number $\dfrac{\operatorname*{sur}\left(
m,n\right)  }{n!}$ (which, by Corollary \ref{cor.count-maps.sur.n!}
\textbf{(b)}, is an integer) is often denoted by $%
%TCIMACRO{\QDATOPD{\{}{\}}{m}{n}}%
%BeginExpansion
\genfrac{\{}{\}}{0pt}{0}{m}{n}%
%EndExpansion
$, and is called a \textbf{Stirling number of the 2nd kind}. We will
eventually learn more about these numbers.
\end{remark}

\bigskip

So far we have seen recursive equations for $\operatorname*{sur}\left(
m,n\right)  $. What about explicit formulas? Here is the best one:

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

\end{theorem}

We will prove this quite soon (Lecture 20, Example 1). (See the 2019 notes for
an elementary proof using the above recurrences.)

\subsection{Sums of powers}

Recall that I teased you with a formula for $1^{m}+2^{m}+\cdots+n^{m}$ using
these $\operatorname*{sur}\left(  m,n\right)  $ numbers a while ago (Lecture
5, Theorem 1.2.7). We shall now prove it. First, a much more fundamental theorem:

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

\end{theorem}

\begin{proof}
Double counting.

Specifically, let us double-count the maps $f:\left[  m\right]  \rightarrow
\left[  k\right]  $.

On the one hand, the \# of such maps is clearly $k^{m}$ (by Theorem 2.4.1 in
Lecture 16).

On the other hand, every map $f:\left[  m\right]  \rightarrow\left[  k\right]
$ has a well-defined range (i.e., set of values). This range is a subset of
$\left[  k\right]  $. Thus, by the sum rule, we have
\begin{align*}
&  \left(  \text{\# of maps }f:\left[  m\right]  \rightarrow\left[  k\right]
\right)  \\
&  =\sum_{I\subseteq\left[  k\right]  }\underbrace{\left(  \text{\# of maps
}f:\left[  m\right]  \rightarrow\left[  k\right]  \text{ whose range is
}I\right)  }_{\substack{=\left(  \text{\# of surjections from }\left[
m\right]  \text{ to }I\right)  \\\text{(since the maps from }\left[  m\right]
\text{ to }\left[  k\right]  \text{ whose range is }I\\\text{are the same as
the surjections from }\left[  m\right]  \text{ to }I\text{)}}}\\
&  =\sum_{I\subseteq\left[  k\right]  }\underbrace{\left(  \text{\# of
surjections from }\left[  m\right]  \text{ to }I\right)  }%
_{=\operatorname*{sur}\left(  m,\left\vert I\right\vert \right)  }\\
&  =\sum_{I\subseteq\left[  k\right]  }\operatorname*{sur}\left(  m,\left\vert
I\right\vert \right)  =\sum_{i=0}^{k}\ \ \sum_{\substack{I\subseteq\left[
k\right]  ;\\\left\vert I\right\vert =i}}\operatorname*{sur}\left(
m,\underbrace{\left\vert I\right\vert }_{=i}\right)  \\
&  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \left(  \text{here, we have split
our sum according to the value of }\left\vert I\right\vert \right)  \\
&  =\sum_{i=0}^{k}\ \ \underbrace{\sum_{\substack{I\subseteq\left[  k\right]
;\\\left\vert I\right\vert =i}}\operatorname*{sur}\left(  m,i\right)
}_{\substack{=\dbinom{k}{i}\operatorname*{sur}\left(  m,i\right)
\\\text{(since the \# of addends in this sum}\\\text{is the \# of
}i\text{-element subsets of }\left[  k\right]  \text{,}\\\text{but this \# is
known to be }\dbinom{k}{i}\text{)}}}=\sum_{i=0}^{k}\dbinom{k}{i}%
\operatorname*{sur}\left(  m,i\right)  =\sum_{i=0}^{k}\operatorname*{sur}%
\left(  m,i\right)  \cdot\dbinom{k}{i}.
\end{align*}


Comparing the two results, we obtain%
\begin{equation}
k^{m}=\sum_{i=0}^{k}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}%
{i}.\label{pf.thm.sur.power-formula-N.0}%
\end{equation}
This is almost precisely the claim of Theorem \ref{thm.sur.power-formula-N},
except that the sum ranges over all $i\in\left\{  0,1,\ldots,k\right\}  $
instead of over all $i\in\left\{  0,1,\ldots,m\right\}  $. Fortunately, this
little difference is easy to bridge: We have $\dbinom{k}{i}=0$ whenever $i>k$
(since $k\in\mathbb{N}$). Thus, the sum $\sum_{i=0}^{k}\operatorname*{sur}%
\left(  m,i\right)  \cdot\dbinom{k}{i}$ does not change if we extend its range
from $i\in\left\{  0,1,\ldots,k\right\}  $ to all $i\in\mathbb{N}$. Hence,%
\begin{equation}
\sum_{i=0}^{k}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}%
=\sum_{i\in\mathbb{N}}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom
{k}{i}.\label{pf.thm.sur.power-formula-N.4}%
\end{equation}
However, we also recall (from Lecture 16, Proposition 2.4.10 \textbf{(f)})
that%
\begin{equation}
\operatorname*{sur}\left(  m,i\right)  =0\ \ \ \ \ \ \ \ \ \ \text{whenever
}m<i.\label{pf.thm.sur.power-formula-N.=01}%
\end{equation}
Thus, the sum $\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)
\cdot\dbinom{k}{i}$ does not change if we extend its range from $i\in\left\{
0,1,\ldots,m\right\}  $ to all $i\in\mathbb{N}$. Hence,%
\[
\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}%
=\sum_{i\in\mathbb{N}}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom
{k}{i}.
\]
Comparing this with (\ref{pf.thm.sur.power-formula-N.4}), we find
\[
\sum_{i=0}^{k}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}%
=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}.
\]
Thus, we can rewrite (\ref{pf.thm.sur.power-formula-N.0}) as
\[
k^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}.
\]
This proves Theorem \ref{thm.sur.power-formula-N}.
\end{proof}

Using the polynomial identity trick, we can generalize Theorem
\ref{thm.sur.power-formula-N}, replacing \textquotedblleft$k\in\mathbb{N}%
$\textquotedblright\ by \textquotedblleft$k\in\mathbb{R}$\textquotedblright:

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

\end{theorem}

\begin{proof}
Forget that we fixed $k$. Define the following two polynomials (in one
indeterminate $X$, with real coefficients):%
\[
P:=X^{m}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ Q:=\sum_{i=0}%
^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{X}{i}.
\]
Then, Theorem \ref{thm.sur.power-formula-N} says that $P\left(  k\right)
=Q\left(  k\right)  $ for all $k\in\mathbb{N}$. In other words, $P\left(
x\right)  =Q\left(  x\right)  $ for all $x\in\mathbb{N}$. Thus, by the
polynomial identity trick (Lecture 14, Corollary 2.2.5), we have $P=Q$, so
that $P\left(  k\right)  =Q\left(  k\right)  $ for all $k\in\mathbb{R}$. But
this is precisely the claim of Theorem \ref{thm.sur.power-formula-R}.
\end{proof}

Note, however, that we cannot extend Theorem \ref{thm.sur.power-formula-R} to
$m\in\mathbb{R}$, already because $k^{m}$ is not a polynomial in $m$ for fixed
$k$ (but also because $\operatorname*{sur}\left(  m,i\right)  $ is not defined
for $m\notin\mathbb{N}$, and because $m$ appears as a summation bound on the
right hand side).

\bigskip

Now, we can prove our formula for sums of powers (Lecture 5, Theorem 1.2.7).
Let us first derive a minor variation of it:

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

\end{theorem}

\begin{proof}
We have%
\begin{align*}
\sum_{k=0}^{n}\underbrace{k^{m}}_{\substack{=\sum_{i=0}^{m}\operatorname*{sur}%
\left(  m,i\right)  \cdot\dbinom{k}{i}\\\text{(by Theorem
\ref{thm.sur.power-formula-N})}}}  &  =\sum_{k=0}^{n}\ \ \sum_{i=0}%
^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom{k}{i}\\
&  =\sum_{i=0}^{m}\ \ \sum_{k=0}^{n}\operatorname*{sur}\left(  m,i\right)
\cdot\dbinom{k}{i}\ \ \ \ \ \ \ \ \ \ \left(
\begin{array}
[c]{c}%
\text{here, we interchanged}\\
\text{the summation signs}%
\end{array}
\right) \\
&  =\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\underbrace{\sum
_{k=0}^{n}\dbinom{k}{i}}_{\substack{=\dbinom{0}{i}+\dbinom{1}{i}%
+\cdots+\dbinom{n}{i}\\=\dbinom{n+1}{i+1}\\\text{(by the hockey-stick
identity}\\\text{(Lecture 7, Theorem 1.3.24))}}}\\
&  =\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)  \cdot\dbinom
{n+1}{i+1},\ \ \ \ \ \ \ \ \ \ \text{qed.}%
\end{align*}

\end{proof}

When $m>0$, the sum $\sum_{k=0}^{n}k^{m}$ can be rewritten as $\sum_{k=1}%
^{n}k^{m}=1^{m}+2^{m}+\cdots+n^{m}$, so the claim of Theorem
\ref{thm.sur.sum-of-powers-1} becomes%
\[
1^{m}+2^{m}+\cdots+n^{m}=\sum_{i=0}^{m}\operatorname*{sur}\left(  m,i\right)
\cdot\dbinom{n+1}{i+1}.
\]
This is precisely the claim of Theorem 1.2.7 in Lecture 5, just with the
variable $k$ renamed as $m$.


\end{document}