# Is there any continuous function $f : \mathbb{R}\to \mathbb{R}$ with $f(\mathbb{R}\setminus K)$ not open for any compact $K$?

I'm trying to find out if there is any continuous function $f : \mathbb{R}\to \mathbb{R}$ such that $f(\mathbb{R}\setminus K)$ is not open for all $K$ compact.

Since in $\mathbb{R}$ every compact is closed and bounded, the set $\mathbb{R}\setminus K$ is open and unbounded. So if there was a continuous function such that the image of any open set is not open it would suffice.

I know there are continuous functions which are not open, that is, that may not map some open sets to open sets, but a continuous function which doesn't map any open set to open set is quite different and I'm failing to see if such a function do exist or not.

Is there any continuous function with this property? How can we see that such a function can or cannot exist?

Edit: Although it wasn't made clear on the question, I'm wondering if there is a function satisfying this property which is not constant. The constant function clearly satisfies this, but I'm asking other functions than constant ones.

• I think you may want to exclude trivial cases... – Megadeth Oct 27 '15 at 3:14
• If you will change the Q to ask for a non-constant f, it would be a good Q – DanielWainfleet Oct 27 '15 at 6:02

Take $f$ to be a constant function.
Take $f(x)=\sin x$, or more generally any bounded continuous function such that the preimage of its minimum (or maximum) value is an unbounded set.