All Topics  
Stirling's approximation

 

   Email Print
   Bookmark   Link

 

Stirling's approximation


 
 


In mathematicsMathematics

Mathematics is the discipline that deals with concepts such as quantity, structure, space and change....
, Stirling's approximation (or Stirling's formula) is an approximation for large factorialFactorial

In mathematics, the factorial of a natural number n is the product of all positive integers less than or equal to n...
s. It is named in honour of James StirlingJames Stirling (mathematician)

James Stirling was an important Scottish mathematician....
.

The formula is written as

Roughly, this means that these quantities approximate each other for all sufficiently large integers n. More precisely, Stirling's formula says that

or

Derivation

The formula, together with precise estimates of its error, can be derived as follows. Instead of approximating n!, one considers its natural logarithmNatural logarithm

The natural logarithm, formerly known as the hyperbolic logarithm, is the logarithm to the base e, where e is equal ...
:

The right-hand side of this equation is (almost) the approximation of the integral using the trapezoid rule,
and the error in this approximation is given by the Euler–Maclaurin formula:

where Bk is Bernoulli numberBernoulli number

In mathematics, the Bernoulli numbers are a sequence of rational numbers with deep connections in number theory....
 and Rm,n is the remainder term in the Euler–Maclaurin formula.
Take limits to find that

Denote this limit by y. Because the remainder Rm,n in the Euler–Maclaurin formula satisfies

where we use Big-O notation, combining the equations above yields the approximation formula in its logarithmic form:

Taking the exponential of both sides, and choosing any positive integer m, we get a formula involving an unknown quantity ey.
For m=1, the formula is

The quantity ey can be found by taking the limit on both sides as n tends to infinity and using Wallis' productFacts About Wallis product

In mathematics, Wallis' product for π, written down in 1655 by John Wallis, states that...
,
which shows that . Therefore, we get Stirling's formula:

The formula may also be obtained by repeated integration by partsIntegration by parts

In calculus, and more generally in mathematical analysis, integration by parts is a rule that transforms the integral of pro...
, and the leading term can be found through the method of steepest descentMethod of steepest descent

In mathematics, the steepest descent method or saddle-point approximation is a method used to approximate integrals of...
.
Stirling's formula, without the factor that is often irrelevant in applications, can be quickly obtained by approximating the sum

with an integral:

Speed of convergence and error estimates


More precisely,

with

Stirling's formula is in fact the first approximation to the following series (now called the Stirling series):

As , the error in the truncated series is asymptotically equal to the first omitted term. This is an example of an asymptotic expansionAsymptotic expansion

In mathematics an asymptotic expansion, asymptotic series or Poincar expansion is a formal series of functions w...
. It is not a convergent seriesConvergent series

In mathematics, a series is the sum of the terms of a sequence of numbers....
; for any particular value of n there are only so many terms of the series that improve accuracy, after which point accuracy actually gets worse. Let be the Stirling series to terms evaluated at . The graph shows , which, when small, is essentially the relative error.

The asymptotic expansion of the logarithm is also called Stirling's series:

In this case, it is known that the error in truncating the series is always of the same sign and at most the same magnitude as the first omitted term.

Stirling's formula for the Gamma function

For all positive integers,

However, the Gamma functionGamma function

In mathematics, the Gamma function extends the factorial function to complex and non-integer numbers ....
, unlike the factorial, is more broadly defined for all complex numbers other than non-positive integers; nevertheless, Stirling's formula may still be applied. If then

Repeated integration by parts gives the asymptotic expansion

where Bn is the nth Bernoulli numberBernoulli number

In mathematics, the Bernoulli numbers are a sequence of rational numbers with deep connections in number theory....
. The formula is valid for z large enough in absolute value when , where e is positive, with an error term of
when the first m terms are used. The corresponding approximation may now be written:

A convergent version of Stirling's formula

Thomas BayesThomas Bayes

Thomas Bayes was a British mathematician and Presbyterian minister, known for having formulated a special case of Bayes' the...
 showed, in a letter to John CantonJohn Canton

John Canton was an English physicist....
 published by the Royal SocietyRoyal Society

The Royal Society of London for the Improvement of Natural Knowledge, known simply as the Royal Society, was founded i...
 in 1763, that Stirling's formula did not give a convergent seriesConvergent series

In mathematics, a series is the sum of the terms of a sequence of numbers....
.

Obtaining a convergent version of Stirling's formula entails evaluating

One way to do this is by means of a convergent series of inverted rising exponentialsPochhammer symbol

In mathematics, the Pochhammer symbol...
. If , then

where

From this we obtain a version of Stirling's series

which converges when .

A version suitable for calculators

The approximation

or equivalently,

can be obtained by rearranging Stirling's extended formula and observing a coincidence between the resultant power series and the Taylor seriesTaylor series

In mathematics, the Taylor series of an infinitely differentiable real function f, defined on an open interval , is the...
 expansion of the hyperbolic sine function. This approximation is good to more than 8 decimal digits for z with a real part greater than 8. Robert H. Windschitl suggested it in 2002 for computing the Gamma function with fair accuracy on calculators with limited program or register memory (see ref. 'Toth').

Gergo Nemes proposed in 2007 an approximation which gives the same number of exact digits as the Windschitl approximation but is much simpler:

or equivalently,

History

The formula was first discovered by Abraham de MoivreAbraham de Moivre

Abraham de Moivre was a French mathematician famous for de Moivre's formula, which links complex numbers and trigonomet...
 in the form
Stirling's contribution consisted of showing that the constant
is . The more precise versions are due to
Jacques Binet.

See also

  • Lanczos approximationLanczos approximation

    In mathematics, the Lanczos approximation is a method for computing the Gamma function numerically, published by Cornelius L...
  • Spouge's approximationSpouge's approximation

    In mathematics, Spouge's approximation is a formula for the gamma function due to John L....