Algorithm Search⌘K

Proofs: Stirling's approximation

These are the human proofs of Stirling's approximation, at full length.

The sharp form of Stirling's formula, with the constant and the error bounds full

This proof shows: stirling-formula.

Statement. There is a real sequence (rn)n≥1(r_n)_{n \ge 1} with 0<rn<112n0 < r_n < \frac{1}{12n} for each n≥1n \ge 1, such that

n!=2πn (ne)nern.n! = \sqrt{2\pi n}\,\left(\frac{n}{e}\right)^n e^{r_n}.

In particular n!∼2πn (n/e)nn! \sim \sqrt{2\pi n}\,(n/e)^n. The sharper lower bound rn>112n+1r_n > \frac{1}{12n+1} is Robbins' theorem and is not proved here.

Step 1: a convergent sequence. For n≥1n \ge 1 let

an=ln⁡n!−(n+12)ln⁡n+n,so thatn!=eann (n/e)n.a_n = \ln n! - \left(n + \tfrac12\right)\ln n + n, \qquad\text{so that}\qquad n! = e^{a_n}\sqrt{n}\,(n/e)^n.

Then

an−an+1=(n+12)ln⁡n+1n−1.a_n - a_{n+1} = \left(n + \tfrac12\right)\ln\frac{n+1}{n} - 1.

To see this, expand an+1a_{n+1} and use ln⁡(n+1)!=ln⁡n!+ln⁡(n+1)\ln (n+1)! = \ln n! + \ln(n+1): the terms ln⁡n!\ln n! cancel, and what remains is −ln⁡(n+1)+(n+32)ln⁡(n+1)−(n+12)ln⁡n+n−(n+1)-\ln(n+1) + (n + \frac32)\ln(n+1) - (n+\frac12)\ln n + n - (n+1), which is the right side.

Step 2: a series for the difference. Put t=12n+1t = \frac{1}{2n+1}, so 0<t<10 < t < 1. Then 1+t1−t=2n+22n=n+1n\frac{1+t}{1-t} = \frac{2n+2}{2n} = \frac{n+1}{n} and n+12=12tn + \frac12 = \frac{1}{2t}. For 0≤t<10 \le t < 1 we have ln⁡1+t1−t=2∑j≥0t2j+12j+1\ln\frac{1+t}{1-t} = 2\sum_{j \ge 0} \frac{t^{2j+1}}{2j+1}. So

an−an+1=12t⋅2∑j≥0t2j+12j+1−1=∑j≥1t2j2j+1.a_n - a_{n+1} = \frac{1}{2t}\cdot 2\sum_{j \ge 0}\frac{t^{2j+1}}{2j+1} - 1 = \sum_{j \ge 1}\frac{t^{2j}}{2j+1}.

Step 3: two-sided bound on the difference. Every term of the series is positive, so an−an+1>0a_n - a_{n+1} > 0. Also 12j+1≤13\frac{1}{2j+1} \le \frac13 for j≥1j \ge 1, with strict inequality for j≥2j \ge 2, so

an−an+1<13∑j≥1t2j=t23(1−t2).a_n - a_{n+1} < \frac13\sum_{j \ge 1} t^{2j} = \frac{t^2}{3(1-t^2)}.

Since t−2−1=(2n+1)2−1=4n(n+1)t^{-2} - 1 = (2n+1)^2 - 1 = 4n(n+1), we get t21−t2=14n(n+1)\frac{t^2}{1-t^2} = \frac{1}{4n(n+1)}. Hence

0<an−an+1<112n(n+1)=112n−112(n+1).0 < a_n - a_{n+1} < \frac{1}{12n(n+1)} = \frac{1}{12n} - \frac{1}{12(n+1)}.

Step 4: the limit and the bounds on rnr_n. Step 3 says two things. First, (an)(a_n) is strictly decreasing. Second, an−112n<an+1−112(n+1)a_n - \frac{1}{12n} < a_{n+1} - \frac{1}{12(n+1)}, so bn=an−112nb_n = a_n - \frac{1}{12n} is strictly increasing. Also bn<an≤a1b_n < a_n \le a_1 for each nn, so (bn)(b_n) is increasing and bounded above. It converges to a limit LL. Since an=bn+112na_n = b_n + \frac{1}{12n} and 112n→0\frac1{12n} \to 0, the sequence (an)(a_n) also converges to LL. A strictly increasing sequence is smaller than its limit, and a strictly decreasing sequence is larger than its limit. So for each n≥1n \ge 1,

L<anandan−112n<L.L < a_n \quad\text{and}\quad a_n - \frac{1}{12n} < L.

Let rn=an−Lr_n = a_n - L. Then 0<rn<112n0 < r_n < \frac{1}{12n}, and n!=eLernn (n/e)nn! = e^{L} e^{r_n}\sqrt n\,(n/e)^n. Put K=eLK = e^L. It remains to show K=2πK = \sqrt{2\pi}.

Step 5: Wallis integrals. For integers m≥0m \ge 0 let Im=∫0π/2sin⁡mx dxI_m = \int_0^{\pi/2}\sin^m x\,dx. Then I0=π/2I_0 = \pi/2 and I1=1I_1 = 1. For m≥2m \ge 2 write sin⁡mx=sin⁡m−1x⋅sin⁡x\sin^m x = \sin^{m-1}x\cdot\sin x and integrate by parts: Im=(m−1)∫0π/2sin⁡m−2xcos⁡2x dx=(m−1)(Im−2−Im)I_m = (m-1)\int_0^{\pi/2}\sin^{m-2}x\cos^2x\,dx = (m-1)(I_{m-2} - I_m), because the boundary term −sin⁡m−1xcos⁡x-\sin^{m-1}x\cos x is 0 at both ends. So Im=m−1mIm−2I_m = \frac{m-1}{m}I_{m-2}. Since 0≤sin⁡x≤10 \le \sin x \le 1 on [0,π/2][0, \pi/2], the sequence (Im)(I_m) is non-increasing. By induction on mm, ImIm+1=π2(m+1)I_m I_{m+1} = \frac{\pi}{2(m+1)}: for m=0m = 0 the product is π/2\pi/2, and if it holds for mm, then Im+1Im+2=m+1m+2Im+1Im=π2(m+2)I_{m+1}I_{m+2} = \frac{m+1}{m+2}I_{m+1}I_m = \frac{\pi}{2(m+2)}.

For n≥1n \ge 1 the monotonicity gives I2n+1≤I2n≤I2n−1I_{2n+1} \le I_{2n} \le I_{2n-1}. Multiply by I2n>0I_{2n} > 0:

π2(2n+1)≤I2n2≤π4n.\frac{\pi}{2(2n+1)} \le I_{2n}^2 \le \frac{\pi}{4n}.

Multiply by 4n/π4n/\pi: the left side becomes 2n2n+1\frac{2n}{2n+1} and the right side becomes 1. Both tend to 1, so I2n2∼π4nI_{2n}^2 \sim \frac{\pi}{4n}, that is I2n∼12π/nI_{2n} \sim \frac12\sqrt{\pi/n}.

Step 6: the central binomial coefficient. The recurrence gives I2n=π2∏j=1n2j−12jI_{2n} = \frac\pi2\prod_{j=1}^{n}\frac{2j-1}{2j}. Now ∏j=1n(2j−1)=(2n)!2nn!\prod_{j=1}^n (2j-1) = \frac{(2n)!}{2^n n!} and ∏j=1n2j=2nn!\prod_{j=1}^n 2j = 2^n n!, so I2n=π2⋅(2n)!4n(n!)2=π2(2nn)4−nI_{2n} = \frac{\pi}{2}\cdot\frac{(2n)!}{4^n (n!)^2} = \frac\pi2\binom{2n}{n}4^{-n}. With Step 5,

(2nn)4−n=2πI2n∼2π⋅π2n=1πn.\binom{2n}{n}4^{-n} = \frac{2}{\pi}I_{2n} \sim \frac{2}{\pi}\cdot\frac{\sqrt\pi}{2\sqrt n} = \frac{1}{\sqrt{\pi n}}.

Step 7: the constant. By Step 4, n!∼Kn (n/e)nn! \sim K\sqrt n\,(n/e)^n. So (2n)!∼K2n (2n/e)2n(2n)! \sim K\sqrt{2n}\,(2n/e)^{2n} and (n!)2∼K2n (n/e)2n(n!)^2 \sim K^2 n\,(n/e)^{2n}. Dividing,

(2nn)∼K2n (2n)2nK2n n2n=2 4nKn.\binom{2n}{n} \sim \frac{K\sqrt{2n}\,(2n)^{2n}}{K^2 n\, n^{2n}} = \frac{\sqrt2\,4^n}{K\sqrt n}.

Compare with Step 6: 2Kn∼1πn\frac{\sqrt 2}{K\sqrt n} \sim \frac{1}{\sqrt{\pi n}}, so K=2πK = \sqrt{2\pi}. Then n!=2πn (n/e)nernn! = \sqrt{2\pi n}\,(n/e)^n e^{r_n} with 0<rn<112n0 < r_n < \frac1{12n}, and ern→1e^{r_n} \to 1. ■\blacksquare

Remark. The lower bound rn>112n+1r_n > \frac1{12n+1} needs a finer estimate of the series of Step 2. Robbins gives it in the paper cited on the page. The proof above gives the upper bound 112n\frac{1}{12n} and the positivity of rnr_n.

Back to Stirling's approximation