# Functions Which are non differentiable on a Given Set.

I have recently read the famous Weierstrass Non differentiable function which is continuous everywhere but nowhere differentiable.

But now my question is:

Given a countable set $S (\subset \mathbb{R})$ , can we construct a function which is continuous everywhere but non differentiable only at points of S..?

My Attempt:
If $S$ finite say, $S=\{c_1,c_2,...,c_n\}$ Then the following function is the desired one:$$f(x)=\sum_{i=1}^{n}|x-c_i|$$

But I cannot construct the function for a arbitrary Enumerable set $S.$

Can we generalize the question for an arbitrary set $S$?

Thank you...!!

• You can make an easy example of a set which has corners periodically by just defining the function on, say, $[-1,1]$ and arranging so that it takes equal values on the ends, and then copy-pasting it. Maybe you can use this to handle the general case? I'm not sure - just a thought. Dec 26, 2016 at 5:09
• Sir, I think I got your point a little...but Is there any explicit example...??@ A Yerger Dec 26, 2016 at 5:14
• If you want to write down an explicit formula for such a thing that won't be defined piecewise, it's done with Fourier series. But I have thought of another example which modifies your own, and is also discontinuous on the integers. $f(x) = \sum_{n \in \mathbb Z} \frac{1}{2^{|n|}}|x-n|$. This should be okay since as $n$ moves away from $0$, we shrink the contributions geometrically. Dec 26, 2016 at 5:19
• But sir this is an particular case. and I have also construct a function which is non differentiable at only $\mathbb{Z}$ but continuous every where.....But I cannot extend this construction for the arbitrary set $S$. In fact, for $S={a_1, a_2, a_3,.......}$....!!!! Dec 26, 2016 at 5:24
• Is the construction possible...?? Intuitively it seems to me that this is possible (as u noted in ur first comment) ....but I can't.... Dec 26, 2016 at 5:26

The same construction can be generalized. Let $a_1,a_2,\dots$ be the elements of $S$.

Then the function $f(x)=\sum\limits_{n=1}^\infty \dfrac{|x-a_n|}{2^n \max(|a_n|,1)}$ is differentiable at all points except the points at $S$.

• Can you prove it? We can try to work it out if you'd like. Dec 26, 2016 at 5:40
• How does the series Converge....?? Dec 26, 2016 at 5:50
• hmm, good point. we'll adjust it. Dec 26, 2016 at 5:56
• Please tell how does the series converge now...??@ J F Hidalgo Dec 26, 2016 at 6:04
• well, each summand is smaller than $|\frac{x}{a_n}-1|2^{-n}|$ and $|x-a_n|2^{-n}$. If $|a_n|\leq 1$ it is smaller than $(|x|+1)|2^{-n}$ and otherwise it is smaller than $(|x|+1)2^{-n}$ Dec 26, 2016 at 6:08

Yes. See this answer, on the kinds of sets where a function $f$ may fail to be differentiable. Such a set must be a $G_{\delta\sigma}$ set, meaning it must be an infinite, countable union of $G_{\delta}$ sets (which in turn are countable intersections of open sets).

Notice that every closed set is $G_{\delta}$ and in particular, every singleton is $G_{\delta}$:

$$\{p\}=\bigcap_{n\geq1}\left(p-\frac1n,p+\frac1n\right)$$

Hence, every countable set is $G_{\delta\sigma}$: $C=\cup_{n\in\mathbb{N}}\{c_n\}$.

The paper linked in the answer describes how one may construct continuous functions $f:\mathbb{R}\longrightarrow\mathbb{R}$ whose set of non-differentiability is a $G_1\cup G_2$, where $G_1$ is any $G_{\delta}$ and $G_2$ is a $G_{\delta\sigma}$ with measure zero. In particular, notice that every countable set is both $G_{\delta\sigma}$ and has measure zero, so every countable set may be written as some $G_1\cup G_2$.