\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage{slide-article}
\usepackage{slide-article-tom}
\ifx\pdfoutput\undefined
     \usepackage[dvips]{graphicx}
\else
     \usepackage[pdftex]{graphicx}
%%     \usepackage{type1cm}
%%     \usepackage{color}
     \pdfcompresslevel 9
\fi
%  \usepackage{epsfig}
%\usepackage{graphics}
\usepackage{hyperref}

%\definecolor{Emerald}{cmyk}{1,0,0.50,0}
\hypersetup{colorlinks,
            linkcolor=blue,
            %pdfpagemode=FullScreen
            pdfpagemode=None
            }


%\usepackage{hyper}
%\usepackage{hthtml}
%\def\hyperref#1#2#3#4{\hturl{#1}}

\def\pagedone{\newpage}

\def\tthdump#1{#1}

\tthdump{\def\sectionhead#1{\begin{center}{\LARGE\hypertarget{#1}
     {#1}\hyperlink{Our general topics:}{\hfil$\leftarrow$}}\end{center}}}
     
%%tth:\def\sectionhead#1{{\LARGE#1\hypertarget{#1}{#1}}
%%tth:     \special{html: <A NAME="#1"></A><a href="\#Top of file">       Top</a>}}

\tthdump{\def\quotesection#1{\begin{center}{\LARGE\hypertarget{#1}
     {#1}\hyperlink{The quotes}{\hfil$\twoheadleftarrow$}}\end{center}}}
     
%%tth:\def\quotesection#1{{\LARGE#1\hypertarget{#1}{#1}}
%%tth:     \special{html: <A NAME="#1"></A><a href="\#The quotes">       <-</a>}}

%%tth:\def\makehyperlink#1{\special{html: <a href="\##1">}{\large#1}\special{html: </a>}}

%%tth:\def\binom#1#2{\left(\begin{array}{c}#1\\#2\end{array}\right)}

%\def\sectionhead#1{\begin{center}{\LARGE #1}\end{center}}
%\def\sectionhead#1{\section{#1}}

% defines a 2 element column vector.
\def\col#1#2{\left(\begin{array}{c}#1\\#2\end{array}\right)}
\def\tcol#1#2{(#1, #2)^T}

% defines the expectation operator.
\def\expect#1{\langle #1 \rangle}

%%%\def\bigep{{\Large{$\varepsilon$}}}

\begin{document}
\raggedright
%%tth:\special{html: <A NAME="Top of file"></A>}

\pagestyle{myfooters}
%\pagestyle{plain}

\thispagestyle{empty}
%      The more precise approximation is from some older work
%        by Charles Blair
%      Since this involves a lot of formulas it's written using TeX
%
%         Charles Blair [BITNET:CEBLAIR@UIUCVMD]
%         (submitted to the Monthly)
%
\begin{center}
     {\Large {Stirling's Approximation}} \newline
     {\large (to $n!$)}
\end{center}
\par Stirling's approximation to the factorial is typically written as:
     \begin{eqnarray}
        n! & \approx & \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n
     \end{eqnarray}
     
\par To find this approximation, we can begin with the observation that:
     \begin{eqnarray*}
          \ln(n!) & = & \ln(1 * 2 * 3 * \cdots * n) \\
                   & = & \ln(1) + \ln(2) + \ln(3) + \cdots + \ln(n)\\
                   & = & \sum_{i = 1}^{n}\ln ( i )
     \end{eqnarray*}
     
\par  There are various ways to approximate this sum, some more accurate than others, some
     easier to compute than others.
     
\pagedone

\par One relatively straightforward way to approximate is to use integrals:
\begin{eqnarray*}
     \ln (n !) & = & \sum_{i = 1}^{n}\ln ( i ) \\
                 & \approx & \int_1^n \ln(x) dx \\
                 & = & n \ln (n) - n + 1
\end{eqnarray*}
Exponentiating each side, we get the first approximation:
\begin{eqnarray*}
     n ! & \approx & e^{n \ln (n) - n + 1} \\
          & = & \left(e^{\ln(n)}\right)^n e^{-n}e \\
          & = & n^n e^{-n} e \\
          & = &  e * \left(\frac{n}{e}\right) ^ n
\end{eqnarray*}
This is fairly rough, so in practice it makes sense to ignore
the factor of $e$ in front, and just use the approximation:
\begin{eqnarray*}
     n ! & \approx & \left(\frac{n}{e}\right) ^ n
\end{eqnarray*}
This is good enough for a variety of uses \ldots
\pagedone

\par A more careful derivation of Stirling's approximation (including 
upper and lower bounds) using infinite series for logarithms
instead of integrals follows:
\def\otn{\sum_1^{n-1}}
%%\def\frac#1#2{{{#1}\over{#2}}}
\def\nin{\sum_n^\infty}
\def\mess{\frac{k-9}{120k^4(k+1)}}
\def\omess{\left(\frac1{L+1}-\frac1{2L}\right)}
\begin{eqnarray*}
     \ln  n! & = & n\ln\ n-\sum_{k=1}^{n-1} k\ln\left(1+\frac1k\right)\\
        & = &
          n\ln n+\sum_{L=1}^\infty\left(\sum_{k=1}^{n-1}k(-1)^L\frac{k^{-L}}L\right)\\
       & = & n\ln\ n-(n-1)+\frac12\otn k^{-1}-\frac13\otn k^{-2}+\dots\\
\end{eqnarray*}

\par Approximate $\sum k^{-1}$ using
$$\ln\ n = \otn \ln\left(1+\frac1k\right)=\otn k^{-1}-\frac12\otn k^{-2}+\dots$$
\pagedone
 When we group according to powers of $k$ we get:
$$\ln\ n! = n\ln\ n-(n-1)+\frac12\ln\ n +\left(\frac14-\frac13\right)
       \otn k^{-2}$$
       $$+\left(-\frac16+\frac14\right)\otn k^{-3}+\dots$$
       
       
$$\hbox{Let:}\quad S=\left(n+\frac12\right)\ln n-(n-1)$$
$$M_L=\sum_{k=1}^\infty k^{-L}$$
$$M=\sum_{L=2}^\infty(-1)^L\omess M_L$$
\begin{eqnarray*}
     \ln n! & = & S-\frac1{12}\left(M_2-\nin k^{-2}\right) \\
          & &  -\sum_{L=3}^\infty(-1)^L\omess\left(M_L-\nin k^{-L}\right)\\	& = & S-M+\frac1{12}\nin k^{-2}-\frac1{12}\nin k^{-3} \\
         & &     +\frac3{40}\nin k^{-4}-\frac1{15}\nin k^{-5}+\dots \\
\end{eqnarray*}

Since:
$$ \frac1{12k^2}-\frac1{12k^3}+\frac3{40k^4}=
\frac1{12}\left(\frac1k-\frac1{k+1}\right)-\mess ,$$

we have
$$S-M+\frac1{12n}-\nin\mess $$
$$> \ln\ n! >$$
$$ S-M+\frac1{12n}-\nin\mess
-\nin\frac1{15k^5}$$
For $n\ge 9$, $\ln n!<S-M+1/12n$ is immediate.  For a lower bound,
we can use $[k\ge9]$: $$\mess+\frac1{15k^5}=\frac{k^2-k+8}{120k^5(k+1)}$$
$$ < \frac1{120k^3(k+1)}<\frac1{360}\left(\frac1{(k-1)^3}-%
\frac1{k^3}\right)$$
to obtain $\ln n!>S-M+1/(12n)-1/(360(n-1)^3)$.
\par To determine $M$, the usual argument involving Wallis' product
can be used:
\begin{eqnarray*}
\lim_{n\to\infty}\frac{4^n(n!)^2}{\sqrt{2n}(2n!)} & = & \lim\frac{2\cdot
4\cdot6\dots(2n-2)\sqrt{2n}}{3\cdot5\dots(2n-1)} \\
 & = & \sqrt{\frac\pi2} \\
 & = &  e^{1-\ln 2-M} \\
\end{eqnarray*}
 So: $e^{-M}=\frac{\sqrt{2\pi}}e$


\end{document}
