Extending $f: X\subset \mathbb{R}^m\to\mathbb{R}^n$ an isometric immersion. 
Let $X\subset \mathbb{R}^m$ not empty and $f: X\to\mathbb{R}^n$ an isometric immersion. Prove that there exists an isometric immersion $\varphi: \mathbb{R}^m \to\mathbb{R}^n$ such that $\varphi|_X=f$. When $X$ generates (in the sense of linear algebra) $\mathbb{R}^m$, $\varphi$ is unique. Metrics are euclidean metrics (in particular, $\mathbb{R}^m$ and $\mathbb{R}^n$ metrics comes from usual inner product).

Part of proof:

Without loss of generality we can say that $f(0)=0$ (up translations). Then $f$ satisfies $f(x+y)=f(x)+f(y)$ and $f(\lambda x)=\lambda f(x) \ \forall \lambda\in\mathbb{R}$ because $f$ preserve distances and the fact that $\mathbb{R}^n$ euclidean metric comes from an inner product, is not so hard to prove.

I need to prove the existence of $T$ linear transformation such that $T|_X=f$ (assumming $f(0)=0$). I've tried extending $f$ using values of a basis of $X$, but is not factible to prove existence of $T$.
Also, is question possible if $m>n$? or exercise is just incomplete?.
I think that if $X$ generates $\mathbb{R}^m$ the uniqueness is obvious if $T$ is linear extension.
Added: I was opened a bounty for +100 because I need to prove existence of $T$. This is the only fact that I can't be formal. If you want to explain what happend if $m>n$ better. But the priority is a formal proof of the fact of existence of $T$.
 A: As noted in the OP, we may assume $0\in X$, and $f(0)=0$. The first thing to note is that  $f$ preserves the scalar product, since for any $x,x'$ in $X$ we have
\begin{align*}
\langle f(x),f(x')\rangle&=\frac{d(f(x),0)^2+d(f(x'),0)^2-d(f(x),f(x'))^2}{2}\\
&=\frac{d(x,0)^2+d(x',0)^2-d(x,x')^2}{2}\\
&=\langle x,x'\rangle
\end{align*}
Let $\{y_1,y_2,\dots,y_r\}\subseteq f(X)$ be a basis of $\text{span}(f(X))$. For each $i$ there as an $x_i$ such that $f(x_i)=y_i$. Let us put $H=\text{span}(x_1,x_2, \dots ,x_r)$, and denote by $H^{\perp}$ its orthogonal complement in ${\mathbb R}^m$.
Let $\phi$ be the linear mapping ${\sf span}(f(X)) \to H$, defined by $\phi(y_i)=x_i$. Then $\phi$ preserves scalar products by the equality above, so $\phi$ is an isometry.
Let $x\in X$ and $y=f(x)$. We can decompose $x$ as $x=h+k$, with $h \in H, k \in H^{\perp}$. Then $ \langle  h,k \rangle =0$ , and we have Pythagoras' equality $||x||^2=||h||^2+||k||^2$.
 For any $i$ we have
$$
\langle h,x_i\rangle =\langle x,x_i\rangle =\langle f(x),f(x_i)\rangle =\langle y,y_i\rangle =\langle \phi(y),\phi(y_i)\rangle =\langle \phi(y),x_i\rangle 
$$
So we see that $h$ and $\phi(y)$ are both in $H$ and have equal coordinates in the basis 
$(x_1, \ldots ,x_n)$. So $h=\phi(y)$. Then 
$$||h||^2=\langle h,h\rangle =\langle \phi(y),\phi(y)\rangle =\langle y,y\rangle =d(y,0)^2=d(x,0)^2=||x||^2$$
We deduce $||k||^2=||x||^2-||h||^2=0$, so $k=0$, and $x=h=\phi(y)$. Thus $f$ coincides with $\phi^{-1}$ where it is defined, so $f$ is linear and we are done.
