Nowhere Monotonic Continuous Function

THEOREM There exists a continuous function f:[0,1]->R that is neither increasing nor decreasing on any subinterval of [0,1]. Proof Consider the set of all continuous functions f:[0,1]->R. Equip it with the sup metric. It's a complete metric space. Let I be a subinterval of [0,1]. Let A(I) denote the set of all continuous f:[0,1]->R that are increasing on I. ( x<y ==> f(x)<=f(y) ). Notice that A(I) is closed. Let B(I) be the set of all continuous f:[0,1]->R that are decreasing on I. Notice that B(I) is closed. Let K = A(I) u B(I). Notice that K is closed and Int(K) = 0. Let {I[n]} be a sequence of intervals constructed as follows. I[1]=[0,1/2], I[2]=[1/2,1], I[3]=[0,1/3], I[4]=[1/3,2/3], I[5]=[2/3,1], I[6]=[0,1/4], I[7]=[1/4,2/4], etc. Put P[n] = A(I[n]) u B(I[n]). Notice that P[n] is closed and Int(P[n])=0. By the Baire Category Theorem U(n:-N)[P[n]] is not the whole space, thus showing the existence of a continuous function that is neither increasing nor decreasing on any subinterval of [0,1].

You can also see a proof of the existence of a continuous nowhere differentiable function.

Both proofs have been adopted from the book Topological Spaces: From Distance to Neighborhood.