Stirling’s approximation of n!

Since working with sums is easier than working with products, we take the logarithm base of both sides,

and try to find expressions for the lower and upper bounds, i.e.

getting a lower bound

integrating ln x

can be integrated by parts, with and the rest as :

Checking this by differentiating:

Plug in to find :

trapezoid rule approximation

To approximate the area under the curve, add the area of the trapezoids. Since the curve is concave downwards, this will underestimate the area.
Each trapezoid has an area of the average of the sides, times the width (1). i.e. the area of the trapezoid between and is . As all terms except the first and last occur twice in the sum, it comes to:

Since , add to both sides to get:

i.e.

Raise both sides to the power of (anti-log):

getting an upper bound

references

Richard Hamming – Methods of Mathematics, ch.15