# Stirling's Log-Factorial Approximation

## Motivation:

In a statistical physics course, I often encountered the following approximation due to Stirling:

It was very useful but my professor didn’t explain how good the approximation was. The derivation I found turn out to be very simple and so I can present it in a few lines here.

## Derivation:

If we define

we have an upper-Riemann sum with . So we basically have the following approximation:

Now, by the intermediate-value theorem

## Analysis:

We may easily check how good this approximation is by bounding the error-term:

This error grows very slowly. In fact, if i.e. the number of molecules in an glass of water, which is a minuscule error relative to the number of molecules.