Barack and Michelle Obama recently invited Amy Chyao, a 16-year-old high-school junior from Texas who is working on a new cancer treatment, and Mikayla Nelson, a high-school freshman from Montana who designed an innovative solar-powered car, to sit in the first lady’s box during the president’s State of the Union Address.

It was a nice gesture, but the president didn’t tell the truth about the girls. He left that to Eva Longoria’s flighty character on Desperate Housewives.

“Now girls, if it were up to me, I’d say avoid math and science—they cause serious frown lines,” Gabrielle Solis advised high-school students during a recent episode. “Young girls today need to know the dangers of long division.”

Obama didn’t mention that, as good as Chyao and Nelson might be at science and math, those subjects would not hold their interest in the long run. If they were like their peers, their proclivities would emerge once they finished college: When it came time to pick a profession, they would find their hearts were not in science and engineering.

Less than one in five professors of science and math at top research universities in the United States is a woman. The gender distribution of engineers at top Silicon Valley companies is similar to the gender distribution of the audience at your average strip club. Shouldn’t the president have told girls like Chyao and Nelson to discover their real interests before wasting time on AP calculus?

Much has been written about why the number of women in science and math plummets as the intellectual demands in those fields rise with age. We’ve spent years arguing about potential differences in the brains of men and women (courtesy of the controversy spurred five years ago by the former head of President Obama’s National Economic Council), the role of discrimination, and differences between men and women in the way they balance work and home life.

Most Americans believe the doors of opportunity are wide open to careers in science and math, a view that meshes perfectly with John Tierney’s recent argument that worries about sexism are a distraction. (Alison Gopnik recently critiqued Tierney’s claim in Slate.) Anyone can become a scientist or an engineer if she has the necessary interest, determination, and talent. If fewer women than men walk through those doors of opportunity, it has to be because fewer women than men have the necessary interest, determination, and talent. Fewer women than men freely choose to become scientists or engineers.

I’d like you to meet Jane Stout, Nilanjana Dasgupta, Matthew Hunsinger, and Melissa A. McManus. These psychologists at the University of Massachusetts at Amherst recently conducted experiments on this question. Their focus was on college students, but their work has broad implications for the way we think about education and fairness.

Stout, Dasgupta, and their colleagues wanted to find out why women’s outstanding performance on science and math tests in high school and college correlates so weakly with their eventual interest in pursuing careers in those fields. In high school and college, girls increasingly earn math and science grades equal to or better than the grades of their male peers. But when it comes to choosing a career in math or science, more men than women choose to walk through those open doors.

The psychologists asked female students studying biology, chemistry, and engineering to take a very tough math test. All the students were greeted by a senior math major who wore a T-shirt displaying Einstein’s E=mc2 equation. For some volunteers, the math major was male. For others, the math major was female. This tiny tweak made a difference: Women attempted more questions on the tough math test when they were greeted by a female math major rather than a male math major. On psychological tests that measured their unconscious attitudes toward math, the female students showed a stronger self-identification with math when the math major who had greeted them was female. When they were greeted by the male math major, women had significantly higher negative attitudes toward math.

In a more ambitious experiment organized with the university’s math department, the psychologists evaluated how undergraduates performed when they had male or female math professors.

They measured, for instance, how often each student responded to questions posed by professors to the classroom as a whole. At the start of the semester, 11 percent of the female students attempted to answer questions posed to the entire class when the professor was male, and 7 percent of the female students attempted to answer questions posed to the entire class when the professor was female. By the end of the semester, the number of female students who attempted to answer questions posed by a male professor had not changed significantly: Only 7 percent of the women tried to answer such questions. But when classes were taught by a woman, the percentage of female students who attempted to answer questions by the semester’s end rose to 46.

The researchers also measured how often students approached professors for help after class. Around 12 percent of the female students approached both male and female professors for help at the start of the semester. The number of female students approaching female professors was 14 percent at the end of the semester. But the number of female students asking for help from a male professor dropped to zero.

Finally, when Stout and Dasgupta evaluated how much the students identified with mathematics, they found that women ended up with less confidence in their mathematical abilities when their teachers were men rather than women. This happened even when women outperformed men on actual tests of math performance.

Think about that. On objective measures of math performance, these women were outscoring men. But their identification with mathematics was not tied to their interest, determination, or talent. It was connected to whether their teacher was a woman or a man.

These experiments suggest that subtle and unconscious factors skew the “free choices” we make. The career choices of men and women are affected far more by discrimination than by any innate differences between men and women. But it is not the kind of discrimination we usually talk about. We ought to assume that male math professors at the University of Massachusetts were just as committed to teaching young women as they were to teaching young men. And those professors were just as talented as their female counterparts. (The professors and students were not told the purpose of the experiment beforehand, so the female professors and female students couldn’t have entered into some kind of pact to boost test scores.)

The traditional model of discrimination, in which people deliberately tip the scales in favor of one group over another, still applies in some cases. There are undoubtedly sexist professors. But overt sexism does not explain these findings. In fact, that model of discrimination might be an obstacle to overcoming the real challenge.

Our reasons for feeling suited to particular professions are only partially—and perhaps tangentially—tied to our interests, determination, and talent. More than three decades ago, psychotherapists at Georgia State University studied why some women, by all objective measures bright and talented, believed they were less gifted than they were. No matter the evidence, they believed they were imposters.

It is true that fewer women than men break into science and engineering careers today because they do not choose such careers. What isn’t true is that those choices are truly “free.”

Become a fan of Shankar Vedantam on Facebook.