For more than a century, scientists have known that our pupils respond to more than changes in light. They also betray mental and emotional commotion within. In fact, pupil dilation correlates with arousal so consistently that researchers use pupil size, or pupillometry, to investigate a wide range of psychological phenomena. And they do this without knowing exactly why our eyes behave this way. “Nobody really knows for sure what these changes do,” said Stuart Steinhauer, who directs the Biometrics Research Lab at the University of Pittsburgh School of Medicine.

While the visual cortex in the back of the brain assembles the images we see, a different, older part of our nervous system manages the continuous tuning of our pupil size, alongside other functions—like heart rate and perspiration—that operate mostly outside our conscious control. This autonomic nervous system dictates the movement of the iris, like the lens of a camera, to regulate the amount of light that enters the pupil.

The iris is made of two types of muscle: in a brightly lit environment, a ring of sphincter muscles that encircle and constrict the pupil down to as little as a couple of millimeters across; in the dark, a set of dilator muscles laid out like bicycle spokes, which can expand the pupil up to 8 millimeters—approximately the diameter of a chickpea.

Cognitive and emotional events can also dictate pupil constriction and expansion, though such events occur on a smaller scale than the light reflex, causing changes generally less than half a millimeter. But that’s enough. By recording subjects’ eyes with infrared cameras and controlling for other factors that might affect pupil size, like brightness, color, and distance, scientists can use pupil movements as a proxy for other processes, like mental strain.

Princeton psychologist Daniel Kahneman showed several decades ago that pupil size increases in proportion to the difficulty of the task at hand. Calculate 9 times 13, and you pupils will dilate slightly. Try 29 times 13, and they will widen further and remain dilated until you reach the answer or stop trying. As Kahneman says in his recent book, Thinking Fast and Slow, he could divine when someone gave up on a multiplication problem simply by watching for pupil contraction during the experiment.