Nobody was going to stop her. Nobody. Certainly not the other students who might make fun of her for raising her hand in class, repeatedly, to ask questions. It was eighth-grade math, and it was hard. She asked the teacher a question. And then another. And then another. Every class, the drill was the same: Wash, rinse, repeat.

“People used to even make jokes about me because I asked so many questions,” says Kennedy Sampson, now a high school junior in Maryland. “But I needed to understand it …I had to do what I had to.”

Kennedy’s determination and grit makes her a good candidate to succeed in math.

Her voice was among more than 6,000 U.S. girls and women from ages 10 to 30 who were interviewed for a newly released study about STEM (science, technology, engineering and math) education. The study, done by Microsoft in partnership with KRC Research, finds that despite the high priority that is placed on STEM in schools, efforts to expand female interest and employment in STEM and computer science are not working as well as intended. This is especially true in technology and engineering.

While the U.S. Bureau of Labor Statistics predicts that technology professionals will experience the highest growth in job numbers between now and 2030, only a fraction of girls and women are likely to pursue degrees that enable them to fulfill these news jobs.

The reasons range from peer pressure, to a lack of role models and support from parents as well as teachers, to a general misperception of what STEM careers look like in the real world. But the research also points to ways to better support girls and young women in STEM. Those include:

  • Providing teachers with more engaging and relatable STEM curriculum, such as 3D and hands-on projects, the kinds of activities that have proven to help retain girls’ interest in STEM over the long haul.
  • Increasing the number of STEM mentors and role models – including parents – to help build young girls’ confidence that they can succeed in STEM. Girls who are encouraged by their parents are twice as likely to stay in STEM, and in some areas like computer science, dads can have a greater influence on their daughters than moms, yet are less likely than mothers to talk to their daughters about STEM, the study found.
  • * Creating inclusive classrooms and workplaces that value female opinions. It’s important to celebrate the stories of women who are in STEM right now, today.

Peggy Johnson, an engineer who is now Microsoft’s executive vice-president of business development, didn’t know what being an engineer looked like – until she got to college. She began college as a business major. She was a freshman, doing a job delivering campus mail, when she took some packages to the engineering department – and everything changed.

“The two ladies behind the desk there got super-excited when they saw a woman walking in, because they thought I was going to ask questions about engineering, but I wasn’t,” Johnson says. “I was just delivering the mail, I couldn’t understand their excitement. And they talked to me about engineering, opening up the world of what an engineering degree could do for me. They said in engineering, you can work on the world’s biggest problems and help solve for them.”

That evening, Johnson thought about what the women had said. The very next day she changed her major to engineering.

Her parents backed her choice. “It was really my mom, who had grown up in a different time, when many women didn’t go to college, who said, ‘I think it’s going to be a fantastic career for you,’ because she’d seen me love math and science all those years.”

Her mother encouraged her to “stick with it,” during the “challenging ups and downs of pursuing my engineering degree,” Johnson says. The “downs” included a professor who tried to discourage her from continuing on in her major.

“I was an electrical engineering major, but I had to take a few classes in mechanical engineering. For whatever reason, I wasn’t as skilled in that field, so I struggled. I went to talk to the professor several times. And he said, ‘I just don’t think this is the right degree for you.’”

He “almost convinced me,” she says. But her mother told her differently, yet again. “I know you’ll stick with it” – and Johnson did.

Sticking with it is something girls need to be encouraged to learn, says Reshma Saujani, founder and CEO of Girls Who Code, whose mission is to close the gender gap in technology. It is among the many STEM nonprofits supported by Microsoft Philanthropies.

“We have to rethink the way we raise our girls,” Saujani says. “Boys are pushed to take risks; girls are not. In fact, they feel like they have to be perfect at everything they do; they see getting a ‘B’ in math class as bad.

“We have to teach girls to be imperfect.”

When it comes to computer science, “The process of learning how to code is learning how to fail,” Saujani says. “We need to teach girls that it is all right to sit with that discomfort of not knowing the right answer right away.”

She also emphasises how important it is to have a dad that “doesn’t coddle you, that encourages you to try new things. You have to inspire girls to try things that they may not be good at,” she says.

John Sheehan’s daughter has always been good at math, but even so, he saw her being discouraged in classes, albeit it indirectly.

“I used to go to her schools, for the parent-for-the-day activities, and I remember math teachers praising the boys” regularly, but the girls – not so much.

That wasn’t acceptable to Sheehan, a Microsoft distinguished engineer. While his daughter didn’t say she felt disheartened, at times he sensed she was.

“She’d say, ‘Oh, this math is hard,’ and I’d say, ‘Yeah it’s hard for everybody – but you can do it.’ There was this sort of underlying feeling society was telling her that boys are better at math. It made her think when she had trouble with some particular topic, it might have something to do with the fact that she was a girl. My job as a parent was to dispel that belief.”

Sheehan is among the Microsoft employees who volunteer to educate girls about computer science and STEM. He also started a fund for girls and STEM at his alma mater in Boston.

Toni Townes-Whitley, Microsoft corporate vice president for industry, had a similar experience in school, like Johnson and Sheehan’s daughter. A high school chemistry teacher of hers was “partial to my male counterparts,” and “did not encourage girls to pursue ‘hard’ sciences.”

Townes-Whitley did not let it stop her.

“Once I recognized the bias, I made it a point to connect with the other female students, study together and outperform collectively in the class,” she says.

That spirit of determination continues in her current role. “It’s critical to mentor girls from classroom to the boardroom, across the full career continuum in STEM,” she says. “The research has indicated that there are ‘off ramps’ at different educational levels where girls leave STEM programs throughout middle school, high school and undergraduate” in college.

“It’s important to encourage, inspire and support to stay the course, and present STEM careers differently.”

Mary Snapp, corporate vice president and head of Microsoft Philanthropies, agrees. “Unless things change much faster, many in this bright, hopeful generation will not enter these fields,” she wrote in a recent post. “These are among the reasons Microsoft Philanthropies provides grants to nonprofits that prioritise increasing diversity in computer science, and more than half of beneficiaries are female.”

Snapp adds that Microsoft commissioned the research to better understand what causes girls and young women to disengage from STEM studies, what can be done to fix the problem and to share those learnings with others.

Helen Chiang, general manager of Minecraft Franchise, says both her parents encouraged her early interest in STEM. When she was in middle school, her mother drove her to the local high school “each day so I could take upper-level math and science with the high schoolers.”

When Chiang wasn’t feeling challenged enough in her regular high school curriculum – and was “considered an oddball/nerd/geek by the rest of the class because I excelled in math and science” – her parents stepped in yet again.

“They supported my passion and interests by finding me a math and science high school program so I could learn and be challenged in an environment with other kids like me,” she says, noting: “It’s incredibly hard to be an outlier, especially during the teenage years.

“Learning in a community of peers that had similar interests kept me from leaving STEM early because it wasn’t considered popular in my regular high school.”

Chiang says where she grew up, “It wasn’t popular for girls to be smart or interested in challenging subjects within STEM. I went through a period of wondering whether I should pretend to not understand subjects, or dumb myself down so that I would be liked. I have to credit my parents, who reinforced in me from an early age that it’s much more important to always be curious, always be learning and continue to challenge yourself – than to want to be liked. Friends and popularity come and fade, but what’s in your brain should stay with you a lifetime.”

Peggy Johnson can vouch for that. After she graduated college, she went on a job interview with a company that was based in another country.

“I don’t think they knew that Peggy was a female name,” she says. “And I walked in the door, and I sat down, and the interviewer looked at me and said, ‘Oh, why are you here?’ I said, ‘You posted this engineering job.’ And he said, ‘Oh, we don’t hire female engineers.’ And then he got up and left.”

Johnson remembers looking at the walls around her and thinking, “Well, I guess this interview is over.”

She picked up her resume and walked out, not letting that setback defeat her. Soon, that company’s loss would be Qualcomm’s, and later, Microsoft’s gain. And in 2017, Johnson was ranked as the most powerful female engineer in the US by Business Insider.