Can $\int_0^\infty f (x) \, dx$ exist if $\lim_{x \to \infty} f(x)$ does not exist

harmonic-numbersimproper-integralslimitssequences-and-series

Is is possible to have a function for which $\lim_{x \to \infty} f(x)$ does not exist, but $\int_0^\infty f(x) \, dx$ exists and is finite?

I think I've found an example actually, but I'm not sure it works. Let $H_n$ be the $n$th harmonic number. Consider $f$ such that $f(x) = 1$ for $x \in [0,1)$ and $f(x) = (-1)^{n}$ for $x \in [H_n , H_{n + 1})$. It seems that
$$
\int_0^\infty f(x) \, dx = \sum_{n = 1}^\infty \frac{(-1)^{n + 1}}{n} = \log 2
$$

even though $\lim_{x \to \infty} f(x)$ doesn't exist. Does this work?

Best Answer

You example is correct. Note that you based your idea on an oscillating function, however, we can also give an example with a non-negative one.

Consider hats functions with maximum value $1$ centered on integers such that the hat width at for the $n$-th is $\frac 1 {n^2}$. Thus, the area of the $n$-th hat function is $\frac 1{2n^2}$. Now, define $f$ as the sum of those hats functions, thus : $$\int_0^\infty f(x) dx =\sum_{n>0} \frac 1{2n^2} = \frac{\pi^2}{12}$$

And of course the limit of $f$ does not exist since $f(n) = 1$ and $f(n + 0.5) =0$ for $n$ large enough.

Related Question