When my first child was born, I was very happy, as many moms are, but also a little on edge. I liked the idea of being a mom, and the idea of caring for my beautiful baby, but I also felt ill prepared for my new role. Yes, I had babysat other people’s kids, and yes, I had taken the rudimentary mommy-training courses. I also realized that moms of varied backgrounds and cultures have managed to mother, and often capably, for thousands of years. Yet, I felt something like I might have if I had been appointed CEO of a major corporation as my first job out of school.

I am pretty sure I am not the only mom who has had such doubts. A friend of mine, now a mother of four, recalled her thoughts the other day as she carried her firstborn home from the hospital. “People,” she announced in her head, “you know I am leaving here with a real baby, a living person, and you are letting me take her—without supervision!” Still, I felt a little ridiculous for being overwhelmed by a task we let pretty much anyone do.

Not that people say mothering, or parenting in general, is easy. But it isn’t supposed to require any special talent, intelligence or brainpower. That lore, however, turns out to be largely false. Even a person’s ability to show love and affection for her child depends on some pretty heavy duty thinking skills—skills that may be quite difficult for some to master, and that tax the brains of virtually every mother. (Although this blog focuses on motherhood, because the research does, and because I happen to be female, I am in no way implying that the role of a father is insignificant; indeed some of the conclusions likely apply to dads as well.)

Psychologists emphasize that mothering appropriately requires many parts of the brain, including those involved in perception, emotion, movement and learning (see Scientific American Video, "Your Brain On Kids"). But one of the most important, and variable, contributors to basic parenting ability—and the parent-child bond—is a part of the brain called the prefrontal cortex that sits roughly behind your forehead. The prefrontal cortex is charged with planning, attention, reasoning, decision-making, and impulsivity. Underlying many of these “executive” functions is something called working memory, a virtual sketchpad that enables us to hold items or facts in mind briefly for the purposes of manipulating them mentally. Incidentally, working memory capacity, much research has shown, is closely associated with IQ.

In a study so new it is still under journal review, psychologist Alison Fleming at the University of Toronto at Mississauga, Andrea Gonzalez, now at McMaster University, and their colleagues tested 90 mothers on two components of executive function—working memory and cognitive flexibility—using computer-based exercises. In a test of spatial working memory, for example, they asked the mothers to collect tokens concealed by boxes. The moms had to remember which boxes they had already inspected so as to avoid checking any given box twice. If they goofed, their score went down. The moms were also rated on the strategy they used to perform this task.

In the cognitive flexibility test, mothers were to choose between pairs of different figures (shapes or lines). They had to guess at the “correct” choice at first, and then, after several trials, determine the rule that governed the correct answers. The rules would change without warning, and the participants had to adapt their strategy accordingly. The score depended on their error rate for each rule.

After performing the cognitive assessments, the researchers videotaped these mothers interacting with their six-month-olds at home, observing how they responded to the babbling, cries and gestures of their infants, what the infant does in turn, and so on. They gave each mother a score on how attuned she was to her baby’s cues.

Gonzalez and Fleming found that the mothers who did well on the executive function tests—those who have better working memories and are flexible thinkers—were also more sensitive to their babies’ needs than those who got lower cognitive scores. Scientists have garnered parallel findings in rodents. Mommy rats vary in how much they lick and groom (read: cuddle, care for) their pups. The good mommies do this a lot. It turns out that rats that groom their pups more also do better at rodent tests of executive function than those who groom less.

Why does executive function matter so much for mothering? To take care of a baby’s needs, mom needs to be able to juggle tasks, to prioritize on the fly, rapidly, repeatedly and without a lot of downtime. She must determine where to put that dish she carrying to rush over to stop baby from crawling down the stairs. She must decide whether to drop the laundry to prevent her child from rubbing carrot puree into his hair one more time. She must ponder: Should I stop mopping up this spill to help my wailing toddler retrieve a toy that is out of reach? Can my brain manage that decision along with five others I will have to make in the next 10 minutes? And after I help my child, can I remember what I was doing before she needed my assistance?

Mothering tests your attention span, ability to plan, prioritize, organize and reason as much as does a day at the office. And if you are a good planner, you can cope better when interacting with your child. “It makes sense, given the demands of motherhood, that it would depend on executive function,” Gonzalez says. “But nobody had looked at it [until now].”

Interestingly, working memory is related to impulse control, and a person’s ability to reassess a situation so as to respond less negatively toward it. A mother’s working memory capacity can influence how emotionally she reacts to her child’s behavior. In a study published last year, psychologist Kirby Deater-Deckard at Virginia Polytechnic Institute and his colleagues show that women with poorer working memories react more negatively to difficult behavior by a child than do women who score higher on working memory tests. Women with more minimal working memory capacity find controlling their feelings difficult in the face of such challenges, a fact that may result in more frequent mistreatment of the child.

All of this data helps explain why teenage moms have such a hard time. The prefrontal cortex is not fully developed even by age 20, so teens cannot react flexibly and make quick decisions as well as an older mom can. As a result, they are less responsive to their babies. They are also more impulsive. Working memory, less developed in teens, also helps control emotions. And, in fact, a new study by the Toronto team confirms that poor executive function in young moms makes it difficult for them to mother effectively. In their investigation, teenage moms performed abysmally on tests of working memory, cognitive flexibility and impulsivity compared to older moms--and were also a lot less sensitive to their babies. In fact, the worse a teen mom did on the cognitive challenges, the lower she scored on the maternal sensitivity scale.

What’s the lesson here? It is not to label anybody an unfit mother or to further stratify women over who does this difficult job the best. As I see it, brain science helps explain, and justify, the frustration inherent in being a mother, no matter who you are. So if mundane tasks such as making a meal or running an errand seem like solving a Rubik’s cube when children are involved, we can say “It’s okay.” In fact, scientists who study motherhood and the brain say that given how complex parenting is, it is amazing that most humans manage it at all. For mothers who are depressed or economically disadvantaged, motherhood presents an especially difficult challenge, Gonzalez says.

In the end, all this hard work may pay off, though—and not just for the child. Giving your prefrontal cortex a workout is likely to make it stronger. “I would wager that you would get better at these executive skills,” says Fleming, “at least in learning what to attend to, what is safe to ignore—and how to most efficiently to multi-task when looking after multiple children.” Although this conclusion is just a reasonable guess—nobody has bothered to prove it yet—it casts doubt on a complaint I’ve heard from many mothers that their babies have depleted their brainpower. The opposite may be closer to the truth.

The ability to show love for your child and care for him or her is not only a matter of will or spirit. It also requires finesse. Now, when I see a mom react poorly to her child’s antics (something I would never do, of course), I will just blame her working memory. And when I find a mother who can remain calm amid chaos, I will marvel at her cognitive flexibility, intellect and maybe also that vague concept we call willpower.