Show that $(X\times Y)\setminus (A\times B)$ is connected 
Problem.
Let $\emptyset \subset A\subset X$ and $\emptyset \subset B\subset Y$. If $X$ and $Y$ are connected, show that $(X\times Y)\setminus (A\times B)$ is also connected by using the criteria of connectedness that if for any continuous function $f$ such that $f:X\to \{\pm1\}$, $f$ is constant then $X$ is connected.

I began by assuming that there exists a function $f:(X\times Y)\setminus (A\times B)\to\{\pm1\}$ which is continuous but not constant but couldn't proceed any further beyond that.

The proof is essentially the same as the one linked to. Suppose we have a function $f:(X\times Y)\setminus(A\times B)\to\{\pm1\}$. Begin by choosing $a\in X\setminus A$ and $b\in Y\setminus B$ (which is possible because both are proper subsets). Now, let $(x,y)\in(X\times Y)\setminus(A\times B)$ be arbitrary. We will show that $f(x,y)=f(a,b)$. 
Because $(x,y)\notin A\times B$, either $x\notin A$ or $y\notin B$. Without loss of generality, suppose $x\notin A$. Then $\{x\}\times Y$ is homeomorphic to $Y$ and contained in $(X\times Y)\setminus(A\times B)$, so the restriction $f|_{\{x\}\times Y}$ is constant. Similarly, $X\times\{b\}$ is homeomorphic to $X$ and contained in $(X\times Y)\setminus(A\times B)$, so $f|_{X\times\{b\}}$ is constant. Hence
$$f(x,y)=f(x,b)=f(a,b)$$
and we are done.
