TITLE: When is $y=|P(x)|$ is differentiable?
QUESTION [5 upvotes]: Let $P:\mathbb{R}\to\mathbb{R}$ denote the polynomial function. When is $y=|P(x)|$ differentiable?

I found out that $y=|P(x)|$ may be differentiable through-out $\mathbb{R}$ or it may not be. When it is not differentiable thorough out $\mathbb{R}$, the points of non- differentiability occur at $P(x)=0$. Is there any more detail which can be given about this?

REPLY [2 votes]: I've upvoted Arthur's answer, but I'd like to add a perspective on why Arthur's answer is correct, since none of the answers seem to address the why of it.
Let $$\newcommand\sgn{\operatorname{sgn}}\sgn(x) = \begin{cases} -1 &x<0\\1&x\ge0\end{cases}$$
be the sign function that returns the sign of its argument. Observe that $|x|=x\sgn(x)$.
Thus if $f:\Bbb{R}\to\Bbb{R}$ is any real valued function, $|f|(x) = f(x)\sgn(f(x))$.
If $f$ is differentiable, then when $f(x)\ne 0$, both $f(x)$ and $\sgn(f(x))$ are differentiable, so we can apply the product rule to get
$$|f|'(x) = f'(x)\sgn(f(x)) + f(x)f'(x)\sgn'(f(x)),$$
but $\sgn'(x)=0$, when $x\ne 0$, so the second term is $0$.
Thus $$|f|'(x) = f'(x)\sgn(f(x)),$$
when $f(x)\ne 0$.
What about when $f(x)=0$?
Well, let's take a look at the limit.
$$|f|'(x) = \lim_{h\to 0} \frac{|f(x+h)|-|f(x)|}{h} = \lim_{h\to 0} \frac{|f(x+h)|}{h}= \lim_{h\to 0} \left|\frac{f(x+h)}{h}\right|\sgn(h).$$
This limit exists if and only if the left and right hand limits exist and agree, but in the right hand limit $\sgn(h)=1$, and we get $|f'(x)|$, and in the left hand limit $\sgn(h)=-1$, and we get $-|f'(x)|$. Thus when $f(x)=0$, $|f|$ is differentiable at $x$ if and only if $|f'(x)|=-|f'(x)|$, which occurs if and only if $f'(x)=0$. 
Thus we obtain Arthur's answer, if $f:\Bbb{R}\to \Bbb{R}$ is differentiable, then $|f|$ is differentiable at $x$ if and only if $f(x)\ne 0$ or $f(x)=f'(x)=0$.
Moreover, when differentiable, $|f|'(x) = f'(x)\sgn(f(x))$.