# 斯特林近似

**斯特林近似**（Stirling's approximation）是渐近公式

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

它描述阶乘函数 \( n! \) 在 \( n \) 很大时的增长。更确切地说，它是伽马函数——阶乘的解析延拓——渐近展开的首项，并且随着 \( n \) 增大，公式两边的比值趋于 1，尽管该近似从不精确等于 \( n! \)。<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>

| 关键事实 | 详情 |
|---|---|
| 首项公式 | \( n! \sim \sqrt{2\pi n}\,(n/e)^{n} \)；相对误差约为 \( 1/(12n) \)<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> |
| 首批修正项 | \( \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> |
| 严格的双侧界 | \( n! = \sqrt{2\pi}\,n^{n+1/2}e^{-n}e^{r_n} \)，其中 \( \frac{1}{12n+1} < r_n < \frac{1}{12n} \)（罗宾斯，1955）<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup> |
| 级数的性质 | 完整展开是发散的但为渐近的：每个部分和在达到最优项数之前都能提高精度<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> |
| 首次发表 | 詹姆斯·斯特林（James Stirling），《微分方法》（1730），命题28的例2，以 \( 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> |
| 标准推导 | 对伽马函数积分应用拉普拉斯方法（鞍点近似）<sup>[8](https://personal.math.ubc.ca/~feldman/m321/asymptotic.pdf)</sup> |
| 典型用途 | 估计二项式系数和多项式系数，例如 \( \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> |

## 公式及其精度

该近似即使对中等大小的 \( n \) 也相当精确。首项相对误差约为 \( 1/(12n) \)，因此当 \( n \) 大约大于 8 时误差已低于百分之一，并随 \( n \) 增大而减小。<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> MIT 18.310 讲义指出，即使对 \( n = 0 \)（将 \( 0^{0} \) 解释为 1），该公式也相当精确，且公式与 \( n! \) 的比值随 \( n \) 增大趋于 1。<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

**一个简单的严格界。** 哥伦比亚大学（Columbia University）数学家赫伯特·罗宾斯（Herbert Robbins）在《美国数学月刊》（1955）上发表了一个简短的初等证明，给出了该公式及显式误差控制。他将其写为

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

并证明余项满足双重不等式

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

他的推导将 \( \log(p+1) \) 分解为曲线面积、一个三角形以及曲线 \( y = \log x \) 下方的一小条，然后用对数级数对这些小条项进行估计。该证明还从两个单调序列的收敛性确定了常数 \( \sqrt{2\pi} \)。<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup>

## 完整的渐近级数

首项公式是更长展开的第一项。用伽马函数表示，

\[ \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), \]

其中 \( z^{-3} \) 处的进一步系数为 \( -139/51840 \)，\( z^{-4} \) 处为 \( -571/2488320 \)。<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> NIST数学函数数字图书馆确定了标准术语：将 \( \mathrm{Ln}\,\Gamma(z) \) 按 \( 1/z \) 的幂展开、系数为伯努利数的级数称为斯特林级数，而 \( \Gamma(z) \) 本身的展开（有时仅指其首项）称为斯特林公式。<sup>[10](https://dlmf.nist.gov/5.11)</sup>

该级数是发散的但为渐近的：对固定的 \( z \)，不断添加项最终会使近似变差，但在恰当处截断则对大的 \( z \) 能给出任意高的精度。<sup>[1](https://wjmaths.com/courses/topics-in-mathematical-methods/build/topics_math_methodsse46.html)</sup> DLMF归一化中的系数 \( g_k \) 开头为 \( 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）计算了直到 \( g_{20} \) 的精确值，斯皮拉（Spira，1971）修正了其中的错误并将表扩展到 \( g_{30} \)。<sup>[10](https://dlmf.nist.gov/5.11)</sup>

**误差界。** 对实正数 \( z \)，若级数截断于 \( k = n-1 \)，则余项的绝对值不超过第一个被忽略的项的绝对值，且两者符号相同。对复数 \( z \)，该界会多出一个因子 \( \sec^{2n}\!\left(\tfrac{1}{2}\mathrm{ph}\,z\right) \)，因此精度在远离正实轴处会下降。<sup>[10](https://dlmf.nist.gov/5.11)</sup>

## 如何推导

将拉普拉斯方法应用于伽马函数的欧拉积分，即可得到斯特林公式；这是产生渐近展开的常用方法之一。<sup>[8](https://personal.math.ubc.ca/~feldman/m321/asymptotic.pdf)</sup> 在这种观点下，该公式是伽马函数积分的鞍点近似：被积函数 \( e^{N S(x)} \) 在 \( S \) 的鞍点附近用高斯函数近似，同样的技术可推广到多维和复鞍点。<sup>[11](https://unseel.com/mathematics/stirling-approximation)</sup> 也存在初等的途径：罗宾斯1955年的证明只使用对数级数和 \( y = \log x \) 下方面积的几何分解。<sup>[5](https://dornsife.usc.edu/sergey-lototsky/wp-content/uploads/sites/211/2024/02/Stirling-Robbins.pdf)</sup> R. B. 帕里斯（R. B. Paris）证明了缩放伽马函数 \( \Gamma^{*}(x) \) 的带显式余项的展开可由带余项的拉格朗日反演定理推出，从而得到斯特林系数 \( \gamma_n \) 的闭式表示。<sup>[12](https://arxiv.org/abs/1405.3423)</sup>

一个更粗糙的版本足以用于计数论证：写作 \( n! = (n/e)^{n} \cdot W \)，其中 \( W = (2\pi n + \pi/3)^{1/2}(1 + O(1/n)) \)；取对数时，因子 \( W \) 对首项没有贡献，可以忽略。<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

## 改进

若干闭式近似在保持类似简单形式的同时改进了斯特林首项。对于 \( w \to \infty \) 时的 \( \Gamma(w+1) \)，MDPI的综述列出了伯恩赛德公式

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

以及两个被其描述为比伯恩赛德公式更精确的近似：拉马努金改进

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

该式记录于《失落的笔记本及其他未发表论文》中，是拉马努金基于数值计算提出的猜想；以及高斯珀公式

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

从拉马努金公式出发，卡拉楚巴（Karatsuba）推导了进一步的渐近结果。<sup>[13](https://www.mdpi.com/2073-8994/14/11/2459)</sup>

## 应用

**二项式系数和多项式系数。** 将该公式应用于 \( (2n)! \) 和两次 \( n! \) 得到中间二项式系数

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

其 \( 4^{n}/\sqrt{n} \) 的增长在随机游走计数中有概率解释。<sup>[9](https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec05-06.pdf)</sup> 同样的代换将多项式系数——计数由给定频率的符号构成的可能消息——转化为易于处理的表达式；此类系数的以2为底的对数度量了挑出一条消息所需的比特数，这正是香农信息熵的基础量。<sup>[2](https://math.mit.edu/~djk/18.310/Lecture-Notes/coding_for_efficiency.html)</sup>

**计算。** 由于 \( n! \) 很快会使浮点运算溢出，数值库提供对数伽马函数 \( \lgamma(x) \)，即 \( |\Gamma(x)| \) 的自然对数，已在C11和POSIX.1-2008中标准化，软件中通常以这种形式计算斯特林型展开。<sup>[14](https://man7.org/linux/man-pages/man3/lgamma.3.html)</sup>

## 历史

牛津大学贝利奥尔学院（Balliol College, Oxford）的詹姆斯·斯特林，皇家学会会员，于1730年出版了《微分方法：或论无穷级数的求和与插值》。<sup>[7](https://books.google.com/books?id=53PGRs2XglwC)</sup> 在该书命题28的例2中，他以如今与他名字相联系的形式陈述了 \( n! \) 的常用对数；带有 \( \sqrt{2\pi n} \) 因子的现代常见版本出现得更晚，这一发展在公式的历史中有迹可循。<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)

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

Topic: 物质世界与数学 › 数学与统计学 › 逻辑与离散数学 › General discrete mathematics and discrete structures › Combinatorics › Algebraic and analytic combinatorics › Asymptotic analysis of combinatorial structures

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/stirlings-approximation

English original: https://www.edgepedia.org/stirlings-approximation
