Prove if $|f|$ is differentiable at $a$ and $f$ is continuous at $a$ then $f$ is differentiable at $a$ I have a problem
Prove if $|f|$ is differentiable at $a$ and $f$ is continuous at $a$ then $f$ is differentiable at $a$
Hint: I need prove $|\lim_{x\rightarrow a}\frac{f(x)-f(a)}{x-a}|=\lim_{x\rightarrow a}|\frac{f(x)-f(a)}{x-a}|$
I try use this fact: $\lim_{x\rightarrow a}\frac{|f(x)|-|f(a)|}{x-a}$ Exist and $\lim_{x\rightarrow a}|f(x)|-|f(a)|=0$ But I'm stuck, please someone help me?
 A: Hints for $f(a) = 0$:


*

*If $|f|$ is differentiable, then following limits exist and agree:
$$ \lim_{x \to a^-} \frac{|f(x)|}{x - a}, \quad \lim_{x \to a^+} \frac{|f(x)|}{x - a}. $$
Show that the derivative of $|f|$ at $a$ must be zero.

*Now, as for $f$ we have
$$ \left|\lim_{x\to a} \frac{f(x)}{x - a}\right| = \lim_{x\to a} \left|\frac{|f(x)|}{x - a}\right| = 0. $$

A: Using a $\delta,\varepsilon$ approach we can translate the conditions of differentiability and continuity of $f$ at $x=a$ as followings.
Continuity: $$\lim_{x\to a}f(x)=f(a)\Leftrightarrow \forall\varepsilon_1>0,\exists\delta_1>0,|x-a|<\delta_1\Rightarrow|f(x)-f(a)|<\varepsilon_1$$
Differentiability (assuming it is some finite value $M$): $$\lim_{x\to a}\frac{|f(x)|-|f(a)|}{x-a}=M\Leftrightarrow\forall \varepsilon_2>0,\exists\delta_2>0,|x-a|<\delta_2\Rightarrow \Big|\frac{|f(x)|-|f(a)|}{x-a}-M\Big|<\varepsilon_2$$
Formulating the problem in similar terms (assuming some finite value $L$):
$$\lim_{x\to a}\frac{f(x)-f(a)}{x-a}=L\Leftrightarrow \forall \varepsilon^*>0,\exists \delta^*>0, |x-a|<\delta^*\Rightarrow \Big|\frac{f(x)-f(a)}{x-a}-L\Big|<\varepsilon^*$$
So we need to show that using the inequalities from continuity and differentiability above to derive the inequality of either side of the last equivalence statement. First let $\delta^*=\min\{\delta_1,\delta_2\}$ then we have by the hypothesis that 
$$|f(x)-f(a)|<\varepsilon_1$$
and 
$$\Big|\frac{|f(x)|-|f(a)|}{x-a}-M\Big|<\varepsilon_2\Leftrightarrow ||f(x)|-|f(a)|-M(x-a)|<\varepsilon_2|x-a|<\varepsilon_2\delta^*$$
Using twice the triangle inequality in the expression $||f(x)|-|f(a)|-M(x-a)|$ we obtain 
$$||f(x)|-|f(a)|-M(x-a)|\leq||f(x)|-|f(a)||+|M||x-a|\leq|f(x)-f(a)|+|M||x-a|<|f(x)-f(a)|+|M|\delta^*<\varepsilon_1+|M|\delta^*$$
If we choose $\varepsilon_1,\varepsilon_2$ such that $\varepsilon_1+|M|\delta^*\leq \varepsilon_2\delta^*$ then we otain
$$|f(x)-f(a)|+|M|\delta^*<\varepsilon_2\delta^*\Leftrightarrow |f(x)-f(a)|<(\varepsilon_2-|M|)\delta^*$$
Similarly for our inequality in question we have
$$\Big|\frac{f(x)-f(a)}{x-a}-L\Big|<\varepsilon^*\Leftrightarrow |f(x)-f(a)-L(x-a)|<\varepsilon^*|x-a|<\varepsilon^*\delta^*$$
Applying again twice the triangle inequality on the expression $|f(x)-f(a)-L(x-a)|$ yields
$$|f(x)-f(a)-L(x-a)|<|f(x)-f(a)|+|L|\delta^*<\varepsilon_1+|L|\delta^*$$
Choosing $\varepsilon^*=\varepsilon_2+|L|-|M|$ and by the fact that we chose $\varepsilon_1,\varepsilon_2$ such that $\varepsilon_1+|M|\delta^*\leq\varepsilon_2\delta^*$ then 
$$|f(x)-f(a)-L(x-a)|<\varepsilon_1+|L|\delta^*<\varepsilon^*\delta^*$$
This should complete the argument. Notice that $\varepsilon:=\varepsilon(\delta^*)=\varepsilon_2(\delta^*)+|L|-|M|$ as expected a function of $\delta^*$.
A: Hint for $f(a)>0$ or $f(a)<0$.
Assume $f(a)>0$ and take $\epsilon=\frac{f(a)}{2}$.
$f $continuous at a$\implies$
$\exists \eta>0 : \forall x\in (a-\eta,a+\eta)$
$0<\frac{f(a)}{2}<f(x)<\frac{3f(a)}{2}$
and $|f(x)|=f(x) \implies$
$f$ differentiable at $a$ since $|f|$ is.
the same approach if $f(a)<0$
