13

If I define a function:

$f(x) = \max[g(x),h(x)]$

What is $f'(x)$?

  • 1
    Welcome to Math.SE! Could you provide some context, so that it is easier for others to help you. What kind of answer are you looking for? What class of functions do $f,g,h$ belong to? – Hrodelbert Apr 16 '15 at 10:20
  • 1
    I believe this can be written as a piecewise function, but you can employ the absolute value function if you feel like it. By the way, if, at any point $x$ we have $g(x)=h(x)$ and $g'(x)\ne h'(x)$, I don't believe the function has a derivative at that point. – Akiva Weinberger Apr 16 '15 at 10:26
  • @columbus8myhw: See my comment to one of the answers. I conclude as you, that if $g(x_0)=h(x_0)$ but $g'(x_0)\neq h'(x_0)$ then it is NOT differentiable at that point. – String Apr 16 '15 at 10:37
  • I'm not confident enough to speak with great authority here, but I think you can define distributional derivatives of these functions. I.e. the derivative will be a dirac delta at points of discontinuity. – Benjamin Lindqvist Apr 16 '15 at 10:39
  • Ok got the point, but in the case the $g(x)$ is totally equal to $h(x)$ or these curves are tangent each other, I have $f(x_{0})'=g(x_{0})'=h(x_{0})'$. For example $f(x) = \max[2x^{2},x^{2}]$ – Jonathas Maciel Apr 21 '15 at 11:52

3 Answers3

16

I assume that $f$ and $g$ are differentiable. You can write $$ \max(f(x),g(x)) = \frac{f(x) + g(x) + |f(x) - g(x)|}{2}$$ and calculate the derivative of your function at those points where it exists (note that $x \mapsto |x|$ is not differentiable at $0$, so it is not clear that the derivative exists at those points where $f(x) = g(x)$.) Distinguishing the cases in the different regions, what we obtain is the following

$$ \frac{d}{dx} \max(f(x),g(x)) = \begin{cases} f'(x) & \text{if} \quad f(x) = g(x) \text{ and } f'(x) =g'(x) \\ g'(x) & \text{if} \quad g(x) > f(x) \\ f'(x) & \text{if} \quad f(x) > g(x) \\ \text{undefined} & \text{if} \quad f(x) = g(x) \text{ and } f'(x)\neq g'(x) \end{cases}$$

user159517
  • 7,816
  • 1
  • 18
  • 43
  • 1
    I like this rendering of it! This also helps us to see when we will succeed even at points where $f(x)=g(x)$. Suppose $h(x)=f(x)-g(x)$ and $h(x_0)=0$. Then if $h'(x_0)=0$ we have $h'(x)=-h'(x)=0$ so that $|h(x)|$ is differentiable at $x_0$. If $h'(x_0)\neq 0$ it is not. Also note that $h'(x_0)=0$ corresponds to $f'(x_0)=g'(x_0)$. – String Apr 16 '15 at 10:29
  • 3
    You can differentiate this into $\dfrac{f'(x)+g'(x)+(f'(x)-g'(x))\operatorname{sign}(f(x)-g(x))}2$, where $\operatorname{sign}(x)=\dfrac x{\lvert x\rvert}$ is $1$ if $x$ is positive and $-1$ if $x$ is negative. (Let's define $\operatorname{sign}(0)$ to be undefined, though it's often considered to be zero.) Don't confuse the sign function with the sine function. – Akiva Weinberger Apr 16 '15 at 10:40
  • (For pronunciation purposes, it's sometimes called the "signum" function to avoid confusion with the sine function.) – Akiva Weinberger Apr 16 '15 at 10:41
  • 1
    @AlbertoDebernardi What about $\max{x^3,-x^3}$? That's differentiable everywhere. If $f(x_0)=g(x_0)$ at a point $x_0$, but also $f'(x_0)=g'(x_0)$, there's no problem there. – Akiva Weinberger Apr 16 '15 at 10:45
  • @AlbertoDebernardi: What prevents $h(x)=\max{x^2,-x^3}$ from being differentiable at $x=0$? – String Apr 16 '15 at 10:45
  • 1
    Since this question is unfortunately closed I have to write a comment. this answer and @AkivaWeinberger are correct but the expression you want depends on the goal. Operationally you may prefer this $\frac{\mathrm{d}}{\mathrm{d}x}\mathrm{max}(f(x), g(x)) = { {\mathrm{if } f(x) > g(x), f'(x)}, {\mathrm{if } f(x) < g(x), g'(x)}, {\mathrm{if } f(x) = g(x), {\mathrm{if }f'(x) = g'(x), f'(x), \text{undefined otherwise}}}$ – alfC May 24 '18 at 03:40
4

This function does not need to have a derivative. For example, pick $g(x) = x$ and $h(x)=-x$. Then we obtain $$ f(x) = \max(x,-x) = |x| $$ which does not have a derivative at $x=0$. By picking uglier fuctions $g$ and $h$ you can create more of these points.

Jolien
  • 1,645
0

I assume that $g,h$ are real functions of one variable defined on some open set $\mathcal{D}$. Then $f$ admits a derivative tt the points $x\in \mathcal{D}$ such that $g(x)\not=h(x)$ otherwise nothing can be said in general. For such a point, if $g(x)>h(x)$ then $f'(x)=g'(x)$, the other case is alike.