Steven R. Dunbar
Department of Mathematics
203 Avery Hall
Lincoln, NE 68588-0130
http://www.math.unl.edu
Voice: 402-472-3731
Fax: 402-472-8466

Topics in
Probability Theory and Stochastic Processes
Steven R. Dunbar

__________________________________________________________________________

Stirling’s Formula Derived from Elementary Sequences and Series

_______________________________________________________________________

Note: These pages are prepared with MathJax. MathJax is an open source JavaScript display engine for mathematics that works in all browsers. See http://mathjax.org for details on supported browsers, accessibility, copy-and-paste, and other features. The applets use JavaScript which you need to have enabled in order to display and use the applets.

_______________________________________________________________________________________________

### Rating

Mathematicians Only: prolonged scenes of intense rigor.

_______________________________________________________________________________________________

### Section Starter Question

What is the geometric summation formula? How can you use the geometric sum formula to derive the series expansion for $log\left(1+x\right)$ ? What do you need to know about the geometric sum formula in order to justify its use to derive the series expansion for $log\left(1+x\right)$ ?

_______________________________________________________________________________________________

### Key Concepts

1. Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation
$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}\phantom{\rule{0.3em}{0ex}}.$

2. The formula is useful in estimating large factorial values, but its main mathematical value is in limits involving factorials.

__________________________________________________________________________

### Vocabulary

1. Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation
$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}\phantom{\rule{0.3em}{0ex}}.$

__________________________________________________________________________

### Mathematical Ideas

Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation

$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}\phantom{\rule{0.3em}{0ex}}.$

The formula is useful in estimating large factorial values, but its main mathematical value is in limits involving factorials. Another attractive form of Stirling’s Formula is:

$n!\sim \sqrt{2\pi n}{\left(\frac{n}{e}\right)}^{n}\phantom{\rule{0.3em}{0ex}}.$

An improved inequality version of Stirling’s Formula is

 $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n+1\right)} (1)

See Stirling’s Formula. in MathWorld.com.

Here we rigorously derive Stirling’s Formula using elementary sequences and series expansions of the logarithm function, based on the sketch in Kazarinoﬀ [2] which is in turn based on the note by Nanjundiah [3].

#### A weak form of Stirling’s Formula

Theorem 1.

$\sqrt[n]{n!}\sim \frac{n}{e}$

Remark. This form of Stirling’s Formula is weaker than the usual form since it does not give direct estimates on $n!$. On the other hand,it avoids the determination of the asymptotic constant $\sqrt{2\pi }$ which usually requires Wallis’s Formula or equivalent. For many purposes of estimation or limit taking this version of Stirling’s Formula is suﬃcient, and the proof is elementary. The proof is taken from [5, pages314-315].

Proof. Start from the series expansion for the exponential function and then estimate:

$\begin{array}{llll}\hfill {e}^{n}& =1+\frac{n}{1!}+\dots +\frac{{n}^{n-1}}{\left(n-1\right)!}+\frac{{n}^{n}}{n!}\left(1+\frac{n}{n+1}+\frac{{n}^{2}}{\left(n+1\right)\left(n+2\right)}+\dots \phantom{\rule{0.3em}{0ex}}\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill &

On the other hand, ${e}^{n}>{n}^{n}∕n!$ by dropping all but the ${n}^{n}∕n!$ term from the series expansion for the exponential. Rearranging these two inequalities

$\frac{{n}^{n}}{{e}^{n}}

Now take the $n$th root of each term, and use the fact that $\sqrt[n]{2n+1}\to 1$ as $n\to \infty$. □

#### Stirling’s Formula from sequences and series

Let ${a}_{n}=\frac{n!}{{n}^{n+1∕2}{e}^{-n}}$ . Then $\frac{{a}_{n}}{{a}_{n+1}}={\left(\frac{n+1}{n}\right)}^{n+1∕2}{e}^{-1}$ and $log\left(\frac{{a}_{n}}{{a}_{n+1}}\right)=\left(n+1∕2\right)log\left(1+1∕n\right)-1$ .

Lemma 2. For $|x|<1$,

$log\left(\frac{1+x}{1-x}\right)=2\sum _{k=0}^{\infty }\frac{1}{\left(2k+1\right){x}^{2k+1}}\phantom{\rule{0.3em}{0ex}}.$

Proof. Left as an exercise. □

Note then that

$log\left(1+\frac{1}{n}\right)=log\left(\frac{1+\frac{1}{2n+1}}{1-\frac{1}{2n+1}}\right)=2\sum _{k=0}^{\infty }\frac{1}{\left(2k+1\right){\left(2n+1\right)}^{2k+1}}\phantom{\rule{0.3em}{0ex}}.$

Then

$\begin{array}{llll}\hfill log\left(\frac{{a}_{n}}{{a}_{n+1}}\right)& =\left(\frac{2n+1}{2}\right)\left(2\sum _{k=0}^{\infty }\frac{1}{\left(2k+1\right){\left(2n+1\right)}^{2k+1}}\right)-1\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =\sum _{k=1}^{\infty }\frac{1}{\left(2k+1\right){\left(2n+1\right)}^{2k+1}}=\sum _{k=0}^{\infty }\frac{1}{\left(2k+3\right){\left(2n+1\right)}^{2k+2}}\phantom{\rule{0.3em}{0ex}}.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Now coarsely estimating the denominators

$log\left(\frac{{a}_{n}}{{a}_{n+1}}\right)\le \frac{1}{2{\left(2n+1\right)}^{2}}\sum _{k=0}^{\infty }\frac{1}{{\left(2n+1\right)}^{2k}}\phantom{\rule{0.3em}{0ex}}.$

Lemma 3.

$log\left({a}_{n+1}\right)

Proof.

Let $f\left(x\right)=\left(x+1∕2\right)log\left(1+1∕x\right)-1$, so $log\left(\frac{{a}_{n}}{{a}_{n+1}}\right)=f\left(n\right)$. Observe that $f\left(x\right)\to 0$ as $x\to \infty$ and ${f}^{\prime }\left(x\right)=log\left(1+1∕x\right)-\frac{2x+1}{2{x}^{2}+2}$. Because ${f}^{\prime }\left(x\right)<0$ for $x>1$ (proof left as an exercise) $f\left(x\right)$ is decreasing from $\left(3∕2\right)log\left(2\right)-1\approx 0.0397$ to $0$ as $x$ increases. Hence $0.

By Lemma 2

$log\left(\frac{{a}_{n}}{{a}_{n+1}}\right)=\frac{1}{3{\left(2n+1\right)}^{2}}\sum _{k=0}^{\infty }\frac{1}{{\left(2n+1\right)}^{2k}}\phantom{\rule{0.3em}{0ex}}.$

The sum is a geometric sum, so

$0

Expand $1∕\left(12n\left(n+1\right)\right)$ in partial fractions and add $log\left({a}_{n+1}\right)$ throughout to obtain

$log\left({a}_{n+1}\right)

Deﬁne ${x}_{n}=log\left({a}_{n}\right)-\frac{1}{12n}$, so Lemma 3 shows that ${x}_{n}$ is an increasing sequence, ${x}_{n}<{x}_{n+1}$. That is,

 ${x}_{n}=log\left({a}_{n}\right)-\frac{1}{12n} (2)

Deﬁne ${y}_{n}=log\left({a}_{n}\right)$, and then the left-side inequality in Lemma 3 shows that ${y}_{n}$ is a decreasing sequence that is, ${y}_{n+1}<{y}_{n}$. By the deﬁnition of ${x}_{n}$ and ${y}_{n}$, ${x}_{n}<{y}_{n}$ and $|{x}_{n}-{y}_{n}|=1∕\left(12n\right)$, so $|{x}_{n}-{y}_{n}|\to 0$ as $n\to \infty$. Therefore $sup{x}_{n}=inf{y}_{n}$ and call the common value $\lambda$. By continuity, $\underset{n\to \infty }{lim}{a}_{n}={e}^{\lambda }$.

Using elementary properties of limits

 ${e}^{\lambda }=\underset{n\to \infty }{lim}{a}_{n}=\frac{{\left(\underset{n\to \infty }{lim}{a}_{n}\right)}^{2}}{\underset{n\to \infty }{lim}{a}_{2n}}=\underset{n\to \infty }{lim}\frac{{\left({a}_{n}\right)}^{2}}{{a}_{2n}}\phantom{\rule{0.3em}{0ex}}.$ (3)

However,

 $\frac{{\left({a}_{n}\right)}^{2}}{{a}_{2n}}=\sqrt{\left(\frac{2}{n}\right)}\frac{2\cdot 4\dots \left(2n-2\right)\cdot 2n}{1\cdot 3\dots \left(2n-3\right)\cdot \left(2n-1\right)}\phantom{\rule{0.3em}{0ex}}.$ (4)

The easy demonstration is left as an exercise.

Lemma 4 (Wallis’ Formula).

$\underset{n\to \infty }{lim}\left(\frac{\left(2n\right)\cdot \left(2n\right)\dots 2\cdot 2}{\left(2n+1\right)\cdot \left(2n-1\right)\cdot \left(2n-1\right)\dots 3\cdot 3\cdot 1}\right)=\frac{\pi }{2}.$

Proof. See the proofs in Wallis Formula.. □

Using the continuity of the square root function

$\underset{n\to \infty }{lim}\left(\sqrt{\frac{1}{2n+1}}\right)\left(\frac{\left(2n\right)\cdot \left(2n-2\right)\dots 4\cdot 2}{\left(2n-1\right)\cdot \left(2n-3\right)\dots 5\cdot 3\cdot 1}\right)=\sqrt{\frac{\pi }{2}}\phantom{\rule{0.3em}{0ex}}.$

Now multiplying both sides by $2$ and rewriting the leading square root sequence, obtain

$\underset{n\to \infty }{lim}\left(\sqrt{\frac{2}{n}\phantom{\rule{0.3em}{0ex}}\frac{2n}{2n+1}}\right)\left(\frac{\left(2n\right)\cdot \left(2n-2\right)\dots 4\cdot 2}{\left(2n-1\right)\cdot \left(2n-3\right)\dots 5\cdot 3\cdot 1}\right)=\sqrt{2\pi }\phantom{\rule{0.3em}{0ex}}.$

Then since

$\underset{n\to \infty }{lim}\sqrt{\frac{2n}{2n+1}}=1$

equation 4 is

${e}^{\lambda }=\underset{n\to \infty }{lim}{a}_{n}=\sqrt{\left(\frac{2}{n}\right)}\frac{2\cdot 4\dots \left(2n-2\right)\cdot 2n}{1\cdot 3\dots \left(2n-3\right)\cdot \left(2n-1\right)}=\sqrt{2\pi }\phantom{\rule{0.3em}{0ex}}.$

Equivalently, unwrapping the deﬁnition of ${a}_{n}=\frac{n!}{{n}^{n+1∕2}{e}^{-n}}$ this is exactly Stirling’s Formula

$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}\phantom{\rule{0.3em}{0ex}}.$

Using the deﬁnitions ${x}_{n}=log\left({a}_{n}\right)-\frac{1}{12n}$ and ${y}_{n}=log\left({a}_{n}\right)$, the inequality ${x}_{n}<{y}_{n}$, and the least upper bound and greatest lower bound limit in equation (3) we can express Stirling’s Formula in inequality form

$\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}

This is almost as good as the inequality (1).

Remark. This proof of Stirling’s Formula and the inequality (1) is the easiest, the shortest and the most elementary of the proofs that I present. These are all deﬁnite advantages. The main disadvantage of this proof is that it requires the form of Stirling’s Formula before starting, in order to create the sequence ${a}_{n}$ which is the main object of the proof.

#### Stirling’s Formula from Wallis’ Formula

Lemma 5. If $\alpha \in ℝ$, then the sequence

${a}_{\alpha }\left(n\right)={\left(1+\frac{1}{n}\right)}^{n+\alpha }$

is decreasing if $\alpha \in \left[\frac{1}{2},\infty \right)$, and increasing for $n\ge N\left(\alpha \right)$ if $\alpha \in \left(-\infty ,\frac{1}{2}\right)$.

Remark. This lemma is based on a remark due to I. Schur, see [4], problem 168, on page 38 with solution on page 215

Proof. The derivative of the function $f\left(x\right)={\left(1+\frac{1}{x}\right)}^{x+\alpha }$ (deﬁned on $\left[1,\infty \right)$) is

${f}^{\prime }\left(x\right)={\left(1+\frac{1}{x}\right)}^{x+\alpha }\left(ln\left(1+\frac{1}{x}\right)-\frac{x+\alpha }{x\left(x+1\right)}\right).$

Let

$g\left(x\right)=\left(ln\left(1+\frac{1}{x}\right)-\frac{x+\alpha }{x\left(x+1\right)}\right)$

then

${g}^{\prime }\left(x\right)=\frac{\left(2\alpha -1\right)x+\alpha }{{x}^{2}{\left(x+1\right)}^{2}}$

and $\underset{x\to \infty }{lim}g\left(x\right)=0$. It follows that $g\left(x\right)<0$ and so ${f}^{\prime }\left(x\right)<0$ when $\alpha \ge 1∕2$ and $x\ge 1$, and ${f}^{\prime }\left(x\right)>0$ when $\alpha <1∕2$ and $x\ge max\left(1,\frac{\alpha }{1-2\alpha }\right)$. The monotonicity of ${a}_{\alpha }\left(n\right)$ follows. □

From the lemma, for every $\alpha \in \left(0,1∕2\right)$ there is a positive integer $N\left(\alpha \right)$ such that

${\left(1+\frac{1}{k}\right)}^{k+\alpha }

for all $k\ge N\left(\alpha \right)$. As a consequence, we obtain

$\prod _{k=n}^{2n-1}{\left(1+\frac{1}{k}\right)}^{k+\alpha }<{e}^{n}<\prod _{k=n}^{2n-1}{\left(1+\frac{1}{k}\right)}^{k+1∕2}.$

Rearrange the products with telescoping cancelations, using the upper bound on the right as an example.

$\begin{array}{llll}\hfill & \prod _{k=n}^{2n-1}{\left(1+\frac{1}{k}\right)}^{k+1∕2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\left(1+\frac{1}{n}\right)}^{n+1∕2}{\left(1+\frac{1}{n+1}\right)}^{n+1+1∕2}\cdots {\left(1+\frac{1}{2n-1}\right)}^{2n-1+1∕2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\left(\frac{n+1}{n}\right)}^{n+1∕2}{\left(\frac{n+2}{n+1}\right)}^{n+1+1∕2}\cdots {\left(\frac{2n}{2n-1}\right)}^{2n-1+1∕2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\left(\frac{n+1}{n}\right)}^{1∕2}{\left(\frac{n+2}{n+1}\right)}^{1∕2}\cdots {\left(\frac{2n}{2n-1}\right)}^{1∕2}\cdot {\left(\frac{n+1}{n}\right)}^{n}{\left(\frac{n+2}{n+1}\right)}^{n+1}\cdots {\left(\frac{2n}{2n-1}\right)}^{2n-1}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\left(\frac{2n}{n}\right)}^{1∕2}\cdot \left(\frac{{\left(2n\right)}^{2n-1}}{{n}^{n}\cdot \left(n+1\right)\cdots \left(2n-1\right)}\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={2}^{1∕2}\cdot \frac{{\left(2n\right)}^{2n-1}}{{n}^{n}\cdot \left(n+1\right)\cdots \left(2n-1\right)}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={2}^{1∕2}\cdot \frac{{2}^{2n-1}\cdot {n}^{n-1}}{\left(n+1\right)\cdots \left(2n-1\right)}.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Multiply by the last fraction by $n!∕{n}^{n}$ and Write more compactly,

$\begin{array}{llll}\hfill & \frac{n!}{{n}^{n}}\cdot {2}^{1∕2}\cdot \left(\frac{{2}^{2n-1}\cdot {n}^{n-1}}{\left(n+1\right)\cdots \left(2n-1\right)}\right).\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={2}^{1∕2}\cdot \frac{{2}^{n-1}\cdot {2}^{n}\cdot n!}{n\cdot \left(n+1\right)\cdots \left(2n-1\right)}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={2}^{1∕2}\cdot \frac{\left(2n\right)!!}{\left(2n-1\right)!!}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

This uses the “double factorial” notation $n!!=n\cdot \left(n-2\right)\cdots 4\cdot 2$ if $n$ is even, and $n!!=n\cdot \left(n-2\right)\cdots 3\cdot 1$ if $n$ is odd. The lower bound product on the left is similar.

That is, after multiplying through by $n!∕{n}^{n+1∕2}$,

$\frac{{2}^{\alpha }}{\sqrt{n}}\cdot \frac{\left(2n\right)!!}{\left(2n-1\right)!!}<\frac{n!{e}^{n}}{{n}^{n+1∕2}}<\frac{{2}^{1∕2}}{\sqrt{n}}\cdot \frac{\left(2n\right)!!}{\left(2n-1\right)!!}$

for all $n\ge N\left(\alpha \right)$. Using the Wallis Formula,

${2}^{\alpha }\sqrt{\pi }\le \underset{n\to \infty }{liminf}\frac{n!{e}^{n}}{{n}^{n+1∕2}}\le \underset{n\to \infty }{limsup}\frac{n!{e}^{n}}{{n}^{n+1∕2}}\le \sqrt{2\pi }.$

Stirling’s formula follows by passing to the limit as $\alpha \to 1∕2$.

Remark. This proof can be extended to an asymptotic formula for the Gamma function using log-convexity of the Gamma function. See [1].

#### Sources

The weak form of Stirling’s Formula is taken from [5]. The ﬁrst sequence proof is mostly adapted from the sketch in Kazarinoﬀ [2] which is in turn based on the note Nanjundiah [3]. The second sequence proof using derivatives and monotonicity is adapted from [1].

_______________________________________________________________________________________________

### Problems to Work for Understanding

1. Show that $\sqrt[n]{2n+1}\to 1$ as $n\to \infty$.
2. Show that for $|x|<1$,
$log\left(\frac{1+x}{1-x}\right)=2\sum _{k=0}^{\infty }\frac{1}{\left(2k+1\right){x}^{2k+1}}\phantom{\rule{0.3em}{0ex}}.$

3. Let $f\left(x\right)=\left(x+1∕2\right)log\left(1+1∕x\right)-1$. Show that $f\left(x\right)$ decreases to $0$ as $x\to \infty$.
4. Show that
$\frac{{\left({a}_{n}\right)}^{2}}{{a}_{2n}}=\sqrt{\left(\frac{2}{n}\right)}\frac{2\cdot 4\dots \left(2n-2\right)\cdot 2n}{1\cdot 3\dots \left(2n-3\right)\cdot \left(2n-1\right)}\phantom{\rule{0.3em}{0ex}}.$

5. Show that the derivative of the function $f\left(x\right)={\left(1+\frac{1}{x}\right)}^{x+\alpha }$ (deﬁned on $\left[1,\infty \right)$ ) is
${f}^{\prime }\left(x\right)={\left(1+\frac{1}{x}\right)}^{x+\alpha }\left(ln\left(1+\frac{1}{x}\right)-\frac{x+\alpha }{x\left(x+1\right)}\right).$

__________________________________________________________________________

### References

[1]   Dorin Ervin Dutkay, Constantin P. Niculescu, and Florin Popvici. Stirling’s formula and its extension for the Gamma function. American Mathematical Monthly, 120:737–740, October 2013. available as http:dx.doi.org/10.4169/amer.math.monthly.120.08.737.

[2]   Nicholaus D. Kazarinoﬀ. Analytic Inequalities. Holt, Rinehart and Winston, 1961.

[3]   T. S. Nanjundiah. Note on Stirling’s formula. American Mathematical Monthly, 66:701–703, 1959.

[4]   G. Pólya and G. Szegö. Problems and Theorems in Analysis I: Series, Integrals, Theory of Functions. Classics in Mathematics. Springer Verlag, 1998. Repring of the 1978 version.

[5]   S. Saks and A. Zygmund. Analytic Functions. Elsevier Publishing, 1971.

__________________________________________________________________________

__________________________________________________________________________

I check all the information on each page for correctness and typographical errors. Nevertheless, some errors may occur and I would be grateful if you would alert me to such errors. I make every reasonable eﬀort to present current and accurate information for public use, however I do not guarantee the accuracy or timeliness of information on this website. Your use of the information from this website is strictly voluntary and at your risk.

I have checked the links to external sites for usefulness. Links to external websites are provided as a convenience. I do not endorse, control, monitor, or guarantee the information contained in any external website. I don’t guarantee that the links are active at all times. Use the links here with the same caution as you would all information on the Internet. This website reﬂects the thoughts, interests and opinions of its author. They do not explicitly represent oﬃcial positions or policies of my employer.

Information on this website is subject to change without notice.