# Calculating pretty difficult limit that invloves Riemann sums

Let $$S_n = \sum_{k=1}^n\frac{1}{\sqrt{n^2+k^2}}$$. Calculate the following limit $$\lim_{n \to \infty} n\left(n\Big(\ln(1+\sqrt{2})-S_n\Big)-\frac{1}{2\sqrt{2}\,(1+\sqrt{2})}\right).$$

My intuition says that every from of $$n$$ times a parentheses in a form of $$0 \cdot \infty$$ otherwise the problem would be trivial.

So let's first calculate the inner most bracket, $$\ln(1+\sqrt{2})-S_n$$. Firstly, we notice that $$S_n$$ is a Riemann sum. Take $$f(x)=\frac{1}{\sqrt{1+x^2}}$$. Now $$S_n = \sum_{k=0}^n\frac{1}{\sqrt{n^2+k^2}}=\sum_{k=0}^n\frac{1}{n}f(\frac{k}{n})$$ which is the Riemann sum for $$\int_0^1f(x)dx=\text{arcsinh}(x) \vert_0^1=\ln(1+\sqrt{2})$$. Now $$\ln(1+\sqrt{2})-S_n$$ is the difference between the area under the curve and the riemann sum.

Now trying to calculate $$n(\ln(1+\sqrt{2})-S_n)=\frac{\ln(1+\sqrt{2})-S_n}{\frac{1}{n}}=^{\text{Stolz-Cesaro}}=n(n+1)(S_n-S_{n+1})$$. But I am stuck here. How should I continue? $$S_n-S_{n+1}$$ does not look like a nice Riemann sum, and I have no idea how to actually compute it. Any tips would be gladly appreciated.

• The first sentence "My intuition says that ..." probably needs some copy-editing, because I can not parse it. Upvoted anyway for clearly showing the attempt. Feb 13 at 8:51

Extending the argument in this answer we can write $$\frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right) =\int_0^1 f(x) \, dx+\frac{f(1)-f(0)}{2n}+\frac{f'(1)-f'(0)}{12n^2}+o(1/n^2)\tag{1}$$ Using $$f(x) =\frac{1}{\sqrt{1+x^2}},\,\int_0^1 f(x) \, dx=\log(1+\sqrt{2}),f'(x)=-\frac{x}{(1+x^2)^{3/2}}$$ in above formula we get $$S_n=\log(1+\sqrt{2})-\frac{1}{2\sqrt{2}(1+\sqrt{2})}\cdot \frac{1}{n}-\frac{1}{24\sqrt{2}}\cdot\frac{1}{n^2}+o(1/n^2)$$ and thus desired limit is $$1/24\sqrt{2}$$.

For completeness I provide a proof of $$(1)$$. We assume that $$f''$$ is Riemann integrable on $$[0,1]$$.

For $$x\in[0,1/n]$$ we have via mean value theorem $$f(x+(k-1)/n)=f(k/n)+(x-1/n)f'(k/n)+o(x-1/n)\tag{2}$$ Integrating this with respect to $$x$$ in $$[0,1/n]$$ and summing the result for $$k=1$$ to $$k=n$$ we get $$\int_0^1 f(x) \, dx=\frac{1}{n}\sum_{k=1}^n f(k/n) - \frac{1}{2n}\cdot\frac{1}{n}\sum_{k=1}^n f'(k/n) + o(1/n)$$ And this means that $$\lim_{n\to\infty} n\left(\int_0^1 f(x)\,dx-\frac{1}{n}\sum_{k=1}^n f\left(\frac{k} {n} \right) \right) =-\frac{1}{2}\int_{0}^{1}f'(x)\,dx$$ or $$\frac{1}{n}\sum_{k=1}^n f\left(\frac{k} {n} \right)=\int_0^1 f(x) \, dx+\frac{f(1)-f(0)}{2n}+o(1/n)\tag{3}$$ Again applying Taylor's theorem (with Peano's form of remainder) we get $$f(x+(k-1)/n)=f(k/n)+(x-1/n)f'(k/n)+\frac{1}{2}(x-1/n)^2f''(k/n)+o((x-1/n)^2)$$ Integrating in $$[0,1/n]$$ and summing for $$k=1$$ to $$k=n$$ we get $$\int_0^1 f(x) \, dx=\frac{1}{n}\sum_{k=1}^n f(k/n)-\frac{1}{2n}\cdot\frac{1}{n}\sum_{k=1}^n f'(k/n) +\frac{1}{6n^2}\cdot\frac{1}{n}\sum_{k=1}^n f''(k/n) +o(1/n^2)\tag{4}$$ Replacing $$f$$ by $$f'$$ in $$(3)$$ we get $$\frac{1}{n}\sum_{k=1}^n f'\left(\frac{k} {n} \right)=\int_0^1 f'(x) \, dx+\frac{f'(1)-f'(0)}{2n}+o(1/n)$$ ie $$\frac{1}{n}\sum_{k=1}^n f'\left(\frac{k} {n} \right)=f(1)-f(0)+\frac{f'(1)-f'(0)}{2n}+o(1/n)$$ Using the above equation in $$(4)$$ we get $$\int_0^1 f(x) \, dx=\frac{1}{n}\sum_{k=1}^n f(k/n)-\frac{1}{2n}\cdot\left(f(1)-f(0)+\frac{f'(1)-f'(0)}{2n}+o(1/n)\right) +\frac{1}{6n^2}\cdot\frac{1}{n}\sum_{k=1}^n f''(k/n) +o(1/n^2)$$ Treating the last factor of the last term above as a Riemann sum for $$f''$$ we see that it can be written as $$f'(1)-f'(0)+o(1)$$ and hence after a little algebra we get $$\int_0^1 f(x) \, dx=\frac{1}{n}\sum_{k=1}^n f\left(\frac{k} {n} \right) - \frac{f(1)-f(0)}{2n}-\frac{f'(1)-f'(0)}{12n^2}+o(1/n^2)$$ which is same as equation $$(1)$$. The argument can be repeated (with more algebraic manipulation) to get a formula with error $$o(n^{-k})$$ for any positive integer $$k$$.

The formulas of above type give details on how fast the Riemann sums (with uniform partition) approximate the Riemann integral. One can however note that the formula fails miserably when the function $$f$$ is periodic with period $$1$$ and sufficiently smooth. In these cases the error is much smaller than any terms like $$o(n^{-k})$$ and hence one can expect that the error is more like exponentially decreasing ie of the form $$o(k^{-n})$$ for some constant $$k>1$$. This is true and discussed in a very nice example in this thread.

Since $$\int_0^1 f(x)\,dx=\frac{1}{n}\int_0^n f(t/n) \, dt$$ we can apply Euler Maclaurin summation formula on right side to get the desired result. In general for any positive integer $$p$$ we have $$\frac{1}{n}\sum_{k=1}^{n}f\left(\frac{k}{n}\right)=\int_0^1 f(x) \, dx+\frac{f(1)-f(0)}{2n}+\sum_{k=1}^{\lfloor p/2\rfloor}\frac{B_{2k}}{(2k)!}\cdot\frac{f^{(2k-1)}(1)-f^{(2k-1)}(0)}{n^{2k}}+o(n^{-p})$$

• Great answer and also a very nice justification for the results. Feb 13 at 15:56