TITLE: If $f: M\to M$ an isometry, is $f$ bijective?
QUESTION [11 upvotes]: $f: M\to M$ an isometry between metric spaces, is $f$ bijective?
$f$ obviously is injective. I proved bijection for $M=\mathbb{R}^n$. But I'm not sure if is true in general metric spaces.

REPLY [7 votes]: Jasons answers give a very nice example, but there are even examples when you have much more than only a metric.
Just giving an example for Hilbert spaces. Taking $\ell^2$ with  the norm
$$\|(a_k)_{k\in \mathbb{N}}\|=\sum_{k=0}^\infty |a_k|^2$$
(which is induced from the skalarproduct)
$$\langle (a_k)_{k \in \mathbb{N}}, (b_k)_{k\in \mathbb{N}}\rangle=
 \sum_{k=0}^\infty a_k b_k $$
and taking something like a switch function so that
$$f(a_0,a_1,a_2,\dots)=(0,a_0,a_1,a_2,\dots)$$
This one is obviously an isometry, but obviously not surjective.
For Hilbertspaces there are no finite dimensional examples, as with a scalarproduct ones always get that a isometry is affine linear (I will consider the linear cases which doesn't make a big difference), and as every isometry is injective the kernel is trivial (here I say it is linear) and hence the isometry is in finite dimensional case a bijection.