$f'(x)=0$ implies $f$ constant, although finite or countable exceptions

I am reading a text and I do not know why this follows:

I $f$ is a continuous function and $f'(x)=0$ for every $x \in \mathbb{R}$ except for a finite set $E$ or a countable set $E$, then $f$ must be constant.

Does anybody know an example for such an function?

• your function is not continuous. – drhab Aug 6 '14 at 11:31
• you're right. but which function is continuous and in one point different then in others? – monoid Aug 6 '14 at 11:34
• derivative is undefined at $x=2.$ – Bumblebee Aug 6 '14 at 11:34
• @monoid in point different then others (so constant on the rest) excludes continuity. No such function exist. – drhab Aug 6 '14 at 11:35
• @drhab how can I picture to myself such a function in the above statement? – monoid Aug 6 '14 at 11:42

The problem here is a common one in that the formulation of the result can be at odds with everyday usage of the language.

The only examples of such $f$ are in fact constant functions, which have $f'(x)= 0$ for all $x$.

What does

[...] $f'(x)=0$ for every $x \in \mathbb{R}$ except for a finite set $E$ or a countable set $E$, [...]

mean to say precisely?

It means to say that there is a set $E$ that is finite or countable such that $f'(x)= 0$ for all $x \notin E$.

Note that:

• $E$ can be empty.
• It is not uncommon that the author does not insist that $f'(x) \neq 0$ for $x \in E$.

Informally, the result says if for continous $f$ you know $f'(x) = 0$ for all $x$ except possibly some few exceptions, then you can conclude that $f$ is constant (and after that you'd know in fact $f'(x) = 0$ for all $x$).

In particular, this result tells you that there cannot be any interesting examples: by the very result every example has to be constant!