Proving a function is continous only if a set is open Prove that a function from $\mathbb{R}$ to $\mathbb{R}$ is continuous if and only if the inverse image every open set is open.
Definition: A set is open if it contains all its interior points.
Proof: Let $f$ be continuous, then $\forall a,\forall \epsilon > 0$, there exists a $\delta > 0$ such that $$|x - a| < \delta \Rightarrow |f(x) - f(a)| < \epsilon$$ Let $O$ be open to show $f^{-1}(O) = \{ x:f(x)\in O \}$ is open. Let $a\in f^{-1}(O) \Rightarrow f(a)\in O$. Since $O$ is open, there exists $\epsilon > 0$ such that $N(f(a),\epsilon)\subset O$. But, $f$ is continuous at $a$, so given this $\epsilon$,there exists a $\delta > 0$ such that $$|x - a| < \delta \Rightarrow |f(x) - f(a)| < \epsilon$$ Moreover, $x\in N(a,\epsilon) \Rightarrow f(x)\in N(f(a),\epsilon)$. This last is contained in $O$, so  $N(a,\epsilon)\subset f^{-1}(O)$. Hence, $a$ is an interior point of $f^{-1}(O)$. This is true for all $a$, so $f^{-1}(O)$ is open.
I am not sure if this is right any suggestions would be greatly appreciated. 

Your definition of an open set is stated wrong; it is not possible for a set $O$ to have an interior point outside of $O$, so it doesn't make sense to define an open set as one that contains all its interior points. A closed set also contains all its interior points. Instead you want to say 

A set $O$ is open if every point of $O$ is an interior point. 

Or equivalently, 

A set $O$ is open if for every $x \in O$ there exists an open set $V$ containing $x$ such that $V \subset O$. 

Your proof looks on track until you say  "Moreover, $x\in N(a,\epsilon) \Rightarrow f(x)\in N(f(a),\epsilon)$. This last is contained in $O$, so  $N(a,\epsilon)\subset f^{-1}(O)$" because $x$ is in a $\delta$-ball, not an $\varepsilon$-ball. If you fix this to state that any point $a \in f^{-1}(O)$ can be contained in a $\delta$-ball that lies within $f^{-1}(O)$ then you are done.
