Stirling’s Formula

Today I wanted to discuss something I learnt last week in my Probability course: Stirling’s Formula. Stirling’s Formula is an approximation for factorials, and leads to quite accurate results even for small values of n.

The formula can be written in two ways:

{\displaystyle \ln n!=n\ln n-n+O(\ln n)}


{\displaystyle n!\sim {\sqrt {2\pi n}}\left({\frac {n}{e}}\right)^{n},}

where the ~ sign means that the two quantities are asymptotic (i.e. their ratios tend to 1 as n tends to infinity).

File:Mplwp factorial gamma stirling.svg
Comparison of Factorial with Stirling’s Approximation | Source: Wikipedia

Proof of Stirling’s Formula

The following identity arises using integration by parts:

Screen Shot 2017-02-06 at 8.11.00 AM.png

Taking f(x) = log x, we obtain

Screen Shot 2017-02-06 at 8.11.48 AM.png

Next, sum over n, and by recalling that log x + log y = log xy we get the following expression:

Screen Shot 2017-02-06 at 8.12.23 AM.png


Screen Shot 2017-02-06 at 8.13.23 AM.png

Next, define

Screen Shot 2017-02-06 at 8.13.38 AM.png

which allows us to rearrange the above expression to:

Screen Shot 2017-02-06 at 8.13.41 AM.png

So as n tends to infinity we get

Screen Shot 2017-02-06 at 8.13.46 AM.png

How do we show that Screen Shot 2017-02-06 at 8.15.19 AM.png ?

Firstly, note that from (*) it follows that

Screen Shot 2017-02-06 at 8.16.31 AM.png

So, we need to show that

Screen Shot 2017-02-06 at 8.16.57 AM.png

Let’s set

Screen Shot 2017-02-06 at 8.17.25 AM.png

Note that I0=π/2 and I1 = 1. Then for n≥2, we can integrate by parts to see that

Screen Shot 2017-02-06 at 8.19.17 AM.png

And so, we obtain the following two expressions:

Screen Shot 2017-02-06 at 8.19.36 AM.png

In is decreasing in n and In/In-2 → 1, so it follows that I2n/I2n+1 → 1. Therefore,

Screen Shot 2017-02-06 at 8.21.18 AM.png

as required.

Although the end result is satisfying, I find that some steps in this proof are like ‘pulling-a-rabbit-out-of-a-hat’! What do you think? Mx




One thought on “Stirling’s Formula”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s