TITLE: Finding a pair of functions with properties
QUESTION [8 upvotes]: I need to find a pair of functions $f$, $g$ such that 

$f$ is not differentiable at  $x = 0$
$g$ is not differentiable at $f(0)$
$g \circ f$ is differentiable at $x = 0$

I've tried a lot of functions but just can't seem to find ones that work. Any help would be appreciated, thank you.

REPLY [13 votes]: The first condition suggests $f(x)=|x|$ as a relatively simple example. Then $g(x)=x-|x|$ is also not differentiable at $x=f(0)=0$, and $(g\circ f)(x)=|x|-|x|$ is identically zero, so it is certainly differentiable at $x=0$.