Question concerning Preimage 
Let $f$ be the map from $\mathbb{R} \to \{a,b,c\}$ defined by
  \begin{equation}
f(x)=\begin{cases} a &\text{if} \quad x>0 \\ b & \text{if} \quad x<0 \\ c &\text{if} \quad x=0 \end{cases}
\end{equation}
  Determine pre-images $f^{-1}(B)$ of all subsets of $B$ and justify if they are closed, open or neither.

My reasoning
Let $f$ be a function from $X$ to $Y$. The pre-image of the set $B \subseteq Y$ under $f$ is the subset of $X$ defined by
\begin{equation}
f^{-1}[B]=\{x \in X:f(x) \in B\}
\end{equation}
As such, I would answer $f^{-1}(a)=\mathbb{R}^{+}\backslash \{0\}, f^{-1}(b)=\mathbb{R}^{-1}\backslash \{0\},f^{-1}(c)=0$. As for the second part, I would argue the two first cases are open, as every point in these two subsets are interior point in their respective subset. As for the last case, I interpret the corollary to theorem 2.20 (Rudin, p.33) - A finite point set has no limit points - that it is neither open nor closed. Is any of this correct?

Hints： You should consider these cases:


*

*$B$ doesn't contain $a,b,c$.  Pre-images $f^{-1}(B)$ is $\emptyset$; Both open and closed.

*$B$ contains $a,b,c$. Pre-images $f^{-1}(B)$ is $\Bbb R$. Both open and closed.

*$B$ only contains one element of $\{a,b,c\}$, for example, contains $a$. $f^{-1}(B)=f^{-1}(a)=\mathbb{R}^{+}\backslash \{0\}$. It is open, however not closed.

*$B$ contains two elesments of $\{a,b,c\}$.
