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

cauchy-sequencesexamples-counterexamplesreal-analysisuniform-continuity

I want to prove this:

There exists a continuous function $f:\mathbb{Q}\to\mathbb{Q}$, but not uniformly continuous, and a Cauchy sequence $\{x_n\}_{n\in\mathbb{N}}$ of rational numbers such that $\{f(x_n)\}_{n\in\mathbb{N}}$ is not a Cauchy sequence.

More particular:
Does there exist a Cauchy sequence $\{x_n\}_{n\in\mathbb{N}}$ of rational numbers such that $\{x_n^2\}$ is not Cauchy?

I think that would be weird, and the counterexample should be with some function that is continuous in $\mathbb{Q}$ but not in $\mathbb{R}$. Am I right? Which would be some example of that?

Best Answer

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.