Function $f$ is continuous iff partitions of $\mathbb{R}^2$ as defined are open Assume $g: \mathbb{R} \rightarrow \mathbb{R}$ and define $$G_{+} := \{(a,b) \in \mathbb{R}^2 \ \ | \ b>g(a) \}$$ $$G_{-} := \{(a,b) \in \mathbb{R}^2 \ \ | \ b<g(a) \}$$
then $g$ is continuous everywhere on $\mathbb{R} \iff G_{+}, G_{-}$ are open.
So $G_{+}, G_{-}$ are basically partition of $\mathbb{R}^2$, and I can see how $g$ disconnects $\mathbb{R}^2$ if it is continuous everywhere, but how can I use this, with the fact that $g$ is continuous and any pre-image of an open set in $\mathbb{R}$ is open.
 A: $\Rightarrow$
Let's assume $g$ is continous and we will show that $G_{+}$ is open.
Let $(a,b) \in G_{+}$ thus $b>g(a)$. Choose $\epsilon = \frac{b-g(a)}{2}$ and define $ V = (g(a)-\epsilon,g(a)+\epsilon).$ This is an open neighborhood of $g(a)$ and thus because $g$ is continuous, we get that $g^{-1}(V)$ is an open neighberhood of $a$. Now we define $W = g^{-1}(V) \times (b-\epsilon,b+\epsilon).$ This is an open neighberhood of $(a,b)$; now we will prove that $W \subseteq G_{+}$.
Let $(x,y) \in W$; thus $x \in g^{-1}(V)$, and so we get $g(x) \in V = (g(a)-\epsilon,g(a)+\epsilon)$. In addition $y \in (b-\epsilon,b+\epsilon),$ and thus from our definition of $\epsilon$ we get $y>g(x)$, and thus $(x,y) \in G_{+}$. So we got that $W \subseteq G_{+}$ and thus $G_{+}$ is open.
$\Leftarrow$
Let's assume $G_{+} , G_{-}$ are open and prove g is continous.
let $x \in \mathbb{R}$ and let $\epsilon>0$ thus $(x,g(x) + \epsilon) \in G_{+}$, because $G_{+}$ is open we get that there exist $W_1,V_1$ neighberhoods of $x,g(x)+\epsilon$ such that $(x,g(x) + \epsilon) \in W_1\times V_1 \subseteq G_{+}$.
in the same way we can find $W_2,V_2$ neighberhoods of $x,g(x)-\epsilon$ such that $(x,g(x) - \epsilon) \in W_2\times V_2 \subseteq G_{-}$. define $W = W_1\cap W_2$ this is a neighberhood of $x$ we will show that for every $y\in W$ - $|g(y)-g(x)|<\epsilon$. indeed let $y \in W$ thus $y \in W_1$ and thus $(y,g(x)+\epsilon) \in W_1\times V_1 \subseteq G_{+}$ and thus $(y,g(x)+\epsilon) \in G_{+}$ and from the definition of $G_{+}$ we get $y<g(x)+\epsilon$. in the same way we can get that $y>g(x)-\epsilon$ and thus we proved that for every $y\in W$ - $|g(y)-g(x)|<\epsilon$. thus $g$ is continous.
