On the first day of class every semester, Portia Dyrenforth asks the students taking her psychology course whether they think couples with similar personalities are more likely to be happy together.

Inevitably, she says, they nod.

Then she asks whether they know any couples who are very different from each other but still seem quite content in their relationships.

They nod at this one, too.

“It’s the idea that opposites attract or birds of a feather flock together,” she says.

Both of the truisms are regularly trotted out by relationship experts proffering advice and long-married couples rationalizing their success.

Online dating sites like eHarmony.com have even built businesses around the belief that people with similarities make better matches in the long run. OppositesConnect.com is betting the reverse is true.

Two years ago, Dyrenforth, a professor at Hobart and William Smith Colleges in Upstate New York, decided to try to get to the bottom of the discrepancy.

To assemble a large and varied group of couples to examine, she turned to data that had been collected by demographers in Australia, Germany and Britain. (She found no studies in the U.S. that were extensive enough to fit her purposes.) In all, 11,625 married couples were included in the study, recently published in the Journal of Personality and Social Psychology.

Dyrenforth, working with three other psychologists, examined the data with a few questions in mind: Do personality traits influence a person’s happiness in general and in the context of a relationship? Can a spouse’s personality affect the happiness of his or her partner? And does having similar personalities affect the couple’s relationship satisfaction?

The traits Dyrenforth looked at were extroversion, agreeableness, conscientiousness, emotional stability and openness to experience – often referred to as “The Big Five” by psychologists.

She found that people with high levels of all those characteristics were more likely to be happy with life in general and with their relationships. Emotional stability, in particular, seemed to be a crucial component for personal happiness.

More surprising to Dyrenforth was that a partner’s traits can also influence happiness. People who have spouses with high levels of agreeableness, conscientiousness and emotional stability were more likely to be happy in their relationships and with life as a whole.

As for sharing common characteristics? It didn’t seem to matter much, Dyrenforth found.

That, she says, explains why opposites do occasionally attract, and birds of a feather will sometimes flock together. And either kind of pairing can work just fine, she said.