Show that function distances are preserved If for all $x,y \in \mathbb{R}^n$ that satisfies $|x - y| = t$ also satisfies $|f(x) - f(y)|=t$ (for some constant $t \in \mathbb{R}^{+}$), show that $|f(x) - f(y)| = |x-y|$ for all values of $x,y \in \mathbb{R}^n$.
This seems very much intuitive to me and that $f(x) = x$ or that the range set is a copy of $\mathbb{R}^n$. My initial goal was to show if $r \in l(x,y)$, then $f(r) \in l(f(x),f(y))$ such that $|f(r)-f(z)| = |r - z|$ where $z \in \{x,y\}$. Showing this is enough to solve the problem. The most intuitive idea, however that seems to work is creating equilateral triangles in some way and make it work.
$\color{green}{\text{Edit :}}$ In $\mathbb{R}$, by taking $f$ as the greatest integer function with a period of $t$, we get a clear contradiction to the initial statement. The idea doesn't seem to directly work for higher dimensions, albeit the first answer claims so. Can this (or the claim in the original question) be proven for $n &gt; 1$?
This is true in $\mathbb{R}^n$ for $n\ge2$ and it is wrong in $\mathbb{R}$.
First not that $f:\mathbb{R}^n\to\mathbb{R}^n$ preserves the distance $t$ if and only if $\widetilde{f}(x)\triangleq\frac{1}{t}f(tx)$ preserves the distance $1$. So, we may suppose that $t=1$ without loss of generality.

If $n=1$ then the function
$$f(x)=\cases{x+1&amp;if $x\in\mathbb{Z}$,\\
x&amp;if $x\notin\mathbb{Z}$.}$$
is a counter-example.
If $n&gt;1$ then it is Beckman-Quarles theorem that date back to 1953. The article is freely accessible here.
I don't think this is true without further hypothesis (continuity maybe), because we can build counter examples with periodic stuff or similar.
In $\mathbb R$ take $f(x)=\lfloor x\rfloor$ and $t=1$. Then $f(\frac12)-f(\frac 13)=0\neq \frac 12-\frac 13$.
I think we can extend that to higher dimensions without too much issues.