Fractal dimension

More about the Sierpiński triangle

Sierpiński triangle builder

Cut a triangle into four and throw away the middle one. Do the same to the three triangles that are left, and again, and again. What remains is the Sierpiński triangle, a shape made of three half-size copies of itself, with no area and endless edges. Build it level by level, grow it from random jumps in the chaos game, or find it hidden in the odd numbers of Pascal's triangle, and change the corners, jumps and remainders to see the fractals next door. Choose one of three ways to build the fractal. Remove middles cuts the middle out of every triangle, one level at a time: press Play or Step. The chaos game jumps from point to point, each time part of the way towards a corner picked at random, and marks every landing spot; change the number of corners, the jump and the rule to grow other fractals. Pascal's triangle colours every number by its remainder: the odd numbers draw the Sierpiński triangle.

How it works

  1. Choose a method: remove middles, the chaos game or Pascal's triangle.
  2. Press Play or Step to remove the next level or to add points, or set the rows and the remainder for Pascal's triangle.
  3. Change the corners, the jump and the rule of the chaos game, and read the triangles, the area and the fractal dimension in the tiles.

Three roads to one fractal

Removing middles builds the triangle from the outside in: after n rounds there are 3ⁿ triangles left, holding (3/4)ⁿ of the area, so after 10 rounds less than 6% remains. The chaos game builds it from the inside out: start anywhere, jump halfway to a corner picked at random, mark the spot and repeat. However the dice fall, the marks settle on the Sierpiński triangle. And in Pascal's triangle, where each number is the sum of the two above it, colouring the odd numbers draws the same picture, because odd plus even and even plus odd are odd, but odd plus odd is even.

Fractal dimension

Halve the size of a line and you need 2 copies to cover it; halve a square and you need 4, a cube 8. Those are 2¹, 2² and 2³, and the exponent is the dimension. Halve the Sierpiński triangle and you need 3 copies, so its dimension d solves 2^d = 3: d = log 3 / log 2 ≈ 1.585. It is more than a curve and less than a surface. The chaos game with other corners and jumps gives other dimensions: 5 corners with a jump of 0.618 give a pentagon of pentagons, 6 corners with a jump of 2/3 a snowflake of hexagons.

Frequently asked questions

Why does the chaos game always give the same shape?

Each jump halves the distance between the point and the copy of the triangle that belongs to the chosen corner. Whatever the starting point, after a handful of jumps it is so close to the triangle that the difference is smaller than a pixel, and from then on every jump maps the triangle onto one of its three halves. The random choices only decide in which order the triangle gets filled in.

What happens with four corners?

With 4 corners and a jump of 1/2 the four half-size copies cover the square exactly, so the points simply fill it in, with no holes. Add a rule, such as never picking the same corner twice or never a neighbour of the last corner, and a fractal appears again, because certain regions can no longer be reached.

Why do the odd numbers of Pascal's triangle make the Sierpiński triangle?

Rows 0 to 2ᵏ − 1 of Pascal's triangle mod 2 form a triangle, and the next 2ᵏ rows contain two copies of it with an empty triangle of zeros between them, exactly like the removal. Lucas's theorem of 1878 gives the reason: C(n, k) is odd exactly when every binary digit 1 of k is also a 1 in n.

What about other remainders?

For a prime p, Pascal's triangle mod p is also self-similar, made of p(p + 1)/2 copies at 1/p scale: dimension log 6 / log 3 ≈ 1.63 for p = 3 and log 15 / log 5 ≈ 1.68 for p = 5. Remainders by composite numbers such as 4 or 6 make patterns that combine those of their factors.

Is anything sent to a server?

No. Everything is drawn in your browser, and your last settings stay in this browser's local storage.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Go to Editor