Our goal is to find an approximation of

\[n! = 1 \cdot 2 \cdot 3 \cdot \ldots \cdot n\]

that is a function $f(n)$ such that

\[n! = f(n) + \varepsilon(n)\]

with $\varepsilon(n) \rightarrow 0$ for $n \rightarrow \infty$. To ease the notation, we will simply write $n! = f(n)$ ignoring the error term, but we will keep in mind that our approximation will be valid for large $n$. This is known as Striling’s approximation, which can be proved in several ways. What we see here is a nice proof that is relatively easy to understand.

We take $f(n) = n^n \varphi(n)$, with $\varphi$ unknown. It is easy to see that, given

\[\begin{aligned} (n+1)! & = (n+1)^{n+1} \varphi(n+1) \\ n! & = n^n \varphi(n), \end{aligned}\]

we have

\[\frac{\varphi(n+1)}{\varphi(n)} = \left( 1 + \frac{1}{n} \right)^{-n}.\]

Since

\[\lim_{n\rightarrow \infty} \left( 1 + \frac{1}{n} \right)^{-n} = e^{-1},\]

we could just take $\varphi(n) = e^{-n}$. This approximation, however, is not very good. We can do better by adding another term, that is

\[f(n) = n^n e^{-n} \psi(n).\]

As done before, we compute

\[\frac{(n+1)!}{n!} = \frac{ (n+1)^{n+1}e^{-(n+1)}\psi(n+1) }{ n^n e^{-n}\psi(n) },\]

from which we obtain

\[\frac{\psi(n+1)}{\psi(n)} = \left( 1 + \frac{1}{n} \right)^{-n} e^{-1},\]

which is what we found before, but with the addition of the $e^{-1}$ term. The next step used the formula

\[\begin{aligned} \log \frac{1+x}{1-x} & = \log (x+1) - \log(x - 1) \\ & = 2 \left( x + \frac{x^3}{3} + \frac{x^5}{5} + \dots \right) \\ & > 2x, \end{aligned}\]

where $0 < x < 1$. If we set $x = \frac{1}{2n + 1}$, we get

\[\log \left(1 + \frac{1}{n} \right) > \frac{1}{n +\frac{1}{2}},\]

from which we get

\[\left( 1 + \frac{1}{n} \right)^{n + \frac{1}{2}} > e.\]

Therefore,

\[\frac{\psi(n+1)}{\psi(n)} < \left( 1 + \frac{1}{n} \right)^{\frac{1}{2}} = \frac{\sqrt{n+1}}{\sqrt{n}},\]

that is,

\[\frac{\psi(n+1)}{\sqrt{n+1}} < \frac{\psi(n)}{\sqrt{n}}.\]

The function $\chi(n)$ is (slowly) decreasig and greater than zero; it has therefore a limit, which we will call $\chi(\infty)$,

\[\lim_{n\rightarrow \infty} \chi(n) = \chi(\infty).\]

Putting all the pieces together, we have found

\[n! \approx n^n e^{-n} \sqrt{n} \, \chi(\infty),\]

an expression that was found by De Moivre. Stirling found the value of $\chi(\infty)$, which we will now calculate.

The starting point is Wallis product,

\[\frac{\pi}{2} = \lim_{n\rightarrow \infty} \frac{ 2 \cdot 2 \cdot 4 \cdot 4 \cdot \ldots \cdot 2n \cdot 2n }{ 1 \cdot 3 \cdot 3 \cdot 5 \cdot 5 \cdot \ldots \cdot (2n -1) (2n + 1) }.\]

The numerator can be written as

\[2^{2n} (n!)^2.\]

If we multiply both terms of the fraction by this number, the denominator becomes the square of $(2n)!$ times $2n + 1$, and therefore

\[\frac{\pi}{2} = \lim_{n\rightarrow \infty} \frac{ 2^{4n} (n!)^4 }{ (2n)! (2n!) (2n + 1) }.\]

Plugging in our approximation $n! \approx n^n e^{-n} \sqrt{n} \, \chi(\infty)$, we obtain

\[\begin{aligned} \frac{\pi}{2} & = \lim_{n\rightarrow \infty} \frac{ 2^{4n} n^{4n} e^{-4n} \left(\sqrt{n}\right)^4 \chi(n)^4 }{ \left[ (2n)^{2n} e^{-2n} \sqrt{2n} \chi{2n} \right]^2 (2n + 1) } \\ & = \frac{ 2^{4n} n^{4n} e^{-4n} n^2 \chi(n)^4 }{ (2n)^{4n} e^{-4n} 2n \chi(2n)^2 (2n + 1) } \\ & = \frac{n}{2(2n + 1)} \frac{\chi(\infty)^4}{\chi{\infty}^2}, \end{aligned}\]

because $\lim_{n\rightarrow \infty} \chi(n) = \lim_{n\rightarrow \infty} \chi(2n) = \chi(\infty)$. Removing redundant terms we obtain

\[\frac{\pi}{2} = \frac{1}{4} \chi{\infty}^2,\]

which gives

\[\chi(\infty) = \sqrt{2 \pi}\]

thus completing the proof of Stirling’s approximation.