Females influence the gender of their offspring so they inherit either their mother's or grandfather's qualities. 'High-quality' females -- those which produce more offspring -- are more likely to have daughters.

Weaker females, whose own fathers were stronger and more successful, produce more sons.

The study, by scientists at the University of Exeter (UK), Okayama University and Kyushu University (Japan), is published January 9 in the journal Ecology Letters. It shows for the first time that females are able to manipulate the sex of their offspring to compensate for the fact that some of the genes which make a good male make a bad female and vice versa.

The research focuses on the broad-horned flour beetle, Gnatocerus cornutus, but the team believes the findings could apply to other species across the animal kingdom, even mammals.

Male flour beetles with large jaws have the most mating success and win the most fights, so are seen as 'high quality'. However, the muscles and body shape needed to carry the massive jaws mean that large-jawed males father daughters with a more masculine body-shape, less adept at carrying eggs. This means that these successful males father daughters who produce fewer offspring.

Poor-quality females produce more sons who inherit their grandfather's good qualities. Conversely, high-quality daughters, fathered by poor males, produce relatively small-jawed and weak sons, and compensate by producing more female offspring that will inherit their mother's good attributes.

Corresponding author Dr David Hosken of Biosciences at the University of Exeter (Cornwall Campus) said: "Our study shows females are able to bias the sex ratio of their offspring in surprising and subtle ways. These findings shed new light on why some families have lots of sons, while others have mainly daughters. Of course everyone will be interested to know if the study can help explain why this sometimes happens in human families but I'm afraid we can't answer that!"

The broad-horned flour beetle is a well-known pest that feeds on flour and grains, such as porridge and semolina. Around three to four centimetres long and reddish-brown in colour, they live all over the world.