Steven R. Dunbar
Department of Mathematics
203 Avery Hall
University of Nebraska-Lincoln
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 from Wallis’ Formula and the Trapezoidal Approximation

_______________________________________________________________________

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

Rating

Mathematically Mature: may contain mathematics beyond calculus with proofs.

_______________________________________________________________________________________________

Section Starter Question

Section Starter Question

Can you summarize the steps in the “classical” proof of Stirling’s Formula using the Euler-Maclaurin Formula? That is, where does the proof start, what happens next, and what approximations and limits are used in the proof? Can you speculate why the proof is organized in this way?

_______________________________________________________________________________________________

Key Concepts

Key Concepts

  1. The Trapezoidal Approximation for the integral of a function f such that the second derivative exists for all x [a,b] is
    abf(t) dtf(a) + f(b) 2 (b a) = f(c) 12 (b a)3

    for some c [a,b].

  2. Stirling’s Formula as an asymptotic limit follows from Wallis’ Formula and elementary manipulations that can be estimated using the Trapezoidal Approximation.

__________________________________________________________________________

Vocabulary

Vocabulary

  1. The Trapezoidal Approximation for the integral of a function f such that the second derivative exists for all x [a,b] is
    abf(t) dtf(a) + f(b) 2 (b a) = f(c) 12 (b a)3

    for some c [a,b].

__________________________________________________________________________

Mathematical Ideas

Mathematical Ideas

The Proof of Stirling’s Formula as an Asymptotic Limit

Lemma 1 (Trapezoidal Approximation with Error Term). If f is a function such that the second derivative exists for all x [a,b] then

abf(t) dtf(a) + f(b) 2 (b a) = f(c) 12 (b a)3

for some c [a,b].

Proof. Define the constant K by

abf(t) dtf(a) + f(b) 2 (b a) = K (b a)3.

Then the function

F(x) =axf(t) dtf(a) + f(x) 2 (x a) K (x a)3

satisfies F(a) = F(b) = 0. Apply Rolle’s Theorem to F(x) to conclude that for some t (a,b) the derivative

F(x) = f(x) f(x) 2 (x a) f(a) + f(x) 2 3K (x a)2

is zero, F(t) = 0. Furthermore F(a) = 0, so applying Rolle’s Theorem again, there is some c (a,t) with F(c) = 0. That is,

F(c) = 0 = f(c) 2 (c a) 6K (c a)

so solving for K gives K = f(c) 12 . □

Remark. This version of the Trapezoidal Approximation is more general and more refined than Lemma 1 in Stirlings Formula by Euler-Maclaurin Summation.. The estimate there is only an upper bound on the error over the unit interval [r 1,r] proved using a Taylor polynomial approximation. Numerical analysis texts usually derive the Trapezoidal Approximation and the error estimate by linear interpolation through the endpoints of integration, also known as Lagrange Interpolation, or the Newton-Cotes formula.

Lemma 2.

(n!)2 (2n)! π n 22n (1)

as n .

Proof. This asymptotic limit follows easily from the asymptotic expression for the central binomial term, see Wallis’ Formula.. The details are left as an exercise. □

If we multiply the left hand side of (1) with (2n)! n! , we get n!, the object of our attention. Rewrite (2n)! n! as

(2n)! n! = (2n)(2n 1)(n + 1) = nn 1 + n n 1 + n 1 n 1 + 1 n.  (2)

Take the logarithm of the bracketed product in (2) and then rewrite to obtain

log 1 + n n + log 1 + n 1 n + + log 1 + 1 n = n 1 n log 1 + n n + 1 n log 1 + n 1 n + + 1 n log 1 + 1 n (3) n12 log xdx = n(2 log 2 1).

Recognizing the second line (3) as a right-box Riemann sum written in reverse order we have discovered the way to approach Stirling’s Formula.

Write the trapezoidal approximation of 12 log xdx on the partition {x0 = 1,x1 = 1 + 1n,x3 = 1 + 2n,,xn = 1 + nn = 2} as

1 2n log 1 + 1 n log 1 + 1 n + 1 n log 1 + 2 n + + 1 n log 1 + n 1 n + 1 2n log 2. (4)

This trapezoidal approximation differs from the sum in brackets in (3) by only 1 2n log 2 since log 1 is zero. The limit of expression (4) is still 12 log xdx = 2 log 2 1, but we can bound the error with Lemma 1.

(2 log 2 1) 1 2n log 1 + 1 n log 1 + 1 n + + 1 n log 1 + n 1 n + 1 2n log 2 = j=1n 1 12cj2 1 n3.

The difference is positive since log(x) is concave-down. Since f(x) = 1x2 is bounded above by 1 on [1, 2], we can uniformly estimate the upper bound so

0 (2 log 2 1) 1 2n log 1 + 1 n log 1 + 1 n + + 1 n log 1 + n 1 n + 1 2n log 2 1 12n2.

Now use log 1 = 0 and using knowledge of what Stirling’s Formula should look like, add in and subtract out 1 2n log 2 and rewrite the last summand to obtain

0 (2 log 2 1) 1 n log 1 + 1 n + + 1 n log 1 + n n 1 2n log 2 1 12n2.

Multiply by n and rearrange the result:

0 n(2 log 2 1) + 1 2 log 2 log 1 + 1 n 1 + 2 n 1 + n n 1 12n

Exponentiate both sides and taking the limit as n gives

1 + n n 1 + n 1 n 1 + 1 n en(2 log 21)+log 22

Multiply by nn and rewrite the right side to get the asymptotic estimate for equation (2)

(2n)! n! 22nnn2 en ,n . (5)

Recall from equation (1) in Lemma 2 that

(n!)2 (2n)! π n 22n

and apply the Multiplication II Lemma from Asymptotic Limits. to this asymptotic limit to get

n! (2n)! n! nπ 22n .

Then put this together with the asymptotic limit (5) and use the Substitution Lemma from Asymptotic Limits. to finally obtain Stirling’s Formula:

n! nn+12 en 2π.

Discussion

The classic proof of Stirling’s Formula starts with log(n!) = j=1n log(j). The classic proof expresses this as 0n1 log(1 + x) dx with an error term with the Euler-Maclaurin summation formula. The Euler-Maclaurin summation formula is an adaptation of the Trapezoidal Approximation. (Alternatively, the Euler-Maclaurin summation formula is a result of the Fundamental Theorem of Calculus, summation by parts, and integration by parts.) This allows us to write

log(n!) = n log(n) n + 1 + 1 2 log(n) +1B1(x) x dxϵn (6)

where

ϵn =nB1(x) x dx

and ϵn 0 as n . Then start from Wallis’ Formula and take logarithms, replacing the logarithms of the factorials with equation (6). This provides an equation for the integral 1B1(x) x dx which is solved for the value log(2π) 1. Then the equation above can be exponentiated to express Stirling’s Formula.

The present proof of Stirling’s Formula starts from Wallis’ Formula in the form of an asymptotic estimate for the central binomial term (n!)2(2n)!. Isolate n! on one side of the central binomial term asymptotic estimate and write the other part (2n)!n! as a Riemann sum for n12 log xdx. The present proof then uses the Trapezoidal Rule to express the approximation for

(2n)! n! = (2n)(2n 1)(n + 1) = nn 1 + n n 1 + n 1 n 1 + 1 n.

with an error term. Then the proof combines this with the asymptotic form of Wallis Formula to produce the asymptotic form of Stirling’s Formula. The present proof cannot be immediately adapted to give Stirling’s Formula with an error estimate because an essential step is to use Wallis’ Formula as an asymptotic limit and we do not have a error estimate on that limit.

The present proof uses the same ingredients of the Trapezoidal Rule and Wallis Formula as the Euler-Maclaurin proof, but uses them in reverse order and in somewhat different ways.

Sources

This section is adapted from the short article [1] by Paul Levrie in the June 2011 issue of Mathematics Magazine.

_______________________________________________________________________________________________

Problems to Work

Problems to Work for Understanding

  1. Show that
    (n!)2 (2n)! π n 22n

    as n .

__________________________________________________________________________

Books

Reading Suggestion:

References

[1]   Paul Levrie. Stirred, not shaken, by Stirling’s Formula. Mathematics Magazine, 84(3):208–211, June 2011.

__________________________________________________________________________

Links

Outside Readings and Links:

__________________________________________________________________________

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.

Steve Dunbar’s Home Page, http://www.math.unl.edu/~sdunbar1

Email to Steve Dunbar, sdunbar1 at unl dot edu

Last modified: Processed from LATEX source on October 10, 2011