People say that |x| is not differentiable, but isn't the derivative of |x|, |x|/x? I have heard that $|x|$ is not differentiable, but I found a derivative that meets all the requirements necessary.
Here is my proof that the derivative of $|x|$ is $|x|/x$. First, note that $|x|$ has a slope of $1$ when x is positive. $|x|/x$ also equals $1$ when $x$ is positive. $|x|$ has a slope of $-1$ when $x$ is negative. $|x|/x$ equals $-1$ because $|x|$ is positive and $x$ is negative. $|x|$ has an undefined slope at $x=0$ and |x|/x is also undefined at $x=0$. Therefore, $|x|$'s derivative is $|x|/x$.
Anything wrong with this?
 A: The issue is that $f(x) = |x|$ is not differentiable at $x = 0$.  Looking at the definition of the derivative at $x = 0$:
$$\lim_{h\to 0}\frac{f(h) - f(0)}{h} = \lim_{h\to 0}\frac{|h|}{h}.$$ Now, since $$|h| = \begin{cases}
-h, & h\le 0\\
h, & h>0
\end{cases}$$ we have that $$\lim_{h\to 0^{-}}\frac{|h|}{h} = \lim_{h\to 0^{-}}\frac{-h}{h} = -1$$ whereas $$\lim_{h\to 0^{+}}\frac{|h|}{h} = \lim_{h\to 0^{+}}\frac{h}{h} = 1,$$ which means that $f'(0)$ does not exist.  If we consider $x\ne 0$ then we can say that $f'(x) = -1$ for $x < 0$ and $f'(x) = 1$ for $x>0$, i.e.
$$f'(x) = \begin{cases}
-1, &x<0\\
\text{DNE}, &x=0\\
1, &x>0
\end{cases} = \begin{cases}
\frac{|x|}{x}, &x\ne 0\\
\text{DNE}, &x = 0
\end{cases}
$$
So, we can't say that $f$ is differentiable on $\mathbb{R}$, but we can say it is differentiable on $\mathbb{R}{\setminus\{0\}}$.
A: If $A\subset\Bbb R$ and $f$ is a function from $A$ into $\Bbb R$, we say that $f$ is differentiable if $f$ is differentiable at every $a\in A$. So, the absolute value function is not differentiable, since it is not differentiable at $0$. Otherwise, you are right, but I would simply say that if we differentiate it at a point $a\ne0$, then we get $1$ if $a>0$ and $-1$ if $a<0$.
A: I think what the OP is trying to say is that there isn't generally a single, unified formula given for the derivative of $|x|$, and he has provided one.  I think the formula looks correct, and has the same domain as the piecewise derivative as well.
A: You're essentially correct, except that what you've stated isn't exactly "differentiability"; if we let $f(x)=|x|$ then it's true that:

*

*Wherever $|x|/x$ is defined, the derivative $f'(x)$ exists and equals $|x|/x$.


*The domain on which $|x|/x$ is defined is the same as the domain on which $f'(x)$ exists.
That said, this is a bit of an unusual combination of facts - generally, mathematicians like functions to be defined on some domain fixed ahead of time rather than inferred later and aren't so concerned about trying to get the domains of things to match up by cleverly dividing something by zero at various places. If you defined derivatives and algebra using partial functions, then there would be some literal equality between the partial functions $f'(x)$ and $\frac{|x|}x$ - but this would be a non-standard definition, much as it may get informally used in calculus classes.
This doesn't mean that $|x|$ is differentiable - that means that the derivative exists everywhere and, clearly, $f'(0)$ doesn't exist since $\frac{f(x)}x$ is $1$ if $x>0$ and $-1$ if $x<0$ - so, in particular, that quotient has no limit as $x$ goes to $0$. It's also worth noting that, if $x\neq 0$, it is more common to write this using the notation on the right hand side:
$$\frac{|x|}x=\begin{cases}1 & \text{if }x >0 \\-1&\text{if }x<0 \end{cases}$$
where the reader can be immediately informed that this is just two constant functions pasted together, rather than having to struggle to identify what $\frac{|x|}x$ is.
A: The derivative is easily found by the classical definition when $x\ne0$.
Let $f(x)=|x|$
\begin{eqnarray}
f^\prime(x)&=\lim_{h\to0}\frac{|x+h|-|x|}{h}\\
&=\lim_{h\to0}\frac{|x+h|-|x|}{h}\cdot\frac{|x+h|+|x|}{|x+h|+|x|}\\
&=\lim_{h\to0}\frac{|x+h|^2-|x|^2}{h(|x+h|+|x|)}\\
&=\lim_{h\to0}\frac{(x+h)^2-x^2}{h(|x+h|+|x|)}\\
&=\lim_{h\to0}\frac{h(2x+h)}{h(|x+h|+|x|)}\\
&=\lim_{h\to0}\frac{2x+h}{|x+h|+|x|}\\
&=\frac{x}{|x|}
\end{eqnarray}
Note also that $$\frac{x}{|x|}=\frac{x}{|x|}\cdot\frac{|x|}{|x|}=\frac{x|x|}{|x|^2}=\frac{x|x|}{x^2}=\frac{|x|}{x}$$
