TITLE: Is this function lebesgue integrable or not?
QUESTION [5 upvotes]: I'm trying to see if this function is lebesgue integrable.
$$\int_0^1 \frac{(-1)^{\lfloor 1/x \rfloor}}{x^2} dx.$$
How can I prove it?
I try the following:
Let $f(x)=\frac{(-1)^{\lfloor 1/x \rfloor}}{x^2}$.
\begin{align*}
\int_0^1 |f(x)| dx&=\sum_{n=1}^{\infty} \int_{1/(n+1)}^{1/n} |f(x)| dx\\
&=\sum_{n=1}^{\infty} \int_{1/(n+1)}^{1/n} \frac{1}{x^2} dx\\
&=\sum_{n=1}^{\infty} \left(\frac{-1}{n}+\frac{1}{n+1}\right)<\infty.
\end{align*}
Thus $f(x)$ is L.I.
I'm wrong?

REPLY [3 votes]: No, the integrand here is not Lebesgue integrable. To prove that $f : x↦ \frac{(-1)^{\lfloor 1/x\rfloor}}{x^2}$ is Lebesgue integrable, you have to prove that $f$ is measurable (this is the case here) and that $\int_0^1 |f(x)|\,\mathrm{d}x$ is finite. But $|f(x)| = \frac{1}{x^2}$, therefore,
$$
\int_0^1 |f(x)|\,\mathrm{d}x = \int_0^1 \frac{\mathrm{d}x}{x^2} = \lim_{\varepsilon\to 0} \int_\varepsilon^1 \frac{\mathrm{d}x}{x^2} =\lim_{\varepsilon\to 0} \left(\frac{1}{\varepsilon}-1\right) = +\infty.
$$
Your error comes from the fact that $\frac{1}{1/n} = n$ (actually I had difficulties to find it) so your last sum should be
$$
\sum_{n=1}^\infty\left((n+1)-n\right) = \infty.
$$