In 2008, research suggested there was no gender gap in math performance in the US. From second to 11th grades, girls did just as well as boys on state standardized math tests.

A new, well-designed, and large study suggests otherwise. It looks at younger children and shows that there is a tiny gender gap when kids start school (albeit larger among the very top performers) and that it widens, across all ability levels, through third grade. That’s a critical timeframe, as past research shows that early math achievement determines a child’s interest and confidence in the subject during elementary and middle school, and strongly predicts how good at math she’ll be later on.

Perhaps most unsettling is the study’s finding that teachers perceive girls with nearly identical mathematical abilities—and identical behavioral profiles—to be significantly less able than their male counterparts, and that bias itself is part of the reason girls end up doing worse.

A team of researchers used two sets of data from the National Center for Education Statistics’ Early Childhood Longitudinal Program, which tracks kids over time starting in kindergarten—one group starting in 1998-99, and the second in 2010-11.

Every year, the Department of Education tested the students (and did not show the results to their teachers). At the same time, the teachers were asked to rate their students’ various math-related abilities on a 5-point scale, evaluating things like how a student “orders a group of objects,” “solves problem involving numbers using concrete objects,” “shows an understanding of the relationship between quantities,” and “models, reads, writes, and compares fractions.”

Teachers also rated children’s behavior—known to influence perceptions—across categories like self-direction, organization, persistence, and eagerness to learn.

The researchers looked at how the kids performed on the tests and compared that to how teachers estimated their abilities and mindsets.

They found that when kindergarten starts, girls represent 48% of children in the 50th percentile, those whose performance is right in the middle of the distribution. By the end of second grade, they make up only 38%.

The effect is even more pronounced at the top end of the range. Girls make up 33% of the 99th percentile—the very top performers—at the start of kindergarten, and by the end of second grade they are only 15%.

One explanation for why the results of this study, published in October in AERA Open, are so different from the one in 2008, which found no gender gap, might be the tests that were used. In 2008, researchers used state-standardized tests, which teachers can prepare children for. The tests in the data set used in the recent study were adaptive, which adjusts the questions based on kids’ answers to previous items.

This is important because some have argued that girls are better than boys at applying strategies for test-taking, so would do better in state tests for which they’ve been prepared. An adaptive test, according to this reasoning, doesn’t reward such strategies, and so is a better measure of a child’s true mathematical ability. Others have argued that girls respond differently (pdf) in competitive environments. In addition, the adaptive test is harder, says Joseph Cimpian, a professor at New York University and one of the authors of the study.

Whatever the reason, the gender gap at a young age matters because it predicts future success in math. Kids in top-performing math groups in grade school are more likely to pursue future careers in computer science and other STEM (science, technology, engineering and math) professions. Women are significantly underrepresented in high-paying, math-intensive fields, earning only 19% of bachelor’s degrees (pdf) in engineering in the US and only 18% of computer-science degrees.

To reverse the trend, teachers need to be aware of how they can influence girls’ abilities, Cimpian says. “Half of the growth of the gender gap is due to teachers having lower expectations of girls,” he argues. When teachers assume their female students can’t do math problems, it drives girls’ confidence in math down: The 2012 Program for International Student Assessment showed girls felt more math anxiety than boys and that, in turn, was correlated with poor long-term math performance.

“It’s not the most uplifting research,” Cimpian says. “Hopefully by making people aware of it, it will force them to think of their own biases.”