Is there a continuous positive function whose integral over $(0,\infty)$ converges but whose limit is not zero?

Solution 1:

Yes, there is such a function:

Consider the function $f$ with domain $[0,\infty)$ whose graph coincides with the non-negative $x$-axis except around the positive integers. At a positive integer $n$, the graph of $f$ is a "spike" (an inverted V shape) of height one and width $1/2^{n-1}$, centered around $n$. These are your "tent" functions.

Now, following Jose27's comment, take $g(x)=f(x)+e^{-x}$.

Then $\limsup\limits_{x\rightarrow\infty}\ g(x)=1$, because of the spikes, while $\liminf\limits_{x\rightarrow\infty}\ g(x)=0$; thus $\lim\limits_{x\rightarrow\infty} g(x)$ does not exist.

Also:

$$ \int_0^\infty e^{-x}\,dx= 1 $$ and $$ \int_0^\infty f(x)\, dx =\sum_{n=1}^\infty {1\over 2^n }=1. $$ Thus, the integral $\int_0^\infty g(x)\,dx$ converges to 2.

Finally, note that $g$ is continuous and $g(x)=e^{-x}+f(x)\ge e^{-x}>0$ on $[0,\infty)$.