We've updated our Privacy Policy to make it clearer how we use your personal data. We use cookies to provide you with a better experience. You can read our Cookie Policy here.


How a Fly's Brain Calculates Direction of Travel

How a Fly's Brain Calculates Direction of Travel content piece image
Fly brains are capable of performing vector math to calculate direction of travel. Credit: Meishel Desouto
Listen with
Register for free to listen to this article
Thank you. Listen to this article using the player above.

Want to listen to this article for FREE?

Complete the form below to unlock access to ALL audio articles.

Read time: 4 minutes

Navigation doesn’t always go as planned—a lesson that flies learn the hard way, when a strong headwind shunts them backward in defiance of their forward-beating wings. Fish swimming upriver, crabs scuttling sideways, and even humans hanging a left while looking to the right contend with similar challenges. How the brain calculates an animal’s direction of travel when the head is pointing one way and the body is moving in another is a mystery in neuroscience.   

A new study makes significant headway on solving this mystery by reporting that the fly brain has a set of neurons that signal the direction in which the body is traveling, regardless of the direction in which the head is pointing. The findings, published in Nature, also describe in detail how the fly’s brain calculates this signal from more basic sensory inputs. 

“Not only do these neurons signal the fly’s direction of travel, but they do also so in a world-centered reference frame,” says Rockefeller neuroscientist Gaby Maimon. What’s remarkable, adds first author Cheng Lyu, a graduate student in the Maimon lab, is that these insects are transforming body-referenced sensory inputs into a world-referenced signal, allowing the fly to know that it is traveling, for instance, 90 degrees to the right of the sun or northward.

Finding one’s place

Even when we close our eyes, we typically retain a good idea of where we are in a room and which way we’re facing. That’s because, even in darkness, our brains construct an internal understanding of where we are in space. In the 1980s, scientists discovered that a group of cells called head direction cells play a key role in letting us to know our angular orientation and it was later discovered that flies have cells with similar function. The cells’ activity indicates the angle in which the head is pointing, akin to how a compass needle indicates one’s orientation in an environment. 

All is well as long as we’re walking—or flies are flying—in the same direction that the head is facing. The head-direction cells can be used to update the internal sense of where one is going. But if we walk north while facing east, or if a fly attempts to buzz forward while the wind pushes it backward, the head direction cells point in the wrong direction. Yet the system still works. Flies are relatively unperturbed by the indignities of wind currents, and humans don’t get lost when they swivel to take in the scenery. Lyu and Maimon wondered how flies know where they’re going, even when their head direction cells were seemingly relaying inaccurate information. 

To answer this question, Lyu glued fruit flies to miniature harnesses that hold only the insects’ heads in place, enabling him to record brain activity while leaving the flies free to flap their wings and steer their bodies through a virtual environment. The setup contained several visual cues, including a bright light representing the sun and a field of dimmer dots that could be adjusted to make the fly feel like it was being blown backward or sideways. 

As expected, the head direction cells consistently indicated the fly’s orientation to the sun, simulated by the bright light, independently of the dimmer dots’ motion. In addition, the researchers identified a new set of cells that indicated which way the flies were traveling, and not just the direction their head was pointing. For example, if the flies were oriented directly toward the sun in the east while being blown backward, these cells indicated that the flies were (virtually) traveling west. “This is the first set of cells known to indicate which way an animal is moving in a world-centered reference frame,” Maimon says.     

Mental math

But the team also wondered how fly brains compute the animal’s travel direction at the cellular level. Collaborating with Larry Abbott, a theorist at Columbia University’s Zuckerman Institute, Lyu and Maimon were able to demonstrate that the fly brain engages in a sort of mathematics exercise.

A physics student plotting an object’s trajectory will break the trajectory into components of motion, plotted along the x- and y-axis. Similarly in the fly brain, four classes of neurons that are sensitive to visual motion indicate the fly’s traveling direction as components along four axes. Each neuronal class can be thought of as representing a mathematical vector. The vector’s angle points in the direction of its associated axis. The vector’s length indicates how fast the fly is moving along that direction. “Amazingly, a neural circuit in the fly brain rotates these four vectors so that they are aligned properly to the angle of the sun and then adds them up,” Maimon says. “The result is an output vector that points in the direction the fly is traveling,  referenced to the sun.”

Vector math is more than just an analogy for the computation taking place. Rather, the fly brain appears to be literally performing vector operations. In this circuit, populations of neurons explicitly represent vectors as waves of activity, with the position of the wave representing the vector’s angle and the height of the wave representing its length. The researchers even tested this idea by precisely manipulating the length of the four, input vectors and showing that the output vector changes just as it would if flies were literally adding up vectors.

“We make a strong argument that what’s happening here is an explicit implementation of vector math in a brain.” Maimon says. “What makes this study unique is that we show, with extensive evidence, how neuronal circuits implement relatively sophisticated mathematical operations.”   

Understanding spatial cognition

The present research clarifies how flies figure out which way they’re going, in the moment. Future studies will examine how these insects keep track of their travel direction over time to know where they’ve ultimately ended up. “A core question is how the brain integrates signals related to the animal’s travel-direction and speed over time to form memories,” says Lyu. “Researchers can use our findings as a platform for studying what working memory looks like in the brain.”

The findings might have implications for human disease, as well. Because spatial confusion is often an early sign of Alzheimer’s disease, many neuroscientists are interested in understanding how brains construct an internal sense of space. “The fact that insects, with their tiny brains, have explicit knowledge of their traveling direction should compel researchers to search for similar signals and analogous quantitative operations in mammalian brains,” Maimon says. 

“Such a discovery might inform aspects of the dysfunction underlying Alzheimer’s disease, as well as other neurological disorders that afflict spatial cognition.” 


Lyu C, Abbott LF, Maimon G. Building an allocentric travelling direction signal via vector computation.
Nature. Published online December 15, 2021:1-6. doi:10.1038/s41586-021-04067-0

This article has been republished from the following materials. Note: material may have been edited for length and content. For further information, please contact the cited source.