## 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 22

new question: Prove that for any sets A, B, and C, An(BUC)=(AnB)U(AnC) by St_Louis

Apr 20

new image: information-theoretic-distributed-measurement-dds.png by rspuzio

new image: information-theoretic-distributed-measurement-4.2 by rspuzio

new image: information-theoretic-distributed-measurement-4.1 by rspuzio

new image: information-theoretic-distributed-measurement-3.2 by rspuzio

new image: information-theoretic-distributed-measurement-3.1 by rspuzio

new image: information-theoretic-distributed-measurement-2.1 by rspuzio

Apr 19

new collection: On the Information-Theoretic Structure of Distributed Measurements by rspuzio

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 question: Prove that for any sets A, B, and C, An(BUC)=(AnB)U(AnC) by St_Louis

Apr 20

new image: information-theoretic-distributed-measurement-dds.png by rspuzio

new image: information-theoretic-distributed-measurement-4.2 by rspuzio

new image: information-theoretic-distributed-measurement-4.1 by rspuzio

new image: information-theoretic-distributed-measurement-3.2 by rspuzio

new image: information-theoretic-distributed-measurement-3.1 by rspuzio

new image: information-theoretic-distributed-measurement-2.1 by rspuzio

Apr 19

new collection: On the Information-Theoretic Structure of Distributed Measurements by rspuzio

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