# Computing $\int\limits_0^\infty x \left \lfloor{\frac1x}\right \rfloor \, dx$

This is an integral I computed but can't find the result online or on wolfram. So here's a proof sketch, please indulge this sanity check:

$$\int_0^\infty x \left \lfloor{\frac1x}\right \rfloor \ dx = \int_0^1 x \left \lfloor{\frac1x}\right \rfloor \ dx$$ $$= \sum_{n=1}^\infty \int_{1/(n+1)}^{1/n} nx \ dx =\sum_{n=1}^\infty\frac n2 \left(\frac{1}{n^2} - \frac{1}{(n+1)^2}\right)$$ $$= \sum_{n=1}^\infty\frac n2 \left(\frac{2n+1}{n^2(n+1)^2}\right)$$ $$= \sum_{n=1}^\infty\frac{1}{(n+1)^2} + \frac12 \sum_{n=1}^\infty \frac{1}{n(n+1)^2}$$ $$= \frac{\pi^2}{6} -1 + \frac12\left(\sum_{n=1}^\infty \frac1n - \frac{1}{n+1} - \frac{1}{(n+1)^2}\right)$$ $$=\frac{\pi^2}{6} -1 + \frac12\left(\sum_{n=1}^\infty \frac1n - \frac{1}{n+1}\right) -\frac12\left(\sum_{n=1}^\infty\frac{1}{(n+1)^2}\right)$$ $$= \left(\frac{\pi^2}{6} -1\right) + \left(\frac12\cdot 1\right) - \frac12\left(\frac{\pi^2}{6} -1\right)$$ $$= \frac{\pi^2}{12}.$$

Basically, I used the Basel sum several times, and the fifth line follows from a partial sum decomposition. The seventh follows from the known result for the Basel sum, as well as the fact that the first series in the 6th line telescopes.

I hope this is all correct.

• @XanderHenderson For $x>1$, floor of $\frac{1}{x}$ is $0$ Dec 28, 2017 at 3:34
• @XanderHenderson What you wrote is certainly not true, because you forgot the $x$ term. However, what Y. Forman says is correct, and I should've been more explicit there. Dec 28, 2017 at 3:37
• Oi... derp. Sorry for being dyslexic. I missed the $x$. Dec 28, 2017 at 3:39
• $$\int_0^1 x \lfloor 1/x \rfloor dx = \int_1^\infty \frac{1}{t} \lfloor t \rfloor \frac{dt}{t^2}= \sum_{n=1}^\infty \int_n^\infty t^{-3}dt = \sum_{n=1}^\infty \frac{n^{-2}}{2} = \frac{\zeta(2)}{2}$$ Dec 28, 2017 at 3:43
• @reuns Nice, better post it as answer! Dec 28, 2017 at 4:40

Use

$$n\left(\frac1{n^2}-\frac1{(n+1)^2}\right)=\frac n{n^2}-\frac{n+1-1}{(n+1)^2}=\frac1n-\frac1{n+1}+\frac1{(n+1)^2}.$$

The first two terms do telescope and the Basel series remains.

• @stressedout: of course, but much simpler. And also simpler than yours, which is also essentially the OP's.
– user65203
Sep 5, 2018 at 6:28
• @stressedout: your solution isn't different, just longer. A one-liner is simpler.
– user65203
Sep 5, 2018 at 6:38

Alternatively, one may follow the same line of thought and use summation by parts formula to calculate the infinite sum. Similarly, $$\int_0^{+\infty} x\lfloor \frac{1}{x}\rfloor dx =\sum_{n=1}^{\infty}\frac{n}{2}\left(\frac{1}{n^2}-\frac{1}{(n+1)^2}\right)=-\frac{1}{2}\sum_{n=1}^{\infty}f_n(g_{n+1}-g_n)$$

where $f_n = n$ and $g_n = 1/n^2$. Now, summation by parts for the last expression gives:

$$-\frac{1}{2}\sum_{n=1}^{\infty}f_n(g_{n+1}-g_n) = -\frac{1}{2}\left(\ \lim_{n\to\infty}\frac{n}{(n+1)^2} -1 -\sum_{n=2}^{\infty}\frac{1}{n^2}\right)$$

But it is well-known that $$\sum_{n=1}^{\infty}\frac{1}{n^2}=\frac{\pi^2}{6}$$

Hence,

$$-\frac{1}{2}\sum_{n=1}^{\infty}f_n(g_{n+1}-g_n) = -\frac{1}{2}\left(\ \lim_{n\to\infty}\frac{n}{(n+1)^2} -1 - (\frac{\pi^2}{6}-1)\right) = \frac{\pi^2}{12}$$
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}