% 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{21}{October 04}{Neil Calkin}{Grady Thomas and Honghai Xu}\\\\\\\\\\

\section{What is the distribution of cycles in a random permutation?}
Specifically if we pick a permutation of {1,2,\ldots,n} and a fixed integer k, what is the probability that there are exactly k fixed points? \\

P($\pi$ has no fixed points) = $\frac{D_n}{n!}\simeq \frac{1}{e}$ \\
How  many permutations have exactly one fixed point? ${n\choose 1} D_{n-1}$ \\ 
How many permutations have exactly k fixed points? ${n\choose k}D_{n-k}$ \\
Denote, temporarily, $\lfloor x+\frac{1}{2} \rfloor$ to be the nearest integer to x \\
so, 
\begin{align*}
P(\pi \text{ has exactly k fixed points}) &= \frac{1}{n!}\frac{n!}{k!(n-k)!}D_{n-k} \\
&= \frac{1}{k!} \frac{\lfloor \frac{(n-k)!}{e}+\frac{1}{2}\rfloor}{(n-k)!} \\
&\simeq \frac{1}{k!e} \\
&= \frac{e^{-1}}{k!}+error_{n,k}, \text{where } |error_{n,k}| < \frac{1}{k!(n-k+1)!} \\
\end{align*}

Asymptotically, the number of fixed points is almost Poisson, with mean 1. \\
So, expected number of fixed points is about $E\lbrack X\rbrack$ where $X\sim Poisson(1)$, so $E\lbrack X\rbrack=1$ \\

\vspace{2mm}

Can we count 2-cycles? \\
One Approach: Compute the probability that there are no 2-cycles.  Prove some general abstract nonsense (here, Poisson paradigm) to show distribution is asymptotically Poisson, and deduce the mean. \\

Exponential generating function for permutations without 2-cycles is
\begin{align*}
\exp\lbrace-log(1-x)-\frac{x^2}{2}\rbrace = \frac{e^{\frac{-x^2}{2}}}{1-x} \\
\end{align*}

We could, if we choose, write $e^{\frac{-x^2}{2}} = \sum \frac{x^{2k}}{k!}\frac{(-1)^k}{2^k}$ and compute exactly as we did with $D_n$. \\
\vspace{2mm}
\textbf{Excercise: } Compute as we did with $D_n$, get a similar "nearest integer" result. \\
\vspace{2mm}

Alternative Approach: Since $\frac{e^{\frac{-x^2}{2}}}{1-x}$ blows up at x=1 we know that if \\
$\frac{e^{\frac{-x^2}{2}}}{1-x} = \displaystyle\sum_{n\geq 0} t_n\frac{x^n}{n!}$, then for any $|r|<1, \frac{r^nt_n}{n!}\to 0$ \\
and for any $|R>1, \limsup_{n\to\infty} \frac{R^nt_n}{n!} \to \infty$ \\
 
This suggest ${\displaystyle t_n\approx cn!}$.\\\\
Let's see if we can eliminate the singularity at $x=1$. \\
At $x=1$, ${\displaystyle e^{-\frac{x^2}{2}}}$ behaves like ${\displaystyle e^{-\frac{1}{2}}}$.\\
Near $x=1$, ${\displaystyle \frac{e^{-\frac{x^2}{2}}}{1-x}}$ behaves like ${\displaystyle \frac{e^{-\frac{1}{2}}}{1-x}}$.\\
So, consider ${\displaystyle \frac{e^{-\frac{x^2}{2}}}{1-x}-\frac{e^{-\frac{1}{2}}}{1-x}}$, say, for $x=1-\delta$.

\begin{align*}
\frac{e^{-\frac{x^2}{2}}}{1-x}-\frac{e^{-\frac{1}{2}}}{1-x}
=  \frac{e^{-\frac{{(1-\delta)}^2}{2}}-e^{-\frac{1}{2}}}{\delta}
=  \frac{e^{-\frac{1}{2}}}{\delta}\cdot (e^{\delta-\frac{\delta^2}{2}}-1)
\end{align*}

As $\delta \rightarrow 0$, ${\displaystyle(\frac{e^{\delta-\frac{\delta^2}{2}}-1}{\delta}) }\rightarrow 1$. Hence, ${\displaystyle \frac{e^{-\frac{x^2}{2}}-e^{-\frac{1}{2}}}{1-x}}$ has no singularities in $C$, and its coefficients approach $0$ faster than $\epsilon^n$ for all ${\displaystyle \epsilon >0 \Rightarrow \frac{t^n}{n!}=e^{-\frac{1}{2}}+O(\epsilon^n)}$, for any fixed $\epsilon >0 $.\\
Therefore, the probability of an arbitrary permutation $\pi$ has no two-cycles $\rightarrow e^{-\frac{1}{2}}$ as $n \rightarrow \infty$.\\\\
Similarly, the probability of an arbitrary permutation $\pi$ has no $k$-cycles $\rightarrow e^{-\frac{1}{k}}$ as $n \rightarrow \infty$.\\
\textbf{Exercise :  Prove this proposition.\\}


Hence a poisson paradigm Theorem would tell us that the number of $k$-cycles is poisson with mean $\approx \frac{1}{k}$ and hence the number of $k$-cycles is $\approx \frac{1}{k}$.\\\\
As a collary, the expected number of cycles in a random permutation on $\{1,2,...,n\}$ is
\begin{align*}
\sum_{k=1}^{n}E(\mbox{the number of k-cycles}) \approx \sum_{k=1}^{n} \frac{1}{k} \approx H_n.
\end{align*}
\begin{align*}
H_n=1+\frac{1}{2}+\frac{1}{3}+...+\frac{1}{n} \approx \log n+r+O(\frac{1}{n}),
\end{align*}
where $r$ is the Euler Mascheroni Constant. \\\\
Let's check the above formula. We notice that for $n=1,2,3,4$, the formula is more than just an approximation. The equality holds, as the following table shows.\\
\begin{table}[htbp]
\begin{center}
\begin{tabular}{|r|r|r|r|}
\hline
\multicolumn{1}{|c|}{n} &
\multicolumn{1}{|c|}{$H_n$}&
\multicolumn{1}{|c|}{permutations} &
\multicolumn{1}{|c|}{E(number of cycles)} \\
\hline
1&1&(1) &1\\
2&$1+\frac{1}{2}=\frac{3}{2}$& (1)(2);(12)&$\frac{3}{2}$\\
3&$\frac{3}{2}+\frac{1}{3}=\frac{11}{6}$& (1)(2)(3);(1)(23);(2)(13);(3)(12);(123);(132)&$\frac{11}{6}$\\
4&$\frac{11}{6}+\frac{1}{4}=\frac{25}{12}$& &$\frac{1\times4+6\times3+3\times2+8\times2+6\times1}{4+3+2+2+1}=\frac{25}{12}$\\
\hline
\end{tabular}
\caption{Comparison of values of $H_n$ and E(number of cycles)}
\label{tab:newton}
\end{center}
\end{table}

\textbf{Exercise : How far does this pattern continue?}










\end{document}
