Let (M,d) be a metric space, and M1, M2 be two subspace of M.
Edit: I forgot to mension that both M1 and M2 are dense.
Suppose we have
$f: M \rightarrow M$ and we know f is an isometric mapping from M1 to M1, i.e., $$ d(f(a),f(b))=d(a,b) $$ for any $a,b \in M1$.
Suppose we also have $$ d(f(a),f(b))=d(a,b) $$ for any $a \in M1$ and $b \in M2$.
The question is : can we say that f is an isometric mapping of $M1\cup M2$?
In other words, is it possible to show that $$ d(f(a),f(b))=d(a,b) $$ for any $a,b \in M1\cup M2$.
I think it is true in Euclidean space, but I have no idea how to do it in a general metric space.
Any suggestion would be greatly appreciated.
$M_1=\{a\}$, $M_2=\{b,c\}$, $f(a)=a, f(b)=f(c)=b$, $d(x,y)=1$ if $x\neq y.$