STIRLING’S FORMULA

11. STIRLING’S FORMULA

Formulas involving n! or Γ(p) are not convenient to simplify algebraically or to differentiate. Here is an approximate formula for the factorial or Γ function known as Stirling’s formula which can be used to simplify formulas involving factorials:

(11.1) n! ∼ n p e −n √ 2πn

or Γ(p + 1) ∼ p e −p 2πp.

Stirling’s formula

The sign ∼ (read “is asymptotic to”) means that the ratio of the two sides

n! n −n n √ e 2πn

tends to 1 as n → ∞. Thus we get better approximations to n! as n becomes large. Actually the absolute error (difference between the Stirling approximation and the correct value) increases, but the relative error (ratio of the error to the value of n!) tends to zero as n increases. To get some idea of how this formula arises, we outline what could, with a little more detail, be a derivation of it. (For more detail, consult advanced calculus books.) Start with

(11.2) Γ(p + 1) = p ! =

x p e −x dx =

e p ln x−x dx.

Substitute a new variable y such that

x=p+y √ p.

Section 11 Stirling’s Formula 553

Then

√ dx = p dy,

√ x = 0 corresponds to y = − p,

and (11.2) becomes

p!=

√ e p ln(p+y√p )−p−y p − p dy. p

For large p, the logarithm can be expanded in the following power series:

y y 2 (11.4)

ln(p + y p ) = ln p + ln 1+ √

= ln p +

√ +···. p

2p Substituting (11.4) into (11.3), we get

p!∼ 2 e p ln p+y√p−(y /2)−p−y √ p √

The first integral is easily shown to be 2π (Problem 9.4). The second integral tends to zero as p → ∞, and we have

p! ∼ p p e −p 2πp

which is (11.1). With more work, it is possible to find an asymptotic expansion for Γ(p + 1):

288p 2 +··· . This is another example of an asymptotic series which is divergent as an infinite

series; however, the first term alone (Stirling’s formula) is a good approximation when p is large, and the second term can be used to estimate the relative error (Problem 1).

PROBLEMS, SECTION 11

1. Use the term 1/(12p) in (11.5) to show that the error in Stirling’s formula (11.1) is < 10% for p > 1; < 1% for p > 10; < 0.1% for p > 100; < 0.01% for p > 1000.

2. (a) To see the results in Problem 1 graphically, computer plot the percentage error in Stirling’s formula as a function of p for values of p from 1 to 1000. Make separate plots, say for p = 1 to 10, 10 to 100, 100 to 1000, to make it easier to read values from your plots.

(b) Repeat part (a) for the percentage error in (11.5) using two terms of the asymp- totic series, that is, Stirling’s formula times [1 + 1/(12p)].

554 Special Functions Chapter 11

3. In statistical mechanics, we frequently use the approximation ln N ! = N ln N − N, where N is of the order of Avogadro’s number. Write out ln N ! using Stirling’s

formula, compute the approximate value of each term for N = 10 23 , and so justify this commonly used approximation.

4. Use Stirling’s formula to evaluate lim (2n)! n n→∞

2 2n (n!) 2

Γ(n + 3

5. Use Stirling’s formula to evaluate lim √

n→∞

n Γ(n + 1)

“ Use equations (3.4) and (11.5) to show that Γ(p) ∼ p ” p2π/p 1+ 1 12p +··· . 7. The function ψ(p) = d dp ln Γ(p) is called the digamma function, and the polygamma

6. − p e p

d functions are defined by ψ n (p) = dp n ψ(p). [Warning: Some authors define ψ(p) as d ln p! = d

dp ln Γ(p + 1).] (a)

dp

Show that ψ(p + 1) = ψ(p) + 1 p . Hint: See (3.4).

(b) 1 Use Problem 6 to obtain ψ(p) ∼ ln p − 1

2p − 12p 2 · · ·.

8. Sketch or computer plot a graph of y = ln x for x > 0. Show that ln n! is between the R n+1 R n values of the integrals 2 ln x dx and 1 ln x dx. (Hint: ln n! = ln 1+ln 2+ln 3+· · · is the sum of the areas of rectangles of width 1 and height up to the ln x curve at x = 1, 2, 3, · · ·.) By considering the values of the two integrals for very large n as in Problem 3, show that ln n! = n ln n − n approximately for large n.

9. The following expression occurs in statistical mechanics:

n!

P=

p np+u q nq−u .

(np + u)! (nq − u)!

Use Stirling’s formula to show that

1 npx nqy

∼x

p2πnpqxy,

where x = 1 + np ,y=1−

, and p + q = 1. Hint: Show that

nq

(np) np+u (nq) nq−u =n n p np+u q nq−u

and divide numerator and denominator of P by this expression. 10. Use Stirling’s formula to find lim n→∞ (n!) 1/n /n.