Scientists have found that some people are born optimists because they have inherited a "happy gene".
The finding may help to explain why some people are always miserable while others tend to look on the bright side, the Daily Mail reported.
Professor Elaine Fox at Essex University showed more than 100 people positive and negative pictures on a computer screen, such as growling dogs and smiling children.
Volunteers supplied a sample of their DNA and they were tested to see which version they carried of the 5-HTTLPR gene, which affects levels of the "feel-good" chemical serotonin.
We inherit either two "short" versions, a long and a short version or two "long" versions of the gene.
Those with two short versions of the gene managed to focus on the positive images and avoid getting upset by the negative ones, according to the research.
Strangely this "short" version of the gene is the same one that has been associated with making people feel anxious and depressed and it suggests these people have a "very emotional" response to their environment.
"When times are really good, it is those with the highly reactive short genotype who really benefit," said Professor Fox.
"They were very response to positive images which suggests they will thrive in a supportive environment, but previous research shows they can also go under, and will be particularly devastated by a traumatic experience.
"It suggests these people are very susceptible to emotional aspects of their environment.
"Those with the long version are less reactive which means that they often fare best in fairly benign conditions but they perhaps would not gain as much from a good experience," he added.
The researchers described the finding as a mechanism that seems to explain our levels of resilience to life's general stress.
The study was published online in Biological Psychiatry.