What is the derivative of max and min functions? If I define a function:
$f(x) = \max[g(x),h(x)]$
What is $f'(x)$?
 A: 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.
A: 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}$$
A: 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.   
