# 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

#### Solutions Collecting From Web of "Is the max of two differentiable functions differentiable?"

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.

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|$.

$f(x) > g(x)$ Then $F:={\rm max}\{f,g\} =f$ is differentiable at $x$

If $f(x)=g(x)$ and $f(y)< g(y),\ y< x$ and $f(z)> g(z),\ z>x$, then $\frac{F(y)-F(x) }{y-x}$ goes to $g'(x)$ when $y$ goes to $x$

And $\frac{F(z)-F(x) }{z-x}$ goes to $f'(x)$ when $z$ goes to $x$. Hence in general $f'(x)\neq g'(x)$ so that it is not differentiable.