Assume $f$ is uniformly continuous and unbounded on $[0,\infty)$. Whether the following statement is true? Assume $f$ is uniformly continuous and unbounded on $[0,\infty)$. Is it true that either $\displaystyle\lim_{x\to\infty}f(x)=+\infty$ or $\displaystyle\lim_{x\to\infty}f(x)=-\infty$ 
Please give a hint for the problem. I have tried to find some oscillating function, but could not find. Give some hint for this problem.
 A: What about
$$f(x)=
\begin{cases}
n + (x -n^2) & n^2 - n \le x \le n^2\\
n - (x - n^2) & n^2 \le x \le n^2 + n\\
0 & \text{otherwise}
\end{cases}$$
for $n \ge 3$ integer. Easy to prove that for $x,y \in \mathbb R$ you have $\vert f(x)- f(y)\vert \le \vert x - y \vert$.
A: Intuitively, $x\sin(x)$ was on the right the track but the function has to keep forcing itself to $0$ every $\pi$, so if only there was a way to slow down the oscillation as the function grows unbounded. 
For a pretty counterexample, use 
$$f(x) = \begin{cases} x\sin(\log|x|) & x\neq 0 \\ 0 & x=0 \\ \end{cases}$$
The derivative $\cos(\log|x|) + \sin(\log|x|)$ is bounded, making this function Lipschitz, hence uniformly continuous, but its limit as $x\to \infty$ does not exist.
A: Here is a description of the graph of a counterexample function, constructed explicitly for this context:
Start at the origin, and go up in a straight line with slope $1$ until the you get to $1$. Then go down in a straight line at slope $-1$ until you get to a $y$-value of $-2$. Then go up in a straight line at slope $1$ until you hit $3$, then go down until you hit $-4$, and so on.
This will be unbounded and uniformly continuous, but it won't have a limit as $x\to \infty$. It's not entirely straight-forward to write down a formula for this function, but that's not really necessary either. So we're fine.
If you want a function with a nice formula, you could take something like $\sqrt x\sin(\sqrt x)$. It is basically a "smoothed-out" version of the function I describe above. It's a bit more difficult to come up with, but it's not difficult to check that the derivative is bounded, and the function therefore is Lipschitz and uniformly continuous. But it is also clearly unbounded, as the different maxima and minima of $\sin(\sqrt x)$ gives ever larger and smaller values of $\sqrt x\sin(\sqrt x)$.
