Stirling's Approximation Formula

Last Updated : 23 Jul, 2025

Stirling's Approximation Formula: It is a powerful mathematical tool used to estimate the factorial of large numbers. Factorials, represented by n!, are the product of all positive integers up to a given number n for example 5! = 5×4×3×2×1 = 120.

Stirling's approximation provides a formula for approximating the natural logarithm of a factorial, expressed as ln⁡(n!) = n ln⁡(n) - n. This approximation improves in accuracy as the number n increases.

Factorial of a non-negative integer n is approximated as

n!≈\sqrt{2πn}[\frac{n}{e}]^n

Applications of Stirling's Approximation Formula

  • The value of factorials grow very fast. With the help of this formula, we get an approximate idea.
  • It helps us in finding the order of growth of factorial. We know ln⁡(n!) = n ln⁡(n) - n. From this, we can conclude that the growth of Log (n!) with n is bounded by n Log n. Wen we find lower bound on time taken by comparison based sorting, we get the term and find a lower bound as n Log n

Solved Examples on Stirling's Approximation Formula

Problem 1: Use the Stirling Formula to find the value of 6! and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 6.

⇒ 6!=\sqrt{2\timesπ\times6}[\frac{6}{e}]^6

= 719.19

As 6! = 720, the Stirling formula gives an error of 0.11% .

Problem 2: Find the value of 11! using the Stirling formula and then calculating the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 11.

⇒ 11!=\sqrt{2\timesπ\times11}[\frac{11}{e}]^{11}

= 39615625.05

As 11! = 39916800, the Stirling formula gives an error of 0.75% .

Problem 3: Find 13! using Stirling Formula and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 13.

⇒ 13!=\sqrt{2\timesπ\times13}[\frac{13}{e}]^{13}

= 6187239475.19

As 13! = 6227020800, the Stirling formula gives an error of 0.63% .

Problem 4: Find 5! using Stirling Formula and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 5.

⇒ 5!=\sqrt{2\timesπ\times5}[\frac{5}{e}]^{5}

= 118.96

As 5! = 120, the Stirling formula gives an error of 0.86% .

Problem 5: Find 7! using Stirling Formula and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 7.

⇒ 7!=\sqrt{2\timesπ\times7}[\frac{7}{e}]^{7}

= 4980.39

As 7! = 5040, the Stirling formula gives an error of 1.18% .

Problem 6: Find 9! using Stirling Formula and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 9.

⇒ 9!=\sqrt{2\timesπ\times9}[\frac{9}{e}]^{9}

= 359536.87

As 9! = 362880, the Stirling formula gives an error of 0.92% .

Problem 7: Find 3! using Stirling Formula and then calculate the error difference.

Solution:

As per Stirling formula, n!≈\sqrt{2πn}[\frac{n}{e}]^n

Here n = 3.

⇒ 3!=\sqrt{2\timesπ\times3}[\frac{3}{e}]^{3}

= 5.84

As 3! = 6, the Stirling formula gives an error of 2.67% .

Accuracy and Limitations

Stirling's Approximation is highly accurate for large n, but it is not exact. The relative error of the approximation decreases as n increases, making it a valuable tool for approximations in practical applications. However, for small values of n, the approximation can be less accurate, and exact factorial computation is preferred.

DSA Implementation

Python
import math

def stirling_approximation(n):
    # Stirling's approximation formula
    return math.sqrt(2 * math.pi * n) * (n / math.e) ** n

# Example usage
n = 10
approximation = stirling_approximation(n)
exact = math.factorial(n)

print(f"Stirling's Approximation for {n}! : {approximation}")
print(f"Exact factorial for {n}!: {exact}")
print(f"Relative error: {abs((approximation - exact) / exact) * 100:.6f}%")

Output
Stirling's Approximation for 10! : 3598695.6187410373
Exact factorial for 10!: 3628800
Relative error: 0.829596%

Conclusion

Stirling's Approximation Formula is a remarkable mathematical result that simplifies the computation of large factorials. Its derivation involves elegant techniques from calculus, and its applications span a wide range of disciplines. While it is not exact, its accuracy improves with larger n, making it an indispensable tool in both theoretical and applied mathematics. Whether you're working in probability, combinatorics, or physics, understanding and using Stirling's Approximation can greatly simplify your calculations.

Important Maths Related Links:

Comment

Explore