Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

Let $I=[0,1]\subset \mathbb{R}$ and for $x\in \mathbb{R}$ define $f(x)= \operatorname{dist}(x,I)$ then I need to find out its points of differentiability.

I could see that $f(x)$ is continuous everywhere, but for differentiability at some point $x=c$ what has to be done?

share|cite|improve this question

Hint: $$\operatorname{dist}(x,I)=\begin{cases} |x|& x<0\\ 0 & 0\leq x\leq1\\ |x-1| & x>1 \end{cases}$$ i.e. $$\operatorname{dist}(x,I)=\begin{cases} -x & x<0\\ 0 & 0\leq x\leq1\\ x-1 & x>1 \end{cases}$$

share|cite|improve this answer
Yes, sometimes just writing it out makes it much clearer, doesn't it? Not so abstract -- it's an easy function to analyze. +1 for you! – MPW Jun 16 '14 at 15:11
@MPW: For more fun, try the same problem when $I$ is replaced by the Cantor middle thirds set or a Cantor set of positive Lebesgue measure (pick a specific symmetric Cantor set of positive measure to work with). – Dave L. Renfro Jun 16 '14 at 15:15
@Dario oh it was so easy I got messed up with definitions ! – Neeraj Bhauryal Jun 16 '14 at 15:16

For $x<0$ the distance to $I$ is the same as the distance to $0$, so $f(x)=-x$. For $x\in I$ the distance f(x)=0 and for $x>1$ we take the distance to $1$: $f(x)=x-1$. This results in the following graph around $I$.

enter image description here

For a function $f$ to be differentiable in $x_0$ the "slope" has to be continuous, so it has to be the same approaching from the left as from the right. Formally a function $f$ is said to be differentiable in point $x_0$ if

$$ \lim_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h} $$

exists. From the graph we can see that there might be a problem in $x_0=0$ and $x_0=1$. Take a look at the limit in $x_0=0$:

$$ \lim_{h\to 0}\frac{f(0+h)-f(0)}{h}=\lim_{h\to 0}\frac{f(h)}{h}. $$

Leting $h$ approach $0$ from positive values we find $f(h)=0$ so the limit evaluates to $0$. Letting $h$ approach $0$ from negative values we find $f(h)=-h$ so the limit evaluates to $\frac{-h}{h}=-1$. Because the limit from the right isn't the same as the limit from the left we say that the limit does not exist and as a result $f$ is not differentiable in $x_0=0$.

The same argument applies to $x_0=1$.

share|cite|improve this answer

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.