\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=Thursday, December 29, 2022 17:40:43}
%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{\numboxed}[2]{\underbrace{\boxed{#1}}_{\text{box } #2}}
\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 24, version \today}
\ohead{page \thepage}
\cfoot{}
\begin{document}
\section*{Math 222 Fall 2022, Lecture 24: The twelvefold way}

\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}}}

\subsection{Solving the counting puzzle from Lecture 23}

In Lecture 23, we posed the following problem:

\begin{exercise}
\label{exe.count.tasks}Given $n$ persons ($n>0$) and $k$ tasks ($k>0$).

\textbf{(a)} What is the \# of ways to assign a task to each person such that
each task has at least $1$ person working on it?

\textbf{(b)} What if we additionally want to choose a leader for each task?
(The leader should be chosen from the people working on that task.)

\textbf{(c)} What if, instead of choosing leaders, we want to choose a
vertical hierarchy for each task? (A vertical hierarchy means a ranking of all
people working on this task, from highest to lowest; ties are not allowed.)
\medskip

\textbf{Example:} Assume that $n=8$ and $k=3$. Let our $8$ people be
$1,2,3,4,5,6,7,8$, and our $3$ tasks be $A,B,C$.

\textbf{(a)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1,2,5$\\\hline
$B$ & $3$\\\hline
$C$ & $4,6,7,8$\\\hline
\end{tabular}
\ \ .
\]


\textbf{(b)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1,2,5$ with leader $2$\\\hline
$B$ & $3$ with leader $3$\\\hline
$C$ & $4,6,7,8$ with leader $7$\\\hline
\end{tabular}
\ \ .
\]


\textbf{(c)} One option is%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1>5>2$\\\hline
$B$ & $3$\\\hline
$C$ & $7>8>4>6$\\\hline
\end{tabular}
\ \
\]
(where the \textquotedblleft$>$\textquotedblright\ sign means
\textquotedblleft is ranked above\textquotedblright).
\end{exercise}

Let us now answer it.

\begin{proof}
[Solution to Exercise \ref{exe.count.tasks}.]\textbf{(a)} The answer is
$\operatorname*{sur}\left(  n,k\right)  $.

\textit{Proof.} Choosing such an assignment is tantamount to choosing a
surjection from $\left\{  \text{people}\right\}  $ to $\left\{  \text{tasks}%
\right\}  $. \medskip

\textbf{(b)} The answer is $n^{\underline{k}}\cdot k^{n-k}$.

\textit{Proof.} First, choose a leader for each task. There are
$n^{\underline{k}}$ options for this (since the leaders have to be distinct,
so we are choosing an injective map from $\left\{  \text{tasks}\right\}  $ to
$\left\{  \text{people}\right\}  $). After the leaders have been chosen, each
of the remaining $n-k$ people joins one of the $k$ leaders. There are
$k^{n-k}$ options for this. \medskip

\textbf{(c)} The answer is $n!\cdot\dbinom{n-1}{k-1}$.

\textit{Proof.} WLOG, we assume that the $n$ people are called $1,2,\ldots,n$,
and the $k$ tasks are called $1,2,\ldots,k$.

First, we choose the $k$-tuple $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $,
where $a_{i}$ is the \# of people to work on task $i$. This $k$-tuple is a
composition of $n$ into $k$ parts (since its entries $a_{1},a_{2},\ldots
,a_{k}$ have to be positive integers and to sum up to $n$). Thus, there are
$\dbinom{n-1}{k-1}$ options for it (by Theorem 2.8.1 in Lecture 21). We shall
refer to this composition as the \textbf{headcount composition}.

Next, we choose a permutation $\sigma$ of $\left[  n\right]  $, and we put all
the $n$ people into a single vertical hierarchy:%
\[
\sigma\left(  1\right)  >\sigma\left(  2\right)  >\sigma\left(  3\right)
>\cdots>\sigma\left(  n\right)
\]
(where the symbol \textquotedblleft$>$\textquotedblright\ means
\textquotedblleft is ranked above\textquotedblright, not \textquotedblleft
larger as a number\textquotedblright). This hierarchy will be called the
\textbf{total hierarchy}.

Now, we assign the top $a_{1}$ people of this total hierarchy to task $1$, the
next-highest $a_{2}$ people to task $2$, and so on. This way, we have chosen
both an assignment of tasks and a hierarchy within each task. For example, if
$n=8$ and $k=3$ and $\left(  a_{1},a_{2},a_{3}\right)  =\left(  3,1,4\right)
$, and if $\sigma$ is the permutation of $\left[  8\right]  $ whose one-line
notation is $\left(  1,5,2,3,7,8,4,6\right)  $ (so that the total hierarchy is
$1>5>2>3>7>8>4>6$), then we get the following result:%
\[%
\begin{tabular}
[c]{|l|l|}\hline
task & people working on it\\\hline\hline
$A$ & $1>5>2$\\\hline
$B$ & $3$\\\hline
$C$ & $7>8>4>6$\\\hline
\end{tabular}
\
\]
(which is precisely the example given in the exercise).

Thus, by choosing a composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ of
$n$ into $k$ parts and a permutation $\sigma$ of $\left[  n\right]  $, we have
obtained an assignment of tasks and a hierarchy within each task. Note that
each choice of an assignment of tasks and a hierarchy within each task can be
constructed uniquely in this way (i.e., it is obtained from a unique
composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $ and a unique
permutation $\sigma$ of $\left[  n\right]  $). There are $\dbinom{n-1}{k-1}$
options for the composition $\left(  a_{1},a_{2},\ldots,a_{k}\right)  $, and
$n!$ options for the permutation $\sigma$. Thus, the total \# of possibilities
is $\dbinom{n-1}{k-1}\cdot n!=n!\cdot\dbinom{n-1}{k-1}$.
\end{proof}

\bigskip

\setcounter{section}{2}

\section{\label{chap.12way}The twelvefold way}

\setcounter{subsection}{2}

Now, back to our balls and boxes. Recall from Lecture 23:

\begin{itemize}
\item We are counting ways to place balls into boxes.

The balls are the elements of a given set $A$.

The boxes are the elements of a given set $X$.

We have defined an $L\rightarrow L$\textbf{ placement} to be a map from $A$ to
$X$. This is understood to be a way to place the balls in the boxes.

We have counted arbitrary, surjective and injective $L\rightarrow L$ placements.

\item We still want to count:

\begin{itemize}
\item $L\rightarrow U$ placements (i.e., placements where the boxes are
unlabelled, aka indistinguishable),

\item $U\rightarrow L$ placements (i.e., placements where the balls are unlabelled),

\item $U\rightarrow U$ placements (i.e., placements where everything is unlabelled).
\end{itemize}
\end{itemize}

\subsection{Relations and equivalence classes}

\subsubsection{What we need}

First, we need to define what \textquotedblleft unlabelled\textquotedblright%
\ means. The rigorous way to do so is via the concept of \textbf{equivalence
classes}. The idea behind this is to collect certain $L\rightarrow L$
placements into sets (these sets are the equivalence classes) and to count not
the placements themselves but rather the sets.

Specifically:

\begin{itemize}
\item The $L\rightarrow U$ placements are \textbf{sets} of $L\rightarrow L$
placements, where we throw two $L\rightarrow L$ placements into the same set
if they can be obtained from one another by permuting boxes.

\item The $U\rightarrow L$ placements are \textbf{sets} of $L\rightarrow L$
placements, where we throw two $L\rightarrow L$ placements into the same set
if they can be obtained from one another by permuting balls.

\item The $U\rightarrow U$ placements are \textbf{sets} of $L\rightarrow L$
placements, where we throw two $L\rightarrow L$ placements into the same set
if they can be obtained from one another by permuting boxes and permuting balls.
\end{itemize}

This \textquotedblleft throwing together\textquotedblright\ procedure is
easiest to formalize by defining \textbf{relations}.

\subsubsection{Relations}

What is a relation? For instance, divisibility (\textquotedblleft$x$ divides
$y$\textquotedblright) is a relation on the set $\mathbb{Z}$, since two
integers $x$ and $y$ can either satisfy or not satisfy \textquotedblleft$x$
divides $y$\textquotedblright. This relation is usually denoted by $\mid$.
Other famous relations on the set $\mathbb{Z}$ are $\leq$, $\geq$, $<$, $>$,
$=$, $\neq$ and $\vdots$. (The relation $\vdots$ is defined as follows:
$x\ \vdots\ y$ if and only if $y\mid x$.) Many more relations have no standard
notation for them, but can be easily defined. For instance, the relation
\textquotedblleft$x$ and $y$ are consecutive integers\textquotedblright\ (that
is, \textquotedblleft$y=x+1$ or $y=x-1$\textquotedblright) on $\mathbb{Z}$ is
an important relation in the study of lacunar sets.

Here is the general definition of a relation:

\begin{definition}
\label{def.12way.relation}Let $S$ be a set.

A \textbf{binary relation} (or, for short, \textbf{relation}) on $S$ is
formally defined as a subset of $S\times S$. If $R$ is a binary relation on
$S$, then the statement \textquotedblleft$\left(  x,y\right)  \in
R$\textquotedblright\ is commonly written as \textquotedblleft$x\ R\ y$%
\textquotedblright.

Informally, a binary relation on $S$ means a statement \textquotedblleft%
$x\ R\ y$\textquotedblright\ defined for every pair of elements $\left(
x,y\right)  \in S\times S$. For each pair $\left(  x,y\right)  \in S\times S$,
this statement $x\ R\ y$ is either true or false.
\end{definition}

The informal and the formal definitions of a binary relation are equivalent, because:

\begin{itemize}
\item Given a statement \textquotedblleft$x\ R\ y$\textquotedblright\ defined
for every pair $\left(  x,y\right)  \in S\times S$, we can encode it as a
subset of $S\times S$, namely as the subset%
\[
\left\{  \left(  x,y\right)  \in S\times S\ \mid\ x\ R\ y\right\}  .
\]


\item Conversely, every subset $T$ of $S\times S$ can be decoded into a
statement defined for every pair $\left(  x,y\right)  \in S\times S$ (namely,
the statement \textquotedblleft$\left(  x,y\right)  \in T$\textquotedblright).
\end{itemize}

\begin{example}
Consider the relation $\mid$ (\textquotedblleft divides\textquotedblright),
but not on the entire set $\mathbb{Z}$ but rather on its subset $\left[
6\right]  =\left\{  1,2,3,4,5,6\right\}  $. Then, formally speaking, this
relation is the following subset of $\left[  6\right]  \times\left[  6\right]
$:%
\begin{align*}
&  \{\left(  1,1\right)  ,\ \left(  1,2\right)  ,\ \left(  1,3\right)
,\ \left(  1,4\right)  ,\ \left(  1,5\right)  ,\ \left(  1,6\right)
,\ \left(  2,2\right)  ,\ \left(  2,4\right)  ,\ \left(  2,6\right)  ,\\
&  \ \ \ \ \ \ \ \ \ \ \left(  3,3\right)  ,\ \left(  3,6\right)  ,\ \left(
4,4\right)  ,\ \left(  5,5\right)  ,\ \left(  6,6\right)  \}.
\end{align*}
It consists of all pairs $\left(  x,y\right)  \in\left[  6\right]
\times\left[  6\right]  $ such that $x$ divides $y$.
\end{example}

\subsubsection{Box-, ball- and box-ball-equivalence}

Now, let us apply this to boxes and balls:

\begin{definition}
\label{def.12way.box-ball-eq}Consider the set $X^{A}$ of all $L\rightarrow L$
placements (i.e., of all maps from $A$ to $X$). On this set, we define three
relations%
\[
\overset{\operatorname*{box}}{\sim}%
,\ \ \ \ \ \ \ \ \ \ \overset{\operatorname*{ball}}{\sim}%
,\ \ \ \ \ \ \ \ \ \ \underset{\operatorname*{ball}%
}{\overset{\operatorname*{box}}{\sim}},
\]
which we will call \textbf{box-equivalence}, \textbf{ball-equivalence} and
\textbf{box-ball-equivalence} (respectively). These relations are defined as follows:

\begin{itemize}
\item Two $L\rightarrow L$ placements $f,g:A\rightarrow X$ are said to be
\textbf{box-equivalent} (and we write $f\overset{\operatorname*{box}}{\sim}g$)
if they can be obtained from one another by permuting the boxes (i.e., if
there exists a permutation $\xi$ of $X$ such that $f=\xi\circ g$).

\item Two $L\rightarrow L$ placements $f,g:A\rightarrow X$ are said to be
\textbf{ball-equivalent} (and we write $f\overset{\operatorname*{ball}}{\sim
}g$) if they can be obtained from one another by permuting the balls (i.e., if
there exists a permutation $\alpha$ of $A$ such that $f=g\circ\alpha$).

\item Two $L\rightarrow L$ placements $f,g:A\rightarrow X$ are said to be
\textbf{box-ball-equivalent} (and we write $f\underset{\operatorname*{ball}%
}{\overset{\operatorname*{box}}{\sim}}g$) if they can be obtained from one
another by permuting the balls and the boxes (i.e., if there exist a
permutation $\alpha$ of $A$ and a permutation $\xi$ of $X$ such that
$f=\xi\circ g\circ\alpha$).
\end{itemize}
\end{definition}

\begin{example}
We shall use the notations from \S 3.1 (in Lecture 23) to write $L\rightarrow
L$ placements. Let $A=\left[  6\right]  $ and $X=\left[  3\right]  $ (so that
the balls are $1,2,\ldots,6$, and the boxes are $1,2,3$). Consider the two
$L\rightarrow L$ placements%
\[
f=\left[  14\right]  \ \left[  235\right]  \ \left[  6\right]
\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ g=\left[  125\right]
\ \left[  36\right]  \ \left[  4\right]  .
\]
These two $L\rightarrow L$ placements $f$ and $g$ are not box-equivalent
(because no matter how we permute the boxes in $f$, the two balls $1$ and $4$
will stay together in the same box, but these two balls lie in different boxes
of $g$). They are not ball-equivalent either (because no matter how we permute
the balls in $f$, the first box will have $2$ balls, but in $g$ it has $3$
balls). However, they are box-ball-equivalent, because if we start with $f$,
then swap the first two boxes and furthermore appropriately permute the balls
(replacing balls $1,2,3,4,5,6$ by $3,1,2,6,5,4$, respectively), then we obtain
$g$.
\end{example}

\subsubsection{Equivalence classes}

The three relations introduced in Definition \ref{def.12way.box-ball-eq} are
there to tell us which of our $L\rightarrow L$ placements we should throw into
the same set when we count $L\rightarrow U$ placements, $U\rightarrow L$
placements and $U\rightarrow U$ placements. (For instance, in order to count
$L\rightarrow U$ placements, we need to throw any two box-equivalent
placements into the same set.)

The resulting sets will be called the \textbf{equivalence classes}. Here is
how these classes are defined in general:

\begin{definition}
\label{def.12way.eqclass}Let $\sim$ be a relation on a set $S$.

\textbf{(a)} For each $a\in S$, we define a subset $\left[  a\right]  _{\sim}$
of $S$ by%
\[
\left[  a\right]  _{\sim}=\left\{  b\in S\ \mid\ b\sim a\right\}  .
\]
This subset $\left[  a\right]  _{\sim}$ is called the \textbf{equivalence
class} of $a$ (for the relation $\sim$), or the $\sim$\textbf{-equivalence
class} of $a$.

\textbf{(b)} The \textbf{equivalence classes of }$\sim$ are defined to be the
sets $\left[  a\right]  _{\sim}$ for all $a\in S$. They are also called the
$\sim$\textbf{-equivalence classes}.
\end{definition}

\begin{example}
Let $S$ be the set $\mathbb{Z}$, and let $\sim$ be the relation
\textquotedblleft divides\textquotedblright\ (i.e., we let $b\sim a$ hold if
and only if $b$ divides $a$). Then, for any integer $a$, the equivalence class
$\left[  a\right]  _{\sim}$ is the set of all divisors of $a$. For instance,%
\[
\left[  6\right]  _{\sim}=\left\{  1,2,3,6,-1,-2,-3,-6\right\}  .
\]

\end{example}

Definition \ref{def.12way.eqclass} is slightly nonstandard. Usually, one
defines equivalence classes only for equivalence relations, not for arbitrary
relations. I have made it more general in order to get to the point faster.
Now, we can define the placements we want:

\begin{definition}
\label{def.12way.LtoU-etc}\textbf{(a)} An $L\rightarrow U$ \textbf{placement}
(from $A$ to $X$) shall mean a $\overset{\operatorname*{box}}{\sim}%
$-equivalence class.

\textbf{(b)} A $U\rightarrow L$ \textbf{placement} (from $A$ to $X$) shall
mean a $\overset{\operatorname*{ball}}{\sim}$-equivalence class.

\textbf{(c)} A $U\rightarrow U$ \textbf{placement} (from $A$ to $X$) shall
mean a $\underset{\operatorname*{ball}}{\overset{\operatorname*{box}}{\sim}}%
$-equivalence class.

\textbf{(d)} Let $\phi$ be an $L\rightarrow U$ or $U\rightarrow L$ or
$U\rightarrow U$ placement. Then, $\phi$ is a set of maps from $A$ to $X$. We
say that $\phi$ is \textbf{injective} if all of these maps in $\phi$ are
injective. We say that $\phi$ is \textbf{surjective} if all of these maps in
$\phi$ are surjective.
\end{definition}

\begin{example}
Let $X=\left[  2\right]  $ and $A=\left[  3\right]  $. As we found in Lecture
23, there are eight $L\rightarrow L$ placements $A\rightarrow X$, namely%
\begin{align*}
&  [123]\ [\ ],\\
&  [12]\ [3],\\
&  [13]\ [2],\\
&  [23]\ [1],\\
&  [1]\ [23],\\
&  [2]\ [13],\\
&  [3]\ [12],\\
&  [\ ]\ [123].
\end{align*}
Now let us see what the $L\rightarrow U$, $U\rightarrow L$ and $U\rightarrow
U$ placements are, defined as equivalence classes:

\textbf{(a)} The $L\rightarrow U$ placements are the four
$\overset{\operatorname*{box}}{\sim}$-equivalence classes
\begin{align*}
&  \left\{  [123]\ [\ ],\ \ \ \ [\ ]\ [123]\right\}  ,\\
&  \left\{  [12]\ [3],\ \ \ \ [3]\ [12]\right\}  ,\\
&  \left\{  [13]\ [2],\ \ \ \ [2]\ [13]\right\}  ,\\
&  \left\{  [23]\ [1],\ \ \ \ [1]\ [23]\right\}  .
\end{align*}
In the notations of Lecture 23, they are denoted by%
\begin{align*}
&  \underline{[123]\ [\ ]},\\
&  \underline{[12]\ [3]},\\
&  \underline{[13]\ [2]},\\
&  \underline{[23]\ [1]},
\end{align*}
respectively.

\textbf{(b)} The $U\rightarrow L$ placements are the four
$\overset{\operatorname*{ball}}{\sim}$-equivalence classes%
\begin{align*}
&  \left\{  [123]\ [\ ]\right\}  ,\\
&  \left\{  [12]\ [3],\ \ \ \ [13]\ [2],\ \ \ \ [23]\ [1]\right\}  ,\\
&  \left\{  [1]\ [23],\ \ \ \ [2]\ [13],\ \ \ \ [3]\ [12]\right\}  ,\\
&  \left\{  [\ ]\ [123]\right\}  .
\end{align*}
In the notations of Lecture 23, they are denoted by%
\begin{align*}
&  [\bullet\bullet\bullet]\ [\ ],\\
&  [\bullet\,\bullet]\ [\bullet],\\
&  [\bullet]\ [\bullet\,\bullet],\\
&  [\ ]\ [\bullet\bullet\bullet],
\end{align*}
respectively.

\textbf{(c)} The $U\rightarrow U$ placements are the two
$\underset{\operatorname*{ball}}{\overset{\operatorname*{box}}{\sim}}%
$-equivalence classes%
\begin{align*}
&  \left\{  [123]\ [\ ],\ \ \ \ [\ ]\ [123]\right\}  ,\\
&  \left\{
[12]\ [3],\ \ \ \ [13]\ [2],\ \ \ \ [23]\ [1],\ \ \ \ [1]\ [23],\ \ \ \ [2]\ [13],\ \ \ \ [3]\ [12]\right\}
.
\end{align*}
In the notations of Lecture 23, they are denoted by%
\begin{align*}
&  \underline{[\bullet\bullet\bullet]\ [\ ]},\\
&  \underline{[\bullet\,\bullet]\ [\bullet]},
\end{align*}
respectively.
\end{example}

Now we know precisely what we want to count!

\subsubsection{Equivalence relations}

Before we get to the actual counting, a few words about equivalence classes
are in order. As I said, we defined them rather generally. In this generality,
there is not much to say about these equivalence classes. They can overlap, be
empty, contain one another, etc..

However, they behave much better if $\sim$ is an \textbf{equivalence
relation}. Let's briefly define what this means:

\begin{definition}
\label{def.12way.eqrel}Let $\sim$ be a relation on a set $S$. We say that
$\sim$ is an \textbf{equivalence relation} if it satisfies the following three axioms:

\begin{itemize}
\item \textbf{Reflexivity:} For any $a\in S$, we have $a\sim a$.

\item \textbf{Symmetry:} For any $a,b\in S$, if $a\sim b$, then $b\sim a$.

\item \textbf{Transitivity:} For any $a,b,c\in S$, if $a\sim b$ and $b\sim c$,
then $a\sim c$.
\end{itemize}
\end{definition}

The relation \textquotedblleft divides\textquotedblright\ on $\mathbb{Z}$ is
not an equivalence relation (since it fails symmetry). The relation
\textquotedblleft is less than $1$ mile away from\textquotedblright\ (e.g., on
the set of all buildings in Philadelphia) is not an equivalence relation
either (since it fails transitivity). However, the relation \textquotedblleft
equals\textquotedblright\ (on an arbitrary set) is an equivalence relation, as
is the relation \textquotedblleft parallel\textquotedblright\ (on the set of
all straight lines in the Euclidean plane), as is the relation
\textquotedblleft is congruent modulo $5$\textquotedblright\ (on the set of
all integers). See \S 3.3.2 in the 2019 notes for many more examples of
equivalence relations.

The example we care about the most is the following:

\begin{proposition}
\label{prop.12way.box-eqrels}All three relations%
\[
\overset{\operatorname*{box}}{\sim}%
,\ \ \ \ \ \ \ \ \ \ \overset{\operatorname*{ball}}{\sim}%
,\ \ \ \ \ \ \ \ \ \ \underset{\operatorname*{ball}%
}{\overset{\operatorname*{box}}{\sim}}%
\]
on the set $X^{A}$ are equivalence relations.
\end{proposition}

\begin{proof}
See Exercise 3.3.3 in the 2019 notes. The proof is a straightforward
application of the following three simple facts:

\begin{itemize}
\item If $\alpha$ and $\beta$ are two permutations of the same set, then
$\alpha\circ\beta$ is also a permutation of this set.

\item If $\alpha$ is a permutation of a set, then $\alpha^{-1}$ is also a
permutation of this set.

\item The identity map $\operatorname*{id}\nolimits_{X}$ of a set $X$ is
always a permutation of $X$.
\end{itemize}
\end{proof}

Why are we singling out equivalence relations? The reason is that if $\sim$ is
an equivalence relation, then its equivalence classes are particularly well-behaved:

\begin{theorem}
\label{thm.12way.eqrel-eqclasses}Let $\sim$ be an equivalence relation on a
set $S$. Then, each element $s$ of $S$ belongs to \textbf{exactly one} $\sim
$-equivalence class, namely to its own $\sim$-equivalence class $\left[
s\right]  _{\sim}$.
\end{theorem}

(Note that the word \textquotedblleft exactly one\textquotedblright\ means
that if $s$ belongs to two $\sim$-equivalence classes $\left[  a\right]
_{\sim}$ and $\left[  b\right]  _{\sim}$, then these two classes $\left[
a\right]  _{\sim}$ and $\left[  b\right]  _{\sim}$ are identical, even though
we don't necessarily have $a=b$.)

\subsection{$U\rightarrow L$ placements}

Time to count!

Recall that the $U\rightarrow L$ placements are the
$\overset{\operatorname*{ball}}{\sim}$-equivalence classes. We will write them
using the $\bullet$-notation (as explained in Example \S 3.1 in Lecture 23).
For example, $[\bullet\,\bullet]\ [\bullet]$ means the $U\rightarrow L$
placement that puts two balls into box $1$ and one ball into box $2$.

\begin{proposition}
\label{prop.12way.UtoL.all}We have%
\begin{align*}
&  \left(  \text{\# of }U\rightarrow L\text{ placements }A\rightarrow X\right)
\\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{N}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right) \\
&  =\dbinom{\left\vert A\right\vert +\left\vert X\right\vert -1}{\left\vert
A\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The second equality sign follows from Theorem 2.8.5 in Lecture 21. It remains
to prove the first equality sign.

WLOG assume that the boxes are called $1,2,\ldots,\left\vert X\right\vert $.
(This is a harmless assumption, because of the isomorphism principle.)

Now, define the \textbf{occupancy list} of an ($L\rightarrow L$ or
$U\rightarrow L$) placement to be the $\left\vert X\right\vert $-tuple%
\[
\left(  \text{\# of balls in box }1,\ \ \text{\# of balls in box }%
2,\ \ \ldots,\ \ \text{\# of balls in box }\left\vert X\right\vert \right)
\in\mathbb{N}^{X}.
\]
So the occupancy list just remembers how many balls there are in each single
box. This is clearly well-defined, since ball-equivalent $L\rightarrow L$
placements have the same occupancy list (after all, swapping two balls doesn't
change the \# of balls in any given box).

Now, consider the map%
\[
\left\{  U\rightarrow L\text{ placements}\right\}  \rightarrow\left\{  \left(
x_{1},x_{2},\ldots,x_{\left\vert X\right\vert }\right)  \in\mathbb{N}%
^{\left\vert X\right\vert }\text{ }\mid\text{ }x_{1}+x_{2}+\cdots
+x_{\left\vert X\right\vert }=\left\vert A\right\vert \right\}
\]
that sends each $U\rightarrow L$ placement to its occupancy list. This map is
a bijection, because

\begin{itemize}
\item it is injective (any two $L\rightarrow L$ placements that have the same
occupancy list must be ball-equivalent, and thus constitute the same
$U\rightarrow L$ placement), and

\item it is surjective (any $\left\vert X\right\vert $-tuple $\left(
x_{1},x_{2},\ldots,x_{\left\vert X\right\vert }\right)  \in\mathbb{N}%
^{\left\vert X\right\vert }$ satisfying $x_{1}+x_{2}+\cdots+x_{\left\vert
X\right\vert }=\left\vert A\right\vert $ is the occupancy list of a
$U\rightarrow L$ placement, since we can simply put $x_{1}$ balls into box
$1$, put $x_{2}$ balls into box $2$, and so on).
\end{itemize}

Hence, the bijection principle yields%
\begin{align*}
&  \left(  \text{\# of }U\rightarrow L\text{ placements }A\rightarrow X\right)
\\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{N}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right)  ,
\end{align*}
and this proves the first equality sign. Proposition \ref{prop.12way.UtoL.all}
is thus proven.
\end{proof}

\begin{proposition}
\label{prop.12way.UtoL.sur}Let $\mathbb{P}=\left\{  1,2,3,\ldots\right\}  $.
Then,%
\begin{align*}
&  \left(  \text{\# of surjective }U\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\mathbb{P}^{\left\vert X\right\vert }\text{ satisfying }%
x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert A\right\vert
\right) \\
&  =\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert -\left\vert
X\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The first equality sign is proved similarly as in Proposition
\ref{prop.12way.UtoL.all}, but now the occupancy list consists of
\textbf{positive} integers (since a surjective $U\rightarrow L$ placement must
not leave any box empty). The second equality sign follows from Theorem 2.8.1
in Lecture 21.
\end{proof}

\begin{proposition}
\label{prop.12way.UtoL.inj}We have%
\begin{align*}
&  \left(  \text{\# of injective }U\rightarrow L\text{ placements
}A\rightarrow X\right) \\
&  =\left(  \text{\# of }\left(  x_{1},x_{2},\ldots,x_{\left\vert X\right\vert
}\right)  \in\left\{  0,1\right\}  ^{\left\vert X\right\vert }\text{
satisfying }x_{1}+x_{2}+\cdots+x_{\left\vert X\right\vert }=\left\vert
A\right\vert \right) \\
&  =\dbinom{\left\vert X\right\vert }{\left\vert A\right\vert }.
\end{align*}

\end{proposition}

\begin{proof}
The first equality sign is proved similarly as in Proposition
\ref{prop.12way.UtoL.all}, but now the occupancy list consists of $0$'s and
$1$'s (since a box in an injective $U\rightarrow L$ placement can only contain
$0$ or $1$ balls). The second equality sign follows from Theorem 2.8.4 in
Lecture 21.
\end{proof}

\bigskip

We can now fill in the first two rows of our twelvefold way table:%
\[%
\begin{tabular}
[c]{|c||c|c|c|}\hline
& arbitrary & injective & surjective\\\hline
$L\rightarrow L$ & $\left\vert X\right\vert ^{\left\vert A\right\vert }$ &
$\left\vert X\right\vert ^{\underline{\left\vert A\right\vert }}$ &
$\operatorname*{sur}\left(  \left\vert X\right\vert ,\left\vert A\right\vert
\right)  $\\\hline
$U\rightarrow L$ & $\dbinom{\left\vert A\right\vert +\left\vert X\right\vert
-1}{\left\vert A\right\vert }$ & $\dbinom{\left\vert X\right\vert }{\left\vert
A\right\vert }$ & $\dbinom{\left\vert A\right\vert -1}{\left\vert A\right\vert
-\left\vert X\right\vert }$\\\hline
$L\rightarrow U$ &  &  & \\\hline
$U\rightarrow U$ &  &  & \\\hline
\end{tabular}
\ \ \ \ \ .
\]


\subsection{$L\rightarrow U$ placements}

Now, let us move on to the $L\rightarrow U$ placements. These, as we recall,
are the $\overset{\operatorname*{box}}{\sim}$-equivalence classes. We again
want to count arbitrary, surjective and injective $L\rightarrow U$ placements.
The injective ones are the easiest to count:

\begin{proposition}
\label{prop.12way.LtoU.inj}We have%
\begin{align*}
&  \left(  \text{\# of injective }L\rightarrow U\text{ placements
}A\rightarrow X\right) \\
&  =\left[  \left\vert A\right\vert \leq\left\vert X\right\vert \right]  .
\end{align*}

\end{proposition}

\begin{proof}
We WLOG assume that the balls are called $1,2,\ldots,\left\vert A\right\vert
$, and that the boxes are called $1,2,\ldots,\left\vert X\right\vert $. Thus,
$A=\left\{  1,2,\ldots,\left\vert A\right\vert \right\}  =\left[  \left\vert
A\right\vert \right]  $ and $X=\left\{  1,2,\ldots,\left\vert X\right\vert
\right\}  =\left[  \left\vert X\right\vert \right]  $.

If $\left\vert A\right\vert >\left\vert X\right\vert $, then there are no
injective maps from $A$ to $X$ (by the Pigeonhole Principle for Injections)
and thus also no injective $L\rightarrow U$ placements (since these are
equivalence classes of injective maps from $A$ to $X$). Thus, the claim of
Proposition \ref{prop.12way.LtoU.inj} boils down to $0=0$ in this case.

It remains to handle the case when $\left\vert A\right\vert \leq\left\vert
X\right\vert $. In this case, there is at least one injective $L\rightarrow L$
placement $A\rightarrow X$, namely the $L\rightarrow L$ placement%
\[
\lbrack1]\ [2]\ \cdots\ [\left\vert A\right\vert ]\ [\ ]\ [\ ]\ \cdots\ [\ ].
\]
Let us denote this $L\rightarrow L$ placement by $f$.

Now, every injective $L\rightarrow L$ placement is box-equivalent to
$f$\ \ \ \ \footnote{\textit{Proof.} Let $g$ be an injective $L\rightarrow L$
placement. We must prove that $g$ is box-equivalent to $f$.
\par
Note that $A=\left\{  1,2,\ldots,\left\vert A\right\vert \right\}  =\left[
\left\vert A\right\vert \right]  $ and $X=\left\{  1,2,\ldots,\left\vert
X\right\vert \right\}  =\left[  \left\vert X\right\vert \right]  $.
\par
The placement $g$ must have a box (namely, $g\left(  1\right)  $) that
contains the ball $1$; a box (namely, $g\left(  2\right)  $) that contains the
ball $2$; and so on. Consider these $\left\vert A\right\vert $ boxes $g\left(
1\right)  ,g\left(  2\right)  ,\ldots,g\left(  \left\vert A\right\vert
\right)  $. All these boxes are distinct (since $g$ is injective, so that no
two balls are in the same box). Thus, we can find a permutation $\sigma$ of
$X=\left[  \left\vert X\right\vert \right]  $ that sends $1,2,\ldots
,\left\vert A\right\vert $ to $g\left(  1\right)  ,g\left(  2\right)
,\ldots,g\left(  \left\vert A\right\vert \right)  $. (Indeed, we can construct
such a permutation $\sigma$ by sending the first $\left\vert A\right\vert $
positive integers $1,2,\ldots,\left\vert A\right\vert $ to $g\left(  1\right)
,g\left(  2\right)  ,\ldots,g\left(  \left\vert A\right\vert \right)  $, while
sending the next $\left\vert X\right\vert -\left\vert A\right\vert $ positive
integers $\left\vert A\right\vert +1,\left\vert A\right\vert +2,\ldots
,\left\vert X\right\vert $ to the remaining $\left\vert X\right\vert
-\left\vert A\right\vert $ elements of $X$.)
\par
This permutation $\sigma$ then has the property that $g=\sigma\circ f$ (check
this!). Hence, $f$ and $g$ are box-equivalent (by the definition of
box-equivalence). Qed.}. Hence, there is only one box-equivalence class
consisting of injective maps, namely $\left[  f\right]
_{\overset{\operatorname*{box}}{\sim}}$. In other words, there is only one
injective $L\rightarrow U$ placement $A\rightarrow X$, namely $\left[
f\right]  _{\overset{\operatorname*{box}}{\sim}}$.

Therefore, $\left(  \text{\# of injective }L\rightarrow U\text{ placements
}A\rightarrow X\right)  =1=\left[  \left\vert A\right\vert \leq\left\vert
X\right\vert \right]  $. This proves Proposition \ref{prop.12way.LtoU.inj}.
\end{proof}

Next time, we will count surjective and general $L\rightarrow U$ placements.
This is far less easy.


\end{document}