According to the definition I am using, an isometry is a mapping $f:X \rightarrow Y$ between two metric spaces $(X,d_{X})$ and $(Y,d_{Y})$: $$ d_{Y}(f(a),f(b)) = d_{X}(a,b) $$ for all $a,b \in X $
I managed to prove that it is injective. I let $f(a)=f(b)$ so $d_{Y}(f(a),f(b))=d_{X}(a,b)=0$, which means $a=b$, by one of the axioms of distance. So $f(a)=f(b) \Rightarrow a=b$ and $f$ is injective. Now, I have to prove (or give a counterexample) that $f$ is surjective. I thought of a very simple counterexample, but I am not sure if it is right.
Consider $X,Y \subset \mathbb{R}^{2}$ such that $X=\left\{ (0,0),(0,1),(1/2,\sqrt{3}/2)\right\} $ and $Y=\left\{ (0,0),(0,1),(1/2,\sqrt{3}/2),(10,10)\right\} $. And the usual euclidean distance. I constructed $X$ so that for any two given points, their distance is always the same (=1). $Y$ contains $X$ and also another point that could be pretty much anything. Now I define $f(\textbf{x})=\textbf{x}$. Surely, $f$ is not surjective, but $d(f(a),f(b)) = d(a,b)$ for any $a,b \in X$.
Is my reasoning right?