Bees and wasps devised the same clever math trick to build nests

These insects solved a building problem as a mathematician would, with geometry

A photo of several bees sitting on top of a honey comb structure.

The nests of honeybees consist of mostly six-sided cells made from wax. Adding pairs of five- and seven-sided cells help fit large and small hexagons together.

Todd Huffman/Wikimedia Commons (CC BY 2.0)

Honeybees and yellow jackets don’t look like mathematicians. But working as a colony, these insects can solve a common building problem using a geometric solution.

Some types of bees and wasps live in colonies. These social insects build nests from six-sided — or hexagonal — cells. As their colonies grow, these insects sometimes need to increase the size of the cells. But it’s hard to fit hexagons of different sizes together without wasting materials. And their nest-making material is hard to make. Both the honeybees and wasps have solved this problem: They mixed in some pairs of five-sided and seven-sided cells.

Those alternate cells bridge the gap between different sizes of six-sided hexagons. This fix is close to the best possible solution to this problem, conclude researchers behind the new finding. They reported their results July 27 in PLOS Biology.

“We’ve known for a long time that the hexagonal comb [that] bees and wasps use is the most efficient, stable shape,” says Lewis Bartlett. “But mixing different-sized hexagons is tricky.” Bartlett studies honeybees at the University of Georgia in Athens. He did not take part in the research.

When colonies develop bigger members

Colonies of social wasps and honeybees are run by female workers. They raise the offspring of their mother, the queen. They do this in hexagonal cells. Honeybees build those cells out of wax. Wasps make them from paper. At first, the offspring are other workers that can’t reproduce. At a certain point in its life cycle, though, the colony needs to switch to raising males and new queens. These colony members can reproduce.

They can often be bigger than the workers, so the cells need to get bigger too. That poses a challenge.

Images of part of a honeybee nest (left) and that of two species of wasp (center, right) exhibit pairs of five- and seven-sided cells (highlighted) nestled in among the six-sided variety. The bottom of each image is oriented toward a newer part of the nest, which means these insects built the five-sided cells before the seven-sided ones to help connect smaller, older hexagonal cells (top) to larger, newer ones (bottom).
Five- and seven-sided cells show up in pairs in the nests of honeybees (left) and two species of wasps (center and right). These insects built the five-sided cells before the seven-sided ones to help connect smaller, older hexagonal cells (top) to larger, newer ones (bottom). M.L. Smith et al/PLOS Biology 2023

“Think of someone tiling your bathroom floor,” says Michael Smith. He’s a biologist at Auburn University in Alabama. The tiles are two different sizes of hexagons. They’ll fit well together if the small ones are on one side of the floor and the big ones are on the other side. But then, he says, you’ll “have some kind of an issue when you try to [merge] them together.”

To figure out how insects solve this puzzle, Smith and other researchers analyzed 115 pictures of nests. The nests had been made by five species of honeybee, four species of Vespula wasps, which are commonly called yellow jackets, and one species of paper wasp. Team member Kirstin Petersen developed an automated image analysis tool. She’s a roboticist at Cornell University in Ithaca, N.Y.

The scientists used the tool to get data from 22,745 cells. Those data included lengths of cell walls and how many neighbors each cell has. (Smith also double-checked the data for each of the cells by hand. It was a tough job, he says, “but I was also happy to do that.”)

The automated tool allowed the team to get data from cells that aren’t perfect hexagons. Many scientists had ignored these before. Such cells were hard to measure and looked misshapen.

That turned out to be wrong.

All the bees and wasps build oddly shaped cells in pairs, one cell with five sides and one with seven. These pairs bridged the gap between small worker cells and big cells for males and queens.

A five-seven pairing has the same number of open sides — 10 — as a pair of hexagons. So it doesn’t disrupt the pattern. And the larger size of the seven-sided cell allows the bees and wasps to start making larger hexagons on the other side of it. “They’re always building the five-sided cell first, and then the seven-sided cell,” Smith says.

The buzzy math behind it all

The best way to build an array of cells of the right size can be represented by a tool called a Delaunay triangulation. Imagine a sheet of paper with dozens of dots. Now fill the sheet with triangles by connecting only neighboring dots. Finally, around each triangle, draw a circle that touches each corner. No dot should be inside any of the circles. Now, draw new lines that connect centers of neighboring circles. You’ll see a tiling of shapes that looks like the pattern of hexagons in the bee and wasp nests.

What the bees and wasps are doing is close to the best possible geometric solution, says Nils Napp. He’s a computer scientist at Cornell University. He designed a mathematical model about this. It uses equations to describe how the bees and wasps were building their nests. 

That model showed that adding bigger hexagons to the nest would slowly break the pattern. Gaps might start to form. Or the workers might need to build an unusable cell to keep their nest together. The best thing to do would be to add a five-seven pair just as the pattern reaches a certain point of disorder.

In a Delaunay triangulation (left), triangles are drawn by connecting neighboring dots (black), and the triangles are laid out so that no dot is inside a circle circumscribing each triangle. Red dots mark the centers of those circles. Connecting those red dots together (right) creates a tiling of polygons (red), like the hexagons of a honeybee or yellow jacket nest.
Triangles connect neighboring dots (black) in a Delaunay triangulation (left). The triangles are laid out so that no black dot is inside a circle that goes around each triangle. Connecting the red dots at the centers of the circles together (right) creates a tiling of polygons (red).Left: Nü es, Matthias Kopsch/Wikimedia Commons (CC BY-SA 3.0); Right: Nü es, Hferee/Wikimedia Commons (CC BY-SA 3.0)

Napp’s model predicts that, in this situation, roughly 85 percent of all non-hexagon cells are in five-seven pairs. That’s what the team also found happens in the nests of all the bee and wasp species they analyzed.

This similarity across species indicates that the building solution evolved more than once. The bees and wasps in this study had a common ancestor, but it died out some 179 million years ago. So these insects are not close relatives. They build their nests out of different materials, too. Still, “both evolved to use this five-seven rule for transitioning between hexagon sizes,” Bartlett says. “Evolution has a tendency to solve challenges optimally.”

More Stories from Science News Explores on Math