Getty Images/Pascal Le Segretain Happiness is one of the most important things in life, yet it's also one of the hardest to study.

Psychiatrist Robert Waldinger is the director of the Harvard Study of Adult Development, one of the longest and most complete studies of adult life ever conducted. Waldinger described some of the secrets to happiness revealed by the study in a recent TED talk.

The study followed two cohorts of white men for 75 years, starting in 1938:

268 Harvard sophomores as part of the "Grant Study" led by Harvard psychiatrist George Vaillant

456 12- to 16-year-old boys who grew up in inner-city Boston as part of the "Glueck Study" led by Harvard Law School professor Sheldon Glueck

The researchers surveyed the men about their lives (including the quality of their marriages, job satisfaction, and social activities) every two years and monitored their physical health (including chest X-rays, blood tests, urine tests, and echocardiograms) every five years.

They came away with one major finding: Good relationships keep us happier and healthier.

In his TED Talk, Waldinger pointed out three key lessons about happiness:

1. Close relationships

The men in both groups of the Harvard study who reported being closer to their family, friends, or community tended to be happier and healthier than their less social counterparts. They also tended to live longer. By comparison, people who said they were lonelier reported feeling less happy. They also had worse physical and mental health, as defined above.

A 2014 review of dozens of studies published in the journal Social and Personality Psychology Compass suggests that loneliness can get in the way of mental functioning, sleep, and well-being, which in turn increases the risk of illness and death.

2. Quality (not quanity) of relationships

It's not just being in a relationship that matters. Married couples who said they argued constantly and had low affection for one another (which study authors defined as "high-conflict marriages") were actually less happy than people who weren't married at all, the Harvard study found.

However, the effect of relationship quality seems to depend somewhat on age. A 2015 study published in the journal Psychology and Aging that followed people for 30 years found that the number of relationships people had was, in fact, more important for people in their 20s, but the quality of relationships had a bigger effect on social and psychological well being when people were in their 30s.

3. Stable, supportive marriages

Being socially connected to others isn't just good for our physical health. It also helps stave off mental decline. People who were married without having divorced, separating, or having "serious problems" until age 50 performed better on memory tests later in life than those who weren't, the Harvard study found.

And other research backs this up. A 2013 study in the journal PLOS ONE found that marriage, among other factors, was linked to a lower risk of mild cognitive impairment and dementia.

All of this suggests that strong relationships are critical to our health.

Society places a lot of emphasis on wealth and "leaning in" to our work, Waldinger said. "But over and over, over these 75 years, our study has shown that the people who fared the best were the people who leaned in to relationships, with family, with friends, with community."

You can watch the full TED talk here.