Stirling's approximation by the saddle-point method
D-019 stirling-saddle-point Home PU-205 Threads chance Depends on — verified
Statement
N! grows as NN e−N √(2πN), obtained by recognising that the integrand of the gamma function is overwhelmingly concentrated near its maximum.
Why it matters
Statistical mechanics is built on ln N! with N ~ 1023, so this is not an optional refinement. More importantly, the method — expand about the maximum, keep the quadratic term, do the Gaussian integral — is the same technique that later gives the WKB approximation, the classical limit of the path integral, and mean-field theory. Teaching it once, properly, pays four times.
Assumptions
Derivation
Result
Reading. In statistical mechanics only the logarithm is needed, and only the first two terms of it: the √(2πN) contributes ½ ln(2πN), which is of order ln N against terms of order N and is discarded without hesitation. But it must be derived before it can be discarded honestly.
Units check. N! and the argument x of the gamma integral are pure numbers, so every term — NN, e−N, √(2πN) — is dimensionless, as a count must be. The logarithm takes a dimensionless argument, as required.
Limiting cases
- Large N: relative error falls as 1/12N — the next term of the asymptotic series. At N = 100 the factorial is accurate to 0.083%.
- Keeping only the peak height gives ln N! ≈ N ln N − N, the form used throughout statistical mechanics; the √ term is a controlled correction.
- For the logarithm — the quantity actually used — the accuracy is far better than for the factorial itself.
Breaks when
- N is small. At N = 1 the approximation gives 0.922 against a true value of 1.
- The exponent has several comparable maxima — each must be summed, and interference between them is the physics of a first-order transition.
- The maximum lies at or near a boundary of the integration range, where the symmetric Gaussian extension is illegitimate.
Failure modes
- Using ln N! ≈ N ln N and dropping the −N. That term is the same order as the first and dropping it is a gross error, not a refinement.
- Keeping √(2πN) in a statistical-mechanics calculation where it is negligible, while elsewhere dropping terms of order N. Inconsistent truncation is worse than either choice made consistently.
- Applying the approximation to the small factorials that appear in combinatorial prefactors.
Worked number
At N = 10: exact 10! = 3,628,800; Stirling gives 3,598,696 — a relative error of 0.83%. At N = 5 the error is 1.7% (120 vs 118.02); at N = 100 it is 0.083% (9.333 × 10157 vs 9.325 × 10157). The error tracks 1/12N at each point.
The same saddle-point argument reappears as WKB (PU-401) and the classical limit of the path integral (PU-401/L07). What is a broad-but-narrow peak here becomes a stationary-phase point there; the Gaussian around it is the fluctuation determinant. Learn the bookkeeping once and the later derivations are the same moves in a different alphabet.
Discussion
The strength of Stirling's formula is that every symbol in it carries a separate physical meaning, and the saddle-point derivation hands each one to you in turn. The factor NNe−N is nothing but the height of the integrand at its peak, ef(N) with f(N) = N ln N − N. The factor √(2πN) is the width of that peak — the area under a Gaussian of curvature |f″(N)| = 1/N, so its width scales as √N. A factorial that spans hundreds of orders of magnitude is thus reconstructed from just two numbers: how tall the dominant term is, and how many terms of comparable size cluster around it.
This is why the result is structured as (peak height) × (peak width) and why the two pieces are treated so differently in practice. In statistical mechanics one works with ln N! for N ~ 1023, and there the split becomes a hierarchy: N ln N − N is of order 1023, while ½ ln(2πN) is of order 50. Keeping the width term in an entropy is like measuring the distance to the Moon and worrying about the thickness of a coat of paint. But — and this is the discipline the page insists on — you may only discard it after you have derived it and confirmed its size. Dropping the −N, by contrast, is not a refinement but a factor-of-eN catastrophe, because that term is the same order as the one you keep.
The deeper point is that this derivation is a template, not a one-off. It is Laplace's method: any integral of the form ∫eN g(x) dx, with a large parameter N multiplying a smooth function with a single interior maximum, is asymptotically √(2π/N|g″|) eN g(x0). Rotate the contour into the complex plane and the same argument becomes the saddle-point (steepest-descent) method, where the maximum is a saddle of the analytic integrand; that is the version that yields WKB, the semiclassical limit ℏ → 0 of the Feynman path integral (the classical path is the stationary point of the action), and the leading asymptotics of Bessel and Airy functions. The 1/12N correction quoted on the page is simply the next term of Watson's lemma — the contribution of the cubic and quartic pieces of f that we truncated at second order.
There is also a probabilistic reading that unifies the two examples below. The gamma integrand xNe−x, once normalised, is the probability density of a sum of N independent exponential waiting times; its mean is N and its variance is N, so by the central limit theorem it approaches a Gaussian of width √N centred on N — which is exactly what the quadratic expansion produces. Stirling's formula and the CLT are two faces of the same concentration-of-measure phenomenon, and the √(2πN) is the normalisation of that limiting Gaussian.
Common misconceptions.
- “Stirling says N! ≈ N ln N.” No — that confuses the formula for N! with the leading term of ln N!, and even then omits the essential −N.
- “The √(2πN) is negligible, so it never matters.” It is negligible inside a logarithm of order N. In a bare prefactor — the peak height of a binomial, a partition-function ratio — it is often the entire answer (Example 2).
- “Bigger N always means safe.” Not if the exponent develops a second comparable maximum (a first-order transition) or if the maximum sits at the boundary of the range, where only half the Gaussian lies inside and an extra factor of ½ appears (Problem 5).
- “Apply it everywhere factorials appear.” The small factorials in combinatorial prefactors (a 3! symmetry factor) must be evaluated exactly; Stirling is an asymptotic statement.
Worked examples
Example 1 — Entropy of a two-state paramagnet (the width term is rightly dropped). A crystal has N independent spins, each ↑ or ↓. Find the configurational entropy when a fraction x = 0.75 point up, for one mole of spins.
Answer. The configurational entropy at 75% alignment is 4.68 J K−1 mol−1 (compare the maximum R ln 2 = 5.76 J K−1 mol−1 at x = ½). Retaining the √(2πN) factors would have changed this by ~10−22 of its value — correctly discarded.
Example 2 — Peak of a binomial distribution (the width term is the whole answer). Toss a fair coin N = 104 times. What is the probability of exactly N/2 heads?
Answer. About 0.80%. This equals 1/(σ√(2π)) with standard deviation σ = √N/2 = 50 — the peak of the Gaussian that the binomial becomes. Had we used only N ln N − N we would have obtained the nonsense P = 1, since the leading terms cancel exactly. Here the √(2πN) is not a correction; it is the physics.
Problems
- (Warm-up.) Estimate ln(10!) using the three-term formula ln N! ≈ N ln N − N + ½ln(2πN) and compare with the exact value. What does the two-term formula alone give?
Solution
Exact: 10! = 3 628 800, so ln(10!) = 15.104. Two-term: 10 ln 10 − 10 = 23.026 − 10 = 13.026 — an error of 2.08, i.e. the missing ½ln(2πN). Three-term: add ½ln(2π·10) = ½ln(62.83) = ½(4.140) = 2.070, giving 15.096. The residual error is 15.104 − 15.096 = 0.008, in excellent agreement with the next asymptotic term 1/(12N) = 1/120 = 0.0083. - (Order of magnitude.) How many decimal digits does 100! have? Use log10(100!) = ln(100!)/ln 10.
Solution
ln(100!) ≈ 100 ln 100 − 100 + ½ln(200π) = 460.517 − 100 + ½ln(628.3) = 360.517 + 3.221 = 363.739. Divide by ln 10 = 2.302585: log10(100!) = 157.97. The number of digits is ⌊157.97⌋ + 1 = 158, which matches the exact 100! exactly. - (Testing the error law.) Predict the relative error of the leading Stirling formula N! ≈ NNe−N√(2πN) at N = 20, then verify against the exact 20! = 2.4329 × 1018.
Solution
The next term of the asymptotic series multiplies the formula by (1 + 1/(12N) + …), so the leading formula undershoots by about 1/(12·20) = 1/240 = 0.417%. Check: 2020 = 1.04858 × 1026, e−20 = 2.06115 × 10−9, √(40π) = 11.210. Product = 2.4225 × 1018. Relative error = (2.4329 − 2.4225)/2.4329 = 0.427% — as predicted. - (Entropy of mixing.) An ideal gas of N molecules, half of species A and half of species B, is arranged on N sites. Using Stirling, show that the mixing entropy is S = Nk ln 2 and evaluate it for one mole.
Solution
The number of arrangements is W = N!/((N/2)!)2. With the two-term formula, ln W = (N ln N − N) − 2(½N ln(½N) − ½N) = N ln N − N ln(N/2) = N ln 2. Hence S = k ln W = Nk ln 2. For one mole, S = R ln 2 = 8.314 × 0.6931 = 5.76 J K−1 mol−1. (This is the discrete-lattice route to the −Nk ∑ xi ln xi mixing entropy.) - (Method reuse — a boundary saddle.) Find the leading large-N asymptotics of I(N) = ∫0π eN cos θ dθ by Laplace's method. Explain why the answer carries a factor ½ relative to a naive interior-maximum estimate, and connect it to the modified Bessel function I0(N).
Solution
The exponent g(θ) = cos θ is maximal at θ = 0, which lies on the boundary of the range. Expand cos θ ≈ 1 − θ2/2, so g(0) = 1, g″(0) = −1. Then I(N) ≈ eN ∫0∞ e−Nθ2/2 dθ. Because the maximum sits at the endpoint, only half of the symmetric Gaussian lies inside the range, giving ½√(2π/N):I(N) ≈ eN · ½√(2π/N) = eN√(π/2N)An interior maximum would have kept the full Gaussian and doubled this — the ½ is precisely the “maximum at a boundary” caveat from the derivation's assumptions. Since I0(N) = (1/π)∫0π eN cos θ dθ, this reproduces the standard result I0(N) ≈ eN/√(2πN), the same saddle-point structure that gave Stirling.