How do you inspire a group of unusually smart, hard working, optimistic, and largely privileged youngsters who are already destined for success? Encourage them to learn from those most in need; urge them confront inequity; exhort them channel their optimism with empathy; oh, and remind them that for all their accomplishments, they wouldn’t be where they are without a heavy dose of luck.

That was the message that philanthropists Bill and Melinda Gates delivered to Stanford’s 2014 graduating class in a poignant commencement address.

At a time when inequality is becoming one of the central issues of our time, the Gateses, whose foundation has become one of the most formidable philanthropic enterprises in history, exhorted graduates to pursue a mission-driven life. While both speakers were inspiring, it was Melinda Gates who delivered the most stirring lines. Here’s she is on channeling optimism:

Optimism for me isn’t a passive expectation that things will get better; it’s a conviction that we can make things better—that whatever suffering we see, no matter how bad it is, we can help people if we don’t lose hope and we don’t look away.

Drawing from her own experience witnessing abject poverty, heartbreaking disease and the ravages and stigma of AIDS in India, she later added:

Let your heart break. It will change what you do with your optimism.

And here’s the bit about luck and why it’s important:

Bill worked incredibly hard and took risks and made sacrifices for success. But there is another essential ingredient of success, and that ingredient is luck—absolute and total luck.

When were you born? Who were your parents? Where did you grow up? None of us earned these things. They were given to us.

When we strip away our luck and privilege and consider where we’d be without them, it becomes easier to see someone who’s poor and sick and say “that could be me.” This is empathy; it tears down barriers and opens up new frontiers for optimism.

So here is our appeal to you: As you leave Stanford, take your genius and your optimism and your empathy and go change the world in ways that will make millions of others optimistic as well.

The talk may well join another Stanford commencement address—the classic 2005 speech by Bill Gates’ longtime rival Steve Jobs—in the ranks of the most memorable ever. And it seemed especially apt for Stanford, a university that is minting innovators and entrepreneurs are an unprecedented rate. But not all successful Silicon Valley enterprises are created equal, or as the investor Peter Thiel famously bemoaned, “we wanted flying cars, instead we got 140 characters.” Stanford, for example, recently spawned the likes of Snapchat – disappearing messages—and Theranos—a potential revolution in healthcare. Both are successful and both are worth billions. But there’s little doubt as to which one Bill and Melinda Gates think Stanford graduates should join or try to emulate.

Get inspired and watch the full address below (Gates’ story begins at 1:10.50).