Sierpinski Triangle

how to generate the sierpinski triangle fractal both deterministically and via the randomized chaos game.


Fractal Intro Mandelbrot Sierpinski Gallery Return to Homepage




The Sierpinski Triangle is the orbit S of a seed in the Chaos Game.

Polish mathematician Waclaw Sierpinski (1882-1969) worked in the areas of set theory, topology and number theory, and made important contributions to the axiom of choice and continuum hypothesis. But he is best known for the fractal that bears his name, the Sierpinski triangle, which he introduced in 1916.

The Sierpinski triangle, sometimes referred to as the Sierpinski gasket, is a simple iterated function system that often serves as the first example of a fractal given to elementary school or high school students. There are two main ways to construct the triangle, one of which is obvious, and the other rather incredible.

Construction 1: Begin with a base triangle, and then draw lines connecting the midpoints of each leg, forming three self-similar right-side up subtriangles at each of the base triangle's corners. Then repeat this process for each of the newly formed subtriangles, and so on, ad infinitum.

Construction 2: "The Chaos Game"


  1. Choose three random points A, B, and C in some plane P, and color one of them red, another blue, and the third green. We will refer to these points as vertices, since one can imagine them as vertices of a triangle.
  2. Take a die and color two of the faces red, two blue, and two green.
  3. Select a point D on the plane P. This starting location for D is called the seed (D moves around later).
  4. Roll the die.
  5. Based on the color that the die produces face-up, move the seed toward the appropriately colored vertex, so that its distance away from that vertex is half of what it originally was. Then erase the original location of D.
  6. Repeat steps 4 and 5 about 7 times.
  7. Now repeat steps 4 and 5 ad infinitum, but graph the path of D along the way.

Most people expect a fairly random graph of streaks within a triangle. But the resulting graph is not random at all:





A random algorithm produces this! Out of chaos crystallizes order. Mathematicians denote this result, the orbit of the seed, by S. Regardless of the initial value of the seed, the Sierpinski triangle is realized.

Below is an applet made by Jacobo Bulaevsky that lets you see iterations of the Sierpinski triangle using the first style of construction described above. It would behoove you to not venture past 10 iterations, since otherwise your browser will freeze.



If you browser recognized the applet tag, you would see the Sierpinski Triangle applet here.



Fractal Intro Mandelbrot Sierpinski Gallery Return to Homepage



W. Wu, 2000-2005 ©.