The idea: cut out the middle, keep the rest, repeat
Take a piece, cut it into thirds and throw away the middle third. Do the same to every piece that is left, and again, forever. What is never thrown away is a remove-and-repeat fractal. On a line this gives the Cantor set; on a cube, cutting each cube into 27 and throwing away the 7 middle ones, it gives the Menger sponge.
Each Next level on the page takes two steps: first the pieces are cut and the parts that will go turn red, then the red parts disappear and the numbers below update.
The Cantor set has length zero
Level n has 2ⁿ pieces, each 3⁻ⁿ long. Every cut keeps 2/3 of what was there, so the total length is (2/3)ⁿ, which goes to 0. The parts thrown away add up to the whole interval, a geometric series with ratio 2/3:
removed = 1/3 + 2/9 + 4/27 + … = (1/3) / (1 − 2/3) = 1
| level n | pieces | piece length | total length |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 1 | 2 | 1/3 | 0.6667 |
| 2 | 4 | 1/9 | 0.4444 |
| 3 | 8 | 1/27 | 0.2963 |
| 6 | 64 | 1/729 | 0.0878 |
| 20 | 1 048 576 | 1/3 486 784 401 | 0.0003 |
The end points 0, 1/3, 2/3, 1/9, … are never cut away, so the set is not empty. (Demo: Cantor set, level 0 → 6.)
But it has as many points as [0, 1]
Write x in base 3. The first digit says which third x is in: 0 left, 1 middle, 2 right. The second digit says which third of that third, and so on. The first cut removes the numbers whose first digit must be 1, the second cut those whose second digit must be 1. So x survives every cut exactly when it can be written with only the digits 0 and 2.
Now read every 2 as a 1. The digits become a number in base 2, and every base-2 number between 0 and 1 is reached by exactly one such path. So the Cantor set has as many points as the whole interval [0, 1]: it is uncountable, even though its length is 0. This is the same "infinite strings of choices" that Cantor's diagonal argument shows cannot be listed.
| point x | base 3 | in the set? |
|---|---|---|
| 1/4 | 0.020202… | yes, never an end point (binary 0.0101… = 1/3) |
| 3/4 | 0.202020… | yes (binary 0.1010… = 2/3) |
| 1/3 | 0.1 = 0.0222… | yes, the right end of [0, 1/3] |
| 1/2 | 0.1111… | no, removed at level 1 |
| 1/5 | 0.0121… | no, removed at level 2 |
A number like 1/3 has two ways to be written, 0.1 and 0.0222…; it counts as long as one of them has no 1. (Demo: follow x = 1/4, Demo: follow x = 1/3, Demo: follow x = 1/5.)
The Menger sponge: no volume, endless surface
Cut the cube into 27 like a Rubik's cube and remove the cube in the middle of each face and the one in the centre. 20 of 27 cubes stay, each 1/3 as wide. Do it again to all 20. Level n has 20ⁿ cubes of side 3⁻ⁿ, so the volume (20/27)ⁿ goes to 0. Every cut opens tunnels whose walls add new surface, and the surface area of the unit cube grows as
surface = 2 · (20/9)ⁿ + 4 · (8/9)ⁿ → ∞
| level n | cubes | volume | surface |
|---|---|---|---|
| 0 | 1 | 1 | 6 |
| 1 | 20 | 0.7407 | 8 |
| 2 | 400 | 0.5487 | 13.04 |
| 3 | 8 000 | 0.4064 | 24.76 |
Each face of the sponge is a Sierpinski carpet, the 2-D version (keep 8 of 9 squares): a little square is cut out where both of its positions are a middle third. (Demo: Menger sponge, level 0 → 3.)
Fractal dimension
A shape made of N copies of itself, each scaled by 1/3, has similarity dimension D = log N / log 3. A segment cut in thirds gives 3 copies (D = 1), a cube 27 (D = 3).
| shape | copies N | D = log N / log 3 |
|---|---|---|
| Cantor set | 2 | ≈ 0.631 |
| Sierpinski carpet | 8 | ≈ 1.893 |
| Menger sponge | 20 | ≈ 2.727 |
The Cantor set is "more than points, less than a line"; the sponge is more than a surface but less than a solid. For curves built the other way round, by adding detail, see Fractal Curves; the chaos game draws a remove-and-repeat triangle with random jumps.
What the page leaves out
Levels above 6 and 3 (the pieces would be smaller than a pixel), the Cantor function (the "devil's staircase"), fat Cantor sets with positive length, the proof that the set is closed and has no isolated points, box-counting dimension, and the fact that every compact metric space is a continuous image of the Cantor set.