Quant Memo
Core

Stirling's Approximation

A simple formula for estimating n! without multiplying out every term — indispensable whenever combinatorics or probability calculations involve factorials of large numbers.

Factorials grow so fast that computing n!n! directly for anything beyond small nn is impractical by hand, yet factorials show up constantly in combinatorics and probability — counting arrangements, computing binomial coefficients, evaluating tail probabilities. Stirling's approximation gives a closed-form estimate of n!n! that's accurate enough for essentially all practical purposes, without multiplying nn terms together.

The formula states n!2πn(ne)nn! \approx \sqrt{2\pi n} \left(\dfrac{n}{e}\right)^n, where ee is Euler's number. In words: n!n! behaves, for large nn, like a large exponential term (n/e)n(n/e)^n scaled by a comparatively gentle square-root correction factor 2πn\sqrt{2\pi n}. The exponential term dominates the size of the answer; the square-root term refines it.

For n=10n = 10: the true value is 10!=3,628,80010! = 3{,}628{,}800. Stirling's estimate gives 2π×10×(10/e)107.927×(3.6788)103,598,696\sqrt{2\pi \times 10} \times (10/e)^{10} \approx 7.927 \times (3.6788)^{10} \approx 3{,}598{,}696 — within about 0.8% of the exact answer, and the relative error shrinks further as nn grows.

A common working shortcut in mental-math or interview settings is the simpler bound ln(n!)nlnnn\ln(n!) \approx n\ln n - n, dropping the square-root correction entirely — useful for quickly estimating the order of magnitude or the log of a factorial (as needed, for example, in Stirling-based approximations to binomial coefficients) when a rough answer is all that's required.

Stirling's approximation, n!2πn(n/e)nn! \approx \sqrt{2\pi n}\,(n/e)^n, replaces an unwieldy product of nn terms with a closed-form estimate accurate to well under 1% error even for moderate nn, making it the standard tool for handling factorials in combinatorics and probability by hand.

Related concepts

Practice in interviews

Further reading

  • Feller, An Introduction to Probability Theory and Its Applications, vol. 1
ShareTwitterLinkedIn