Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Stirling's approximation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Derivation == Roughly speaking, the simplest version of Stirling's formula can be quickly obtained by approximating the sum <math display=block>\ln(n!) = \sum_{j=1}^n \ln j</math> with an [[integral]]: <math display=block>\sum_{j=1}^n \ln j \approx \int_1^n \ln x \,{\rm d}x = n\ln n - n + 1.</math> The full formula, together with precise estimates of its error, can be derived as follows. Instead of approximating <math>n!</math>, one considers its [[natural logarithm]], as this is a [[slowly varying function]]: <math display=block>\ln(n!) = \ln 1 + \ln 2 + \cdots + \ln n.</math> The right-hand side of this equation minus <math display=block>\tfrac{1}{2}(\ln 1 + \ln n) = \tfrac{1}{2}\ln n</math> is the approximation by the [[trapezoid rule]] of the integral <math display=block>\ln(n!) - \tfrac{1}{2}\ln n \approx \int_1^n \ln x\,{\rm d}x = n \ln n - n + 1,</math> and the error in this approximation is given by the [[Euler–Maclaurin formula]]: <math display=block>\begin{align} \ln(n!) - \tfrac{1}{2}\ln n & = \tfrac{1}{2}\ln 1 + \ln 2 + \ln 3 + \cdots + \ln(n-1) + \tfrac{1}{2}\ln n\\ & = n \ln n - n + 1 + \sum_{k=2}^{m} \frac{(-1)^k B_k}{k(k-1)} \left( \frac{1}{n^{k-1}} - 1 \right) + R_{m,n}, \end{align}</math> where <math>B_k</math> is a [[Bernoulli number]], and {{math|''R''<sub>''m'',''n''</sub>}} is the remainder term in the Euler–Maclaurin formula. Take limits to find that <math display=block>\lim_{n \to \infty} \left( \ln(n!) - n \ln n + n - \tfrac{1}{2}\ln n \right) = 1 - \sum_{k=2}^{m} \frac{(-1)^k B_k}{k(k-1)} + \lim_{n \to \infty} R_{m,n}.</math> Denote this limit as <math>y</math>. Because the remainder {{math|''R''<sub>''m'',''n''</sub>}} in the Euler–Maclaurin formula satisfies <math display=block>R_{m,n} = \lim_{n \to \infty} R_{m,n} + O \left( \frac{1}{n^m} \right),</math> where [[big-O notation]] is used, combining the equations above yields the approximation formula in its logarithmic form: <math display=block>\ln(n!) = n \ln \left( \frac{n}{e} \right) + \tfrac{1}{2}\ln n + y + \sum_{k=2}^{m} \frac{(-1)^k B_k}{k(k-1)n^{k-1}} + O \left( \frac{1}{n^m} \right).</math> Taking the exponential of both sides and choosing any positive integer <math>m</math>, one obtains a formula involving an unknown quantity <math>e^y</math>. For {{math|''m'' {{=}} 1}}, the formula is <math display=block>n! = e^y \sqrt{n} \left( \frac{n}{e} \right)^n \left( 1 + O \left( \frac{1}{n} \right) \right).</math> The quantity <math>e^y</math> can be found by taking the limit on both sides as <math>n</math> tends to infinity and using [[Wallis product|Wallis' product]], which shows that <math>e^y=\sqrt{2\pi}</math>. Therefore, one obtains Stirling's formula: <math display=block>n! = \sqrt{2 \pi n} \left( \frac{n}{e} \right)^n \left( 1 + O \left( \frac{1}{n} \right) \right).</math>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)