Former U.S. President Barack Obama answers questions at the Gates Foundation Inaugural Goalkeepers event on September 20, 2017 in New York City.

When the going gets rough, a pep talk from former president Barack Obama may come in handy. A day after president Donald Trump's downcast speech on terrorism and political adversaries during the U.N. General Assembly (UNGA), Obama discussed the power of optimism at the inaugural Bill & Melinda Gates Foundation's "Goalkeepers" event. In his speech, Obama notes the world's challenges, including growing economic inequality, a changing climate, mass migration and the rise of nationalism and xenophobia. When it's time for you to confront future hurdles, roadblocks and disappointment and when others are "purposefully undermining efforts you know can make a difference," there is only only way to respond, Obama says, if you want to be successful.

"Your response has to be to reject cynicism and reject pessimism and push forward, with a certain infectious and relentless optimism," he says. "Not blind optimism, not one that ignores the scale and scope of our challenges, but that hard-earned optimism, that's rooted in the stories of very real progress that have occurred throughout human history." "We have to reject the notion that we're suddenly gripped by forces that we cannot control," Obama says. "We've got to embrace the longer and more optimistic view of history and the part that we play in it." But how can anyone be optimistic under those conditions, you may ask? Obama wants you to consider this: "By just about every measure, America is better — and the world is better — than it was 50 years ago, 30 years ago or even 10 years ago."

Your response has to be to reject cynicism and reject pessimism and push forward, with a certain infectious and relentless optimism. Barack Obama Former U.S. president