Provide an example of a non-empty subset $X \subseteq \mathbb{Q}$ that is both open and closed, and justify your example.
This is a question from a practice set I have. The first and foremost thing I would check is the empty set $\emptyset$ and the rationals $\mathbb{Q}$. But $X$ needs to be non-empty and $\mathbb{Q}$ is neither open nor closed. I then considered a slightly less trivial example: $(2, 3) \cup (4, 5)$ with the metric $d(a, b) = |a - b|$ (I think, $(2, 3)$ and $(4, 5)$ are both open and closed but I am not sure how to justify it).
Any assistance in finding and/or justifying such a set is much appreciated.
In every topological space $X$ the empty set $\emptyset$ and the whole $X$ are always clopen sets, i.e. sets that are simultaneously open and closed. Since your question asks about a non-empty example, we can use $\mathbb{Q}$. A more interesting clopen subset of $\mathbb{Q}$ (with the usual topology) is $(-\pi, \pi)$. It is immediate that the interval is open. It is also closed, because its complement $(-\infty, -\pi) \cup (\pi, +\infty)$ is open.