# Show that $\mathbb{Q}$ is dense in the real numbers. (Using Supremum)

I am stuck on a homework the teacher gave us to hand in. It is stated as following:

The set of rational numbers $\mathbb{Q}$ given by all $q = \frac{m}{n}$ for some $m, n \in \mathbb{Z}$ with $n \neq 0$ is dense in the real numbers in the following sense: For each real $\epsilon > 0$ and $x \in \mathbb{R} \exists q_{\epsilon}: |x- q_{\epsilon}| < \epsilon$

With the problem, I am given a hint:

Prove the statement first for $x > 0$ Let $\mathbb{Q}_{x}$ be the set of rational numbers, such that $a \in \mathbb{Q}_{x} \Rightarrow a \leq x$. Why is $\mathbb{Q}_{x}$ nonempty? Apply the supremum property to $\mathbb{Q}_{x}$ and prove that the supremum of $\mathbb{Q}_{x}$ is $x$

Here my attempts: Suppose $x > 0$. Let $\mathbb{Q}_{x}$ the set of $q \in \mathbb{Q}$ s.th. $q \leq x$.

(i) Show that $\mathbb{Q}_{x}$ is nonempty:

$q \leq x \Rightarrow \frac{m}{n} \leq x \Rightarrow n \geq \frac{m}{x}$. Then by the Archimedian property and the fact that $\mathbb{N}$ is a subset of $\mathbb{Z}$ there exists an $n$ for which this is the case, thus $\mathbb{Q}_{x}$ is nonempty.

(ii) Supremum

By defintion, $\mathbb{Q}_{x}$ is a bounded set. Thus, by the supremum property, $\mathbb{Q}_{x}$ has a supremum.

(iii) Show that $x = sup(\mathbb{Q}_{x})$

(I am not too certain how to show this, but I think I will get it in time, however, hints are appreciated)

But from then on I am stuck. For any x > 0, I can show that there is a set of rational numbers for which x is the supremum. Thus, I can find a rational number arbitratly close to x, making $x-q < \epsilon$? And what about $x\neq0$? How does my result help me there?

Thanks for the time and advice!

First, thanks for your help. However, I am still in need of some more. I find myself unable to show that if $\mathbb{Q}_{x}$ is bounded by $x$, $x$ is indeed the supremum of that set. If I suppose that there is a $y < x$ and that that $y$ is an upper bound (in order to prove by contradiction), how can I find a $q \in \mathbb{Q}_{x}$ which is larger than $y$ without using that between any two real numbers, there lies a rational number, which is what I am supposed to show in the first place?

• +1 for formatting in LaTeX, for showing your work (and effort) and for clearly clarifying where you are stuck/confused... – Namaste Nov 1 '12 at 14:07

## 5 Answers

Another way to see that that $\mathbb Q$ is dense in $\mathbb R$ is by showing that $\frac{\left\lfloor{nx}\right\rfloor}{n}$ is a sequence of rational numbers that converges to $x$ for $n$ goes to infinity. If you want this sequence also helps you to show that $x$ is the supremum of $\mathbb Q_x$, because $\frac{\left\lfloor{nx}\right\rfloor}{n}$ converges to $x$ from below...

To be clear the floor function is defined as $\left\lfloor{y}\right\rfloor:= \max \{m\in \mathbb Z: m \leq y \}$.

• I was going to say that this is not clear because it's not obvious what f(x) = [floor(nx)]/n looks like, but for the purposes of the question it doesn't matter. Actually I like your answer. – Adam Rubinson Nov 1 '12 at 16:30

By definition of supremum, note that for any $\epsilon>0$ we have that $x-\epsilon$ is not an upper bound for $\Bbb Q_x$, meaning there is some $q_\epsilon\in\Bbb Q_x$ such that $x-\epsilon<q_\epsilon$, so $x-q_\epsilon<\epsilon$ as desired.

If you want to prove it for $x<0$, try applying a similar argument to $\Bbb Q_{-x}$. That should allow you to find a $q_\epsilon$ that is greater than $x$, and within $\epsilon$ of it.

You have $x>0$ and $\Bbb Q_x=\{q\in\Bbb Q:q\le x\}$. Your first step, proving that $\Bbb Q_x\ne\varnothing$, doesn’t quite work the way you’ve stated it, because you never specified what $m$ is. You can turn it into a legitimate proof by specifying $m=1$, for instance:

Since $x>0$, $\frac1x\in\Bbb R$, and by the Archimedean property there is an $n\in\Bbb Z^+$ such that $n\ge\frac1x$. But then $\frac1n\le x$, and $\frac1n\in\Bbb Q$, so $\frac1n\in\Bbb Q_x$, which is therefore not empty.

This is working way too hard, though: since $x>0$, $0\in\Bbb Q_x$, and therefore $\Bbb Q_x\ne\varnothing\,$! (However, the argument will be useful later, so it’s not really wasted effort after all.)

To show that $x=\sup\Bbb Q_x$, first note that $x$ is an upper bound for $\Bbb Q_x$ by the definition of $\Bbb Q_x$, so $\sup\Bbb Q_x\le x$ by the definition of supremum. Suppose that $\sup\Bbb Q_x<x$, and let $y=x-\sup\Bbb Q_x$; clearly $y>0$. Use the Archimedean property to say that there an $n\in\Bbb Z^+$ such that $\frac1n<y$, and let $A=\left\{\frac{m}n:m\in\Bbb Z^+\right\}$. The intuitive idea is that since the gap between $\sup\Bbb Q_x$ and $x$ is longer than $\frac1n$, and the elements of $A$ are spaced $\frac1n$ apart, at least one of them must fall in that gap. Suppose for a moment that we’ve managed to prove that $A\cap(\sup\Bbb Q_x,x)\ne\varnothing$; then there are positive integers $m$ and $n$ such that $\sup\Bbb Q_x<\frac{m}n<x$, which clearly contradicts the definition of $\Bbb Q_x$, showing that $\sup\Bbb Q_x=x$.

To prove that $A\cap(\sup\Bbb Q_x,x)\ne\varnothing$, suppose not. Let $L=\left\{m\in\Bbb Z^+:\frac{m}n\le\sup\Bbb Q_x\right\}$, and let $R=\left\{m\in\Bbb Z^+:\frac{m}n\ge x\right\}$. Here are some hints to get you through the rest.

1. Show that $L$ has a maximum element $\ell$.
2. Show that $R$ has a minimum element $r$.
3. Show that $\ell=r+1$.
4. Show that this is impossible

This might not help you to answer the question your teacher set you, but it is an easy way to see that $\mathbb{Q}$ is dense in $\mathbb{R}$. Consider $$X = \left\{ \frac{q}{2^n} : q \text{ and } n \text{ are integers} \right\}$$ which is a subset of $\mathbb{Q}$. Then every $x \in \mathbb{R}$ is the limit of a sequence of members of $X$ - which can be seen by subdividing intervals of width $2^{-n}$ for all $n$, and so $X$ is dense in $\mathbb{R}$. Since $X$ is a subset of $\mathbb{Q}$, $\mathbb{Q}$ must also be dense in $\mathbb{R}$.

Let $x \in \mathbb{R}$ and let x(n) be the partial decimal expansion of x to n digits. But for some (large) integer m, x(n) = $m/10^{n}$ so x(n) $\in \mathbb{Q}$. We have |x - x(n)| <= $10^{-n}$ for all $n$. Pick n s.t. $10^{-n}$ < $\epsilon$. As x(n) $\in \mathbb{Q}_{x}$ so $\mathbb{Q}_{x}$ is nonempty. And the limit of x(n) is x, so sup of $\mathbb{Q}_{x}$ is $x$

Thus the set of all partial decimal expansions is dense in $\mathbb{R}$. But this set is a subset of $\mathbb{Q}$, and so $\mathbb{Q}$ is dense in $\mathbb{R}$.