If $\lim_{n\to\infty} x_n =0$, then $\{f(x_n)\}$ is Cauchy? For each positive integer $n$, let $x_n$ be a real number in $\left(0,\frac{1}{n}\right)$. Is the following true?

If $f$ is a continuous real-valued function defined on $(0,1)$, then $\{f(x_n)\}_{n=1}^\infty$ is a Cauchy sequence.

I can't see why this is wrong. My quick thought was that, if $x_n$ is Cauchy and $f$ is continuous, then $f(x_n)$ is Cauchy as well. I am very sure this is true for compact domain. Is it something going wrong with $x=0$? Could someone give a counterexample?
 A: Hint: Try $f(x)=\frac{1}{x}$ and see what happens.
If $f$ were continuous on $[0,1)$ then you'd be fine, but because $0$ needn't be in the domain of $f$, it can behave 'arbitrarily badly' as $x \to 0$.
A: Take $f(x) = \ln x$ and $x_n = \dfrac{1}{n+1}$. You see that $f$ is continuous on $(0,1)$, and $0 < x_n < \dfrac{1}{n}$ and $f(x_n) = - \ln(n+1) \to -\infty$, hence is not Cauchy.
A: This would be true if $f$ is uniformly continuous (basically, a function that maps Cauchy sequences into Cauchy sequences).
You're right to be sure if the domain is compact, because a continuous real function on a compact is uniformly continuous.
Note that $(x_n)$ converges to $0$ by the squeeze theorem, so it is Cauchy. Now you just need a function that's not uniformly continuous on $(0,1)$ and one that has infinite limit at $0$ is good enough. Another example is $f(x)=\sin(1/x)$ and $x_n=1/(2n)$, because
$$
\lim_{n\to\infty}\sin(2n)
$$
does not exist (not very easy to show, though, but I'm sure you can find it on the site).
