# Why does the derivative of $g(z) = \max\{0,z\}$ not exist at $z = 0$?

Question: Why does the derivative of $g(z) = \max\{0,z\}$ not exist at $z = 0$?

I know that for $z = 0$ we have $g'(z) = \lim\limits_{h\to 0}\dfrac{g(z+h) - g(z)}{h} = \lim\limits_{h\to 0}\dfrac{g(h)}{h} = \lim\limits_{h \to 0} \dfrac{h}{h} = 1,$ as $g(h) = h$ if $h \neq 0$. If the limit exists the function has a derivative, right?

• It might be helpful to graph $g(z)$. There's a corner at $z=0$. – carmichael561 Dec 29 '17 at 14:53
• Your statement "$\lim\limits_{h\to 0}\frac{g(h)}{h}=\lim\limits_{h\to 0}\frac{h}{h}$" is false. It is only true if $h\to 0+$. – MPW Dec 29 '17 at 15:04
For the derivatives to exist, you should check at both sides of $z=0$.
The right side derivative: $$\lim_{h \rightarrow 0+} \frac{g(h)}{h} = 1$$ (as you calculated)
But the left side derivative is not the same: $$\lim_{h \rightarrow 0-} \frac{g(h)}{h} = \lim_{h \rightarrow 0-} \frac{0}{h}=0$$ (Since $\max \{ 0, h \}$ when $h<0$ is $0$) Thus the derivative does not exist.