If $\lim\limits_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=0$ for all $x\in I$, then $f$ is constant. So suppose $I\subset \mathbb{R}$ is an open interval and $f: I\to \mathbb{R}$ a continuous function such that $$\lim\limits_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=0$$ for all $x\in I$. Show that $f$ is constant.


My ideas:

Proof by contraposition. Suppose $f$ is not constant; thus there are $a,b\in I$ with $a&lt;b$ such that $f(a)\neq f(b)$. I am given the hint that I should check the $\sup$ of $$M:=\left \{ x\in [a,b] : \frac{f(x)-f(a)}{x-a} &lt; \frac{f(b)-f(a)}{2(b-a)}\right\}.$$ I tried wrapping my head around the geometric meaning of $\frac{f(x)-f(a)}{x-a} $ and $\frac{f(b)-f(a)}{2(b-a)}$. I came to the conclusion that $\frac{f(x)-f(a)}{x-a} $ approximates the slope of the curve at $a$ for sufficient $x$. $\frac{f(b)-f(a)}{2(b-a)}$ is half of the slope of the secant line connecting $a$ with $b$.

But what does finding the $\sup$ of $M$ mean and how does it contradict the fact that $f$ is not constant?
Following your idea, without loss of generality, and towards a contradiction, $f(b)&gt;f(a)$. Define $g(x)=\frac{f(x)-f(a)}{x-a}$ if $x\neq a$ and $g(a)=0.$ Then $g$ is continuous on $[a,b]$. 

Now, set $g(b)=2\epsilon$ and $c=\inf\{x\in [a,b]:g(x)&gt;\epsilon\}.$ Then, continuity of $g$ implies that $c &lt; b$ and $g(c)=\epsilon.$ (Drawing a picture here will help).

But there is a $d\in (c,b]$ such that $|f(x) – f(c)| \le \epsilon(x – c)$  for all $x \in (c,d]$ (why?) and so now we have for all $x\in(c,d],$ 

$|f(x)-f(a)|\leq |f(x)-f(c)|+|f(c)-f(a)|\leq$

$ \epsilon (x-c)+\epsilon(c-a)= \epsilon(x-a)\Rightarrow g(x)\le \epsilon,$ 

which contradicts the choice of $c$.
The most simple answer to this problem is to use mean-value theorem.

https://en.wikipedia.org/wiki/Mean_value_theorem#A_simple_application

Look contents 4 : A simple application.