TITLE: $ f: \mathbb{R}^n \to \mathbb{R}^m $ preserving distances
QUESTION [8 upvotes]: Let $ f: \mathbb{R}^n \to \mathbb{R}^m $ be a function, that preserves distances. Prove that there exist a linear transformation $T$, and a vector $\mathbf{j} \in \mathbb{R}^m $ such that $ f(\mathbf{x}) = T\mathbf{x}+\mathbf{j}$ for every $\mathbf{x} \in \mathbb{R}^n $.   

First I suppose that $f(\mathbf{0})=\mathbf{0}$, since I can translate, without losing the property of preserving distances. So I need to prove that $f$ is linear. 
If I simply prove that $ f(\mathbf{x}+\mathbf{y}) = f(\mathbf{x})+f(\mathbf{y})$  then it´s done, because obviously I can deduce that this implies $ f(r\mathbf{x}) = rf(\mathbf{x}) $ with $r$ rational. But since I know that $f$ preserves distances, then in particular $f$ is continuous, and it´s easy to prove that this implies that $ f(c\mathbf{x}) = cf(\mathbf{x})$ for every real number $c$.
But I don´t know How can I prove that $f$ respects the sum.

REPLY [7 votes]: Consider the parallelogram determined by $\mathbf{0}$, $\mathbf{x}$, $\mathbf{y}$, and $\mathbf{x}+\mathbf{y}$. Because $f$ respects distances,  the points $f(\mathbf{0}) = \mathbf{0}$, $f(\mathbf{x})$, $f(\mathbf{y})$, and $f(\mathbf{x}+\mathbf{y})$ must also give a parallelogram (since the distance from $\mathbf{0}$ to $f(\mathbf{x})$ equals the distance from $f(\mathbf{y})$ to $f(\mathbf{x}+\mathbf{y})$, and the distance from $\mathbf{0}$ to $f(\mathbf{y})$ is equal to the distance from $f(\mathbf{x})$ to $f(\mathbf{x}+\mathbf{y})$).
Therefore, $f(\mathbf{x}+\mathbf{y})$ must be the fourth vertex of the parallelogram determined by $\mathbf{0}$, $f(\mathbf{x})$ and $f(\mathbf{y})$, namely $f(\mathbf{x})+f(\mathbf{y})$.
Added. You can verify that $f(\mathbf{x}+\mathbf{y})$ lies in the same plane as $\mathbf{0}$, $f(\mathbf{x})$, and $f(\mathbf{y})$ by using the fact below that $f$ respects midpoints: the diagonals of the original parallelogram bisect each other, hence the line joining $f(\mathbf{x})$ and $f(\mathbf{y})$ and the line joining $\mathbf{0}$ and $f(\mathbf{x}+\mathbf{y})$ bisect each other. 
You can also prove homogeneity by showing that $f(\frac{1}{2}(\mathbf{x}+\mathbf{y})) = \frac{1}{2}f(\mathbf{x}) + \frac{1}{2}f(\mathbf{y})$, by considering the spheres of radius $\frac{1}{2}\lVert \mathbf{x}-\mathbf{y}\rVert$ around $\mathbf{x}$, $\mathbf{y}$, $f(\mathbf{x})$ and $f(\mathbf{y})$; that is, $f$ respects midpoints of line segments. From this it follows that $f(t\mathbf{x}+(1-t)\mathbf{y}) = tf(\mathbf{x}) + (1-t)f(\mathbf{y})$ for all dyadic rationals $t\in (0,1)$, hence by continuity for all $t\in [0,1]$. From there, it follows that $f(n\mathbf{x}) = nf(\mathbf{x})$ for all integers $n$, and then homogeneity follows.

REPLY [7 votes]: One trick is to use the polarization identity. This allows us to prove linearity directly, without approximation arguments.
Preserving distances means that 
$$
\|f(x)-f(y)\|=\|x-y\|
$$
for all $x,y$. The assumption $f(0)=0$ allows us to also get $$\|f(x)\|=\|x\|$$ for all $x$. 
Now, using the polarization identity,
$$
\langle f(x),f(y)\rangle=\frac{\|f(x)\|^2+\|f(y)\|^2-\|f(x)-f(y)\|^2}4
=\frac{\|x\|^2+\|y\|^2-\|x-y\|^2}4=\langle x,y\rangle.
$$
Now we get, for any $x,y,z\in\mathbb{R}^n$, $\lambda\in\mathbb{R}$,
$$
\langle f(\lambda x+y),f(z)\rangle=\langle\lambda  x+y,z\rangle=\lambda \langle x,z\rangle+\langle y,z\rangle=\langle\lambda  f(x)+f(y),f(z)\rangle,
$$
so
$$
\langle f(\lambda x+y)-\lambda f(x)-f(y),f(z)\rangle=0
$$
for any $z$, in particular $z=x$, $z=y$, $z=x+y$.
But then
$$
\|f(\lambda x+y)-\lambda f(x)-f(y)\|^2=\langle f(\lambda x+y)-\lambda f(x)-f(y),f(\lambda x+y)-\lambda f(x)-f(y)\rangle=0
$$
after distributing on the second term of the inner product. 
So $f(\lambda x+y)=\lambda f(x)+f(y)$ for all $x,y\in\mathbb{R}^n$, $\lambda\in\mathbb{R}$.