Why $\mathbb{Q}$ and $\mathbb{Z}$ are zero-dimensional spaces

general-topology

why $\mathbb{Q}$ and $\mathbb{Z}$ are zero-dimensional spaces ?

My attempt : Definition of zero-dimensional spaces:

A topological space $(X, \tau)$ is said to be zero-dimensional if there is a basis for the topology consisting of clopen sets

we know that in discrete space all basis for the topology consisting of clopen sets.so here i can said that obviously $\mathbb{Z}$ will be zero-dimensional spaces since $\mathbb{Z}$ induce discrete topology

But im confused about $\mathbb{Q}$ because it is neither closed nor open

Best Answer

The set $\mathcal{B}=\{(a,b)\mid a, b \in \Bbb P\}$ forms a base for the usual topology on $\Bbb R$ (where $\Bbb P = \Bbb R \setminus \Bbb Q$ is the set of irrationals).

For each $(a,b) \in \mathcal{B}$ it’s clear that $(a,b) \cap \Bbb Q = [a,b]\cap \Bbb Q$ and so the set $\{B \cap \Bbb Q\mid B \in \mathcal{B}\}$ is a base for the subspace topology of $\Bbb Q$ that consists of closed-and-open (clopen) sets.