# Is there a function that doesn't have a limit at infinity but its derivative does?

Is there a function that is differentiable in $\mathbb{R}$, its derivative converges to $0$ as $x\to \infty$ but the function does not converge as $x \to \infty$, neither to a finite limit nor to an infinite limit? If not, how can you prove that?

Thank you
Gal

• Welcome to this site! When asking a question, please post any attempts or thoughts of your own on the problem as well as any additional context so users can better pinpoint how to help you. :-) – Zain Patel Jul 9 '15 at 13:24
• Thank you very much for both the tip and the example – Gal Fl Jul 9 '15 at 13:45

## 1 Answer

Consider the function $f:\mathbb R\to\mathbb R$ given by $f(x)=\sin(\log(1+x^2))$. It does not have a limit at $\pm\infty$ but its derivative $$f'(x)=\cos(\log(1+x^2))\frac{2x}{1+x^2}$$ goes to zero as $x\to\pm\infty$.

Let me add how I came up with this function: First, $\log(x)$ tends to infinity as $x\to\infty$ but its derivative goes to zero. To make it behave well in both directions and at the origin, we change $x$ to $1+x^2$; note that $\log(x^2)=2\log(x)$ so the asymptotic behaviour is essentially the same. Now we have a function that goes to infinity at infinity but the derivative goes to zero. If we compose this with a nice smooth function that does not have a limit at infinity, we should be done. And indeed, the function $f$ given above works.