Real Analysis – Prove Closure of R Minus Q is R

metric-spacesreal-analysis

I am taking a metric spaces class, and I am struggling to show how to prove that the closure of $\mathbb{R}\setminus\mathbb{Q}$ is $\mathbb{R}$. Taking this question's answer as a reference, I have done the following:

My Attempt

We want to show that for every real number $r$ and $\epsilon\gt 0$, there exist an at least one $q$ in $\mathbb{R}\setminus\mathbb{Q}$ such that $|r-q| \lt \epsilon$ which will mean that complement of closure of $\mathbb{R}\setminus\mathbb{Q}$ is empty in $\mathbb{R}$, therefore closure of $\mathbb{R}\setminus\mathbb{Q}$ must equal to $\mathbb{R}$.

Let $r$ be a real number. Then, there exist at least one $q$ such that $|r-q| \lt \epsilon$ holds. I am not sure if I can choose $q$ such as:

Write $r$
in decimal expansion, and let $q$
be the rational that has the same decimal expansion as $r$
up to the $n$th digit after the decimal point, and terminates there.

Since we are in $\mathbb{R}\setminus\mathbb{Q}$ and we cannot choose $q$ to be a rational that has the same decimal, since rational are excluded, and I am not sure if we can choose a real and non-rational number that holds to be true.

I would appreciate any help!

Best Answer

Let $r\in\mathbb{R}$. For any $\varepsilon>0$, there exists $N\in\mathbb{N}$ by the Archimedean property, such that $2<\varepsilon N<\varepsilon 10^N$. Define

$$q:=10^{-N}\lfloor 10^{N}r\rfloor+\Big(\pi-10^{-N}\lfloor 10^{N}\pi\rfloor\Big),$$

such that $$|r-q|=|10^{-N}\underbrace{(10^Nr -\lfloor 10^Nr\rfloor)}_{\in[-1,1]}-10^{-N}\underbrace{(10^N\pi-\lfloor 10^N\pi\rfloor)}_{\in[-1,1]}|\le2\cdot10^{-N}<\varepsilon.$$

Note: Suppose $q\in\mathbb{Q}$, then $\pi = q-10^{-N}\lfloor 10^{N}r\rfloor+ 10^{-N}\lfloor 10^{N}\pi\rfloor\in\mathbb{Q}$, which is contradictory, i.e. $q\in\mathbb{R}\backslash\mathbb{Q}$.

(Following the idea of CyclotomicField)