Cantor set

The standard Cantor set, introduced by German mathematician Georg Cantor in 1883, is obtained by starting with a line segment and recursively deleting the middle third ad infinitum. The first seven levels of this process are illustrated below.1

When we magnify by a factor of 3, the size doubles since a third of the line segment is deleted. This yields a fractal dimension of d = \log_3 2\approx 0.63. Although the first figure is a line segment of dimension one, the fractal dimension of the resulting Cantor set is less than one since it is produced by recursive deletion. In contrast, the Koch snowflake, which also starts with a one-dimensional figure (the outline of a triangle), has fractal dimension greater than one since it is produced by recursive insertion.

Let’s look at a higher-dimensional analogue of the Cantor set. Start with a filled square (level 0). To obtain the set at level 1, partition the square per tic-tac-toe into nine subsquares, then retain only the four corner subsquares (i.e., delete the remaining five subsquares). To obtain the set at level 2, apply the same process to each of these four corner squares. In general, to construct the Cantor set at level n+1, apply this process to each of the squares that comprise the set at level n.

You can use the following program to picture the process. When the program loads, it shows the level 1 Cantor set in blue on top of the level 0 Cantor set in red. You can generate several additional levels, each stacked on top of its predecessor. Offset controls the vertical gap between successive levels.

Cantor set

None of level sets depicted in the program is actually the Cantor set. Rather, it is their intersection which is the Cantor set (which can be imagined but not viewed). That is, where C_n denotes the level n set, the Cantor set is defined by \cap_0^\infty C_n = C.2I_n=\lbrack-1/n,1/n\rbrack[/latex] for positive integer n, the intersection is the set of points belonging to every interval: \cap_1^\infty I_n = \{0\}.]

Although the resulting Cantor set is non-empty, there’s not much substance to it which is why it’s sometimes called ‘Cantor dust’. It has measure zero, meaning that for any value \epsilon > 0, we can fit the points of the set into a sequence of boxes whose total area measures less than \epsilon.3

And yet, Cantor dust does have substance. It contains many points, as many as there are real numbers. (The two sets have the same cardinality: there exists a one-to-one correspondence between the real numbers and the Cantor set.)

What about the Cantor set’s fractal dimension? When we magnify by a factor of 3, we get 4 new copies, so its size increases by a factor of 4. Hence its fractional dimension is d = \log_3 4\approx 1.26. In fact, our Cantor dust and the Koch snowflake have the same fractal dimension. The former is made by chiseling away and the former by adding on. To create Cantor dust, we start with a two-dimensional fill square and recursively delete regions; and to create the Koch snowflake, we start with a one-dimensional outlined triangle and recursively add line segments.

Our description of the 2D Cantor set is based on deleting squares but our program for generating this set is based on adding squares. We construct Cantor sets from the bottom up, starting with a square, and building higher level sets from lower level sets. A set at level n+1 is formed by shrinking four clones of the level n set and translated each one to a corner. In the following program, the level parameter indicates the set’s level and the len parameter the length along each side. The boxes share a common material mat.

function makeCantor(level, mat, len=10) {
    if (level == 0) {
        let geom = new THREE.BoxGeometry(len, 0.4, len);
        return new THREE.Mesh(geom, mat);
    } else {
        let cantor = makeCantor(level-1, mat, len);
        let root = new THREE.Object3D();
        root.scale.set(1/3, 1, 1/3);
        for (x of [-len, len]) {
            for (z of [-len, len]) {
                let clone = cantor.clone();
                clone.position.set(x, 0, z);
                root.add(clone);
            }
        }
        return root;
    }
}


  1. From en.wikipedia.org Image:Cantor_set_in_seven_iterations.svg, Public Domain, Link
  2. Analogously, given the closed intervals [latex
  3. I found mention of ‘Cantor dust’ irresistable. It’s one of the many points where mathematics verges on magic. I had a student once who wanted to write a paper on ‘magic bits’, 0s and 1s that carry a bit more data than ordinary 0s and 1s. I would say this crossed the threshold into magic.