
Algorithms To Live By Book Summary
The Computer Science of Human Decisions
Book by Brian Christian
Summary
Algorithms to Live By reveals how computer algorithms can solve many of life's most vexing human problems, from finding a spouse to folding laundry, by providing a blueprint for optimizing everyday decisions through the lens of computer science.
The 37% Rule: When To Stop Looking And Commit
The 37% Rule provides guidance on the optimal time to stop searching and commit to a particular choice, whether you're looking for an apartment, hiring an employee, or finding a spouse. In short, look at your first 37% of options to establish a baseline, then commit to anything after that point which beats the best you've seen so far.
To be precise, the optimal proportion to look at before switching to "leap mode" is 1/e, or about 37%. So if you're searching for an apartment and have 30 days to do it, spend the first 11 days (37% of 30) exploring options, then on day 12 pick the next place that tops your current best.
This algorithm offers the best chance of finding the single best option, though it will still fail a majority of the time. But it shows the power of establishing a "good enough" baseline before jumping on something that exceeds it.
Section: 1, Chapter: 1
Why Silver Medalists Are A Lie
the 1800s, Lewis Carroll (of Alice in Wonderland fame) pointed out a flaw in single elimination tournaments, like those used in lawn tennis at the time. The problem is that the tournament format can only definitively determine 1st place. The person who loses in the finals could theoretically be the 2nd best player, but they could also be the 3rd, 4th, or worse. That's because they only lost to the eventual champion - if they had faced off against others, they may have lost those matchups.
As Carroll calculated, if player skills are evenly distributed, the odds that the 2nd and 3rd best players face off in the semi-finals is about 50/50. So awarding a silver medal to the finalist creates a lie half the time. The same is true of bronze medals determined by a 3rd place game. Single elimination formats simply don't provide enough information to rank anyone but the overall winner.
Section: 1, Chapter: 1
Look-Then-Leap Vs. Threshold Rules
There are two main approaches to solving "optimal stopping" problems like hiring employees or buying a house:
- Look-Then-Leap Rule: Gather information for a set period of time, then commit to the next option that exceeds the best you've seen. This is the 37% Rule.
- Threshold Rule: If you have full prior information, simply set a predetermined threshold for quality and immediately take the first option that meets or exceeds it. No "look" phase needed.
The Threshold Rule only works if you have solid information on the distribution of options before you start looking. For example, if you know the distribution of typing speeds for secretaries, you can set a threshold and hire the first applicant who meets it. If you lack that information, the Look-Then-Leap approach is necessary to first establish a baseline.
In many real-world scenarios, from buying a house to choosing a spouse, we lack reliable priors. So some initial exploration, per the 37% Rule, is optimal before setting a threshold to leap for. The more uncertainty, the more exploration is needed before exploiting.
Section: 1, Chapter: 1
Optimism In The Face Of Uncertainty
A key insight from the multi-armed bandit problem is the power of "optimism in the face of uncertainty." That is, when choosing between options where some information is known and some unknown, optimism is the mathematically correct approach.
Suppose you walk into a casino and see two slot machines. The first, you're told, pays out 20% of the time. The second machine's payoff rate is unknown. Which should you choose?
Rationally, you should try the mystery machine. That's because it COULD pay out at >20%, in which case it's the better choice. But you'll only find out if you try it. Mathematically, the expected value of an unknown option is higher than a known suboptimal one.
So in life, when facing uncertainty, choose optimistically - assume the best of a new person, place, or experience. Optimism maximizes your chance of finding something great. Pessimism can lead to overlooking hidden gems.
Section: 1, Chapter: 2
When To Give Up On A Restaurant, Job Or Relationship
The explore/exploit tradeoff, also known as the multi-armed bandit problem, offers guidance on when to stop exploring new options and commit to the best known one. The optimal approach depends on the total length of time you'll be making decisions:
- Short time horizon (e.g. choosing where to eat on your last night of vacation): Exploit immediately by picking the best place you've been to already. Don't risk a bad meal to explore.
- Medium time horizon (e.g. choosing lunch spots in the few months before moving to a new city): Mix it up between exploiting old favorites and exploring to find new ones. Lean more toward exploring early on.
- Long time horizon (e.g. choosing jobs or relationships when young): Explore a lot, try new things constantly, don't settle down too soon. With decades of decisions ahead, finding a great option is worth many misses.
Section: 1, Chapter: 2
The Gittins Index: Optimizing The Slot Machine Of Life
What's the optimal balance between exploring new options and exploiting known ones? Mathematician John Gittins solved this in the 1970s with the Gittins Index.
The Gittins Index assigns each option a score based on its observed results so far AND the uncertainty remaining in that option. Unknown options get an "uncertainty bonus" that makes them more attractive to try.
For example, suppose you have two slot machines, one that paid off 4/10 times, and a new machine you've never tried. The Gittins Index will recommend the new machine, because the uncertainty bonus outweighs the 40% payoff of the known machine. It COULD be much better.
Once you've tried an option enough times, the uncertainty bonus dwindles and its Gittins Index matches its observed performance. At that point you "retire" an option that underperforms.
Section: 1, Chapter: 2
How To Arrange Your Bookshelf, And Your Life
What's the optimal way to sort your bookshelf? Sorting theory offers some guidance:
- Don't alphabetize. Alphabetical order takes more time to scan than the seconds saved in faster location. Especially if you're more likely to browse than look for a specific title.
- Don't group by category. In the age of search, sorting into genres, topics, or "like with like" is unnecessary. It adds more time than it saves.
- Do optimize for browsing. Put your favorite titles at eye level. Less accessed ones up high or down low.
- Do make it a "cache." Put the most recently read or acquired books in the most visible spot. They're most likely to be accessed again soon. Rotate books in and out.
The same principles apply to organizing your office, kitchen, or life.
Section: 1, Chapter: 3
How Tournaments And Sports Rank Competitors
Many different tournament formats are used in sports to rank competitors, from March Madness to the World Cup. Each format is effectively a sorting algorithm.
The NCAA March Madness tournament uses a single elimination bracket. With 64 teams, it conducts 63 games total to (partially) sort the teams. It's similar to a merge sort, with successive rounds halving the remaining teams until a winner is crowned.
In contrast, a round-robin tournament where every team plays every other team would take 2,016 games to fully sort 64 teams. That's infeasible.
The World Cup uses a hybrid approach - a group stage where each group of 4 teams plays a round-robin, followed by a single elimination bracket. This balances the information gained from head-to-head matchups with the efficiency of elimination.
In general, more games or matches will yield a more reliable ranking, but also take more time. Tournaments trade off time and accuracy in their structure. But no tournament is perfect due to "noise" - an inferior team can beat a better on any given day. So even a full round-robin doesn't guarantee the "correct" ranking.
Section: 1, Chapter: 3
The Periodic Table Of Sorting Algorithms
Computer science has categorized many sorting algorithms and identified the "periodic table" of how they relate. The key attributes are:
- Runtime: How long the algorithm takes, measured in Big O notation. Bubble sort is O(n^2), merge sort is O(n log n). This measures both average and worst case.
- Stability: A "stable" sort keeps items with the same key in the same relative order. An unstable sort might scramble them.
- Memory: How much RAM the algorithm uses. Merge sort is not in-place, so it requires O(n) extra space. Heapsort is in-place, requiring only O(1) extra space.
This "periodic table" helps programmers pick the right algorithm for a given job. For example:
- For general sorting, merge sort or quicksort are fast, but not stable or in-place.
- For mostly sorted data, insertion sort is simple, stable, in-place, but O(n^2) worst case.
- For huge datasets that don't fit in RAM, mergesort's O(n) extra space is infeasible.
Section: 1, Chapter: 3
Deciding What To Keep
When deciding what to keep and what to discard, whether it's for your closet, your bookshelf, or your computer's memory, consider two factors:
- Frequency: How often is this item used or accessed? Things used most often should be kept close at hand. This is why your computer's RAM is faster than its hard disk.
- Recency: When was this item last used? Items used more recently are more likely to be used again soon. So the most recently used items should also be kept easily accessible.
Many caching algorithms, like Least Recently Used (LRU), primarily consider recency. But the optimal approach, as used by the human brain, balances both frequency and recency.
Section: 1, Chapter: 4
The Surprising Benefit Of Clutter And Mess
While we often aspire to Marie Kondo levels of tidiness and order, there are benefits to some degree of clutter. That's because keeping things organized takes time - time that's wasted if you never access the items again.
For any storage system, like a filing cabinet or computer memory, there's an inherent tradeoff between "search" and "sort." The more time you spend organizing up front (sorting), the less time you'll spend trying to find something later (searching). But if you never look for the item again, that up-front sorting was all wasted effort.
That's why the optimal approach is to "err on the side of messiness." Only sort and organize things that you're confident you'll need to retrieve later. The less likely you are to search for something, the more clutter you should tolerate.
For example, don't bother organizing tax receipts that you'll never look at again. But do file away important contracts you may need to reference.
Section: 1, Chapter: 4
Related Content


Rebel Ideas Book Summary
Matthew Syed
Matthew Syed reveals the vital ingredient missing from our understanding of success: cognitive diversity. Rebel Ideas shows how bringing together different insights, perspectives and thinking styles turbocharges creativity, problem-solving and decision-making, to improve performance in today's complex world.
Matthew Syed reveals the vital ingredient missing from our understanding of success: cognitive diversity. Rebel Ideas shows how bringing together different insights, perspectives and thinking styles turbocharges creativity, problem-solving and decision-making, to improve performance in today's complex world.
Psychology
Innovation
Business
Leadership