continuous nowhere monotonic function
Let $f$ be a realvalued continuous function^{} defined on the unit interval $[0,1]$. It seems intuitively clear that $f$ should be monotonic^{} on some subinterval $I$ of $[0,1]$. Most of the concrete examples seem to support^{} this. A counterexample is termed nowhere monotonic, meaning that the function is not monotonic in any subinterval of $[0,1]$. Surprisingly, nowhere monotonic functions do exist:
Proposition 1.
There exists a realvalued continuous function defined on $\mathrm{[}\mathrm{0}\mathrm{,}\mathrm{1}\mathrm{]}$ that is nowhere monotonic.
A sketch of the proof goes as follows:

1.
Let $X$ be the set of all continuous realvalued functions on [0,1]. Then $X$ is a complete metric space given the sup norm. Clearly $X$ is nonempty.

2.
Given any subinterval $I$ of $[0,1]$, the subset $P(I)\subseteq X$ consisting of all nondecreasing functions, the subset $Q(I)\subseteq X$ consisting of all nonincreasing functions, and hence their union $M(I)$, are closed.

3.
Furthermore, $M(I)$ is nowhere dense.

4.
Let $S$ be the set of all rational intervals^{} in $[0,1]$ (a rational interval is an interval whose endpoints are rational numbers). Then $S$ is countably infinite^{}. Take the union $M$ of all $M(I)$, where $I$ ranges over $S$.
 5.

6.
However, $M$ is a countable^{} union of nowhere dense sets and $X$ is a nonempty complete metric space. By Baire Category Theorem, this can not happen. Therefore, $M\subset X$ strictly and there exists a continuous nowhere monotone realvalued function defined on $[0,1]$.
Example : van der Waerden function
The above shows the existence of such a function. Here is an actual example of a nowhere monotonic continuous function, called the van der Waerden function. This function, which we designate by $f$, is given by a series
$$f(x)=\sum _{k=0}^{\mathrm{\infty}}{f}_{k}(x)$$ 
where the functions ${f}_{k}$ are defined by
$${f}_{0}(x)=\{\begin{array}{cc}x,\hfill & \text{if}\mathrm{\hspace{0.33em}\hspace{0.33em}0}\le x\le \frac{1}{2}\hfill \\ x+1,\hfill & \text{if}\frac{1}{2}\le x\le 1\hfill \end{array}\mathit{\hspace{1em}\hspace{1em}}\text{and}\mathit{\hspace{1em}\hspace{1em}}{f}_{k}(x)=\frac{1}{{2}^{k}}{f}_{0}({2}^{k}x)$$ 
where each ${f}_{k}(x)$ is defined on $[0,{2}^{k}]$. Since ${f}_{k}$ agrees on the endpoints, we can extend the its domain to the entire unit interval by periodic extension (so that the graph of ${f}_{k}(x)$ has the shape of a sawtooth).
$$
 It is easy to check that each ${f}_{k}$ is continuous. Using the Weierstrass Mtest^{} we can also see that the series converges uniformly, and therefore conclude that $f$ itself is a continuous function (it is the uniform limit of continuous functions).
 We now prove that $f$ is nowhere monotonic:
The set $$ is dense in $[0,1]$. Given any interval $I\subset [0,1]$ we can then find a point of the form $\frac{L}{{2}^{k}}$ in its interior.
It is easily seen that ${f}_{j}(\frac{L}{{2}^{k}})=0$ for $j\ge k$.
For any integer $j>k$, consider the points ${a}_{j}:=\frac{{2}^{jk}L1}{{2}^{j}}$ and ${b}_{j}:=\frac{{2}^{jk}L+1}{{2}^{j}}$. The points ${a}_{j}$ (resp. ${b}_{j}$) are just the points on the left (resp. on the right) of $\frac{L}{{2}^{k}}$ when we divide the unit interval in segments of size $\frac{1}{{2}^{j}}$.
A direct calculation would show that
$$\{\begin{array}{cc}{f}_{s}({a}_{j})=0,\hfill & s\ge j\hfill \\ {f}_{s}({a}_{j})=\frac{1}{{2}^{j}},\hfill & j>s\ge k\hfill \\ {f}_{s}({a}_{j})={f}_{s}(\frac{L}{{2}^{k}})\pm \frac{1}{{2}^{j}},\hfill & k>s\ge 0\hfill \end{array}$$ 
and similarly for ${b}_{j}$.
Evaluating $f$ in the points ${a}_{j}$ and ${b}_{j}$ we obtain
$f({a}_{j})$  $=$  $\sum _{s=0}^{\mathrm{\infty}}}{f}_{s}({a}_{j})$  
$=$  $\sum _{s=0}^{j1}}{f}_{s}({a}_{j})$  
$=$  $\sum _{s=0}^{k1}}{f}_{s}({a}_{j})+{\displaystyle \sum _{s=k}^{j1}}{f}_{s}({a}_{j})$  
$=$  $\sum _{s=0}^{k1}}{f}_{s}({\displaystyle \frac{L}{{2}^{k}}})+{\displaystyle \sum _{s=0}^{k1}}(\pm {\displaystyle \frac{1}{{2}^{j}}})+{\displaystyle \frac{jk}{{2}^{j}}$  
$=$  $f({\displaystyle \frac{L}{{2}^{k}}})+{\displaystyle \sum _{s=0}^{k1}}(\pm {\displaystyle \frac{1}{{2}^{j}}})+{\displaystyle \frac{jk}{{2}^{j}}}$ 
and similarly for $f({b}_{j})$.
The least value we can obtain is $f({a}_{j})=f({\displaystyle \frac{L}{{2}^{k}}}){\displaystyle \frac{k}{{2}^{j}}}+{\displaystyle \frac{jk}{{2}^{j}}}=f({\displaystyle \frac{L}{{2}^{k}}})+{\displaystyle \frac{j2k}{{2}^{j}}}$, and even in this extreme case we can still choose $j$ large enough so that ${a}_{j}\in I$ and $j>2k$.
For this appropriate $j$ we see that $f({a}_{j})>f(\frac{L}{{2}^{k}})$, and similarly $f({b}_{j})>f(\frac{L}{{2}^{k}})$.
Recall that $$. We conclude that $f$ is not monotonic in $I$, and hence it is nowhere monotonic.
Remark. The van der Waerden function turns out to be nowhere differentiable^{} as well.
Title  continuous nowhere monotonic function 

Canonical name  ContinuousNowhereMonotonicFunction 
Date of creation  20130322 14:59:08 
Last modified on  20130322 14:59:08 
Owner  asteroid (17536) 
Last modified by  asteroid (17536) 
Numerical id  19 
Author  asteroid (17536) 
Entry type  Result 
Classification  msc 54E52 
Defines  van der Waerden function 