TITLE: Construction of a join function of infinitely many derivatives.
QUESTION [5 upvotes]: I am curious if anyone can construct a function made up of more than one e.g. $|x| = x, x\geq 0$ and $-x, x\leq 0$. However I would require that it must be infinitely differentiable and in the above case of $|x|$ it must be infinitely differentiable at 0. I suspect that we can't find one but if anyone has an example or a rigorous explanation as to why it doesn't work it would be grateful.

REPLY [7 votes]: The standard example is $$f(x)=\left\{\begin{array}{ll}e^{-1/x},& x>0\\ 0,& x\le 0\end{array}\right.$$
$f$ is infinitely differentiable everywhere.