Many probability calculations involve factorials. As discussed in Section 6.2, factorials are often hard to work with. This section introduces a method for approximating factorials using simpler functions. These approximations make it easier to answer questions like, “how big is ?”, or "how big is ?", when and are large.
Consider the definition of the factorial:
This product involves terms. The early terms all are of size . So, to a very rough approximation, . Clearly since all of the terms in the product except the first are less than . Half are larger than and half are smaller, so a better approximation is . Stirling’s approximation provides an accurate estimate for using a function roughly of the form .
Stirling’s approximation is remarkably accurate, even for relatively small . Here’s a table comparing values. The values for the approximation have been rounded to the tenth’s place.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|
| 1 | 2 | 6 | 24 | 120 | 720 | ||
| Stirling | 0.9 | 1.9 | 23.5 | 710.1 |
Notice that, while the absolute error in the approximation grows as increases, the relative error is vanishing. The table below provides the errors, printed to their first significant figure.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|
| Abs. Error: | 0.08 | 0.08 | 0.2 | 0.5 | 2.0 | 10 | 60 |
| Rel. Error: | 0.08 | 0.04 | 0.03 | 0.02 | 0.02 | 0.01 | 0.01 |
Stirling’s approximation has less than a 2% error for , and less than a 1% error for .