# Why is the derivative of $\frac{|x|}{x}$ equal to $\emptyset$ at $x=0$?

I got a bit of a confusion here. If $\varphi(x)=\frac{|x|}{x}$, then $$\varphi(x) = \left.\Bigg\{ \begin{array}{cc} 1 &if \ x>0\\ \emptyset & if \ x=0\\ -1 & if \ x <0 \end{array} \right.$$ and then

$$\varphi'(x) = \left.\Bigg\{ \begin{array}{cc} 0 &if \ x>0 \cup x<0\\ \emptyset & if \ x=0 \end{array} \right.$$

The derivative at $0$ is nevertheless also $0$. Why? My only suspicion is that $\varphi(x)$ is actually somehow defined at $x=0$, although I do not see how: there should be an indeterminate form $\frac{0}{0}$. Some form of L'Hospital's rule?

-
If $\varphi(x)=\frac{|x|}x$, then $\varphi(0)$ is undefined. And no matter which of your two definitions of $\varphi$ you use, $\varphi'(0)$ is not $0$: it does not exist. – Brian M. Scott Jan 18 '13 at 20:44
Who is telling you that $\phi'(0) = 0$??? – Christopher A. Wong Jan 18 '13 at 20:45
Plus, even if it was defined at $0$, the lateral limits wouldn't be the same. – Git Gud Jan 18 '13 at 20:45
$\phi(0)$ is undefined, but $\phi$ is differentiable at every other point, and it's derivative is the $0$ function. Therefore the derivative can be continously extended to zero. But the extended function is the derivative only on $\mathbb{R}-\{0\}$. – sebigu Jan 18 '13 at 20:49
I never said the function is defined at $0$. $\emptyset$ means undefined, as I clearly stated at the end of the post. What got me confused is this: wolframalpha.com/input/?i=diff%28abs%28x%29%2Fx%2Cx%29 – Alex Jan 18 '13 at 22:48

This is a very nice example. Clearly $|x|/x$ has problems when $x=0$. The function $\varphi$ is not what we call differentiable at $x=0$, even though it has a continuous derivative at $x=0$. A function can't be called differentiable unless it is itself continuous. Let's consider $x<0$ and $x>0$ separately.

Assume that $x<0$. Let $x=-k$ where $k>0$. We have:

$$\frac{|x|}{x} = \frac{|-k|}{-k}=\frac{k}{-k}=-1 \, .$$

It follows that $\varphi(x)=-1$ for all $x<0$. Thus $\varphi$ is constant for all $x<0$ and so $\varphi'(x)=0$. It follows that $\varphi'(x)$ tends towards zero as $x$ tends towards zero from the negative side.

Assume that $x>0$. Let $x=k$ where $k>0$. We have:

$$\frac{|x|}{x} = \frac{|k|}{k}=\frac{k}{k}=1 \, .$$

It follows that $\varphi(x)=1$ for all $x>0$. Thus $\varphi$ is constant for all $x>0$ and so $\varphi'(x)=0$. It follows that $\varphi'(x)$ tends towards zero as $x$ tends towards zero from the positive side.

Putting these two answers together, we may conclude that $\varphi'$ is continuous because:

$$\lim_{x \to 0^-} \left( \frac{d}{dx}\frac{|x|}{x}\right) = \lim_{x \to 0^+} \left(\frac{d}{dx}\frac{|x|}{x}\right) = 0 \, .$$

However, $\varphi$ fails to be itself continuous because $\varphi(x)$ tends towards $-1$ as $x$ tends towards zero from the negative side while $\varphi(x)$ tends towards $+1$ as $x$ tends towards zero from the positive side, meaning that

$$\lim_{x \to 0^-} \frac{|x|}{x} \neq \lim_{x \to 0^+} \frac{|x|}{x} \, .$$

-
'The function...has a continuous derivative at $x=0$.' How's that possible? – Alex Jan 19 '13 at 1:58
@Alex The definition of continuity does not depend on the value of the function at a point, but on the value as you approach a point. The function $\varphi$ is constant for all $x<0$ and $x>0$ and so $\varphi'(x) = 0$ for all $x<0$ and $x>0$. Which ever way you approach $x=0$ along the real line you find that $\varphi'(x) \to 0$ as $x \to 0$. Thus $\varphi'$ is, by definition, continuous at $x=0$. However, the function $\varphi$ itself is not and so it's not what we call a differentiable function. I think this example was engineered to highlight this quirky possibility. – Fly by Night Jan 19 '13 at 13:49
I'm sorry I'm still at loss: derivative $\varphi'(0)$ does not exist, yet the derivative of $\varphi(x)$ at $x=0$ is continuous. I probably miss something here but it sounds really weird. – Alex Jan 21 '13 at 15:23
The derivative does exist: $\varphi'(x) = 0$ for all $x \neq 0$ and the left- and righ-hand limits agree so that $\varphi'(x) \to 0$ as $x \to 0^-$ and $x \to 0^+$. Thus, we can say that $\varphi'(x) = 0$ for all $x$ (by continuity). The derivative exists and is continuous. We call a function "differentiable" if $\varphi$ is continuous and so too is $\varphi'$. It's just a quirk of the definition. A function can have a continuous derivative, but still not meet the definition of a "differentiable" function. – Fly by Night Jan 21 '13 at 19:27
I could be very mistaken, but doesn't this simply mean that the limit exists as $x \to 0$? That is, one cannot talk about continuity of a function at some element that's not in its domain. Continuity is in, a metric space, defined to be that the limit of a function towards a point equals the function evaluated at that point. If one cannot talk about evaluating the function at this point, then how can one consider continuity? In other words from this logic, I could say that functions are continuous at $\infty$, which doesn't really make sense... – DanZimm May 21 '14 at 14:26

The function $\phi(x) = |x|/x$ has a step discontinuity at $x=0$. Not only is it discontinuous, but you cannot redefine $\phi(0)$ to make it continuous, let alone differentiable.

Some other motivational examples:

If your function were something like $\psi(x) = \sin x/x$, you would similarly have $\psi(0)$ undefined. However, if you redefined $\psi(0) = 1$, you would have a function that is both continuous and differentiable at $x=0$.

For $\gamma(x) = x^2/|x|$, you could set $\gamma(0) = 0$ to make the function continuous at $0$, but it still wouldn't be differentiable.

-
The function $\gamma$ is such that $\gamma(x)=|x|$ for every $x$ hence the choice of $\gamma(0)=1$ is odd. – Did Jan 18 '13 at 21:08
You can make it continuous, by defining $\phi(0)=0$ or am I incorrect? – CBenni Jan 18 '13 at 21:37
@CBenni That's incorrect. The left-hand limit of $\varphi$ is $-1$ while the right-hand limit it $+1$. Continuity at $x=0$ has nothing to do with the value at zero, but with the limits as we tend towards zero. – Fly by Night Jan 18 '13 at 21:40
@FlybyNight Indeed, I was thinking $|x|$... I did waaay too much maths today. Sorry. – CBenni Jan 18 '13 at 21:41
thanks for the catch - $\gamma(0)$ should indeed be $0$. I was indeed thinking of $|x|$. – orlandpm Jan 18 '13 at 22:36