To prove $f$ to be a monotone function A open set is a set that can be written as a union of open intervals. If $f$
is a real valued continuous function on $\mathbb{R}$ that maps every open set to an
open set, then prove that $f$ is a monotone function.
 A: If there exist $a< b< c$ with $f(b) > f(a), f(b) > f(c)$ then $f(a) \neq sup f([a,c]) \neq f(c)$ so that $f|_{(a,c)}$ attains a supremum. Therefore $f((a,c))$ is not open. 
A: "Increasing" ("decreasing") means nonstrictly increasing (decreasing). We consider a function $f:\mathbb R\rightarrow\mathbb R$.
Lemma 1. If a function $f$ is non-monotone, then its restriction to some set of size $3$ or $4$ is non-monotone.
Proof. Suppose $f$ is non-monotone. Since $f$ is not decreasing, we can choose $a,b$ so that $a<b$ and $f(a)<f(b)$. Since is not increasing, we can choose $c,d$ so that $c<d$ and $f(c)>f(d)$. The set $\{a,b,c,d\}$ does the trick.
Lemma 2. If a function $f$ is non-monotone, then its restriction to some $3$-element set $X$ is non-monotone.
Proof. Suppose $f$ is non-monotone. By Lemma 1, we may assume that the restriction of $f$ to some $4$-element set $\{a,b,c,d\}$, with $a<b<c<d$, is non-monotone. Without loss of generality, we may assume that $f(a)\le f(d)$. Now we consider two cases.
Case I. For some $x\in(a,d)$, either $f(x)>f(d)$ or $f(x)<f(a)$. In this case, the set $X=\{a,x,d\}$ works.
Case II. For each $x\in(a,d)$ we have $f(a)\le f(x)\le f(d)$; in particular, $f(a)\le f(b)\le f(d)$ and $f(a)\le f(c)\le f(d)$. Since $f$ is not increasing on $\{a,b,c,d\}$, we must have $f(b)>f(c)$, and then $X=\{a,b,c\}$ works.
Theorem. An open continuous function $f:\mathbb R\rightarrow\mathbb R$ is monotone.
Proof. Consider an open continuous function $f:\mathbb R\rightarrow\mathbb R$, and assume for a contradiction that $f$ is non-monotone. By Lemma 2 there is a $3$-element set $X=\{a,b,c\}$, $a<b<c$, such that $f$ is non-monotone on $X$. Since $f$ is continuous, it has an absolute maximum value and an absolute minimum value on the closed interval $[a,c]$. If both the maximum and the minimum were attained at the endpoints, then $f$ would be monotone on $X$. Without loss of generality, we may assume that the absolute maximum value of $f$ on $[a,c]$, call it $M$, is attained in the open interval $(a,c)$. But this means that the image of $(a,c)$ under $f$ has a greatest element, namely $M$, and so it can't be an open set.
