# Density of rational and irrational numbers

Since $\mathbb{Q}$ is countable and $\mathbb{R} \backslash \mathbb {Q}$ is not, what does this tell us about the density of rational and irrational numbers along the real number line? Saying that there exists more irrational numbers than rational numbers seems rather vague becuase we're comparing infinites. How do we even define density here?

• There is a mathematical notion of dense, and the rationals and irrationals are each dense in the real numbers. However, it seems you are thinking of a different notion of denseness, perhaps more related to cardinality... – angryavian Nov 7 '16 at 0:31
• "what does this tell us about the density of rational and irrational numbers along the real number line?" Nothing: there are countable non-dense sets, countable dense sets, uncountable dense sets and uncountable non-dense sets. Countability and density are totally unrelated notions. – Crostul Nov 7 '16 at 0:50
• @Alephnull The Cantor set is such an example. – Crostul Nov 7 '16 at 8:09
• @Crostul But there are not co-countable nowhere dense sets (sets which are nowhere dense by have countable complement). So because $\mathbb{Q}$ is countable, we can at least conclude that $\mathbb{R}\setminus\mathbb{Q}$ is somewhere dense. – Reese Nov 7 '16 at 9:13
• @Alephnull It's pretty straightforward - a nowhere dense set by definition must exclude an entire interval. That interval cannot be countable. – Reese Nov 7 '16 at 11:03

One can have any combination of (countably infinite, uncountable) and (dense in the line, not dense in the line). (Unless, as was suggested in the comments, you have some notion of density other than the one defined by Captain Falcon.)

Countably infinite and dense in the reals: Rationals

Countably infinite and not dense in the reals: Integers

Uncountable and dense in the reals: Irrationals

Uncountable and not dense in the reals: Unit interval

• Ah ah, I appreciate the reference to Captain Falcon. However, "C." stands for "Cyril" ; Falcon being my name. :) – C. Falcon Nov 7 '16 at 0:58
• Another example, a bit worse, is the Cantor set. It is uncountable and not dense, in fact it equals its closure which has (Lebesgue) length zero. – Jeppe Stig Nielsen Nov 7 '16 at 10:11

A subset $A$ of $\mathbb{R}$ is said dense if and only if any elements of $\mathbb{R}$ is a limit of a sequence of elements of $A$.

Indeed, both $\mathbb{Q}$ and $\mathbb{R}\setminus\mathbb{Q}$ are dense in $\mathbb{R}$ in that sense.

As you pointed out, $\mathbb{Q}$ is countable, whereas $\mathbb{R}\setminus\mathbb{Q}$ is not, but the notion of density as nothing to do with countability.

Remark. To see that $\mathbb{Q}$ is dense in $\mathbb{R}$, let us pick $x\in\mathbb{R}$ and for all $n\in\mathbb{N}$ let us define: $$x_n:=\frac{\lfloor 10^nx\rfloor}{10^n}.$$ It is a sequence of $\mathbb{Q}$ which converges towards $x$ using squeeze theorem. For the density of $\mathbb{R}\setminus\mathbb{Q}$ consider: $$y_n:=x_n+\frac{\sqrt{2}}{n+1}.$$

• Nice answer, Captain! (salute) – Todd Wilcox Nov 7 '16 at 5:35

As clarified in other answers, cardinality by itself does not answer density questions.

Regarding the definition of density, there are two definitions. One is topological, saying that a set $A$ is dense if it intersects every non-empty open set. For the real line this is equivalent to saying that $A$ is dense (in the real line $\Bbb R$) if it intersects every open interval $(x,y)$ with $x<y$. In other words, for all choices of $x$ and $y$ with $x<y$ there is $a\in A$ with $x<a<y$. The latter condition usually is termed "order-dense" (in $\Bbb R$) and could be defined without reference to topology, for any linear order in place of $\Bbb R$. That is, $A$ is order-dense in a linear order $(L,<)$ is for all $x,y\in L$ with $x<y$ there is $a$ in $(x,y)$, that is, $x<a<y$ with $a\in A$. Finally a set $A$ is order-dense in itself if $A$ is order-dense in the linear order $(A,<)$. The set $\Bbb Q$ of all rational numbers is order-dense in the set $\Bbb R.$ The set $\Bbb Q$ is also order-dense in itself. The set $\Bbb Z$ of all integers is not order-dense in itself, and it is not order-dense in $\Bbb R$. The middle-third Cantor set $C$ is not order-dense in itself as it has "gaps", e.g. the interval $(\frac13,\frac23)$ contains no elements of $C$. (But, $C$ is (topologically) dense in itself, as it has no isolated points.) $C$ is no-where dense (in $\Bbb R$), meaning that the complement of its (topological) closure in $\Bbb R$ is (topologically) dense (and, as it happens, order-dense).

If $X$ is a topological space and $A$ is a subset then we say that $A$ is dense in $X$ provided that the closure of $A$ contains $X$. When $X=\Bbb R$ this means either of the following two conditions: (1) the set $A$ intersects every non-empty open interval, or (2) for every real number $x$ there is a sequence of points of $A$ converging to $x$. On the other hand, if $A=\Bbb Z$ then $A$ is dense in itself (topologically), but not order-dense in itself. Indeed, for every $m\in\Bbb Z$ the constant sequence $\langle m,m,...\rangle$ converges to $m$. On the other hand, the interval $(m,m+1)$ contains no integers.

In case you interpreted "dense" not in the topological definition, but as saying "many more irrationals than rationals", there's another field of math that provides an alternative way of seeing this.

In Measure Theory there's the concept of the measure of a set, which is an alternative characterization of its size. We want a way to define a function on sets, so let $X\subseteq 2^\mathbb{R}$ be a collection of sets (I have a specific one in mind here, namely the Lebesgue $\sigma$-algebra, but don't worry about that). Now, define the function: $$\mu:X\to\mathbb{R}_{\geq 0}\cup\lbrace\infty\rbrace$$ that must fulfill three axioms:

1. Non-negativity. For any subset $E\in X$, we have that $\mu(E)\geq 0$. Intuitively, things can't have negative size.

2. $\mu(\emptyset) = 0$. This should also seem intuitive, "the lack of a set" has no measure (there will be other sets with no measure though!).

3. Countable additivity on disjoint subsets. If $E_1,E_2$ are disjoint subsets of $\mathbb R$ (so $E_1\cap E_2 = \emptyset$), then: $$\mu(E_1\cup E_2) = \sum_{i = 1}^2 \mu(E_i)$$ This will actually be true for countably many disjoint subsets, so if $\lbrace E_i\rbrace$ are all pairwise disjoint, then: $$\mu(\cup_{i= 1}^\infty E_i)= \sum_{i = 1}^\infty \mu(E_i)$$ For finite sums, the intuition for this should be clear (think about each set as a circle, like how you make a Venn diagram. If there's no overlap between circles, the total "area" should be just all the individual areas added together).

Unfortunately, the above identity working for countable sums is less clearly true to our intuition. If we accept it though, we get some interesting results. The most applicable one to this is that we can calculate: $$\mu(\mathbb R\setminus\mathbb Q) = \infty,\quad\mu(\mathbb Q) = 0$$

So, in terms of measure theory, there are essentially no rational numbers, but infinitely many irrationals.