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 directly for anything beyond small 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 that's accurate enough for essentially all practical purposes, without multiplying terms together.
The formula states , where is Euler's number. In words: behaves, for large , like a large exponential term scaled by a comparatively gentle square-root correction factor . The exponential term dominates the size of the answer; the square-root term refines it.
For : the true value is . Stirling's estimate gives — within about 0.8% of the exact answer, and the relative error shrinks further as grows.
A common working shortcut in mental-math or interview settings is the simpler bound , 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, , replaces an unwieldy product of terms with a closed-form estimate accurate to well under 1% error even for moderate , 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