$\int_a^\infty f(x) \, dx$ converges $\Rightarrow$ $\lim_{x\to \infty}f(x)=0$ $\int_a^\infty f(x) \, dx$ converges $\Rightarrow$ $\lim_{x\to \infty}f(x)=0$.
Give a proof or counterexample.(Assume $f(x)$ positive and continuous.)
I can show that $\int_R^{R'}f(x)\,dx \approx 0$ for $R,R'$ large. $f(c)(R'-R) \approx 0$ for some $c \in (R,R')$ by mean value theorem. Then I don't know how to prove.  
 A: $$f(x)=\sum_{n\geq 1} n e^{-n^6 (x-n)^2} $$
is a continuous, non-negative function on the real line such that $\int_{-\infty}^{+\infty}f(x)\,dx = \sqrt{\pi}\zeta(2) = \frac{\pi^2\sqrt{\pi}}{6}$.
In particular $\int_{a}^{+\infty}f(x)\,dx $ is finite for any $a\in\mathbb{R}$, but for any $n\in\mathbb{Z}^+$ we have $f(n)\geq n$, and
$$ \lim_{x\to +\infty}f(x) $$
does not exist.
A: Picture a function with a spike of height $n$ but width $1/n^3$ at each $x=n$ (and $f$ vanishingly small, say $f(x)=e^{-x^2}$ otherwise).  The spikes contribute area at most $\sum{1\over n^2}$ to the area beneath the curve, so the improper integral will converge, but $f(x)\not\to0$ as $x\to\infty$.
A: Construct a piecewise-linear function $f$ such that around every positive integer $n$ the function describes an isosceles triangle with height $1$ and base length of $\frac{1}{2^n}$.   
Clearly $\lim_{x\rightarrow \infty} f(x) \nrightarrow 0$, however the integral $\int_0^\infty f(x)dx$ is the sum of the areas of the triangles:  $$\int_0^\infty f(x)d = \sum_{n=1}^\infty {\frac{1}{2}\cdot 1 \cdot \frac{1}{2^n}} = \frac{1}{2} \sum_{n=1}^\infty {\frac{1}{2^n}} = \frac{1}{2}$$
A: No. Let $\delta=\frac{1}{10}$. Consider a piecewise linear function $f:\mathbb{R}\rightarrow\mathbb{R}$
such that for each $n\in\mathbb{N}$, $f$ is linear on $[n-\delta2^{-n},n]$
with $f(n-\delta2^{-n})=0$, $f(n)=1$; $f$ is linear on $[n,n+\delta2^{-n}]$
with $f(n+\delta2^{-n})=0$; $f=0$ otherwise.
Clearly $f$ is continuous, non-negative and $\int_{a}^{\infty}f(x)dx<\infty$
for each $a\in\mathbb{R}$. However, $\lim_{x\rightarrow\infty}f(x)\neq0$
because $f(n)=1$ for each $n\in\mathbb{N}$.
A: Here's one that's quite artificial but easy to understand:
$$
g(x) = \begin{cases} 1 & \text{if } n<x<x+ \dfrac 1 {2^n} \text{ for some } n\in\mathbb \{1,2,3,\ldots\}, \\ 0 & \text{otherwise.} \end{cases}
$$
$$
f(x) = \text{a slightly smoothed approximation to } g(x),
$$
for example, you can make it piecewise linear near the jumps, so it's continuous.
Then you have
$$
\int_0^\infty f(x) \, dx = 1 \text{ but } \limsup_{x\to\infty} f(x) = 1.
$$
