It's a question we've wondered about for years: how much of our character is down to our built-in genes and how much is down to the experiences we go through?

And now researchers in the UK may be closer to an answer, having developed a mathematical model that looks at what makes individuals nasty or nice, and why both types can exist together. 

Mathematical ecologist Sasha Dall from the University of Exeter developed the model with an international team of researchers, with the goal of studying the evolution of society in various types of species.

In particular, the researchers wanted to explore what's known as genetic polymorphism – the tendency for different characteristics to appear in a single species. Consider ants: whereas they're all prepared to chip in for the good of the community, that's far from the case with other creatures (including humans).

According to the researchers, the model – which was formulated from study of colony-living microbes – suggests inherited genetic tendencies can be used to predict how animals and other organisms react to others and their surroundings, rather than anything they actually sense or experience as they go through life.

"What we have been able to show is how you can get a situation where you end up with distinct levels of genetically determined niceness coexisting within populations," said Dall. The model indicates that some species rely on inherited instructions in deciding what to do, and these instructions can vary depending on genetic codes.

"Social evolution theory hasn't previously addressed genetic polymorphism," said one of the team, Olof Leimar from Stockholm University. "We have developed a model that allows us to explore this within a general framework alongside other behavioural influences. Our hope and aim is to do further work in this area to test our model experimentally."

As Leimar says, this is only a theoretical model for now, so some real-world experiments would be required to back up the researchers' conclusions – but it's important research, for having combined the idea of genetic polymorphism with the theory of kin selection (where everyone in the same society works for the greater good) for the first time.

Ultimately, the model may have something to tell us about the nature versus nurture debate in human beings as well: is your neighbour that grumpy because he's led a hard life, or was he born that way?

In fact, much modern thinking points to there being a little (or a lot) of both involved, to such an extent that some scientists think the whole nature versus nurture idea should be retired as a concept so we can approach the issue from a completely different angle.

Maybe this new mathematical model will be able to give us a fresh perspective too.

The findings have been published in PLOS Computational Biology.