Find the necessary and sufficient condition on $g$ for which $f$ is differentiable at $0$ 
Suppose two functions $f,g: \mathbb{R} \to \mathbb{R}$ satisfy $f(x) = xg(x)$ for all $x \in \mathbb{R}$. Find the necessary and sufficient condition on $g$ for which $f$ is differentiable at $0$. In such case find $f'(0)$.

We have $f'(0) = xg'(0) +g(0)$ and thus $f'(0) = g(0)$ if $g'(0)$ exists. So in order for $f'(0)$ to exist $g$ must be differentiable at $0$? 

Using the definition we have  $\lim_{h\rightarrow 0}\frac{f(0+h)-f(0)}h =\lim_{h\rightarrow 0}\frac{hg(h)-0\cdot g(0)}h =\lim_{h\rightarrow 0}g(h)$ so f'(0) exists iff g is continuous at 0.
