# Proving differentiability using Caratheodory's Lemma

Let $I$ be an open interval and let $c\in I$. Let $f:I\rightarrow\mathbb{R}$ be continuous and define $g:I\rightarrow\mathbb{R}$ by $g(x)=\left|f(x)\right|$.

Prove that if $g$ is differentiable at $c$, then $f$ is also differentiable at $c$.

The hint given was to use Caratheodory's Lemma. Since $g$ is differentiable at $c$, there exists a function $\phi:I\rightarrow\mathbb{R}$ that is continuous at $c$ such that

$$g(x)-g(c)=\left|f(x)\right|-\left|f(c)\right|=\phi(x)\cdot(x-c)$$

I need some help on how to proceed.

Hint: Try by separating the three cases: $f(c)>0$ , $f(c)<0$ and $f(c)=0$.
1. If $f(c)>0$, by the continuity of $f$ at $c$ there is a neighborhood $J\subset I$ of $c$ such that $f_{/J}>0$.
2. Use same argument if $f(c)<0$.
3. If $f(c)=0$, show that $\phi(x)\to 0$ (as $x\to c$), i.e $g'(c)=0$.