Stirling's Approximation

On a log scale, n!n! and the Stirling approximation nearly coincide, and the relative error shrinks like 112n\frac{1}{12n}. Where π\pi enters is only sketched at the idea level.

n!≈2πn(ne)nn!\approx\sqrt{2\pi n}\left(\frac{n}{e}\right)^n

Examples & Exercises

Compute the relative error of Stirling's formula at n=10n = 10 and compare with 1120\frac{1}{120}. (A numerical check, not a proof.)

∣S(10)−10!∣10!≈0.008296≈1120\frac{|S(10)-10!|}{10!} \approx 0.008296 \approx \frac{1}{120}
n=10n = 10: the two curves overlap on the log scale.
Show proof
  1. 10!=362880010! = 3628800. S(10)=20π(10e)10≈3598695.62S(10) = \sqrt{20\pi}\left(\frac{10}{e}\right)^{10} \approx 3598695.62.
  2. The relative error =3628800−3598695.623628800≈0.008296= \frac{3628800-3598695.62}{3628800} \approx 0.008296.
  3. 112⋅10=1120≈0.008333\frac{1}{12\cdot 10} = \frac{1}{120} \approx 0.008333 — matching the claim. (This is a numerical check, not a proof of the error formula.)

Explain the picture comparing ln⁡(n!)=∑k=1nln⁡k\ln(n!) = \sum_{k=1}^{n}\ln k with ∫1nln⁡x dx\int_1^n \ln x\,dx. (Idea level.)

∑k=1nln⁡k≈∫1nln⁡x dx=nln⁡n−n+1\sum_{k=1}^{n}\ln k \approx \int_1^n \ln x\,dx = n\ln n - n + 1
The sum of the bars and the area under the curve are close.
Show proof
  1. ln⁡(n!)=∑k=1nln⁡k\ln(n!) = \sum_{k=1}^{n}\ln k is the total area of bars under the graph of y=ln⁡xy = \ln x.
  2. The integral ∫1nln⁡x dx=nln⁡n−n+1\int_1^n \ln x\,dx = n\ln n - n + 1 is the area under the curve — close to the bar sum.
  3. The gap grows like 12ln⁡(2πn)\frac{1}{2}\ln(2\pi n), and that correction produces the 2πn\sqrt{2\pi n}. The rigorous derivation is omitted — idea level.

Assuming Stirling's formula, derive (2nn)∼4nπn\binom{2n}{n} \sim \frac{4^n}{\sqrt{\pi n}}.

(2nn)=(2n)!(n!)2∼4πn (2n/e)2n2πn (n/e)2n=4nπn\binom{2n}{n} = \frac{(2n)!}{(n!)^2} \sim \frac{\sqrt{4\pi n}\,(2n/e)^{2n}}{2\pi n\,(n/e)^{2n}} = \frac{4^n}{\sqrt{\pi n}}
The central binomial coefficient is smaller than 4n4^n by πn\sqrt{\pi n}.
Show proof
  1. Stirling in the numerator: (2n)!≈4πn(2ne)2n(2n)! \approx \sqrt{4\pi n}\left(\frac{2n}{e}\right)^{2n}.
  2. Denominator: (n!)2≈2πn(ne)2n(n!)^2 \approx 2\pi n\left(\frac{n}{e}\right)^{2n}.
  3. Dividing gives 4πn2πn⋅(2n)2nn2n=1πn⋅4n\frac{\sqrt{4\pi n}}{2\pi n}\cdot\frac{(2n)^{2n}}{n^{2n}} = \frac{1}{\sqrt{\pi n}}\cdot 4^n. (Stirling's formula itself is assumed.)

6. Series