<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Removing the magic from Stirling&#8217;s formula</title>
	<atom:link href="http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/feed/" rel="self" type="application/rss+xml" />
	<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/</link>
	<description>Mathematics related discussions</description>
	<lastBuildDate>Wed, 15 May 2013 08:08:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: zeugirdorcar</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-36942</link>
		<dc:creator><![CDATA[zeugirdorcar]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 18:12:56 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-36942</guid>
		<description><![CDATA[Nice. Thanks. I still think the $latex I_{n}$ integral looks like a rabbit from a hat.... I once saw Stirling&#039;s approx following from Cauchy&#039;s integral formula very naturally but I&#039;ve been unable to reproduce it..... any way http://omega.albany.edu:8008/PascalT.pdf  dots all the i&#039;s for Stirling&#039;s &amp; the  awsome thing is that with sage it was ALL DONE IN THE BROWSER!]]></description>
		<content:encoded><![CDATA[<p>Nice. Thanks. I still think the <img src='http://s0.wp.com/latex.php?latex=I_%7Bn%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='I_{n}' title='I_{n}' class='latex' /> integral looks like a rabbit from a hat&#8230;. I once saw Stirling&#8217;s approx following from Cauchy&#8217;s integral formula very naturally but I&#8217;ve been unable to reproduce it&#8230;.. any way <a href="http://omega.albany.edu:8008/PascalT.pdf" rel="nofollow">http://omega.albany.edu:8008/PascalT.pdf</a>  dots all the i&#8217;s for Stirling&#8217;s &amp; the  awsome thing is that with sage it was ALL DONE IN THE BROWSER!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niall MacKay</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-10177</link>
		<dc:creator><![CDATA[Niall MacKay]]></dc:creator>
		<pubDate>Tue, 26 Oct 2010 16:11:46 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-10177</guid>
		<description><![CDATA[Your use of the piecewise-linear interpolation between the integers brings out the $latex O(n\log n)$, $latex O(n)$ and $latex O(\log n)$ terms so neatly that I wanted it very much to give the $latex O(1)$ term too -- which it does,  provided that

$latex \sum_{r=1}^\infty \{ (r+ {1\over 2})\log(1+{1\over r})-1\} = 1 - {1\over 2} \log(2\pi)$

which is true but which I cannot prove. Taylor-expanding the log and resumming in $latex \zeta(n)$, $latex n\geq 2$, doesn&#039;t seem to help.]]></description>
		<content:encoded><![CDATA[<p>Your use of the piecewise-linear interpolation between the integers brings out the <img src='http://s0.wp.com/latex.php?latex=O%28n%5Clog+n%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='O(n&#92;log n)' title='O(n&#92;log n)' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=O%28n%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='O(n)' title='O(n)' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=O%28%5Clog+n%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='O(&#92;log n)' title='O(&#92;log n)' class='latex' /> terms so neatly that I wanted it very much to give the <img src='http://s0.wp.com/latex.php?latex=O%281%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='O(1)' title='O(1)' class='latex' /> term too &#8212; which it does,  provided that</p>
<p><img src='http://s0.wp.com/latex.php?latex=%5Csum_%7Br%3D1%7D%5E%5Cinfty+%5C%7B+%28r%2B+%7B1%5Cover+2%7D%29%5Clog%281%2B%7B1%5Cover+r%7D%29-1%5C%7D+%3D+1+-+%7B1%5Cover+2%7D+%5Clog%282%5Cpi%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;sum_{r=1}^&#92;infty &#92;{ (r+ {1&#92;over 2})&#92;log(1+{1&#92;over r})-1&#92;} = 1 - {1&#92;over 2} &#92;log(2&#92;pi)' title='&#92;sum_{r=1}^&#92;infty &#92;{ (r+ {1&#92;over 2})&#92;log(1+{1&#92;over r})-1&#92;} = 1 - {1&#92;over 2} &#92;log(2&#92;pi)' class='latex' /></p>
<p>which is true but which I cannot prove. Taylor-expanding the log and resumming in <img src='http://s0.wp.com/latex.php?latex=%5Czeta%28n%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;zeta(n)' title='&#92;zeta(n)' class='latex' />, <img src='http://s0.wp.com/latex.php?latex=n%5Cgeq+2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n&#92;geq 2' title='n&#92;geq 2' class='latex' />, doesn&#8217;t seem to help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: M</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-9410</link>
		<dc:creator><![CDATA[M]]></dc:creator>
		<pubDate>Thu, 02 Sep 2010 21:17:56 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-9410</guid>
		<description><![CDATA[Here is a simple proof of Wallis and Stirling formulas. Email me for more pictures and details. 

Consider a {\it one-dimensional random walk}   of a point $\cal Q$
that starts at $x=0$ and  at each step   jumps from the point it
occupies   to either   right or
  left adjacent integer.
 The probability of finding point $\cal P$ in
location $x=K$ after $N$ steps from its initial position     is
given by  the binomial distribution
$$
 {P}(K,N)=\begin{cases} \dfrac{N !}  {2^N\; \left(\frac{N+  K
 }{2}!\right)    \left(\frac{N-   K }{2}!\right) }, \text{ if
}\vert K\vert \le N; \;  N-K \text{ is
even},\\
0, \text{ otherwise}.\end{cases} \eqno{\rm (3)}
$$

Let us now assume   that
$$  N=2n  \text{ is even } \eqno{\rm (4a)}$$
and $\varepsilon$ satisfies
$$
0&lt;\varepsilon&lt;\dfrac 5{30}. \eqno{\rm (4b)}
$$
Formula (3) can be rewritten as
$$
\hskip-0.2cm  {P}(-2k,2n)= {P}(2k,2n)=\begin{cases} \dfrac{(2n) !}
{2^{2n}\; \left(n!\right)^2     }\cdot
 \dfrac{\left(n!\right)^2     }  {  (n+  k)!
   (n-   k)! }=\\
 \hskip0.5cm \dfrac{(2n) !}  {2^{2n}\; \left(n!\right)^2     }
 \prod\limits_{j=1}^{k} \dfrac{\;\;n-\  (k-j) \;\;}{n+ { j} }, \text{ if } 0\le k\le n,\\
0, \text{ otherwise}.\end{cases}  {\rm (5)}
$$
Formula (5) implies that sufficiently large   $ n$
$$
1-\sum\limits_{\vert
 k\vert &lt; n^{0.5+\varepsilon} } P\big(2k, 2n \big)  =\sum\limits_{\vert
 k\vert \ge n^{0.5+\varepsilon} } P\big(2k, 2n \big)\le 2^{-
n^{2\varepsilon}}    \eqno{\rm (6)}
$$
and for $\vert k\vert \le n^{0.5+\varepsilon}$
$$
  \frac 1{\sqrt{ n}} e^{-\frac{k^2}{n}  -8
n^{-0.5+3\varepsilon} } \le\frac {2^{2n}\; \left(n!\right)^2 }{(2n)
!\sqrt{ n}}
  \;\;  P(2k,2n)
 \le   \frac 1{\sqrt{ n}} e^{-\frac{k^2}{n}  +8
n^{-0.5+3\varepsilon} }.\eqno{\rm (7)}
$$
The proof of formulas (6,7) is given in the Appendix.

 Formula (7) implies
$$
\bigg[ \frac 1{\sqrt{ n}}\sum\limits_{ \vert k \vert \le
n^{0.5+\varepsilon} } e^{-\frac{k^2}{n}}\bigg] e^{ -8
n^{-0.5+3\varepsilon} } \le\frac {2^{2n}\; \left(n!\right)^2 }{(2n)
!\sqrt{ n}}
  { \sum\limits_{\vert k \vert \le n^{0.5+\varepsilon}}P(2k,2n)}
 \le \bigg[
\frac 1{\sqrt{ n}}\sum\limits_{ \vert k \vert \le
n^{0.5+\varepsilon} } e^{-\frac{k^2}{n}}\bigg] e^{ 8
n^{-0.5+3\varepsilon} }.
$$
\color{black} Taking now limit as $n\to +\infty$ and using
$\lim\limits_{n\to +\infty}e^{ 8 n^{-0.5+3\varepsilon}
}=\lim\limits_{n\to +\infty}e^{- 8n^{-0.5+3\varepsilon} }=1$,
$\lim\limits_{n\to +\infty} \sum\limits_{\vert k \vert \le
n^{0.5+\varepsilon}}P(2k,2n)=1$ due to (6), $\lim\limits_{N\to
+\infty}\dfrac 1{\sqrt{n}}\sum\limits_{{\vert k \vert \le
n^{0.5+\varepsilon},}
 \atop{k \text{ is even}}}
e^{-\frac{k^2}{n}}=\int\limits_{-\infty}^{+\infty}e^{-t^2}dt=\sqrt{\pi}$
we obtain (1).]]></description>
		<content:encoded><![CDATA[<p>Here is a simple proof of Wallis and Stirling formulas. Email me for more pictures and details. </p>
<p>Consider a {\it one-dimensional random walk}   of a point $\cal Q$<br />
that starts at $x=0$ and  at each step   jumps from the point it<br />
occupies   to either   right or<br />
  left adjacent integer.<br />
 The probability of finding point $\cal P$ in<br />
location $x=K$ after $N$ steps from its initial position     is<br />
given by  the binomial distribution<br />
$$<br />
 {P}(K,N)=\begin{cases} \dfrac{N !}  {2^N\; \left(\frac{N+  K<br />
 }{2}!\right)    \left(\frac{N-   K }{2}!\right) }, \text{ if<br />
}\vert K\vert \le N; \;  N-K \text{ is<br />
even},\\<br />
0, \text{ otherwise}.\end{cases} \eqno{\rm (3)}<br />
$$</p>
<p>Let us now assume   that<br />
$$  N=2n  \text{ is even } \eqno{\rm (4a)}$$<br />
and $\varepsilon$ satisfies<br />
$$<br />
0&lt;\varepsilon&lt;\dfrac 5{30}. \eqno{\rm (4b)}<br />
$$<br />
Formula (3) can be rewritten as<br />
$$<br />
\hskip-0.2cm  {P}(-2k,2n)= {P}(2k,2n)=\begin{cases} \dfrac{(2n) !}<br />
{2^{2n}\; \left(n!\right)^2     }\cdot<br />
 \dfrac{\left(n!\right)^2     }  {  (n+  k)!<br />
   (n-   k)! }=\\<br />
 \hskip0.5cm \dfrac{(2n) !}  {2^{2n}\; \left(n!\right)^2     }<br />
 \prod\limits_{j=1}^{k} \dfrac{\;\;n-\  (k-j) \;\;}{n+ { j} }, \text{ if } 0\le k\le n,\\<br />
0, \text{ otherwise}.\end{cases}  {\rm (5)}<br />
$$<br />
Formula (5) implies that sufficiently large   $ n$<br />
$$<br />
1-\sum\limits_{\vert<br />
 k\vert &lt; n^{0.5+\varepsilon} } P\big(2k, 2n \big)  =\sum\limits_{\vert<br />
 k\vert \ge n^{0.5+\varepsilon} } P\big(2k, 2n \big)\le 2^{-<br />
n^{2\varepsilon}}    \eqno{\rm (6)}<br />
$$<br />
and for $\vert k\vert \le n^{0.5+\varepsilon}$<br />
$$<br />
  \frac 1{\sqrt{ n}} e^{-\frac{k^2}{n}  -8<br />
n^{-0.5+3\varepsilon} } \le\frac {2^{2n}\; \left(n!\right)^2 }{(2n)<br />
!\sqrt{ n}}<br />
  \;\;  P(2k,2n)<br />
 \le   \frac 1{\sqrt{ n}} e^{-\frac{k^2}{n}  +8<br />
n^{-0.5+3\varepsilon} }.\eqno{\rm (7)}<br />
$$<br />
The proof of formulas (6,7) is given in the Appendix.</p>
<p> Formula (7) implies<br />
$$<br />
\bigg[ \frac 1{\sqrt{ n}}\sum\limits_{ \vert k \vert \le<br />
n^{0.5+\varepsilon} } e^{-\frac{k^2}{n}}\bigg] e^{ -8<br />
n^{-0.5+3\varepsilon} } \le\frac {2^{2n}\; \left(n!\right)^2 }{(2n)<br />
!\sqrt{ n}}<br />
  { \sum\limits_{\vert k \vert \le n^{0.5+\varepsilon}}P(2k,2n)}<br />
 \le \bigg[<br />
\frac 1{\sqrt{ n}}\sum\limits_{ \vert k \vert \le<br />
n^{0.5+\varepsilon} } e^{-\frac{k^2}{n}}\bigg] e^{ 8<br />
n^{-0.5+3\varepsilon} }.<br />
$$<br />
\color{black} Taking now limit as $n\to +\infty$ and using<br />
$\lim\limits_{n\to +\infty}e^{ 8 n^{-0.5+3\varepsilon}<br />
}=\lim\limits_{n\to +\infty}e^{- 8n^{-0.5+3\varepsilon} }=1$,<br />
$\lim\limits_{n\to +\infty} \sum\limits_{\vert k \vert \le<br />
n^{0.5+\varepsilon}}P(2k,2n)=1$ due to (6), $\lim\limits_{N\to<br />
+\infty}\dfrac 1{\sqrt{n}}\sum\limits_{{\vert k \vert \le<br />
n^{0.5+\varepsilon},}<br />
 \atop{k \text{ is even}}}<br />
e^{-\frac{k^2}{n}}=\int\limits_{-\infty}^{+\infty}e^{-t^2}dt=\sqrt{\pi}$<br />
we obtain (1).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Takis Konstantopoulos</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1395</link>
		<dc:creator><![CDATA[Takis Konstantopoulos]]></dc:creator>
		<pubDate>Tue, 07 Oct 2008 17:52:52 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1395</guid>
		<description><![CDATA[Hm... I had no intention in posting a comment with LaTeX code. I saw the earlier comments with nice formulae and thought that there was an automatic LaTeX converter embedded here. Wrong. My apologies.

In fact, I think my posting was chopped!!! So, instead, please &lt;a href=&quot;http://www.ma.hw.ac.uk/~takis/commentonstirling.pdf&quot; rel=&quot;nofollow&quot;&gt;click here&lt;/a&gt;.

http://www.ma.hw.ac.uk/~takis/commentonstirling.pdf

(If someone could tell me how to post properly, I&#039;d appreciate!)

Sorry for the mess above!]]></description>
		<content:encoded><![CDATA[<p>Hm&#8230; I had no intention in posting a comment with LaTeX code. I saw the earlier comments with nice formulae and thought that there was an automatic LaTeX converter embedded here. Wrong. My apologies.</p>
<p>In fact, I think my posting was chopped!!! So, instead, please <a href="http://www.ma.hw.ac.uk/~takis/commentonstirling.pdf" rel="nofollow">click here</a>.</p>
<p><a href="http://www.ma.hw.ac.uk/~takis/commentonstirling.pdf" rel="nofollow">http://www.ma.hw.ac.uk/~takis/commentonstirling.pdf</a></p>
<p>(If someone could tell me how to post properly, I&#8217;d appreciate!)</p>
<p>Sorry for the mess above!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Takis Konstantopoulos</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1394</link>
		<dc:creator><![CDATA[Takis Konstantopoulos]]></dc:creator>
		<pubDate>Tue, 07 Oct 2008 17:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1394</guid>
		<description><![CDATA[I read the interesting discussion on the Stirling formula and
have a few comments.
Tim Gowers&#039; method starts from the intuitive idea `replace sum by integral&#039;.
It has the advantage that the crude Stirling approximation is obvious.
But the square root term (and the constant) are not obvious.
Besides, it does not give the link to the Central Limit Theorem,
which is the reason why $\sqrt{2\pi}$ appears.
See comments at the end of this, in reference to Laplace. He knew
that Stirling&#039;s approximation is intimately connected with probabilities
of sums of a large number of random variables
and developed a general approximation method in his work on the analytical
theory of probabilities.

David Speyer&#039;s method, starting from $n! = \int_0^\infty x^n e^{-x} dx$,
resembles very much Laplace&#039;s method.
Also, as he observed, the connection to the CLT is apparent.
But there is one thing in David&#039;s method,
which is not very natural.
Namely (following Laplace) it is better to make the
change of variable
\[
t=x/n
\]
first, instead of $t=x-n$. Then the gamma integral gives
\[
n! = n^{n+1} \int_0^\infty (t e^{-t})^n dt
\]
so that
\[
\frac{n!}{n^n e^{-n} \sqrt{n}} = 
\sqrt{n} e^n \int_0^\infty e^{-n g(t)} dt,
\]
where
\[
g(t) = t - \log t
\]
is a function with minimum at $t=1$,
and $g(1)=1$, $g&#039;(1)=0$, $g&#039;&#039;(1)=1$.
Following Laplace, the action is played by the second derivative of $g$,
so fixing and $\epsilon &gt; 0$ pick $0&lt; \delta &lt; 1$ so that
\[
&#124;g&#039;&#039;(t) - 1&#124; &lt; \epsilon \mbox{ if } &#124;t-1&#124;  0$, both bounds converge to zero.
This means that
\[
\frac{n!}{n^n e^{-n} \sqrt{n}} =
o(1) + \sqrt{n} e^n \int_{1-\delta}^{1+\delta} 
e^{-n g(t)} dt.
\]
Now write
\[
g(t) = 1 + \frac{1}{2} g&#039;&#039;(\tau)(t-1)^2
\]
for some $\tau=\tau(t)$ lying between $1$ and $t$, and therefore
$&#124;g&#039;&#039;(\tau) -1&#124;  0$, (iv) the infimum of $g(x)$ over any compact
set not containing $x_0$ is strictly larger than $g(x_0)$,
(v) $f$ is continuous around $x_0$ with $f(x_0) \neq 0$.
Then
\[
I_n \sim
f(x_0) e^{-(n+\frac{1}{2}) g(x_0)} \sqrt{2\pi/n g&#039;&#039;(x_0)}.
\]
The proof is along the same lines as in the special case above.

Regarding the connection to the CLT:
Let $X_0, X_1, X_2$, ... be a sequence of independent random variables,
all exponential with mean 1:
\[
P(X_j &gt; t) = e^{-t}.
\]
Then $S_n = X_0+ X_1 + \cdots + X_n$ has density
\[
\frac{1}{n!} x^n e^{-x}.
\]
So the density of $(S_n-n)/\sqrt{n}$ is
\[
f_n(x) = \frac{1}{n!} (n+\sqrt{n}~x)^n e^{-n-\sqrt{n}~x} \sqrt{n}.
\]
A local version of the CLT tells us that, for all $x$ (in fact, uniformly),
\[
\lim_{n \to \infty} f_n(x)  = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}
\]
Setting $x=0$ we obtain Stirling&#039;s approximation.
Of course, the heavy-duty machinery invoked is not simpler
than the proof given above.

And here is an exact statement of the LOCAL CLT
(see, e.g. Fristedt and Gray, a Modern Approach to Probability Theory,
Thm 15.9, p.284):

Let $S_n = X_1+ ... + X_n$ be sum of independent
and identically distributed random variables, where $X_1$ has
square integrable density, mean $\mu$, and finite variance $\sigma^2$.
Let $f_n$ be the density of $(S_n-n\mu)/\sqrt{n\sigma^2}$.
Then $f_n(x)$ converges (uniformly over all $x$)
to the standard Gaussian density.]]></description>
		<content:encoded><![CDATA[<p>I read the interesting discussion on the Stirling formula and<br />
have a few comments.<br />
Tim Gowers&#8217; method starts from the intuitive idea `replace sum by integral&#8217;.<br />
It has the advantage that the crude Stirling approximation is obvious.<br />
But the square root term (and the constant) are not obvious.<br />
Besides, it does not give the link to the Central Limit Theorem,<br />
which is the reason why $\sqrt{2\pi}$ appears.<br />
See comments at the end of this, in reference to Laplace. He knew<br />
that Stirling&#8217;s approximation is intimately connected with probabilities<br />
of sums of a large number of random variables<br />
and developed a general approximation method in his work on the analytical<br />
theory of probabilities.</p>
<p>David Speyer&#8217;s method, starting from $n! = \int_0^\infty x^n e^{-x} dx$,<br />
resembles very much Laplace&#8217;s method.<br />
Also, as he observed, the connection to the CLT is apparent.<br />
But there is one thing in David&#8217;s method,<br />
which is not very natural.<br />
Namely (following Laplace) it is better to make the<br />
change of variable<br />
\[<br />
t=x/n<br />
\]<br />
first, instead of $t=x-n$. Then the gamma integral gives<br />
\[<br />
n! = n^{n+1} \int_0^\infty (t e^{-t})^n dt<br />
\]<br />
so that<br />
\[<br />
\frac{n!}{n^n e^{-n} \sqrt{n}} =<br />
\sqrt{n} e^n \int_0^\infty e^{-n g(t)} dt,<br />
\]<br />
where<br />
\[<br />
g(t) = t - \log t<br />
\]<br />
is a function with minimum at $t=1$,<br />
and $g(1)=1$, $g&#8217;(1)=0$, $g&#8221;(1)=1$.<br />
Following Laplace, the action is played by the second derivative of $g$,<br />
so fixing and $\epsilon &gt; 0$ pick $0&lt; \delta &lt; 1$ so that<br />
\[<br />
|g''(t) - 1| &lt; \epsilon \mbox{ if } |t-1|  0$, both bounds converge to zero.<br />
This means that<br />
\[<br />
\frac{n!}{n^n e^{-n} \sqrt{n}} =<br />
o(1) + \sqrt{n} e^n \int_{1-\delta}^{1+\delta}<br />
e^{-n g(t)} dt.<br />
\]<br />
Now write<br />
\[<br />
g(t) = 1 + \frac{1}{2} g''(\tau)(t-1)^2<br />
\]<br />
for some $\tau=\tau(t)$ lying between $1$ and $t$, and therefore<br />
$|g&#8221;(\tau) -1|  0$, (iv) the infimum of $g(x)$ over any compact<br />
set not containing $x_0$ is strictly larger than $g(x_0)$,<br />
(v) $f$ is continuous around $x_0$ with $f(x_0) \neq 0$.<br />
Then<br />
\[<br />
I_n \sim<br />
f(x_0) e^{-(n+\frac{1}{2}) g(x_0)} \sqrt{2\pi/n g''(x_0)}.<br />
\]<br />
The proof is along the same lines as in the special case above.</p>
<p>Regarding the connection to the CLT:<br />
Let $X_0, X_1, X_2$, &#8230; be a sequence of independent random variables,<br />
all exponential with mean 1:<br />
\[<br />
P(X_j &gt; t) = e^{-t}.<br />
\]<br />
Then $S_n = X_0+ X_1 + \cdots + X_n$ has density<br />
\[<br />
\frac{1}{n!} x^n e^{-x}.<br />
\]<br />
So the density of $(S_n-n)/\sqrt{n}$ is<br />
\[<br />
f_n(x) = \frac{1}{n!} (n+\sqrt{n}~x)^n e^{-n-\sqrt{n}~x} \sqrt{n}.<br />
\]<br />
A local version of the CLT tells us that, for all $x$ (in fact, uniformly),<br />
\[<br />
\lim_{n \to \infty} f_n(x)  = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}<br />
\]<br />
Setting $x=0$ we obtain Stirling&#8217;s approximation.<br />
Of course, the heavy-duty machinery invoked is not simpler<br />
than the proof given above.</p>
<p>And here is an exact statement of the LOCAL CLT<br />
(see, e.g. Fristedt and Gray, a Modern Approach to Probability Theory,<br />
Thm 15.9, p.284):</p>
<p>Let $S_n = X_1+ &#8230; + X_n$ be sum of independent<br />
and identically distributed random variables, where $X_1$ has<br />
square integrable density, mean $\mu$, and finite variance $\sigma^2$.<br />
Let $f_n$ be the density of $(S_n-n\mu)/\sqrt{n\sigma^2}$.<br />
Then $f_n(x)$ converges (uniformly over all $x$)<br />
to the standard Gaussian density.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1212</link>
		<dc:creator><![CDATA[Neil]]></dc:creator>
		<pubDate>Fri, 08 Aug 2008 15:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1212</guid>
		<description><![CDATA[Tim,
My favourite derivation of the constant is to look at the ratio of the binomial coefficients to the central binomial coefficient, use the fact that for small x,
(1+x) is very close to log(x), and obtain as a result the central limit theorem
for binomial coefficients directly.  Then once you get that the coeffcients are 
decaying about the middle like exp(-l^2/n), you compare to the integral of
 exp(-x^2), and out pops the constant.
Of course, I each this in a generating functions course, and so I also show them
Euler Maclaurin as the trick to obtain everything but the value of the constant:
I actually use this example to motivate truly understanding the Euler MacM trick.

Neil]]></description>
		<content:encoded><![CDATA[<p>Tim,<br />
My favourite derivation of the constant is to look at the ratio of the binomial coefficients to the central binomial coefficient, use the fact that for small x,<br />
(1+x) is very close to log(x), and obtain as a result the central limit theorem<br />
for binomial coefficients directly.  Then once you get that the coeffcients are<br />
decaying about the middle like exp(-l^2/n), you compare to the integral of<br />
 exp(-x^2), and out pops the constant.<br />
Of course, I each this in a generating functions course, and so I also show them<br />
Euler Maclaurin as the trick to obtain everything but the value of the constant:<br />
I actually use this example to motivate truly understanding the Euler MacM trick.</p>
<p>Neil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Askey</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1138</link>
		<dc:creator><![CDATA[Richard Askey]]></dc:creator>
		<pubDate>Tue, 08 Jul 2008 02:40:52 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1138</guid>
		<description><![CDATA[A proof starting from the integral representation of gamma is given
in Creighton Buck&#039;s &quot;Advanced Calculus&quot;, published over 50
years ago.  This was likely not the first place it appeared.  One
reason many people who derived Stirling&#039;s formula used a
different argument was the desire for more terms in the
approximation to log gamma.]]></description>
		<content:encoded><![CDATA[<p>A proof starting from the integral representation of gamma is given<br />
in Creighton Buck&#8217;s &#8220;Advanced Calculus&#8221;, published over 50<br />
years ago.  This was likely not the first place it appeared.  One<br />
reason many people who derived Stirling&#8217;s formula used a<br />
different argument was the desire for more terms in the<br />
approximation to log gamma.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gord</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1059</link>
		<dc:creator><![CDATA[gord]]></dc:creator>
		<pubDate>Tue, 08 Apr 2008 08:43:04 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1059</guid>
		<description><![CDATA[Back to your question of why should nCr appear in integral of cos^n ...
If you look at cos^n [or other functions that approach 1 smoothly &amp; flatly from below...
and you keep reapplying them.. you get something that looks remarkably like a scaled 
right half of a normal distribution... [seems to shrink left at 1/sqrt n ]...

My point is, you get the same thing with (1-x^2)^n or  exp(-x*x/2) when raised to the n - the normal curve.

So to me, it seems like a product version of the central limit theorem - we keep reapplying by multiplying yet again by something roughly a normal distribution, and converges (nicely!) to the real normal distribution.

Turning the above sentence into math .. ie. stating why in the limit the repeated product converges to a scaled normal distribution... I havent done that yet - it might be obvious to others reading this blog ...


Great, stimulating discussion/exposion, thanks!
[apologies for lack of latex]]]></description>
		<content:encoded><![CDATA[<p>Back to your question of why should nCr appear in integral of cos^n &#8230;<br />
If you look at cos^n [or other functions that approach 1 smoothly &amp; flatly from below...<br />
and you keep reapplying them.. you get something that looks remarkably like a scaled<br />
right half of a normal distribution... [seems to shrink left at 1/sqrt n ]&#8230;</p>
<p>My point is, you get the same thing with (1-x^2)^n or  exp(-x*x/2) when raised to the n &#8211; the normal curve.</p>
<p>So to me, it seems like a product version of the central limit theorem &#8211; we keep reapplying by multiplying yet again by something roughly a normal distribution, and converges (nicely!) to the real normal distribution.</p>
<p>Turning the above sentence into math .. ie. stating why in the limit the repeated product converges to a scaled normal distribution&#8230; I havent done that yet &#8211; it might be obvious to others reading this blog &#8230;</p>
<p>Great, stimulating discussion/exposion, thanks!<br />
[apologies for lack of latex]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Romik</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1039</link>
		<dc:creator><![CDATA[Dan Romik]]></dc:creator>
		<pubDate>Mon, 03 Mar 2008 12:33:14 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1039</guid>
		<description><![CDATA[Dear Prof. Gowers,

Gil Kalai told me about your demystification of Stirling&#039;s formula. Indeed, this easy result deserves to be better explained and understood, and I recall as an undergraduate I was quite frustrated at not being given a proper explanation for it. Then, about 10 years ago I discovered a new derivation of the constant sqrt(2 pi) which I believe to be slightly simpler than the one you presented, and conceptually better motivated, since it relates to the probabilistic viewpoint involving the central limit theorem. The difference with the approach you and a few of the readers mention is that I look at the cumulative probabilities of the symmetric binomial distribution instead of at just the &quot;local&quot; probabilities. By computing the sum of  the first half of the binomial coefficients in a given row in two ways (first, using the obvious symmetry, and second, using a simple integration formula that converges to the integral of the Gaussian distribution), one gets the constant immediately.

My proof appeared in the American Math. Monthly 107 (2000), 556--557, and can be found on my web site. I wonder if you and others will think that my approach is indeed simpler than integrating powers of cosine - I find it hard to be objective about this, but of course both approaches are quite easy. By the way, I apologize for the pompous title of my paper (so pompous that I&#039;m embarrassed to write it here) - in my defense, I was 21 when I wrote it...]]></description>
		<content:encoded><![CDATA[<p>Dear Prof. Gowers,</p>
<p>Gil Kalai told me about your demystification of Stirling&#8217;s formula. Indeed, this easy result deserves to be better explained and understood, and I recall as an undergraduate I was quite frustrated at not being given a proper explanation for it. Then, about 10 years ago I discovered a new derivation of the constant sqrt(2 pi) which I believe to be slightly simpler than the one you presented, and conceptually better motivated, since it relates to the probabilistic viewpoint involving the central limit theorem. The difference with the approach you and a few of the readers mention is that I look at the cumulative probabilities of the symmetric binomial distribution instead of at just the &#8220;local&#8221; probabilities. By computing the sum of  the first half of the binomial coefficients in a given row in two ways (first, using the obvious symmetry, and second, using a simple integration formula that converges to the integral of the Gaussian distribution), one gets the constant immediately.</p>
<p>My proof appeared in the American Math. Monthly 107 (2000), 556&#8211;557, and can be found on my web site. I wonder if you and others will think that my approach is indeed simpler than integrating powers of cosine &#8211; I find it hard to be objective about this, but of course both approaches are quite easy. By the way, I apologize for the pompous title of my paper (so pompous that I&#8217;m embarrassed to write it here) &#8211; in my defense, I was 21 when I wrote it&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: malkarouri</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1033</link>
		<dc:creator><![CDATA[malkarouri]]></dc:creator>
		<pubDate>Wed, 27 Feb 2008 22:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1033</guid>
		<description><![CDATA[The way I tend to remember this formula is by deriving it from equating the Poisson distribution with mean lambda by a Gaussian with mean and variance lambda. I first found this approach in David Mackay&#039;s Information Theory, Inference, and Learning Algorithms. It is magic alright, but at least it was short enough for me to remember.
I wonder if one substitutes a Binomial distribution instead would one get C(2n, n)?]]></description>
		<content:encoded><![CDATA[<p>The way I tend to remember this formula is by deriving it from equating the Poisson distribution with mean lambda by a Gaussian with mean and variance lambda. I first found this approach in David Mackay&#8217;s Information Theory, Inference, and Learning Algorithms. It is magic alright, but at least it was short enough for me to remember.<br />
I wonder if one substitutes a Binomial distribution instead would one get C(2n, n)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurens Gunnarsen</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1025</link>
		<dc:creator><![CDATA[Laurens Gunnarsen]]></dc:creator>
		<pubDate>Thu, 21 Feb 2008 20:20:58 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1025</guid>
		<description><![CDATA[I can&#039;t help thinking that this is an especially apposite moment to insert a ringing recommendation for Robert M. Young&#039;s classic EXCURSIONS IN CALCULUS.  Not only does the book include the very derivation of Stirling&#039;s formula that Professor Gowers has presented here (on pp. 264-267), but it also offers several different approaches to deriving the deep and powerful Euler-Maclaurin summation formula, of which Stirling&#039;s formula is a straightforward corollary.  

In particular, on pp. 354-5 of his EXCURSIONS, Professor Young notes that summing the values of an analytic function f at the first n non-negative integers boils down to finding another function F related to it by 

f(x) = F(x + 1) - F(x) = F&#039;(x) + (1/2!)F&#039;&#039;(x) + (1/3!)F&#039;&#039;&#039;(x) + ... , 

since f(0) + f(1) + ... + f(n-1) is then just F(n) - F(0).  And now, to Euler, the striking formal resemblance between 

f(x) = F&#039;(x) + (1/2!)F&#039;&#039;(x) + (1/3!)F&#039;&#039;&#039;(x) + ... 

and 

y = x + ax^2 + bx^3 + ... 

naturally suggested solving for F in much the same way as one solves for x in terms of y in a power series of this sort.  One simply writes

x = y + ry^2 + sy^3 + ... , 

with r, s, ... undetermined constants, and substitutes this form into the power series.  Then one fixes r, s, ... successively by requiring the coefficients of terms of like degree to match on both sides of the equation.   

Of course there&#039;s more to it than this in the end, but it&#039;s hard to think of a more straightforward argument for putting 

F&#039;(x) = f(x) + rf&#039;(x) + sf&#039;&#039;(x) + ... , 

and substituting back. And not only does this astonishingly simple idea actually work, it exposes the essence of the Euler-Maclaurin summation formula.]]></description>
		<content:encoded><![CDATA[<p>I can&#8217;t help thinking that this is an especially apposite moment to insert a ringing recommendation for Robert M. Young&#8217;s classic EXCURSIONS IN CALCULUS.  Not only does the book include the very derivation of Stirling&#8217;s formula that Professor Gowers has presented here (on pp. 264-267), but it also offers several different approaches to deriving the deep and powerful Euler-Maclaurin summation formula, of which Stirling&#8217;s formula is a straightforward corollary.  </p>
<p>In particular, on pp. 354-5 of his EXCURSIONS, Professor Young notes that summing the values of an analytic function f at the first n non-negative integers boils down to finding another function F related to it by </p>
<p>f(x) = F(x + 1) &#8211; F(x) = F&#8217;(x) + (1/2!)F&#8221;(x) + (1/3!)F&#8221;&#8217;(x) + &#8230; , </p>
<p>since f(0) + f(1) + &#8230; + f(n-1) is then just F(n) &#8211; F(0).  And now, to Euler, the striking formal resemblance between </p>
<p>f(x) = F&#8217;(x) + (1/2!)F&#8221;(x) + (1/3!)F&#8221;&#8217;(x) + &#8230; </p>
<p>and </p>
<p>y = x + ax^2 + bx^3 + &#8230; </p>
<p>naturally suggested solving for F in much the same way as one solves for x in terms of y in a power series of this sort.  One simply writes</p>
<p>x = y + ry^2 + sy^3 + &#8230; , </p>
<p>with r, s, &#8230; undetermined constants, and substitutes this form into the power series.  Then one fixes r, s, &#8230; successively by requiring the coefficients of terms of like degree to match on both sides of the equation.   </p>
<p>Of course there&#8217;s more to it than this in the end, but it&#8217;s hard to think of a more straightforward argument for putting </p>
<p>F&#8217;(x) = f(x) + rf&#8217;(x) + sf&#8221;(x) + &#8230; , </p>
<p>and substituting back. And not only does this astonishingly simple idea actually work, it exposes the essence of the Euler-Maclaurin summation formula.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gowers</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1024</link>
		<dc:creator><![CDATA[gowers]]></dc:creator>
		<pubDate>Wed, 20 Feb 2008 23:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1024</guid>
		<description><![CDATA[That&#039;s slightly embarrassing as I have the book but haven&#039;t read that bit of it. But I would add to the previous comment that it is an excellent book in general, with beautiful discussions of bits of maths that often fall between the cracks of a typical undergraduate course. (For example, I was never taught the irrationality of pi and eventually learnt it from this book, where it formed part of a very interesting discussion of several related topics.)]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s slightly embarrassing as I have the book but haven&#8217;t read that bit of it. But I would add to the previous comment that it is an excellent book in general, with beautiful discussions of bits of maths that often fall between the cracks of a typical undergraduate course. (For example, I was never taught the irrationality of pi and eventually learnt it from this book, where it formed part of a very interesting discussion of several related topics.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TSM</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1021</link>
		<dc:creator><![CDATA[TSM]]></dc:creator>
		<pubDate>Mon, 18 Feb 2008 23:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1021</guid>
		<description><![CDATA[Speaking of rabbits, here is a reference:
Strange Curves, Counting Rabbits, and Other Mathematical Explorations,
Keith Ball, Princeton Univ Press,  2003.

Chapter 6 (pp 109-126) is an excellent, motivated, wonderfully illustrated expository account of the path traveled largely by Gowers to Stirling&#039;s formula. The Central Limit Theorem is discussed in the  previous chapter, and so the estimate of the middle binomial coefficient 2n choose n is available. His approach to Central Limit Theorem is also excellent, starting from coin-tossing, and leading to the standard improper double integral exploited for the normal distribution. Explicit use of the big-Oh notation is avoided.

Ball also mentions that historically this approach is backwards; the Central Limit Theorem was first established using Stirling-like ideas. Also, Stirling used the Wallis product formula. 

tsm [at] usna.edu]]></description>
		<content:encoded><![CDATA[<p>Speaking of rabbits, here is a reference:<br />
Strange Curves, Counting Rabbits, and Other Mathematical Explorations,<br />
Keith Ball, Princeton Univ Press,  2003.</p>
<p>Chapter 6 (pp 109-126) is an excellent, motivated, wonderfully illustrated expository account of the path traveled largely by Gowers to Stirling&#8217;s formula. The Central Limit Theorem is discussed in the  previous chapter, and so the estimate of the middle binomial coefficient 2n choose n is available. His approach to Central Limit Theorem is also excellent, starting from coin-tossing, and leading to the standard improper double integral exploited for the normal distribution. Explicit use of the big-Oh notation is avoided.</p>
<p>Ball also mentions that historically this approach is backwards; the Central Limit Theorem was first established using Stirling-like ideas. Also, Stirling used the Wallis product formula. </p>
<p>tsm [at] usna.edu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1012</link>
		<dc:creator><![CDATA[James]]></dc:creator>
		<pubDate>Sat, 16 Feb 2008 00:19:48 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1012</guid>
		<description><![CDATA[Hi, 

I was wondering if you&#039;d mind if I used your blog article on Stirling&#039;s formula for the next edition of &quot;Eureka&quot; (the journal of the Archimedeans undergrad. maths society here at Cambridge). It would most likely reach quite a broad audience of first years next year if you would consent. It might be worth appending David Speyer&#039;s remarks also.

Of course if there is something else you&#039;d prefer I&#039;m open to suggestions.

Contact me at archim-eureka-editor@srcf.ucam.org if you are interested.]]></description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>I was wondering if you&#8217;d mind if I used your blog article on Stirling&#8217;s formula for the next edition of &#8220;Eureka&#8221; (the journal of the Archimedeans undergrad. maths society here at Cambridge). It would most likely reach quite a broad audience of first years next year if you would consent. It might be worth appending David Speyer&#8217;s remarks also.</p>
<p>Of course if there is something else you&#8217;d prefer I&#8217;m open to suggestions.</p>
<p>Contact me at <a href="mailto:archim-eureka-editor@srcf.ucam.org">archim-eureka-editor@srcf.ucam.org</a> if you are interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilay</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1011</link>
		<dc:creator><![CDATA[Nilay]]></dc:creator>
		<pubDate>Thu, 14 Feb 2008 03:27:27 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1011</guid>
		<description><![CDATA[I tried out the integration $latex \int_1^n\log x dx$. This evaluates to $latex n log n - n +1$. This would mean that this approximation is off by $latex n^{\frac{1}{2}}$.]]></description>
		<content:encoded><![CDATA[<p>I tried out the integration <img src='http://s0.wp.com/latex.php?latex=%5Cint_1%5En%5Clog+x+dx&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;int_1^n&#92;log x dx' title='&#92;int_1^n&#92;log x dx' class='latex' />. This evaluates to <img src='http://s0.wp.com/latex.php?latex=n+log+n+-+n+%2B1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n log n - n +1' title='n log n - n +1' class='latex' />. This would mean that this approximation is off by <img src='http://s0.wp.com/latex.php?latex=n%5E%7B%5Cfrac%7B1%7D%7B2%7D%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n^{&#92;frac{1}{2}}' title='n^{&#92;frac{1}{2}}' class='latex' />.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Speyer</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-1009</link>
		<dc:creator><![CDATA[David Speyer]]></dc:creator>
		<pubDate>Mon, 11 Feb 2008 18:50:30 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-1009</guid>
		<description><![CDATA[I just realized this morning that the resemblance of my argument to the central limit formula is more than superficial: Let $latex F(x)=e^{-x}$ for $latex x \geq 0$ and $latex F(x)=0$ for $x &lt; 0$. Then the $latex (n+1)$-fold convolution of $F$ with itself is $latex x^n e^{-x}/n!$ for $latex x \geq 0$ (and, of course, zero for negative $latex x$). So what I&#039;m doing is basically verifying the central limit theorem by hand for independent eponentially distibuted random variables.]]></description>
		<content:encoded><![CDATA[<p>I just realized this morning that the resemblance of my argument to the central limit formula is more than superficial: Let <img src='http://s0.wp.com/latex.php?latex=F%28x%29%3De%5E%7B-x%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F(x)=e^{-x}' title='F(x)=e^{-x}' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=x+%5Cgeq+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x &#92;geq 0' title='x &#92;geq 0' class='latex' /> and <img src='http://s0.wp.com/latex.php?latex=F%28x%29%3D0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='F(x)=0' title='F(x)=0' class='latex' /> for $x &lt; 0$. Then the <img src='http://s0.wp.com/latex.php?latex=%28n%2B1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(n+1)' title='(n+1)' class='latex' />-fold convolution of $F$ with itself is <img src='http://s0.wp.com/latex.php?latex=x%5En+e%5E%7B-x%7D%2Fn%21&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x^n e^{-x}/n!' title='x^n e^{-x}/n!' class='latex' /> for <img src='http://s0.wp.com/latex.php?latex=x+%5Cgeq+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x &#92;geq 0' title='x &#92;geq 0' class='latex' /> (and, of course, zero for negative <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' />). So what I&#8217;m doing is basically verifying the central limit theorem by hand for independent eponentially distibuted random variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gowers</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-996</link>
		<dc:creator><![CDATA[gowers]]></dc:creator>
		<pubDate>Sun, 03 Feb 2008 12:55:33 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-996</guid>
		<description><![CDATA[Just realized that the beautiful argument given by David Speyer a few comments up is almost certainly essentially the same as the argument I alluded to using the central limit theorem: your/his main steps are to centre and rescale a distribution and use the Taylor expansion up to the second term to get a Gaussian coming out, just as one does in proving the central limit theorem itself. But the fact that it comes out quickly and directly like that is very nice. And I myself find the first step pretty natural -- if you&#039;ve got the integral representation of the gamma function, then why not try to use it?]]></description>
		<content:encoded><![CDATA[<p>Just realized that the beautiful argument given by David Speyer a few comments up is almost certainly essentially the same as the argument I alluded to using the central limit theorem: your/his main steps are to centre and rescale a distribution and use the Taylor expansion up to the second term to get a Gaussian coming out, just as one does in proving the central limit theorem itself. But the fact that it comes out quickly and directly like that is very nice. And I myself find the first step pretty natural &#8212; if you&#8217;ve got the integral representation of the gamma function, then why not try to use it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: B</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-995</link>
		<dc:creator><![CDATA[B]]></dc:creator>
		<pubDate>Sun, 03 Feb 2008 00:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-995</guid>
		<description><![CDATA[This is certainly pulling a rabbit out of a hat, but what about integrating the logarithm of the sine product of sin(pi*x)/pi*x from 0 to 1? This is, if nothing else, a fairly natural thing to do once you know about the sine product, and the proof comes out without much trouble. Certainly it isn&#039;t hard to remember as a proof, at any rate.]]></description>
		<content:encoded><![CDATA[<p>This is certainly pulling a rabbit out of a hat, but what about integrating the logarithm of the sine product of sin(pi*x)/pi*x from 0 to 1? This is, if nothing else, a fairly natural thing to do once you know about the sine product, and the proof comes out without much trouble. Certainly it isn&#8217;t hard to remember as a proof, at any rate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toomuchcoffeeman</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-993</link>
		<dc:creator><![CDATA[toomuchcoffeeman]]></dc:creator>
		<pubDate>Sat, 02 Feb 2008 04:15:40 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-993</guid>
		<description><![CDATA[Oops, bodged LaTeX. ``No formula provided&#039;&#039; should be 0, of course ... and the last formula should be
$latex 2^{-2n}{2n\choose n}\frac{\pi}{2} = \int_0^{\pi/2}\cos^n\theta\,d\theta$

[&lt;em&gt;Many thanks for the comment, and I like the explanation for the appearance of the binomial
coefficient even if it doesn&#039;t get the whole way to answering the question. I&#039;ve corrected the bounds 
in the integrals and fixed your LaTeX bug now.&lt;/em&gt;]]]></description>
		<content:encoded><![CDATA[<p>Oops, bodged LaTeX. &#8220;No formula provided&#8221; should be 0, of course &#8230; and the last formula should be<br />
<img src='http://s0.wp.com/latex.php?latex=2%5E%7B-2n%7D%7B2n%5Cchoose+n%7D%5Cfrac%7B%5Cpi%7D%7B2%7D+%3D+%5Cint_0%5E%7B%5Cpi%2F2%7D%5Ccos%5En%5Ctheta%5C%2Cd%5Ctheta&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2^{-2n}{2n&#92;choose n}&#92;frac{&#92;pi}{2} = &#92;int_0^{&#92;pi/2}&#92;cos^n&#92;theta&#92;,d&#92;theta' title='2^{-2n}{2n&#92;choose n}&#92;frac{&#92;pi}{2} = &#92;int_0^{&#92;pi/2}&#92;cos^n&#92;theta&#92;,d&#92;theta' class='latex' /></p>
<p>[<em>Many thanks for the comment, and I like the explanation for the appearance of the binomial<br />
coefficient even if it doesn't get the whole way to answering the question. I've corrected the bounds<br />
in the integrals and fixed your LaTeX bug now.</em>]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toomuchcoffeeman</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-992</link>
		<dc:creator><![CDATA[toomuchcoffeeman]]></dc:creator>
		<pubDate>Sat, 02 Feb 2008 04:13:31 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-992</guid>
		<description><![CDATA[Shouldn&#039;t the integral defining $latex I_n$ be taken from $latex \null 0$ to $latex \pi/2$?

Also (though in some sense this ties in with Lior&#039;s post above) one non-magic reason to get $latex {2n\choose n}$ out of these integrals is that it is the constant coefficient in $latex (x+x^{-1})^{2n}$ -- a fairly natural trick to try -- so putting $latex x=e^{i\theta}$ and rescaling one gets

$latex 2^{-2n}{2n\choose n} \frac{\pi/2} = \int_0^{\pi/2} \cos^n \theta\,d\theta$

I can&#039;t see how to get round using (the proof of) Wallis&#039; formula, though.]]></description>
		<content:encoded><![CDATA[<p>Shouldn&#8217;t the integral defining <img src='http://s0.wp.com/latex.php?latex=I_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='I_n' title='I_n' class='latex' /> be taken from <img src='http://s0.wp.com/latex.php?latex=%5Cnull+0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;null 0' title='&#92;null 0' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=%5Cpi%2F2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi/2' title='&#92;pi/2' class='latex' />?</p>
<p>Also (though in some sense this ties in with Lior&#8217;s post above) one non-magic reason to get <img src='http://s0.wp.com/latex.php?latex=%7B2n%5Cchoose+n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='{2n&#92;choose n}' title='{2n&#92;choose n}' class='latex' /> out of these integrals is that it is the constant coefficient in <img src='http://s0.wp.com/latex.php?latex=%28x%2Bx%5E%7B-1%7D%29%5E%7B2n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(x+x^{-1})^{2n}' title='(x+x^{-1})^{2n}' class='latex' /> &#8212; a fairly natural trick to try &#8212; so putting <img src='http://s0.wp.com/latex.php?latex=x%3De%5E%7Bi%5Ctheta%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x=e^{i&#92;theta}' title='x=e^{i&#92;theta}' class='latex' /> and rescaling one gets</p>
<p><img src='http://s0.wp.com/latex.php?latex=2%5E%7B-2n%7D%7B2n%5Cchoose+n%7D+%5Cfrac%7B%5Cpi%2F2%7D+%3D+%5Cint_0%5E%7B%5Cpi%2F2%7D+%5Ccos%5En+%5Ctheta%5C%2Cd%5Ctheta&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='2^{-2n}{2n&#92;choose n} &#92;frac{&#92;pi/2} = &#92;int_0^{&#92;pi/2} &#92;cos^n &#92;theta&#92;,d&#92;theta' title='2^{-2n}{2n&#92;choose n} &#92;frac{&#92;pi/2} = &#92;int_0^{&#92;pi/2} &#92;cos^n &#92;theta&#92;,d&#92;theta' class='latex' /></p>
<p>I can&#8217;t see how to get round using (the proof of) Wallis&#8217; formula, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Watkins</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-991</link>
		<dc:creator><![CDATA[David Watkins]]></dc:creator>
		<pubDate>Sat, 02 Feb 2008 03:06:23 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-991</guid>
		<description><![CDATA[I found that proof a wonderful read. I stumbled across this blog not expecting to understand anything, so I am prompted to to write this. I like your style of &quot;removing the magic&quot;, seeing how it really works.

Thanks.]]></description>
		<content:encoded><![CDATA[<p>I found that proof a wonderful read. I stumbled across this blog not expecting to understand anything, so I am prompted to to write this. I like your style of &#8220;removing the magic&#8221;, seeing how it really works.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Old Fart</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-988</link>
		<dc:creator><![CDATA[Old Fart]]></dc:creator>
		<pubDate>Fri, 01 Feb 2008 20:45:40 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-988</guid>
		<description><![CDATA[What&#039;s wrong with magic? I was shown the summed up logs thing in a chemistry 1B lecture, probably before you were born, that was enough to crack out the boltzman distribution. My &#039;please sir, what about the pis&#039; was rather dismissed as taking the piss. Beyond that, Copson&#039;s &#039;Theory of Functions of a Complex Variable&#039;, Section 9.53 does the business in an old school way. Dave MacKay&#039;s take (Information Theory, Inference and Learning Algorithms, page 2!) has a shade of the darker arts (including the central limit theorem) to it. None of these is maths, perhaps; Stirling&#039;s theorem does, nonetheless, belong to the world.]]></description>
		<content:encoded><![CDATA[<p>What&#8217;s wrong with magic? I was shown the summed up logs thing in a chemistry 1B lecture, probably before you were born, that was enough to crack out the boltzman distribution. My &#8216;please sir, what about the pis&#8217; was rather dismissed as taking the piss. Beyond that, Copson&#8217;s &#8216;Theory of Functions of a Complex Variable&#8217;, Section 9.53 does the business in an old school way. Dave MacKay&#8217;s take (Information Theory, Inference and Learning Algorithms, page 2!) has a shade of the darker arts (including the central limit theorem) to it. None of these is maths, perhaps; Stirling&#8217;s theorem does, nonetheless, belong to the world.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Speyer</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-985</link>
		<dc:creator><![CDATA[David Speyer]]></dc:creator>
		<pubDate>Fri, 01 Feb 2008 18:26:24 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-985</guid>
		<description><![CDATA[Stupid typos in the above:

The formula that doesn&#039;t parse is

$latex n!=n^n e^{-n} \int_{-n}^{\infty} e^{-u} (1+u/n)^n du$.

I dropped the coefficient 1/2 in the Taylor series
 $latex n \log(1+u/n)=u-u^2/2 n+O(u^3/n^2)$, and in several of the following formulas.

[&lt;em&gt;Many thanks for the comment, and I&#039;ve fixed the bugs now&lt;/em&gt;.]]]></description>
		<content:encoded><![CDATA[<p>Stupid typos in the above:</p>
<p>The formula that doesn&#8217;t parse is</p>
<p><img src='http://s0.wp.com/latex.php?latex=n%21%3Dn%5En+e%5E%7B-n%7D+%5Cint_%7B-n%7D%5E%7B%5Cinfty%7D+e%5E%7B-u%7D+%281%2Bu%2Fn%29%5En+du&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n!=n^n e^{-n} &#92;int_{-n}^{&#92;infty} e^{-u} (1+u/n)^n du' title='n!=n^n e^{-n} &#92;int_{-n}^{&#92;infty} e^{-u} (1+u/n)^n du' class='latex' />.</p>
<p>I dropped the coefficient 1/2 in the Taylor series<br />
 <img src='http://s0.wp.com/latex.php?latex=n+%5Clog%281%2Bu%2Fn%29%3Du-u%5E2%2F2+n%2BO%28u%5E3%2Fn%5E2%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n &#92;log(1+u/n)=u-u^2/2 n+O(u^3/n^2)' title='n &#92;log(1+u/n)=u-u^2/2 n+O(u^3/n^2)' class='latex' />, and in several of the following formulas.</p>
<p>[<em>Many thanks for the comment, and I've fixed the bugs now</em>.]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Speyer</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-981</link>
		<dc:creator><![CDATA[David Speyer]]></dc:creator>
		<pubDate>Fri, 01 Feb 2008 17:00:19 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-981</guid>
		<description><![CDATA[I think that, if you follow the approach by taking logs, you will always have to do something tricky to get the value of the constant. After all, for many sums, such as sum 1/n, sum 1/(n log n) or sum n log n, it is easy to get an asymtopic formula where the constant term is given by a convergent sum, but it is very rare that this constant has a closed form.

Here is a different approach where the constant comes out relatively naturally. The first step is less motivated than in your argument but, after that, everything feels natural to me.

Start with the integral formula for the Gamma function:

$latex n!=\int_0^{\infty} e^{-x} x^n dx$

Now, a quick computation with derivatives shows that $latex e^{-x} x^n$ is optimized at x=n, so lets make a change of variables to put x=n at the origin. Set $latex x=u+n$, so 

$latex n!=n^n e^{-n} \int_{-n}^{\infty} e^{-u} (1+u/n)^n dx$

The formula $latex (1+u/n)^n$ is screaming to be replaced by $latex e^u$. Just making this replacement gives us far too much error, so keep one more term.

$latex (1+u/n)^n=\exp(n \log(1+u/n))=\exp(u-u^2/2n+O(u^3/n^2))$
so the integrand is
$latex \int e^{-u^2/n+O(u^3/n^2)} du.$

Intuitively, we are done at this point, because $latex \int e^{-u^2/n} du=\sqrt{2 \pi n}$. Being careful, we have the problem that the error term $latex O(u^3/n^2)$ will overwhelm the terms we care about when u is too large. So the careful way to do this is to chop our integrand at $latex &#124;u&#124;=n^{a}$ for some $latex a$ between 1/2 and 2/3, and use some straightforward bounds to show that those tails don&#039;t contribute.]]></description>
		<content:encoded><![CDATA[<p>I think that, if you follow the approach by taking logs, you will always have to do something tricky to get the value of the constant. After all, for many sums, such as sum 1/n, sum 1/(n log n) or sum n log n, it is easy to get an asymtopic formula where the constant term is given by a convergent sum, but it is very rare that this constant has a closed form.</p>
<p>Here is a different approach where the constant comes out relatively naturally. The first step is less motivated than in your argument but, after that, everything feels natural to me.</p>
<p>Start with the integral formula for the Gamma function:</p>
<p><img src='http://s0.wp.com/latex.php?latex=n%21%3D%5Cint_0%5E%7B%5Cinfty%7D+e%5E%7B-x%7D+x%5En+dx&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n!=&#92;int_0^{&#92;infty} e^{-x} x^n dx' title='n!=&#92;int_0^{&#92;infty} e^{-x} x^n dx' class='latex' /></p>
<p>Now, a quick computation with derivatives shows that <img src='http://s0.wp.com/latex.php?latex=e%5E%7B-x%7D+x%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='e^{-x} x^n' title='e^{-x} x^n' class='latex' /> is optimized at x=n, so lets make a change of variables to put x=n at the origin. Set <img src='http://s0.wp.com/latex.php?latex=x%3Du%2Bn&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x=u+n' title='x=u+n' class='latex' />, so </p>
<p><img src='http://s0.wp.com/latex.php?latex=n%21%3Dn%5En+e%5E%7B-n%7D+%5Cint_%7B-n%7D%5E%7B%5Cinfty%7D+e%5E%7B-u%7D+%281%2Bu%2Fn%29%5En+dx&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n!=n^n e^{-n} &#92;int_{-n}^{&#92;infty} e^{-u} (1+u/n)^n dx' title='n!=n^n e^{-n} &#92;int_{-n}^{&#92;infty} e^{-u} (1+u/n)^n dx' class='latex' /></p>
<p>The formula <img src='http://s0.wp.com/latex.php?latex=%281%2Bu%2Fn%29%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(1+u/n)^n' title='(1+u/n)^n' class='latex' /> is screaming to be replaced by <img src='http://s0.wp.com/latex.php?latex=e%5Eu&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='e^u' title='e^u' class='latex' />. Just making this replacement gives us far too much error, so keep one more term.</p>
<p><img src='http://s0.wp.com/latex.php?latex=%281%2Bu%2Fn%29%5En%3D%5Cexp%28n+%5Clog%281%2Bu%2Fn%29%29%3D%5Cexp%28u-u%5E2%2F2n%2BO%28u%5E3%2Fn%5E2%29%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(1+u/n)^n=&#92;exp(n &#92;log(1+u/n))=&#92;exp(u-u^2/2n+O(u^3/n^2))' title='(1+u/n)^n=&#92;exp(n &#92;log(1+u/n))=&#92;exp(u-u^2/2n+O(u^3/n^2))' class='latex' /><br />
so the integrand is<br />
<img src='http://s0.wp.com/latex.php?latex=%5Cint+e%5E%7B-u%5E2%2Fn%2BO%28u%5E3%2Fn%5E2%29%7D+du.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;int e^{-u^2/n+O(u^3/n^2)} du.' title='&#92;int e^{-u^2/n+O(u^3/n^2)} du.' class='latex' /></p>
<p>Intuitively, we are done at this point, because <img src='http://s0.wp.com/latex.php?latex=%5Cint+e%5E%7B-u%5E2%2Fn%7D+du%3D%5Csqrt%7B2+%5Cpi+n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;int e^{-u^2/n} du=&#92;sqrt{2 &#92;pi n}' title='&#92;int e^{-u^2/n} du=&#92;sqrt{2 &#92;pi n}' class='latex' />. Being careful, we have the problem that the error term <img src='http://s0.wp.com/latex.php?latex=O%28u%5E3%2Fn%5E2%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='O(u^3/n^2)' title='O(u^3/n^2)' class='latex' /> will overwhelm the terms we care about when u is too large. So the careful way to do this is to chop our integrand at <img src='http://s0.wp.com/latex.php?latex=%7Cu%7C%3Dn%5E%7Ba%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='|u|=n^{a}' title='|u|=n^{a}' class='latex' /> for some <img src='http://s0.wp.com/latex.php?latex=a&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a' title='a' class='latex' /> between 1/2 and 2/3, and use some straightforward bounds to show that those tails don&#8217;t contribute.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gowers</title>
		<link>http://gowers.wordpress.com/2008/02/01/removing-the-magic-from-stirlings-formula/#comment-980</link>
		<dc:creator><![CDATA[gowers]]></dc:creator>
		<pubDate>Fri, 01 Feb 2008 16:24:34 +0000</pubDate>
		<guid isPermaLink="false">http://gowers.wordpress.com/?p=20#comment-980</guid>
		<description><![CDATA[Thanks for that, and I&#039;ve now sorted out your LaTeX and my wrong definition of $latex I_n$. I should have added that the magic of the telescoping sum wasn&#039;t critical to getting the estimate to work, but it&#039;s quite pleasant and the proof works for an arbitrary function with decreasing derivative. So that piece of &quot;magic&quot; doesn&#039;t concern me.]]></description>
		<content:encoded><![CDATA[<p>Thanks for that, and I&#8217;ve now sorted out your LaTeX and my wrong definition of <img src='http://s0.wp.com/latex.php?latex=I_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='I_n' title='I_n' class='latex' />. I should have added that the magic of the telescoping sum wasn&#8217;t critical to getting the estimate to work, but it&#8217;s quite pleasant and the proof works for an arbitrary function with decreasing derivative. So that piece of &#8220;magic&#8221; doesn&#8217;t concern me.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
