# Example of a function which is not differentiable on parts of its domain

Can you provide me with an example of a function $$f:\mathbb{R} \to \mathbb{R}$$ which is not piece-wise defined and differentiable on some parts of its domain and some parts not?

I am curious to know whether it is possible to say soemthing like this: "function f is differentiable until point x=5 but for values x>5 it is no longer differentiable".

(I know that you can achieve this with functions like $$f(x)= x^{q \over p}, p,q \in \mathbb{N}$$ at point $$0$$ but that is not what I am looking for.)

Any ideas are welcome!

• One problem is that being "not piece-wise defined" is not well-defined. – Qi Zhu Sep 6 '19 at 15:09
• Going in the direction of Qi Zhu, I would say that a map defined by something for $x \le 5$ and something else for $x > 5$ is piecewise defined. – mathcounterexamples.net Sep 6 '19 at 15:10
• I doubt a satisfactory example exists, if as I apprehend, you are looking for a single formula in terms of familiar functions. All the elementary functions, and even the special functions are infinitely differentiable almost everywhere they are defined. They wouldn't be useful otherwise. – saulspatz Sep 6 '19 at 15:10
• It's also not a problem to rewrite your function into a "not piecewise-defined" function, as in $f = \mathbb{1}_M f_1 + \mathbb{1}_{M^C} f_2$ where $\mathbb{1}_{\cdot}$ denotes the indicator function as usual. – Qi Zhu Sep 6 '19 at 20:24
• @QiZhu, Ah okay I got the point, thx for your pacience and the explanations :) – Philipp Sep 6 '19 at 20:38

$$f(x) = \begin{cases} 0 & x \le 5\\ 1 & x \in \mathbb Q \text{ and } x > 5\\ 0 & x \notin \mathbb Q \text{ and } x > 5 \end{cases}$$

It is differentibale for $$x \le 5$$ and not even continuous for $$x > 5$$.

Another one... consider the map $$f$$ defined in this post for $$x > 0$$ and $$f(x) = 0$$ for $$x \le 0$$. it is continuous and never differentiable for $$x > 0$$ but differentiable for $$x \le 0$$.

Note: however those may be seen as piecewise defined.

• No, that's not what I am looking for. – Philipp Sep 6 '19 at 15:25

I was trying to conjure up an example, but realized that i was just rewriting "piecewise defined" functions in a "not-piecewise" way. Here is an example: Consider a differentiable function $$f$$ and a continous but nowhere differentiable function $$g$$ (for example https://en.wikipedia.org/wiki/Weierstrass_function). Then the function $$h(x):= max(f(x),g(x))$$ is differentiable on the open set $$\{x| f(x)>g(x)\}$$ and not differentiable on the open set $$\{x|f(x).

But the question is now, do you consider $$max(f,g)$$ to be piecewise or not? Clearly it can be defined piecewise, but could also be defined by the formula $$max(f(x),g(x)) = \frac{f(x)+g(x)}{2} + \frac{|f(x)-g(x)|}{2}$$

• differentiability at points, where $f(x)=g(x)$ depends on choice of $f$ and $g$. – Leander Tilsted Kristensen Sep 6 '19 at 15:54