Let $\mu$ denote the Lebesgue measure. Lebesgue's theorem:
Let $(a,b)\subseteq\Bbb R$ be any interval and $f:(a,b)\to\Bbb R$ any monotone function. Then: $$\mu(\{x\in(a,b):f\text{ is not differentiable at }x\})=0$$
Is lovely, and Royden remarks that it is considered by some as one of the most important theorems of analysis on the historic observation that it "saved" confidence in real analysis, which had foundational difficulties at the time. Royden asks the student to show a theorem of Riesz and Nagy, that Lebesgue's theorem is the best possible result (paraphrasing):
(Riesz-Nagy): Let $E\subseteq(a,b)\subseteq\Bbb R$ where $\mu(E)=0$. There exists $f:(a,b)\to\Bbb R$ a monotone function such that $f$ is not differentiable at any $x_0\in E$.
Explicitly: since $E$ is null, show there exists a countable set of distinct intervals $\{(c_k,d_k)\}_{k\in\Bbb N}\subseteq(a,b)$ with: $$\sum_{k\ge1}(d_k-c_k)<\infty$$And: for all $x\in E$, there are infinitely many $k\in\Bbb N$, $x\in(c_k,d_k)$. Then we can define a monotone function $f$ on $(a,b)$ by: $$f(x)=\sum_{k\ge1}\mu((c_k,d_k)\cap(-\infty,x))$$Show that this $f$ is not differentiable at any point of $E$.
I'm able to show the existence of such $\{(c_k,d_k)\}$. However, the difference expression is very unclear for me - there must be some bound I am missing - while I can observe a certain term diverges, for all I know the other terms in the derivative also diverge, and the $\infty-\infty$ limit form is indeterminate. My attempt and further thoughts are below.
Let $h$ be any nonzero real, and fix $x\in E$. Define: $$\begin{align}K_1(h)&:=\{k\in\Bbb N:x,x+h\in(c_k,d_k)\}\\K_2(h)&:=\{k\in\Bbb N:x\notin (c_k,d_k),\,x+h\in(c_k,d_k)\}\\K_3(h)&:=\{k\in\Bbb N: x\in (c_k,d_k),\,x+h\notin(c_k,d_k)\}\end{align}$$
Then: $$\begin{align}\frac{f(x+h)-f(x)}{h}&=\frac{1}{h}\sum_{k\in K_1(h)}[x+h-c_k-(x-c_k)=h]\\&+\frac{1}{h}\left(\sum_{k\in K_2(h)}(x+h-c_k)-\sum_{k\in K_3(h)}(x-c_k)\right)\\&=|K_1(h)|+\frac{1}{h}\left(\sum_{k\in K_2(h)}(x+h-c_k)-\sum_{k\in K_3(h)}(x-c_k)\right)\end{align}$$
The convergence of the series in $d_k-c_k$ implies $d_k-c_k$ vanishes as $k\to\infty$; so, for fixed $h$, for large $k$ it is impossible for $x$ and $x+h$ both to lie in $(c_k,d_k)$, so $K_1(h)$ is always a finite set. By hypothesis on the infinite covering by $\{(c_k,d_k)\}$, it follows that $K_3(h)$ is an infinite set. Whether or not $K_2(h)$ is infinite in general is unclear to me, but, say, if $x+h\in E$, then $K_2(h)$ is infinite. As $h$ gets smaller, $K_1(h)$ gradually increases, and it can be easily - but formally - shown that $\lim_{h\to0}|K_1(h)|=\infty$. The issue is that I don't know how we can ensure the bracketed term is bounded from below - this is what I meant by $\infty-\infty$.
If $h>0$, then $k\in K_2(h)$ iff. $x\le c_k<x+h<d_k$; so, $0<x+h-c_k\le h$, and $k\in K_3(h)$ iff. $c_k<x<d_k\le x+h$; so, $0<d_k-x\le h$. I note that $-(x-c_k)=(d_k-x)-(d_k-c_k)$, so $c_k-d_k<-(x-c_k)\le h+c_k-d_k$. So I might hope, at best, to combine these and bound: $$\frac{1}{h}\sum_{k\in K_2(h)}(c_k-d_k)<\frac{1}{h}\left(\sum_{k\in K_2(h)}(x+h-c_k)-\sum_{k\in K_3(h)}(x-c_k)\right)$$I know, by convergence and a simple analysis, $\lim_{h\to0}\sum_{k\in K_2(h)}(c_k-d_k)=0$, but there is no way to know the rate of convergence. The term, once divided by $h$, may well diverge to a negative infinity, and then the (non)existence of the derivative limit from above is unclear.
I can make similar bounds for $h<0$ and conclude: $$\frac{f(x+h)-f(x)}{h}>|K_1(h)|-\frac{1}{|h|}\sum_{k\in K_2(h)}(d_k-c_k),\,\forall h\neq0$$It would be nice to say then that the derivative is divergent, but I don't think this is rigorous due to the unknown behaviour of $\sum_{k\in K_2(h)}$. I also can't make any bounds from above since the relevant series are over an infinite set - the bounds just give me "$\cdots<\infty$" which is useless. Besides, $f$ is increasing so the derivative expression is always positive - upper bounds would not, I think, be helpful.
What am I missing? Any hints or answers are appreciated (I'd prefer hints, though).