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.

Two rules, before and after. Left: the interval from 0 to 1 becomes two pieces, 0 to 1/3 and 2/3 to 1, with the middle third shown in red and removed. Right: a cube face cut into a 3 by 3 grid with the centre square red; in the whole cube the 6 face centres and the centre cube, 7 of 27, are removed and 20 stay
One rule each: keep the 2 outer thirds of a segment, keep the 20 outer cubes of 27.

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 npiecespiece lengthtotal length
0111
121/30.6667
241/90.4444
381/270.2963
6641/7290.0878
201 048 5761/3 486 784 4010.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.

A tree of Cantor pieces over three levels. Each piece splits into a left child labelled digit 0 and a right child labelled digit 2. The path to 1/4 is highlighted: 0, then 2, then 0, giving 0.020 in base 3. Reading each 2 as 1 gives 0.010 in base 2, on the way to 1/3
Every survivor is a path of 0s and 2s; read 2 as 1 and it is a binary number.

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 xbase 3in the set?
1/40.020202…yes, never an end point (binary 0.0101… = 1/3)
3/40.202020…yes (binary 0.1010… = 2/3)
1/30.1 = 0.0222…yes, the right end of [0, 1/3]
1/20.1111…no, removed at level 1
1/50.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 ncubesvolumesurface
0116
1200.74078
24000.548713.04
38 0000.406424.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).

shapecopies ND = log N / log 3
Cantor set2≈ 0.631
Sierpinski carpet8≈ 1.893
Menger sponge20≈ 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.

On the mind map

This page on the Fractals mind map · 10 pages in 5 branches · open it to see the whole map and test yourself in recall mode.