% This is the LaTeX template file for preparing lecture notes for 
% courses taught by Neil Calkin.  When preparing 
% LaTeX notes for this class, please use this template.
%
% The body contains examples: study them, run 
%
%	pdflatex <yourfilename.tex>
%
% and see how they work.   View the output file with acrobat,
% or print it out to compare input and result.
%
%
%
%
%


\documentclass{article}
\usepackage{epsfig,amsmath,amssymb}
\usepackage{graphicx}
\usepackage[myheadings]{fullpage}
%
% The following commands set up the lecnum (lecture number)
% counter and make various numbering schemes work relative
% to the lecture number.
%
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}

%
% The following macro is used to generate the header.
%
\newcommand{\lecture}[4]{
   \pagestyle{myheadings}
   \thispagestyle{plain}
   \newpage
   \setcounter{lecnum}{#1}
   \setcounter{page}{1}
   \noindent
   \begin{center}
   \framebox{
      \vbox{\vspace{2mm}
    \hbox to 6.28in { {\bf Combinatorial Analyis
                        \hfill Fall 2010} }
       \vspace{4mm}
       \hbox to 6.28in { {\Large \hfill Lecture #1: #2  \hfill} }
       \vspace{2mm}
       \hbox to 6.28in { {\it Lecturer: #3 \hfill Scribe: #4} }
      \vspace{2mm}}
   }
   \end{center}
   \markboth{Lecture #1: #2}{Lecture #1: #2}
   {\bf Disclaimer}: {\it These notes are intended for students in the class
listed above: they are not guaranteed to be complete or even necessarily
correct.  They may only be redistributed with permission, which you may
expect will be liberally granted.  Ask first, please.} \vspace*{4mm}
}

%
% Convention for citations is authors' initials followed by the year.
% For example, to cite a paper by Leighton and Maggs you would type
% \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}.
% (To avoid bibliography problems, for now we redefine the \cite command.)
% Also commands that create a suitable format for the reference list.
\renewcommand{\cite}[1]{[#1]}
\def\beginrefs{\begin{list}%
        {[\arabic{equation}]}{\usecounter{equation}
         \setlength{\leftmargin}{2.0truecm}\setlength{\labelsep}{0.4truecm}%
         \setlength{\labelwidth}{1.6truecm}}}
\def\endrefs{\end{list}}
\def\bibentry#1{\item[\hbox{[#1]}]}

%Use this command for a figure; it puts a figure in wherever you want it.
%usage: \fig{NUMBER}{SPACE-IN-INCHES}{CAPTION}
\newcommand{\fig}[3]{
			\vspace{#2}
			\begin{center}
			Figure \thelecnum.#1:~#3
			\end{center}
	}
% Use these for theorems, lemmas, proofs, etc.
\newtheorem{theorem}{Theorem}[lecnum]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newenvironment{proof}{{\bf Proof:}}{\hfill\rule{2mm}{2mm}}


\def\Z{\hbox{$\mathbb Z$}}
\def\Q{\hbox{$\mathbb Q$}}
\def\R{\hbox{$\mathbb R$}}
\def\N{\hbox{$\mathbb N$}}
\def\C{\hbox{$\mathbb C$}}



% **** IF YOU WANT TO DEFINE ADDITIONAL MACROS FOR YOURSELF, PUT THEM HERE:

\begin{document}
%FILL IN THE RIGHT INFO.
%\lecture{**LECTURE-NUMBER**}{**DATE**}{**LECTURER**}{**SCRIBE**}
\lecture{5}{August 27}{Neil Calkin}{Reid Sanders and Grady Thomas}

\begin{flushleft}

% Second half, split at definition of z choose m

\section{Bivariate Generating Functions}

Still considering the set of binary strings without adjacent 1's:
$0^*(100^*)(\epsilon v 1)$.

Consider the generating function (denoted g.f.) for two variables
\begin{equation}
f(x,y) = \sum_{f_n,k}x^ny^k
\end{equation}

Where $f(x,y) = \#$ of binary strings of length $n$ with exactly $k$ 1's (still without adjacent 1's), and both n,k are finite.
% wg This must be a generating function 

\textbf{Exercise: } Suppose that $\mathcal{A}$ and $\mathcal{B}$ are combinatorial classes, with each having weight $w$ and length $l$ defined. That is each object has a non-negative integer weight and non-negative integer length and $\mathcal{A}_{n,k}$ = \{objects with weight $n$ and length $k$\},
$\mathcal{B}_{n,k}$ = \{objects with weight $n$ and length $k$\}.


$\| \mathcal{A}_{n,k} \|$ finite for each pair of $n,k$


$\|\mathcal{B}_{n,k} \|$ finite for each pair of $n,k$


If $\mathcal{A}$ has bivariate generating function $f(x,y)$, $\mathcal{B}$ has bivariate generating function $g(x,y)$, then $\mathcal{A} \times \mathcal{B}$ with obvious weight and length $w_p = w_1 + w_2$ and $l_p = l_1 + l_2$. Has bivariate generating function $f(x,y)g(x,y)$.


Once this exercise is complete we can do the following: 
\begin{align*}
&0^* \text{ has g.f. :}&
&1+x^2+x^3+ ... 1\over{1-x}\\
& 100^* \text{ has g.f. :}&
&x^2y+x^3y+x^4y+...=x^2y\over{1-x}\\
& (100^*)^k \text{ has g.f. :}&
&\left({x^2y\over{1-x}}\right)^k&
\end{align*}
Since these sets of strings are all disjoint 

\begin{align*}
& (100^*)^* \text{ has g.f. :}
&1+{x^2y\over{1-x}}+{x^2y\over{1-x}}^2+{x^2y\over{1-x}}^3+...={1\over{1-{x^2y\over{1-x}}}}\\
& (\epsilon v 1) \text{ has g.f. :} &{1+xy}\\
& \text{Hence }0^*(100^*)(\epsilon v 1) \text{ has g.f. :}
&{1\over{1-x}} {1\over{1-{x^2y\over{1-x}}}}{(1 +xy)} = {{1+xy}\over{1-x-x^2y}}
\end{align*}

How do we get coefficients out of this? 

\begin{align*}
& [y^k]{{1+xy}\over{1-x-x^2y}}\\
&= [y^k] {1\over{1-x}} {1\over{1-{x^2y\over{1-x}}}}\\
&= {1\over{1-x}} [y^k] {1\over{1-{x^2y\over{1-x}}}}\\
&= \left({1\over{1-x}} [y^k] {1\over{1-{x^2y\over{1-x}}}}\right) + \left({x\over{1-x}} [y^{k-1}] {1\over{1-{x^2y\over{1-x}}}}\right)\\
&= {1\over{1-x}}\left({x^2\over 1-x}\right)^k + {x \over 1-x} \left({x^2\over 1-x}\right)^{k-1}
\end{align*}

As an aside, note that:

\begin{align*}
& [x^m]{1\over {1-x}^k}\\
&= [x^m]({{1-x})^{-k}}\\
&= {-k \choose m}{(-1)}^m
\end{align*}
Where we need to interpret ${-k \choose m}$ properly! That is 
\begin{align*}
&{n \choose m} = {n! \over m!(n-m)!}\\
&= {n(n-1)...(n-m+1) \over m!}
\end{align*}

This expression makes sense even if n is not a positive integer.

\begin{definition}
Let z be an object which can be added or multiplied (i.e. in some ring). Then:
\begin{align*}
&{z \choose m} := {z(z-1)...(z-m+1) \over m!}
\end{align*}
\end{definition}

%%%%%%%%%%%%%%%%%%%%% break %%%%%%%%%%
So, for example

\begin{align*}	
&{-k\choose m}(-1)^{-1} \\
&= {{-k(-k-1) \ldots (-k-m+1)}\over{m!}}(-1)^m \\
&= \frac{k(k+1)\ldots (k+m-1)}{m!} \\
&= \frac{(k+m-1)(k+m-2)\ldots (k+1)k}{m!} \\
&= \frac{(k+m-1)!}{m!(k-1)!} \\
&= {k+m-1\choose m} \\
&= {k+m-1\choose k-1} \\
\end{align*}

\bf{Note:} 
\begin{align*}
& \frac{1}{(1-x)^2} \\
&= \frac{d}{dx} (\frac{1}{1-x}) \\
&= \frac{d}{dx} (1+x+x^2+\ldots) \\
&= 1+2x+3x^2+\ldots \Rightarrow [x^m]\frac{1}{(1-x)^2}\\
&= m+1
\end{align*}
										
\rm{Let's continue this:} \\
\begin{align*}
					&(\frac{d}{dx})^2 \frac{1}{1-x} = \frac{2}{(1-x)^3}  \\
					&(\frac{d}{dx})^3 \frac{1}{1-x} = \frac{(2)(3)}{(1-x)^4}  \\
					&(\frac{d}{dx})^n \frac{1}{1-x} = \frac{n!}{(1-x)^{n+1}}  \\		
&\text{so, }  \frac{1}{(1-x)^k} = \frac{1}{(k-1)!} (\frac{d}{dx})^{k-1} 
\frac{1}{1-x}  \\
&\text{but }  (\frac{d}{dx})^{k-1} x^r = r(r-1)\cdots (r-k+2)x^{r-k+1}
\end{align*}

so, 
\begin{align*}
	 \frac{1}{(k-1)!} (\frac{d}{dx})^{k-1} x^r &= \frac{r(r-1)\cdots (r-k+2)}{(k-1)!} x^{r-k+1} \\																						 &= {r\choose k-1} x^{r-k+1} \\ 
\end{align*}

so,  
\begin{align*}
&[x^m] \frac{1}{(1-x)^k} = {k+m-1 \choose k-1}
\end{align*}

\begin{theorem}
\begin{equation}
[x^n](1+x)^z = {z\choose n} \text{where} {z\choose n} = \frac{z(z-1)\cdots (z-m+1)}{n!} 
\end{equation}
\end{theorem}

Back to coefficients,
\begin{align*}
&[x^n y^k]f(x,y) = [x^n](\frac{1}{1-x} (\frac{x^2}{1-x})^k + \frac{x}{1-x} (\frac{x^2}{1-x})^{k-1})
\end{align*}
\begin{align*}
	[x^n] \frac{x^2k}{(1-x)^{k+1}} &= [x^{n-2k}] \frac{1}{(1-x)^{k+1}} \\																 &= {n-2k+k \choose k} \\
																 &= {n-k \choose k} 
\end{align*}
\\
\begin{align*}
	[x^n] \frac{x^{2k-1}}{(1-x)^k} &= [x^{n-2k+1}] \frac{1}{(1-x)^k} \\
																 &= {n-2k+k \choose k-1} \\
																 &= {n-k \choose k-1}
\end{align*}

\begin{align*}
&f_{n,k} = {n-k \choose k} + {n-k \choose k-1} \\
&= {n-k+1 \choose k} \\
&\Rightarrow F_n = f_{n,0} + f_{n,1} + f_{n,2} + \ldots \\
\end{align*}

So this expresses Fibonacci numbers in terms of binomial terms
\begin{align*}
&F_n = \displaystyle\sum\limits_{k=0}^{\lfloor{\frac{n+1}{2}}\rfloor} {n-k+1 \choose k}
\end{align*}
\bf{Exercise:}
\rm Give a combinatorial proof that $f_{n,k} = {n-k+1 \choose k}$

\end{flushleft}

\end{document}
