# An example of a continuous function $f:\mathbb{R}\to\mathbb{R}$ whose graph is a rectifiable curve, and which is not piecewise smooth

After these questions one and two and three, I'd like to know an example of a continuous function $f:\mathbb{R}\to\mathbb{R}$ which is not piecewise smooth, but $(x,f(x))$ being a rectifiable curve in any open interval in its domain.

I'd appreciate some help in form of hints, suggestions if not answers.

The functions of the class mentioned in this question seem to be suitable examples for the above question. A construction method for functions of this type is given by Pietro Majer in this answer. Also note that (as mentioned in the comments by Pietro Majer there) the description of this class can be extended to any countable dense subset instead of the Rationals.

I'd like to know whether this class of functions are the only examples for the type of functions mentioned in this question.

-
Is there any particular reason why you would want to know this? Do you need it as some kind of counterexample? –  Jonas Teuwen Sep 18 '11 at 19:26
Jonas Teuwen : no, I am just curious, I have a class of functions which seem to have this property but would like to know if this property is satisfied only by this class or there are any more. –  Rajesh D Sep 18 '11 at 19:30
Could I suggest that you consult Apostol's book "Mathematical Analysis" [I have the second edition] - Chapter 6 "Functions of Bounded Variation and Rectifiable Curves" - which I think covers exactly the territory you are exploring, and puts it in a wider context, which may be helpful to you. –  Mark Bennet Sep 18 '11 at 20:43

Consider the sawtooth functions $$\phi_n(x):=\min\bigl\{|x-{k\over2^n}|\>\bigm| \>k\in{\mathbb Z}\bigr\}\qquad(x\in{\mathbb R})\ .$$ Each $\phi_n$ takes values in $[0,2^{-(n+1)}]$, is Lipschitz continuous with Lipschitz constant $1$ and has "corners" at the points $k\>2^{-(n+1)}$, $k\in{\mathbb Z}$. The function $$f(x):=\sum_{j=0}^\infty\>{1\over 4^j}\phi_j(x)\qquad(x\in{\mathbb R})$$ is therefore well defined and continuous on all of ${\mathbb R}$, and its total variation on any interval $[a,b]\subset{\mathbb R}$ can be estimated as follows: $$V_{[a,b]}(f)\leq \sum_{j=0}^\infty {1\over 4^j}(b-a)={4\over3}(b-a)\ .$$ Therefore any finite part of the graph of $f$ is rectifiable.
It remains to show that $f$ is not piecewise smooth. To this end consider a point $(2k+1)/2^{n+1}$. The functions $\phi_j$ with $j<n$ are linear in the neighborhood of this point, $\phi_n$ changes its derivative from $1$ to $-1$ there, and because of the factors ${1\over 4^j}$ in the definition of $f$ the summands with $j>n$ cannot smooth out this corner.