# Examining the convergence of $\int_{0}^{1}\left(\left\lceil \frac{1}{x} \right\rceil-\left\lfloor \frac{1}{x} \right\rfloor\right) \, dx$

Okay so I'm trying to determine whether $\int_{0}^{1}\left(\left\lceil \frac{1}{x} \right\rceil-\left\lfloor \frac{1}{x} \right\rfloor\right) \, dx$ converges and if so, to what value? So the function $\left\lceil \frac{1}{x} \right\rceil-\left\lfloor \frac{1}{x} \right\rfloor = 0$ when $x=\frac{1}{k}$ where $k$ is a natural number, and everywhere else $\left\lceil \frac{1}{x} \right\rceil-\left\lfloor \frac{1}{x} \right\rfloor = 1$ From there I split the integral:

\begin{align*} \int_0^1 \left(\left\lceil \frac{1}{x} \right\rceil-\left\lfloor \frac{1}{x} \right\rfloor\right) \, dx &= \int_{1/2}^1 1 \, dx +\int_{1/3}^{1/2} 1 \, dx + \int_{1/3}^{1/4} 1 \, dx + \cdots \\[10pt] &= (1 - 1/2) + (1/2 - 1/3) + (1/3 - 1/4) + \cdots \\[10pt] &= \lim_{m \to \infty} 1-1/m = 1\;. \end{align*}

Am I correct?

• Very nice solution indeed...I could learn some thing new from it. Jul 16, 2015 at 0:02

Yes, you are correct. But it is much faster if you say that $\lceil \frac{1}{x} \rceil-\lfloor \frac{1}{x} \rfloor$ is $1$ except in a set of measure zero. If you don't know what the meausre of a set is, just say that the set is countable. Then $$\int_0^1\left(\left\lceil \frac{1}{x}\right \rceil-\left\lfloor \frac{1}{x} \right\rfloor\right)dx=\int_0^11dx=1$$
• Dirichlet's function (rationals map to $0$ and irrationals to $1$) is not integrable in Riemann's sense. Jul 16, 2015 at 3:09