Density of rational and irrational numbers

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


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}.$$


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.