Stirling's Formula

An important formula in applied mathematics as well as in probability is the Stirling's formula known as

\begin{displaymath}n! \sim \sqrt{2 \pi} \; n^{\displaystyle (n+ 1/2)} \;e^{\displaystyle-n} \end{displaymath}

where $\sim$ is used to indicate that the ratio of the two sides goes to 1 as n goes to $\infty$. In other words, we have

\begin{displaymath}\lim_{n \rightarrow \infty} \frac{n!}{\sqrt{2 \pi} \; n^{\displaystyle (n+ 1/2)}e^{\displaystyle-n}} = 1\end{displaymath}


\begin{displaymath}\lim_{n \rightarrow \infty} \frac{n!}{ n^{\displaystyle (n+ 1/2)}e^{\displaystyle-n}} = \sqrt{2 \pi}\;.\end{displaymath}

Proof of the Stirling's Formula

First take the log of n! to get

\begin{displaymath}\log(n!) = \log (1) + \log(2) + \cdots + \log(n)\;.\end{displaymath}

Since the log function is increasing on the interval $(0,\infty)$, we get

\begin{displaymath}\int_{n-1}^{n} \log(x) dx < \log(n) < \int_{n}^{n+1} \log(x) dx\end{displaymath}

for $n \geq 1$. Add the above inequalities, with $n=1,2,\cdots,N$, we get

\begin{displaymath}\int_{0}^{N} \log(x) dx < \log(N!) < \int_{1}^{N+1} \log(x) dx\end{displaymath}

Though the first integral is improper, it is easy to show that in fact it is convergent. Using the antiderivative of $\log(x)$ (being $x \log(x) -x$), we get

\begin{displaymath}n\log(n) - n < \log(n!) < (n+1)\log(n+1) - n\;.\end{displaymath}

Next, set

\begin{displaymath}d_n = \log(n!) - \left(n + \frac{1}{2}\right) \log(n) + n\;.\end{displaymath}

We have

\begin{displaymath}d_n - d_{n+1} = \left(n + \frac{1}{2}\right) \log\left(\frac{n+1}{n}\right) - 1\;.\end{displaymath}

Easy algebraic manipulation gives

\begin{displaymath}\frac{n+1}{n} = \frac{1 + \displaystyle \frac{1}{2n+1}}{1 - \displaystyle \frac{1}{2n+1}}\;.\end{displaymath}

Using the Taylor expansion

\begin{displaymath}\frac{1}{2} \log\left(\frac{1+t}{1-t}\right) = t + \frac{1}{3} t^3 + \frac{1}{5} t^5 + \cdots\end{displaymath}

for -1 < t < 1, we get

\begin{displaymath}d_n - d_{n+1} = \frac{1}{3} \frac{1}{(2n+1)^2} + \frac{1}{5} \frac{1}{(2n+1)^4} + \cdots\end{displaymath}

This implies

\begin{displaymath}0 < d_n - d_{n+1} < \frac{1}{3} \Bigg(\frac{1}{(2n+1)^2} + \frac{1}{(2n+1)^4} + \cdots\Bigg)\end{displaymath}

We recognize a geometric series. Therefore we have

\begin{displaymath}0 < d_n - d_{n+1} < \frac{1}{3} \frac{1}{(2n+1)^2 - 1} = \frac{1}{12} \left(\frac{1}{n} - \frac{1}{n+1}\right)\;.\end{displaymath}

From this we get
the sequence $\{d_n\}$ is decreasing;
the sequence $\left\{d_n - \displaystyle \frac{1}{12n}\right\}$ is increasing.
This will imply that $\{d_n\}$ converges to a number C with

\begin{displaymath}\lim_{n \rightarrow \infty} d_n = \lim_{n \rightarrow \infty} d_n - \displaystyle \frac{1}{12n} = C \end{displaymath}

and that C > d1 - 1/12 = 1 - 1/12 = 11/12. Taking the exponential of dn, we get

\begin{displaymath}\lim_{n \rightarrow \infty}\frac{n!}{ n^{\displaystyle (n+ 1/2)}e^{\displaystyle-n}} = e^{C}\;.\end{displaymath}

The final step in the proof if to show that $e^C = \sqrt{2\pi}$. This will be done via Wallis formula (and Wallis integrals). Indeed, recall the limit

\begin{displaymath}\lim_{n \rightarrow \infty} \frac{\ldots(2n)(2n)}{\ldots(2n-1)(2n-1)(2n+1)}\;= \frac{\pi}{2}\;.\end{displaymath}

Rewriting this formula, we get

\begin{displaymath}\frac{2.4.6\ldots(2n)}{1.3.5.\ldots(2n-1) \sqrt{2n}} \sim \sqrt{\frac{\pi}{2}}\end{displaymath}

Playing with the numbers, we get

\begin{displaymath}\frac{(2^n n!)^2}{(2n)!} \frac{1}{\sqrt{2n}} \sim \sqrt{\frac{\pi}{2}}\end{displaymath}

Using the above formula

\begin{displaymath}n! \sim n^{\displaystyle (n+ 1/2)}e^{\displaystyle-n} e^{C}\;.\end{displaymath}

we get

\begin{displaymath}\frac{2^{2n} \Big(n^{2n+1} e^{-2n} e^{2C}\Big)}{(2n)^{(2n+1/2)} e^{-2n} e^C}\frac{1}{\sqrt{2n}} \sim \sqrt{\frac{\pi}{2}}\end{displaymath}

Easy algebra gives

\begin{displaymath}e^C \sim \sqrt{2\pi}\end{displaymath}

since we are dealing with constants, we get in fact $e^C = \sqrt{2\pi}$. This completes the proof of the Stirling's formula.

[Trigonometry] [Calculus]
[Geometry] [Algebra] [Differential Equations]
[Complex Variables] [Matrix Algebra]

S.O.S MATHematics home page

Do you need more help? Please post your question on our S.O.S. Mathematics CyberBoard.

Mohamed A. Khamsi
Tue Dec 3 17:39:00 MST 1996

Copyright 1999-2014 MathMedics, LLC. All rights reserved.
Contact us
Math Medics, LLC. - P.O. Box 12395 - El Paso TX 79913 - USA
users online during the last hour