## Creating patterns through matrix expansion

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:

$0 \to \begin{bmatrix}{} 0 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}$

We initialize the process with $M_0=[0]$

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 $M_2: 3 \times 3$ matrix and then to a $M_3: 9 \times 9$ 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 $2 \times 2$ or a $4 \times 4$ 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 $M_5: 243 \times 243$

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

Figure 1

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

$0 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}$

Initialized with $M_0=[1]$

Figure 2

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

$0 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}$

Initialized with $M_0=[0]$

Figure 3

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

$0 \to \begin{bmatrix}{} 0 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}$

Initialized with $M_0=[0]$

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.

$0 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 0 & 1 & 0 \\ 1 & 0 & 1 \\ 0 & 1 & 0 \\ \end{bmatrix}$

Initialized with $M_0=[1]$

Figure 5

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):

$0 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 2 & 2 & 2 \\ 2 & 1 & 2 \\ 2 & 2 & 2 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 2 & 0 & 2 \\ 0 & 2 & 0 \\ 2 & 0 & 2 \\ \end{bmatrix}$

Initialized with $M_0=[1]$

Figure 6

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

$0 \to \begin{bmatrix}{} 1 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 2 & 1 & 2 \\ 1 & 2 & 1 \\ 2 & 1 & 2 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}$

Initialized with $M_0=[1]$

Figure 7

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

$0 \to \begin{bmatrix}{} 1 & 0 & 1 \\ 0 & 2 & 0 \\ 1 & 0 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 2 & 1 & 2 \\ 1 & 2 & 1 \\ 2 & 1 & 2 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}$

Initialized with $M_0=[0]$

Figure 8

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:

$0 \to \begin{bmatrix}{} 1 & 0 & 1 \\ 1 & 1 & 1 \\ 1 & 0 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 1 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 0 & 2 & 2 \\ 2 & 0 & 2 \\ 2 & 2 & 0 \\ \end{bmatrix}$

Initialized with $M_0=[2]$

Figure 9

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

$0 \to \begin{bmatrix}{} 2 & 2 & 2 \\ 2 & 0 & 2 \\ 2 & 2 & 2 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 1 & 3 & 1 \\ 3 & 2 & 3 \\ 1 & 3 & 1 \\ \end{bmatrix}; \; 3 \to \begin{bmatrix}{} 3 & 0 & 3 \\ 0 & 3 & 0 \\ 3 & 0 & 3 \\ \end{bmatrix}$

Initialized with $M_0=[2]$

Figure 10

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

$0 \to \begin{bmatrix}{} 2 & 2 & 2 \\ 2 & 1 & 2 \\ 2 & 2 & 2 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 0 & 0 & 0 \\ 1 & 0 & 1 \\ 0 & 0 & 0 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 1 & 3 & 1 \\ 3 & 2 & 3 \\ 1 & 3 & 1 \\ \end{bmatrix}; \; 3 \to \begin{bmatrix}{} 3 & 2 & 3 \\ 2 & 0 & 2 \\ 3 & 2 & 3 \\ \end{bmatrix}$

Initialized with $M_0=[3]$

Figure 11

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 $M_6: 729 \times 729$ matrix (Figure 12):

$0 \to \begin{bmatrix}{} 1 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 1 & 0 \\ 1 & 3 & 1 \\ 0 & 1 & 1 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 1 & 2 & 2 \\ 2 & 2 & 2 \\ 2 & 2 & 1 \\ \end{bmatrix}; \; 3 \to \begin{bmatrix}{} 0 & 3 & 3 \\ 2 & 1 & 2 \\ 3 & 3 & 0 \\ \end{bmatrix}$

Initialized with $M_0=[2]$

Figure 12

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

$0 \to \begin{bmatrix}{} 2 & 2 & 2 \\ 2 & 1 & 2 \\ 2 & 2 & 2 \\ \end{bmatrix}; \; 1 \to \begin{bmatrix}{} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 1 \\ \end{bmatrix}; \; 2 \to \begin{bmatrix}{} 1 & 3 & 1 \\ 3 & 2 & 3 \\ 1 & 3 & 1 \\ \end{bmatrix}; \; 3 \to \begin{bmatrix}{} 3 & 0 & 3 \\ 0 & 3 & 0 \\ 3 & 0 & 3 \\ \end{bmatrix}$

Initialized with $M_0=[2]$

Figure 13

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

This entry was posted in art, Scientific ramblings and tagged , , , , , , . Bookmark the permalink.