# Nowhere differentiable continuous functions and local extrema

Consider any continuous function which is nowhere differentiable (such as Weierstarss function). If this function would be monotone on some interval $(a,b)$ then there is a result which states that in this interval this function would be almost everywhere differentiable which is contradiction. Therefore any such function cannot be differentiable in any interval. However this not settles the issue of having local extrema.

Is it possible to construct everywhere continuous, nowhere differentiable function $f:[-1,1] \to \mathbb{R}$ with the following property: $f$ has local minimum at $x_0=0$, $f$ has local maximum at $x_1=\frac12$, $f(0)>f(\frac12)$ and $x_0,x_1$ are only extremas of $f$

• I imagine you mean $f(0) < f(1/2)$? Otherwise, by continuity of $f$, there exist $M \ge f(0) > f(1/2)$ and $c \in [0, 1/2]$ such that $M = f(c)$. In fact, $M > f(0)$, as otherwise $f$ would be somewhere differentiable since we would then have $M \ge f \ge f(0) \ge M$ on some interval $[0, \epsilon')$ (because $0$ is a local minimum), so $f$ would be constant on this interval and thus differentiable. Hence $c \in (0, 1/2)$ is such that $M = f(c) > f(1/2)$, so $c$ is another local extremum of $f$. – Jordan Payette Apr 16 '17 at 14:17

I explained in a comment to your question that you need instead to assume that $f(0) < f(1/2)$ for your statement to have a chance to be true. I show here that even then, such a function does not exist.
Assume the contrary, so $f : [-1,1] \to \mathbb{R}$ is a continuous nowhere differentiable function which only has precisely two local extrema in some interval $(- \epsilon, 1/2 + \epsilon) \subset (-1,1)$, namely $0$ as a local minimum and $1/2$ as a local maximum, with $f(0) < f(1/2)$. (Observe that $-1$ and $1$ might be local extrema of $f$ on $[-1,1]$).
Consider any $(c - \delta, c+ \delta) \subset (0, 1/2)$. Then $f$ achieves its maximum on $[c - \delta/2, c + \delta/2]$ in some point $c'$. We can't have $c' \in (c - \delta/2, c+ \delta/2)$, for otherwise it would be another local maximum of $f$ in $(-\epsilon, 1/2 + \epsilon)$. Therefore, $c' \in \{ c - \delta/2, c + \delta/2 \}$. Similarly, $f$ achieves its minimum on $[c - \delta/2, c + \delta/2]$ only on the boundary. The minimum and the maximal values have to be different, for otherwise the function would be constant on this interval and there would be infinitely many local extrema. Furthermore, the maximum cannot be achieved at $c - \delta/2$, for otherwise we would have $f(c - \delta/2) > f(c + \delta/2)$ and so $f$ would have a local minimum in the interval $[c - \delta/2, 1/2]$ located in fact in $(c- \delta/2, 1/2)$. Hence the maximum is achieved at $c+ \delta/2$.
As $c$ and $\delta$ were arbitrary, this shows that $f$ is (strictly) increasing on $[0, 1/2]$. As you mentioned in your question, this implies that $f$ is somewhere differentiable. A contradiction.