Вы находитесь на странице: 1из 5

STIRLINGS FORMULA

KEITH CONRAD
Our goal is to prove the following asymptotic estimate for n! due to Stirling (1730).
Theorem 1. As n , n!
n
n
e
n

2n. That is, lim


n
n!
(n/e)
n

2n
= 1.
We will rst show n! (n
n
/e
n
)

nC for some unknown constant C. In this form, the


estimate for n! was found by de Moivre. Stirling identied the constant C as precisely

2.
We start by computing log n! using summation by parts:
log n! =
n

k=1
log k
=
n

k=1
u
k
(v
k
v
k1
) (where u
k
= log k and v
k
= k)
= u
n
v
n
u
1
v
0

n1

k=1
v
k
(u
k+1
u
k
)
= nlog n
n1

k=1
k(log(k + 1) log k)
= nlog n
n1

k=1
k log
_
1 +
1
k
_
. (1)
We now expand log(1 + 1/k) into a series in 1/k and carefully truncate the sum. Recall
for 0 < x 1 that
log(1 + x) = x
x
2
2
+
x
3
3

x
4
4
+ ,
which is an alternating series because x > 0. Taking x = 1/k for a positive integer k,
log
_
1 +
1
k
_
=
1
k

1
2k
2
+
1
3k
3

1
4k
4
+ ,
so
k log
_
1 +
1
k
_
= 1
1
2k
+
1
3k
2

1
4k
3
+ .
Since the series is alternating, k log(1 + 1/k) lies between the second and third truncation:
1
1
2k
< k log
_
1 +
1
k
_
< 1
1
2k
+
1
3k
2
.
Therefore we can write
k log
_
1 +
1
k
_
= 1
1
2k
+ b
k
, 0 < b
k
<
1
3k
2
.
1
2 KEITH CONRAD
Substituting this into (1),
log n! = nlog n
n1

k=1
_
1
1
2k
+ b
k
_
= nlog n (n 1) +
1
2
n1

k=1
1
k

n1

k=1
b
k
.
Because 0 < b
k
< 1/3k
2
, the innite series

k1
b
k
converges by the comparison test. Call
the sum B, so

n1
k=1
b
k
= B +
n
, where
n
0 as n . So
log n! = nlog n n + 1 +
1
2
n1

k=1
1
k
B
n
= nlog n n +
1
2
n

k=1
1
k
+ (1 B)
n

1
2n
, (2)
where we made n the upper bound of the sum by subtracting 1/2n from the overall value.
We focus our attention now on the behavior of

n
k=1
1/k as n . Intuitively, this sum
should behave like
_
n
1
dt/t = log n, so we expect the sum to have the same order of growth
as log n. Of course, having the same order of growth does not generally mean the sizes dier
by a bounded amount as n gets large: consider n
2
+ n and n
2
: their order of growth is the
same but (n
2
+ n) n
2
= n blows up with n. Yet for

n
k=1
1/k and log n it turns out the
dierence is bounded. In fact, the dierence

n
k=1
1/k log n converges! To see why, lets
give the dierence a name, say
a
n
=
n

k=1
1
k
log n.
We claim a
n
> 0 for every n. This comes from applying the inequality 1/k >
_
k+1
k
dt/t to
n

k=1
1
k
log n >
n

k=1
_
k+1
k
dt
t
log n =
_
n+1
1
dt
t
log n = log(n + 1) log n > 0.
Moreover, a
n
> a
n+1
for every n (that is, a
1
> a
2
> a
3
> ) since
a
n
a
n+1
=
_
n

k=1
1
k
log n
_

_
n+1

k=1
1
k
log(n + 1)
_
= log(n + 1) log n
1
n + 1
=
_
n+1
n
dt
t

1
n + 1
>
_
n+1
n
dt
n + 1

1
n + 1
= 0.
Thus a
n
> a
n+1
for all n.
STIRLINGS FORMULA 3
The sequence a
1
, a
2
, . . . is decreasing and always positive, so it must converge: call the
limit . There is no reason to expect = 0. In fact, .5772. (The number is called
Eulers constant.) Since a
n
=

n
k=1
1/k log n converges to as n , we can write
n

k=1
1
k
= log n + +
n
,
where
n
0 as n . Substituting this into (2) gives
log n! = nlog n n +
1
2
(log n + +
n
) + (1 B)
n

1
2n
= nlog n n +
1
2
log n +
_
1 B +

2
_

1
2n
+

n
2
.
Now take the exponential of both sides:
n! =
n
n
e
n

ne
1B+/2
e
n1/2n+n/2
.
As n ,
n
1/2n +
n
/2 0, so its exponential tends to 1. Therefore
(3) n!
n
n
e
n

nC,
where C = e
1B+/2
. We have derived Stirlings formula except for a calculation of the value
of C in terms of familiar numbers.
There are several ways of showing C =

2. Unfortunately, the most natural ways of


doing this involve material beyond the scope of rst-year calculus. There is a proof that
C =

2 using only elementary calculus, and we will follow that method. However, you will
see that it is a rather mysterious sequence of steps!
The main idea is (without motivation, sorry!) to look at the sequence of integrals
I
n
=
_

0
sin
n
x dx
and in particular compute I
n
/I
n+1
in two dierent ways as n : by estimates and
by explicit formulas. The formula C =

2 will follow from a comparison of the two


calculations.
The rst two values of I
n
are
I
0
= , I
1
= 2.
Using integration by parts we get a recursive formula for I
n
when n 2:
I
n
=
_

0
udv (u = sin
n1
x, dv = sin x dx)
= sin
n1
x cos x

0
+
_

0
(n 1) cos x sin
n2
x cos x dx
= (n 1)
_

0
sin
n2
x cos
2
x dx
= (n 1)
_

0
sin
n2
x(1 sin
2
x) dx
= (n 1)(I
n2
I
n
).
4 KEITH CONRAD
Thus nI
n
= (n 1)I
n2
, so
(4) I
n
=
n 1
n
I
n2
.
From the recursion (4) we will show I
n
/I
n+1
tends to 1 as n . Since sin x [0, 1] for
0 x , we have sin
n+1
x < sin
n
x when 0 < x < (except at x = /2, where sin x = 1).
Therefore I
n+1
< I
n
so these integrals are decreasing with n. Looking at three consecutive
integrals,
I
n+1
< I
n
< I
n1
,
so
1 <
I
n
I
n+1
<
I
n1
I
n+1
.
The indices n + 1 and n 1 dier by 2, so we can apply (4) with n + 1 in place of n to get
(5) 1 <
I
n
I
n+1
<
n + 1
n
= 1 +
1
n
.
Thus I
n
/I
n+1
1 as n .
Now we compute exact formulas for I
n
using (4) and the initial values at n = 0 and n = 1.
The following tables provide some values of I
n
separately for even n and for odd n.
n 0 2 4 6 8
I
n

1
2

3
4
1
2

5
6
3
4
1
2

7
8
5
6
3
4
1
2

n 1 3 5 7
I
n
2
2
3
2
4
5
2
3
2
6
7
4
5
2
3
2
The pattern is clear: for m 1,
I
2m
=
2m1
2m

2m3
2m2

3
4

1
2
,
and
I
2m+1
=
2m
2m + 1

2m2
2m1

4
5

2
3
2.
Both expressions involve a product of consecutive even numbers and a product of consecutive
odd numbers. Formulas for these parity products in terms of factorials are useful:
(2m)(2m2)(2m4) 4 2 = (2m)(2(m1))(2(m2)) (2 2) (2 1) = 2
m
m!
and
(2m1)(2m3) 3 1 =
(2m)!
(2m)(2m2)(2m4) 4 2
=
(2m)!
2
m
m!
.
Therefore
I
2m
=
(2m)!/2
m
m!
2
m
m!
=
(2m)!
2
2m
m!
2

and
I
2m+1
=
2
m
m!
(2m + 1)((2m)!/2
m
m!)
2 =
2
2m
m!
2
(2m)!

2
2m + 1
.
Taking the ratio,
(6)
I
2m
I
2m+1
=
(2m)!
2
2
4m
m!
4
(2m + 1)
2
.
STIRLINGS FORMULA 5
We took the ratio because we know it tends to 1 as m . We will feed (3) into the right
side of (6) and nd that from its limiting behavior the formula C =

2 will drop right out.


By (3), n!
2
C
2
n
2n+1
/e
2n
, so
(2m)!
2

C
2
(2m)
4m+1
e
4m
, m!
4

C
4
m
4m+2
e
4m
.
Thus
(2m)!
2
m!
4

C
2
(2m)
4m+1
e
4m

e
4m
C
4
m
4m+2
=
2
4m+1
C
2
m
,
so by (6)
I
2m
I
2m+1

1
2
4m

2
4m+1
C
2
m

(2m + 1)
2

2
C
2
as m . Thus 2/C
2
= 1, so C =

2. This completes our derivation of Stirlings


formula. It took us about 2 1/2 pages to get Stirlings formula (3) without an explicit
constant and then another 2 pages (total) to pin down the constant as

2.
Stirlings formula is useful whenever one meets large factorials and needs to make an
estimate. This happens in combinatorics, probability theory, chemistry (thermodynamics)
and physics (statistical mechanics, quantum mechanics). In chemistry n may be on the
order of Avogadros number 6.02 10
23
. Its worth noting that the crude estimate log n!
nlog nn, or the even rougher estimate log n! nlog n, which both follow from (3) without
the need to determine the constant C, is the way Stirlings formula is often used in chemistry
and physics.

Вам также может понравиться