%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This is a sample of how lectures should be done in LaTeX and Xfig (figures)
%% THe only tricky part is how to do figures (USE xfig) and how to do
%% formulas. I can help you with that if you want.
%% Add a section to this file (see command \section) to start a new lecture.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\documentclass{article}
  \usepackage{graphicx}
  \usepackage{psfrag}
  \usepackage{latexsym}
  \usepackage{amsfonts}
\parskip 4pt
\newtheorem{thm}{Theorem}[section] 
\newtheorem{prop}[thm]{Proposition}
\newtheorem{defi}[thm]{Definition}
\newtheorem{lemma}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{exm}[thm]{Example}
\newtheorem{rem}[thm]{Remarks}
\newtheorem{pbm}[thm]{Question}
\newcommand{\proof}{\noindent {\it Proof: }}
\newcommand{\T}{{\cal T}}
\newcommand{\e}{\epsilon}
\newcommand{\w}{\omega}
\newcommand{\nat}{\mathbb N}
\newcommand{\real}{\mathbb R}
\newcommand{\Q}{\mathbb Q}
\newcommand{\Z}{\mathbb Z}


\def\endofproof{\hfill
\nobreak \hskip0pt plus 1fill \qquad \qed% \par
\medskip\noindent} \def\qed{\vbox{\hrule \hbox{\vrule\hbox to
5pt{\vbox to 6pt{\vfil}\hfil}\vrule}\hrule}}

\begin{document}

\title{Lecture Notes ``Enumerative Combinatorics''}

\maketitle 

\section{Lecture 1}

The goal of this course is to learn {\bf how to count!}  I am sure you
think you know already. If you do, see if you can tackle the following
problems:

\begin{enumerate}

\item Using 6 variables $x_1,x_2,x_3,x_4,x_5,x_6$ how many monomials of
degree 110 are there? For example $x_1^{50}x_2^{25}x_3^{20}x_4^{5}x_5^3x_6^7$.

\item In the USA we have counts of 1,5,10,25,50,100 cents. How many ways
are there to give change of \$ $2.75$?

\item If you have 10 non-commuting variables how many ways are there
to put parentheses to indicate order of multiplication?

\end{enumerate}

Our first goal is to give tools that would allow you to answer such
practical questions; very much like calculus is a general tool to answer
questions about functions. Our second goal is, when possible, answer
questions like those above for {\bf any} instance, e.g. we have $n$
variables and we count monomials of degree $d$ in terms of $d$ and $n$.
We seek {\bf compact representations} of the counting functions for those
cases or {\bf easy-to-evaluate formula}. We should remark here that
we do not deal with the equally important problem of estimating but
instead we focus only on computing the exact cardinality of finite sets.


There are two general principles or philosophies for counting. The first
is the {\bf bijection approach} which seeks to compute cardinalities of
sets by establishing a bijection between a set of known cardinality and
the set whose cardinality is unknown (just a using your fingers to count).
The second approach, the {\bf analytic-algebraic approach} to enumeration,
aims to find a description of the counting function from the knowledge
of a recurrence relation or a generating function. Let us solve the first
problem using two approaches:

A monomial $x_1^{\alpha_1}x_2^{\alpha_2}\dots x_n^{\alpha_n}$ of
degree $d$ has $\alpha_1+\dots+\alpha_n=d$. We set up a bijection
between such monomials and a vector of length $(n-1)+d$ full with dots
and bars. The recipe is $x_1^{\alpha_1}x_2^{\alpha_2}\dots
x_n^{\alpha_n}$ gets mapped to the vector that has $\alpha_1$ dots,
then a bar, $\alpha_2$ dots, then a bar, $\alpha_3$ dots, then a bar,
etc. ending with bar, the $n-1$-th bar, followed by $\alpha_n$
dots. For example, using $4$ variables $x_1^3x_2^4x_3x_4^2$ gives us
$(.,.,.,\vert,.,.,.,.\vert,.,\vert,.,.)$.  Similarly, the monomial
$x_3^7$ gives $(\vert,\vert,.,.,.,.,.,.,.,\vert)$.  It is not
difficult to convince yourself such dot/bar vectors are in bijection
to the monomials. In fact, all the important information is given by
the positions of the bars, because the rest we know are filled with
dots. There are $(n-1)+d$ symbols or positions, we need to choose
$n-1$ of them then the answer is ${d+n-1 \choose n-1}$ which is the
same as ${d+n-1 \choose d}$. Thus for six variables, there are
153476148 monomials of degree 110. We simply apply the well-known
formula ${m \choose k}=\frac{m!}{(m-k)! k!}$ (prove it is true!).

\pagebreak
\vfill

\section{Lecture 2}

Now analytically, we observe that all possible monomials in six
variables appear as terms of the infinite series

$(1+x_1+x_1^2+x_1^3+\dots)(1+x_2+x_2^2+x_2^3+\dots)(1+x_3+x_3^2+x_3^3+\dots)(1+x_4+x_4^2+x_4^3+\dots)(1+x_5+x_5^2+x_5^3+\dots)(1+x_6+x_6^2+x_6^3+\dots)$

which is the same as $\Pi_{i=1}^n \frac{1}{(1-x_i)}$. Note that if we
substitute $x_i=t$ then the coefficient of $t^d$ will count all the
monomials of degree $d$ because each one contributes one time to the
sum.  Thus all we need to know is the Taylor series expansion of the
series $\frac{1}{(1-t)^6}$ around $t=0$, namely
$1+6t+21t^2+56t^3+\dots$, and look at the coefficient $t^{110}$.  We
corroborate the answer using MAPLE.

\begin{verbatim}
[deloera@localhost deloera]$ maple
    |\^/|     Maple V Release 5.1 (University of California, Davis)
._|\|   |/|_. Copyright (c) 1981-1998 by Waterloo Maple Inc. All rights
 \  MAPLE  /  reserved. Maple and Maple V are registered trademarks of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> f:=1/(1-t)^6;
                                         1
                                 f := --------
                                             6
                                      (1 - t)

> taylor(f,t=0,113);
              2       3        4        5        6        7         8
1 + 6 t + 21 t  + 56 t  + 126 t  + 252 t  + 462 t  + 792 t  + 1287 t  + ...
     .
     .
     .
                107              108              109              110
    134153712 t    + 140364532 t    + 146803272 t    + 153476148 t    + ...
\end{verbatim}

Incidentally MAPLE can be very useful it contains a package called
{\tt combinat} that has essential combinatorial operations.  Using
essentially the same idea we can solve the second problem about
counting the ways to change \$ $2.75$ using american coins. Note that
for such an specific problem finding a bijective proof is not as
natural as for the previous question. We can represent each coin
combination as a monomial. For example $275$ cents is the same as
$2*100+3*25$ (two 1 dollar coins, plus 3 quarter coins) can be
represented as $x_{dollar}^{2*100}x_{quarters}^{3*25}$. All
combinations of the quarters are represented in the infinite series
$(1+x_{quarters}^{25}+x_{quarters}^{2*25}+x_{quarters}^{3*25}+\dots)$.
Thus all possible combinations of pennies, nickels, dimes, quarters,
half-dollar, dollars that give $275$ cents are presents as monomials
of the product

$ (1+x_{pennies}^{1}+x_{pennies}^{2*1}+x_{pennies}^{3*1}+\dots) (1+x_{nickels}^{5}+x_{nickels}^{2*5}+x_{nickels}^{3*5}+\dots) (1+x_{dimes}^{10}+x_{dimes}^{2*10}+x_{dimes}^{3*10}+\dots) (1+x_{quarters}^{25}+x_{quarters}^{2*25}+x_{quarters}^{3*25}+\dots)
(1+x_{halfdollars}^{50}+x_{halfdollars}^{2*50}+x_{halfdollars}^{3*50}+\dots)
(1+x_{dollars}^{100}+x_{dollars}^{2*100}+x_{dollars}^{3*100}+\dots)
$

If we wish to know how many give exactly $275$ we simply need to substitute
again an auxiliary variable $x_{somecoin}=t$, and then we find the coefficient
of $t^{275}$. The nice thing is that these are again geometric series for
which we know simple formulas!

$$ \frac{1}{(1-t)(1-t^5)(1-t^{10})(1-t^{25})(1-t^{50})(1-t^{100})}$$

The answer is, using MAPLE, 258170 ways to give such change. What is the 
smallest amount. As a curiosity, \$ $3.66$ is the first amount that has
over a million ways to be broken into american change!

We wish to solve now the last remaining problem of the introduction.
Its solution requires a ``hybrid approach'', where first we use a
bijection to a new combinatorial set, then from the new set we can
guess a nice recurrence relation and analytically determine the
formula we are seeking. We try to think geometrically! We verify that
there is a bijection from the set of all possible ways of giving
parentheses to $n$ non-commuting variables and the set of
triangulations of a convex $n+1$-gon. The bijection give from each
parenthesization the inner diagonals of the $n+1$-gon that give a
unique triangulation. Use the letter $a_1$ to label the edge $1,2$,
$a_2$ labels the edge $2,3$, and in general $a_i$ labels $i,i+1$.  Now
if there is a grouping $(a_i,a_{i+1})$ that means that the interior
diagonal $i,i+2$ is present, similarly, if we have an ensemble
$(a_i(a_{i+1}a_{i+2}))$ or $((a_ia_{i+1})a_{i+2})$ we have a diagonal
$i,i+3$. In general if we have an parenthesis grouping together the
portion of symbols $a_i,\dots,a_{i+k}$ we have then a diagonal from
$i$ to $i+k+1$. Figure \ref{fig:parentheses} shows an example of the
bijection (exercise: verify this is indeed a bijection!).

\begin{figure}[htpb]
\begin{center} \includegraphics[scale=.28]{parentheses.eps}
     \caption{A triangulation corresponding to a parenthesization}
     \label{fig:paretheses}
\end{center}
\end{figure}


\begin{thm}
      The number of triangulations of a convex $n$-gon is
      $\frac{1}{n-1} {2n-4 \choose n-2}$, the Catalan numbers.
\end{thm}


\begin{proof}

  Consider an $n$-gon $P$ with a distinguished edge the base
  $\{1,n\}$. In a triangulation of $P$ the base is a side of one of
  the triangles, say $\{1,k,n\}$, and this triangular region divides
  $P$ into two disjoint convex polygonal regions $S_1$with $k$
  vertices and $S_2$ with $n-k+1$ vertices for some $k=2,...n-1$. See
  Figure \ref{fig:regionrecursion}.  The rest of the triangulation of
  $P$ is complete with some triangulation of the polygons
  $S_1,S_2$. Now, $S_1$ can be triangulated into $R(k)$ ways and $S_2$
  into $R(n-k+1)$ ways.  Hence for a given choice of vertex $k$
  containing the edge $\{1,n\}$, there are $R(k+1)R(n-k)$ ways of
  triangulating $P$ thus we have


 \begin{figure}[h]
\begin{center} \includegraphics[scale=.28]{regionrecursion.eps}
     \caption{Setting up the recursion formula}
     \label{fig:regionrecursion}
\end{center}
\end{figure}

 
  $$R(n)=R(2)R(n-1)+R(3)R(n-2)+R(4)R(n-3)+\dots+R(n-1)R(2)$$.
  
  Now we need to solve this recurrence relation. We set $R(2)=1$ and
  let $a_{n-1}=R(n)$. Now we use the method of formal power series: We
  have a series $F(x)=\sum_{n=1}^{\infty} a_nx^n$. Now multiplying $F$
  by itself we get

  
  $$
  F^2(x)=(a_1)^2 x^2+(a_1a_2+a_2a_1) x^3+ \dots +(a_1 a_{n-1}+a_2
  a_{n-3}+\dots+ a_{n-1} a_1) x^{n-1}+...$$
  
  but by our recurrence relation
  $a_{n-1}=a_1a_{n-1}+a_2a_{n-3}+\dots+a_{n-1}a_1$ so we have $F^2=F-a_1x=F-x$
  so the power series is the solution of the quadratic equation $F^2-F+x=0$. It
  has two solutions

  $$F(x)=(1+\sqrt{1-4x})/2 \quad or \quad (1-\sqrt{1-4x})/2,$$ 


but we know that $F(0)=0$ so the right solution is the second
 one. 

\end{proof}

\pagebreak
\vfill
\section{Lecture 3}

Finally we need to prove that the formula for $R(n)$ is the
 right one from the knowledge of its generating function: 
Recall Newton's binomial theorem we have
  
  $$  (1+z)^{1/2}= \sum_{k=0}^{\infty} { 1/2 \choose k} z^k$$
  
  where the binomial
  
  $${ 1/2 \choose k}= \frac {[1/2 (1/2-1)
    (1/2-2)\dots(1/2-k+1)]}{k!}=\frac{(-1)^{k-1}}{k 2^{2k-1}} {2k-2 \choose
    k-1}$$.
  
  Applying this to $z=-4x$ we get the desired result (do not forget to shift
  again by 1, because $a_n=R(n+1)$).


We have seen last time that every way of putting parentheses to $n$
non-commuting variables can be represented as a triangulation of a
convex $(n+1)$-gon. Thus we were also counting the parenthesizations
by the Catalan numbers above, in fact the Catalan numbers form a
common sequence that appears counting diverse objects and, it is
useful to use the triangulations of the $n$-gon to set up a
bijection. Here is another example.


A {\em rooted binary tree} is a tree (in the sense of Graph Theory see
for instance the book of Bollobas ``GraphTheory'') with three
relations among the nodes: parent, left child, and right child; and a
special node called the root that has no parent. Binary trees are
important combinatorial structures due to applications in data
structures and design of algorithms (see for example the classic book
of Donald Knuth `` The Art of Computer Programming'' for an illuminating
study).

From a binary tree with $n$ nodes it is easy to obtain a
triangulation of an $(n+2)$-gon whose vertices are labeled and vice
versa. Here is the bijection: a {\em symmetric order traversal} of the
tree visits all the nodes in a recursive way. If a node is a node with
at least one child, then we traverse its left subtree in symmetric
order, visit the node itself and then traverse its right subtree in
symmetric order. If a node has no children then simply visit it and
return to the previous stage. Now choose a distinguished edge (the
{\em reference edge}) of the $(n+2)$-gon.  

 \begin{figure}[htpb]
\begin{center} \includegraphics[scale=.28]{treetotri.eps}
     \caption{A binary tree, its symmetric ordering and its
    associated triangulation.}
     \label{fig:treetotriang}
\end{center}
\end{figure}



Label the remaining $n$
vertices of the polygon in a counterclockwise way using the labels of
the $n$ nodes of the tree as they appear in the symmetric order
transversal. See Figure \ref{fig:treetotriang}. Now we
will produce a triangulation of the $(n+2)$-gon. We will use $n$
triangles indexed by the $n$ nodes of the tree.  Glue triangles
together along their edges according to the parent-child
relation. Attach the triangle for the root to the reference edge and
the vertex that received the label of the root of the tree. Now
recursively attach each triangle to (1) the appropiate edge of its parent
triangle, i.e left or right depending on the case, and (2) the vertex
labeled by its node. Again look at Figure \ref{fig:treetotriang} for an
example. Clearly, from any triangulation of the $(n+2)$-gon (with labeled
vertices) one can recover a labeled binary tree.
There are many combinatorial objects that have the same cardinality.
Before we present them we need some preliminaries:

An ordered tree is a rooted tree whose principal
subtrees (those obtained by removing the root) are ordered trees and
have been assigned some order among themselves. 


A $k$-tuple of positive integers
$\lambda=(\lambda_1,\lambda_2,\dots,\lambda_k)$ is an {\em integer
partition} of $n$ if $\lambda_1+\lambda_2+\dots+\lambda_k=n$ and
$\lambda_1 \geq \lambda_2 \geq \dots \geq \lambda_k \geq 1$. The
number of parts of $\lambda$ is $k$. Another alternative notation is
to show the multiplicity a part $i$ has. For example, the partition
$(4,2,2,2,1,1)$ can be represented as $4^1 2^3 1^2$. A useful visual
way picture of a partition is an array of squares or cells, left
justified and in decreasing order. This is called the {\em Ferrers
diagram} or {Young diagram}. The {\em conjugate partition} of
$\lambda$ is the partition obtained from $\lambda$ by interchanging
the rows and the columns of the Ferrerss diagram of $\lambda$. For
example $\lambda=(4,2,2,2,1,1)$ and its conjugate $\lambda'=(6,4,1,1)$
is given in the following picture.

 \begin{figure}[htpb]
\begin{center} \includegraphics[scale=.20]{ferrer.eps}
     \caption{A Ferrer Diagram and its conjugate.}
     \label{fig:treetotriang}
\end{center}
\end{figure}

\begin{lemma} The number of partitions of $n$ with $k$ parts is equal to
the number of partitions of $n$ whose largest part is $k$
\end{lemma}

Given a partition $\lambda$ of $n$, a {\em standard tableau} $T$ is an
arrangement of the numbers $[n]=\{1,2,\dots,n\}$ in the cells of the
Ferrers diagram of $\lambda$ which increases across rows and down columns.
Standard tableaux will be very important for us later on.

\begin{thm} The following sets of objects have the same cardinality, given
in terms of the Catalan numbers.

\begin{enumerate}

\item binary trees on $n$ vertices;

\item ordered trees on $n+1$ vertices;

\item Parenthesizations of $n$ non-commuting variables;

\item Standard tableaux in a $2 \times n$ rectangular Ferrers diagram.

\end{enumerate}

\end{thm}

We prove two of the bijections.

\noindent {\bf Proof (1)=(2)} We give a bijection from binary trees to 
ordered trees. Let $B$ be a binary tree let $f(B)$ be an ordered tree
given as follows: The vertices of $f(B)$ are the same as vertices of $B$
plus one more vertex, labeled $0$ as its root. The root of $B$ is the 
first child of the root of $f(B)$. Vertex $v$ is a left child of vertex
$w$ in $B$ if and only if $v$ is the first child of $w$ in $f(B)$.
Finally, vertex $v$ is a left child of $w$ in $B$ if and only if $v$ is the brother to the right of $w$ in $f(B)$.

\noindent{\bf (2)=(3)} and {\bf (3)=(4)} are left as exercises.

\pagebreak
\vfill

\section{Lecture: The Robinson-Schensted-Knuth correspondence}

We saw last time an example of the {\bf bumping process}. We produced a {\bf bumping sequence}: 

 $$x=x_1<x_2,\dots,x_s<x_{s+1}=\infty$$

as well as a sequence of column indices 

$$r_1 \geq r_2 \geq \dots \geq r_s=t$$

At every moment $P_{ir_i}$ has been changed from $x_{i+1}$ to $x_i$.

We also use some auxiliary counters $i,j$.

We imagine the input tableau $P$ is surrounded by $\infty$'s and
zeros:

\noindent{\bf INSERTION ALGORITHM:}

Input: A tableau $P$ and a positive integer $x$ not in $P$.

Output: A new tableau $\hat(P)$, that contains x, the shape of $P$, and
has a single new cell in position $s,t$ where before there was an
$\infty$.
 

\begin{enumerate} 
\item Set $x_1:=x, i:=1, j:=$ smallest $j$ such that $P_{1j}=\infty$

\item IF $x_i < P_{i(j-1)}$ decrease $j$ by one, repeat this step.
      
ELSE $x_{i+1}:=P_{ij}$ and set $r_1:=j$, $P_{ij}:=x_i$

\item IF $x_i \not= \infty$  then $i:=i+1$, RETURN to step 2.
      ELSE set $s:=i, t:=j$, terminate.

\end{enumerate}

Note that at every step the properties we look for are preserved.
Only at the last moment we add the new cell. What makes this useful
is that it is completely reversible!

\noindent{\bf DELETION ALGORITHM:}

Input: A  tableau $\hat{P}$, that contains a cell $s,t$.

Output: A tableau $P$ which is almost same as $\hat{P}$, except the cell
$(s,t)$ is now removed, and certain $x$ not in $P$.

\begin{enumerate}

\item Set $j:=t, i:=s, x_{s+1}=\infty$ 

\item IF $P_{i(j+1)} < x_{i+1}$, then  $j:=j+1$ and repeat this step.
      
ELSE $x_i:=P_{ij}$, $r_i:=j$, and $P_{ij}:=x_{i+1}$

\item IF $i>1$, $i:=i-1$ return to step 2 

 ELSE set $x:=x_1$, end of algorithm.

\end{enumerate}

KEY OBSERVATION: The inversion and deletion algorithms are perfect
inverses of each other.

\vfill

\pagebreak

\noindent{\large MIDTERM 1}

Each problem 9 points (except bonus problem). Please write responses
as if you were writing your lecture to accept the Fields Medal! I will
grade for clarity and details. Due back in my office Monday morning.

\begin{enumerate}

\item What is the number of ways of going up n stairs, if we may take
one or two steps at a time? 

\item Suppose you choose a permutation in $S_n$ uniformly
at random. What is the expected number of cycles? <br>

\item Figure out how many standard Young tableaux are there which
can be formed with  $\{1,2,...15\}$.

\item Stanley's book Chapter 1: 14d,e

\item Without doing calculations prove the recursion relation
about the q-binomial coefficients we saw in class.

\item (BONUS question 20 points): How can one check whether a set of
permutations $p_1,p_2,..p_k$ generates the whole group $S_n$?  Is there a
general effective method like in the case when the $p_i$'s are all
transpositions? Check the literature for this problem, find out what
is known and explain it to me.

\end{enumerate}


\end{document}




LECTURES FOR FIRST HALF: BIJECTIVE APPROACH.
---------------------------------------------------- 1) Introduction

2) Illustration of the bijective method and the analytic method

3) The Catalan family: A classical set of bijections.

-----------------------------------------------------

4) Permutations and its bijections

5) Permutations and its bijections

6) More on Permutations

-----------------------------------------

7) Partitions

8) Tableaux and Robinson-Schensted-Knuth correspondence

9) Robinson-Schensted-Knuth correspondence

------------------------------

10) Sieve Methods, Involutions

11) Sieve Methods, Involutions

12) Sieve Methods, Involutions

---------------------------------

13) Posets and Mobius functions

14) Posets and Mobius functions

15) Posets and Lattices

--------------------------------------

LECTURES FOR THE SECOND HALF: GENERATING FUNCTIONS AND RECURSIONS.
