# 10.10: The Binomial Distribution and Stirling's Appromixation

- Last updated

- Save as PDF

- Page ID
- 143048

Stirling's approximation is named after the Scottish mathematician James Stirling (1692-1770). In confronting statistical problems we often encounter factorials of very large numbers. The factorial N! is a product N(N-1)(N-2)..(2)(1). Therefore, \(\ln \,N!\) is a sum

\[\left.\ln N!\right. = \ln 1 + \ln 2 + \ln 3 + ... + \ln N = \sum_{k=1}^N \ln k. \label{1}\]

where we have used the property of logarithms that \(\log(abc) =\ log(a) + \log(b) +\log(c)\). The sum is shown in figure below.

Using **Euler-MacLaurin** formula one has

\[\sum_{k=1}^N \ln k=\int_1^N \ln x\,dx+\sum_{k=1}^p\frac{B_{2k}}{2k(2k-1)}\left(\frac{1}{n^{2k-1}}-1\right)+R , \label{2}\]

where *B*_{1} = −1/2, *B*_{2} = 1/6, *B*_{3} = 0, *B*_{4} = −1/30, *B*_{5} = 0, *B*_{6} = 1/42, *B*_{7} = 0, *B*_{8} = −1/30, ... are the *Bernoulli numbers*, and *R* is an error term which is normally small for suitable values of *p*.

Then, for large *N*,

\[\ln N! \sim \int_1^N \ln x\,dx \approx N \ln N -N . \label{3}\]

after some further manipulation one arrives at (apparently Stirling's contribution was the prefactor of \(\sqrt{2\pi})\)

\[N! = \sqrt{2 \pi N} \; N^{N} e^{-N} e^{\lambda_N} \label{4}\]

where

\[\dfrac{1}{12N+1} < \lambda_N < \frac{1}{12N}. \label{5}\]

The sum of the area under the blue rectangles shown below up to N is ln N!. As you can see the rectangles begin to closely approximate the red curve as m gets larger. The area under the curve is given the integral of ln x.

\[ \ln N! = \sum_{m=1}^N \ln m \approx \int_1^N \ln x\, dx \label{6}\]

To solve the integral use integration by parts

\[ \int u\,dv=uv-\int v\,dy \label{7A}\]

Here we let \(u = \ln x\) and \(dv = dx\). Then \(v = x\) and \(du = \frac{dx}{x}\).

\[ \int_0^N \ln x \, dx = x \ln x|_0^N - \int_0^N x \dfrac{dx}{x} \label{7B}\]

Notice that \(x/x = 1\) in the last integral and \(x \ln x\) is 0 when evaluated at zero, so we have

\[ \int_0^N \ln x \, dx = N \ln N - \int_0^N dx \label{8}\]

Which gives us Stirling’s approximation: \(\ln N! = N \ln N – N\). As is clear from the figure above Stirling’s approximation gets better as the number N gets larger (Table \(\PageIndex{1}\)).

N |
N! |
ln N! |
N ln N – N |
Error |
---|---|---|---|---|

10 | 3.63 x 10^{6} |
15.1 | 13.02 | 13.8% |

50 | 3.04 x 10^{64} |
148.4 | 145.6 | 1.88% |

100 | 9.33 x 10^{157} |
363.7 | 360.5 | 0.88% |

150 | 5.71 x 10^{262} |
605.0 | 601.6 | 0.56% |

Calculators often overheat at 200!, which is all right since clearly result are converging. In thermodynamics, we are often dealing very large N (i.e., of the order of Avagadro’s number) and for these values Stirling’s approximation is excellent.

## References

- J. Stirling "Methodus differentialis, sive tractatus de summation et interpolation serierum infinitarium", London (1730). English translation by J. Holliday "The Differential Method: A Treatise of the Summation and Interpolation of Infinite Series" (1749)