I am trying to prove that if $f : \mathbb R \to \mathbb R$ is locally increasing at every point , i.e. if for every $x\in \mathbb R , \exists r_x >0$ such that $f(a)\ge f(b) , $ whenever $ x+r_x >a>b>x-r_x $ , then $f$ is increasing everywhere .
I have proceeded as : Let $a,b \in \mathbb R , a<b$ ; we want to show $f(a) \le f(b)$ ; now for each $p \in [a,b]$ , there is an open n.b.d. of $p$ in which $f$ is increasing , so by these open intervals , we get an open cover of $[a,b]$ and since $[a,b]$ is compact we can get a finite subcover ; but then I am stuck ; can the proof be finished in this way ? Or is there any better way ? Please help . Thanks in advance