Stirling’s Approximation: A Powerful Tool to Approximate Factorials

Arpita Bhattacharya
5 min readApr 14, 2023

--

Have you ever wondered how to quickly approximate the factorial of a large number? The solution lies in the charms of Stirling’s approximation. This powerful formula can accurately estimate the value of n! for large values of n, making it an invaluable tool in fields ranging from physics to computer science.

In this article, we’ll dive into the details of Stirling’s approximation and explore what it is, a simple derivation of this important mathematical tool and discuss the accuracy of the approximation. So, get comfortable with a cup of coffee and we shall begin.

Stirling’s approximation is a mathematical formula that provides an approximation for factorials. It is named after James Stirling, who first published a related but less precise result. Stirling’s approximation is given by the formula,

where n is a large number.

This approximation is useful in many areas of mathematics and science, where factorials of large numbers need to be calculated.

A student-friendly derivation

Stirling’s approximation to n! can be difficult to calculate directly. So, let’s derive it in a ‘student-friendly’ manner, that is, a derivation that can be easily understood by fresh undergraduate students.

We start with the definition of the factorial function:

We can approximate this product by taking the logarithm of both sides and using the fact that the logarithm is a monotonically increasing function:

Next, we use the fact that the sum of the logarithms is equal to the logarithm of the product:

Now, we approximate the sum by an integral:

This integral can be evaluated using integration by parts:

Therefore, we have,

Finally, we exponentiate both sides to get Stirling’s approximation:

For greater values of n, this approximation is accurate.

In summary, Stirling’s approximation to n! can be derived by approximating the sum of the logarithms of the integers from 1 to n by an integral, evaluating the integral using integration by parts, and exponentiating both sides. The approximation can also be obtained by using the Stirling series, which is a more precise but more complicated formula.

How accurate is the Stirling’s approximation?

Stirling’s approximation to n! is an accurate approximation, leading to positive results. However, for small values of n, the approximation can be quite inaccurate. For example, when n = 1, the approximation is not accurate. The approximation becomes more accurate as n increases.

The range of values of n for which Stirling’s approximation is accurate depends on the desired level of accuracy. However, in general, Stirling’s approximation becomes more accurate as n increases. The more precise form of Stirling’s approximation is,

which is accurate to within 1% for N as small as 10 and becomes more accurate as N increases. For very large values of N, the approximation can be computed using the logarithm of N! via,

One way of stating the approximation involves, the relative error in a truncated Stirling series versus the number of terms used. The error in the truncated series is asymptotically equal to the first omitted term. This is an example of an n → ∞ asymptotic expansion. Stirling’s approximation is an asymptotic expansion, which means that it is not a convergent series, and for any particular value of n, there are better approximations that can be used.

However, Stirling’s approximation is primarily used for large values of n, where it provides an accurate approximation.

The accuracy of the approximation can be improved by using higher-order terms in the expansion. For example, introducing the second-order Stirling approximation can improve the accuracy of the approximation for small values of n.

In conclusion, Stirling’s approximation provides a powerful tool for approximating the factorial of large numbers with a high degree of accuracy. Despite its limitations for small values of n, the approximation rapidly improves as n increases, making it ideal for applications in fields such as statistics, physics, and engineering. While there are alternative methods for approximating factorials, Stirling’s formula is widely used due to its simplicity and ease of use. It has played a significant role in the development of various mathematical theories and has found practical applications in numerous fields. Therefore, Stirling’s approximation is an invaluable tool for mathematicians, scientists, and engineers, providing a simple and accurate means of approximating factorials for a wide range of applications.

--

--

Arpita Bhattacharya
Arpita Bhattacharya

Written by Arpita Bhattacharya

23 | Masters in Math from Lund University, Sweden | Undergraduate from Warwick Uni, UK | STEM Enthusiast |

Responses (2)