# A function of bounded variation with derivative zero almost everywhere

On $[0,1]$, we can define a function $f$ with $f(0)=0$, $f(1)=1$, $f(x)=0$ for irrational $x$ and $f(m/n)=1/n^3$ for $(m,n)=1$. How can i show that $f$ is of bounded variation and $f'=0$ a.e.$[m]$?

Here $m,n$ are positive integers.

-
f is certainly not of bounded variation –  mike Apr 16 '12 at 17:29
@mike, why do you say? would you provide a counter example? Note also that $m,n$ are positive integers. –  Davie Roberts Apr 16 '12 at 17:43
Surely the variation is bounded by $\sum_{n=1}^{\infty} \frac{\phi(n)}{n^3} \leq \sum_{n=1}^{\infty} \frac{n-1}{n^3}$? ($\phi$ is Euler's totient function.) –  copper.hat Apr 16 '12 at 17:51
I think I need a $2$ in my bound. –  copper.hat Apr 16 '12 at 17:56
@copper.hat: $1/n, 2/n,... ,n/n$ -- there at most $n$ fractions with $n$ in the denominator in $(0,1]$ such that $(m,n)=1$. No knowledge of number theory needed for this estimate :-) –  user20266 Apr 16 '12 at 18:03

For each integer $n$, there are at most $n$ rational numbers in $[0,1]$ of the form $m/n$. For any partition used to compute the variation, we can increase the variation by including an irrational between any two rationals in the partition. Thus, the variation is at most $$\sum_{n=1}^\infty n\cdot2\cdot\frac{1}{n^3}=\sum_{n=1}^\infty\frac{2}{n^2}=\frac{\pi^2}{3}\tag{1}$$

For any $\epsilon>0$ and a rational $m/n$, consider when an irrational $r$ satisfies $$\epsilon<\left|\frac{f(m/n)-f(r)}{m/n-r}\right|=\frac{1/n^3}{|m/n-r|}\tag{2}$$

$(2)$ requires that $|m/n-r|<\dfrac{1}{\epsilon n^3}$. The measure of the irrationals which would have a difference ratio bigger than $\epsilon$ considering rationals with a denominator of $n$ would be at most $n\cdot2\cdot\dfrac{1}{\epsilon n^3}$. Summing, we get that the measure of the irrationals which would have a difference ratio bigger than $\epsilon$ considering rationals with a denominator of at least $n$ would be at most $$\sum_{k=n}^\infty k\cdot2\cdot\frac{1}{\epsilon k^3}=\sum_{k=n}^\infty\frac{2}{\epsilon k^2}=\frac{2}{\epsilon}\left(\frac1n+O\left(\frac{1}{n^2}\right)\right)\tag{3}$$ Removing a finite number of rationals does not change the derivative at any irrational, so for any $\epsilon>0$, $(3)$ allows us to compute that, by removing a finite number of rationals (choosing $n$ large enough), we can ensure that the measure of the set of irrationals at which the $\limsup$ of the difference ratios exceeds $\epsilon$ is as small as we wish.

Thus, the measure of the set on which the derivative is not $0$ has measure $0$.

-

$f$ is of bounded variation on $[a,b]$iff the variation of $f$ is finite. This (the variation of $f$ over $[a,b]$) is by definition the supremum over all sums $$\sum|f(x_i)-f(x_{i+1})|$$ where the supremum is taken over all partitions $a=x_0 < ... < x_k = b$ How bad can it get in your example? The value of $f$ at $0$ and $1$ is not relevant of course. A particular unlucky choice of partition will (more or less obviously) collect all rational numbers as one end point of an interval of the partition and an irrational number as the other one -- I leave it to you to show this is the worst possible case :-) . Assuming such a partition can be realized you need to estimate $$\sum_{q = m/n, (m,n)=1} \frac{1}{n^3}$$ (with $q\in[0,1]$) In $(0,1]$ the number of fractions $m/n$ with $(m,n)=1$ is quite obviously bounded by $n$, so you need to show $$\sum_n \frac{1}{n^2}< \infty$$ which I guess you know if you are pondering about $BV$ functions. This answers only the first part of the question. Since I don't know what you learned about $BV$ functions I cannot guess which kind of reasoning would be appropriate for you to show $f^'=0$, one way to show this is to prove $$\int_0^1 f(x) g^'(x)dx =0$$ for every compactly supported $g\in C^1[0,1]$

-
To show $f' = 0$ a.e., one could simply observe that for all irrational $x,y$, we have $\frac{f(x) - f(y)}{x-y} = 0$, so $f'(x) \ne 0$ is only possible for rational $x$. No need to know much about BV functions ;) –  Sam Apr 16 '12 at 18:29
@SamL. Uhm, no - I don't think it is that easy. To show $f^'(x)= 0$ you need to show $\lim_{y\rightarrow x} (f(y)-f(x))/(y-x)=0$. Here you need to take into account the possibility that $y$ may be rational. Each real number can be approximated by rational numbers. –  user20266 Apr 16 '12 at 18:32
@SamL. (of course there is a proof which does not need knowledge about BV functions, but, again, I think it is not that easy.) –  user20266 Apr 16 '12 at 18:34
Thanks @Thomas. However, i would be grateful if you can help me prove $\int_0^1 f(x) g^'(x)dx =0$ and how wil i conclude from this that $f=0$ a.e. Also in the first step, do you imply that $\sum_{q = m/n, (m,n)=1} \frac{1}{n^3}\le\sum_n \frac{1}{n^2}< \infty$. –  Davie Roberts Apr 16 '12 at 18:58
@DavieRoberts: Yes I do claim that inequality. In the first sum just collect all terms which have $1/n$ in the denominator, there are at most $n$ of them. The integral is 0 because $f=0$ with the exception of a zero set. I was hoping you know that this fact implies $f'= 0$ (not $f=0$) a-e. If this is not true you may follow the suggestion of SamL. and consider difference quotients, which you have to do only for irrational $x$ since the rational numbers are a set of measure $0$. There is, however, more work left to do, then. (More than SamL. claims). I don't have time for this today, though. –  user20266 Apr 16 '12 at 19:19

My turn:

First the BV part. Let $t_0=0 < t_1<...<t_n=1$ be a partition of $[0,1]$. As mentioned in another proof, we can always add irrational points $t_i'$ in between to refine the partition. Then we have $t_0 <t_0' < t_1< t_1' <...<t_{n-1}'<t_n$. Since $f(t_i') = 0$, we can form the estimate:

$$\sum_{i=0}^{n-1} | f(t_{i+1}) - f(t_i)| \leq \sum_{i=0}^{n-1} | f(t_{i+1}) - f(t_i)'|+|f(t_i')-f(t_i)| \leq 2 \sum_{i=0}^{n} f(t_i)$$

The last estimate can be replaced by summing over all points in $[0,1]$ where $f$ is positive: $$\sum_{i=0}^{n-1} | f(t_{i+1}) - f(t_i)| \leq \sum_{t \in [0,1], f(t)>0} f(t) \leq \sum_{n=1}^{\infty} \frac{2(n+1)}{n^3} = K$$ (The final inequality comes from the fact that there are at most $n+1$ rationals with denominator $n$ in $[0,1]$.) Consequently, we have $\mathrm{Var}_{[0,1]} f \leq K$.

Now the differentiability part. It turns out that $f$ is differentiable at all irrational points. To see this, let $\alpha \in (0,1)$ be irrational, and choose $y \in [0,\alpha)$. (The analysis for $y \in (\alpha, 1]$ is similar, mutatis mutandis.)

I will prove differentiability in two parts, the first part is unnecessary, but motivates the slightly more involved second part.

The key aspect here is that there are at most $n |y-\alpha|$ (not $n|y-\alpha|+1$!!!) rationals with denominator $n$ in $[y,\alpha]$. This is because $\alpha$ is irrational. Following a similar line of reasoning to above, we can replace the $n+1$ by $n |y-\alpha|$ to get the estimate:

$$\mathrm{Var}_{[y,\alpha]} f \leq \sum_{n=1}^{\infty} \frac{2n|y-\alpha|}{n^3} \leq K|y-\alpha|$$ We are almost finished, the only issue is to replace $K$ by an arbitrary $\epsilon>0$. Pick an $\epsilon > 0$, and choose $N$ such that $\sum_{n=N+1}^{\infty} \frac{2n}{n^3} < \epsilon$. Now choose $\delta>0$ such that the interval $(\alpha-\delta, \alpha+\delta)$ contains no rational of the form $\frac{k}{n}$, where $k \leq n \leq N$. (Such a $\delta$ must exist since $\alpha$ is irrational.) Then if $y \in (\alpha-\delta, \alpha+\delta)$, we can repeat the above analysis to get the estimate:

$$\mathrm{Var}_{[y,\alpha]} f \leq \sum_{n=N+1}^{\infty} \frac{2n}{n^3} |y-\alpha| \leq \epsilon|y-\alpha|$$ Finally, since $|f(y)-f(\alpha)| \leq \mathrm{Var}_{[y,\alpha]} f$, we have that $f'(\alpha)$ exists and is $0$.

-