Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If $|f(x)|$ is a differentiable function, then $f(x)$ is also a differentiable function.

Why is this wrong? Can you find a counterexample please? It seems like a true sentence.

share|cite|improve this question
up vote 18 down vote accepted

Just to give a very extreme example: let $f:\mathbb R \to \mathbb R$ be given by $f(x)=1$ if $x$ is rational and $f(x)=-1$ if $x$ is irrational. Then $|f|$ is constantly $1$, thus differentiable (as many times as you want). But $f$ is not continuous at any point and thus can't be differentiable.

share|cite|improve this answer

What about

$$f(x)=\begin{cases} 1,&\text{if }x\ge 0\\ -1,&\text{if }x<0\;? \end{cases}$$

share|cite|improve this answer

If $f$ is not continuous, then $\left|f\right|$ may be continuous and even differentiable as pointed out by Brian. Suppose $f$ is continuous at $a$ and $\left|f(x)\right|$ is differentiable at $a$. Then, $$\lim_{x\to a}\frac{\left|f(x)\right|-\left|f(a)\right|}{x-a}=L\in \mathbb{R}$$ If $f(a)>0$ by continuity, $f(x)>0$ near $a$ and so $$\lim_{x\to a}\frac{f(x)-f(a)}{x-a}=L\in \mathbb{R}$$ and $f$ is differentiable at $a$. Similarly if $f(a)<0$.

If $f(a)=0$ then $$\lim_{x\to a}\frac{\left|f(x)\right|}{x-a}=L\in \mathbb{R}$$ As Robert said in the comments, $$L=\lim_{x\to a^+}\frac{\left|f(x)\right|}{x-a}\ge 0$$ while $$L=\lim_{x\to a^-}\frac{\left|f(x)\right|}{x-a}\le 0$$ and so $L=0$. Therefore, $$\lim_{x\to a^+}\left|\frac{f(x)}{x-a}\right|=0\implies \lim_{x\to a^+}\frac{f(x)}{x-a}=0$$ while $$\lim_{x\to a^-}\left|\frac{f(x)}{x-a}\right|=0\implies \lim_{x\to a^-}\frac{f(x)}{x-a}=0$$ and so $f$ is differentiable at $0$.

Moral: If $f$ is discontinuous then $\left|f\right|$ may be differentiable. If $f$ is continuous and $\left|f\right|$ is differentiable then $f$ is differentiable as well

share|cite|improve this answer
What counter-example? Since $\dfrac{|f(x)|}{x-a} \ge 0$ for $x > a$ and $\le 0$ for $x < a$, if $\displaystyle \lim_{x \to a} \frac{|f(x)|}{x-a}$ exists, it must be $0$. And then this is also $\displaystyle \lim_{x \to a} \frac{f(x)}{x-a}$. – Robert Israel Dec 28 '12 at 9:52
@RobertIsrael Right – Nameless Dec 28 '12 at 9:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.