A continuous function such that the inverse image of a bounded set is bounded

Suppose $f:\mathbb{R}\longrightarrow \mathbb{R}$ be an arbitrary continuous fuction such that the inverse image of a bounded set is bounded. Then show that,

$1$) The image under $f$ of a closed set is closed.

$2$) $f$ is not necessarily a surjective function.

My attempt ($1$) :

Say, $X\subset \mathbb{R}$ is an arbitrary closed set, such that $f(X)=Y\subset \mathbb{R}$ is not closed. Then I am trying to prove by contradiction.
Case 1 : $X$ is bounded. Hence $X$ is closed and bounded $\implies$ compact. Since $f$ is continuous, $f(X)=Y$ is also compact $\implies Y$ is closed. (a contradiction)
Case 2 : $X$ is not closed and not bounded. So $f(X)=Y$ is not bounded and not closed. If $Y$ is open and not bounded then $Y=\mathbb{R}$, but $\mathbb{R}$ is clopen (closed and open). (a contradiction).
Hence, $f(X)=Y$ where $X$ is closed and not bounded and $Y$ is neither open nor closed and also not bounded. Now I am confused that how to get a contradiction of this final case.

My attempt ($2$) :

Here, I cannot understand the meaning of the inverse image of a bounded set. I think inverse function will exist only for the bijections. In this context how I can find a continuous map $f$ which is not a surjection, and inverse image of the bounded set is bounded.


If $f: X\to Y$ is an arbitrary map, the inverse image of a subset $Y'$ of $Y$ is defined as $f^{-1}(Y'):=\{x\in X: f(x)\in Y'\}$. This dose not require $f$ to be bijective.

For (1), let $X$ be a closed subset of $\mathbb{R}$, then for any $y$ lies in the boundary of $f(X)$, by the definition, you can take a sequence of points $y_n$ in $f(X)$, such that $\lim_{n\to\infty}y_n=y$, and for each $y_n$, take $x_n\in X$ such that $f(x_n)=y_n$. $\{y_n: n\}$ is bouned, hence $\{x_n: n\}$ is also bounded, then pick a convergent subsequence of $(x_n)_n$ (still denoted by $(x_n)_n$), and set $x=\lim_{n\to\infty}x_n$. $X$ is closed, hence $x\in X$. $f$ is continuous, hence $f(x)=f(\lim_{n\to\infty}x_n)=\lim_{n\to\infty}f(x_n)=y$, that is, $y\in f(X)$. Therefore, $f(X)$ is also closed. As for (2), $f(x)=\mathrm{exp}(x)$ should be an example.


If $C\subset \mathbb R$ is closed and bounded then $f(C)$ is closed and bounded too.

So let $C\subset \mathbb R $ be closed and unbounded. Suppose that $f(C)$ is the image of $C$ under $f$.

Let $p$ be a given limit point of $f(C)$. For any $n\in \mathbb N$, there is an $x_n\in C$ such that $f(x_n)\in (p-1/n, p+1/n)$. So $f(x_n)\to p$.

It follows that the sequence $(f(x_n))$ is bounded and hence $(x_n)$ is also bounded (by given hypothesis). By Bolzanno Weierstrass theorem, there exists a convergent subsequence $x_{n_k}\to l\in C$ (because $C$ is closed) hence by continuity, $f(x_{n_k})\to f(l)=p$. It follows that $p\in f(C)$, hence $f(C)$ is closed.

For $(2)$, consider $f(x)=e^{|x|}$. $f(x)\ge 1$ for all $x\in \mathbb R$.