# Triangle Center Patterns

I made a video that illustrates a particularly interesting “discrete state random dynamical system,” which was inspired by a Tweet (and a mistake) that I saw.

First, be hypnotized by this video, which I recommend you watch in 4K, and then scroll down to read about the inspiration and the cool math going on under the hood.

## Matt Henderson’s tweet

This whole exploration came from a “happy accident” that Matt Henderson made (and corrected) in the Tweets below. Watch the video in the first tweet, which shows an concrete example of the “discrete state random dynamical system” that I mentioned earlier.

Matt’s mistake got me interested! If the centroid and the incenter create such interesting and intricate designs, what about other triangle centers like the circumcenter or the orthocenter? In particular, I was interested in finding examples of interesting triangle centers from Clark Kimberling’s Encyclopedia of Triangle Centers (ETC), which is a database with over 53,000 named triangle centers, including all of those that you have heard about.

## Patterns from other triangle centers

Instead of illustrating the results of this process on hexagons as Matt did in his tweet, I’ve done the iterative process on squares. Here are six examples illustrating the patterns for various triangle centers from ETC.

## Some basics of triangle centers

In the video at the top, I interpolate between 20 chosen triangle centers in a continuous way so that we can see how the image transforms as we transform the choice of triangle center.

In order to understand what’s going on, you have to understand something about coordinates. We can define a triangle center with a map $$f\colon \mathbb{R}^3 \to \mathbb{R}$$ such that $$f(a,b,c)$$ is symmetric in $$b$$ and $$c$$. What we do is take the triangle with vertices $$\vec{v}_1$$, $$\vec{v}_2$$, and $$\vec{v}_3$$, define $$a = |\vec{v}_2 – \vec{v}_3|$$, $$b = |\vec{v}_1 – \vec{v}_3|$$, and $$c = |\vec{v}_1 – \vec{v}_2|$$, and define the midpoint as the weighted average $\frac{f(a,b,c) \vec{v}_1 + f(b,c,a)\vec{v}_2, + f(c,a,b)\vec{v}_3}{f(a,b,c) + f(b,c,a) + f(c,a,b)}.$ Whenever $$f(a,b,c)$$, $$f(b,c,a)$$, and $$f(c,a,b)$$ are simultaneously positive, this will describe a point inside the triangle. This way of describing points in space is called a “barycentric coordinate system“.

In the table below, I give examples of five triangle centers and their description in barycentric coordinates. In the case of $$X(2)$$, the barycentric coodinates say that the centroid is just an honest average of the vertices. In all other cases, the other triangle centers are weighted averages of the vertices.

## A curve of triangle centers

The triangle centers in the video are all described by functions of the form $f(a,b,c) = a^{x_1}(b + c – a)^{x_2} (bc)^{x_3} (b^{x_4} + c^{x_4})^{x_5},$ where $$(x_1, x_2, x_3, x_4, x_5) \in \mathbb{R}^5$$ and each frame follows a path in $$\mathbb{R}^5$$, which intersects a triangle center from ETC for a single frame every ten seconds. In order to get this path in five-dimensional space, the code stitches together twenty piecewise-defined Bézier curves into a differentiable curve that goes through those twenty “anchor points”, as suggested by the following illustration. (Thankfully I could reuse some of the code I wrote for my Twitter bot @BotzierCurves!)

In addition to choosing a slightly different triangle center in each frame, the colors of the points change throughout time as well. For example, in the picture below, the pixel is colored white if the same side is chosen twice in a row, red if the opposite side is chosen, and blue or green if the side to the left or right of the previous side is chosen. In the video, these colors change too, by following a Bézier curve through the three-dimensional RGB colorspace.

You can download the code for yourself by visiting my MathArt repository on Github. If you have thoughts on this, if you want to play around with these ideas together, or if you just want to chat, please don’t hesitate to reach out!