Prove of continuity and open set I need to prove this but I can't figure out how. It would be nice if somebody can help me out with this . 
Let X and Y be nonempty subsets of $R^{N}$ and $R^{K}$, respectively. Prove the followings: 
A function $f: X \rightarrow Y$ is continuous if and only if for any open set $B \subset Y $, the inverse image of $B$ under $f$,
$f^{-1} = \{x \in X | f(x) \in B \}$
is open. 
 A: First, suppose that $f:X\to Y$ is such that for any $B \subset Y$ open, $f^{-1}(B)$ is open. Let $x_0 \in X$ and let $\epsilon > 0$. 
You have to show that there exists $\delta > 0$, such that $|x - x_0| < \delta \implies |f(x) - f(x_0)| < \epsilon$. 
We have that $B := B(f(x_0), \epsilon) \subset Y$ is open, so $f^{-1}(B)$ is open. Also, $x_0 \in f^{-1}(B)$, hence there is $\delta > 0$, such that $B(x_0, \delta) \subset f^{-1}(B)$. 
Now let $x \in X$ such that $|x - x_0| < \delta$. Then, $x \in B(x_0, \delta)= f^{-1}(B)$, so $f(x) \in B$, hence $|f(x) - f(x_0)| < \epsilon$. 
Conversely, suppose that $f$ is continuous and let $B \subset Y$ be open. We have to show that $f^{-1}(B)$ is open. Let $x_0 \in f^{-1}(B)$, then $f(x_0) \in B$, but $B$ is open, so $\exists$ $\epsilon > 0$, such that $B(f(x_0), \epsilon) \subset B$. By the continuity of $f$ at $x_0$, for our $\epsilon$ there exists $\delta > 0$, such that $|x - x_0| < \delta \implies |f(x) - f(x_0)| < \epsilon$. In other words, we have for all $x$, 
$$x \in B(x_0, \delta) \implies |x - x_0| < \delta \implies |f(x) - f(x_0)| < \epsilon \implies  f(x) \in B(f(x_0), \epsilon) \implies x \in f^{-1}(B(f(x_0, \epsilon))) \subset f^{-1}(B)$$
So, $B(x_0, \delta) \subset f^{-1}(B)$. Therefore $f^{-1}(B)$ is open.
