I have a finite number $N$ of $\mathcal{C}^\infty$ functions $f_i : \mathbb{R}^n \to \mathbb{R}$. Then, I define:
$$f :\ \mathbb{R}^n \to \mathbb{R} ,\qquad x\mapsto f(x) := \max_{1 \leq i \leq N} f_i(x)\ .$$
I am wondering if there are any conditions such that, given $f_i(x) = f_j(x) = f(x)$:
$$\nabla f_i(x) = \nabla f_j(x) = \nabla f(x)$$
If I understand the question correctly, the maximum need not be differentiable at the point where all functions coincide. Example: Let $n=1$, $f_1(x)=x$, and $f_2(x)=-x$.
$$f_1(0)=f_2(0)=f(0)$$
but
$f(x)=|x|$ is not differentiable at zero.