Let $S=\{(x,y)\in\mathbb{R}^2:|x|\leq1 , |y|\leq1\}$ Prove $S$ is a closed set. Let $S=\{(x,y)\in\mathbb{R}^2:|x|\leq1 , |y|\leq1\}$
Prove $S$ is a closed set.
We need prove $S^c$ is open.
Let $(x,y)\in S^c$ I need to prove $B((x,y),r)\subset S^c$
Let $r=\min\{-1-x,x-1,-1-y,y-1\}$ and Suppose $(a,b)\in B((x,y),r)$
Then, $d((a,b),(x,y))<r$
This implies $|a-x|<r$ and $|b-y|<r$
Then,  $-r+a<x<r+a$ this implies $a<x+r$ then $a<-1$
The other cases are similar.

Well, my doubt is, $r$ is always positive?

Because i think $r$ not necessarily positive.
For example for $x=1000$ and $y=1000$ that r can be negative.
 A: You're right to worry: If $(x,y)=(1000,1000)$ then $-1-x=-1001$ and so $r=-1001$.
There are plenty of ways to correct this. One method is to replace $r$ with $|r|$, as suggested in the comments.
Another approach is to argue that by symmetry, we can assume $0\leq x\leq y$ without loss of generality, and in fact $1<x\leq y$. Then just take $r=x-1$.
Finally, you can make life a lot easier if you express $S$ as an intersection of four closed half-planes. Each closed half-plane is... well, closed. You can prove that without resorting to cases. And a finite intersection of closed sets is closed.
A: We may first prove that if $U_1\subset\mathbb{R}^N$ and $U_2\subset \mathbb{R}^M$ are open sets, then $U_1\times U_2\subset \mathbb{R}^{N+M}$ is open.
Suppose $U_1\subset \mathbb{R}^N$ and $U_2\subset \mathbb{R}^M$ are open sets.
Then for $(x_0,y_0)\in U_1\times U_2$, $\exists \ \epsilon_1,\epsilon_2>0$, such that
$$B_{\epsilon_1}(x_0)\subset U_1 \ and \ B_{\epsilon_2}\subset U_2$$
Take $\epsilon=min\left\{\epsilon_1,\epsilon_2\right\}$, and $(x,y)\in B_{\epsilon}(x_0,y_0)$
Then $(x,y)\subset B_{\epsilon_1}(x_0)\times B_{\epsilon_2}(y_0)\subset U_1\times U_2\in \mathbb{R}^{N+M}$
It then follows that indeed $U_1\times U_2$ is open.
Notice for $S:=\left\{(x,y)\in \mathbb{R}^2:|x|\leq 1,|y| \leq 1\right\}$, then $S=[-1,1]\times[-1,1]\in \mathbb{R}^2$
Clearly $[-1,1]\subset\mathbb{R}$
So, $([-1,1]\times[-1,1])^C=(\mathbb{R}\times[-1,1]^C)\cup(\mathbb{R}\times[-1,1]^C)$ is open.
$\therefore [-1,1]\times[-1,1]$ is closed.
