Prove $f$ is monotonically increasing in $\mathbb{R}$. Suppose a function $f$: $\mathbb{R}\to \mathbb{R} $, for each $x_0 \in \mathbb{R} $ there exists  $\delta $ such that $f$ is monotonically increasing in $(x_0-\delta,x_0+\delta)$. Prove $f$ is monotonically increasing in $\mathbb{R}$.
I think it possibly need to use Henie-Borel Theorem to proof that $f$ is monotonically increasing in arbitrary closed interval $[a,b]$.But how to organise the words ...
 A: Fix $a, b \in \mathbb{R}$ and without loss of generality, $a < b$. Suppose for the sake of contradiction, we had $f(a) > f(b)$. Consider the set
$$S = \lbrace x \in [a, b] : f(x) \ge f(a)\rbrace$$
Then $S$ is bounded above by $b$, and must have a supremum $c \in [a, b]$. By the hypotheses of the question, there exists a $\delta > 0$ such that $f$ is increasing over $(c - \delta, c + \delta)$. But, by definition of the supremum, there must be some $d \in (c - \delta, c]$ such that $d \in S$. Therefore, we have
$$f(a) \le f(d) \le f(c + \delta/2),$$
which means $c + \delta/2 \in S$, contradicting $c = \sup S$.
A: Assume that $f$ is not monotonically increasing, or equivalently that $a,b\in\mathbb R$ exist with $a<b$ and $f(a)>f(b)$.
Then the set $S:=\{x\in\mathbb (a,\infty)\mid f(a)>f(x)\}$ is not empty.
Let $s:=\inf S\geq a$.
For $\delta>0$ small enough $f$ is monotonically increasing on $(s-\delta,s+\delta)$ so it cannot be that $s=a$ because $[s,s+\delta)$ contains elements of $S$.
So $s>a$. But then for $x\in(s-\delta,s)\cap(a,s)$ and $y\in S\cap[s,s+\delta)$ we find $f(x)\leq f(y)<f(a)$ which contradicts that $s=\inf S$.
A contradiction is found and we conclude that our assumption must be wrong.
A: Suppose for the sake of contradiction that there is $x_1< x_2$  such that $f(x_1)>f(x_2)$. Then the set $\{x, x> x_1 \text{ and } f(x)<f(x_1)\}$ is bounded below by $x_1$ and non-empty, hence has a greatest lower bound, say $a$. There exists some $\delta >0$ such that $f$ increases over $(a-\delta, a+\delta)$. By definition of $a$, $f(a-\frac{\delta}2)\geq f(x_1)$. Therefore for any $x$ in $[a, a+\delta)$, $f(x)\geq f(a-\frac{\delta}2)\geq f(x_1)$.
By a well-known property of the GLB, there exists $c\in [a,a+\delta)$ such that $f(c)<f(x_1)$, a contradiction.
