Here's the theorem that I have to prove:

A set $\displaystyle U \subset R$ is called an open set if $\displaystyle \forall x \in U \ \exists \epsilon >0$ such that $\displaystyle (x-\epsilon, x+\epsilon) \subset U$. Prove that the following two statements are equivalent:

(a) $\displaystyle f

\rightarrow R$ is continuous

(b) For any open set $\displaystyle U \subset R$, there exists an open set $\displaystyle W \subset R$ such that $\displaystyle f^{-1}(U)=D \cap W$. Here, $\displaystyle f^{-1}(U)=\{x \in D|f(x) \in U\}$ denotes the preimage of U under f.

Can anyone help me with this? I don't even understand the "idea" of it, much less how to prove it.