# Thread: Gradient for the max function

1. ## Gradient for the max function

Suppose $f(\vec{x})=\max_ix_i$. What is the gradient $\bigtriangledown f(\vec{x})=?$

Any help appreciated.

2. I don't believe that is a differentiable function.

3. THanks for ur reply. Can u provide a brief explanation for the non-differentiability of this function?? My major is electrical engineering, and background in analysis is not good.

4. If you were to graph max(x,y) on, say $-1\le x\le 1$, $-1\le y\le 1$ you would see sharp corners along the lines y= x and y= -x. Generally speaking, only "smooth" functions have derivatives.