Valerio De Angelis

Stirling's formula

Stirling's formula is \[\lim_{n\rightarrow \infty} \frac{n!}{n^n e^{-n} \sqrt{2\pi n}}=1.\] It may be the formula with the largest number of published proofs.

The following is the simplest and most elementary proof of Stirling's formula I have seen. I found it online some years ago and can no longer find the reference. It depends on Wallis product formula for \(\pi\) and the four items described below, whose proofs are completely elementary. Using these four items, a three line proof of Stirling's formula is described at the end of this document.
  1. Let \(n \) be a positive integer. Then \begin{equation} \label{1} \log n! = n\log(n+1)-\sum_{r=1}^n r \log\left(1+\frac{1}{r}\right) \end{equation} Proof. For \(r\geq 1\), we find \[\int_r^{r+1}\log x dx=\left[x \log x -x\right]_r^{r+1}=r \log\left(1+\frac{1}{r}\right) + \log(r+1)-1.\] So \[ \int_1^{n+1} \log x dx=\sum_{r=1}^n \int_r^{r+1}\log x dx =\sum_{r=1}^n r \log\left(1+\frac{1}{r}\right) + \log (n+1)!-n.\] Comparing with \[\int_1^{n+1} \log x dx =\left[x \log x -x \right]_1^{n+1} = (n+1)\log(n+1)-n,\] the result follows. \(\blacksquare\)

  2. For \(r > 0 \), define \[g(r)=\left(r+\frac{1}{2}\right) \log \left(1+\frac{1}{r}\right) -1.\] If \(n\geq 2\), then \begin{equation} \label{S} \log n! -n \log n - \frac{1}{2}\log n +n=1-\sum_{r=1}^{n-1}g(r). \end{equation} Proof. Note that \begin{equation} \label{2} \sum_{r=1}^{n-1}\log\left(1+\frac{1}{r}\right)=\sum_{r=1}^{n-1}\left(\log(r+1)-\log r\right)=\log n.\end{equation} So, using (\ref{1}) and (\ref{2}), we find: \begin{eqnarray*} \log n! -n \log n - \frac{1}{2}\log n +n &=& n\log(n+1)-\sum_{r=1}^n r \log\left(1+\frac{1}{r}\right)-n \log n - \frac{1}{2}\log n +n\\ &=& n\log\left(1+\frac{1}{n}\right) -\sum_{r=1}^n r \log\left(1+\frac{1}{r}\right)- \frac{1}{2}\sum_{r=1}^{n-1}\log\left(1+\frac{1}{r}\right)+n\\ &=& -\sum_{r=1}^{n-1} r \log\left(1+\frac{1}{r}\right)- \frac{1}{2}\sum_{r=1}^{n-1}\log\left(1+\frac{1}{r}\right)+n\\ &=& -\sum_{r=1}^{n-1}\left( \left(r+\frac{1}{2}\right) \log\left(1+\frac{1}{r}\right)-1\right) +1\\ &=& 1-\sum_{r=1}^{n-1} g(r)\ \ \ \ \ \ \ \ \ \blacksquare \end{eqnarray*}

  3. For each \(r > 0 \), \begin{equation} \label{3} g(r)= \sum_{k=1}^\infty \frac{1}{(2k+1)(2r+1)^{2k}}. \end{equation}
  4. Proof. Use the Taylor expansion \[\log \left(\frac{1+t}{1-t}\right) =\sum_{k=0}^\infty \frac{2t^{2k+1}}{2k+1}\] and the identity \[1+\frac{1}{r}=\frac{1+\frac{1}{2r+1}}{1-\frac{1}{2r+1}} \ \ \ \ \blacksquare \]
  5. The limit \[\lim_{n\rightarrow \infty } \left( \log n! -n \log n - \frac{1}{2}\log n +n\right) \] exists.
    Proof. From (\ref{3}), we find \[g(r)= \sum_{k=1}^\infty \frac{1}{(2k+1)(2r+1)^{2k}}\leq \sum_{k=1}^\infty \frac{1}{(2r+1)^{2k}}=\frac{1}{4r^2+4r}\leq \frac{1}{4r^2}. \] So the sum in (\ref{S}) converges as \(n\rightarrow \infty \ \ \blacksquare\)


  6. Proof of Stirling's formula in three steps
    \[g(r):=\left(r+\frac{1}{2}\right) \log \left(1+\frac{1}{r}\right) -1\stackrel{(*)}{=} \sum_{k=1}^\infty \frac{1}{(2k+1)(2r+1)^{2k}} \stackrel{(**)}{\leq} \frac{1}{4r^2}.\] \[ \log n! -n \log n - \frac{1}{2}\log n +n\stackrel{(\#)}{=}1-\sum_{r=1}^{n-1}g(r)\stackrel{(\# \#)}{\rightarrow} C.\] \[\sqrt{\frac{\pi}{2}}\stackrel{(\%)}{=}\sqrt{\frac{2}{\pi}}\prod_{n=1}^\infty \frac{4n^2}{(2n-1)(2n+1)}\stackrel{(@)}{=} \lim_{n\rightarrow \infty} \frac{(2^n n!)^2}{(2n)!\sqrt{2n}} \stackrel{(\$)}{=}\lim_{n\rightarrow \infty} \frac{2^{2n}n^{2n} e^{-2n}n e^{2C}}{(2n)^{2n}e^{-2n} \sqrt{2n} e^C \sqrt{2n}}(1+\epsilon_n)=\frac{e^C}{2} .\] (*) By item 3.

    (**) Because \(\dfrac{1}{(2k+1)(2r+1)^{2k}}\leq \dfrac{1}{(2r+1)^{2k}}\).

    (#) By item 2.

    (##) By the previous line.

    (%) Wallis formula.

    (@) Because \(\displaystyle \prod_{k=1}^n \frac{4k^2}{(2k-1)(2k+1)}=\frac{(2^n n!)^4}{((2n)!)^2 (2n+1)}\).

    (\(\$\)) By the previous line, where \(\epsilon_n \rightarrow 0\).