Creepy crawlies. Insects. They may incite fear, or fascination, but did you know there are a number of insects crawling through mathematics? These number-loving Hexapods are most often found in the field of discrete mathematics and computer science – but these aren’t the same as the bugs you find in a computer program.
The first insect you’ll probably encounter is Langton’s ant. This is named after Chris Langton, who invented it in 1986. The premise of the ant is simple: given a square grid in which each square is either black or white, we create an agent (the ant) on the grid, and assign it the following rules:
- At a white square, turn 90° right, flip the colour of the square, move forward one unit
- At a black square, turn 90° left, flip the colour of the square, move forward one unit
You can watch it at work on a blank grid below:
The ant produces some interesting behaviour. At first, it seems fairly simple, with some symmetries here and there, and it grows more chaotic as it goes. This is up until around 10,000 iterations, where the ant starts making a steady march South-East. The recurring pattern of 104 steps is called a “highway”, and the ant diligently follows this path for the rest of its days. It turns out that these ants are Turing complete, which was proven in 2000.
Langton’s ant is pretty cool at first, watching a tiny, seemingly sentient blip running around on a page and watching the patterns that develop. Of course, it gets old very quickly, and once it starts making a highway you can predict its every move ad infinitum. So, as all good mathematicians do, we start looking for extensions. The first thing you might think of is starting the ant on a grid which already has some squares coloured in, to see if this produces different long-term behaviour to the blank grid. Every such finite configuration which has been tested has eventually led to the construction of a highway, but it remains unproven that this is true for every finite configuration. We do know that the path is always unbounded regardless of the inital configuration, by the Cohen-Kung theorem.
Now, perhaps you wonder what would happen if we added a third colour, so that white changes to blue to black and back to white, where the ant turns right on white, left on blue, and right on black. We should probably create a notation at this point, so let’s call it RLR, according to the directions it turns for each colour in the cycle. With this notation, the original ant would be RL. This generalisation can create some interesting patterns, like LLRR which grows symmetrically in a cardioid shape, or RRLLLRLLLRRR which starts making a triangular shape. You can experiment yourself with multi-coloured configurations here.
|RLR. It is unknown whether this ever creates a highway.||LLRR.||RRLLLRLLLRRR.|
We could even change from a square grid to a triangular or a hexagonal grid. The hexagonal grid permits up to six different rotations, which are notated here as N (no change), R1 (60° clockwise), R2 (120° clockwise), U (180°), L2 (120° counter-clockwise), L1 (60° counter-clockwise).
|L2NNL1L2L1||RL on a triangular grid.|
We could even have multiple ants going at once, which can generate some interesting cyclic behaviour where the ants get stuck in an oscillation. The behaviour of an ant is infinitely reversible, which means that when two ants meet and one is the other’s inverse, it will produce the reverse behaviour and return the pattern to the initial state, and then continue.
We could even consider a kind of ant where the colour of the ant changes – a multi-state Turing machine. These are called Turmites.
A “turmite” is a simple Turing machine which is similar to Langton’s ants, but multiple states of the agent are permitted. The name comes from Turing and mite, and also Turk who was one of its inventors. They have also been called “TurNing machines” by an independent inventor, Allen H. Brady. Some different (two-colour) turmite patterns are shown below, and you can create your own here.
This is by no means all of the insects you can find in mathematics. For more of an entomological fix, you could research ant colony optimisation, artificial bee colony algorithm, butterfly curves, the bug problem, and the spider and fly problem. See if you can find any others!