Isometry in $\mathbb{R}^n$ I'm trying to prove that if $f\colon\mathbb{R}^n \to \mathbb{R}^n$  is a $\mathcal{C}^1$ mapping such that $f'(x)$ is a (linear) isometry for every $x \in \mathbb{R}^n$, then $f$ is an isometry. By an application of inverse mapping theorem and mean value theorem, we have that $|f(x) - f(y)| = |x-y|$ as long as $x$ and $y$ are sufficiently close. How to extend this to the whole space?
 A: Edit
Here's a much simpler argument.  Let $X\subseteq\mathbb{R}^n\times\mathbb{R}^n$ with $$X = \{(x,y)\in\mathbb{R}^n\times \mathbb{R}^n|d(x,y) = d(f(x),f(y)) \}.$$  Note that $(x,x)\in X$ for any $x$, so $X\neq \emptyset$.  Your observation is equivalent to the statement that $X$ is open.  To see $X$ is closed, note that if $g:\mathbb{R}^n\times\mathbb{R}^n\rightarrow\mathbb{R}$ with $g(x,y) = d(x,y) - d(f(x),g(y))$, then $g$ is continuous since $d$ and $f$ are, and $X = g^{-1}(0)$.  Hence, $X$ is a nonempty clopen subset of $\mathbb{R}^n\times\mathbb{R}^n$, so $X = \mathbb{R}^n\times\mathbb{R}^n$, so $f$ is an isometry.
(End edit)
Here's one approach, borrowed from Riemannian geometry.
Let $\gamma:\mathbb{R}\rightarrow\mathbb{R}^n$ be any straight line paramaterized by arclength, meaning that $\|\gamma(t)-\gamma(s)\| = |t-s|$ for any $t$ and $s$.  We will show that $f\circ \gamma$ is also a straight line parametrized by arclength.
Believing this for a second, for $x$ and $y$ in $\mathbb{R}^n$, if $\gamma$ is chosen to be the line going through $x$ and $y$ with $\gamma(t) = x$ and $\gamma(s) = y$, then we have \begin{align*} d(x,y) &= \|\gamma(t)-\gamma(s)\|\\\ &= |t-s|\\\ &= \|f(\gamma(t))-f(\gamma(s))\| \\\ &= d(f(x),f(y)), \end{align*} establishing what we want.
So, why is $f\circ \gamma$ a straight line parameterized by arclength?  This follows from your observation that $\|f(x)-f(y)\| = \|x-y\|$ for $x$ and $y$ close together.  More specifically, looking at the point $\gamma(t)$, we know that for $s$ close to $t$ (and therefore $\gamma(s)$ close to $\gamma(t)$), that $\|f(\gamma(t)) - f(\gamma(s))\| = \|\gamma(t)-\gamma(s)\|$.  This implies that for the line segment of points near $\gamma(t)$, that $f($segment$)$ is another line segment, parametrized by arclength.
Since $\mathbb{R}$ is connected, so is $f(\gamma(\mathbb{R}^n))$.  This implies that $f(\gamma(\mathbb{R}^n))$ is a union of line segments end point to end point where each segment is parameterized by arclength.  This is a straight line iff there are no corners.  But if $f(\gamma(t_0))$ is a corner, then $f$ brings points near $\gamma(t_0)$, but on either side of it, closer together, contradicting your earlier observation that locally $f$ preserves distance.
