In this series,The Way We Work, Entrepreneur Associate Editor Lydia Belanger examines how people foster productivity, focus, collaboration, creativity and culture in the workplace.

Mo Gawdat has had an illustrious technology career, toggling between entrepreneurship and roles at IBM, Microsoft and, most recently, Google. But despite these feats, which looked great on paper and afforded him a comfortable and privileged lifestyle, he largely spent his 20s and 30s extremely unhappy.

“The constant fight for me to acquire more and to be recognized as a more successful businessman was not delivering my happiness,” Gawdat says. “I had to research the topic of happiness to get myself back to my typical happy self.”

He spent nine years trying to crack the happiness code, approaching the task from the logic-driven perspective of an engineer. He developed an equation: Happiness equals your perception of the events of your life, minus your expectations of how life should behave. This model worked well for him. If he let go of his expectations and instead adapted his thoughts and actions to reality, he could maintain constant happiness.

Then, in 2014, he lost his 21-year-old son, Ali, in a surgical accident, putting his equation to the ultimate test. That’s when he knew he couldn’t keep his findings to himself.

“My brain ended up deciding that instead of trying to avenge my son's life, I wanted to give life as a result,” says Gawdat, who published his book Solve for Happy in January of this year and has given several talks on the subject through a campaign he launched to make 10 million people happy. He recently expanded his goal to #OneBillionHappy and left his chief business officer role at Google X, the tech giant’s moonshot R&D division, to devote all of his time to teaching others how to be happy regardless of their circumstances.

Entrepreneur spoke with Gawdat about what it takes to be happy today, and why happiness is crucial for success.

This conversation has been edited for length and clarity.

Why did you decide to come up with a new approach to happiness?I couldn't find material that would actually speak to my own brain and the way I look at life. As much as I respect a lot of the happiness work out there, most of it is either anchored in psychology practice or spirituality, or matters that are a little softer than what today's typical person who prioritizes logic needs to understand. So, I researched the topic as an engineer. There is so much you can learn about happiness if you look at it in a more structured, more engineered way.

You’ve written about how we have high expectations in today’s world because technology increasingly allows us to expect efficiency and certainty. How do we overcome that?There is no way we can control life. If you understand this fact, then suddenly, you can have a better attitude toward the change in your life while continuing to attempt to control the outcomes as much as possible -- but not letting the things that are out of control upset you.

How does the quest for happiness change as the world modernizes further?It doesn't change at all. Happiness has never been a result of what the external conditions are outside you. Happiness has always been a decision and then actions that conform to that decision.

Most of the time, we suffer from what I call unnecessary unhappiness. Like, you get in an Uber and the driver doesn't smile, and your brain tells you, “He disrespects me.” Then you ask your brain, "Is this true, brain? How can he disrespect me if he doesn't even know me?"

Then I ask the other question, which is, "What can I do about it?" When you do something, the unhappiness goes away, because you start to get engaged. If you cannot do anything about it, then accept it. Don't accept it from a point of view of weakness, but accept it from a point of view of strength.

How can entrepreneurs apply these lessons?Most entrepreneurs I've ever seen in my life who have become successful never built what they put in their original business plan. The idea of a successful human being, and a successful entrepreneur and a happy person, is a person who responds to things when things change, who flows along the opportunity that is presented and then reviews the plans and continues to evolve and improve. This does not only make us happier, but it also makes us a lot more productive in life.

What advice do you have about keeping employees happy?We hire people, normally, for their qualifications. For their intellectual horsepower, for their experiences and so on and so forth. But we forget that people who are unhappy are going to poison our organization.

To be able to empower people, use their skills and abilities to get things done. At the same time, keep a happy environment where everyone wants to continue to come back to work and continue to deliver.

Working at Google, you say you learned a lot, especially given that Google has been labeled such a great place to work. What can others learn from Google?Those who were successful at Google were people who believed in Google's mission -- believed in organizing the world's information. And so when they came to work, they didn't feel that it was work. They felt that this was their life's purpose.

My biggest advice is if you feel that what you're working on every day is not really what makes you happy, change.

Start finding something else. It may take you six months, it may take you a year. But honestly, don't spend a day of your life working on anything other than the stuff that makes you happy.

How is achieving happiness in your career in 2018 different than any time before?It's harder from some angles and easier from some angles. In the modern world, because of distractions and constant bombardment with messages that are driving us to look for more ego and more missed expectations, it requires a little more work, but the concept and path is exactly the same.

My work is truly all about happiness in 2018. Previously, research on happiness was about "Sit down and meditate." Meditation is a technology for happiness that was built thousands of years ago and may not be fit for today's world.

What I talk about in Solve for Happy is technology that allows you to be mindful and present in a meeting room or on your commute to work. It allows you to understand how your brain works, so you don't really necessarily have to shut your brain up or shut it down in the form of meditation to be able to be happy. As a matter of fact, my advice uses work techniques that ask you to engage your brain more.