Differentiability of composition with every path implies differentiability
I'm struggling with this problem from my book Curso de Analise Vol. 2 by Elon Lages Lima.
Let $U\subseteq \mathbb{R}^n$ be an open set, $a\in U$ and $f:U\to \mathbb{R}$ with the following property: for every $v\in \mathbb{R}^n$ and every path and $g:(-\epsilon,\epsilon)\to U$ with $g(0)=a$ and $g'(0)=v$ the composite map $f\circ g:(-\epsilon,\epsilon)\to R$ satisfies $(f\circ g)'(0)=T(v)$ where $T:\mathbb{R}^n\to\mathbb{R}$ is a fixed linear transformation. Prove that $f$ is differentiable at $a$.
It's clear that one must have $f'(a)=T$ so one has to prove \begin{equation} \tag 0\lim_{v\to 0}\frac{f(a+v)-f(a)-T(v)}{|v|}=0 \end{equation}
I can't think of any path other than $t\mapsto a+tv$ but then I'm not using the hypothesis to its full strength. I also tried a proof by negating that limit and trying to construct a path from there, but didn't succeed.
How do I approach the problem? Any hints?
I'll accept zhw.'s hint but write the full answer here because the question has received some attention.
Suppose the limit in $(0)$ doesnt exist, then there exists a sequence $v_k$ with $v_k\to 0$ and $v_k\neq 0$ such that
$$\tag 1\frac{|f(a+ v_k) - f(a) - Tv_k|}{|v_k|} \ge \epsilon$$
for all $k$. Write $v_k=r_ku_k$ where $r_k=|v_k|$ and $|u_k|=1$. Then some subsequence of $u_k,$ which I'll still denote by $u_k,$ converges to some $u, |u|=1.$ Passing to a further subsequence if necessary, we can assume $r_1>r_2 >\cdots.$ Now this is the tricky part: how to define $g$. First we define $g$ in $[0,r_1]$. Set $g(0)=a$. For $t\in (0,r_1]$, since $r_k\to 0$ and $r_1>r_2>\cdots$ there is a $k$ such that $t\in[r_{k+1},r_k]$ and we set
$$g(t)=a+r_{k+1}\frac{r_k-t}{r_k-r_{k+1}}u_{k+1}+r_k\frac{t-r_{k+1}}{r_k-r_{k+1}}u_k$$
It's easy to see that $g$ is well defined and $g(r_k)=a+v_k$. Now if $t\in [r_{k+1},r_k]$
$$\frac{g(t)-g(0)}{t}-u=\frac{r_{k+1}(r_k-t)(u_{k+1}-u)+r_k(t-r_{k+1})(u_k-u)}{t(r_k-r_{k+1})}$$
From which one can prove $g_+'(0)=u$. If we set $g(t)=-g(-t)$ for $t\in [-r_1,0]$ we get $g'(0)=u$.
We should have $(f\circ g)'(0)=Tu$, i.e.
$$\tag 2\lim_{t\to 0}\frac{f(g(t))-f(g(0))}{t}=Tu$$
Since $r_k\to 0$, $(2)$ implies that
$$\tag 3\lim_{k\to \infty}\frac{f(g(r_k))-f(g(0))}{r_k}=Tu$$
But $v_k/r_k=u_k\to u$ and $T$ is continuous so
$$\tag 4\lim_{k\to \infty}\frac{1}{r_k}Tv_k=\lim_{k\to \infty}T(\frac{v_k}{r_k})=Tu$$
$(3)$, $(4)$ and the fact that $g(r_k)=a+v_k$, $g(0)=a$ and $|v_k|=r_k$ imply that
$$\lim_{k\to \infty}\frac{f(a+ v_k) - f(a) - Tv_k}{|v_k|}=0$$
contradicting $(1)$.
Hint: Suppose $f$ is not differentiable at $a.$ Then there exists $\epsilon>0$ and a sequence $v_k \to 0$ such that
$$\tag 1\frac{|f(a+ v_k) - f(a) - Tv_k|}{|v_k|} \ge \epsilon$$
for all $k.$ Write $v_k = r_ku_k,$ where $r_k = |v_k|$ and $|u_k|=1.$ Then some subsequence of $u_k,$ which I'll still denote by $u_k,$ converges to some $u, |u|=1.$ Passing to a further subsequence if necessary, we can assume $r_1>r_2 >\cdots.$ The idea is that the sequence $a +v_k = a + r_ku_k$ approaches $a$ tangent to the line $\{a+tu: t \in \mathbb R\}.$ So think of a path $g:\mathbb R \to \mathbb R^n$ such that $g(0)=a$ and $g(r_k) = a+r_ku_k$ for each $k.$ If you do it the right way, you should get $g'(0) = u,$ and because of $(1),$ $(f\circ g)'(0)$ will not exist, giving a contradiction.