derivative if a piecewise function

There is a piecewise function, $$f(x)= \begin{cases} 0 & \text{if } x=0, \\ 1/x & \text{if } x \neq 0. \end{cases}$$ What is the derivative of this function at $x=0$ the txt says $+\infty$ but I don't get how. Can someone help me with this.

$$f'(0) = \lim_{h \rightarrow 0} \frac{f(0+h)-f(0)}{h} = \lim_{h \rightarrow 0} \frac{f(h)}{h} = \lim_{h \rightarrow 0} \frac{1/h}{h} = \lim_{h \rightarrow 0} \frac{1}{h^2} = \infty$$
The function is not differentiable at $0$, so it doesn't have any derivative there.
If your textbook say the derivative is $+\infty$, then it is wrong and its author possibly confused.
In order for the function to be differentiable, it needs to be well approximated by a linear function in a neighborhood of 0, and the derivative is then the slope of this function. $+\infty$ doesn't work for that; even if we try to give meaning to it, $$x \mapsto 0+\infty\cdot x = \begin{cases}+\infty & \text{when }x>0 \\ ??? & \text{when } x=0 \\ -\infty & \text{when } x<0 \end{cases}$$ doesn't approximate your function well in any neighborhood of 0 -- on the contrary there are points arbitrarily close to 0 where its error is infinite
• I completely agree with you. But (unfortunately) quite a number of textbooks associate a $\pm\infty$ derivative with nonexistence of the derivative. Sep 19, 2014 at 1:16
• This is just semantics imo. Yes, you can argue that way, but $\infty$ is really the same as not being differentiable here (meaning that there is little harm that can come from using it). Sep 19, 2014 at 1:19