How would Intermediate Value Theorem be used in this question? Suppose $h:(0,1)$ is a real function s.t. for all $x \in (0,1)$ there exists a $\delta\gt0$ such that for all $x' \in (x,x+\delta)\cap(0,1)$ we have $h(x)\leq h(x')$.
Prove that if $h$ is continuous on $(0,1)$ then $h(x) \leq h(y)$ whenever $x,y \in (0,1)$ and $x\leq y$.  Also show by counterexample this may not be true when h is not continuous.
 A: Assume the contrary and there exist $x<y$ with $h(x)>h(y)$.
Let $z=\inf\{\,t\in(x,1)\mid f(x)>f(t)\,\}$. Then $z\le y$ and clearly $z\ge x+\delta_x$.
By definition of $z$ as infimum, there exist $t\in(z,z+\delta_z)$ with $f(t)<f(x)$. But for these $t$ we have $f(t)\ge f(z)$. Hence $f(z)<f(x)$. By the IVT, there exists $\xi \in(x,z)$ with $h(\xi)=\frac{f(x)+f(z)}{2}<f(x)$.
But this implies $z\le \xi$, contradiction.
A oncontinuous counterexample is $h(x)=-\lfloor 2x\rfloor$.
A: It is not clear to me how the intermediate value theorem can be conveniently used here.
Let $\delta_x>0$ be the posited $\delta$ and $U_x = (x,x+\delta_x)$. Then $\{U_x\}_{x \in (0,1)}$ is an open cover of $(0,1)$.
Now choose $x,y \in [0,1]$. Since $[x,y]$ is compact, there is a finite subcover
$U_{x_1},...,U_{x_n}$. Without loss of generality, we may assume that no $U_{x_j}$ is contained in another. We may also assume that the $x_k$ are in strictly increasing order, $x \in U_{x_1}$ and $y \in U_{x_n}$. If $ n=1$, we are finished, otherwise we may assume $x < { x_2}$.
It should be clear that by construction $x_{k+1} \in U_{x_k}$, hence by considering the sequence of points $x,x_2,...,x_n,y$ we find that $h(x) \le h(x_2), ..., h(x_n) \le h(y)$, and so $h(x) \le h(y)$.
For a counterexample, let $h(x) = x \cdot 1_{(0, { 1 \over 2})}(x)$.
