Proving that if $f:D \to \mathbb{R}$ is continuous and compact, then {$f(x_n)$} is a Cauchy sequence.

If $f:D \to \mathbb{R}$ be continuous and let {${x_n}$} be a Cauchy sequence in $D$. Assuming $D$ is closed and bounded, show that {$f(x_n)$} is a Cauchy sequence.

I've tried this, but I'm not convinced of myself:

Let $f(x)$ be a continuous $\in \mathbb{R}$ with $(a_n)$ in a compact interval. Let $\epsilon>0$ be given. Since $f$ is continuous on a compact set, it is also uniformly continuous. Since $f$ is uniformly continuous there exists $\delta>0$ such that for all $x,y\in \mathbb{R}$ such that $|x-y|<\delta$, $|f(x)-f(y)|<\epsilon$. And since $(a_n)$ is Cauchy and $\delta>0$, there exists a $N\in \mathbb{N}$ such that for all $n,m \geq N$ we have $|x_n - x_m|<\delta$. Thus $|f(x)-f(y)|<\epsilon$, $\epsilon>0$. Thus $f((x_n))$ is Cauchy.

• Are you assuming that $D$ a subset of $\mathbb{R}^n$? Closed and bounded sets in arbitrary metric spaces need not be compact, as the answers below assume. – Dabbler Sep 10 '18 at 21:52

A sequence is Cauchy if and only if it has Cauchy subsequence. In a compact space, every sequence has a convergent subsequence. Therefore, in a compact space every sequence is Cauchy. Since $f(D)$ is compact, you have the result.
• Why is $f(D)$ compact? – user258700 Dec 5 '15 at 23:35
• I always forget that. Then, I also reason superficially (being in $\Bbb R^n$): well, continuous functions do not necessarily send closed sets to closed sets; so, why need they send compacts to compacts? Anyway, thanks. – user258700 Dec 6 '15 at 0:04