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!)
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$).