# A function not differentiable exactly two points of $[0,1]$. construction of such a function is possible?

Can a continuous function on $[0,1]$ be constructed which is not differentiable exactly at two points on $[0,1]$ ?

• A similar question with the famous one-letter answer. Jan 20, 2015 at 15:24

Consider: $$f(x)=\left|x-\frac{1}{2}\right|+\left|x-\frac{1}{3}\right|.$$

• Geometric interpretation of this expression is sum of the distances of a given point on real axis from 1/2 and from 1/3. From this interpretation it is relatively easy to see what the graph of this function looks like. Jan 20, 2015 at 15:28

Let me give another, potentially more common example: the upper-half circle of radius $1/2$ with center at $1/2$, i.e. $$f(x)=\sqrt{\frac{1}{4}-\left(x-\frac{1}{2}\right)^2}$$

• At what two points exactly is this function non-differentiable? The only ones I can think of are the extreme points of the definition domain, $\;\left[0\,,\,\frac14\right]\;$ , yet the function is not continuous there but only one-sided continuos. Jan 20, 2015 at 14:38
• The function is defined on $[0,1]$, isn't it? The function should be not differentiable in $0$ and $1$. Maybe we need to discuss what differentiability on compact sets means? Jan 20, 2015 at 15:24
• Differentiability, just like continuity, at end points of a closed interval mean both "one sided": right on $\;0\;$ , left on $\;1\;$ . I just thought the OP may have meant something else. Jan 20, 2015 at 17:09
• maybe you are right. However, sclaing my answer to a smaller circle and extending the function by zero will also provide an example with non-differentiability in interior points. Jan 20, 2015 at 17:24

Sure. Presuming you allow one-sided limits at interval endpoints in your limit of differentiability (otherwise any otherwise differentiable function is automatically an example because it fails to be differentiable at $0, 1$), you can take as an example the function $f$ defined by $0$ on $[0, \frac{1}{3}]$, $3x - 1$ on $[\frac{1}{3}, \frac{2}{3}]$, and $1$ on $[\frac{2}{3}, 1]$. It is nondifferentiable precisely at $\frac{1}{3}, \frac{2}{3}$.

• This was my first thought and seemed so simple I assumed there was some implicit prohibition of piecewise defined functions. Jan 20, 2015 at 14:22
• I originally misread the problem asking for a function which was differentiable only at two points in $[0, 1]$, which is perhaps more interesting. Jan 20, 2015 at 14:25