Agnes Scott College
Larry Riddle, Agnes Scott College

Sierpinski Carpet





Start with a solid (filled) square C(0). Divide this into 9 smaller congruent squares. Remove the interior of the center square (that is, do not remove the boundary) to get C(1). Now subdivide each of the eight remaining solid squares into 9 congruent squares and remove the center square from each to obtain C(2). Continue to repeat the construction to obtain a decreasing sequence of sets

$$ C(0) \supset C(1) \supset C(2) \supset C(3) \supset \cdots $$

The Sierpinski carpet is the intersection of all the sets in this sequence, that is, the set of points that remain after this construction is repeated infinitely often. The figures below show the first four iterations. The squares in red denote some of the smaller congruent squares used in the construction.




to his

The original square is scaled by a factor r=1/3. This is done 8 times followed by the necessary translations to arrange the eight squares as depicted for C(1) If we take the original square to be a unit square with opposite corners at (0,0) and (1,1), then the IFS would be given by the following functions.

\[ \begin{align} f_1 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} \\ f_2 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} 0 \\ {1/3} \\ \end{array}} \right] \\ f_3 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} 0 \\ {2/3} \\ \end{array}} \right] \\ f_4 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} {1/3} \\ 0 \\ \end{array}} \right] \\ f_5 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} {1/3} \\ {2/3} \\ \end{array}} \right] \\ f_6 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} {2/3} \\ {0} \\ \end{array}} \right] \\ f_7 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} {2/3} \\ {1/3} \\ \end{array}} \right] \\ f_8 ({\bf{x}}) &= \left[ {\begin{array}{*{20}c} {1/3} & 0 \\ 0 & {1/3} \\ \end{array}} \right]{\bf{x}} + \left[ {\begin{array}{*{20}c} {2/3} \\ {2/3} \\ \end{array}} \right] \\ \end{align} \]

The Sierpinski carpet consists of eight self-similar pieces corresponding to the eight functions in the iterated function system.






Angle 90
Axiom F
F —> F+F−F−F−G+F+F+F−F
G —> GGG

This will produce the Sierpinski carpet rotated by 45°. In addition, there will be lines through the square "holes" (see first animation). If you want to avoid those lines, you can modify the L-system to lift the pen by using

F —> F+F−F−F−UGD+F+F+F−F

where U means the pen goes up and D means the pen goes down. You can see the effect in the second animation.

L-system 1 L-system 2


The Sierpinski carpet is self-similar with 8 non-overlapping copies of itself, each scaled by the factor r < 1. Therefore the similarity dimension, d, of the unique attractor of the IFS is the solution to

$$\sum\limits_{k = 1}^8 {{r^d}} = 1\quad \Rightarrow \quad d = \frac{{\log (1/8)}}{{\log (r)}} = \frac{{\log (1/8)}}{{\log (1/3)}} = \frac{{\log (8)}}{{\log (3)}} = 1.89279$$


Suppose the area of the original square C(0) is equal to 1. To get C(k+1), we scale C(k) by 1/3, which reduces the area by 1/9 = (1/3)2. But we make 8 copies of this scaled version to form C(k+1). Therefore the area of C(k+1) must be (8/9)th of the area of C(k). This means that the area of C(n) is (8/9)n for all n. Notice that these areas go to 0 as n goes to infinity.

Another way to compute the area of the Sierpinski carpet is to compute the area of the "holes" using self-similarity. Suppose that the square covering the carpet has area 1 (as we did with C(0) above.) Let \(A\) be the area of the "holes" in the carpet. Then \(A = \frac{1}{9}+8\left(\frac{1}{9}A\right)\), the area of the center "hole" plus the areas of the holes in the eight copies of the carpet surrounding the center "hole", each of which is a 1/3-scaled version of the carpet so the area of those "holes" is scaled by 1/9. Then $$A = \frac{1}{9}+\frac{8}{9}A \Rightarrow \frac{1}{9}A = \frac{1}{9} \Rightarrow A = 1.$$ Thus the "holes" have the same area as the covering square, whence Sierpinski's carpet has area 0.

This means that we have removed "all" of the area of the original square in constructing the Sierpinski carpet. But of course there are many points still left in the carpet. That is one reason why area is not a useful dimension for this set.

Sierpinski used the carpet to catalogue all compact one-dimensional objects in the plane (from a topological point of view). What this basically means is the Sierpinski carpet contains a topologically equivalent copy of any compact one-dimensional object in the plane. Thus for any curve contained in the plane, there is a set homeomorphic to the Sierpinski carpet that contains the curve. For a good discussion of this idea, consult the text by Peitgen, Jurgens, and Saupe [6], or the topology text by Engelking and Sieklucki [2].

In an article written in 1916, Sierpinski wrote [1]:

Note that as early as one year ago Mr. Mazurkiewicz found an example of a curve which was simultaneously a Jordan curve and a Cantor curve...Mazurkiewicz forms this curve by dividing the square into nine smaller squares using lines parallel to the sides and removing the interior of the center square, performing the same procedure on each of the remaining eight square, and iterating this procedure ad infinitum.
So the Sierpinski carpet was actually invented by Stefan Mazurkiewicz, who in 1913 wrote his Ph.D. thesis under the supervision of Sierpinski on curves filling a square.


Box Fractal

Rather than remove the center square at each stop of the iterative construction, keep the center square and the four corner squares but remove the other four middle squares along each edge. The produces the box fractal.

Sierpinski Carpet Relatives


Start with the square rotated by 45° and divide this into 9 smaller congruent squares as with the Sierpinski carpet. But now choose to remove one or more of the smaller squares, and also possibly rotate some of them by 90°, 180°, or 270°, then iterate that construction. This produces what Robert Fathauer has called a "Square Divided by Nine" gasket. Here they are being viewed as relatives of the Sierpinski carpet similar to the family of Sierpinski triangle relatives.

Right Triangle Divided by Nine


Similar to the previous variation, but instead of a square, start with a right triangle and divide that right triangle into nine similar right triangles. Remove from 1 to 7 of the smaller triangles, then iterate. This produces what Robert Fathauer has called a "Right Triangle Divided by Nine" gasket.

Artistic Variations

Rather than remove the center square at each step of the iterative construction, one can replace that square with a scaled copy of some image. Here is an example using an Agnes Scott College logo. Click on the image for a larger view.


For other examples of how the Sierpinski Carpet has been an artistic inspiration, see the pictures of the quilt "Sierpinski Meets Mondrian" designed by Professor Gerda de Vries, University of Alberta; or the quilt "An Infinity of Nine-Patches" by Anabeth Dollins, Penn State University Greater Allegheny Campus; or the Sierpinski Carpet in interlocking crochet by Kate Dudman on Instagram.

Three-dimensional Variation

The three-dimensional generalization of the Sierpinski carpet is known as the Menger sponge, first studied by Karl Menger in 1926. Start with a cube and divide each of the six faces into 9 congruent squares. Remove the smaller cube in the middle of each face, and remove the smaller cube in the very center of the larger cube, leaving 20 smaller cubes. This is a level one Menger sponge. Repeat this process on each of those 20 smaller cubes, and keep repeating the process ad infinitum. The result is an object with zero volume and infinite surface area.

During October and November 2014, twenty primary sites around the world participated in the MegaMenger challenge. As a distributed fractal project, twenty Menger Sponge cubes were built in different cities around the world. In each location, volunteers built 8,000 small cubes out of nearly 50,000 business cards. These were then combined in groups of 20 to create 400 level one Menger Sponges. These were also combined in groups of 20 to make 20 level two sponges, which then formed one massive level three Menger Sponge. The resulting fractal cube would be nearly 5 feet tall. Collectively, these twenty level three sponges could be virtually combined to form a level-4 Menger sponge, perhaps the largest fractal ever built. Here are pictures of the level three Menger sponge built by faculty and students at Agnes Scott College under the guidance of Assistant Professor of Mathematics, Rachel Bayless (with additional contributions from students at several local middle and high schools).



  1. Ciesielski, Krzysztof and Zdzislaw Pogoda. "The Beginning of Polish Topology," The Mathematical Intelligencer, 18 (3), 1996, 32-39.
  2. Engelking, R. and K. Sieklucki. Introduction to Topology, Amsterdam: North-Holland, 1994.
  3. Helmberg, Gilbert. Getting Acquainted with Fractals, de Gruyter Publishing, 2007. [See Preview at Google Books]
  4. Jones, Juw. "Fractals Before Mandelbrot-A Selective History," in Fractals and Chaos, Crilly, Earnshaw, and Jones, Editors, Springer-Verlag 1991.
  5. Mandelbrot, Benoit. The Fractal Geometry of Nature, W.H. Freeman and Co. 1983. [Preview available at Google Books]
  6. McWorter Jr., William A. and Jane Morrill Tazelaar. "Creating Fractals," Byte, August 1987, 123-132.
  7. McWorter Jr., William A. Personal correspondence, December 5, 1999
  8. Peitgen, Heinz-Otto, Hartmut Jurgens and Dietmar Saupe. Fractals for the Classroom, Part One: Introduction to Fractals and Chaos, Springer-Verlag New York, Inc. 1990.
  9. Sierpinski, Waclaw. "On a Cantorian curve which contains a bijective and continuous image of any given curve," Mat. Sb. 30 (1916), 267-287 [Russian].
  10. Fathauer, Robert. Gasket Fractals,