logo

A Simple Derivation of the Stirling Formula 📂Thermal Physics

A Simple Derivation of the Stirling Formula

Formulas

The following equation is referred to as Stirling’s formula.

$$ \lim_{n \to \infty} {{n!} \over {e^{n \ln n - n} \sqrt{ 2 \pi n} }} = 1 $$

Description1

This approximation is useful in the aspect of calculating factorials for large numbers. In fields like thermodynamics and statistical mechanics, it’s essential to assume a large number of molecules,

$$ \begin{align*} n! &\approx \sqrt{2\pi n}\left( \dfrac{n}{e} \right)^{n} \\[0.6em] \log_{2} n! &\approx n \log_{2} n - n \log_{2}e \\[0.6em] \ln n! &\approx n \ln n - n \end{align*} $$

and a more simplified expression like the one above is also used. The proof below is somewhat less rigorous analytically but is sufficient if one only emphasizes the facts for application.

See Also

Derivation 2

Let’s start from the Gamma function $\displaystyle n! = \int_{0}^{\infty} x^{n} e^{-x} dx$. If we set it as $f(x) = n \ln x - x$, then the following formula holds.

$$ e^{f(x)} = x^{n} e^{-x} $$

Given $\displaystyle {{df(x)} \over {dx}} = {{n } \over {x }} - 1$ and $\displaystyle {{d^2 f(x)} \over {dx^2 }} = - {{n } \over {x^2 }}$, and also $\displaystyle {{d^3 f(x)} \over {dx^3 }} = {{ 2n } \over {x^3 }}$, the Taylor expansion of $f$ is as follows.

$$ \begin{align*} f(x) =& f(n) + f '(n) (x-n) + {{1} \over {2!}} f ''(n) (x-n)^2 + {{1} \over {3!}} f^{(3)} (n) (x-n)^3 + \cdots \\ =& n \ln n - n + 0 \cdot (x-n) - {{1} \over {2}} {{n} \over{ n^2}} (x-n)^2 + {{1} \over {6}} {{2n} \over{ n^3}} (x-n)^3 + \cdots \\ =& n \ln n - n - {{ (x-n)^2 } \over{ 2n }} + {{ (x-n)^3 } \over{ 3 n^2 }} + \cdots \end{align*} $$

When $n$ is sufficiently large, the terms following $\displaystyle {{ (x-n)^2 } \over{ 2 n }}$ can be ignored as the denominator increases too rapidly. Thus, the result below is obtained.

$$ f(x) \approx n \ln n - n - {{ (x-n)^2 } \over{ 2n }} $$

20181022\_163326.png

Furthermore, if $n$ is significantly large, the integration of the Gaussian curve from $0$ to $\infty$, and one from $-\infty$ to $\infty$, have no significant difference. Consequently, for a sufficiently large $n$, $$ n! = e^{n \ln n - n} \int_{0}^{\infty} e^{-(x-n)^2 / 2n + \cdots } dx \approx e^{n \ln n - n} \int_{-\infty}^{\infty} e^{-(x-n)^2 / 2n } dx $$ by Gaussian integration, $\displaystyle \int_{-\infty}^{\infty} e^{-(x-n)^2 / 2n } dx = \sqrt{ 2 \pi n}$ holds, leading to the following formula.

$$ n! \approx e^{n \ln n - n} \sqrt{ 2 \pi n} $$

Taking the logarithm of both sides yields the formula below.

$$ \ln n! \approx n \ln n - n + \dfrac{1}{2}\ln 2\pi n $$

If $n$ is very large, then the following approximation holds.

$$ \ln n! \approx n \ln n - n $$


  1. Stephen J. Blundell and Katherine M. Blundell, 열 물리학(Concepts in Thermal Physics, 이재우 역) (2nd Edition, 2014), p12 ↩︎

  2. Stephen J. Blundell and Katherine M. Blundell, 열 물리학(Concepts in Thermal Physics, 이재우 역) (2nd Edition, 2014), p591-593 ↩︎