# Algorithms for Life: The Computer Science of Human Decisions by Brian Christian and Tom Griffiths

## Algorithms to Live By: The Computer Science of Human Decisions

## Introduction

Have you ever wondered how to make the best decisions in life? Whether it's finding a partner, a job, a home, or a parking spot, we are constantly faced with choices that require us to weigh the pros and cons, the risks and rewards, the costs and benefits. But how do we know what is the optimal choice? How do we avoid regrets and mistakes? How do we deal with uncertainty and complexity?

## Algorithms to Live By: The Computer Science of Human Decisions

One possible answer is to look at how computers solve problems. Computers, like us, have limited resources and time, so they need to use algorithms to find efficient and effective solutions. Algorithms are step-by-step procedures that tell a computer what to do in any given situation. They are the core of computer science, the discipline that studies how information can be processed, stored, communicated, and manipulated.

But algorithms are not only useful for computers. They can also help us humans make better decisions and understand ourselves better. In this article, we will explore how algorithms developed for computers can also untangle very human questions. We will see how computer science can help us solve common decision-making problems and illuminate the workings of the human mind. We will also see how algorithms can be applied to everyday situations, from finding a spouse to finding a parking spot, from organizing our inbox to peering into the future.

Ready to learn how to live by algorithms? Let's begin!

## Optimal Stopping

One of the most common problems we face in life is when to stop looking and start choosing. Whether it's finding an apartment, a spouse, or a parking spot, we often have to decide whether to settle for the current option or keep searching for a better one. But how do we know when to stop? How do we avoid missing out on the best option or wasting too much time and energy?

This is where optimal stopping comes in. Optimal stopping is an algorithm that tells us when to stop looking and start choosing based on some criteria. The basic idea is to look at a certain fraction of the options before making a decision, and then pick the first option that meets or exceeds our expectations. This way, we can balance between exploring enough options to establish a baseline and exploiting the best option we find.

For example, suppose you are looking for an apartment in San Francisco, and you have a month to find one. You can use the 37% rule, which is a special case of optimal stopping, to decide when to stop looking and start choosing. The 37% rule says that you should look at 37% of the options before making a decision, and then pick the first option that is better than all the previous ones. In this case, you should look at 37% of a month, which is about 11 days, before making a decision, and then pick the first apartment that is better than all the ones you saw in the first 11 days. This way, you can maximize your chance of finding the best apartment available.

Of course, optimal stopping is not perfect. It does not guarantee that you will find the best option or that you will not regret your choice later. It also depends on some assumptions, such as knowing how many options there are, how they are distributed, and what your preferences are. However, optimal stopping can still help you make better decisions than relying on intuition or random guessing.

## Explore/Exploit

Another common problem we face in life is how to balance between trying new things and sticking with what we know. Whether it's online shopping, dating, or entertainment, we often have to choose between exploring new options and exploiting existing ones. But how do we know when to explore and when to exploit? How do we avoid missing out on new opportunities or getting stuck in a rut?

This is where explore/exploit comes in. Explore/exploit is an algorithm that tells us how to allocate our time and resources between exploring new options and exploiting existing ones based on some criteria. The basic idea is to explore more when we have more time or uncertainty, and exploit more when we have less time or certainty. This way, we can balance between learning new information and using existing information.

For example, suppose you are online shopping for a new laptop, and you have a week to buy one. You can use the epsilon-greedy algorithm, which is a simple case of explore/exploit, to decide when to explore new options and when to exploit existing ones. The epsilon-greedy algorithm says that you should explore with some probability epsilon (say 10%), and exploit with the remaining probability (90%). In this case, you should explore new laptops 10% of the time (say one day), and exploit the best laptop you have found so far 90% of the time (six days). This way, you can maximize your chance of finding the best laptop available.

## Overfitting

One of the most common pitfalls we face in life is overfitting. Overfitting is when we create a model or a theory that fits our data too well, but fails to generalize to new situations. Overfitting is when we make things more complicated than they need to be, or when we pay attention to irrelevant details or noise. Overfitting can lead us to false conclusions, bad decisions, and poor performance.

How can we prevent overfitting? One way is to simplify our models and avoid unnecessary complexity. We can use Occam's razor, which is a principle that says that we should prefer the simplest explanation that fits the data. We can also use cross-validation, which is a technique that tests our model on different subsets of data to see how well it performs. We can also use regularization, which is a method that penalizes our model for being too complex or having too many parameters.

For example, suppose you are learning a new skill, such as playing chess, investing in stocks, or parenting a child. You can use these techniques to avoid overfitting and improve your learning. You can simplify your strategy and focus on the most important factors that affect your performance. You can test your strategy on different scenarios and see how well it works. You can also avoid being too rigid or dogmatic and adjust your strategy based on feedback and experience.

## Relaxation

One of the most common challenges we face in life is relaxation. Relaxation is when we loosen our constraints and find approximate solutions to hard problems. Relaxation is when we accept some errors or imperfections in exchange for speed or simplicity. Relaxation can help us solve problems that are otherwise impossible or impractical to solve.

How can we use relaxation? One way is to use Lagrangian relaxation, which is a technique that converts a hard problem into an easier one by relaxing some of the constraints and adding penalties for violating them. Another way is to use linear programming, which is a method that finds the optimal solution to a problem by using linear equations and inequalities. Another way is to use simulated annealing, which is a process that mimics how metals cool down and crystallize by gradually reducing the temperature and finding the lowest energy state.

For example, suppose you are planning a trip, designing a product, or writing an essay. You can use these techniques to relax your problem and find a good solution. You can relax some of the constraints and add penalties for violating them, such as budget, time, or quality. You can use linear equations and inequalities to model your problem and find the optimal solution. You can also use simulated annealing to explore different options and find the best one.

## Randomness

One of the most common sources of creativity and diversity in life is randomness. Randomness is when we introduce some element of chance or uncertainty into our actions or decisions. Randomness is when we leave things to fate or luck. Randomness can help us generate new ideas, discover new possibilities, and create serendipity.

How can we harness randomness? One way is to use random sampling, which is a technique that selects a subset of items from a larger set based on some probability distribution. Another way is to use random walks, which are paths that move randomly from one point to another based on some rules or probabilities. Another way is to use genetic algorithms, which are processes that simulate natural evolution by creating variations and selecting the best ones based on some fitness function.

For example, suppose you are making art, music, or science. You can use these techniques to harness randomness and create something original and innovative. You can use random sampling to select colors, sounds, or data from a larger set based on some criteria. You can use random walks to create patterns, melodies, or hypotheses based on some rules or probabilities. You can also use genetic algorithms to create variations and select the best ones based on some fitness function.

## Networking

One of the most common aspects of life in the modern world is networking. Networking is when we connect and communicate with others through various channels and devices. Networking is when we share information, resources, and opinions with others who have similar interests or goals. Networking can help us learn new things, find new opportunities, and solve new problems.

How can we optimize our networking? One way is to use routing, which is a technique that finds the best path to send or receive information from one point to another. Another way is to use congestion control, which is a method that regulates the flow of information to avoid overload or delay. Another way is to use error correction, which is a mechanism that detects and corrects errors in the transmission or storage of information.

For example, suppose you are using the internet, social media, or email. You can use these techniques to optimize your networking and improve your communication. You can use routing to find the best path to send or receive information from one point to another based on some criteria, such as speed, cost, or reliability. You can use congestion control to regulate the flow of information to avoid overload or delay based on some feedback, such as packet loss, delay, or throughput. You can also use error correction to detect and correct errors in the transmission or storage of information based on some codes, such as parity bits, checksums, or CRCs.

## Game Theory

One of the most common situations we face in life is game theory. Game theory is when we analyze and influence the behavior of others who have their own interests and goals. Game theory is when we play strategic games with others who may cooperate or compete with us. Game theory can help us understand human psychology, social dynamics, and economic behavior.

How can we use game theory? One way is to use Nash equilibrium, which is a concept that describes a situation where no player can improve their outcome by changing their strategy. Another way is to use prisoner's dilemma, which is a game that illustrates the tension between individual and collective rationality. Another way is to use auction theory, which is a branch of game theory that studies how people bid for goods or services.

For example, suppose you are negotiating a deal, voting for a candidate, or bidding for an item. You can use these concepts to use game theory and improve your outcome. You can use Nash equilibrium to find a situation where no player can improve their outcome by changing their strategy based on some payoff matrix. You can use prisoner's dilemma to illustrate the tension between individual and collective rationality based on some payoff matrix. You can also use auction theory to study how people bid for goods or services based on some auction format, such as first-price, second-price, or sealed-bid.

## Conclusion

In this article, we have seen how algorithms developed for computers can also untangle very human questions. We have seen how computer science can help us solve common decision-making problems and illuminate the workings of the human mind. We have also seen how algorithms can be applied to everyday situations, from finding a spouse to finding a parking spot, from organizing our inbox to peering into the future.

Algorithms are not only useful for computers. They can also help us humans make better decisions and understand ourselves better. By learning how to live by algorithms, we can become more efficient, effective, and creative in our lives.

If you want to learn more about algorithms and how they apply to our lives, you can check out the book Algorithms to Live By: The Computer Science of Human Decisions by Brian Christian and Tom Griffiths. You can also check out some online courses or videos on computer science and algorithms . You can also try some online tools or games that demonstrate some of the algorithms we have discussed .

## FAQs

### What are algorithms?

Algorithms are step-by-step procedures that tell a computer what to do in any given situation. They are the core of computer science, the discipline that studies how information can be processed, stored, communicated, and manipulated.

### Why are algorithms relevant to our lives?

Algorithms are relevant to our lives because they can help us solve common decision-making problems and illuminate the workings of the human mind. They can also help us apply computer science concepts and techniques to everyday situations.

### What are some examples of algorithms that can be applied to everyday situations?

Some examples of algorithms that can be applied to everyday situations are optimal stopping, explore/exploit, sorting, caching, scheduling, Bayes's rule, overfitting, relaxation, randomness, networking, and game theory.

### How can we learn more about algorithms and how they apply to our lives?

discussed.

### What are the benefits and limitations of living by algorithms?

The benefits of living by algorithms are that they can help us make better decisions, understand ourselves better, and become more efficient, effective, and creative in our lives. The limitations of living by algorithms are that they do not guarantee that we will find the best option or that we will not regret our choice later. They also depend on some assumptions, such as knowing how many options there are, how they are distributed, and what our preferences are. 71b2f0854b