Counterexample: Continuous, but not uniformly continuous functions do not preserve Cauchy Sequences

Let us note $$A = \{x \in \mathbb{Q} : x > \sqrt{2}\}.$$ Then the characteristic function $\chi_A : \mathbb{Q} \to \mathbb{Q}$ is continuous but doesn't preserve Cauchy sequences.


The answer above already provides a nice counterexample. I will address your other questions.

You are right that the counterexample must be a function which is not the restriction to $\mathbb{Q}$ of a continuous function from $\mathbb{R}$ to $\mathbb{R}$. In particular, there does not exist a Cauchy sequence of rational numbers $(x_n)$ such that $(x_n^2)$ is not Cauchy.

Let $(x_n)$ be a Cauchy sequence of rational numbers and let $f:\mathbb{R}\to\mathbb{R}$ be a continuous function such that $f(\mathbb{Q})\subset\mathbb{Q}$. Since $(x_n)$ is Cauchy and $\mathbb{R}$ is complete, $(x_n)$ converges (in $\mathbb{R}$, not necessarily to a rational number). Then by the continuity of $f$, the sequence $(f(x_n))$ converges. But convergent sequences are Cauchy, so $(f(x_n))$ is Cauchy. Restricting the function $f$ to $\mathbb{Q}$ and applying it to $(x_n)$ still yields a Cauchy sequence.


Another simple example is given by $f(x)=\frac1{x^2-2}$.