People who are seriously interested in emergent complexity and pattern formation might at some point discover matrix expansion for themselves. It is a version of string rewriting that allows one to create complex patterns. For me, the inspiration came from the way Hindu temples were constructed in their phase of maturity and this led me to walking on a path, which probably several others have done before me. While matrix substitution is perhaps common knowledge to students of pattern formation, I am still recording it here in part due to the great beauty of the patterns that can be generated by this very simple mechanism.

Let us consider the following substitution rules:

We initialize the process with

What these substitution rules do is to replace every 0 and 1 respectively by the indicated matrices in each round. As a consequence we get an expanding matrix which starts with a single element, which then grows to a matrix and then to a matrix and so. Once we arrive at a matrix of a certain size we can render it as an image by assigning a color to each cell based on the number it contains. In this case we have two numbers 0,1; hence, our image would be two-colored. We could have done the same with a or a matrix as the substituent. However, these either have too little diversity or grow too fast to produce nice images on a typical laptop screen. Unless indicated otherwise all images in this note were produced by expanding the matrix to a size of

Applying the above rules initialized as indicated above leads us to the famous box fractal (Figure 1).

Applying the below rules yields us the famous Sierpinski box (Figure 2):

Initialized with

Applying the below rules yields us a variant, the box-dot fractal (Figure 3):

Initialized with

Applying the below rules yields us a more complex variant of the box fractal (Figure 4):

Initialized with

Figure 4

Applying the below rules yields us an interesting carpet weaving (Figure 5). A search on the internet reveals that a certain Jeff Haferman was the first to announce this: in any case he arrived at it before my times.

Initialized with

We can get many other weavings; however, to realize the full potential of this mechanism we shall now go to higher number of colors. For 3 colors we need to formulate 3 rules and so on. We show below some carpets and fractals obtained with 3 and 4 colors.

The below rules yield a 3 color carpet (Figure 6):

Initialized with

The below rules yield a 3 color carpet (Figure 7):

Initialized with

The below rules yield a 3 color carpet (Figure 8):

Initialized with

The below rules yield the liṅga-ṣaṭkoṇa fractal (Figure 9). The inspiration for this comes from the matrix figure used in the śaiva tradition known as the liṅga-yantra. One can see the fractal liṅga-s combined with a hexagonal gasket fractal with an inner skewed Koch’s curve:

Initialized with

The below rules yield a 4 color carpet (Figure 10):

Initialized with

The below rules yield a 4 color H-fractal with repeating copies of the letter “H” (Figure 11):

Initialized with

The below rules yield a 4 color hexagonal gasket fractal with a Koch curve boundary and some further complex structure. This image was created after 6 rounds of matrix expansion i.e. a matrix (Figure 12):

Initialized with

The below rules yield a 4 color carpet. This image was created after 6 rounds of matrix expansion i.e. a matrix (Figure 13):

Initialized with

Not all matrices yield aesthetically worthwhile images. A reader might experiment with this method to obtain further images.