The Course of Reason

How to Solve a Problem

September 24, 2013

“Algorithm” is a scary word. You probably just threw up a little bit, a little fear puke, from reading it just now. Also, it is hard to look at. The first part is easy: “Algo.” That is easy to look at. But then your eyes hit that second part and just sort of get lost in a tangled mess of letters that have no business hanging out together. To what black magic does this dark word refer? The goal of this post is to kind of answer that question, and to make algorithms less scary for you.

Ugh I broke the first rule of writing. Pretend I didn’t write that intro. First I have to tell you why you want to learn about them. I should have written an intro that tells you algorithms are everywhere, and that they affect you personally every day. Then, I should have said something like, “plus, they are taking your jobs!” Oh man, you would have been so hooked then. Just pretend I wrote that.

The truth is, algorithms are super powerful, and you already know a bunch. Do you remember when you learned how to add and subtract? Guess what. You learned an algorithm for each. You didn’t really learn shit about math. Your teacher just taught you an algorithm that computes solutions to addition and subtraction problems. The same is true for multiplication, division, and probably everything else you think of as “math.”

See, an algorithm is a “way to solve a problem.” But it is a special way, because it is very specific, and it always works. Here’s the algorithm you probably learned for adding:

1. Stack the numbers and align them on the right. Draw a line under the bottom number.
2. Start at the right-hand side of both numbers.
3. Add the stacked digits, using mental math or your fingers, writing the results beneath them. If the result is 10 or more, write only the right-hand digit.
4. Move left, and if the last result was 10 or more, write the 1 above the new stack of digits.
5. Repeat 3 and 4 until you can’t go left anymore.
6. The answer is beneath the line.

A little bit hairy when you spell out all the details. You probably don’t even think about the process anymore, but just do it reflexively. Try to write out the algorithm you use to multiply two numbers together. It’s kinda nasty, but you can use it with no problem. So, you’ve got a pretty good handle on a few algorithms. Let’s just memorize the rest so that they can’t take our jobs. How many more could there possibly be?

Um, a shitload. But that’s okay, because once you learn the basics and get a feel for how things work, you can sort of branch off on your own and cook them up as you need them. I want to help you shift from “memorize algorithms and apply them,” to “think algorithmically.” If algorithms are magic, then you’re a wizard, Harry. You have the power.

Did you know that when you mow the lawn you are executing an algorithm? It is probably something like, “Start on the perimeter of uncut grass. Mow around the perimeter, then move inward to the new perimeter of uncut grass. Continue until the perimeter is 0.” Boom, long grass problem solved, every time. There are other ways to mow the lawn, some better than others. I never liked mowing the lawn, but I always had to do it. When I was 14 I mowed the words “HELP” in the lawn. This was a bad way to mow the lawn.

A cake algorithm

Some algorithms make tasties. 

At this point, you are probably thinking, “Okay, so algorithms aren’t so scary. They are just really boring.” First of all, that’s a really mean thing to think. Second of all, is science cool? Is rationality cool? Because guess what. The scientific method is an algorithm. Or rather, a class of algorithms. Rational decision making is a class of algorithms. Now who’s boring?!

The scientific method is a way of thinking that solves the problem of “not knowing what shit is true, and not knowing how shit works.” Rationality is a way of thinking that solves the problem of “good shit doesn’t happen for me as often as I’d like.” If you approach these problems systematically and carefully, breaking them down into pieces and dealing with those pieces step by step, then you are thinking algorithmically, and you are cool.

Here is the science algorithm:

1. Wonder about something.
2. Come up with a reason for why that thing might be.
3. Come up with an experiment that tests your reason.
4. Observe the experiment.
5. Analyze the results of the experiment.
6. Come up with a better reason, and repeat 1 - 5, until you have a really good reason.

Here is the rationality algorithm:

1. Want something.
2. Think about what things you can do right now.
3. Imagine doing those things, and then think about what you could do next.
4. If doing several things in a row gets you closer to what you want, remember that chain of things.
5. Find the best chain of things that gets you closer to what you want.
6. Do that chain, then repeat steps 1 - 5, until you have what you want, or you want something else.

There are various specific versions of these (I actually think the science algorithm is a version of the rationality algorithm), and shortcuts to avoid common problems and save time. But the output to the science algorithm is always a tentative belief, and the output to the rationality algorithm is always a strategy. But you could basically try your best to follow those two algorithms, and your life would probably get better.

“But Seth, those two algorithms are really vague! You said algorithms are supposed to be specific! What counts as a good reason? What counts as the best chain of things? How do I just come up with an experiment? There are like an infinite number of things I can do right now, so how am I supposed to imagine doing them all?”

Very good point, and very good questions. Now you are thinking algorithmically. You have a goal: live by the rationality/science algorithm. You are breaking that goal down into its pieces, looking at what each step requires. That generates new subproblems. You’ve got to solve those subproblems somehow. The way you solve them will depend on the specifics of your main problem. And sometimes, you’ve got to plan on making changes to your plan, or to fill in details as you go along.

The rationality algorithm can take a really long time, and gets really complex after only a few levels of action. Think about chess. We are amazed by people who can think three or four moves ahead. Clearly they aren’t using the rationality algorithm to reason all the way to checkmate from the beginning of the game. They are using good heuristics to ignore a bunch of possible moves.You can speed things up by figuring out good heuristics to ignore actions. For example, you might have a heuristic that says, “control the center early on,” or “if you have more pieces, make a bunch of even exchanges.” These are shortcuts through the rationality algorithm applied to chess. Similar shortcuts exist for lots of problems.

The real world is messy, vague, random, and fast. It is in no way ideal. You have almost no control over anything. You’ve got to develop good heuristics, learn from both your mistakes and others’, and think quickly. You’ll face problems constantly. To solve them, you’ve got to see them clearly, understand them, break them into manageable chunks, form a plan, and execute the plan. In short, you’ve got to algorithm.

Problem Solving Algorithm

The Problem Solving Algorithm

 

 

 

About the Author: Seth Kurtenbach

Seth Kurtenbach's photo
Seth Kurtenbach is pursuing his PhD in computer science at the University of Missouri. His current research focuses on the application of formal logic to questions about knowledge and rationality. He has his Master's degree in philosophy from the University of Missouri, and is growing an epic beard in order to maintain his philosophical powers. You can email Seth at Seth.Kurtenbach@gmail.com or follow him on Twitter: @SJKur.

Comment

Register/Login

Name:
Email:
Location:

Guests may not post URLs. Registration is free and easy.

Remember my personal information

Notify me of follow-up comments?



Enter the missing word: CFI's mission (http://www.centerforinquiry.net/about) is to foster a _______ society.

Creative Commons License

The Course of Reason is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.

CFI blog entries can be copied or distributed freely, provided:

  • Credit is given to the Center for Inquiry and the individual blogger
  • Either the entire entry is reproduced or an excerpt that is considered fair use
  • The copying/distribution is for noncommercial purposes