# A non-monotonic, everywhere differentiable function whose derivative is nowhere zero

I've been grading the following problem for an undergraduate numerical analysis course:

Suppose $f \in C([a,b])$ and $f'(x)$ exists on $(a,b)$. Show that if $f'(x) \neq 0$ for all $x \in (a,b)$, then there can exist at most one number $p$ in $[a,b]$ with $f(p) = 0$.

Proof by contradiction plus the Mean Value Theorem does the trick just fine. But a few students tried proving it directly, as follows:

By the MVT, there exists $c \in (a,b)$ such that $$f'(c) = \frac{f(b)-f(a)}{b-a}.$$ $f'(c) \neq 0$, hence $f(b) \neq f(a)$. Then either $f(a) < f(b)$ or $f(b) < f(a)$. But then $f$ is either strictly increasing or strictly decreasing; hence, there exists at most one zero in $(a,b)$.

Pedantic grading aside, there seems to be a leap of logic here. Due to the many examples of differentiable functions with discontinuous derivatives, I wonder if there is a counterexample to the students' final conclusion. Namely, is there a non-monotonic, everywhere differentiable function whose derivative is nowhere zero?

Note: I need the derivative to exist, so the Weierstrass function (as in this post and this post) doesn't work.

There may also be a simple way to interpret the students' proofs; they're generally poorly written and the above was my best guess at what they meant to say.

• Darboux says "no". – David Mitra Sep 28 '14 at 14:06
• As $f(a) < f(b)$ or $f(b) < f(a)$, doesn't $f$ need to be monotonic? – Clarinetist Sep 28 '14 at 14:10
• @Clarinetist: That does not follow directly, i.e. without using Darboux' theorem. Note that the "sign" (i.e. wether $<$ or $>$ occurs) could change with different values of $a,b$. – PhoemueX Sep 28 '14 at 15:32

As David Mitra points out, Darboux' theorem (every derivative fulfils the intermediate value property) implies that either $f' >0$ or $f' <0$ on the whole interval, so that $f$ is strictly monotonous.
Another approach is to note that the argument given by the student proves that $f$ is injective. But it is well-known (and easy to see directly using the intermediate value theorem) that every continuous injective function on an interval is strictly monotonous.
• For injectivity, one would need to show that $f(c) \neq f(d)$ for all $c \neq d \in [a,b]$, correct? Not just for $a$ and $b$. Regardless, I think you've affirmed for me that the students didn't know what they were doing. – artificial_moonlet Sep 28 '14 at 17:22
• Yes, sure, fur $c\neq d$ and $c,d \in [a,b]$, but the proof using the mean value theorem is just the same. – PhoemueX Sep 28 '14 at 17:57