Show that $g:I\to\mathbb{R}$ is continuous and $f:(x-x_0)g(x)$ is differentiable (a) Let a function $g:I\to\mathbb{R}$ be continuous at $x_0\in I$. Prove that the function $f$ given by $f(x)=(x-x_0)g(x)$ is differentiable at $x_0$.
(b) Let a function $f:I\to\mathbb{R}$ be differentiable at $x_0\in I$ and $f(x_0)=0$. Prove that there exists a function $g:I\to \mathbb{R}$ that is continuous at $x_0 \in I$ such that $f(x)=(x-x_0)g(x)$.

Thought:
(a)
By $Fermat's$, since $g$ is continous, if $g'(x_0)=0$ then $g(x)$ is differentiable?
but how does it connect back with $f(x)$?
(b)
use the definition of every differentiable function is continuous?
Thus $f(x)$ is continuous and also $(x-x_0)$ so $g(x)$ too?
Thank you!!

Hints: 
Regarding $a)$, use the definition! The function $f$ is differentiable at $x_0$ if, and only if, the below limit exists and is finite:
$$\lim _{x\to x_0} \frac{f(x)-f(x_0)}{x-x_0}=\lim _{x\to x_0} \frac {(x-x_0)g(x)-(x_0-x_0)g(x_0)}{x-x_0}=\cdots$$
Proceed. Don't forget to use the hypothesis that $g$ is continuous at $x_0$.

Now $b)$. You're asked to prove the existence of a function $g$ such that, among other things,  $f(x)=(x-x_0)g(x)$, for all $x\in I$. This tells you that the function $g$ you're looking for is such that $\displaystyle g(x)=\frac{f(x)}{x-x_0}$, for all $x\in I\setminus \{x_0\}$. You want $g$ to be continuous, so $\displaystyle g(x_0)=\lim _{x\to x_0}\frac{f(x)}{x-x_0}$ if the limit exists. Try to prove it exists and find it. Remember your other hypothesis, namely that $f$ is differentiable and $f(x_0)=0$.
