Proving the existence of a non-monotone continuous function defined on $[0,1]$ Let $(I_n)_{n \in \mathbb N}$ be the sequence of intervals of $[0,1]$ with rational endpoints, and for every $n \in \mathbb N~$ let $E_n=\{f \in C[0,1] : f \:\text{is monotone in}\: I_n\}$. Prove that for every $n \in \mathbb N$, $E_n$ is closed and nowhere dense in $(C[0,1],d_\infty)$. Deduce that there are continuous functions in the interval $[0,1]$ which aren't monotone in any subinterval. 
For a given $n$, $E_n$ can be expressed as $E_n=E_{n\nearrow} \cup E_{n\swarrow}$ where $E_{n\nearrow}$ and $E_{n\swarrow}$ are the sets of monotonically increasing functions and monotonically decreasing functions in $E_n$ respectively. I am having problems trying to prove that these two sets are closed. I mean, take $f \in (C[0,1],d_\infty)$ such that there is $\{f_k\}_{k \in \mathbb N} \subset E_{n\nearrow}$ with $f_k \to f$. How can I prove $f \in E_{n\nearrow}$?. Suppose I could prove this, then I have to show that $\overline {E_n}^\circ=E_n^\circ=\emptyset$. This means that for every $f \in E_n$ and every $r>0$, there is $g \in B(f,r)$ such that g is not monotone. Again, I am stuck. If I could solve this two points, it's not difficult to check the hypothesis and apply the Baire category theorem to prove the last statement.
 A: It is easy to show that $E_n$ is close. Just like what you did, let $E_n^1$ be the subset of $E_n$ containing all functions increasing on $I_n$. Let $\{ f_k\}$ be a sequence in $E_n$ converging to $f\in C[0,1]$. Pick $x, y\in I_n$, $x<y$. Then $f_n(x) \leq f_n(y)$ for all $n$. Take $n\to \infty$ gives $f(x) \leq f(y)$. Thus $E_n^1$ is closed. Now $E_n$ is the union of two close set, so it is close. 
To show that $E_n$ has empty interior, let $f\in E_n$. Assume that $f$ is inceasing (the case when $f$ is decreasing can be done similarly). We perturb $f$ a little bit to get a function $h$ which is not monotone. Let Write $I_n = [a, b]$. Let $\epsilon >0$ be arbitrary. Let $c_1, c_2\in (a, b)$ such that 
$$ c_1 < c_2, \text{ and }\ f(b) - \epsilon < f(c_2) \leq f(b).$$
$c_1, c_2$ can be found as $f$ is continuous. Let $g$ be a continuous function on $[0,1]$ with the properties:
$$|g|\leq \epsilon,\ g(a) = g(b) = -\epsilon,\ g(c_1)= g(c_2)=0,\ .$$
Then $h=f-g$ satisfies
$$d(f, h)_\infty \leq \epsilon$$ 
and $h(a) = f(a) - \epsilon < f(a)\leq f(c_1)= h(c_1)$ and $h(c_2) = f(c_2) > f(b) - \epsilon = h(b)$. Thus $h$ is not monotone. As $f$, $\epsilon>0$ are arbitrary, $E_n$ contains no open set. Hence $E_n$ are nowhere dense. (The conclusion is quite interesting).
