Let $I=[a,b]$ and $J=[c,d]$ be two closed intervals of real numbers
Let $f: I \times J \to \mathbb{R}$ be a function such that $f(x,y)$ has partial derivatives of the variables $x$ and $y$ For all $x \in I$, let $y_m(x)$ be such that $$ \max_{y \in J} |f(x,y)| = |f(x,y_m(x))| $$
My question is if the function $y_m(x)$ is derivable in $x$
Thanks for any suggestion
Counterexample: On $[-1,1]\times [0,1],$ define $f(x,y) = C-(y^2-x^2)^2$ for a large enough positive constant $C.$ Then $y_m(x) = |x|.$
Added later: A more ambitious example: Let $W:[0,1]\to [0,1]$ be a continuous nowhere differentiable function. Then the graph of $W,$ call it $G_W,$ is a compact subset of $\mathbb R^2.$ Now it is well known that given any closed subset $E \subset\mathbb R^2,$ there is a $C^\infty$ function $g$ on $\mathbb R^2$ such that $g=0$ on $E,$ and $g>0$ off of $E.$ Choose such a $g$ relative to $E = G_W.$ Then let $f=2-g.$ We get $y_m(x) = W(x)$ for each $x\in [0,1].$ Thus $y_m$ is nowhere differentiable on $[0,1].$