$f:(a \space b)\rightarrow \mathbb{R}$ is a continuous function such that $|f|$ is differentiable, then $f$ is differentiable or not Let $f:(a\space b) \rightarrow \mathbb{R}$ be a continuous function and |f| is differentiable on $(a\space b)$. Then $f$ is differentiable or not?
Intuitively I am guessing it to be true and have tried to prove using the definition of differentiability but didn't succeed.
 A: I’m going to bed soon, so I’m going to just write up an answer here.
Let $f:(a,b) \rightarrow \mathbb{R}$ be continuous. In the comments, you suggested that if $|f(x)|$ is differentiable, then either $f \geq 0$ or $f \leq 0$ on all of $(a,b)$. This is not the case. Indeed, a counter example may be given by $f(x) = x^3$ on the interval $(-1,1)$. Here we clearly have that $f$ takes on positive and negative values, but we have that $|x^3|$ is differentiable with derivative $\frac{d}{dx} |x^3| = 3 x |x|$.
You are right though that the problem is “easier” in the case that $f$ is non-negative or non-positive. Indeed we may prove the following “easy” lemma.
Lemma 1: Let $f:(a,b) \rightarrow \mathbb{R}$ be continuous, and $|f|$ be differentiable. If $x_0 \in (a,b)$ and $f(x_0) \neq 0$, then $f$ is differentiable at $x_0$.
Proof:
This easily follows from the fact that since $f(x_0) \neq 0$, there is a sub-interval $(c,d) \subseteq (a,b)$ containing $x_0$ on which $|f| = f$ or $|f| = -f$.
So the only place where something could go wrong is at the zeros of $f$. Looking at the $f(x)=x^3$, we notice that the derivative at $0$, we have $f(0) = 0$. Further, we see that $f’(0) = |f|’(0) = 0$. Maybe this is always the case. We prove the following lemma:
Lemma 2: Let $f:(a,b) \rightarrow \mathbb{R}$ be continuous, and $|f|$ be differentiable. If $f(x_0) = 0$, then $f$ is differentiable at $x_0$ with $f’(x_0) = |f|’(x_0) = 0$.
Proof:
Looking at the difference quotients, we see:
$$\begin{align*} \frac{|f(x_0 + h) - f(x_0)|}{h} & = \frac{|f(x_0 + h) |}{h} \\ & = \frac{ \big | |f(x_0 + h)| \big |} {h} \end{align*}$$
It immediately follows taking limits as $h \rightarrow 0$ that $f’(x_0)$ exists and $f’(x_0) = |f|’(x_0)$.
While not strictly necessary for your problem, it is also easy to see that if $|f|’(x_0) \neq 0$, then there is a point $x_1$ such that $|f(x_1)| < 0$, which cannot be the case. Thus $f’(x_0) = |f|’(x_0) = 0$.
Combining these two lemmas, we get the following theorem:
Theorem: Let $f:(a,b) \rightarrow \mathbb{R}$ be continuous. If $|f|$ is differentiable, than $f$ is differentiable as well.
