Consider $\Bbb Q$, the set of rational numbers, with the metric $d(p,q) = |p-q|$. Then which of the following are true? This question is posted many times on this site. But I couldn't understand it from there.
Consider $\Bbb Q$, the set of rational numbers, with the metric $d(p,q) = |p-q|$. Then which of the following are true?

*

*$\{q \in \Bbb Q : 2<q^2<3\}$ is closed.


*$\{q \in \Bbb Q : 2\leq q^2\leq4\}$ is compact.
My Attempt:
We know a sequence of rational numbers $x_n = 1, x_{n+1} =\frac{2}{x_n} + \frac {1}{x_n}$. Let $lim_{n \to \infty}x_n = x$ So $x = \frac{x}{2} + \frac{1}{x} \implies \frac{x}{2} = \frac{1}{x} \implies x^2 =2 \implies x = \sqrt2 \notin \Bbb Q$. So $\Bbb Q$ is not closed.
Also $\{q \in \Bbb Q : 2<q^2<3\} = [\sqrt2,\sqrt3] \cap \Bbb Q$
Here $[\sqrt2,\sqrt3]$ is closed but $\Bbb Q$ is not closed. We know that intersection of two closed set is closed. But here this result is not applicable.
 A: You are trying to find out if the set is closed in $\mathbb R$. In $\mathbb Q$ the set is closed. [If $2 <q_n^{3}<3$ and $(q_n)$ converges to a rational number $q$ then $2 <q^{2}<3$. Also, the intersection of any closed set in $\mathbb R$ with $\mathbb Q$ is a close set in $\mathbb Q$]. Your sequence converging to $\sqrt 2$ shows that it is not compact (since there is a sequence with no convergent subsequence).
A: Here is a some additional info. We consider the metric space $\left(\mathbb{Q},d\right)$ with $d=d(x,y)=|x-y|$. The metric $d$ induces a topology $\mathcal{O}_d$ with a basis consisting of all open intervals $(p,q)\cap \mathbb{Q}$ with rational endpoints $p,q$.
In the following we do not consider $\mathcal{O}_d$ as induced topology from the topological space $\mathbb{R}$ but rather as topological space in its own right.
(1) Is $\{q\in\mathbb{Q}:2<q^2<3\}$ closed?
We recall the set
\begin{align*}
\color{blue}{A=\{q\in\mathbb{Q}:2<q^2<3\}=\left(\left(-\sqrt{3},-\sqrt{2}\right)\cup\left(\sqrt{2},\sqrt{3}\right)\right)\cap\mathbb{Q}}\tag{1}
\end{align*}
is closed, if and only if the set $\mathbb{Q}\setminus A$ is open.
The set $\mathbb{Q}\setminus{A}$ is given as:
\begin{align*}
\color{blue}{\mathbb{Q}\setminus A=\left(\left(-\infty,-\sqrt{3}\right)
\cup\left(-\sqrt{2},\sqrt{2}\right)\cup\left(\sqrt{2},\infty\right)\right)\cap\mathbb{Q}}\tag{2}
\end{align*}
Note we are free to use open or closed parentheses around the irrational numbers $\pm\sqrt{2},\pm\sqrt{3}$ in (2) since these numbers are not elements of the topological space $\left(\mathbb{Q},\mathcal{O}_d\right)$ and they are excluded by intersection with $\mathbb{Q}$.

We show that $\mathbb{Q}\setminus A$ is open by taking any point $q$ from this set and deriving an open set containing this point and which is contained in $\mathbb{Q}\setminus A$.
We start with the left-most interval in (2). Let $q$ be a rational point in $\left(-\infty, -\sqrt{3}\right)$. Let $q_1=q-1$. Since $\mathbb{Q}$ is dense in $\mathbb{R}$ we know that between any two real numbers $a< b$ there is a rational number $r$ with $a<r<b$. So let $q_2$ be a rational number with $q<q_2<-\sqrt{3}$ and we conclude the open set $\left(q_1,q_2\right)\cap \mathbb{Q}$ fulfils
\begin{align*}
q\in\left(q_1,q_2\right)\cap\mathbb{Q}\subset \left(-\infty,-\sqrt{3}\right)\subset \mathbb{Q}\setminus A
\end{align*}
In the same way we can show that $\left(-\sqrt{2},\sqrt{2}\right)\cap\mathbb{Q}$ and $\left(\sqrt{2},\infty\right)\cap\mathbb{Q}$ are open sets. It follows that $\mathbb{Q}\setminus A$ is a union of open sets and therefore open.
We conclude the set $A=\{q\in\mathbb{Q}:2<q^2<3\}$ is closed.

Note: A shorter way to see that $A$ is closed: We inspect the right-hand side of (1) and observe the boundary $\partial A=\overline{A}\setminus A^{\circ}=\emptyset$. Then we recall a set $A$ is open and closed if and only if $\partial A=\emptyset$. We can in the same way show that $A$ is open as we did it for $\mathbb{Q}\setminus A$.
(2) Is $\{q\in\mathbb{Q}:2\leq q^2\leq 4\}$ compact?
Here we only note that a metric space is compact if and only if it is sequentially compact. A sequence which has not a converging subsequence has already been shown by the OP and by @KaviRamaMurthy .
