Continuous functions and intervals

It is known that the image of an interval $I$ by continuous functions $f:\mathbb{R}\to \mathbb{R}$ is another interval $f(I)$. If the interval is compact, that is, closed and bounded, then so is $f(I)$. However, in general $I$ and $f(I)$ can be of different types.

I am trying to study which situations may arise, and find examples or a proof of why a certain case is impossible. For instance, the case $I$ is a bounded open interval and $f(I)$ an open, unbounded interval is possible; it is enough to consider the function $f(x) = 1/x$ and $I = (0,1)$. However, I'm having some troubles with the case $I$ closed and unbounded. I think $f(I)$ cannot be an open interval, but mainly because it seems impossible to draw. How could I proceed to prove this is impossible? I thought about dividing the cases $f(I)$ bounded and unbounded, but I'm stuck at this point. If I am in the wrong, a counterexample would be appreciated.


Solution 1:

Let $f:[0,+\infty)\to \mathbb{R}$ be given by $f(x)=\frac{x\sin(x)}{1+x}$. Then $f(I)=(-1,1)$.