A question on metric space defined on $\mathbb{Q}$. Consider $\mathbb{Q}$ be the set of all rational numbers. Defined $d(p,q)=|p-q|
$. Then which of the following statements are true?

$\{q \in \mathbb{Q} : 2&lt;q^2&lt;3\}$ is closed.

$\{q \in \mathbb{Q} : 2 \leq q^2 \leq 4\}$ is closed.

$\{q \in \mathbb{Q} : 2 \leq q^2 \leq 4\}$ is compact.

$\{q \in \mathbb{Q} : q^2 \geq 1\}$ is compact.


So I was thinking about it, where option 4. is not true because this is not bounded. So, not compact follows from the unboundedness. So If we can show that here the set in 4. And I think no 1. is closed, since it's complement is $\mathbb{Q}$ union some open set in $\mathbb{R}$.
For the other statement we may use the general criteria that &quot;A metric space is compact iff it is complete and totally bounded&quot;. But I need some help to do this.
We can write 1. as $\left((\sqrt{2}, \sqrt{3}) \cup (-\sqrt{3}, -\sqrt{2})\right) \cap \mathbb{Q}$ which is a real-open set (open intervals are open) intersected with $\Bbb Q$, so that set is open in $\Bbb Q$. It is also closed in $\Bbb Q$ because we can also write it as $\left([\sqrt{2}, \sqrt{3}] \cup [-\sqrt{3}, -\sqrt{2}]\right) \cap \mathbb{Q}$, which is closed for similar reasons.
2 is closed as we can write it as $\left([\sqrt{2}, 2] \cup [-2, -\sqrt{2}]\right) \cap \mathbb{Q}$ and as its element $2$ is not an interior point of it, it's not open.
The set under 3 is just the same as under 2 so is indeed closed, as we saw, so it could be compact, as it's also bounded. But in fact it is not, as we can pick any irrational $p$ &quot;within&quot; the set (say $\sqrt{3}$ will do) and find a sequence of rationals $q_n$ in the set that converges to $p$ in the reals (this can always be done). But then the sequence $(q_n)_n$ is Cauchy (it's convergent in the reals after all) but not convergent in $\Bbb Q$ (as the only point it could converge to doesn't lie in the set). So the set is not compact. A deeper reason why it is not compact( which you've probably not covered yet) is that a compact countable set in a metric space must have an isolated point, and this set has none. But the non-completeness (or the related fact that we have a sequence without a convergent subsequence) can be used to refute compactness at a more elementary level.
For 4, in all metric spaces we know that &quot;$A$ compact $\implies$ $A$ closed and bounded;  Heine-Borel is the inverse implication which holds in subsets of $\Bbb R^n$ in the Euclidean metric. The &quot;force&quot; of it is to quickly prove compactness. But the always valid implication can be used to easily refute compactness, and 4 is an example: not bounded so non-compact is a valid deduction in any metric space.
True. Split the set into $\\{q \in \mathbb{Q} : 2 &lt; q^2 &lt; 4$ and $q &lt; 0\\}$ and $\\{q \in \mathbb{Q} : 2 &lt; q^2 &lt; 4$ and $q &gt; 0 \\}$. I claim each of these is closed; thus, their union is closed. For $\\{q \in \mathbb{Q} : 2 &lt; q^2 &lt; 4$ and $q &gt; 0 \\}$ is the intersection of all sets of the form $\\{q \in \mathbb{Q} : a \leq q \leq b\\}$ where $a, b$ range over all rational values s.t. $a &lt; \sqrt{2}$ and $b &gt; \sqrt{3}$. The intersection of any family of closed sets is closed. And similarly with $\\{q \in \mathbb{Q} : 2 &lt; q^2 &lt; 4$ and $q &lt; 0\\}$.

True. It's the inverse image of the real interval $[2, 4]$ under the continuous map $q \mapsto q^2$; the inverse image of a closed set under a continuous map is closed.

Edit: misread this the first time. 3 is in fact false. For consider the collection of open sets of the form $\\{q \in \mathbb{Q} : q^2 &gt; a\\}$ where $a$ is some rational s.t. $a^2 &gt; 2$. This collection provides an open subcover of the set but clearly does not have a finite subcover.

False. A compact metric space is always bounded; this one is not bounded. That is, we may consider the open cover $\{(-a, a) : a \in \mathbb{Q}\}$; this does not have a finite subcover since if it did, the set $\{q \in \mathbb{Q} : q^2 \geq 1\}$ would be bounded.