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?


  • 9
    $\begingroup$ If you are interested, there is a function soft max that approximates the max-function smoothly. $\endgroup$
    – Eff
    Apr 22, 2015 at 12:24
  • 3
    $\begingroup$ As a slightly weaker argument -- $max(f,g)$ should at least always be piecewise-differentiable, correct? $\endgroup$
    – hBy2Py
    Apr 22, 2015 at 17:53
  • $\begingroup$ @Brian I'm pretty sure that's true, though it's possibly a separate question to be asked. $\endgroup$ Apr 22, 2015 at 18:56
  • $\begingroup$ @Matt Separate question asked $\endgroup$
    – hBy2Py
    Apr 22, 2015 at 19:08

4 Answers 4


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

  • $\begingroup$ simplest and easiest approach. wonderful $\endgroup$
    – monalisa
    Jul 15, 2015 at 6:33

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

  • 1
    $\begingroup$ may i ask what software you use to generate this graph? $\endgroup$
    – Nighty
    Apr 22, 2015 at 7:40
  • 3
    $\begingroup$ @LeeKM: Microsoft Mathematics. It's free and does symbolic computation as well. $\endgroup$
    – user65203
    Apr 22, 2015 at 7:41
  • 2
    $\begingroup$ I'll remember this answer if I ever need to draw a pair of lips in a Mathematica plot. $\endgroup$ Apr 22, 2015 at 11:27

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

  • 4
    $\begingroup$ This is a nice answer; a little more work gives a precise condition for exactly when $\max(f,g)$ will be differentiable. $\endgroup$ Apr 22, 2015 at 12:24
  • 6
    $\begingroup$ The condition is: whenever $f(a) = g(a)$, $f'(a) = g'(a)$. $\endgroup$ Apr 22, 2015 at 12:26

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


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .