The Stirling's approximation of the factorial function is defined as:

$$n! \sim \sqrt{2 \pi n} \left(\frac{n}{e}\right)^n$$

This Wikipedia's derivation starts by using the logarithm of $n!$

$$\ln n! = \ln 1 + \ln 2 + ... + \ln n$$

And then it says

The right-hand side of this equation minus

$${\displaystyle {\tfrac {1}{2}}(\ln 1+\ln n)={\tfrac {1}{2}}\ln n} $$

is the approximation by the trapezoid rule of the integral

$${\displaystyle \ln n!-{\tfrac {1}{2}}\ln n\approx \int _{1}^{n}\ln x\,{\rm {d}}x=n\ln n-n+1}$$


Before proceeding I of course need to understand every step, but I'm not understanding the text that I marked in bold.

What I understand from that statement is that we substract an equation, i.e. ${\displaystyle {\tfrac {1}{2}}(\ln 1+\ln n)={\tfrac {1}{2}}\ln n} $, from the right hand side of the previous equation, i.e. $\ln n! = \ln 1 + \ln 2 + ... + \ln n$, which is $\ln 1 + \ln 2 + ... + \ln n$. This does not make sense at all to me.

Could someone explain me what it's meant by that statement?

I must be honest, a great percentage of the times I don't understand something similar to this is because of the way things are explained in English, not because of the formulas. (Please, mathematicians, learn to write well!)

  • $\begingroup$ What exactly is unclear ? The trapezoid-rule states that the integral is approximately $1/2\ln(1)+\ln(2)+\ln(3)+\cdots+\ln(n-1) +1/2\ln(n)$ $\endgroup$ – Peter Aug 31 '16 at 17:44
  • $\begingroup$ There is nothing to learn on our side. The RHS of an equation is just what is written on the right of the equality sign, so the the RHS of the previous equation minus something has the obvious meaning: what is written in the right part of the previous line, minus something. $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:44
  • $\begingroup$ In our case, something is $\frac{1}{2}\left(\log(1)+\log(n)\right)$, that is $\frac{1}{2}\log n$. $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:46
  • 1
    $\begingroup$ No, because you do not subtract $\log(1)+\log(2)+\ldots+\log(n)$ from $\frac{1}{2}\log(n)$, you do the opposite. $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:47
  • 1
    $\begingroup$ What else The RHS of the previous equation minus three could mean?! $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:50

The trapezoid with base $[k,k+1]$ has area

$$\frac12\big(\ln k+\ln(k+1)\big)\;;$$

when you sum these over $k=1,\ldots,n-1$, you get

$$\frac12\ln 1+\ln 2+\ln 3+\ldots+\ln(n+1)+\frac12\ln n\;,$$

because every height except the first ($\ln 1$) and the last ($\ln n$) appears twice, once as the righthand height of a trapezoid and then again as the lefthand height of the next trapezoid. This is the same as

$$(\ln 1+\ln 2+\ldots+\ln n)-\left(\frac12\ln 1+\frac12\ln n\right)\;.$$

It doesn’t actually say that you’re subtracting an equation from an equation: it says that you’re subtracting the quantity $\frac12(\ln 1+\ln n)$ from the quantity $\ln 1+\ldots+\ln n$ (which happens to be $\ln n!$), and that this quantity that you’re subtracting can be simplified to $\frac12\ln n$ (since $\ln 1=0$).

  • 1
    $\begingroup$ I think there is just a language issue here, not a real mathematical problem. $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:58

We start with the equality

$$\log(n!)=\log(1)+\log(2)+\cdots +\log(n)$$

Then, note that

$$\begin{align} \log(n!)-\frac12 (\log(1)+\log(n))&=\frac12 \log(1)+\log(2)+\cdots +\log(n-1)+\frac12 \log(n)\\\\ &\approx \int_1^n \log(x)\,dx\\\\ &=n\log(n)-n+1 \end{align}$$

Since the logarithm is concave, the trapezoidal rule approximation provides a lower bound. Therefore, we find from $(1)$ that

$$n!<e\sqrt{n}\left(\frac ne\right)^n $$

  • $\begingroup$ I think there is just a language issue here, not a real mathematical problem. $\endgroup$ – Jack D'Aurizio Aug 31 '16 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.