# Stirling's approximation

**Stirling's approximation** is the asymptotic formula

\[ n! \sim \sqrt{2\pi n}\left(\frac{n}{e}\right)^{n} \]

which describes the growth of the factorial function \( n! \) for large \( n \). More precisely, it is the leading term of an asymptotic expansion of the gamma function, the analytic extension of the factorial, and the ratio of the two sides approaches 1 as \( n \) increases even though the approximation never equals \( n! \) exactly.<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup><sup> • </sup><sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

| Key fact | Detail |
|---|---|
| Leading formula | \( n! \sim \sqrt{2\pi n}\,(n/e)^{n} \); the relative error is approximately \( 1/(12n) \)<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> |
| First correction terms | \( \Gamma(z+1) = \sqrt{2\pi}\,z^{z+1/2}e^{-z}\left(1 + \frac{1}{12z} + \frac{1}{288z^{2}} - \frac{139}{51840z^{3}} - \frac{571}{2488320z^{4}} + \cdots\right) \)<sup>[3](https://www1.phys.vt.edu/~ersharpe/spec-fn/app-d.html)</sup><sup> • </sup><sup>[4](https://mathworld.wolfram.com/StirlingsSeries.html)</sup> |
| Rigorous two-sided bound | \( n! = \sqrt{2\pi}\,n^{n+1/2}e^{-n}e^{r_n} \) with \( \frac{1}{12n+1} < r_n < \frac{1}{12n} \) (Robbins, 1955)<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup> |
| Nature of the series | The full expansion is divergent but asymptotic: each partial sum improves accuracy up to an optimal number of terms<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> |
| First publication | James Stirling, *Methodus differentialis* (1730), example 2 of proposition 28, stated for the common logarithm of \( n! \)<sup>[6](https://hsm.stackexchange.com/questions/18672/when-and-how-did-stirlings-formula-become-adulterated)</sup><sup> • </sup><sup>[7](https://books.google.com/books?id=53PGRs2XglwC)</sup> |
| Standard derivation | Laplace's method (saddle-point approximation) applied to the gamma-function integral<sup>[8](https://personal.math.ubc.ca/~feldman/m321/asymptotic.pdf)</sup> |
| Typical use | Estimating binomial and multinomial coefficients, for example \( \binom{2n}{n} \sim 4^{n}/\sqrt{\pi n} \)<sup>[9](https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec05-06.pdf)</sup> |

## The formula and its accuracy

The approximation is accurate even for moderate \( n \). The relative error of the leading term is about \( 1/(12n) \), so it is already below one percent for \( n \) larger than roughly 8, and it decreases as \( n \) grows.<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> The MIT 18.310 notes observe that the implied formula is quite accurate even for \( n = 0 \) (interpreting \( 0^{0} \) as 1) and that the ratio of the formula to \( n! \) approaches 1 as \( n \) increases.<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

**A simple rigorous bound.** [Herbert Robbins](https://www.edgepedia.org/herbert-robbins), a mathematician at Columbia University, published a short elementary proof in *The American Mathematical Monthly* (1955) that gives the formula together with explicit error control. Writing

\[ n! = \sqrt{2\pi}\,n^{n+1/2}e^{-n}e^{r_n}, \]

he showed that the remainder satisfies the double inequality

\[ \frac{1}{12n+1} < r_n < \frac{1}{12n}. \]

His derivation partitions \( \log(p+1) \) into a curvilinear area, a triangle, and a small sliver under the curve \( y = \log x \), then bounds the sliver terms with the logarithmic series. The proof also determines the constant \( \sqrt{2\pi} \) from the convergence of two monotone sequences.<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup>

## The full asymptotic series

The leading formula is the first term of a longer expansion. In terms of the gamma function,

\[ \Gamma(z+1) = \sqrt{2\pi}\,z^{z+1/2}e^{-z}\left(1 + \frac{1}{12z} + \frac{1}{288z^{2}} + \mathcal{O}(z^{-3})\right), \]

with further coefficients \( -139/51840 \) at \( z^{-3} \) and \( -571/2488320 \) at \( z^{-4} \).<sup>[3](https://www1.phys.vt.edu/~ersharpe/spec-fn/app-d.html)</sup><sup> • </sup><sup>[4](https://mathworld.wolfram.com/StirlingsSeries.html)</sup> The NIST Digital Library of Mathematical Functions fixes the standard terminology: the expansion of \( \mathrm{Ln}\,\Gamma(z) \) in powers of \( 1/z \) with Bernoulli-number coefficients is called Stirling's series, while the expansion of \( \Gamma(z) \) itself, or sometimes just its leading term, is known as Stirling's formula.<sup>[10](https://dlmf.nist.gov/5.11)</sup>

The series is divergent but asymptotic: for fixed \( z \), adding terms eventually makes the approximation worse, yet truncating at the right place gives arbitrarily high accuracy for large \( z \).<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> The coefficients \( g_k \) in the DLMF normalization begin \( g_0 = 1 \), \( g_1 = 1/12 \), \( g_2 = 1/288 \), \( g_3 = -139/51840 \), \( g_4 = -571/2488320 \).<sup>[10](https://dlmf.nist.gov/5.11)</sup> Wrench (1968) computed exact values up to \( g_{20} \), and Spira (1971) corrected errors in those results and extended the table to \( g_{30} \).<sup>[10](https://dlmf.nist.gov/5.11)</sup>

**Error bounds.** For real positive \( z \), if the series is terminated at \( k = n-1 \), the remainder is bounded in magnitude by the first neglected term and has the same sign. For complex \( z \), the bound acquires a factor \( \sec^{2n}\!\left(\tfrac{1}{2}\mathrm{ph}\,z\right) \), so accuracy degrades away from the positive real axis.<sup>[10](https://dlmf.nist.gov/5.11)</sup>

## How it is derived

Stirling's formula may be generated by [Laplace's method](https://www.edgepedia.org/laplaces-method), one of the common ways of producing asymptotic expansions, applied to Euler's integral for the gamma function.<sup>[8](https://personal.math.ubc.ca/~feldman/m321/asymptotic.pdf)</sup> In this view the formula is the saddle-point approximation to the gamma-function integral: the integrand \( e^{N S(x)} \) is approximated by a Gaussian around the saddle point of \( S \), and the same technique generalizes to multi-dimensional and complex saddles.<sup>[11](https://unseel.com/mathematics/stirling-approximation)</sup> An elementary route exists as well: Robbins's 1955 proof uses only the logarithmic series and a geometric decomposition of areas under \( y = \log x \).<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup> R. B. Paris has shown that the expansion of the scaled gamma function \( \Gamma^{*}(x) \), with explicit remainder, follows from Lagrange's inversion theorem with a remainder, yielding a closed-form representation of the Stirling coefficients \( \gamma_n \).<sup>[12](https://arxiv.org/abs/1405.3423)</sup>

A rougher version, sufficient for counting arguments, writes \( n! = (n/e)^{n} \cdot W \) with \( W = (2\pi n + \pi/3)^{1/2}(1 + O(1/n)) \); when logarithms are taken, the factor \( W \) contributes nothing to the leading terms and can be ignored.<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

## Refinements

Several closed-form approximations improve on the leading Stirling term while keeping a similar simple shape. For \( \Gamma(w+1) \) with \( w \to \infty \), the MDPI survey lists Burnside's formula

\[ \Gamma(w+1) \sim \sqrt{2\pi w}\left(\frac{2w+1}{2e}\right)^{w+1/2}, \]

and two approximations it describes as more accurate than Burnside's: Ramanujan's refinement

\[ \Gamma(w+1) \sim \sqrt{\pi}\left(\frac{w}{e}\right)^{w}\sqrt[6]{8w^{3}+4w^{2}+w+\tfrac{1}{30}}, \]

which was recorded in *The lost notebook and other unpublished papers* as a conjecture of Ramanujan based on numerical calculations, and Gosper's formula

\[ \Gamma(w+1) \sim \sqrt{2\pi\left(w+\tfrac{1}{6}\right)}\left(\frac{w}{e}\right)^{w}. \]

Starting from Ramanujan's formula, Karatsuba derived further asymptotic results.<sup>[13](https://www.mdpi.com/2073-8994/14/11/2459)</sup>

## Applications

**Binomial and multinomial coefficients.** Applying the formula to \( (2n)! \) and \( n! \) twice gives the middle binomial coefficient

\[ \binom{2n}{n} \sim \frac{4^{n}}{\sqrt{\pi n}}, \]

whose \( 4^{n}/\sqrt{n} \) growth has a probabilistic interpretation in random-walk counting.<sup>[9](https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec05-06.pdf)</sup> The same substitution turns multinomial coefficients, which count the possible messages built from symbols at given frequencies, into tractable expressions; the base-2 logarithm of such a coefficient measures the number of bits needed to single out one message, the quantity underlying Shannon's entropy of information.<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

**Computation.** Because \( n! \) overflows floating-point arithmetic quickly, numerical libraries expose the log-gamma function \( \lgamma(x) \), the natural logarithm of \( |\Gamma(x)| \), standardized in C11 and POSIX.1-2008, which is the form in which Stirling-type expansions are typically evaluated in software.<sup>[14](https://man7.org/linux/man-pages/man3/lgamma.3.html)</sup>

## History

James Stirling, F.R.S., of Balliol College, Oxford, published *Methodus differentialis: sive tractatus de summatione et interpolatione serierum infinitarum* in 1730.<sup>[7](https://books.google.com/books?id=53PGRs2XglwC)</sup> In example 2 of proposition 28 of that work he states the common logarithm of \( n! \) in the form now associated with his name; the modern familiar version with the \( \sqrt{2\pi n} \) factor emerged later, a development traced in histories of the formula.<sup>[6](https://hsm.stackexchange.com/questions/18672/when-and-how-did-stirlings-formula-become-adulterated)</sup>

## References

1. [7.4 Stirling's Formula, Topics in Mathematical Methods](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)
2. [5.3 Stirling's Formula and Approximations for Multinomial Coefficients, MIT 18.310 lecture notes](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)
3. [Appendix D: Asymptotic Series for the Gamma Function, Virginia Tech](https://www1.phys.vt.edu/~ersharpe/spec-fn/app-d.html)
4. [Stirling's Series, Wolfram MathWorld](https://mathworld.wolfram.com/StirlingsSeries.html)
5. [Herbert Robbins (1955). A Remark on Stirling's Formula. The American Mathematical Monthly 62(1), 26–29.](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)
6. [When and how did Stirling's formula become adulterated?, History of Science and Mathematics Stack Exchange](https://hsm.stackexchange.com/questions/18672/when-and-how-did-stirlings-formula-become-adulterated)
7. [James Stirling (1730). Methodus differentialis, Google Books digitization](https://books.google.com/books?id=53PGRs2XglwC)
8. [Asymptotic expansions, UBC M321 notes (R. Feldman)](https://personal.math.ubc.ca/~feldman/m321/asymptotic.pdf)
9. [MIT 18.200, Lecture 05–06: Counting (Spring 2024)](https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec05-06.pdf)
10. [DLMF §5.11 Asymptotic Expansions, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/5.11)
11. [Stirling's Approximation, Unseel mathematics reference](https://unseel.com/mathematics/stirling-approximation)
12. [R. B. Paris (2011). On the asymptotic expansion of Γ(x), Lagrange's inversion theorem and the Stirling coefficients. arXiv:1405.3423.](https://arxiv.org/abs/1405.3423)
13. [On Some Asymptotic Expansions for the Gamma Function, Symmetry 14(11):2459 (MDPI, 2022)](https://www.mdpi.com/2073-8994/14/11/2459)
14. [lgamma(3) Linux manual page](https://man7.org/linux/man-pages/man3/lgamma.3.html)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Logic and discrete mathematics › General discrete mathematics and discrete structures › Combinatorics › Algebraic and analytic combinatorics › Asymptotic analysis of combinatorial structures*

*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
