nLab Stirling's approximation

Contents

Idea

Stirling’s approximation, or Stirling’s formula, gives an asymptotic approximation to the factorial function in terms of elementary functions.

Statement

Define n!n! for nn \in \mathbb{N} as usual by recursion: 0!=10! = 1 and (n+1)!=(n+1)n!(n+1)! = (n+1) \cdot n!. Stirling’s approximation says

n!n n2πne nn! \sim \frac{n^n \sqrt{2\pi n}}{e^n}

or in other words that

limnn n2πne nn!=1.\underset{n \to \infty}{\lim}\; \frac{n^n \sqrt{2\pi n}}{e^n \cdot n!} = 1.

Proof

Many proofs are known. The following is meant to bring out the essential kinship between this formula and the famous Gaussian integral identity

e x 2dx=π,\int_{-\infty}^\infty e^{-x^2}\; d x = \sqrt{\pi},

or equivalently

e x 2/2dx=2π.\int_{-\infty}^\infty e^{-x^2/2}\; d x = \sqrt{2\pi}.

First we establish an elementary fact, accessible to a student of elementary calculus.

Proposition

For some constant CC,

n!Cn nne n.n! \sim C\frac{n^n \sqrt{n}}{e^n}.

Proof

Consider a trapezoidal sum estimate? for the integral

I n= 1 nlogxdx=xlogxx| 1 n=nlognn+1=1+logn ne n.I_n = \int_1^n \log x\; dx = \left. x\log x - x\right|_1^n = n \log n - n + 1 = 1 + \log \frac{n^n}{e^n}.

Partitioning the interval [1,n][1, n] into subintervals of unit length, the corresponding trapezoidal sum is

T n=log1+log22+log2+log32++log(n1)+logn2=log(n!)12logn=logn!n.T_n = \frac{\log 1 + \log 2}{2} + \frac{\log 2 + \log 3}{2} + \cdots + \frac{\log (n-1) + \log n}{2} = \log (n!) - \frac1{2} \log n = \log \frac{n!}{\sqrt{n}}.

T nT_n underestimates I nI_n because the graph of log\log is “concave down” (meaning logx-\log x is a convex function). In other words, the error terms

k k+1logxdxlogk+log(k+1)2(1)\int_k^{k+1} \log x\; dx - \frac{\log k + \log (k+1)}{2} \qquad (1)

are positive, so that the sum of these error terms from k=1k=1 to n1n-1, which is I nT nI_n - T_n, increases with nn. However, using the error term estimate for the trapezoidal rule, the term (1) is on the order of 1/k 21/k^2 (the maximum value of |(log)(x)|=1/x 2|(\log)''(x)| = 1/x^2 over [k,k+1][k, k+1]). Since 1/k 2\sum 1/k^2 converges, we see that the increasing sequence I nT nI_n - T_n has a uniform upper bound and therefore a limit. Hence the limit

limn(I n1)T n=limnlogn ne nlogn!n=limnlogn nne nn!\underset{n \to \infty}{\lim} (I_n - 1) - T_n = \underset{n \to \infty}{\lim} \log \frac{n^n}{e^n} - \log \frac{n!}{\sqrt{n}} = \underset{n \to \infty}{\lim} \log \frac{n^n \sqrt{n}}{e^n \cdot n!}

exists, and therefore n!Cn nne nn! \sim C\frac{n^n \sqrt{n}}{e^n} for some constant CC.

The following lemma makes reference to the Gamma function.

Lemma

2πC=limnΓ(n+12)Γ(n)n\frac{\sqrt{2\pi}}{C} = \underset{n \to \infty}{\lim} \frac{\Gamma(n + \frac1{2})}{\Gamma(n) \cdot \sqrt{n}}; in particular, this limit exists.

Proof

From n!Cn nne nn! \sim C\frac{n^n \sqrt{n}}{e^n}, we easily derive

(2n)!n!n!2 2n2nCn\frac{(2n)!}{n! \cdot n!} \sim \frac{2^{2n} \sqrt{2n}}{C n}

so that

1C(2n)!2 2nn!n!n2n=(2n1)(2n3)312(2n2)(2n4)212n.\frac1{C} \sim \frac{(2n)!}{2^{2n} n! \cdot n!} \cdot \frac{n}{\sqrt{2n}} = \frac{(2n-1)(2n-3) \ldots 3 \cdot 1}{2 \cdot (2n-2)(2n-4) \ldots 2} \cdot \frac1{\sqrt{2n}}.

Then, using Γ(12)=2 0 e x 2dx=π\Gamma\left(\frac1{2}\right) = 2\int_0^\infty e^{-x^2} dx = \sqrt{\pi}, we have

2πC(2n1)(2n3)312(2n2)(2n4)2πn=(n12)(n32)(12)Γ(12)(n1)!n=Γ(n+12)Γ(n)n.\frac{\sqrt{2\pi}}{C} \sim \frac{(2n-1)(2n-3) \ldots 3 \cdot 1}{2 \cdot (2n-2)(2n-4) \ldots 2} \cdot \frac{\sqrt{\pi}}{\sqrt{n}} = \frac{\left(n-\frac1{2}\right)\left(n-\frac{3}{2}\right) \ldots \left(\frac1{2}\right) \Gamma\left(\frac1{2}\right)}{(n-1)! \cdot \sqrt{n}} = \frac{\Gamma\left(n + \frac1{2}\right)}{\Gamma(n) \cdot \sqrt{n}}.

Proposition

limnΓ(n+12)Γ(n)n=1\underset{n \to \infty}{\lim} \frac{\Gamma(n + \frac1{2})}{\Gamma(n) \cdot \sqrt{n}} = 1.

Proof

From log-convexity of Γ\Gamma (see here), we may derive

Γ(x12)Γ(x1)Γ(x)Γ(x12)Γ(x+12)Γ(x)\frac{\Gamma(x-\frac1{2})}{\Gamma(x - 1)} \leq \frac{\Gamma(x)}{\Gamma(x-\frac1{2})} \leq \frac{\Gamma(x+\frac1{2})}{\Gamma(x)}

which implies that the values of Γ(x+12)Γ(x)x\frac{\Gamma(x+\frac1{2})}{\Gamma(x) \cdot \sqrt{x}}, with xx ranging over half-integers, tend to the same limit LL as with xx ranging over whole integers. Therefore

L 2=limnΓ(n+1)n+12Γ(n+12)Γ(n+12)nΓ(n)=limnnΓ(n)(n+12)nΓ(n)=limnn(n+12)n,L^2 = \underset{n \to \infty}{\lim} \frac{\Gamma(n+1)}{\sqrt{n+\frac1{2}}\cdot \Gamma(n + \frac1{2})} \cdot \frac{\Gamma(n + \frac1{2})}{\sqrt{n}\Gamma(n)} = \underset{n \to \infty}{\lim} \frac{n\Gamma(n)}{\sqrt{(n+\frac1{2})n}\cdot \Gamma(n)} = \underset{n \to \infty}{\lim} \frac{n}{\sqrt{(n+\frac1{2})n}},

whence L 2=1L^2 = 1, and therefore L=1L = 1.

References

  • n-Category Café post

  • Dan Romik, Stirling’s Approximation for n!: the Ultimate Short Proof?, The American Mathematical Monthly Volume 107 Issue 6 (2000), 556-557. doi.org/10.1080/00029890.2000.12005235

Last revised on April 12, 2024 at 22:24:35. See the history of this page for a list of all contributions to it.