[This is a cross-post](https://math.stackexchange.com/questions/4602412/derivative-without-extrema-is-monotone) from Math.SE.
The question was asked there 3 months ago but didn't receive much attention aside from one comment asking for clarification. I feel like it might be non-trivial and so I decided to repost the question here.


Let $f\colon(a,b)\to\mathbb R$ be differentiable on $(a,b)$ such that $f'$ has no local extrema on $(a,b)$. Is it true that $f'$ is necessarily monotone on $(a,b)$?


If $f'$ is assumed to be continuous on $(a,b)$ then this is definitely true. Indeed, by continuity of $f'$ each segment $[x\_1,x\_2]\subset(a,b)$ contains points of global maximum and minimum of $f'$ on this segment which must be attained at the endpoints of the segment (otherwise $f'$ will have a local extremum), so $\min\{f'(x\_1),f'(x\_2)\}\leq f'(x)\leq\max\{f'(x\_1),f'(x\_2)\}$ for any points $x\_1<x<x\_2$ in $(a,b)$, and the latter property can be shown to be equivalent to monotonicity.


However, derivatives can be discontinuous, and I'm not sure how to proceed in that case. I couldn't find similar problems on both Math.SE and MO or elsewhere on the internet, but the question seems so natural that it probably had been considered and researched by some analysts of 20th century.



Derivative without extrema is monotone
The following is copied from A. Bruckner, *Differentiation of Real Functions* (2d ed, 1994), at the end of chapter 6 (“The Zahorski Classes”): I didn't check the details carefully, but it seems to answer your question. (Remarks in brackets are mine. All typos are also likely to be mine.)



> 
> A continuous function defined on $[a,b]$ must assume a maximum and a minimum on $[a,b]$. The corresponding statement for derivatives is false. (Consider, for example, a derivative $g$ whose graph is similar to the graph of $g\_0 = \sin(1/x)$, $g\_0(0)=0$ except that $g$ never quite achieves the values $1$ or $-1$.) More surprising is the fact that a derivative need not achieve any *local extrema*. To see this, consider the function $f$ of Example 1.1 of Chapter 1 [reproduced below]. This function has the Darboux property [i.e., the intermediate value property], but is not in Baire class one. If we redefine $f$ so as to equal $0$ at *every* point of $C$, then the resulting function $g\_1$ is in $\mathcal{B}\_1$ [Baire class $1$], but no longer has the Darboux property. Now let $C\_2$ be a nowhere dense perfect subset of $[0,1]$ such that each point of $C\_1$ [I think $C\_1 := C$ here] (other than $0$ and $1$) is a bilateral point of accumulation of $C\_2$, while $0$ is a point of accumulation [of] $C\_2$ from the right and $1$ is a point of accumulation from the left. Let $g\_2$ be defined relative to $C\_2$ as $g\_1$ was defined relative to $C\_1$. Continue the process, arriving at a sequence of nowhere dense perfect sets $\{C\_k\}$ such that $0\in C\_k$, $1\in C\_k$ and every other point of $C\_k$ is a bilateral point of accumulation of $C\_{k+1}$ and such that $\bigcup C\_k$ is dense in $[0,1]$. To each set $C\_k$ corresponds a function $g\_k$. Let $g(x) = \sum g\_k(x)/2^k$.
> 
> 
> Since $g$ is the uniform sum of functions in $\mathcal{B}\_1$, $g$ is also in $\mathcal{B}\_1$. Even though none of the functions $g\_k$ is in $\mathcal{D}$ [functions with the Darboux property], their sum is. To verify this, we can apply any of the several parts of Theorem 1.1 of Chapter 2 [characterizing Darboux functions among those in Baire class $1$]. Furthermore, it is easy to verify that $g$ attains no local extrema.
> 
> 
> By Theorem 7.1 of Chapter 2 [a theorem of Maximoff], there exists a homeomorphism $h$ of $[0,1]$ onto itself such that the function $g\circ h$ is approximately continuous. Since this function is bounded, it is also a derivative. Since $g$ attains no local extrema, neither does $g\circ h$. We summarize as a theorem:
> 
> 
> **Theorem 3.1.** *There exists a bounded approximately continuous derivative which achieves no local maximum and no local minimum.*
> 
> 
> 


Example 1.1 of chapter 1 is this:



> 
> Let $C$ be the Cantor set in $[0,1]$. If $(a,b)$ is an interval contiguous to $C$, we define $f(x) = (2(x-a)/(b-a))-1$ for $x\in[a,b]$. Otherwise let $f(x)=0$. Then $f$ is a Darboux function which is discontinuous at every point of $C$.
> 
> 
> 


