In mathematics, Stirling's approximation (or Stirling's formula) is an approximation for large factorials. It is named after James Stirling.
The formula as typically used in applications is
The next term in the O(log(n)) is ^{1}⁄_{2}ln(2πn); a more precise variant of the formula is therefore
often written
Contents
Derivation
The formula, together with precise estimates of its error, can be derived as follows. Instead of approximating n!, one considers its natural logarithm:
The righthand side of this equation is (almost) the approximation by the trapezoid rule of the integral and the error in this approximation is given by the Euler–Maclaurin formula:
where B_{k} is a Bernoulli number and R_{m,n} is the remainder term in the Euler–Maclaurin formula. Take limits to find that
Denote this limit by y. Because the remainder R_{m,n} in the Euler–Maclaurin formula satisfies
where we use BigO 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 e^{y}. For m=1, the formula is
The quantity e^{y} can be found by taking the limit on both sides as n tends to infinity and using Wallis' product, which shows that . Therefore, we get Stirling's formula:
The formula may also be obtained by repeated integration by parts, and the leading term can be found through Laplace's method. 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
Full article ▸
