# 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 $\left \langle {d_n} \right \rangle$ defined as:

$\displaystyle d_n = \ln \left({n!}\right) - \left({n + \frac 1 2}\right) \ln n + n$

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

From Lemma 3 it is seen that the sequence:

$\left \langle {d_n - \dfrac 1 {12 n}}\right\rangle$

is increasing.

In particular:

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

and so $\left\langle{d_n}\right\rangle$ is bounded below.

From the Monotone Convergence Theorem (Real Analysis), it follows that $\left\langle{d_n}\right\rangle$ 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 \ \mathrm d x$

Then from Lemma 4:

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

So:

 $\displaystyle \lim_{n \mathop \to \infty} \dfrac {n!} {n^n \sqrt n e^{-n} }$ $=$ $\displaystyle \sqrt {2 \pi}$ Lemma 5 $\displaystyle \implies \ \$ $\displaystyle \lim_{n \mathop \to \infty} \dfrac {n!} {\sqrt{2 \pi n} \left({\frac n e}\right)^n}$ $=$ $\displaystyle 1$

Hence the result.

$\blacksquare$