# Is the Cantor set a subset of rational numbers, and is it countable or uncountable?

In Chapter 2 of Rudin's Priniciples of Mathematical Analysis, Rudin takes the Cantor set as an example of a perfect set in $\mathbb{R}^1$ which contains no segment. Here's the construction of the Cantor set and the proof:

2.44 The Cantor set The set which we are now going to construct shows that there exist perfect sets in $\mathbb{R}^1$ which contain no segment.

Let $E_0$ be the interval $[0, 1]$. Remove the segment $(\frac13,\frac23)$, and let $E_1$ be the union of the intervals $$[0,\frac13], [\frac23,1].$$ Remove the middle thirds of these intervals, and let $E_2$ be the union of the intervals $$[0,\frac19], [\frac29,\frac39], [\frac69,\frac79],[\frac89,1]$$ Continuing in this way, we obtain a sequence of compact sets $E_n$, such that
(a) $E_1\supset E_2 \supset E_3 \dots$;
(b) $E_n$ is the union of $2^n$ intervals, each of length $3^{-n}$.

The set $$P=\bigcap_{n=1}^\infty E_n$$ is called the Cantor set. $P$ is clearly compact, and Theorem 2.36 shows that $P$ is not empty.

No segment of the form $$\left(\frac{3k+1}{3^m},\frac{3k+2}{3^m}\right)\tag{24},$$ where $k$ and $m$ are positive integers, has a point in common with $P$. Since every segment $(\alpha,\beta)$ contains a segment of the form (24), if $$3^{-m}<\frac{\beta-\alpha}6,$$ $P$ contains no segment.

To show that $P$ is perfect, it is enough to show that $P$ contains no isolated point. Let $x \in P$, and let $S$ be any segment containing $x$. Let $I_n$ be that interval of $E_n$ which contains $x$. Choose $n$ large enough, so that $I_n\subset S$. Let $x_n$ be an endpoint of $I_n$, such that $x_n\ne x$.

It follows from the construction of $P$ that $x_n\in P$. Hence $x$ is a limit point of $P$, and $P$ is perfect.

One of the most interesting properties of the Cantor set is that it provides us with an example of an uncountable set of measure zero (the concept of measure will be discussed in Chap. 11).

I can follow the proof with some effort, but in the end of this section Rudin claims that the Cantor set is an example of an uncountable set of measure zero. How can the Cantor set be uncountable? Corollary of Theorem 2.13 shows the set of all rational numbers is countable. Theorem 2.8 shows that every infinite subset of a countable set is countable. The elements in the Cantor set are the end points of all the intervals in $E_n$, it follows from the construction of the Cantor set that these end points are all rational numbers. Hence $P$ is a subset of the rational numbers and countable. Is there anything wrong with my reasoning here?

• "The elements in the Cantor set are the end points of all the intervals in $E_n$." This is false. For example, $\frac{1}{4}$ is an element of the Cantor set, but it is not an endpoint of any of the intervals in $E_n$ for any $n$. Oct 21, 2013 at 2:20
• @MichaelAlbanese: Nice comment :) see my answer... haha Oct 21, 2013 at 2:20
• IMHO, that part of Rudin's book is not very clear. It is too concise and suffers greatly from the lack of pictures. You might want to have a look somewhere else. Oct 21, 2013 at 2:30

"The elements in the Cantor set are the end points of all the intervals in $E_n$..." This is your mistake. This isn't true. In fact, written in ternary expansion, the elements of the Cantor set are precisely those elements in $[0,1]$ with a ternary expansion consisting of $0$'s and $2$'s (where we note $0.01=0.00\bar{2}\in\mathcal{C}$, but $0.0101\notin\mathcal{C}$, for example). Using this fact, it isn't hard to show that $\frac{1}{4}\in\mathcal{C}$ but $1/4$ is not an endpoint of any interval.

• As ternary expansion is not unique, you should say that the elements of the Cantor set are precisely those with a ternary expansion using only $0$'s and $2$'s. Oct 21, 2013 at 2:48
• I've been struggling with $\frac14 \in P$. I'm looking for some articles on ternary expansion and the Cantor set. Thank you for the info. I'll just accept your answer just now. Oct 21, 2013 at 3:16
• @MichaelAlbanese: I've updated my answer to include your statement. Thank you for helping me be more precise. Oct 21, 2013 at 12:23

All of the endpoints are indeed in the Cantor set.

But because any intersection of closed sets is again closed, this means that the Cantor set is closed as well -- in fact, it is the closure of the set of all points.

In particular, this means that the limit of any sequence of endpoints, if it exists, must also be in the Cantor set. In fact, it turns out that every point of the Cantor set is of this form.

To see that $1/4$ must be in the cantor set, observe it is the limit of the sequence $s_n$ defined by

$$s_n = \sum_{i=1}^n \frac{2}{9^i}$$

If you draw the picture of the first few $E_i$, you'll see that $1/4$ is alternately in the left and right thirds of its interval, so it never gets removed.

To see that this continues forever, note this picture is self-similar: the location of $1/4$ in the interval $[2/9, 1/3]$ is proportionally in the same place as it is in $[0,1]$.

Elements of the Cantor set are all endpoints of intervals used in the construction. Note that all points in $[0,1]$ the ternary expansion of which has only $0$ and $2$ (that is, all numbers of the form $\sum_{n=1}^\infty a_n3^{-n}$ where $a_n\in \{0,2\}$ for all $n$) lie in the Cantor set.

If $P$ is a complete metric space with no isolated points, then it cannot be countable. If $U_n=P\setminus\{x_n\}$, where $(x_n:n\in \mathbb{N})$ is some enumeration of $P$, then the Baire Category theorem will tell us that $\cap U_n$ is dense. But if $(x_n:n\in \mathbb{N})=P$, this intersection is empty, a contradiction.

• As it is pointed out in my answer and the comment by Michael Albanese, your first sentence is incorrect. All of the endpoints are elements of the Cantor set, but not every element of the Cantor set is an endpoint. Oct 21, 2013 at 2:29
• Yes, my first sentence was stated backward. But I think what I meant is fairly clear from the rest of my answer, yes?
– user95250
Apr 6, 2019 at 2:58

You can see that $P=\cap_{n\geq 0}f^{-n}([0,1/3]\cup [2/3,1])$, where $f(x)=3x$ if $x\in [0,1/3]$ and $f(x)=-3(x-1)$ se $x\in [2/3]$. It follows from this that P is homeomorphic to $\Sigma=\{0,1\}^{\mathbb{N}}$ endowed with metric $d(\alpha, \beta)=2^{-N(\alpha, \beta)}$, where $N(\alpha, \beta)=\min\{i; \alpha_i\neq \beta_i\}$. In particular, P is uncountable.