Metric spaces - continuity - open/closed. 
Let $f:(M_1,d_1)\to (M_2,d_2)$ be a mapping between two metric spaces. 
a)Let $A\subseteq M_1$ be open and $B\subseteq M_1$ closed. Show through the use of counterexamples that in general $f(A)$ is not open and $f(B)$ is not closed in $M_2$. 
b) Show that f is continuous when the pre-images of closed sets in f are closed again. 

Just started learning about metric spaces in general and this one piqued my interest in the textbook. 
Here's what I thought: 
a) Although I'm allowed to use counterexamples I don't know how to start. I was thinking that I need to find a set in $M_1$ whose ball is not open in $M_2$, right? And similarly for B, that the corresponding set in $M_2$ is not closed, meaning that the complement is not open? 
But how can I show that? I mean, I have no explicit norm given to set up the balls. Any ideas? 
b) We weren't at the chapter of continuity in metric spaces so I tried reading about it somewhere. It seems kind of similar to proving continuity in $\mathbb{R}$? But again, I don't know how to approach this without a norm. According to my textbook I'm supposed to show that 
$d_2(f(x),f(x_0))<\epsilon$ if $d_1(x,x_0)<\delta$, correct?
But I seriously don't know how to use that to deal with b), especially since they require pre-images of f. 
Any tips or hints would be greatly appreciated. 
Edit: My approach for a): 
$$
d(x,y) :=  \begin{cases}0, &x = y\\1, & x\neq y\end{cases}
$$
$B_r(x)=\{y\in \mathbb{R}|d(x,y)<r\}$  $x\in \mathbb{R},~r>0$
$B_{1/2}(0)=\{0\}$ is open for $x=y$.
For $d_2:|x-y|$ 
No finite number of open intervals so that the intersection is zero. 
$\rightarrow f(B_{1/2}(0))$ is not open. 
For the closed case: 
You said I should take the complement of all the balls used for the open case, meaning: 
$B_r(x)=\{y\in \mathbb{R}|d_1(x,y)>r\}$ for $x\in\mathbb{R},r>0$.
$\rightarrow$ $B_{1/2}^{d_1}(0)={1}$ is closed in $(\mathbb{R},d_1)$?
So for $d_2(x,y):=|x-y|$ and $f:(\mathbb{R},d_1)\to (\mathbb{R},d_2),x\mapsto x$. 
So similarly it should be $f(B_{1/2}^{d_1}(0))=\{1\}$, and $\{1\}$ is not closed because for all $r>0:B_r^{d_2}(0)={0}$ and not $\{1\}$, right? 
 A: a) In such exercises, you are allowed to use any metric and mapping you wish to. A nice one for counterexamples is
$$
d(x,y) :=  \begin{cases}0, &x = y\\1, & x\neq y\end{cases}
$$
What is the ball $B_r(x)=\{y\in\mathbb R\mid d(x,y)<r\}$ around $x\in\mathbb R, r>0$ with this metric? Can you find a mapping that maps it to a non-open set? (Remember that $d_1$ and $d_2$ may be different.)
(Side Remark: A metric space is by no means normed, for example if it has the metric $d$ given above.)
b) Usually continuous is defined as "the preimages of open sets are open". To prove your statement, use that open sets are the complements of closed ones:
Let $f:S\to T$ be a function where preimages of closed sets are closed. Let $A\in T$ be open, $B:=T\setminus A$. Hence B is closed, and by assumption $\tilde B=f^{-1}(B)$ is closed to. Use that to show that $\tilde A=f^{-1}(A)$ is open, which concludes your proof.

My suggestions for your approach above
$$
d_1(x,y) :=  \begin{cases}0, &x = y\\1, & x\neq y\end{cases}
$$
Hence in $(\mathbb R, d_1)$ the open balls are $B_r(x)=\{y\in \mathbb{R}|d_1(x,y)<r\}$  for $x\in \mathbb{R},~r>0$
$\Rightarrow A:=B^{d_1}_{1/2}(0)=\{0\}$ is open in $(\mathbb R, d_1)$.
Let $d_2(x,y):=|x-y|$ and $f:(\mathbb R,d_1)\to(\mathbb R,d_2), x\mapsto x$
Thus $f(A)=\{0\}$, but $\{0\}$ is not open in $(\mathbb R, d_2)$ since $\not\exists r>0:B_r^{d_2}(0) = \{0\}$
For the closed set case, it suffices to take the complements of all the balls above:
Let $B := A^C = \mathbb R\setminus \{0\}$. $B$ is closed in $(\mathbb R, d_1)$ as complement of the open set $A$.
$\Rightarrow f(B) = B$ is not closed in $(\mathbb R, d_2)$ since its complement $A$ is not open (see above).
