It is tempting to assume that animals need large brains to perform complicated tasks, but the immense skills of some insects and worms suggest small brains are surprisingly powerful

A bumblebee flies up to inspect a flower, looking for a taste of nectar. It buzzes around a bit and realises that something is different. The bee can see the flower but cannot reach it.

That is because the "flower" – actually a blue plastic disc with sugar water in the centre – is sitting underneath a sheet of transparent plastic. Luckily for the bee, there is a string attached to the flower. All it has to do is pull on the string, haul out the flower, and sip its reward. So it does.

"When we first started the string-pulling experiments, it was almost a joke," says Lars Chittka of the Queen Mary University of London in the UK. "I laughed my head off when I first saw it. It just looked very funny."

But there is more. Once one bee figured out what it needed to do to access the artificial flower, other bees that were looking on learned the string-tugging trick themselves. The technique even outlasted the original successful bee. It became part of the colony's skillset, transmitted from bee to bee after the first string-pulling bee had died.

"I just couldn't believe what I was seeing," says Chittka.

Bees, it turns out, can solve problems, learn from each other, and pass down that knowledge through generations.

Chittka's lab did an experiment in the 1990s in which they asked whether bees can count. They can

Yet learning to pull on a string is just the latest thing that we now know bees can do. The incredible capacity for learning amongst bees and other social insects has been documented since Victorian times.

Charles Darwin himself suggested that learning could happen across species. He noted that honeybees might learn from watching bumblebees extract nectar in a novel way.

Bees can also learn to recognise colours and patterns. Can they find their way back home from several kilometres away? Not a problem. Recognise human faces? That too. Can bees use tools? Well, that is what Chittka wants to answer next.

Chittka's lab did an experiment in the 1990s in which they asked whether bees can count. They can.

"At that point, we began to scratch our heads a little bit," Chittka says. "How much cleverness can you stick into a tiny brain?"

Bees fly up to 10km away from their hive, through a landscape cluttered with trees and other landmarks

Many people might assume that sophisticated behaviour begins with a large brain. After all, humans have unusually large brains – containing about 86 billion neurons – and we are also an astonishingly clever species. The two characteristics must be linked.

But the more scientists learn about the behaviour of insects and other small animals, the clearer it becomes that complicated skills do not necessarily require a big brain.

"How far can we push these little brains to do surprising things?" asks Chittka. "And should we be as surprised as we are that little-brained creatures can solve these puzzles?"

It now seems that the answer to the latter question is no: we should not be surprised.

For instance, dragonflies zip through the air, catching mosquitoes, moths, butterflies and even other dragonflies.

It is a harder task than appearances might suggest. Each different prey species has a unique flight pattern. The dragonfly has to watch how its prey is flying, predict its likely trajectory, and then move to try to intercept it mid-flight. This requires behavioural flexibility and planning.

Researchers have even worked out exactly which individual neurons are responsible for the formation of this memory

Meanwhile, bees fly up to 10km away from their hive, through a landscape cluttered with trees and other landmarks. They have to find the best flowers with the greatest pay-off of nectar, and remember their locations. They also have to avoid predators and make it back home again, where they then communicate with other bees in intricate social interactions.

These creatures have complex worlds, and need the cognitive capacity to survive in them.

Even a simple nematode worm, an animal less than 1mm long and with only 302 neurons in its entire nervous system, is capable of basic learning and memory. Newly-hatched nematodes that encounter toxin-emitting Escherichia coli bacteria remember to avoid the microbes for the rest of their four-day lifespans.

Researchers have even worked out exactly which individual neurons are responsible for the formation of this memory and for retrieving it later on.

If such minute brains are capable of these cognitive tasks, how exactly do they do it? To understand this, we need to get down to the level of the individual neurons and the circuits they form.

Neurons act a little like wires, carrying electrical signals from one part of the brain to another. They are a biological version of the circuit board in a computer.

There are powerful research tools that allow Vivek to selectively switch on or off different parts of the brain

Studying this circuitry is key to understanding cognition, and it is easier to do in small brains with hundreds or thousands of neurons than in large brains with billions. Tiny brains have to pack the maximum computational power into a small space, so they have evolved minimal wiring solutions.

Vivek Jayaraman, at the Janelia Research Campus in Ashburn, Virginia, studies fruit flies. With 250,000 neurons, fruit fly brains are about a quarter of the size of a bee's.

"The brain has to solve computational problems in order for behaviour to unfold," explains Vivek. "And complex behaviour involves solving a bunch of these problems."

Vivek, an engineer by training, wants to understand the mechanics underlying the behaviour. How does the brain do cognition? For this, he needs to see what the neurons are doing as the behaviour unfolds.

Vivek and his colleagues showed that fruit flies have a sort of mind's eye

But can we step into the brain of a fruit fly and listen in to what they are thinking? Well, sort of. There are powerful research tools that allow Vivek to selectively switch on or off different parts of the brain, then watch as neurons activate in real time.

For instance, one measure of cognition is being able to keep track of where you are in space – an internal representation of the world around you. Having an internal representation means that if the lights suddenly go out in the room you are in, you still know which direction you are facing, where the door is, and how to get to the kitchen where you have a flashlight in the drawer.

You are able to maintain awareness of your body position relative to objects in the room and how to move around within that space. Think of this as your mind's eye.

In 2015, Vivek and his colleagues showed that fruit flies have a similar sort of mind's eye.

The scientists used a technique that allows them to see individual fly neurons turning on and off in real time as the insect navigates through a virtual reality world.

This little insect... essentially has a picture in its head of where it is

The fruit fly walks on a tiny treadmill – actually a ball that rotates as the fly walks forward, stops, or moves in any direction. At the same time a screen surrounds the treadmill, like a fly version of an Imax movie, onto which the researchers project lights.

As the fly walks around on the ball, the lights on the screen move in response, as if the fly were moving around in the real world. So if the fly turns to the left, its world on the screen correspondingly moves to the right.

The researchers are able to watch as different parts of the fly's brain become active as the fly navigates this world. Then they turn off the lights. Just as in humans, the fly brain continues to respond as if the lights are on even after they are switched off. It maintains an internal representation of its surroundings.

Cognitive representations like this were previously thought to be the sole domain of backboned animals like us, but that might not be the case.

With just a few hundred or thousand neurons, you can easily recognise perhaps a hundred faces

"The fact that this little insect can sit in the darkness, and essentially has a picture in its head of where it is, is pretty remarkable," Vivek says.

The next step is to find out if this internal representation is flexible. If your roommate tells you that he has moved the flashlight from the kitchen to the bedroom, your internal representation must change to accommodate this new information.

"That for me is a kind of building block of cognition," Vivek says. "The ability to plan based on an internal representation and a memory, rather than just responding to what we see right now."

Can the fruit flies do something similar even with their tiny brains? We may know before too long.

"There is a general perception," says Chittka, "that because we are big-brained, in order to do clever things you need to have very big brains. But that's not actually the case."

For instance, the ability to recognise faces, which was once thought to be a uniquely human ability, turns out to require a relatively simple neural circuitry – which probably explains how bees can carry out the task.

There are some things that a bigger brain might allow, but some of them might be fairly boring

"With just a few hundred or thousand neurons, you can easily recognise perhaps a hundred faces," he says.

So why bother having a bigger brain?

One reason why large animals have larger brains may simply be that the electrical signals have to travel longer distances. For the signal to travel at a reasonable speed, you need larger neurons, which can carry signals faster than small neurons. So a whale has a large brain with big neurons because a signal has a long way to travel from one end of its body to the other.

Or maybe it is not the whole brain that needs to be bigger, but just one part of it. For instance, animals that have large home ranges, or cache food in thousands of places like a Clark's nutcracker, tend to have a relatively large hippocampus – the part of the brain involved in memory. They can remember more things than bees.

"In that case," says Chittka, "the increase in capacity might be just one of storage size – just as you might have a computer with a bigger hard drive but not necessarily a better processor. There are some things that a bigger brain might allow, but some of them might be fairly boring."

Bigger brains might just replicate the same circuits over and over, giving you more of the same behaviour – greater storage capacity, better acuity, more detail, precision, and finer resolution of responses – but not necessarily new computations or layers of complexity.

Chittka points out that sometimes, bigger brains certainly do mean more complexity – as in the case of our brains, for instance – but it is not automatically the case.

I think understanding at a basic level will take a long time, but I'm in a hurry

Humans tend to be a little defensive about their complex, big brains. Vivek says that people often say to him, "wait, you get paid to work with fruit flies?" They want to know what this can teach us about human cognition.

"People think that it's cool or cute," he says. "But it's more work to explain why it's important and what you can learn."

The message of his work is actually straightforward: if you want to learn how something complex works, start by studying something simple.

In this case "simple" is a relative term, because neurons and their connections are anything but simple. "But at least numerically, there are fewer neurons [in the fruit fly brain], it's compact, I can see a bunch of them at the same time," says Vivek. "And I have the tools to manipulate them and tinker with the different parts at will."

Because of this, he is able to address mechanistic questions that cannot yet be answered in bigger brains.

"I don't by any means think that this is the very end of how cognition is done," says Vivek. Instead, he thinks the relatively simple circuits he is studying are building blocks of cognition. "I think understanding at a basic level will take a long time, but I'm in a hurry – I want the answers in my lifetime!"

Bigger brains might just replicate the same circuits over and over, giving you more of the same behaviour

Chittka also sometimes laments the obsession with finding human-like abilities in other animals. "I find that a bit tedious and too narrow," he says.

The sensory abilities that insects have but humans do not – like sensitivity to ultraviolet, infrared, or polarised light, or an internal magnetic compass for navigating – are captivating on their own. Perhaps we could let go of looking at cognition in terms of human abilities.

"One of the very reasons I find insects fascinating is because they're so weird, so different, so non-human-like," Chittka says.

Surprises really do come in small packages.

Join over six million BBC Earth fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital, Travel and Autos, delivered to your inbox every Friday.