It’s an illusion that dates back to Roman magicians, but the “cups and balls” trick continues to awe: three overturned cups, three balls and a magician that seems to make the balls move through one cup to another.

The trick is an audience favorite, but it may also be a window into some serious neuroscience as well. Brain experts say they can learn a lot about attention, perception and brain cognition from magicians, who have been practicing sleight of hand to distract and deceive audiences’ minds for thousands of years. And now the relationship goes both ways: A new study examining the cups and balls trick shows magicians can improve their craft with the help of science, too.

“How is that you can see David Blaine do a trick and you’re still fooled a year later when you see someone else do it?” says Stephen Macknik, the director of the Laboratory of Behavioral Neurophysiology at the Barrow Neurological Institute and a co-author of the study, which appears in the journal PeerJ. “The answer is they have all these techniques to make these illusions more robust than what we do in science. We needed to learn their techniques, poach them, bring them back to the laboratory, and we could increase the rate of discovery in neuroscience.”

Macknik and his co-author, Susana Martinez-Conde, have worked closely with Penn & Teller and other top magicians in the world to develop neuromagic, or the study of how magicians’ techniques can help neurologists better understand brain functions. Carrying out the first-ever scientific analysis of the cups and balls trick, however, allowed the two to also give back to the magic community by analyzing which elements in a magic trick are most successful at creating an illusion.

When Penn & Teller perform the cups and balls trick, they throw an additional variation into the mix: After performing the trick with the traditional cups, they repeat the illusion with transparent cups. The mechanisms of the illusion are so effective, however, that audiences are still deceived even when they can see through the cups and presumably track the journey of the balls.

“It’s more impressive, not just because of the cups, but also because the audience has already seen it,” says Martinez-Conde, the director of the Laboratory of Visual Neuroscience at the Barrow Neurological Institute. “They’re breaking several of the main axioms of magicians, one of which is to never do the same trick in front of the same audience twice.”

Teller (he’s the quiet one) first developed the transparent cup variation in a Midwestern diner while playing around with an empty glass and rolled-up paper napkins. He placed a napkin ball on the top of the glass and tipped it over with one hand while he slipped another napkin ball underneath the glass with the other. The falling ball captured his attention so strongly that he didn’t noticed the second ball enter the glass. Teller thought that would make an ideal trick for a show, and figured the drop technique would be key to distracting audiences enough for the illusion to work.

Macknik and Martinez-Conde decided to investigate Teller’s hunch and document whether dropping the ball from the top of the cup really does steal viewers’ attention. As part of the study, they showed participants video clips of Teller performing the cups and balls routine using one of six different manipulations to distract their attention: One involved the tip-and-drop technique, others involved dropping the ball to the floor, or raising the ball to the participants’ eye level, or, in the simplest trick, sticking the ball to the bottom of the overturned cup with tape while Teller surreptitiously loaded the cup with another ball or “removed” a ball from the upside-down cup. Teller repeated each series twice, once with opaque cups and another time with transparent cups. Macknik and Martinez-Conde tracked the eye movements of the participants and also asked them to push one of two buttons to report whether they thought a ball was to calculate which manipulations were the most effective at misleading audiences. In some videos, Teller’s face was blacked out to test whether the direction of his gaze during the trick has any effect.

It came as no surprise that participants’ perceptions about the placement of the balls in the cups were more accurate when Teller used transparent cups. But contrary to Teller’s intuition, dropping the ball from the top of the cup was not the most effective way to trick audiences. Putting tape on the inside of cups to suspend balls fooled viewers the most. Lifting the balls from the table to the tops of the cups, instead of dropping them, held viewers’ gaze longer, and Teller’s gaze during the trick had no effect on viewers’ perceptions at all.

These new insights aren’t ground-breaking revelations about how to do the trick, but the scientists say they reveal quite a bit about how to improve the art of illusion — by exploiting some of the biases that drive the way the brain divides its attention. The brain is most easily tricked by the stuck ball, for example, probably because our logical minds expect the ball to drop, and therefore don’t expect it to remain suspended. Likewise, bringing the ball up to eye level or dropping it on the floor directs our attention to that act, and distracts it from other activities that may be going on in the background, such as the loading of removing balls from other cups.

“All we knew before we did this experiment was the ways magicians thought about these tricks and the way they worked in the minds of spectators.” Macknik says. “Now that we know some of those insights are incorrect, we can start to get a handle on what is correct.”

The cups and balls study, for example, confirms what other Macknik and Martinez-Conde’s other research has suggested: that our ability to focus on multiple things at the same time isn’t as strong as we thought.

“The fact that magic works is evidence that multitasking doesn’t exist, because if it did, you’d be able to see the method behind every magic trick,” Macknik says. “If being able to simultaneously attend to multiple things happening at once was possible, there’d be no magic trick.”

Macknik and Martinez-Conde aren’t setting out to tell magicians how to do their jobs, but they hope the relationship they’ve established with the magic community will continue to benefit both worlds. Neuromagic has already helped scientists learn basic truths about the brain that magicians have been exploiting for thousands of years, and now, researchers are returning the favor.

“We really have arrived at a symbiosis of both disciplines,” Martinez-Conde says. And, perhaps, better magic tricks as well.