$\{x\times (1/x)| 0The background is Munkres's topology says:
Every closed interval in $\mathbb{R}$ is compact.
and
A subspace A of $\mathbb{R}^n$ is compact if and only if it is closed and is bounded in the square (or Eucliean) metric.
followed by two counter examples which confuse me:
$$
A=\{x\times (1/x)\;| \;0<x\leq 1\}
$$
is closed in $\mathbb{R}^2$ (why?) and not bounded (easy to see).
$$
S=\{x\times \sin(1/x)\;| \;0<x\leq 1\}
$$
is NOT closed in $\mathbb{R}^2$ (why?) and bounded (easy to see).
 A: Well... let's check. Let $y=(y_1,y_2)\in \mathbb{R}^2\setminus A$.
If $y_1\not \in [0,1]$, then let $\varepsilon=\frac{\min\{|y_1|,|y_1-1|\}}{2}$. Then, $B(y,\varepsilon)\cap A=\emptyset$, since $B(y,\varepsilon)$ does not contain any element with first coordinate in $[0,1]$.
If $y_1\in (0,1]$, apply continuity of $x\mapsto 1/x$ to get some $\epsilon>0$ such that $|x-y_1|<\epsilon$ implies $|\frac{1}{x}-\frac{1}{y_1}|\leq \frac{|\frac{1}{y_1}-y_2|}{2}$. Again $B(y,\varepsilon)\cap A=\emptyset$.
If, finally, $y_1=0$, use that $\lim_{x\to 0^+}\frac{1}{x}=\infty$ to pick some $\varepsilon$ such that $x\in (0,\varepsilon)$ implies $\frac{1}{x}\geq 2|y_2|+10^4$. Again, $B(y,\varepsilon)\cap A=\emptyset$.
Since $y$ was arbitrary, we conclude that $\mathbb{R}^2\setminus A$ is open.
To see that $S$ is not closed, let $x_n=\frac{1}{2\pi n}$ and note that $(x_n,\sin(1/x_n))=(\frac{1}{2\pi n},0),$ which converges to $(0,0)\not \in S$. Hence, $S$ is not closed.
A: Let $(a,b) \in \mathbb{R}^2$ be in the closure of $A$. There exists a sequence $(x_n)$ of elements of $(0,1]$ such that
$$\lim_{n \rightarrow +\infty} \left( x_n, \frac{1}{x_n} \right) = (a,b)$$
Therefore,
$$\lim_{n \rightarrow +\infty} x_n = a, \quad \quad \text{ and } \lim_{n \rightarrow +\infty} \frac{1}{x_n}  =b$$
so $a \neq 0$ (otherwise $1/x_n$ would tend to $+\infty$), so $a \in (0, 1]$ and $b=1/a$. Therefore
$$(a,b)= \left( a, \frac{1}{a} \right) \in A$$
So every point of the closure of $A$ belongs to $A$, so $A$ is closed.
$S$ is not closed because
$$(0,1) = \lim_{n \rightarrow +\infty} \left( \frac{1}{\frac{\pi}{2}+2n\pi}, \sin \left(\frac{\pi}{2}+2n\pi\right)\right)$$
but $(0,1) \notin S$.
