Stirling’s Approximation

Brad Roth
2 min readMar 8, 2024
Stirling’s Approximation

I’ve always been fascinated by Stirling’s approximation,

ln(n!) = n ln(n) − n,

where n! is the factorial. Russ Hobbie and I mention Stirling’s approximation in Appendix I of Intermediate Physics for Medicine and Biology. In the homework problems for that appendix (yes, does has homework problems in its appendices), a more accurate version of Stirling’s approximation is given as

ln(n!) = n ln(n) − n + ½ ln(2π n) .

There is one thing that’s always bothered me about Stirling’s approximation: it’s for the logarithm of the factorial, not the factorial itself. So today, I’ll derive an approximation for the factorial.

The first step is easy; just apply the exponential function to the entire expression. Because the exponential is the inverse of the natural logarithm, you get

n! = e^[n ln(n) − n + ½ ln(2π n)]

Now, we just use some properties of exponents

n! = e^n ln(n) e^−n e^½ln(2π n)

n! = (eln(n))^n e^−n √(e^ln(2π n))

n! = n^n e^−n √(2π n)

And there we have it. It’s a strange formula, with a really huge factor ( n^n) multiplied by a tiny factor (e^−n) times a plain old modestly sized factor (√(2π n)). It contains both e = 2.7183 and π = 3.1416.

Let’s see how it works.

For the last entry (n = 100), my calculator couldn’t calculate 100¹⁰⁰ or 100!. To get the first one I wrote

100^100 = (10^2)^100 = 10^(2 × 100) = 10^200.

The calculator was able to compute e^−100= 3.7201 × 10^−44, and of course the square root of 200π was not a problem. To obtain the actual value of 100!, I just asked Google.

Why in the world does anyone need a way to calculate such big factorials? Russ and I use them in Chapter 3 about statistical dynamics. There you have to count the number of states, which often requires using factorials. The beauty of statistical mechanics is that you usually apply it to macroscopic systems with a large number of particles. And by large, I mean something like Avogadro’s number of particles (6 × 10 23). The interesting thing is that in statistical mechanics you often need not the factorial, but the logarithm of the factorial, so Stirling’s approximation is exactly what you want. But it’s good to know that you can also approximate the factorial itself.

Finally, one last fact from Mr. Google. 1,000,000! = 8.2639 × 10^5,565,708. Wow!

Originally published at



Brad Roth

Professor of Physics at Oakland University and coauthor of the textbook Intermediate Physics for Medicine and Biology.