# Is an isometry necessarily surjective?

A mapping $f:X\to Y$ between metric spaces $(X,d_X)$ and $(Y,d_Y)$ is called an isometry if it preserves distances, i.e.
$$d_Y(f(a), f(b))=d_X(a,b)\text{ }\forall\text{ } a,b\in X$$

My question is:
Is an isometry necessarily surjective? If yes, how can we prove it? If no, is there any counterexample?

My guess is yes. To show that a function is surjective we need to show for all $y\in Y$, there exist some $x\in X$ such that $y=f(x)$.
Let’s suppose $f$ is not surjective, then there exist some $y_1\in Y$ such that for all $x\in X$, $y_1\neq f(x)$. Then $d_Y(y, y_1)$ is well defined but $d_X(x, x_1)$ is not defined because there is no $x_1$ such that $f(x_1)=y_1$. Hence $f$ is not an isometry, a contradiction. Therefore $f$ must be surjective.

I am not sure whether my argument is correct. I would really appreciate any help that shows whether it must be surjective or not and suggestion to improve my proof or counterexample.

Thanks very much!

#### Solutions Collecting From Web of "Is an isometry necessarily surjective?"

In mathematics, an isometry is a distance-preserving injective map between metric spaces.
(Ref: https://en.wikipedia.org/wiki/Isometry)

Now the argument that you are giving is flawed because $d_X(x, x_1)$ is well defined the moment you gave the metric $d_X(,)$.
The isometry respects the metrics in $X$ and $Y$ through the relation $$d_Y(f(a), f(b))=d_X(a,b)\text{ }\forall\text{ } a,b\in X$$ and it does not define the metric $d_Y(,)$.

Consider the following linear map on the Hilbert space $l^2(\mathbb{N})$. Define $T : l^2 \to l^2$ by
$T((x_1,x_2,….)) = (0,x_1,x_2,…)$.

Clearly $T$ is an isometry, but not onto.