$\varrho(f(x),f(y))\geq\varrho(x,y)$, show $f$ onto Let $X$ be a compact metric space and $f:X\rightarrow X$ be a continuous function. If $\varrho(f(x),f(y))\geq\varrho(x,y)$ for all $x,y\in X$, show that $f$ is onto.
I need to show that $f(X)=X$, and $f(X)\subseteq X$ is true by definition, so I need $X\subseteq f(X)$. So take $x\in X$, $f(x)=y\in X$. Then $\varrho(x,y)\leq\varrho(y,f(y))$. The result follows in the case where $\varrho(x,y)=\varrho(y,f(y))$, but how can I show it if $\varrho(x,y)<\varrho(y,f(y))$?
 A: Let $y\in X$ be arbitrary. Consider the sequence $y_n = f^ {n}(y) = \underbrace{(f\circ \ldots \circ f)}_{n}(y)$ that consists of applying the function $n\geq 1$ times to the point $y$. Since $y_n \in f(X)$ for every $n\geq 1$, and $f(X)$ is compact (because $f$ is continuous), $(y_n)$ has a convergent subsequence $y_{n_k} \to f(x_0)$, for some $x_0 \in X$. Observe that for $k\geq 1$,
$$
\varrho(f^{n_k - 1}(y),x_0) \leq \varrho(f^{n_k}(y),f(x_0)) \underbrace{\longrightarrow}_{k\to \infty} 0.
$$
Therefore, $x_0$ is the limit of the sequence $(y_{n_k-1})_{k\in \mathbb{N}}$ (which is in $fX$), and $x_0 \in f(X)$. We write $x_0 = f(x_1)$, for $x_1\in X$. Using the same argument, we can prove $x_1$ is the limit of the sequence $(y_{n_k-2})_{k\in \mathbb{N}}$, which means $x_1\in f(X)$, and we write $x_1 = f(x_2)$. Proceeding like this, we get a sequence $(x_n)_{n\geq 0}$ in $f(X)$ such that $f(x_n)=x_{n-1}$ for all $n\geq 1$ and such that $y_{n_k-n+1} \to x_n$ (for large $k$). Then, for $k\geq 1$,
$$
\varrho(y,x_{n_k-1}) \leq \varrho(fy,x_{n_k-2}) \leq \ldots \leq \varrho(f^{n_k}(y),x_0).
$$
We then conclude that $y=\lim_{k\to \infty}x_{n_k - 1}$, which means $y\in f(X)$.
A: Suppose $X\nsubseteq f(X)$ so that there is $x\in X$ such that $x\notin f(X)$. Since $f(X)$ is compact so there is an $r>0$ such that $B(x, r)\cap f(X)=\emptyset$. Now take the sequence $\{f^k(x)\}_{k=0}^\infty$ in $X$. For any two integers $n$ and $m$ with $m=n+k$, $k\geq 1$, $$\varrho(f^n(x), f^m(x))=\varrho(f^n(x), f^{n+k}(x))\geq \varrho(f^{n-1}(x), f^{n-1+k}(x))\geq\cdots\geq\varrho(x, f^k(x))\geq r$$ because $f^k(x)\in f(X)$. That is, any two distinct terms of the sequence $\{f^k(x)\}$ differ by at least $r$ and hence it cannot have a convergent subsequence. This gives us a contradiction.
