Steven R. Dunbar
Department of Mathematics
203 Avery Hall
Lincoln, NE 68588-0130
http://www.math.unl.edu
Voice: 402-472-3731
Fax: 402-472-8466

Topics in
Probability Theory and Stochastic Processes
Steven R. Dunbar

__________________________________________________________________________

Stirling’s Formula by Euler-Maclaurin Summation

_______________________________________________________________________

Note: To read these pages properly, you will need the latest version of the Mozilla Firefox browser, with the STIX fonts installed. In a few sections, you will also need the latest Java plug-in, and JavaScript must be enabled. If you use a browser other than Firefox, you should be able to access the pages and run the applets. However, mathematical expressions will probably not display correctly. Firefox is currently the only browser that supports all of the open standards.

_______________________________________________________________________________________________ ### Rating

Mathematicians Only: prolonged scenes of intense rigor.

_______________________________________________________________________________________________ ### Section Starter Question

How would you evaluate or even approximate $\left(\genfrac{}{}{0.0pt}{}{2n}{n}\right)$ for large values of $n$, say $n\ge 100$ ?

_______________________________________________________________________________________________ ### Key Concepts

1. Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation
$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}.$

2. The formula is useful in estimating large factorial values, but its main mathematical value is in limits involving factorials.
3. A first-order Euler-Maclaurin Summation Formula is
$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\frac{1}{2}\left(f\left(0\right)+f\left(n\right)\right)+{\int }_{0}^{n}\left(t-⌊t⌋-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

__________________________________________________________________________ ### Vocabulary

1. Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation
$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}.$

2. A first-order Euler-Maclaurin Summation Formula is
$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\frac{1}{2}\left(f\left(0\right)+f\left(n\right)\right)+{\int }_{0}^{n}\left(t-⌊t⌋-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

__________________________________________________________________________ ### Mathematical Ideas

#### Stirling’s Formula

Stirling’s Formula, also called Stirling’s Approximation, is the asymptotic relation

$n!\sim \sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}.$

The formula is useful in estimating large factorial values, but its main mathematical value is in limits involving factorials. Another attractive form of Stirling’s Formula is

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

An improved inequality version of Stirling’s Formula is

 $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n+1\right)} (1)

See Stirling’s Formula..

James Stirling, a Scottish mathematician born in 1692 near Stirling Scotland, received much of his mathematical education in Oxford. He was a friend and correspondent with Nicholaus (I) Bernoulli, Newton, De Moivre, Euler, and Maclaurin. He wrote extensively on methods for accelerating summations of series, and in 1730 published the asymptotic result that bears his name in his book Methodus Differentialis on this subject. See MacTutor History of Mathematics..

According to Diaconis and Freedman, , De Moivre proved a version of Stirling’s Formula without the asymptotic constant $\sqrt{2\pi }$ in 1730 while deriving what we now call the DeMoivre-Laplace Theorem for the normal approximation to the binomial distribution. Stirling also gave a proof of what is now called Stirling’s Formula using Euler-Maclaurin summation and found the constant $\sqrt{2\pi }$ using Wallis’ Formula. This is the plan for the proof in this section.

#### An Easy but Crude Discovery Result

See Stirling’s Formula.:

$\begin{array}{llll}\hfill log\left(n!\right)& =log\left(1\right)+log\left(2\right)+\cdots +log\left(n\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =\sum _{k=1}^{n}log\left(k\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \approx {\int }_{1}^{n}log\left(x\right)\phantom{\rule{0em}{0ex}}dx\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & ={\left[xlog\left(x\right)-x\right]}_{1}^{n}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =nlog\left(n\right)-n+1\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \approx nlog\left(n\right)-n.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Although this gives the general functional form, it does not automatically give the “asymptotic factor” $\sqrt{2\pi n}$. The approximation comes from replacing the sum with an integral, but this can be justified precisely and rigorously with the Euler-Maclaurin sum formula.

#### An analytic proof using Euler-Maclaurin Summation and Wallis’ Formula

This proof is adapted and expanded from Todd, , pages 73-75 with improvements suggested by Jamie Radcliffe and Stephen Hartke.

Lemma 1 (Trapezoidal Approximation). If $f$ is a function such that ${f}^{\prime }\left(x\right)$ is continuous on $\left[r-1,r\right]$

$\frac{1}{2}\left(f\left(r-1\right)+f\left(r\right)\right)={\int }_{r-1}^{r}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+{\int }_{r-1}^{r}\left(t-\left(r-1\right)-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt.$

Proof. Starting from ${\int }_{r-1}^{r}\left(t-\left(r-1\right)-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$, integrate by parts to obtain

${\int }_{r-1}^{r}\left(t-\left(r-1\right)-\frac{1}{2}\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt=\frac{1}{2}f\left(r\right)+\frac{1}{2}f\left(r-1\right)-{\int }_{r-1}^{r}f\left(t\right)\phantom{\rule{0em}{0ex}}dt.$

Then transpose ${\int }_{r-1}^{r}f\left(t\right)\phantom{\rule{0em}{0ex}}dt$ to the other side. □

Remark. The left side in the lemma is the one-interval Trapezoidal Approximation of the area under $f\left(t\right)$ over $\left[r-1,r\right]$. Then the term ${\int }_{r-1}^{r}\left(t-\left(r-1\right)-\frac{1}{2}\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$ is an expression for the error in approximation.

Remark. The term $\left(t-\left(r-1\right)-1∕2\right)$ appears unmotivated, although it appears naturally in the alternative proof of Lemma 2. On the other hand, integration-by-parts to obtain the Trapezoidal Approximation requires a linear function which is $1∕2$ at $r$ and $-1∕2$ at $r-1$. Those requirements mean $t-\left(r-1\right)-1∕2$ is the natural choice.

Remark. Assume that $f\left(t\right)$ is sufficiently differentiable on $\left[r-1,r\right]$ so that we can expand ${f}^{\prime }\left(t\right)$ in a Taylor polynomial ${f}^{\prime }\left(t\right)={f}^{\prime }\left(\left(r-1\right)+1∕2\right)+\left(t-\left(r-1\right)-1∕2\right){f}^{\prime \prime }\left({c}_{t}\right)$ where ${c}_{t}$ is between $t$ and $\left(r-1\right)+1∕2$. Then

$\begin{array}{llll}\hfill & {\int }_{r-1}^{r}\left(t-\left(r-1\right)-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\int }_{r-1}^{r}\left(t-\left(r-1\right)-1∕2\right)\left({f}^{\prime }\left(1∕2\right)+\left(t-\left(r-1\right)-1∕2\right){f}^{\prime \prime }\left({c}_{t}\right)\right)\phantom{\rule{0em}{0ex}}dt\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}={\int }_{r-1}^{r}{\left(t-\left(r-1\right)-1∕2\right)}^{2}{f}^{\prime \prime }\left({c}_{t}\right)\phantom{\rule{0em}{0ex}}dt\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Then

$\begin{array}{llll}\hfill & \left|{\int }_{r-1}^{r}\left(t-\left(r-1\right)-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt\right|\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \le {\int }_{r-1}^{r}{\left(t-\left(r-1\right)-1∕2\right)}^{2}\phantom{\rule{0em}{0ex}}dt\underset{t\in \left[r-1,r\right]}{max}|{f}^{\prime \prime }\left(t\right)|\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =\frac{1}{12}\underset{t\in \left[r-1,r\right]}{max}|{f}^{\prime \prime }\left(t\right)|.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

This is the standard error estimate for the Trapezoidal Approximation derived in numerical analysis texts. The Trapezoidal Approximation and the error estimate are usually derived by linear interpolation through the endpoints of integration, also known as Lagrange Interpolation, or the Newton-Cotes formula.

Lemma 2. Suppose

1. $f$ is a function such that ${f}^{\prime }\left(x\right)$ is continuous on $\left[0,n\right]$ for some integer $n$.
2. Let ${B}_{1}\left(t\right)$ be the periodic extension with period $1$ of the function which is $t-1∕2$ for $t\in \left[0,1\right]$.

Then

$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\frac{1}{2}\left(f\left(0\right)+f\left(n\right)\right)+{\int }_{0}^{n}{B}_{1}\left(t\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

Remark. This is a simple version of the Euler-Maclaurin Summation Formula.

Proof. Using Lemma 1

$\frac{1}{2}\left(f\left(0\right)+f\left(1\right)\right)={\int }_{0}^{1}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+{\int }_{0}^{1}\left(t-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt.$

Then

$f\left(0\right)+\frac{1}{2}f\left(1\right)={\int }_{0}^{1}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\frac{1}{2}f\left(0\right)+{\int }_{0}^{1}\left(t-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

and the result follows by inductively applying the result of Lemma 1 on intervals $\left[1,2\right]$, …, $\left[n-1,n\right]$ and finally adding $1∕2f\left(n\right)$ to both sides. Note that ${B}_{1}\left(t\right)=t-\left(r-1\right)-1∕2$ on $\left[r-1,r\right]$. □

Alternative Direct Proof. Since ${f}^{\prime }\left(x\right)$ is continuous on $\left[0,n\right]$

${\int }_{r-1}^{r}{f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt=f\left(r\right)-f\left(r-1\right),\phantom{\rule{1em}{0ex}}r=1,2,\dots ,n.$

If we multiply this by $r$ and sum we get

$\begin{array}{llll}\hfill \sum _{r=1}^{n}{\int }_{r-1}^{r}r{f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt& =\sum _{r=1}^{n}r\left(f\left(r\right)-f\left(r-1\right)\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =\sum _{r=1}^{n}\left(rf\left(r\right)-\left(r-1\right)f\left(r-1\right)\right)-\sum _{r=1}^{n}f\left(r-1\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =n\cdot f\left(n\right)-0\cdot f\left(0\right)-\left(f\left(0\right)+f\left(1\right)+\cdots +f\left(n-1\right)\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =-\left(f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)\right)+\left(n+1\right)f\left(n\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Note that we can write $r=⌊t⌋+1$ in the integral, so that after rearranging we have

 $f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)=\left(n+1\right)f\left(n\right)-{\int }_{0}^{n}\left(⌊t⌋+1\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$ (2)

Next, by integration by parts we have

 ${\int }_{0}^{n}t{f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt=n\cdot f\left(n\right)-{\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt.$ (3)

Then solving for $nf\left(n\right)$ in (2) and substituting it into (3), obtain

$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+f\left(n\right)-{\int }_{0}^{n}\left(-t+⌊t⌋+1\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt.$

Take the last term and rearrange it as

$-{\int }_{0}^{n}\left(-t+⌊t⌋+1\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt={\int }_{0}^{n}\left(t-⌊t⌋-1∕2-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

and finally use the Fundamental Theorem of Calculus on the last term. Thus

$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\left(f\left(n\right)+f\left(0\right)\right)∕2+{\int }_{0}^{n}\left(t-⌊t⌋-1∕2\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt.$

or equivalently using the definition of ${B}_{1}\left(t\right)$

$f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)={\int }_{0}^{n}f\left(t\right)\phantom{\rule{0em}{0ex}}dt+\frac{1}{2}\left(f\left(0\right)+f\left(n\right)\right)+{\int }_{0}^{n}{B}_{1}\left(t\right){f}^{\prime }\left(t\right)\phantom{\rule{0em}{0ex}}dt$

Lemma 3.

$log\left(n!\right)=\left[\left(n+\frac{1}{2}\right)log\left(n\right)-n+1\right]+{\int }_{1}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx-{ϵ}_{n}$

where

${ϵ}_{n}={\int }_{n}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$

and ${ϵ}_{n}\to 0$ as $n\to \infty$.

Proof. Using Lemma 2 with $f\left(x\right)=log\left(1+x\right)$ on $\left[0,n-1\right]$

$log\left(1\right)+log\left(2\right)+\cdots +log\left(n\right)={\int }_{0}^{n-1}log\left(1+x\right)\phantom{\rule{0em}{0ex}}dx+\frac{1}{2}\left(log\left(1\right)+log\left(n\right)\right)+{\int }_{0}^{n-1}\frac{{B}_{1}\left(x\right)}{1+x}\phantom{\rule{0em}{0ex}}dx.$

After rearranging and the change of variables $y=1+x$ on the last integral this becomes

$log\left(n!\right)=nlog\left(n\right)-n+1+\frac{1}{2}log\left(n\right)+{\int }_{1}^{n}\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx.$

Looking back at the definition ${B}_{1}\left(x\right)=x-⌊x⌋-1∕2$, we can regard ${\int }_{1}^{n}\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$ as the sum of the first $2\left(n-1\right)$ terms of an alternating series with terms of decreasing magnitude. Hence ${\int }_{1}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$ converges. Then we can write

$log\left(n!\right)=nlog\left(n\right)-n+1+\frac{1}{2}log\left(n\right)+{\int }_{1}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx-{ϵ}_{n}$

where

${ϵ}_{n}={\int }_{n}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$

and ${ϵ}_{n}\to 0$ as $n\to \infty$. □

Lemma 4 (Wallis’ Formula).

$\underset{n\to \infty }{lim}\frac{{2}^{4n}\cdot {\left(n!\right)}^{4}}{{\left(\left(2n\right)!\right)}^{2}\left(2n+1\right)}=\frac{\pi }{2}$

Proof. See the proofs in Wallis Formula.. □

Theorem 5 (Stirling’s Formula).

$log\left(n!\right)=\left(n+\frac{1}{2}\right)log\left(n\right)-n+log\left(\sqrt{2\pi }\right)-{\int }_{n}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$

or equivalently

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

as $n\to \infty$.

Proof. For convenience, let

$J={\int }_{1}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx.$

Start with Wallis’ Formula and take logarithms, also use Lemma 3 on the factorials:

Expand, gather and cancel like terms and obtain

$log\left(n\right)+2+2J-4{ϵ}_{n}-log\left(2\right)-2{ϵ}_{2n}-log\left(2n+1\right)\to log\left(\frac{\pi }{2}\right)$

Note that $-log\left(2n+1\right)-log\left(n\right)=-log\left(2+1∕n\right)\to -log\left(2\right)$ as $n\to \infty$ so

$2+2J=log\left(2\pi \right)$

and rearranging $J=log\left(\sqrt{2\pi }\right)-1$.

Therefore, from Lemma 3 we can write

$log\left(n!\right)=\left(n+\frac{1}{2}\right)log\left(n\right)-n+log\left(\sqrt{2\pi }\right)-{\int }_{n}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx$

which after exponentiation can be written in the more familiar form:

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

Corollary 1 (Error Estimate on Stirling’s Formula).

$0

or equivalently

$\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}

Remark. This estimate is not as strong as

$\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n+1\right)}

quoted above in equation (1).

Proof. The proof makes the estimate on

${ϵ}_{n}={\int }_{n}^{\infty }\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx.$

${ϵ}_{n}=\sum _{r=n}^{\infty }\left({ϵ}_{r}-{ϵ}_{r+1}\right)$

and then estimate

$\begin{array}{llll}\hfill {ϵ}_{r}-{ϵ}_{r+1}& ={\int }_{r}^{r+1∕2}\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx+{\int }_{r+1∕2}^{r+1}\frac{{B}_{1}\left(x\right)}{x}\phantom{\rule{0em}{0ex}}dx\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =-{\int }_{1∕2}^{0}\frac{{B}_{1}\left(r+1∕2-y\right)}{r+1∕2-y}\phantom{\rule{0em}{0ex}}dy+{\int }_{0}^{1∕2}\frac{{B}_{1}\left(r+1∕2+z\right)}{r+1∕2+z}\phantom{\rule{0em}{0ex}}dz\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & ={\int }_{0}^{1∕2}\frac{{B}_{1}\left(1∕2-y\right)}{r+1∕2-y}+\frac{{B}_{1}\left(1∕2+y\right)}{r+1∕2+y}\phantom{\rule{0em}{0ex}}dy\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & ={\int }_{0}^{1∕2}\frac{-y}{r+1∕2-y}+\frac{y}{r+1∕2+y}\phantom{\rule{0em}{0ex}}dy\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =-2{\int }_{0}^{1∕2}\frac{{y}^{2}}{{\left(r+1∕2\right)}^{2}-{y}^{2}}\phantom{\rule{0em}{0ex}}dy\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Therefore

$\begin{array}{llll}\hfill -{ϵ}_{n}& =\sum _{r=n}^{\infty }{\int }_{0}^{1∕2}\frac{2{y}^{2}}{{\left(r+1∕2\right)}^{2}-{y}^{2}}\phantom{\rule{0em}{0ex}}dy\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & <\sum _{r=n}^{\infty }{r}^{-2}{\int }_{0}^{1∕2}2{y}^{2}\phantom{\rule{0em}{0ex}}dy\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & =\frac{1}{12}\sum _{r=n}^{\infty }{r}^{-2}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$

Now

${r}^{-2}<{\left({r}^{2}-\frac{1}{4}\right)}^{-1}={\left(r-\frac{1}{2}\right)}^{-1}-{\left(r+\frac{1}{2}\right)}^{-1}$

so

$\begin{array}{llll}\hfill 0<-{ϵ}_{n}& <\frac{1}{12}\sum _{r=n}^{\infty }{\left(r-\frac{1}{2}\right)}^{-1}-{\left(r-\frac{1}{2}\right)}^{-1}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & <\frac{1}{12}{\left(n-\frac{1}{2}\right)}^{-1}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill & \phantom{\rule{2em}{0ex}}& \hfill \end{array}$

#### Sources ### Problems to Work for Understanding

1. Make a table of values of $n!$, $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}$, $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n+1\right)}$ and $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n\right)}$ for $n$ from $1$ to $15$. Compute the relative error between $n!$ and $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n}$ for each value of $n$. Likewise compute the relative error between $n!$ and $\sqrt{2\pi }{n}^{n+1∕2}{e}^{-n+1∕\left(12n\right)}$ for each value of $n$.
2. Using a computer algebra system compute $100!$ and the Stirling’s Formula approximation. Calculate the absolute error and the relative error between the two values.
3. Show that
$\sum _{r=1}^{n}r\left(f\left(r\right)-f\left(r-1\right)\right)=-\left(f\left(0\right)+f\left(1\right)+\cdots +f\left(n\right)\right)+\left(n+1\right)f\left(n\right)$

by using “summation by parts”.

4. Establish and prove the Trapezoidal Approximation and its error for approximating ${\int }_{a}^{b}f\left(t\right)\phantom{\rule{0em}{0ex}}dt$ given the function values at $a={x}_{0},{x}_{1},{x}_{2},\dots ,{x}_{n}=b$ where ${x}_{i}-xi-1=h=\left(b-a\right)∕n$ uniformly for all $i$.
5. Show that
$\frac{{2}^{4n}\cdot {\left(n!\right)}^{4}}{{\left(\left(2n\right)!\right)}^{2}\left(2n+1\right)}=\frac{2\cdot 2\cdot 4\cdot 4\cdot 6\cdot 6\dots \left(2n\right)\cdot \left(2n\right)}{1\cdot 3\cdot 3\cdot 5\cdot 5\dots \left(2n-1\right)\cdot \left(2+1\right)}.$

__________________________________________________________________________ ### References

   P. Diaconis and D. Freedman. An elmentary proof of Stirling’s formula. American Mathematical Monthly, 93:123–126, 1986.

   John Todd. Introduction to the Constructive Theory of Functions. Academic Press, 1963.

__________________________________________________________________________ __________________________________________________________________________

I check all the information on each page for correctness and typographical errors. Nevertheless, some errors may occur and I would be grateful if you would alert me to such errors. I make every reasonable effort to present current and accurate information for public use, however I do not guarantee the accuracy or timeliness of information on this website. Your use of the information from this website is strictly voluntary and at your risk.

I have checked the links to external sites for usefulness. Links to external websites are provided as a convenience. I do not endorse, control, monitor, or guarantee the information contained in any external website. I don’t guarantee that the links are active at all times. Use the links here with the same caution as you would all information on the Internet. This website reflects the thoughts, interests and opinions of its author. They do not explicitly represent official positions or policies of my employer.

Information on this website is subject to change without notice.