# How best to explain the $\sqrt{2\pi n}$ term in Stirling's?

I recently showed my Algorithms class how to bound $\ln n! = \sum \ln n$ by integrals, thereby obtaining the simple factorial approximation

$$e \left(\frac{n}{e}\right)^{n} \leq n! \leq en\left(\frac{n}{e}\right)^{n}$$

But one student, having seen Stirling's approximation, asked where the $\sqrt{2 \pi n}$ term comes from in

$$n! \sim \left(\frac{n}{e}\right)^n \sqrt{2 \pi n}$$

which I couldn't readily answer. Looking around, I can't find a straightforward and intuitive explanation. Can someone explain this in terms understandable to a Computer Science undergrad (ie, no analysis beyond first-year calculus)?

-

– Matt Calhoun Feb 26 '11 at 18:30

## 5 Answers

This blog post by Terence Tao explains how to get this constant from the central limit theorem (equivalently, from the normalization factor we use to define the normal distribution). The question remains where it came from in the central limit theorem, and I think the most honest answer to that question is Fourier analysis; $\frac{1}{\sqrt{2\pi}}$ is the normalization factor which makes the Fourier transform and its inverse look the same, and the Gaussian distribution is its own Fourier transform.

(That is, I don't think you should look for a straightforward and intuitive explanation because I think this is actually a rather deep fact which is not really explained in most courses. On the other hand, just the $\sqrt{n}$ term is straightforward to explain: instead of using the left Riemann sum or the right Riemann sum, you use the trapezoid rule.)

-

1
Do you know where to find "article of Joe Keller" referred in Tao's post? The link does not seem to work any more. Thanks. – Qiang Li Feb 26 '11 at 17:47
@Qiang: unfortunately I do not. – Qiaochu Yuan Feb 26 '11 at 18:03

4
– J. M. Apr 10 '11 at 18:13

One way is to apply Euler-McLaurin Summation (which can be viewed as a clever application of repeated integration by parts) to $\displaystyle \log x$ to show that

$$n! \sim C \sqrt{n} \left(\frac{n}{e}\right)^n$$

Then use Wallis formula (another clever application of integration by parts)

$$\frac{\pi}{2} = \frac{2}{1} \times \frac{2}{3} \times \frac{4}{3} \times \frac{4}{5} \dots$$

to show that $\displaystyle C = \sqrt{2\pi}$.

If I recall correctly, this is how this was derived historically.

Of course, this does not give an intuitive reason as to why the constant is $\displaystyle \sqrt{2\pi}$

-

2
There is a saying that any analyst worth his salt can do wonders with only Cauchy-Schwarz and integration by parts. – Ragib Zaman Nov 18 '11 at 11:33

I'm not exactly sure how much analysis is covered by first-year calculus, but this is probably the shortest proof I know of this fact. It doesn't go very far in terms of making this intuitive, though, and I don't know that this can be done at all.

-

I think that the most intuitive explanation of this factor is as the total mass of a Gaussian integral in the evaluation of the stirling formual by means of steepest descent on the Gamma function defining integral. See, for example, section 2.4 of the following lecture note.

-

2
If all you want is the constant $\sqrt{2\pi}$, you can get it by using the normal approximation to approximate the central binomial coefficient. – Yuval Filmus Feb 26 '11 at 7:14

If You want to see the connection between the term $\sqrt{\pi}$ and factorial, explained in the geometric terms, You can watch Knuth's lecture entitled Why Pi?

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 10, "mathjax_display_tex": 4, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9422415494918823, "perplexity_flag": "head"}