# Stirling's Formula/Proof 2

## Theorem

The factorial function can be approximated by the formula:

$n! \sim \sqrt {2 \pi n} \paren {\dfrac n e}^n$

where $\sim$ denotes asymptotically equal.

## Proof

Consider the sequence $\sequence {d_n}$ defined as:

$d_n = \map \ln {n!} - \paren {n + \dfrac 1 2} \ln n + n$

From Lemma 2 it is seen that $\sequence {d_n}$ is a decreasing sequence.

From Lemma 3 it is seen that the sequence:

$\sequence {d_n - \dfrac 1 {12 n} }$

is increasing.

In particular:

$\forall n \in \N_{>0}: d_n - \dfrac 1 {12 n} \ge d_1 = \dfrac 1 {12}$

and so $\sequence {d_n}$ is bounded below.

From the Monotone Convergence Theorem (Real Analysis), it follows that $\sequence {d_n}$ is convergent.

Let $d_n \to d$ as $n \to \infty$.

From Exponential Function is Continuous, we have:

$\exp d_n \to \exp d$ as $n \to \infty$

Let $C = \exp d$.

Then:

$\dfrac {n!} {n^n \sqrt n e^{-n} } \to C$ as $n \to \infty$

It remains to be shown that $C = \sqrt {2 \pi}$.

Let $I_n$ be defined as:

$\displaystyle I_n = \int_0^{\frac \pi 2} \sin^n x \rd x$

Then from Lemma 4:

$\displaystyle \lim_{n \mathop \to \infty} \frac {I_{2 n} } {I_{2 n + 1} } = 1$

So:

 $\displaystyle \lim_{n \mathop \to \infty} \dfrac {n!} {n^n \sqrt n e^{-n} }$ $=$ $\displaystyle \sqrt {2 \pi}$ Lemma 5 $\displaystyle \leadsto \ \$ $\displaystyle \lim_{n \mathop \to \infty} \dfrac {n!} {\sqrt {2 \pi n} \paren {\frac n e}^n}$ $=$ $\displaystyle 1$

Hence the result.

$\blacksquare$