Limit of $\frac{f\left(x+g\left(x\right)\right)-f\left(g\left(x\right)\right)}{x}$ as $x\to 0$ I'm trying to answer the following question:

Let $f$ be continuously differentiable in all of $\mathbb{R}$ and let $g:\mathbb{R}\to\mathbb{R}$ be a function satisfying $\lim_{x\to0}g\left(x\right)=0$. Show that
  $$\lim_{x\to0} \frac{f\left(x+g\left(x\right)\right)-f\left(g\left(x\right)\right)}{x}=f'(0)$$

At first I though it would be pretty simple triangular inequality from the definition of a limit, but it doesn't really work out for me...


let $\epsilon>0$, we can find $\delta$ such that $$\left|x\right|<\delta\implies\left|\frac{f\left(x\right)-f\left(0\right)}{x}-f'\left(0\right)\right|<\frac{\epsilon}{2}$$
    But as $g\left(x\right)\to0$ we can find $\delta_{g}$ such that
$$\left|x\right|<\delta_{g}\implies\left|g\left(x\right)\right|<\frac{\delta}{2}$$ 
Hence for $\left|x\right|<\min\left\{ \delta_{g},\frac{\delta}{2}\right\}$ we have that $x+g\left(x\right)<\delta$, and 
$$\left|\frac{f\left(x+g\left(x\right)\right)-f\left(g\left(x\right)\right)}{x}-f'\left(0\right)\right|=\left|\frac{f\left(x+g\left(x\right)\right)-f\left(0\right)+f\left(0\right)-f\left(g\left(x\right)\right)}{x}-f'\left(0\right)\right|$$


Any direction?
 A: Since $f(x)$ is $C^1$ you can use the mean value theorem. Namely
$$\frac{f\left(x+g\left(x\right)\right)-f\left(g\left(x\right)\right)}{x} = f'(h(x))$$
Here $h(x)$ is between $g(x)$ and $x + g(x)$. Note that as $x$ goes to zero so does $h(x)$. So since $f'$ is continuous, as $x$ goes to zero $f'(h(x))$ goes to $f'(0)$, and thus you have
$$\lim_{x \rightarrow 0} \frac{f\left(x+g\left(x\right)\right)-f\left(g\left(x\right)\right)}{x} = f'(0)$$
A: Taylor's theorem is often a useful tool in this regard.
Taylor's theorem gives
$f(z) = f(y) + f'(y)(z-y) + \int_y^z (f'(t)-f'(y))dt$, and so, for $x \neq 0$
\begin{eqnarray}
{f(x+g(x)) -f(g(x)) \over x} -f'(0) &=& { f'(g(x)) x + \int_{g(x)}^{x+g(x)} (f'(t)-f'(g(x)))dt\over x}-f'(0) \\
&=& f'(g(x))-f'(0)+ { \int_{g(x)}^{x+g(x)} (f'(t)-f'(g(x)))dt\over x}
\end{eqnarray}
Let $\epsilon>0$ and choose $r>$ such that $|f'(x)-f'(0)| < \epsilon $ for $x\in B(0,r)$. Now choose $\delta \le r$ such that $|g(x)| < r $ for $|x| < \delta$.
Then the above gives
\begin{eqnarray}
\left|{f(x+g(x)) -f(g(x)) \over x} -f'(0) \right| &\le& |f'(g(x))-f'(0)|+  | { \int_{g(x)}^{x+g(x)} (f'(t)-f'(g(x)))dt\over x} | \\
&\le& \epsilon + { \int_{g(x)}^{x+g(x)} |f'(t)-f'(g(x))|dt\over x} \\
&\le& \epsilon + \epsilon { \int_{g(x)}^{x+g(x)} dt\over x} \\
&=& 2 \epsilon
\end{eqnarray}
Hence we have the desired result.
A: If we use the chain rule and  Taylor expansions at $x=0$ $$f(x+g(x))=f(g(0)\big)+x \left(g'(0) f'(g(0))+f'(g(0))\right)+O\left(x^2\right)$$ $$f(g(x))=f(g(0))+x g'(0) f'(g(0))+O\left(x^2\right)$$ $$f(x+g(x))-f(g(x))=x f'(g(0))+O\left(x^2\right)$$ Now, since $\lim_{x\to0}g\left(x\right)=0$, then the result.
