$C^1$ function with limit decay at infinity Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be a continuously differentiable function (i.e. $f \in C^1(\mathbb{R})$). Assume that $$\lim_{x \rightarrow \infty} xf'(x) = 0 \ \mbox{and} \ \ \lim_{n \rightarrow \infty} f(2^n) = 0.$$ Then I would like to show that $\lim_{x \rightarrow \infty} f(x) = 0.$
So the picture is $f$ is a continuous function with some points, say $2, 4, 8 , 16 ,.. , 2^n, ...,$ approaching zero.
Normally, with a continuous function $g$ defined by $$g(2^n) = 0$$ on each $n \in \mathbb{N}$ and $g(x) = 1$ all the time except a small interval around each $2^n$, $g(x)$ is just a line joining $1$ and $0$.
Then this function $g$ does not have limit at infinity. What I see is there might be a sharp slope in each interval around $2^n$ (the line joining $1$ and $0$).
This might where the condition $\lim_{x \rightarrow \infty} xf'(x) = 0$ comes to play (Roughly, it says that for all big enough $x$, the slope of the graph $f(x)$ cannot exceed $1/x$). So the slope of $g$ might exceed $1/x.$
From this I try to prove by contradiction by assumeing the limit at infinity of $f$ is not zero. But I seem to struck.
Any suggestion to do the contradiction, or any kind of other proof which might seem simpler to do ?
 A: Let $a_n$ be the maximum of $|xf'(x)|$ on the interval $ [2^n, 2^{n+1}].$ Then $a_n \to 0$ as $n\to \infty.$ So if $x\in [2^n, 2^{n+1}],$ then the MVT gives
$$|f(x)| = |f(x)-f(2^n)| = |f'(c)(x- 2^n)|$$ $$ = \frac{|cf'(c)|}{|c|}|x- 2^n| \le \frac{a_n}{2^n}|2^{n+1}-2^n|=a_n \to 0.$$
This implies the conclusion.
A: Assume that $f(x)$ does not tend to zero as $x\to\infty$. Then there exists $\varepsilon>0$ and an infinite set of natural numbers $I$ such that for every $n\in I$ you can find a number $x_n$ in the interval $[2^n,2^{n+1})$ for which $|f(x_n)|>\varepsilon$. (If this were not the case, then for every $\varepsilon>0$ there would be some natural number $N$ such that for every $n>N$ and every $x$ in $[2^n,2^{n+1})$, the function $f$ would satisfy $|f(x)|<\varepsilon$, which implies that $\lim_{x\to\infty}f(x)=0$.)
So take our $\varepsilon>0$ and our infinite set $I$ of natural numbers with the above property. We have our sequence $\{x_n\}\in [2^n,2^{n+1})$ for which $|f(x_n|>\varepsilon$. Take $n\in I$ such that $f(2^n)<\varepsilon/2$. This is possible because $I$ is infinite and $\lim_{n\to\infty} f(2^n)=0$. Assume for the moment that $f(x_n)>\varepsilon$. By the mean value theorem, there exists $\xi_n\in (2^n,x_n)$ such that $f'(\xi_n)(x_n-2^n)=f(x_n)-f(2^n)$. Note that $x_n-2^n<2^n<\xi_n$. Also, $f(x_n)>\varepsilon$ and $f(2^n)<\varepsilon/2$, so the MVT equation implies
$$f'(\xi_n)\xi_n>f'(\xi_n)(x_n-2^n)=f(x_n)-f(2^n)>\varepsilon/2$$
Thus we found a sequence $\xi_n$ tending to infinity for which $f'(\xi_n)\xi_n$ is away from zero, contradicting the assumption that $xf'(x)\to 0$ as $x\to\infty$.
A similar argument handles the case when $f(x_n)<0$, so $f(x_n)<-\varepsilon$.
