Suppose that $f: \mathbb{R} \to \mathbb{R}$ is Lebesgue integrable. Does it follow that $\lim_{x\to \infty} f(x)=0$? What if $f$ is continuous on $\mathbb{R}$?
I think the first question is false but the second may be true. However, I can't come up with a counterexample or a proof? I would greatly appreciate it if anyone could provide me with some examples or solutions.
Break the real line into unit intervals, like $...\cup[-2,-1]\cup[-1,0]\cup[0,1] \cup [1,2] \cup [2,3] \cup...$ (it doesn't matter if they overlap, the construction will avoid problems on that front). We will construct something for the positive real line, just mirror the function onto the negative real line (which is to say, put $f(-x)=-f(x)$).
Now, on each piece, say $[n,n+1]$, we want the following: we want to construct a triangle, of area $\frac{1}{2^n}$, such that it's height is $n$. This means it's base will be $\frac{2A}{H} = \frac{2^{1-n}}{n}$. Now, we can define our function as follows: let $m=n+\frac{1}{2}$, then: $$f_n(x)= \begin{cases} 0 \qquad \qquad \qquad \qquad \qquad |m-x|>\frac{2^{-n}}{n} \\ n - (n^22^n)(|m-x|) \qquad |m-x|\leq \frac{2^{-n}}{n} \end{cases} $$
Have the image in mind, the function is not very important. This forms a triangle centered at $m$, of height $n$ and area $\frac{1}{2^n}$.
Join all the piecewise functions together, which you can do because the endpoints all have function value zero.Now, when you are taking the integral of this complete function, you just have to sum the $\frac{1}{2^n}$ up from $n=1$ to $\infty$, and multiply it by two, because you are mirroring this to the negative real line. However, the sum $\sum 2^{-n}$ is just $2$! Twice that is four, and your function is integrable.
But then, of course, your function takes arbitrary high values at certain points! ( $f(n+1/2)=n$, for example). Therefore forget about the limit tending to zero, it does not even exist as $n \to \infty$!
Of course, you must have already seen: our function is continuous as well. But it isn't differentiable at the points $n+\frac{1}{2}$, because the one sided limits are $-n^22^n$ and $n^22^n$ and these don't match. All said and done, here's your example.