A Proof of Stirling's Formula

A Proof of Stirling's Formula

Stirling's Formula

筆者在另一篇證明用常態分佈近似二項分佈的文章中,用到了這個Stirling's Formula,這裡證明一下。主要內容來自於page 552, section 11, chapter 11 in Boas's Mathematical Methods in The Physical Sciences 3rd edition. 黑色字體是課文,藍色字體是我的補充說明。

\[n!\sim n^{n}e^{-n}\sqrt{2\pi n}\tag{11.1}\]

Proof:

Start with \[p!=\int_0^{\infty}x^{p} e^{-x}dx=\int_0^{\infty}e^{(p\ln{x})-x}dx.\tag{11.2}\]

Remark: I show that \(p!=\int_0^{\infty}x^{p} e^{-x}dx\) by integral by parts.
\(x^p\)\(e^{-x}\)
\\(+\)
\(px^{p-1}\)\(-e^{-x}\)
\\(-\)
\(p(p-1)x^{p-2}\)\(e^{-x}\)
\\(+\)
\(p(p-1)(p-2)x^{p-3}\)\(-e^{-x}\)
\\(-\)
\(\vdots\)\(\vdots\)\(\vdots\)
\(p(p-1)(p-2)\cdots 2 x\)\(\pm e^{-x}\)
\\(\pm\)
\(p!\)\(\pm e^{-x}\)
\\(\pm\)
\(0\)---\(\int \pm\)\(\pm e^{-x}\)
\[\int_0^{\infty}x^{p} e^{-x}dx=\lim_{b\to \infty}[-x^{p}e^{-x}-px^{p-1}e^{-x}-p(p-1)x^{p-2}e^{-x}-\cdots -p(p-1)(p-2)\cdots 2x e^{-x}-p!e^{-x}]_{0}^{b}=p!,\] where \[\lim_{x\to \infty}x^c e^{-x}=0\] by L'Hospital Rule.

Substitute a new variable \(y\) such that \[x=p+y\sqrt{p}.\]

Then \[dx=\sqrt{p}dy\]

\[x=0 \text{ corresponds to }y=-\sqrt{p},\]

and (11.2) becomes \[p!=\int_{-\sqrt{p}}^{\infty}e^{p\ln{(p+y\sqrt{p})}-p-y\sqrt{p}}\sqrt{p}dy.\tag{11.3}\]

For large \(p\), the logarithm can be expanded in the following power series: \[\ln{(p+y\sqrt{p})}=\ln{p}+\ln{\left(1+\frac{y}{\sqrt{p}}\right)}=\ln{p}+\frac{y}{\sqrt{p}}-\frac{y^2}{2p}+\cdots.\tag{11.4}\]

since \(\frac{1}{1-x}=1+x+x^2+\cdots\) and \(\ln{(1-x)}=-x-\frac{x^2}{2}-\frac{x^3}{3}-\cdots \) by integrating both sides and \(\ln{(1+x)}=x-\frac{x^2}{2}+\frac{x^3}{3}-\cdots\).

I don't know why we can omit the later terms in the following deduction.

Substituting (11.4) into (11.3), we get \[ \begin{array}{rcl} p! &\sim& \int_{-\sqrt{p}}^{\infty} e^{(p\ln{p})+y\sqrt{p}-(y^2/2)-p-y\sqrt{p}}\sqrt{p}dy\\ &\stackrel{\text{cancel out }y\sqrt{p}}{=}& e^{(p\ln{p})-p}\sqrt{p}\int_{-\sqrt{p}}^{\infty}e^{-y^2/2}dy \\ &=& p^p e^{-p}\sqrt{p}\left[\int_{-\infty}^{\infty}e^{-y^2/2}dy-\int_{-\infty}^{-\sqrt{p}}e^{-y^2/2}dy\right]. \end{array} \]

The first integral is easily shown to be \(\sqrt{2\pi}\) (Problem 9.4). The second integral tends to zero as \(p\to \infty\), and we have \[p!\sim p^{p} e^{-p} \sqrt{2\pi p}\]

which is (11.1).

No comments:

Post a Comment