Show that $ f (x) \to 0$ as $|x| \to \infty$. I am learning Measure Theory .However I got stuck on follow
Let $f $ be a uniformly continuous real valued function on the real line $\Bbb R.$
Assume that $f $ is integrable with respect to the Lebesgue measure on $\Bbb R$.
Show that $ f (x) \to  0$  as $|x| \to \infty$.
My try:
As $f$ is integrable then $\int_{\Bbb R} |f|<\infty $. In order to prove the above I have to find a suitable $G>0$ such that $|f(x)|<\epsilon$ whenever $x<-G$ and $x>G$.
But I can't proceed anymore.Neither I could use the fact that $f$ is uniformly continuous.
 A: Hints:


*

*Show that for any compact set $K$ that $$\lim_{|x| \to \infty} \int_{x+K} |f(y)| \, \lambda(dy)=0.$$

*For fixed $\epsilon>0$ choose $\delta>0$ such that $$|f(y)-f(x)| \leq \epsilon \qquad \text{for all} \, \, x,y \in \mathbb{R}, |x-y| \leq \delta.$$ If we set $K := \overline{B_{\delta}(0)}$, then this is equivalent to $$|f(y)-f(x)| \leq \epsilon \qquad \text{for all} \, \, x \in \mathbb{R}, y \in x+K.$$ Now combine the identity $$|f(x)| = \frac{1}{\lambda(K+x)} \int_{K+x} |(f(x)-f(y))+f(y)| \, \lambda(dy)$$ with the triangle inequality to conclude that $$\lim_{|x| \to \infty} |f(x)| =0.$$

A: By contradiction.  Without loss of generality, suppose  there exists $r>0$  and a sequence $(x_n)_{n\in N}$ tending to $\infty$ as $n\to  \infty,$ such that $f(x_n)>r$ for all $n\in N.$
For each $n,$ there exists  $y>x_n$ such that $f(y)=f(x_n)/2,$ otherwise  the continuity of $f$ implies  that for some n we have $f(y)>r/2$ for all $y>x_n,$ and the integral diverges.
Let $y_n=\inf  \{\;y>x_n: f(y)=f(x_n)/2\;\}.$ By the continuity of $f,$ we have $y\in [x_n,y_n]\implies f(y)\geq f(x_n)/2>r/2\; \implies \;\int_{x_n}^{y_n}f(y) dy >r(y_n-x_n)/2.$
We may choose a subsequence $(k_n)_{n\in N}$ of $N$ such that $y_{k_n}<x_{k_{n+1}}.$ For brevity let $x_{k_n}=x'_n$ and $y_{k_n}=y'_n.$
For $f$ to be  integrable we must have $\sum_{n\in N}r(y'_n-x'_n)/2<\infty, $   hence $y'_n-x'_n\to 0$ as $n\to \infty.$
The uniform continuity of $f$ implies that for some $d>0$ we have $|y-x|<d\implies |f(y)-f(x)|<r/4.$ But for sufficiently large $n$ we have $|y'_n-x'_n|<d,$ giving $r/4> |f(y'_n)-f(x'_n)| = f(x'_n)/2>r/2,$ a contradiction.  
A: Here is a proof by contradiction that is easier to follow than the one posted.
For the sake of contradiction suppose that there is some $\epsilon_0$ such that $\forall A>0, \exists x\geq A, |f(x)|>\epsilon_0$.
Since $f$ is uniformly continuous, there exists $\delta >0$ such that $\forall x,y, |x-y|\leq \delta \implies |f(x)-f(y)|\leq \epsilon_0/2$.
The first statement yields the construction of an increasing sequence $x_n$ such that the intervals $[x_n-\delta, x_n+\delta]$ are disjoint and $|f(x_n)|>\epsilon_0 $.
Now, let $n\in \mathbb N$ be arbitrary and consider some $y\in[x_n-\delta, x_n+\delta] $. 
The inequality $|f(x_n)|-|f(y)|\leq |f(x_n)-f(y)|\leq \epsilon_0/2 $ yields $$|f(y)|\geq |f(x_n)|-\epsilon_0/2\geq \epsilon_0/2$$
Therefore, over each of the intervals $[x_n-\delta, x_n+\delta] $, we have $|f|\geq \epsilon_0/2$ .
Note that $\displaystyle \int_{\mathbb R} |f|\geq \sum_n \int_{x_n-\delta}^{x_n+\delta} |f| \geq \sum_n \epsilon_0 \delta = \infty$
Contradiction.
Proceed similarly to prove that $f\to \infty $ as $x\to -\infty$
