Question:
If $(f \circ f)$ is differentiable on $\mathbb R$, then $f$ is differentiable on $\mathbb R$.
Is this statement true or false and why?
I have had a look at this question and really can't get my head around it.
I have thought that it is False, because if we let $f(x) = 2$, $(f\circ f)$ can't be defined as $(f(f(2))$ doesn't exist. So the statement would be false as we can't define $(f\circ f)$ so it can't be differentiable on $\mathbb R$.
Is this way of looking at it right or not?
There is a very simple counterexample. Consider $$ f(x)=\begin{cases}2 & x\geq 0\\1 & x<0\end{cases} $$ which is not differentiable (not even continuous) at $0$ but $f\circ f\equiv 2$ is constant, so differentiable on $\mathbb R$.