Many mathematicians consider the Mandelbrot set to be the most complicated and interesting set in all of mathematics. In contrast, the Cantor set is deceptively simple, but it has properties that are just as counter-intuitive and astonishing as some of the properties of the Mandelbrot set. Henry John Stephen Smith discovered the Cantor set in 1874, and Cantor introduced it to the world in 1883. As mentioned in a previous post, Cantor’s work helped lay the foundation upon which much of modern mathematical analysis rests. After studying some of Cantor’s mathematics in grad school, I gained a deeper understanding of fundamental concepts in calculus. When you think that you understand a concept fairly well and later learn that your understanding is a bit lacking, it can be humbling. If you have not read my first two Cantor posts, Infinity Does Not Necessarily Equal Infinity, and Why There Are Infinity Many Different Levels of Infinity, I strongly suggest that you read them before continuing. The concepts presented in this post heavily depend on an understanding of the concepts presented in those posts. As you continue to read this post, please slow down and read carefully. My intention is to be as clear and precise as possible with very limited use of the symbols of abstract mathematics. Cantor is very deep, and therefore this post will not be easy reading for many. Don’t get frustrated and give up if you don’t get it on the first or second read. If you are persistent, you will get it. You will find that the struggle was well worth your time and effort.

As I see it, part of the difficulty in understanding Cantor is that there is a vast difference between mathematical objects and physical objects. There is a theorem in mathematics that tells us that __no matter how close__ one real number is to another real number, say 10^{-100} apart, there are infinitely many rational numbers between them. Mathematicians elegantly describe this theorem as follows: The rational numbers are dense in the real numbers. This theorem is certainly not obvious to a normal person, and it seems to be counter-intuitive nonsense. We forget that mathematical points/numbers and curves have no thickness. The set of real numbers is far more complicated and mysterious than we realize. A pure mathematician can cut any interval on a real number line into infinitely many pieces without blinking an eye, but he or she can only cut a piece of lumber into a finite number of pieces. If two atoms are sufficiently close to each other, there is no room to fit another atom between them because atoms have a thickness property. As far as I know, no physical object contains infinitely many atoms. The speed of everything is finite. Pure mathematical knowledge is obtained through a mental activity of logical reasoning from a set of postulates or axioms. Knowledge in physics is obtained through a process of observation, inductive logic, deductive logic and experimentation with physical objects. To say that two real numbers are “just a little bit apart” is imprecise nonsense to a pure mathematician. For a pure mathematician, two reals are equal or they are not equal, but never just a little bit apart. A math professor once told me: “A woman is pregnant or she is not pregnant, but she is never just a little bit pregnant.” Cantor’s work reflects the mind of a pure mathematician who deals with mathematical objects that exist only in the mind of man and God. If God directly communicates math concepts to humans, as Cantor believed, God must be a jokester who is roaring with laughter as He watches us struggle to understand Cantor. If you understand and accept Cantor’s definition of equal cardinality of two sets, his counter-intuitive and absurd theorems are not so counter-intuitive and absurd after all. My three Cantor posts reflect my struggle to understand Cantor.

The purpose of this post is to give the reader a description of the Cantor set and some of its basic properties which seem counter-intuitive, preposterous, absurd, and astonishing. I will avoid the language of formal abstract mathematics as much as possible, and provide numerous explicit examples that illustrate the concepts presented. Keep in mind the following concepts, definitions, and facts as the construction of the Cantor set is explained.

- Open interval (p, q) equals all real numbers between p and q, but not including p or q.
- Closed interval [p, q] equals all real numbers between p and q, and including both p and q.
- Two sets are
__disjoint__if and only if the intersection of the sets equals the empty set. - Numbers expressed in binary or base 2 format have only the digits 0 or 1.
- Numbers expressed in ternary or base 3 format have only the digits 0, 1, or 2.
- Numbers expressed in decimal or base 10 format have only digits 0 through 9.
- The terms “all”, “each”, and “every” mean without exception.
- “If and only if ” means whenever the first statement is true, the second statement is true and vice versa.
- A real number is a
__Cantor number__if and only if it’s in the Cantor set.

To get started, let’s see how the Cantor ternary set is constructed. Like the Mandelbrot set, the Cantor ternary set is a fractal because it’s created by an infinite iterative procedure that determines what numbers are in the set. Numbers in the Mandelbrot set are complex numbers (a + bi) in a region of the complex coordinate plane. All Cantor numbers are real numbers contained in [0, 1]. Like the Mandelbrot set, construction of the Cantor set can only take place in the human intellect.

Construction of the Cantor set starts with the closed interval [0, 1] on the real number line with nothing removed. This interval is represented by the top solid bar in the graph below. At each step in the construction, the __open__ middle 1/3 of each closed interval is removed to produce a new set of closed intervals. The Cantor set equals the set of points/numbers __remaining__ in the closed interval [0, 1] after infinitely many iterations. The graph below depicts the closed intervals remaining after each of the first six iterations in the construction. __Every__ horizontal line of the graph depicts the union of a set of closed intervals, and this union of closed intervals contains __all__ of the Cantor numbers. It might appear that the Cantor set is empty, but you will later see that there are as many numbers in the Cantor set as there are real numbers in [0,1]. We end up with the same number of points we started with! In other words, the cardinal number of the Cantor set equals the cardinal number of the set of the real numbers in [0,1]. What remains in [0, 1] is fractal dust. So the Cantor set is nothing more than fractal dust that has the same cardinality as the set of reals in [0, 1]. (That is absurd! How can that be possible?)

The text box below lists the closed intervals remaining after __each__ of the first 5 iterations in the construction of the Cantor set. Note that the endpoints of the closed intervals are Cantor numbers, and the number of endpoints doubles on each iteration. After the 5^{th} iteration, we have found __at least__ 64 Cantor numbers. Later you will see that there are numbers between the endpoints of closed intervals that are also in the Cantor set. Furthermore, all Cantor numbers are contained somewhere inside the __union__ of the disjoint closed intervals at __every step__ in the construction. Example: 12/13 is contained in [8/9, 9/9], 12/13 is in the Cantor set, and 12/13 is not an endpoint of __any__ of the closed intervals. Later you will see why 12/13 is a Cantor number. As an exercise, you could explicitly list all 64 closed intervals remaining after the 6^{th} iteration. This may help you better understand how the Cantor set is constructed.

Before I go any further, I need to discuss a theorem that tells us how to calculate the value of an infinite geometric sum. In this post, the infinite geometric sum formula is used to calculate the value of a binary or ternary expansion of a number with infinitely many digits. Infinite geometric sums are calculated follows:

- Let a equal the value of first term of the sum.
- Let r equal the constant multiplier of the terms where |r| < 1.
- Sum = a + ar + ar
^{2}+ ar^{3}+ . . . = a(1/(1 – r))

The text box below shows how to apply the infinite geometric sum formula to calculate the binary or ternary expansion of a real number that has infinitely many digits.

We can now see why the sum of the lengths of all open intervals removed from the interval [0, 1] equals 1. This is astonishing and leads to counter-intuitive conclusions. The text box below lists all of the __disjoint open intervals removed__ from [0, 1] in the first 5 iterations. __None__ of these __open intervals__ contains a Cantor number. The sum of **all** removed open intervals = 1/3 + 2/9 + 4/27 + 8/81 + . . . = 1/3(1 / (1 – 2/3)) = 1. The length of the interval [0, 1] = 1, and the total of the lengths of **all** of the infinitely many open disjoint intervals removed equals 1. Therefore after infinity many iterations, the sum of the lengths of the closed disjoint intervals that contains the Cantor set must equal 0. All that remains is fractal dust. Mathematicians say that the Cantor set has Lebesgue measure zero. Later you will see that the cardinal number of [0, 1] equals the cardinal number of the Cantor set. (How is it possible that the cardinal number of fractal dust equals the cardinal number of all reals in [0, 1]? That is absurd!)

It turns out that we can easily determine whether or not a real number x is a Cantor number if we know the ternary expansion of x. An important theorem about Cantor numbers states that __every__ real number x in [0, 1] is a Cantor number if and only if there exists a ternary expansion of x that uses only digits 0 and 2. The proof of Cantor’s theorem hinges on this theorem. We will accept this theorem without a proof. The text box below shows the ternary expansion of various rational numbers in the Cantor set. Notice that some Cantor numbers like 1/27 and 1/3 have two equivalent ternary expansions. What’s important to understand is that the ternary expansion of **all** Cantor numbers, rational or irrational, can be __uniquely__ expressed using __only__ ternary digits 0 and 2. The ternary expansion of 1/2 = (0.111 . . .)_{3,} and 1/2 is not in the Cantor set. It’s not important to know how to convert an arbitrary number to ternary format. Note that the ternary expansion of 12/13 = (0.220220220 . . .)_{3}. If you are bored and want to add a little spice to your life, find the first 100 digits of the ternary expansion of 1/π or 1/e.

Before we can get to the proof of Cantor’s theorem, we need to understand one more important idea. Every real number, rational or irrational, in the closed interval [0, 1] can be expressed as a unique binary coded number of the form (0.b_{1}b_{2}b_{3} . . .)_{2} where each binary digit b_{i} equals 0 or 1. Some examples: 0 = (0.0)_{2}, 1 = 1/2 + 1/4 + 1/8 + 1/16 + . . . = (0.1111 . . . )_{2}, 2/3 = (0.10101010 . . . )_{2} and 0.875 = (0.111)_{2}. What’s important to understand is that there is a __unique__ binary expansion of the form just described for __every__ real number in [0, 1]. How to find the binary expansion of an arbitrary number is not important; we just need to know that it can be done.

Cantor’s theorem states that the cardinal number of the set Cantor numbers equals the cardinal number of the set reals in [0, 1]. In other words, the number of Cantor numbers equals the number of reals in [0, 1]. A proof of Cantor’s remarkable theorem can now be given and it goes something like this:

- Let
**C**equal the set of ternary expansions, using only the digits 0 and 2, of all reals in [0, 1]. Therefore C equals the set of Cantor numbers and C is a__proper__subset of the reals in [0, 1]. C is the fractal dust that is contained in the closed interval [0, 1]. - Let
**R**equal the set of all binary expansions of the reals in [0, 1]. Therefore R equals the set of__all__reals in [0,1]. __Construct__a one-to-one function f(x) with domain C and range R that matches all elements of**C**with all elements of**R**as follows: (This construction is so simple.) Let x equal any element of**C**. If the nth ternary digit of x = 0, then set the nth binary digit of f(x) = 0. If the nth ternary digit of x = 2, then set the nth binary digit of f(x) = 1.

Examples: f((0.20022202)_{3}) = (0.10011101)_{2} and f((0.020220222)_{3}) = (0.010110111)_{2}

- For
__every__element**y**in**R**, there is an element**x**in**C**such that**f(x**) =**y**.

Example: If **y** = (0.11000101)_{2}, then **x** = (0.22000202)_{3}.

- From the results discussed above and the definition function
**f**, Cantor’s theorem easily follows. Since the cardinal number of the reals in [0, 1] equals the cardinal number of the set of__all__real numbers, it follows that the cardinal number of the Cantor set equals the cardinal number of the set of all real numbers.

**A Couple of Comments:**

How to construct the inverse function of f(x) is obvious. I don’t know what the graph of f(x) looks like, and I really don’t care. It’s only important to know that f(x) is a one-to-one function that pair wise maps set **C** to set **R**. Perhaps it’s a bit too dramatic and somewhat misleading to say “The number of Cantor numbers equals the number of reals in [0, 1].” It’s probably better to just say “There is a one-to-one function that pair wise matches the set of Cantor numbers with the real numbers in [0, 1].” On the other hand, how else can we compare the number of elements in two sets? If you understand and accept Cantor’s definition of equal cardinality, Cantor’s work makes more sense. Note that the above proof did not use the technique of proof by contradiction.

There is also a diagonal proof of Cantor’s theorem which uses the technique of proof by contradiction. My post Infinity Does Not Necessarily Equal Infinity gives Cantor’s famous diagonal proof which states that the cardinality of the set of real numbers is __strictly greater__ than the cardinality of the set of counting numbers. The diagonal proof can be easily modified to show that the cardinality of the Cantor set is strictly greater than the cardinality of the set of counting numbers. This is easily accomplished by just replacing the strings of binary digits with strings of ternary digits consisting of 0 or 2 only. Therefore the cardinality of the Cantor set __and__ the cardinality of the set of real numbers is strictly greater than the cardinality of the set of counting numbers. The continuum hypothesis states that there is no cardinal number between the cardinal of the counting numbers and cardinal number of all real numbers. If we accept the continuum hypothesis, it follows that the cardinality of the Cantor set equals the cardinality of the set of __al__l real numbers; not just the reals in [0, 1].

I will close this post with a short discussion of the Cantor ternary function. **Warning!** This is **not** the function that was defined in the proof of Cantor’s theorem above. Basic properties of the ternary function and its graph are shown below. After a student studies the Cantor ternary function in a graduate level math course, he or she gains a deeper understanding of concepts learned in undergraduate level math courses. Functions are no longer just some formula like f(x) = 3x^{2} – 2x + 1 or g(x) = 3Cos(x) – 5. The first derivative of the ternary function can’t be found by applying the standard differentiation rules because there is no explicit formula for it. Wikipedia has an excellent article on the Cantor function.