Let $S\subseteq\mathbb{R}^2$ be the set of points where $f$ is continuous - is $S$ open or closed? Is it empty? Define function $f : \mathbb{R^2}\rightarrow \mathbb{R}$ by
$$f(x, y) = \begin{cases}1,&\text{if }xy=0\\2,&\text{otherwise}\;.\end{cases}$$
If $$S = \{(x, y): f\text{ is continuous at the point }(x,y)  \}\;,$$
what can we say about $S$? Whether $S$ is open, closed, or empty set ? 
I tried by picking up some points of $\mathbb{R}$ to check its inverse images. I need proper proof. I appreciate any kind of help. And my sincere thanks to you.
 A: It is clear that $f(x,y)=1$ for the $x$ and $y$ axes (i.e. $x=0$ or $y=0$). For every point $(x,y) \in f^{-1}(2)$, i.e. all the points that are not on the axes, $f$ is continuous as a constant function. So $f^{-1}(2) \subset S$. However, $f$ is not continuous on the axes (edit: there is no open ball $B$ in $\mathbb{R}^2$ such that $B \subset f^{-1}(2)$) , and since they are closed subsets of $\mathbb{R}^2$ their complement is open. One can see directly that $S= f^{-1}(2)$ is an open subset, since every point $(a,b)$ (with $a,b \ne 0$) has an open ball with radius $r = \min(a/2,b/2)$ which is fully contained in $S$.
I used the standard topology on $\mathbb{R}^2$ and $\mathbb{R}$ and the definition of continuity using real limits ($ \lim_{ (x,y) \to (a,b)}f(x,y) = f(a,b)$).
A: Let 
$$\begin{align*}
Q_1&=\{(x,y)\in\mathbb{R}^2\mid x>0, y>0\}\\
Q_2&=\{(x,y)\in\mathbb{R}^2\mid x<0, y>0\}\\
Q_3&=\{(x,y)\in\mathbb{R}^2\mid x<0, y<0\}\\
Q_4&=\{(x,y)\in\mathbb{R}^2\mid x>0, y<0\}
\end{align*}$$
be the four open quadrants in the plane, and let 
$$\begin{align*}
A_x&=\{(x,y)\in\mathbb{R}^2\mid y=0\}\\
A_y&=\{(x,y)\in\mathbb{R}^2\mid x=0\}
\end{align*}$$
be the $x$- and $y$-axes, respectively. Then $f(x,y)=2$ if and only if 
$$(x,y)\in Q_1\cup Q_2\cup Q_3\cup Q_4$$
and $f(x,y)=1$ if and only if 
$$(x,y)\in A_x\cup A_y.$$
To provide a picture, $f(x,y)=2$ in the blue region, and $f(x,y)=1$ in the red region:
$\hskip1.6in$
By definition, the function $f$ is continuous at $(a,b)\in\mathbb{R}^2$ if and only if, for any open set $V\subseteq\mathbb{R}$ containing $f(a,b)$, there is an open set $U\subseteq\mathbb{R}^2$ containing $(x,y)$ such that $f(U)\subseteq V$. 
Suppose $f(a,b)=1$. The set $V=(\frac{1}{2},\frac{3}{2})$ is an open subset of $\mathbb{R}$ containing $1$. Because $f$ only takes the values $1$ and $2$, the only way to have $f(x,y)\in V$ is to have $f(x,y)=1$. Thus, the only way to have $f(U)\subseteq V$ is if $f(x,y)=1$ for every $(x,y)\in U$, or in other words, $U\subseteq A_x\cup A_y$. Are there any non-empty subsets $U\subseteq A_x\cup A_y$ that are open as subsets of $\mathbb{R}^2$? What does that tell you about whether it's possible for $f$ to be continuous at any point in $A_x\cup A_y$ (the red region)?
Now do the same analysis but for when $f(a,b)=2$. You could let $V=(\frac{3}{2},\frac{5}{2})$, for example.
