Lin-Manuel Miranda, creator of the Broadway musical “Hamilton,” speaks during the University of Pennsylvania commencement ceremony this month. (Matt Rourke/AP)

A commencement speech is meant to inspire. An older and wiser person gives advice to young graduates who are about to go make their own way in the world. Sometimes these cross-generational exchanges come off as out of touch: How can a 50- or 60-something understand what it’s like to be young today?

For starters, they can talk about love. Watching some recent commencement addresses, what stands out are the stories of heartbreak and of the resilience that eventually follows. Sure, a speaker can address an Ivy League class, presuming that everyone there will marry and stay married for decades. But now that single Americans have overtaken married ones, it’s perhaps most relatable and more useful to tell young graduates stories of what happens when love doesn’t result in marriage, or when marriage doesn’t go as planned.

Here are five recent speeches that have done just that.

Sheryl Sandberg on her husband’s death

“I am not here to tell you all the things I’ve learned in life,” Sheryl Sandberg told the Class of 2016 at the University of California at Berkeley last weekend. “Today I will try to tell you what I learned in death.”

Sandberg spoke about the gratitude and resilience she found while dealing with the unexpected death of her husband, Dave. (If you haven’t listened to the full speech, it’s here.) Sandberg could have spoken only of the successes in her life; as chief operating officer of Facebook and author of a best-selling book, she’s got plenty.

But in talking about how she dealt with the unexpected pain in her life, she was able to address the adversity every graduating senior may expect from life. “There’s loss of opportunity: the job that doesn’t work out, the illness or accident that changes everything in an instant,” she said. “There’s loss of dignity: the sharp sting of prejudice when it happens. There’s loss of love: the broken relationships that can’t be fixed. And sometimes there’s loss of life itself.”

Sandberg’s message of how she found gratitude even in grief — without blaming herself for what happened, or allowing his death to overshadow the good things in her life — is advice that applies to anyone, regardless of relationship status.

Lin-Manuel Miranda on ending a relationship

At the University of Pennsylvania’s graduation, playwright and performer Lin-Manuel Miranda got real about the tougher times that paved the path for his current success. Miranda recalls the advice a doctor gave him when he was weathering intense shoulder pain as his high school-college girlfriend was coming back into his life: “You’re trying to avoid going through pain, or causing pain. I’m here to tell you that you’ll have to survive it if you want to be any kind of artist.”

And that meant breaking up with his girlfriend and potentially hurting her. “The story I had been telling myself — happy guy in a long-distance relationship with his high school sweetheart — was being physically rejected by my body via my shoulder. I’d never broken up with anyone before — in my head, I was a ‘good guy,’ and ‘good guys’ don’t break up with their significant others when one of them goes off to study abroad. I was trying to fit my life into a romantic narrative that was increasingly at odds with how I really felt. In retrospect, we both were.”

Miranda takes a familiar plot point — holding on to something too long — and flips the script. Our culture often views those who break up with someone as cruel, but Miranda casts it as kind and necessary. Learning how to break up is a skill that isn’t taught in college but probably should be.

Sen. Elizabeth Warren on the inability to plan your life

At Bridgewater State University, in Massachusetts, Sen. Elizabeth Warren’s message applies to graduates and people of any age: No matter how meticulously you plan your life, life has a way of diverging from your carefully made plans. For her, that diversion included a marriage proposal at age 19 that prompted her to drop out of college while she was studying to be a teacher. (“Boy, was I smart at 19,” she deadpans.)

Warren eventually graduated, at which point she was pregnant and had trouble getting a job. A few years later, she graduated from law school, again pregnant. “Nobody wanted to hire me,” she said. She finally got that teaching job, this time in law. Warren eventually made her way to Washington, where she established the Consumer Financial Protection Bureau and was elected to the Senate.

“Running for office had not been on my bucket list, my shopping list or any other list that I might have,” she says, adding that “all the planning in the world can’t prepare you for the twists that are coming your way.”

Looking back on the meandering path of her life, Warren says, “I never planned to get married when I did, and I sure didn’t plan to get divorced.” But you don’t see her regretting those choices, either.

“People are going to tell you to plan and to focus,” Warren tells graduates. “They will tell you that if you want to succeed, you will have to stubbornly stay on your path, no matter what. They will be right. They will also be wrong.”

Sen. Charles E. Schumer on getting dumped 

It’s hard to believe someone could make this kind of decision: Sen. Charles E. Schumer tells the 2014 graduates of Binghamton University, in New York, of how when he graduated from college about 40 years ago, he had won a scholarship to travel all around the world, with all expenses paid for a year. “For me, it was the opportunity of a lifetime.” he says. “I had never been out of the country before. But at the same time, I met a girl, and I fell in love.”

He had to choose: Do I go around the world for a year on the all-expense-paid scholarship? Or do I stay home with the girl?

Well, he stayed home — and she dumped him shortly thereafter. “There I was: No scholarship. No trip around the world. No girl,” Schumer says. “I said to myself: ‘What a loser you are. You’ll never become anything.’ And in fact, I stayed in my house for several months, moped around, felt sorry for myself. But somehow I picked myself up, dusted myself off and moved forward. And a few years later, I found myself seated at graduation once again, this time from law school.”

And instead of chasing after love, he chased after power and ran for political office. “A few years earlier, nope, I didn’t get that girl. But that November, I won the election.”

That’s quite a rebound.

Elin Nordegren on education helping her through tough times  

In Elin Nordegren’s speech as the outstanding graduating senior at Rollins College in 2014, she talks about how her education helped her through her divorce from Tiger Woods.

“When I entered my student adviser’s office in the fall of 2005, I was 25 years old,” Nordegren begins. “I just recently moved to America; I was married without children. Today, nine years later, I’m a proud American, and I have two beautiful children. But I’m no longer married.”

Huge applause from the audience on that line.

She then details how her course material related to her real life: “After I had taken Communication and the Media, I was unexpectedly thrust into the media limelight — and I probably should have taken more notes in that class. [laughter] My psychology and law class helped me through some of the most challenging times of my life that involved legal matters. The information not only helped me understand the complexity of the legal system, but it also offered me a place of peace in the wild storm of my personal life.”

She continues: “I have also realized that education was a consistent part of my life for the last nine years, and it has offered me comfort. Because education is the one thing that no one can take away from you.”


Be unbreakable: Dating lessons from Kimmy Schmidt

Monogamy was failing me. Was polyamory the answer?

An interview with the director of “The Lobster,” a dark comedy about the search for love