# Can $f\in BV$, $f=0 a.e$ but $f'$ does not exist on an uncountable set?

I want to ask if it is possible to construct a function such that:

1. It is of bounded variation.
2. It is $0$ almost everywhere except on a countable set.
3. It is not differentiable on an uncountable subset.

I thought about constructing a function that gives $\frac{1}{i^{2}}$ on rationals by using an enumeration of rationals. But it is not clear to me if the derivative would not exist on an "uncountable subset". Certainly the derivative cannot exist on the rationals; and by Rudin's own proof it must be $0$ everywhere. However since we can choose the enumeration in an arbitrally way, it is possible an uncountable subset of the irrationals it is also not differentiable? I feel this is likely if I can define it step-wise around a Cantor type set, since making the function non-differentiable at a specific point is always possible, then making an inductive procedure. But I do not know how to write this down precisely.

-
Do you know where your function is continuous? –  Ilya Jan 11 '13 at 8:51
It is differentiable a.e, but I am not clear where. –  Bombyx mori Jan 11 '13 at 8:55

For $x\in [0,1]$, let $$f(x)=3^{-n(x)} \quad \text{where} \quad n(x)=\sup \{n\in \mathbb Z : 2^n x\notin \mathbb Z\} \tag1$$ The function $f$ is zero on every number that is not a dyadic rational. Its total variation is $2+\sum_{n=1}^\infty 3^{-n} \cdot 2^n<\infty$, the extra $2$ coming from the jumps at $0$ and $1$.
If $f'(x)$ exists at some point $x\in (0,1)$, then $f(x)=0$ and consequently $f'(x)=0$ because $f$ has a minimum at $x$. If $x$ belongs to the ternary Cantor set, then $$\operatorname{dist}(x,2^{-n}\mathbb Z)\ge \frac1{2\cdot 3^{n}}, \quad n=1,2,\dots\tag2$$ which in view of (1) implies $\limsup_{y\to x} \dfrac{|f(y)-f(x)|}{|y-x|}>0$. Hence, $f'(x)$ does not exist.