= Gaussian peak behind Stirling's formula
{c}
{title2=$t=n+\sqrt n\,s,\quad t^ne^{-t}/(n^ne^{-n})\to e^{-s^2/2}$}
Repeated <integration by parts> gives the <Gamma integral>
$$
n!=\int_0^\infty t^n e^{-t}\,dt.
$$
The logarithm of its integrand is $n\log t-t$, whose unique maximum is at $t=n$. Write $t=n+\sqrt n\,s$. For fixed $s$ and large $n$, a <Taylor expansion> gives
$$
n\log\left(1+\frac{s}{\sqrt n}\right)-s\sqrt n
=-\frac{s^2}{2}+\frac{s^3}{3\sqrt n}+O(n^{-1}).
$$
The <Big O notation> here is for a fixed $s$, or uniformly for $s$ in a fixed bounded interval. It does not claim a uniform approximation over the entire growing integration domain. Consequently the peak, divided by its height, approaches $e^{-s^2/2}$.
\Image[/stirling-gamma-gaussian-peak.png]
{title=The peak of a factorial integral approaches a Gaussian after recentering and rescaling}
{description=The plotted functions are $K_n(s)=\exp(n\log(1+s/\sqrt n)-s\sqrt n)$ for $s>-\sqrt n$, with zero outside their domains. Each has peak height one. They are rescaled integrands, not normalized <probability density functions>.}
The exact substitution gives
$$
n!=n^n e^{-n}\sqrt n\int_{-\sqrt n}^{\infty}
\exp\left(n\log\left(1+\frac{s}{\sqrt n}\right)-s\sqrt n\right)\,ds.
$$
Replacing the integral by the <Gaussian integral> $\int_{\mathbb R}e^{-s^2/2}\,ds=\sqrt{2\pi}$ produces $S_n$. Thus the estimate is peak height $n^ne^{-n}$ times width $\sqrt n$ times the area of a standard Gaussian peak. This is <Laplace's method> in a concrete form; controlling the integral's tails justifies the replacement. The next terms, including their products after exponentiation, produce the <Stirling correction by Gaussian moments>.
Back to article page