# Need help evaluating $\lim\limits_{n \to \infty} \frac{1}{n} \int_1^n \Vert\frac{n}{x}\Vert dx$

$$\mbox{Evaluate}\quad \lim_{n \to \infty}{1 \over n}\int_{1}^{n}\left\Vert\,n \over x\,\right\Vert \,{\rm d}x$$

Where $\left\vert\left\vert\, x\,\right\vert\right\vert : \mathbb{R} \to \mathbb{R}$ denotes the [distance to the] closest integer to $x$. As an explicit example, $\left\Vert\, 4.7\,\right\Vert = 0.3 = \left\Vert\, 5.3\,\right\Vert$

I'm taking an advanced integration course at a mathematics academy and this is a problem in the problem set. I'd like to say that I've made some progress but I haven't. I'm not really sure what I could do to get started on the right track.

• Please do not use displaystyle in the question title. You might also want to put your actual question in the body and not just in the title. – AlexR Feb 10 '14 at 0:19
• If you graph ||x||, then you end up with something that looks vaguely trigonometric. – recursive recursion Feb 11 '14 at 2:33
• @user92774, if you have the solution, I would kind of like to know it. I have not been able to figure it out myself, and it is an interesting problem – recursive recursion Feb 11 '14 at 22:02
• unfortunately, if I knew the solution I wouldn't have asked the question :) but if I figure it out I'll edit the post.. – MCT Feb 11 '14 at 22:47

We can split this integral into a sum of its parts in order to evaluate it more easily. $$\frac{1}{n}\int_{1}^{n}\left\Vert\,n \over x\,\right\Vert \,{\rm d}x = \frac{1}{n}\sum_{k=1}^{n-1}\int_{n/(k+1)}^{n/k}\left\Vert\,n \over x\,\right\Vert \,{\rm d}x$$ Now to evaluate each integrand, we can split it up further $$\int_{n/(k+1)}^{n/(k+1/2)} \left((k+1)-\frac{n}{x}\right)dx + \int_{n/(k+1/2)}^{n/k} \left(\frac{n}{x}-k \right)dx$$ $$=n\left(\frac{k+1}{k+\frac{1}{2}}-1\right)+n\ln\left(\frac{k+\frac{1}{2}}{k+1}\right)+n\ln \left(\frac{k+\frac{1}{2}}{k}\right)-n\left(1-\frac{k}{k+\frac{1}{2}}\right)$$ Now lots of stuff cancels out and we get the summation $$\sum_{k=1}^{n-1}\ln\left(\frac{(k+\frac{1}{2})^2}{k(k+1)}\right)$$ This partial sum can be rewritten using the Gamma Function, which you probably studied in your advanced integration course, as $$\ln\left(\frac{4}{\pi}\cdot \frac{\Gamma\left(n+\frac{1}{2}\right)^2}{\Gamma(n)\Gamma(n+1)}\right)$$ The $4/\pi$ term comes from the the fact that $\Gamma(3/2)=\sqrt{\pi}/2$. Taking the limit to infinity, the Gammas functions go to $1$ since $$\lim_{n \to \infty}\frac{\Gamma(n+a)\Gamma(n+b)}{\Gamma(n)\Gamma(n+a+b)}=1$$ Thus we have $$\lim_{n \to \infty} \frac{1}{n}\int_{1}^{n}\left\Vert\,n \over x\,\right\Vert \,{\rm d}x = \ln\left(\frac{4}{\pi}\right) \approx 0.24$$