Is the max of two differentiable functions differentiable?

Given that $f$ and $g$ are two real functions and both are differentiable, is it true to say that $h=\max{(f,g)} $ is differentiable too?

Thanks


No. Consider $f(x)=x$ and $g(x)=-x$. You get $\max(f(x),g(x))=|x|$.


No, $h(x)=\max(\cos x,\sin x)$ is not differentiable at $x=\dfrac\pi4+k\pi$.

This is because when you switch from $f$ to $g$, the slopes have no reason to be equal.

enter image description here


not quite. Observe that: $\text{max}(f,g) = \dfrac{f+g + |f-g|}{2}$, thus if we simply let $f(x) = 2x, g(x) = x$, then we run into problem at $|x|$.