# Construct a function such that the improper integral $\int_0^1 fdx$ exists but $\int_0^1 |f|dx$ does not.

I'm having trouble with this exercise in Rudin's PoMA (chapter 6 exercise 7)

a) is quite easy but I can't find a function satisfying b). I attempted to use $g \sin(1/x)$ for some $g$ with $\lim_{t\to 0} g(t)=0$ with no success. Of course $f$ can't be integrable in $[0,1]$ since in this case $|f|$ is too (because $|x|$ is continuous everywhere) and a) would imply that the limit exists.

Here is a full solution based on Jack D'Aurizio's answer.

Take $f(x) = (-1)^{[1/x]}[1/x], ~ x>0$ then for $\frac{1}{m+1}<x\le \frac{1}{m}$ where $m>0$ is a natural we have \begin{equation*} m \le \frac{1}{x} < m+1 \Rightarrow [1/x] = m \Rightarrow f(x) = (-1)^mm \end{equation*} hence \begin{equation*} \int_{\frac{1}{m+1}}^{\frac{1}{m}} f dx = (-1)^mm \left[ \frac{1}{m}-\frac{1}{m+1} \right] = (-1)^m \left[ \frac{1}{m+1} \right], ~ (m \ge 1) \end{equation*} thus if $0<c<1$ let $m=[1/c]\ge 1$ then \begin{align*} \int_{c}^{1} f dx - \int_{c}^{\frac{1}{m}} f dx = \sum_{i=1}^{m-1} \int_{\frac{1}{i+1}}^{\frac{1}{i}} f dx = \sum_{i=1}^{m-1}(-1)^i \left[ \frac{1}{i+1} \right] \\ = H_{m} - 1 \end{align*} But note that \begin{equation*} t \in [c,1/m] \Rightarrow [1/t] = [1/c] = m \end{equation*} thus \begin{equation*} \left|\int_{c}^{1/m} f dx\right| = \left|(-1)^mm \left[ \frac{1-cm}{m} \right]\right| =|1-cm| \end{equation*} and we have \begin{equation*} \left| \int_{c}^{1} f dx - (H_m-1) \right| = |1-cm| \end{equation*} but the latter satisfies, from the right, \begin{equation*} \lim_{c \to 0} |1-cm| = 0 \end{equation*} since \begin{align*} 1/c-1<[1/c]\le 1/c \Rightarrow 1-c < cm \le 1 \end{align*} therefore \begin{equation*} \lim_{c\to 0} \int_{c}^{1} f dx - (H_{[1/c]}-1) = 0 \end{equation*} but \begin{equation*} \lim_{c\to 0} H_{[1/c]}-1 = \sum_{i=2}^{\infty} \frac{(-1)^{i+1}}{i} \Rightarrow \lim_{c\to 0} \int_{c}^{1} f dx = \sum_{i=2}^{\infty} \frac{(-1)^{i+1}}{i} \end{equation*} thus $\int_{0}^{1} f dx$ converges.

By a similar argument we have, for $c \in (0,1)$, \begin{equation*} \int_{c}^{1} |f| dx = \sum_{i=1}^{m-1}\frac{1}{i+1} + \int_{c}^{1/m} |f| dx \ge \sum_{i=1}^{m-1}\frac{1}{i+1} \end{equation*} thus \begin{equation*} \int_{1/n}^{1} |f| dx \ge \sum_{i=2}^{n}\frac{1}{i} \end{equation*} which is unbounded above since this series diverges.

• Can you do the same on [0,oo) instead of [0,1]?
– Did
Jan 31, 2016 at 21:00
• That's a good idea, let me think a bit about it. Jan 31, 2016 at 21:02
• OK. Take your time to think it through... :-)
– Did
Jan 31, 2016 at 21:02
• let it oscillate. Jan 31, 2016 at 21:07
• Nice, $\frac{(-1)^{[x]}}{[x+1]}$ works in the $+\infty$ case. Jan 31, 2016 at 21:38

What about the function given by $(-1)^n\cdot n$, where $n=\left\lfloor\frac{1}{x}\right\rfloor$?

• This works but with a bit more effort than a one liner :) I would appreciate if you could skim my answer at the OP, thanks! Feb 1, 2016 at 3:43

This also works:

$$f(x) = \frac{\sin(1/x)}{x}$$

• Could you elaborate? I'm not sure how to even prove that $\int fdx$ converges in this case. Feb 1, 2016 at 2:14
• Let $x=1/y.$ Then we are looking at $$\int_1^\infty \frac{\sin y}{y}\,dy\,\,\,,\int_1^\infty \frac{|\sin y|}{y}\,dy.$$
– zhw.
Feb 1, 2016 at 2:46
• Rudin hasn't proved anything about $\frac{\sin x}{x}$ at this point, but thanks anyway, when he mentions it I'm sure to come back to your answer. Feb 1, 2016 at 3:42