Lably
Skip to content

Stirling's approximation

Approximation for factorials

  • 8 min read
  • 8 chapters

Related on Lably

Through Mathematics, Factorial and Logarithm

One way of stating the approximation involves the logarithm of the factorial: ln⁡n!=nln⁡n−n+O(ln⁡n), where the big O notation means that, for all sufficiently large values of n, the difference between ln⁡n! and nln⁡n−n will be at most proportional to the logarithm of n. In computer science applications such as the worst-case lower bound for comparison sorting, it is convenient to instead use the binary logarithm, giving the equivalent form log2⁡n!=nlog2⁡n−nlog2⁡e+O(log2⁡n). The error term in either base can be expressed more precisely as 12log⁡(2πn)+O(1n), corresponding to an approximate formula for the factorial itself, n!∼2πn(ne)n. Here the sign ∼ means that the two quantities are asymptotic, that is, their ratio tends to 1 as n tends to infinity.

History

The formula was first discovered by Abraham de Moivre in 1721 in the form n!∼[constant]⋅nn+12e−n.

De Moivre gave an approximate rational-number expression for the natural logarithm of the constant. Stirling's contribution in 1730 consisted of showing that the constant is precisely 2π.

Sign in to keep reading

7 more chapters are free with a Lably account.

More in Functions