Neglect $1/2 \ln(2\pi n)$ in Stirlings approximation formula, but this term is not bounded or gets smaller, but larger

441 Views Asked by At

One form of Stirlings approximation reads $$ \ln(n!) \approx n\ln(n) - n + \frac{1}{2} \ln(2\pi n) $$ another $$ \ln(n!) \approx n\ln n - n. $$ But thats makes me wonder, for the difference of both is $\frac{1}{2}\ln(2\pi n)$, which gets arbitrary large (surely very slow, but it is not bounded...), so the error between both approximations gets larger and larger for $n \to \infty$, but it is not the point of an approximation formula to give a lower error for $n \to \infty$?

So, in what sense is the second approximation valid, when the difference between both terms nonetheless becomes larger and larger for $n\to \infty$? Could anybody please explain this to me?

4

There are 4 best solutions below

4
On BEST ANSWER

This is called an asymptotic expansion.

Since you have $$\frac{\ln(n!)}{n\ln(n)}\xrightarrow[n\to\infty]{} 1,$$

$n\ln(n)$ is a valid approximation for $\ln(n!)$.

You actually have that the error goes to $0$ at the speed $\frac 1{\ln(n)}$ which is very slow.

So if you want a better approximation, you can notice that

$$\frac{\ln(n!)}{n\ln(n)-n}\xrightarrow[n\to\infty]{} 1,$$

and the error goes to $0$ at the speed $\frac {1/2 \ln(2\pi n)}{n\ln(n)-n}$ which is better already.

And so on... you will always have better approximations as the error goes to $0$ faster and faster.

4
On

The exact formula should read as $\;\ln(n!) \color{red}{\sim_\infty} n\ln(n) - n + \frac{1}{2} \ln(2\pi n)$ or $\;\ln(n!) \color{red}{\sim_\infty} n\ln(n) - n $, in the sense of equivalence of functions, not of numerical approximation.

It simply means the ratio of the functions tends to $1$ as $n$ tends to $\infty$, not that the functions tend to have the same value. Rather, it means the functions tend to have the same relative value. For a classic example, consider the equivalent functions $n$ and $n+\sqrt n $.

0
On

Stirling's approximation is an asymptotic approximation for $n! $ which is expressed by the limit formula $$\lim_{n\to\infty} \frac{n!} {(n/e) ^{n} \sqrt{2\pi n}} =1$$ In general we say that $g(n) $ is an asymptotic approximation for $f(n) $ as $n\to\infty$ if $f(n) /g(n) \to 1$ as $n\to\infty$. Naturally this works by comparing ratios and hence the focus is on minimizing the relative error.

But by taking logs we can see that if $g(n) $ is an asymptotic approximation for $f(n) $ then $\log g(n) $ is the usual approximation for $\log f(n) $ where focus is on minimizing absolute error.

So when we use the Stirling approximation for evaluating $n! $ then we are using an asymptotic approximation which is not very accurate, but when we are using it to evaluate $\log n! $ then it is a very accurate approximation. Your second approximation for $\log n! $ is an asymptotic approximation and not the numerical approximation.

It is possible to improve the Stirling approximation (for example multiply by factor $(1+1/12n)$) so that we get very good results for $n! $ for even very small values of $n$ and yet it remains an asymptotic approximation and not the usual one.

0
On

Instead of using the "$\approx$" sign version of the Stirlings formula $$\ln(n!) \approx n\ln(n) - n + \frac{1}{2} \ln(2\pi n)\tag{1A},$$

One friend of mine suggested to use the following "=" sign version of the Stirlings formula.

There exists a positive constant $M$ and a real function $\epsilon(n)\in (-1,1)$ such that

$$\ln(n!) = \left(n\ln(n) - n + \frac{1}{2} \ln(2\pi n)\right)\left(1+\frac{\epsilon(n)M}{n}\right)\tag{1B}$$ holds for all $n>3$.

I myself found out that this version is easier to use because we always explicitly carry the "error" term in the subsequent manipulation. The only uncertain quantity in the calculation is $\epsilon(n)\in(-1,1)$ which is bounded. Because we always use the $=$ sign instead of the $\approx$ sign in the subsequent manipulation, we will not accidentally miscalculate the final error term.