TITLE: Do absolute values of differentiable functions with roots always exhibit cusps?
QUESTION [5 upvotes]: I am interested in the following question because I am hoping to be surprised by an exotic counterexample.

Conjecture: Let $x=a$ be a root of a differentiable function $f$ such that $f(x)>0$ for $k<x<a$ and $f(x)<0$ for $a<x<q$, where $k, q \in \mathbb{R} \cup \{\pm \infty\}$. Then $x=a$ is a cusp of $|f(x)|$.

I am essentially conjecturing that if you have a differentiable function $f$ which is non-constant around one of it's roots, then the absolute value function of $f$ will be non-differentiable at the root of $f$ specified. Would anyone be able to think of a proof sketch for this claim, or suggest a counterexample?

REPLY [10 votes]: As the comments to your question show, you don't have to go to very exotic functions to get a counterexample to your conjecture; it suffices for $f$ to have derivative $0$ at its root (and to satisfy the remainder of your requirements). The simplest kind of counterexample would be $x\mapsto x\,|x|$, that is
$$
  f(x)=\begin{cases}x^2&\text{if }x\geq0\\-x^2&\text{if }x<0.\end{cases}
$$
Now $|f(x)|=x^2$ is as nice as one could hope a function to be. Of course the original function is now only once differentiable at $0$, but you did not ask for more. If you want an example where both the original function and its absolute value are $\mathcal C^\infty$ (infinitely often differentiable everywhere) then contemplate
$$
  g(x)=\begin{cases}xe^{-1/x^2}&\text{if }x\neq0\\0&\text{if }x=0.\end{cases}
$$