Why are there still so few women in science and tech?

FORTUNE — When Karen Purcell decided to major in electrical engineering, even male friends whom she’d tutored through math classes were surprised. “The typical reaction from almost everybody was, ‘Engineering? Why?’ or ‘Do you know what you’re getting yourself into?’” she recalls. Even now, as president of PK Electrical, an award-winning electrical design, engineering, and consulting firm based in Reno, Purcell runs into the occasional client on a construction site who “automatically looks to a male team member for answers, even if he’s fresh out of school,” she says. “I get called ‘honey’ and ‘dear’ a lot, too.”

Most women in engineering and tech can probably identify — not that there are many of them. Despite a scattering of high-profile female tech executives like Sheryl Sandberg and Ginni Rometty, women still hold only about 20% of all computer science jobs. A tiny 7% of CIOs are female, and one in seven engineers, despite the fact that women hold 60% of all bachelor’s degrees and make up 48% of the workforce overall.

MORE: Why CEOs should read Sheryl Sandberg’s book

To help close that gap, Purcell wrote a book, Unlocking Your Brilliance: Smart Strategies for Women to Thrive in Science, Technology, Engineering, and Math. The proceeds will help finance STEMspire, a nonprofit she launched last summer to offer scholarships to female STEM students and seed money to women starting tech and engineering companies. In a recent conversation, Purcell talked about why there are still so few women in these careers, and what it will take to change that.

Fortune: Why does it matter that STEM careers are still pursued mostly by men?

Purcell: It matters for a couple of reasons. First, women themselves are missing out on great opportunities by not going into these fields. The Department of Commerce is predicting that STEM job openings will grow 17% by 2018, a much faster rate than most other careers. And these are among the highest-paying fields too, in part because of that rising demand.

But beyond that, in very practical terms, the shortage of women leads to problems like mistakes in product design. Look at what happened when automotive engineers designed the first airbags, for example. The airbags were designed to fit the body dimensions of the all-male design team. So when the airbags deployed in car accidents, people with smaller body sizes — women and children — were at risk of injury. Something similar occurred with voice-recognition software, which at first was calibrated to recognize only male voices. Having more women around helps companies design products that will work for all their customers, not just the male half.

So why aren’t there more women in engineering and tech jobs?

The gap starts very early, when girls in middle school and high school start getting subtle messages that math and science are for boys. Even though plenty of research shows that girls do just as well as boys on standardized math tests, there is this unintentional bias among parents and educators that pushes boys toward science and math, and nudges girls away. Luckily, that is starting to change.

MORE: 5 professions ruled by women

What are some ways that women already in STEM jobs can gain recognition and move up?

One of the lessons I learned the hard way, which I talk about in the book, is that women need to learn to speak up. Earlier in my career, when I was surrounded in project meetings by men with Type A personalities, voicing my opinions was a real struggle for me. I realized that I had to talk louder in order to be heard, and not be afraid to jump into a conversation. Some women already have strong communications skills but, for those who don’t, it can be tremendously important to focus on developing them.

Mentors can make a big difference, all through your career. At any stage, but especially when you’re just starting out, there are several organizations that can connect you with a mentor, like the Association of Women in Science, the Institute of Electrical and Electronic Engineers, or the National Center for Women and Information Technology. Your peers at work can also be very helpful. You need to build a supportive network around you.

You also need clear goals and a strong sense of confidence. No matter what obstacles get in your way, keep going.

You mention toward the end of your book that you hope the book will be obsolete in 10 years. Why do you think it might be?

One of the biggest reasons is that the cultural bias is changing. There are at least a dozen national programs now, outside of schools, to encourage young girls who are interested in math and science. The Society of Women Engineers sponsors one called Aspire. Companies interested in developing future employees are getting involved, too. Microsoft (MSFT), for instance, runs a high-tech camp for girls. Even the Girl Scouts sponsor a math and science program, which certainly didn’t exist when I was a scout. So I think in a few years we’ll see more young women choosing STEM careers — and succeeding brilliantly at them.

Subscribe to Well Adjusted, our newsletter full of simple strategies to work smarter and live better, from the Fortune Well team. Sign up today.