Millions of high school and college algebra students are united in a shared agony over solving for x and y, and for those to whom the answers don't come easily, it gets worse: Most preschoolers and kindergarteners can do some algebra before even entering a math class.

In a recently published study in the journal Developmental Science, lead author and post-doctoral fellow Melissa Kibbe and Lisa Feigenson, associate professor of psychological and brain sciences at Johns Hopkins University's Krieger School of Arts and Sciences, find that most preschoolers and kindergarteners, or children between 4 and 6, can do basic algebra naturally.

"These very young children, some of whom are just learning to count, and few of whom have even gone to school yet, are doing basic algebra and with little effort," Kibbe said. "They do it by using what we call their 'Approximate Number System:' their gut-level, inborn sense of quantity and number."

The "Approximate Number System," or ANS, is also called "number sense," and describes humans' and animals' ability to quickly size up the quantity of objects in their everyday environments. Humans and a host of other animals are born with this ability and it's probably an evolutionary adaptation to help human and animal ancestors survive in the wild, scientists say.

Previous research has revealed some interesting facts about number sense, including that adolescents with better math abilities also had superior number sense when they were preschoolers, and that number sense peaks at age 35.

Kibbe, working in Feigenson's lab, wondered whether preschool-age children could harness that intuitive mathematical ability to solve for a hidden variable, or in other words, to do something akin to basic algebra before they ever received formal classroom mathematics instruction. The answer was "yes," at least when the algebra problem was acted out by two furry stuffed animals -- Gator and Cheetah -- using "magic cups" filled with objects like buttons, plastic doll shoes and pennies.

In the study, children sat down individually with an examiner who introduced them to the two characters, each of whom had a cup filled with an unknown quantity of items. Children were told that each character's cup would "magically" add more items to a pile of objects already sitting on a table. But children were not allowed to see the number of objects in either cup: they only saw the pile before it was added to, and after, so they had to infer approximately how many objects Gator's cup and Cheetah's cup contained.

At the end, the examiner pretended that she had mixed up the cups, and asked the children -- after showing them what was in one of the cups -- to help her figure out whose cup it was. The majority of the children knew whose cup it was, a finding that revealed for the researchers that the pint-sized participants had been solving for a missing quantity, which is the essence of doing basic algebra.

"What was in the cup was the x and y variable, and children nailed it," said Feigenson, director of Johns Hopkins Laboratory for Child Development. "Gator's cup was the x variable and Cheetah's cup was the y variable. We found out that young children are very, very good at this. It appears that they are harnessing their gut level number sense to solve this task."

If this kind of basic algebraic reasoning is so simple and natural for 4, 5 and 6-year-olds, the question remains why it is so difficult for teens and others.

"One possibility is that formal algebra relies on memorized rules and symbols that seem to trip many people up," Feigenson said. "So one of the exciting future directions for this research is to ask whether telling teachers that children have this gut level ability -- long before they master the symbols -- might help in encouraging students to harness these skills. Teachers may be able to help children master these kind of computations earlier, and more easily, giving them a wedge into the system."

While the ANS helps children in solving basic algebra, more sophisticated concepts and reasoning are needed to master the complex algebra problems that are taught later in the school age years.

Another finding from the research was that an ANS aptitude does not follow gender lines. Boys and girls answered questions correctly in equal proportions during the experiments, the researchers said.

Although other research shows that even young children can be influenced by gender stereotypes about girls' versus boys' math prowess, "we see no evidence for gender differences in our work on basic number sense," Feigenson said.

Parents with numerically challenged kids shouldn't worry that not showing a strong aptitude with numbers is a sign that Bobby or Becky will be bad at math. The psychologists say it's more important to nurture and support young children's use of the ANS in solving problems that will later be introduced more formally in school.

"We find links at all ages between the precision of people's Approximate Number System and their formal math ability," Feigenson said. "But this does not necessarily mean that children with poorer precision grow up to be bad at math. For example, children with poorer number sense may need to rely on other strategies, besides their gut sense of number, to solve math problems. But this is an area where much future research is needed."