The Mechanics and Economics of A Caterpillar Swarm

John Ruf
11 min readApr 12, 2021

Dr. Zhang (Anthony Lee Zhang)asked about a puzzle on a wave of ‘rolling’ caterpillars. The phenomena is shown in this video below by the great YouTube channel, smartereveryday. This is my response and analysis of the caterpillar swarm phenomena shown in the video.

There are a few sets of questions. Firstly, there is a question about “efficiency” of the swarm compared to moving alone. Secondly, there’s another question about the decreasing “efficiency” of each layer. IE: Why don’t caterpillars stack as high as possible?

This problem is depicted below, with each trapezoid representing another caterpillar.

Figure 1: Swarm or Solo? Who Wins?

I don’t like the use of the word efficiency here, because to me efficiency speaks more to thermodynamics and energy efficiency. For example, if adding a layer triples each caterpillar’s energy use, then the “energy efficiency” of using several layers of caterpillars would be less than 1. Rather, I prefer the term “advantage” to describe this, since this is more of a dynamics problem than a thermodynamics problem. The advantage here being given by the formula,

Advantage = NewSpeed/OldSpeed

Note that advantage is unitless, it’s just a ratio of speeds. As long as the new speed and the old speed have the same units (say, miles per hour, meters per second, or caterpillar lengths per unit time) the ratio will always be the same. This helps simplify my analysis later. To illustrate, let’s say that the 2-layer swarm moves at 1.5 times a normal caterpillar’s speed, then the advantage of the 2-layer swarm to moving alone is 1.5. Now that the rules of the game are set, let’s get to the kinematics of caterpillar swarms.

Subsection 1: The Kinematics of Caterpillar Swarms: A demonstration

Let us assume that all caterpillars are identical in regards to speed and to length. We’ll also assume that each caterpillar moves at 1 caterpillar length per minute, note that the units do not matter here since by definition advantage is unitless, thus, no matter what the true speed of a caterpillar is, our computed advantage is going to hold. Furthermore, to demonstrate the simple advantage principle, I am going to assume that there is no friction of any sort (we will add that in later).

When a caterpillar is on top of another caterpillar, that caterpillar is getting the motion of the caterpillar moving at the normal speed below it, plus it’s normal movement of 1 caterpillar-length in that minute. To illustrate this, I created figure 2 below we shows each caterpillar layer moving separately compared to the solo caterpillar. Notice how if only the bottom layer moves, the caterpillar swarm moves no faster than the solo caterpillar, but if the top layer moves as well they gain a speed advantage of +1 caterpillar lengths. There is also the problem of climbing on top and climbing down.

Figure 2: A visualization of Each Step in the Swarm’s Motion

However, caterpillar 1 has not yet gotten (much of) an advantage yet, why? Because he hasn’t taken the higher position until it moves to the top layer and is able to “leach” some speed off of caterpillar 2, as it does at the end of the diagram. Once the caterpillar has taken the top position, then things get interesting, as the caterpillar gets the full motion of the bottom layer, plus his own motion until he overtakes caterpillars 3 and 2. This process continues on until the caterpillar returns to the bottom layer when T=6, shown in figure 3 below.

Figure 3: Swarm vs Solo at each minute

At t=6 minutes, the solo caterpillar has moved 6 caterpillar lengths. How much has caterpillar 1 moved? Caterpillar 1 had 6 total “bottom” movement lengths, but gained 4 caterpillar lengths from being on top, putting the caterpillar at 10 Caterpillar Lengths when the bottom caterpillar is at 6 Lengths. However, to compute the average speed over the whole cycle we need to go on until caterpillar 1 is at the bottom position, which will occur in 4 more seconds, where both the solo caterpillar and caterpillar 1 will be equal.

Therefore, at T=10 minutes , caterpillar 1 will be at 14 caterpillar lengths and the solo caterpillar will be at 10 caterpillar lengths, giving us an advantage of 1.4, as the average velocity of caterpillar 1 was 1.4 caterpillar lengths per minute and the solo caterpillar speed averaged at 1 caterpillar lengths per minute.

Now that we demonstrated the principle, how do we crunch the actual numbers? The average speed is pretty simple to compute, it’s going to be the following

Where distance traveled is going to depend on the time on top and the time on bottom, updating our equation to the following,

Now, what’s the average speed in my example, the speed on top is simply 2, the speed on bottom is 1, and the time on top is going to be 4 minutes and the time on bottom is going to be 6 minutes, giving us the following result.

But, we want to generalize this formula past the speed being in caterpillar lengths and in minutes. Instead, we want to capture this in cycles or rotations since that will allow us to just look at the initial setup of a caterpillar swarm and compute the new average speed of the swarm. We can instead change the units of the formula from caterpillar lengths, to cycle lengths, and the times to cycle times. This yields the following equation

Try it yourself with the 5 caterpillar example, there are two caterpillars on top (on average) throughout the cycle and 3 caterpillars on bottom.

Note that this also works towards the end of SmarterEveryDay’s video when they show the LEGO caterpillar swarm vs the solo caterpillar. For a full cycle, a caterpillar has (4 bricks of length 4) 16 LEGO spots where it can move at normal speed, and 12 (3 bricks of length 4) LEGO spots where it can move at double speed. This means that the average speed computation becomes,

The actual race outcome is significantly higher if you only track the blue LEGO’s against each other because for most of the race the blue caterpillar is on top. However, if you compare the rear of the swarm to the rear of the blue caterpillar, you’ll see that the blue caterpillar moved 20 spaces in 20 time units, while the rear of the swarm moved 29 spaces. If we plug in our speed prediction, 20(time units)*1.42(avg speed)=28.6 ~29 (LEGO slots), which shows that this is a pretty good way to compute the average speed of a swarm.

The only thing that really matters here are the “fraction of places” where the caterpillar can move at double speed and the “fraction of places” where a caterpillar can move at lower speeds. That leaves the question of when should a swarm stack higher and when should a swarm stack wider?

Sub-Section 2: Higher Vs. Wider

This leads to the question of higher versus wider, given that 1 stack is good, then 2 stacks should be better, right? And if you guessed that you would be right, just look at figure 4 below, if you add one more caterpillar to the stack, it is always better for that caterpillar to be higher in the stack, leading to a pyramid-esque shape.

Figure 4: Comparison between Higher and Wider Speeds given an additional caterpillar

But this is actually quite puzzling, because caterpillars generally don’t do a pyramid-style shape. We only see the much less advantageous wider shape in the SmarterEveryDay video.

I think there are two primary ideas behind why the optimal pyramid shape is not chosen, one behavioral and one mechanical.

Sub-Section 3: The Economist’s Answer to the Higher vs Wider Puzzle

Before I say anything, I am going to mention that I’ve only ever minored in economics and this is what I imagine a good economist would say. Also, because I have no experience in sociobiology or ecology, I’m just going to present how an economist would look at this from the perspective of optimizing agents and call it a day (Can you really assume caterpillars are ration utility-maximizers?). Note that I’m sure that ecologists have a far better answer than what I’m putting forward and you should dive deeper than what an undergraduate engineering major has to say on a Sunday afternoon.

But basically, what I think an economist would say is that a caterpillar swarm is not something that occurs because caterpillars are just so gosh-darn friendly to each other, but rather they occur as an equilibrium of each caterpillar trying to maximize the amount of food it can get for the minimum amount of energy, (an old-timey term for this would be a spontaneous order). Naturally, a caterpillar wants to be on top as much as possible, and does not want a caterpillar to be on top of it, as that would require it to expend more energy to carry the caterpillar on top. Therefore, the reason why caterpillars can’t complete the well-coordinated pyramid shown in figure 4 is because caterpillars 5 and 4 would rather move faster forwards to prevent caterpillar 6 from getting on top and increasing their energy consumption to get to food.

A better characteristic of this swarming behavior, from an economist’s point of view, is that the caterpillars on top are moving forward both to take advantage of the caterpillars below them, but also to run away from the caterpillars behind them and prevent them from climbing on top of them. Because having extra weight would cause the caterpillar to have to expend more energy. However, the caterpillar’s act of running forward along the swarm brings it to the front where it can no longer outrun the caterpillars behind it (due to the kinematic advantage of the swarm), and thus leading it to be overtaken by the bottom.

Note that this theory has some predictions: Namely that the caterpillars on top will move more on top than the caterpillars on bottom, since the caterpillars on bottom can’t do anything but wait for the rest of the swarm to pass over them, and have very little incentive to do anything but wait for their turn on top. This would explain why in the video it looks like the bottom caterpillars are hardly working while the caterpillars on top look like they are in a frenzy. This would also explain the occasional breakdowns in the movement coming from the rear, as if the rear caterpillar stops moving, then the caterpillars in front no longer need to move forward to avoid being overtaken by the caterpillar in rear, and safely “get a breather.” Also, I really wish I understood better how to set up a game theory model, as I would really love to explore the microeconomics behind this, but I think my intuition here is pretty solid.

Sub-Section 4: The Engineer’s (or biomechanical) Answer

Now here comes the obvious counterpoint from anyone who has lifted a weight before.

“Well if carrying the caterpillars on top is heavier, then that causes the bottom caterpillars to move slower and reduce the advantage of swarming more than going wider.”

And this point is largely correct, especially if we think of it from an energy perspective. Lets assume that a caterpillar can only generate a certain amount of energy in a certain time frame, then the velocity of that time would be given by a simple energy conservation equation, where energy kinetic is how much energy the caterpillar has in moving, Egen is the amount of energy the caterpillar can produce to continue the motion, and F *x is the equation for how much energy is lost due to friction.

However, we need to calculate how friction changes as the number of caterpillars change. For this we just need to know that friction is the friction coefficient times the force normal to the caterpillar, AKA the force pushing down on the caterpillar. Which is going to be it’s own weight, and the weight of the caterpillars above it. We can also assume that each caterpillar in a row can only move as fast as the slowest caterpillar in that row, so the fact that the caterpillars on the edge are not carrying the full weight of an additional caterpillar on top of them does not matter. So the total Y force on a caterpillar on the first row can be computed as shown below. Where m is the mass of a caterpillar, g is the gravitational constant, and n is the number of rows in a caterpillar swarm.

So, we can plug this into the original energy equation and substitute in the kinetic energy formula to get,

Where xdot is the velocity, x is the position. The great thing is that this is actually a solvable equation for the dynamics of caterpillar at any point if the parameters are given. The biggest bugbear in this dynamic model is that the energy generated is not constant, and will depend on the behavior of the caterpillar, which is actually where the two models can be complimentary rather than competing explanations of the same phenomena.

But this gets a similar result as the economist’s formulation, namely that caterpillars at the bottom move really slowly, caterpillars at the top move quickly. However, this does not answer the question of why the swarm moves fits rather than smoothly.

Sub-Section 5: Conclusions

Can Caterpillar Swarms be simplified as point masses under a variety of forces? Are caterpillars actually rational utility maximizers solving incredibly complicated energy/food tradeoff problems? The only thing that can be said for sure is that caterpillar swarms are complicated and you should probably be doing something else than reading some random undergrad’s take on it.

Let me know (politely, please) of any mistakes I made in the comments below.

--

--