Prove that $f$ continuous and $\int_a^\infty |f(x)|\;dx$ finite imply $\lim\limits_{ x \to \infty } f(x)=0$ I'm trying to prove  the following claim:

If $f$ is continuous  and $\displaystyle\int_a^\infty |f(x)|\;dx$ is finite then $\lim\limits_{ x \to \infty } f(x)=0$.

Here the counter example of all these sine functions won't do, since  their infinite integral does not converge absolutely. 
Any hints for a proof?
 A: We do have the following closely related result: Suppose $f \in L^1 ([0,\infty))$, that is $f$ is measurable and $\int_{0}^\infty |f| < \infty$. Then $f$ "nearly" vanishes at infinity. More precisely, for every $\varepsilon > 0$ there exists a set $A \subset [0,\infty)$ with Lebesgue measure $m(A)<\varepsilon$ such that $\lim_{x \to \infty, x \notin A} f = 0$. In other words, the restriction of $f$ to the complement of $A$ vanishes at infinity.
Here's a proof. Clearly it suffices to show that there is a set $A$ of some finite measure which has the above property. First note that $\left\{ x\ge0:\left|f\left(x\right)\right|>1\right\} $ has finite measure (since $f$ is in $L^1$) so there exists $x_1 \ge 0 $ such that $A_1 := \left\{ x\in\left[x_{1},\infty\right):\left|f\left(x\right)\right|>1\right\} $ has measure smaller than $\frac{1}{2}$. Next note that $\left\{ x\ge0:\left|f\left(x\right)\right|>\frac{1}{2}\right\} $ also has finite measure, so there exists $x_2 \ge x_1$ such that $A_2 := \left\{ x\in\left[x_{2},\infty\right):\left|f\left(x\right)\right|>\frac{1}{2}\right\} $ has measure smaller than $\frac{1}{2^2}$. Continuing this way, we get a sequence of numbers $0 \le x_1 \le x_2 \le \cdots $ such that $A_{n}:=\left\{ x\in\left[x_{n},\infty\right):\left|f\left(x\right)\right|>\frac{1}{n}\right\} $ has measure smaller than $\frac{1}{2^n}$. I now claim that $A := \bigcup_{n=1}^{\infty} A_n$ is a set as desired.
First, suppose that $0 \le y_1 < y_2 < \cdots$ is a sequence of numbers disjoint from $A$ which tends to infinity. Let $n$ be a postiive integer. Then $f(y_k) > \frac{1}{n}$ for at most finitely many $k$, since otherwise there would be a $k$ such that $y_k \ge x_n$ and $f(y_k) > \frac{1}{n}$, contradicting the assumption that $y_k$ is not in $A$ (and therefore in particular not in $A_n$). It now follows that $\lim_{k \to \infty} f(y_k) = 0$.
Second, let us show that $A$ has finite measure. Indeed, $m\left(A\right)=m\left(\bigcup_{n=1}^{\infty}A_{n}\right)\le\sum_{n=1}^{\infty}m\left(A_{n}\right)\le\sum_{n=1}^{\infty}\frac{1}{2^{n}}=1$. Now we are done.
The conclusion cannot be strengthened to obtain an $A$ with measure zero, even if $f$ is continuous, as the other answers you got clearly show.
A: A general hint, and, hopefully, motivation for the process behind the other answers:
For $\delta>0$ and positive constants $a_1, a_2,\ldots$ with $\sum\limits_{i=1}^\infty a_i$ finite given, construct $f$ to satisfy each of the following conditions:


*

*$f$ is nonnegative and integrable on any set $[a,b]$.

*$f$ is identically 0 off the intervals $A_1$, $A_2$, $\cdots$; where, $A_i\cap A_j=\emptyset$ for $i\ne j$, and  $j\in A_j$ for each $j$.

*For each $j$, we have $\int_{A_j} f(x)\,dx =a_j$ and $\sup\limits_{x\in A_j}
   f(x)>\delta$.


In other words, the graph of $f$ consists of disjoint positive spikes of  common amplitude $\delta$   whose widths converge to 0 fast enough so that the sum of their areas is finite.
You could even set things up so that the amplitudes tend to infinity.
A: 
The result is false, as the often presented example of spikes with vanishing bases shows. 

For concreteness, introduce the elementary spike $s:x\mapsto(1-|x|)^+$ centered at $0$, with height $1$ and width $2$, and consider 
$$
f(x)=\sum\limits_{n\geqslant1}s(n^2x-n^3).
$$
In words, one adds countably many spikes, the $n$th spike being centered at $n\geqslant1$, with height $1$ and width $\frac2{n^2}$. Then: 


*

*The function $f$ is finite and nonnegative everywhere. 

*The function $f$ is integrable since  $\int\limits_{-\infty}^{+\infty} s(ax+b)\mathrm dx=\frac1a\int\limits_{-\infty}^{+\infty} s(x)\mathrm dx=\frac1a$, for every $a\gt0$ and every $b$, hence $\int\limits_{-\infty}^{+\infty} f(x)\mathrm dx=\sum\limits_{n\geqslant1}\frac1{n^2}$, which converges. 

*The function $f$ has no limit at infinity since, for every $n\geqslant3$, $f(n)=1$ and $f\left(n+\frac12\right)=0$.

A: this is not true
you can construct a function easily like this:
so $\int_{a}^{\infty}|f(x)| = \sum{u_n}$ starting from n0 such that $u_{n0-1} < a \leq u_{n0}$
so take any $u_n$ such that $\sum{u_n}$ converges
A: The assertion is not true, even if $f(x)\geq0$ for all $x$: let $f(x)$ be
$$
f(x)=\begin{cases}1-2n^2\left|x-\left(n+\frac1{2n^2}\right)\right|,&\ \text{ if } x\in[n,n+\frac1{n^2}),\\ \ \\
0,&\ \text{ if }x\in [n+\frac1{n^2},n+1)
\end{cases}
$$
for $n\in\mathbb{N}$, $f(x)=0$ for $x<1$. 
Then
$$
\int_0^\infty f(x)\,dx\leq\sum_{n=1}^\infty \frac1{2n^2}=\frac{\pi^2}{12}<\infty.
$$
But $f(n+\frac1{2n^2})=1$ for all $n$. 
Your assertion is true if you also require $f$ to be monotone. 
One can also tweak this example to get $f(x)>0$ for all $x$, and one can also get $\limsup_{x\to\infty}f(x)=\infty$ (for instance, one could get $f(n)=n$ for all $n\in\mathbb N$).  
