## You are here

HomeStirling's approximation

## Primary tabs

# Stirling’s approximation

Stirling’s formula gives an approximation for $n!$, the factorial function. It is

$n!\approx\sqrt{2n\pi}n^{n}e^{{-n}}$ |

We can derive this from the gamma function. Note that for large $x$,

$\Gamma(x)=\sqrt{2\pi}x^{{x-\frac{1}{2}}}e^{{-x+\mu(x)}}$ | (1) |

where

$\mu(x)=\sum_{{n=0}}^{\infty}\left(x+n+\frac{1}{2}\right)\ln\left(1+\frac{1}{x+% n}\right)-1=\frac{\theta}{12x}$ |

with $0<\theta<1$. Taking $x=n$ and multiplying by $n$, we have

$n!=\sqrt{2\pi}n^{{n+\frac{1}{2}}}e^{{-n+\frac{\theta}{12n}}}$ | (2) |

Taking the approximation for large $n$ gives us Stirling’s formula.

There is also a big-O notation version of Stirling’s approximation:

$n!=\left(\sqrt{2\pi n}\right)\left(\frac{n}{e}\right)^{n}\left(1+\mathcal{O}% \left(\frac{1}{n}\right)\right)$ | (3) |

We can prove this equality starting from (2). It is clear that the big-O portion of (3) must come from $e^{{\frac{\theta}{12n}}}$, so we must consider the asymptotic behavior of $e$.

First we observe that the Taylor series for $e^{x}$ is

$e^{x}=1+\frac{x}{1}+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\cdots$ |

But in our case we have $e$ to a vanishing exponent. Note that if we vary $x$ as $\frac{1}{n}$, we have as $n\longrightarrow\infty$

$e^{x}=1+\mathcal{O}\left(\frac{1}{n}\right)$ |

Related:

MinkowskisConstant, AsymptoticBoundsForFactorial

Synonym:

Stirling's formula, Stirling's approximation formula

Type of Math Object:

Theorem

Major Section:

Reference

Groups audience:

## Mathematics Subject Classification

68Q25*no label found*30E15

*no label found*41A60

*no label found*

- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)

- Other useful stuff

## Recent Activity

Apr 15

new question: Prove a formula is part of the Gentzen System by LadyAnne

Mar 30

new question: A problem about Euler's totient function by mbhatia

new problem: Problem: Show that phi(a^n-1), (where phi is the Euler totient function), is divisible by n for any natural number n and any natural number a >1. by mbhatia

new problem: MSC browser just displays "No articles found. Up to ." by jaimeglz

Mar 26

new correction: Misspelled name by DavidSteinsaltz

Mar 21

new correction: underline-typo by Filipe

Mar 19

new correction: cocycle pro cocyle by pahio

Mar 7

new image: plot W(t) = P(waiting time <= t) (2nd attempt) by robert_dodier

new image: expected waiting time by robert_dodier

new image: plot W(t) = P(waiting time <= t) by robert_dodier

new question: Prove a formula is part of the Gentzen System by LadyAnne

Mar 30

new question: A problem about Euler's totient function by mbhatia

new problem: Problem: Show that phi(a^n-1), (where phi is the Euler totient function), is divisible by n for any natural number n and any natural number a >1. by mbhatia

new problem: MSC browser just displays "No articles found. Up to ." by jaimeglz

Mar 26

new correction: Misspelled name by DavidSteinsaltz

Mar 21

new correction: underline-typo by Filipe

Mar 19

new correction: cocycle pro cocyle by pahio

Mar 7

new image: plot W(t) = P(waiting time <= t) (2nd attempt) by robert_dodier

new image: expected waiting time by robert_dodier

new image: plot W(t) = P(waiting time <= t) by robert_dodier