Deriving mappings from $\mathbb{R}$ to $\mathbb{R}$ Give continuous functions $f,g,h,k:\mathbb{R}\rightarrow\mathbb{R}$ and sets $U,C,K,S\subseteq\mathbb{R}$ such that:
(a) $U$ is open in $\mathbb{R}$ but $f(U)$ is not.
This one is easy in my mind, I let $U=(0,2\pi)$ then $f(x)=\sin(x)$ then $f:(0,\pi)\rightarrow [-1,1]$
(b) $C$ is closed in $\mathbb{R}$ but $g(C)$ is not.
This one is more tricky. I figure the interval $[0,\infty)$ is closed because its compliment is open. But I can't think of a function. My original thought was $\ln(x)$, but the domain doesn't work.
(c) $K$ is compact but $h^{-1}(K)$ is not.
A metric space $M$ is compact if, for every collection $C$ of open sets such that $\cup C=M$, there are elements $U_1,\dots,U_n\in C$ such that $U_1\cup\dots\cup U_n= M$. I struggle to understand this definition fully, but I do know that intervals $[a,b]$ are compact. I also know that if a set in $\mathbb{Q}$ is compact if and only if the set is finite. So would a function that maps $[a,b]\in\mathbb{R}$ to $[a',b']\in\mathbb{Q}$ work? Since $[a',b']\in\mathbb{Q}$ would have infinitely many points.
(d) $S$ is connected but $k^{-1}(S)$ is not.
A subset $M\subseteq\mathbb{R}$ is connected iff and only if $a,b\in M$ and $a<b$ then $[a,b]\subseteq M$. So basically any interval in $\mathbb{R}$ is connected right? I also know that $\mathbb{Q}$ is not connected. So I'm thinking that a if I find a function that maps an interval in $\mathbb{R}$ to at a set of at least two rational numbers, then I take the inverse of that function and that will be my answer.
 A: For $2)$, consider $C = [0,\infty)$ and $g(x) = \exp(-x)$. Then, $g(C) = (0,1]$ which is not closed. The reasoning behind such a choice is that we know that if our function is continuous and if the to-be-mapped set is closed and bounded, then it's compact and so will be its image by our continuous function. So, we should think of an unbounded closed set, and any function with an asymptote would do the job.
For $3)$, a subset of $\mathbb R$ is compact if and only if it's closed and bounded. Now, a continuous function always pulls back a closed set to a closed set; so the challenge here is to find a compact whose inverse image is unbounded. Note also that a continuous function always maps compacts to compacts, so your function must either have no inverse on the domain or a discontinuous inverse (there are continuous functions with discontinuous inverses). How about $h(x) = \sin(x)$, with $K = [-1,1]$?
For $4)$, the connected subsets of $\Bbb R$ are the ones that are intervals. So you have to search for an interval whose inverse image is not an interval. Also note that a continuous function preserves connectedness; so your function must not have an inverse on the domain, or it should have a discontinuous inverse. So, we would think about a set like $S = (0,1)$ and a function such as $k(x) = x^2$.
