# Mothematics

Why are moths so fatally attracted to lights?

There seems to be a tentative consensus that moths use bright sources of light as a means of navigation. Specifically, it is suggested that moths fly such that the light source is fixed at a particular location in their field of view.

Imagine you are walking along a straight pavement towards a distant street-light. The light appears to subtend some small angle with the horizon. This angle is approximately constant, provided you stay a fair distance from the light. So assuming you don’t stray from the path, you see the street-light as stationary.

This reasoning can be inverted: if the street-light were so dazzling that the path ahead of you became invisible, you could be sure you’re still walking along the pavement by ensuring the street light remains fixed at a particular point in your field of view. How does this thought pertain to moths?

Before the nascent human race tamed fire, two light sources ruled: the moon and the sun. So far away are these two bodies that their position in one’s field of view varies very little as one moves across the Earth’s surface.

Then suppose a moth is in flight, using the moon as its ‘street-light’. Since the moon appears to be stationary, preservation of the angle between the moth’s path and the direction to the moon allows the moth to fly in a straight line.

What happens if a moth encounters a light bulb?

Consider again the street lamp. From a great distance, the light appears almost immobile. As you move closer, the light shifts perceptibly upwards in your field of vision. The rate at which the light rises increases as you get nearer. Eventually, you are almost underneath the light itself. As you pass below, the light rushes over your head and vanishes.

Now imagine you’re a moth. As the street-light starts to disappear, your instincts kick in. You want to force the light back down into your field of view, so you tip backwards to compensate. The lamp briefly reappears, only to disappear again as you continue to move. So you tip backwards again; the process repeats. You are now locked in orbit around the light, constantly adjusting your direction to accommodate its changing inclination.

This would explain why moths tend to circle lights. But moths do not generally orbit lights like planets – frequently, they can be see spiralling towards and subsequently crashing into lights. Can this behaviour be explained by the constant inclination argument?

Here’s the maths. Let the light source be situated at the origin, and the moth have position vector $\bold{r}$. Let $\theta$ be the angle between ‘the direction to the light’ and ‘the direction of the moth’s path’.

This angle can be found by taking the dot product of the moth’s position and velocity vectors:

$\bold{r}\cdot\bold{\dot{r}}=r\dot{r}\cos\theta$

since $\bold{r}$ is the direction to the light and $\bold{\dot{r}}$ is parallel to the direction of the moth’s path.

Our defining equation is

$\cos\theta=c$

where $c$ is a constant. This is all we need to find the moth’s trajectory.

Taking the motion of the moth to be confined to the $xy$ plane, we can expand the dot product out in the following way:

$\bold{r}\cdot\bold{\dot{r}}=cr\dot{r}$

$x\dot{x}+y\dot{y}=c\sqrt{x^2+y^2}\sqrt{\dot{x}^2+\dot{y}^2}$

Now consider the following:

$r=\sqrt{x^2+y^2}$

$\displaystyle \dot{r}=\frac{1}{2}\frac{2x\dot{x}+2y\dot{y}}{\sqrt{x^2+y^2}}$

$r\dot{r}=x\dot{x}+y\dot{y}$

Careful use of the chain rule is needed here. Substituting this expression for $x\dot{x}+y\dot{y}$ into the expression for the dot product,

$r\dot{r}=c\sqrt{x^2+y^2}\sqrt{\dot{x}^2+\dot{y}^2}$

The factor of $r$ cancels on both sides, leaving

$\dot{r}=c\sqrt{\dot{x}^2+\dot{y}^2}$

$\dot{r}^2=c^2(\dot{x}^2+\dot{y}^2)$

This simplifies the equation of motion a little, but we are currently using a mixture of polar and Cartesian coordinates. We’ll now switch to polar coordinates, defined by

$x=r\cos\varphi$

$y=r\sin\varphi$

We want to use these expressions to convert the right-hand side of the equation to polar form. The product and chain rules give

$\dot{x}=\dot{r}\cos\varphi-r\sin\varphi\ \dot{\varphi}$

$\dot{y}=\dot{r}\sin\varphi+r\cos\varphi\ \dot{\varphi}$

Substitution and simplification yields

$\dot{r}^2=c^2(\dot{r}^2+r^2\dot{\varphi}^2)$

We’ll now use a trick to kill off the time derivatives. The chain rule tells us that

$\displaystyle \dot{r}=\frac{dr}{d\varphi}\dot{\varphi}$

Substituting this into the equation of motion yields a common factor of $\dot{\varphi}^2$ on both sides. After removing this term we’re left with

$\displaystyle \Big(\frac{dr}{d\varphi}\Big)^2=c^2\Bigg(\Big(\frac{dr}{d\varphi}\Big)^2+r^2\Bigg)$

After a bit of shuffling, we find

$\displaystyle \frac{1}{r}dr=\frac{c}{\sqrt{1-c^2}}d\varphi$

We integrate:

$\displaystyle \ln r=\frac{c}{\sqrt{1-c^2}}\varphi+\ln A$

where $A$ is a constant. Exponentiating both sides yields

$r=A\exp\Big(\frac{\cos\theta}{\sqrt{1-\cos^2\theta}}\varphi\Big)$

$r(\varphi)=A\exp(\cot\theta\ \varphi)$

Hence the moth moves in a logarithmic spiral.

The picture to the right shows a logarithmic spiral for a particular value of the ‘sought angle’ $\theta$.

It is worth noting that the logarithmic spiral can take a variety of forms depending on the value of $\theta$.

For example as $\theta$ tends to 90 degrees, the spiral winds up tighter and tighter until it becomes a circle. In contrast, as $\theta$ goes to 0, the spirals unfurls into a straight line.

Have you ever seen a moth move in a logarithmic spiral? The answer is most likely no.

Observations of moths in controlled environments show that they don’t always collide with their chosen light source – some tend to fly straight towards the light from a distance, then swerve at the last second and settle into a tight, circular orbit.

So perhaps their true trajectory is a mixture of two logarithmic spirals – one with a very small value of $\theta$ when far away, and one with a value close to 90 degrees when close? But when does the moth switch from one regime to the other? And how does it know when it is ‘close’ to a light?

Perhaps it’s best not to get too attached the logarithmic spiral. The answer is pretty, but is derived from an idealisation.

There are several other theories explaining why moths might circle lights. It is worth having a look at them and deciding for yourself which one seems most plausible. Whatever the rule being used by the moth is, it must surely be a simple one – a moth is tiny, so its brain is tinier yet. The algorithm dictating its behaviour cannot be that complicated.

The mechanism proposed above is certainly simple, and explains moths’ attraction to lights, but gives unrealistic results. Perhaps you can think of an explanation?