To reinforce our findings, we repeated the study using androgynous faces, created on a computer by melding male and female features. We then produced “male” and “female” versions of each face by adding gender-typical hair. Our test subjects, who were unaware of this ruse, were again more likely to attribute an internal, emotional cause to the poses in the faces with female hair, and more likely to attribute a situational cause to the poses in the faces with male hair.

Or as we summarized our discovery: “She’s a bitch, but he’s just having a bad day.”

This discrepancy can have serious consequences. As several studies have demonstrated, when women visit emergency rooms complaining of chest pressure and shortness of breath, which are potential signs of heart attack, they are more likely than men to be told the cause is anxiety (i.e., something about their emotional disposition), and sent home. Men with the same symptoms tend to receive preventive treatment for heart disease. This is a major reason that women die more frequently of heart attacks than men do.

People in many cultures believe that women are more emotional and empathic, whereas men are more stoic and analytical. Both men and women hold these beliefs, even about themselves. However, when my lab has asked people to record their emotional experiences as they occur in everyday life, we have found no differences between men and women on average. And when scientists have compared the brains of men and women, they have found no gendered hard-wiring for emotionality or rationality. In other words, these beliefs about men and women are based on stereotypes.

And it turns out that people are highly protective of these stereotypes. When a woman violates her emotion stereotype, people tend to view her as less likable and less trustworthy. We see this in the courtroom, for example, when women accuse men of rape or domestic violence. As researchers have shown, if a woman expresses grief on the witness stand, consistent with stereotypes about female emotionality, the judge is more likely to hand down a harsher sentence to the defendant. But if a woman expresses anger, violating the stereotype of a female victim as fearful, passive and helpless, the judge’s sentence tends to be lighter.

Today, these stereotypes are playing out on the national stage. Polls indicate that Mrs. Clinton is seen as a more credible candidate than Mr. Trump, yet less trustworthy and likable. This discrepancy is surely rooted, in part, in Mrs. Clinton’s violations of female stereotypes. When she acts “presidential,” she is seen as harsh and cold. In contrast, when Mr. Trump insults his critics or rails against immigrants, many people attribute his anger to the situation (terrorism, the economy) rather than to something about his inner nature. She’s ingenuine; he’s giving voice to the feelings of his fellow Americans.