36 1. Preparatory material

which by Taylor expansion leads to the approximation

m+1

m

log x dx =

1

2

log m +

1

2

log(m + 1) +

m

for some error

m

=

O(1/m2).

The error is absolutely convergent; by the integral test, we have

∑n

m=1

m

= C + O(1/n) for some absolute constant C :=

∑∞

m=1

m. Performing this

sum, we conclude that

n

1

log x dx =

n−1

m=1

log m +

1

2

log n + C + O(1/n)

which after some rearranging leads to the asymptotic

(1.47) n! = (1 +

O(1/n))e1−C

√

nnne−n,

so we see that n! actually lies roughly at the geometric mean of the two

bounds in (1.46).

This argument does not easily reveal what the constant C actually is

(though it can in principle be computed numerically to any specified level

of accuracy by this method). To find this out, we take a different tack,

interpreting the factorial via the Gamma function Γ : R → R as follows.

Repeated integration by parts reveals the

identity10

(1.48) n! =

∞

0

tne−t

dt.

So to estimate n!, it suﬃces to estimate the integral in (1.48). Elementary

calculus reveals that the integrand

tne−t

achieves its maximum at t = n, so

it is natural to make the substitution t = n + s, obtaining

n! =

∞

−n

(n +

s)ne−n−s

ds

which we can simplify a little bit as

n! =

nne−n

∞

−n

(1 +

s

n

)ne−s

ds,

pulling out the now-familiar factors of

nne−n. We combine the integrand

into a single exponential,

n! =

nne−n

∞

−n

exp(n log(1 +

s

n

) − s) ds.

From Taylor expansion we see that

n log(1 +

s

n

) = s −

s2

2n

+ . . . ,

10The

right-hand side of (1.48), by definition, is Γ(n + 1).