# Prob. 17, Chap. 2 in Baby Rudin: The set of all numbers in $[0,1]$ with only $4$ and $7$ as decimal digits is countable, dense, compact, perfect?

Here is Prob. 17 in the Exercises after Chapter 2 in the book Principles of Mathematical Analysis by Walter Rudin, 3rd edition.

Let $E$ be the set of all $x \in [0,1]$ whose decimal expansion contains only the digits $4$ and $7$. Is $E$ countable? Is $E$ dense in $[0,1]$? Is $E$ compact? Is $E$ perfect?

My effort:

The set $E$ is not countable. The proof is essentially the same as that for showing that the set of all the binary sequences is uncountable. Am I right?

The set $E$ is not dense in $[0, 1]$. The smallest element in $E$ is $$x_\min \colon= \frac{4}{10} + \frac{4}{10^2} + \frac{4}{10^3} + \ldots = \frac{4}{9},$$ and the largest element in $E$ is $$x_\max \colon= \frac{7}{10} + \frac{7}{10^2} + \frac{7}{10^3} + \ldots = \frac{7}{9}.$$ Thus, the set $E$ is (strictly) contained in the closed interval $[\frac{4}{9}, \frac{7}{9}]$. So, the element $\frac{1}{5}$ of $[0,1]$, for example, does not lie in the closure of $E$. Am I right?

The set $E$ is clearly bounded. So, for compactness, it suffices to show that $E$ is closed. [It does not matter if $E$ is closed in $[0,1]$ or $\mathbb{R}$, as the former is a closed set in the latter.] So we show that the complement of $E$ in $[0,1]$ is open in $[0,1]$.

Let $x \colon= \sum_{n=1}^\infty \frac{d_n}{10^n}$ be an arbitrary element of $[0,1]-E$, where each $d_n \in \{ 0, 1, 2, \ldots, 9 \}$. Then there is a positive integer $n$ such that $d_n \not\in \{4, 7\}$. Let $N$ be the least such positive integer, and let $\delta$ be a real number such that $$0< \delta < \frac{\min\left( \vert d_N - 4 \vert, \vert d_N - 7 \vert \right)}{10^{N+2}}.$$ Let $y \colon= \sum_{n=1}^\infty \frac{e_n}{10^n}$ be an element of $E$, where each $e_n$ is either $4$ or $7$. Let's also assume that $e_n = d_n$ for all $n \in \{1, \ldots, N-1\}$. What next? How to show that $y$ fails to be within $\delta$ of $x$?

For showing that $E$ is perfect, we need to show that $E$ is closed and that each element of $E$ is a limit point of $E$.

Let $x \colon= \sum_{n=1}^\infty \frac{d_n}{10^n}$ be an arbitrary element of $E$, where each $d_n$ is either $4$ or $7$. Let $\delta > 0$. Then there exists a smallest positive integer $N$ such that $$\frac{3}{10^N} < \delta.$$

Let $y \colon= \sum_{n=1}^\infty \frac{d_n^\prime}{10^n}$, where each $d_n^\prime$ is either $4$ or $7$, be the element of $E$ such that $$d_n^\prime = \begin{cases} d_n \ \mbox{ if } \ n \in \mathbb{N} \ \mbox{ and } n \neq N; \\ 4 \ \mbox{ if } \ n = N \ \mbox{ and } d_N = 7; \\ 7 \ \mbox{ if } \ n = N \ \mbox{ and } d_N = 4. \end{cases}$$ Then $$0< \vert x -y \vert < \delta.$$ This shows that each element $x$ of $E$ is also a limit point of $E$. Am I right?

• Very nice work. +1. Only one thing: you define $\;N\;$ as "the least such positive integer". What if only there are zeros? – DonAntonio Mar 27 '16 at 8:17
• @Joanpemo I didn't get your comment. So can you please elaborate? – Saaqib Mahmood Apr 3 '16 at 7:01

Your arguments for uncountable and not dense look good to me. As far as showing $[0,1]-E$ is open, I think for simplicity since you know that $d_N\not\in\{4,7\}$, and we're dealing with integers, take $$\delta<\frac{1}{10^{N+2}}.$$ Then if $y$ is such that $|x-y|<\delta$ you know that $y$ has to agree with $x$ at $d_N$, and thus $y\not \in E$.

I believe that your argument for $E$ being perfect is correct as well :)

As you mentioned, for any number in [0,1] - E there is some decimal place which is not 4 or 7. The closest number in E would have a 4 or 7 in that place. Maybe this is not mathematical enough, but could I say that if the two numbers differ at decimal place N, and the next decimal place for one of the numbers is either 4 or 7, then the difference between the 2 numbers must be at least $2/10^{n+1}$? Therefore the set of numbers $\notin E$ is open.

• I can think of the following argument. Assume without loss of generality that $x > y$. Then $d_N \geq e_N$. So, $$\left\vert x - y \right\vert = x - y = \frac{ d_N - e_N}{10^N} + \sum_{n=N+1}^\infty \frac{d_n - e_n }{10^n}.$$ What next? – Saaqib Mahmood Apr 3 '16 at 7:15

Concerning the compact argument :

With $x := \sum \frac{d_{n}}{10^n}$, let's say that $d_{N} \notin \left\{4, 7\right\}$. Thus $x \in B(x, 10^{-N}) \subseteq \mathbb{R} - E$, where $B(x, r)$ define the open ball centered in $x$ of radius $r$.

Since $d_{N} \notin \left\{4, 7\right\}$, for all $$y = \sum_{n=1}^{n=N} \frac{d_{n}}{10^{n}} + \sum_{n>N} \frac{d'_{n}}{10^{n}} \ \ \ (*)$$ We have got : $$\left| x-y \right| \leqslant 10^{-N}$$

And (almost) reciprocaly, for all $y$ such that $\left| x-y \right| < 10^{-N}$, it can be written in the $(*)$ way. Then all such $y$ are in $E^{C}$ (since $d_{N} \notin \left\{4,7\right\}$).

Then, by the open ball characterization of open set in metric spaces, we can conclude.

It seems sufficient to show that $E^{C}$ is open in $\mathbb{R}$.

The rest of your solution looks good.

N.B :
- We may have had some problem for $x = 0 \in [0,1]$ and $x = 1 \in [0,1]$, so it's easier to take $x \in \mathbb{R}$ and thus to show that $\mathbb{R} - E$ is open.
- We have got $\left| x-y \right| \leqslant 10^{-N}$ and then $\left| x-y \right| < 10^{-N}$ because of $x$ and $y$ like $x=0,19999...$ and $y=0,10000...$

• can you please explain in a bit of detail how $B(x, 10^{-N} ) \subseteq [0,1]-E$? Suppose that $y = \sum_{n=1}^\infty \frac{e_n}{10^n}$ is in this ball. Then ...? – Saaqib Mahmood Apr 10 '16 at 12:57
• I added some precisions on the post. – Johan Apr 10 '16 at 18:16