Most parents agree that the teenage brain is a mystery, but it may be a surprise to learn that scientists find it puzzling as well, though for different reasons.

A couple of aspects of teenage brain development have perplexed the medical community for some time, however. One is that the brain’s most high-level processing area, the cortex, seems to shrink during the teenage years. The other is that the female brain tends to have less volume than the male brain, despite the fact that young women and men have similar cognitive capabilities.

But researchers from the University of Pennsylvania managed to come to terms with both of these issues in one elegant study.

Gray matter density increased as teens grew older, and this is probably the most telling measure.

The research team looked at the brains of almost 1,200 participants aged 8 to 23 years, using MRI to measure the volume, density and mass of the gray matter (the brain cells themselves), and the thickness of the cortex in more than 1,600 areas of the brain.

The human brain continues to develop right through early adulthood — which is why it’s important for kids and teenagers to treat their brains well. Gray matter volume and mass, and cortical thickness, decreased as teens became older, but other, more important measures increased. Gray matter density increased as teens grew older, and this is probably the most telling measure. The density of the neurons themselves, rather than the other stuff — support cells and tracks between cells — strongly correlated with cognition. It makes sense that during this robust period of development — adolescence — the density of the neurons would be increasing.

It also explains why women are just as smart as men even though they have smaller brains (proportional to their smaller body size). Women’s gray matter density was found to be higher in the study, which would make up for the fact that their total volume is slightly less.

“It is quite rare for a single study to solve a paradox that has been lingering in a field for decades, let alone two paradoxes, as was done [in this study],” said study author, Ruben Gur, in a news release. “We now have a richer, fuller concept of what happens during brain development and now better understand the complementary unfolding processes in the brain that describe what happens.”

Adolescence is an important time for development. Respect your teenagers’ growing brains, and try to support them as much as possible Try to make sure your kids eat well, get enough sleep, and pay attention to their mental health. Your teenager may not thank you in so many words, but their brain (eventually) will.

The study is published in the Journal of Neuroscience.