# Limit using Stirling's formula

Consider the limit $$\lim_{n \to \infty} \left[n(1-2\log2) + \sum_{k=1}^{n} \log\left(1+\frac {k}{n}\right)\right] = \frac {1}{2} \log 2.$$ This can be shown by using Stirling's formula for $n!$. My question is if this is the only way or there is also an elementary solution.

• Elementary solution as in without the use of Stirling's formula? Commented Sep 4, 2014 at 17:24
• Yes, Stirling's formula does not come in every calculus course. Commented Sep 4, 2014 at 17:25
• The sequence you provide does not converge in the form you've written it down. Simply use $n \sum_{k=1}^n \log(1+k/n)>n\log(1+n/n)>n\rightarrow \infty$ Commented Sep 4, 2014 at 17:42
• $\sum_{k=1}^n\log(1+\frac{k}{n}) - 2n\log2 \to \frac{1}{2}\log(2)$ when $n\to +\infty$ Commented Sep 4, 2014 at 17:43
• Sorry I forgot the factor $1-2\log2$. Now it is correct. Commented Sep 5, 2014 at 6:02

This is the case $f:x\mapsto\log(1+x)$ of the more general result that, for every $C^1$ function $f$ on $[0,1]$,

$$\lim_{n \to \infty} \sum_{k=1}^{n} f\left(\frac {k}{n}\right)-n\int_0^1f(x)\mathrm dx = \frac {1}{2}(f(1)-f(0)).$$

To show this, one can use Riemann sums and a first-order Taylor expansion on $f$.

More in details, one starts from the identity $$f\left(\frac {k}{n}\right)=n\int_{(k-1)/n}^{k/n}f(x)\mathrm dx+R_{k,n},\qquad R_{k,n}=n\int_{(k-1)/n}^{k/n}\left(f\left(\frac {k}{n}\right)-f(x)\right)\mathrm dx.$$ The integrand in $R_{k,n}$ is $$f\left(\frac {k}{n}\right)-f(x)=f'\left(\frac{k}n\right)\cdot\left(\frac {k}{n}-x\right)+o\left(\frac1n\right),$$ hence $$R_{k,n}=nf'\left(\frac{k}n\right)\int_{(k-1)/n}^{k/n}\left(\frac {k}{n}-x\right)\mathrm dx+o\left(\frac1{n}\right)=f'\left(\frac{k}n\right)\frac1{2n}+o\left(\frac1{n}\right).$$ Summing these from $k=1$ to $k=n$ yields $$\sum_{k=1}^{n} f\left(\frac {k}{n}\right)=n\int_0^1f(x)\mathrm dx +\frac12\frac1n\sum_{k=1}^{n}f'\left(\frac{k}n\right)+o(1),$$ and it remains to identify the sum on the RHS as a Riemann sum of $f'$ to deduce that $$\frac1n\sum_{k=1}^{n}f'\left(\frac{k}n\right)=\int_0^1f'(x)\mathrm dx+o(1)=f(1)-f(0)+o(1),$$ hence the identity above.

• Thank you very much Did. Your answer is clear, but I have just one question regarding the remainder term. When you are summing you get $n$ terms of $o(\frac{1}{n})$. Is it clear that $no(\frac{1}{n})$ still goes to zero as $n\to \infty$? Commented Sep 6, 2014 at 12:54
• Yes, and the sum of $n$ terms uniformly $o(1/n)$ is indeed $o(1)$.
– Did
Commented Sep 6, 2014 at 12:56
• Thank you. This result is very useful to know. Do you know of any reference since I haven't seen it in standard literature. Commented Sep 6, 2014 at 13:02
• Sure: the definition of small-o (say, the one the WP page gives).
– Did
Commented Sep 6, 2014 at 13:07
• I was thinking of reference for the general result of the limit that you proved. This is the result that can be applied. Commented Sep 6, 2014 at 15:02