Week 13: Using Application Problems to Develop Algorithms

An algorithm in mathematics is a procedure, a description of a set of steps that can be used to solve a mathematical computation: but they are much more common than that today.

The first step towards an understanding of why the study and knowledge of algorithms are so important is to define exactly what we mean by an algorithm. According to the popular algorithms textbook Introduction to Algorithms (Second Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein), “an algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values as output.” In other words, algorithms are like road maps for accomplishing a given, well-defined task. So, a chunk of code that calculates the terms of the Fibonacci sequence is an implementation of a particular algorithm. Even a simple function for adding two numbers is an algorithm in a sense, albeit a simple one.

Some algorithms, like those that compute the Fibonacci sequences, are intuitive and maybe innately embedded into our logical thinking and problem-solving skills. However, for most of us, complex algorithms are best studied so we can use them as building blocks for more efficient logical problem-solving in the future. In fact, you may be surprised to learn just how many complex algorithms people use every day when they check their e-mail or listen to music on their computers. This article will introduce some basic ideas related to the analysis of algorithms, and then put these into practice with a few examples illustrating why it is important to know about algorithms.

Explanation

An algorithm in mathematics is a procedure, a description of a set of steps that can be used to solve a mathematical computation: but they are much more common than that today. Algorithms are used in many branches of science (and everyday life for that matter), but perhaps the most common example is that step-by-step procedure used in long division.

The process of resolving a problem in such as "what is 73 divided by 3" could be described by the following algorithm:

  • How many times does 3 go into 7?
  • The answer is 2
  • How many are left over? 1
  • Put the 1(ten) in front of the 3.
  • How many times does 3 go into 13?
  • The answer is 4 with a remainder of one.
  • And of course, the answer is 24 with a remainder of 1.

The step by step procedure described above is called a long division algorithm.

Why Algorithms?

While the description above might sound a bit detailed and fussy, algorithms are all about finding efficient ways to do the math. As the anonymous mathematician says, 'Mathematicians are lazy so they are always looking for shortcuts.' Algorithms are for finding those shortcuts.

A baseline algorithm for multiplication, for example, might be simply adding the same number over and over again. So, 3,546 times 5 could be described in four steps:

  • How much is 3546 plus 3546? 7092
  • How much is 7092 plus 3546? 10638
  • How much is 10638 plus 3546? 14184
  • How much is 14184 plus 3546? 17730

Five times 3,546 is 17,730. But 3,546 multiplied by 654 would take 653 steps. Who wants to keep adding a number over and over again? There are a set of multiplication algorithms for that; the one you choose would depend on how large your number is. An algorithm is usually the most efficient (not always) way to do the math.

Common Algebraic Examples

FOIL (First, Outside, Inside, Last) is an algorithm used in algebra that is used in multiplying polynomials: the student remembers to solve a polynomial expression in the correct order:

To resolve (4x + 6)(x + 2), the FOIL algorithm would be:

  • Multiply the first terms in the parenthesis (4x times x = 4x2)
  • Multiply the two terms on the outside (4x times 2 = 8x)
  • Multiply the inside terms (6 times x = 6x)
  • Multiply the last terms (6 times 2 = 12)
  • Add all the results together to get 4x2 + 14x + 12)

BEDMAS (Brackets, Exponents, Division, Multiplication, Addition and Subtraction.) is another useful set of steps and is also considered a formula. The BEDMAS method refers to a way to order a set of mathematical operations.

Teaching Algorithms

Algorithms have an important place in any mathematics curriculum. Age-old strategies involve rote memorization of ancient algorithms; but modern teachers have also begun to develop curriculum over the years to effectively teach the idea of algorithms, that there are multiple ways of resolving complex issues by breaking them into a set of procedural steps. Allowing a child to creatively invent ways of resolving problems is known as developing algorithmic thinking.

When teachers watch students do their math, a great question to pose to them is "Can you think of a shorter way to do that?" Allowing children to create their own methods to resolve issues stretches their thinking and analytical skills.

Outside of Math

Learning how to operationalize procedures to make them more efficient is an important skill in many fields of endeavor. Computer science continually improves upon arithmetic and algebraic equations to make computers run more efficiently; but so do chefs, who continually improve their processes to make the best recipe for making a lentil soup or a pecan pie.

Other examples include online dating, where the user fills out a form about his or her preferences and characteristics, and an algorithm uses those choices to pick a perfect potential mate. Computer video games use algorithms to tell a story: the user makes a decision, and the computer bases the next steps on that decision. GPS systems use algorithms to balance readings from several satellites to identify your exact location and the best route for your SUV. Google uses an algorithm based on your searches to push appropriate advertising in your direction.

Some writers today are even calling the 21st century the Age of Algorithms. They are today a way to cope with the massive amounts of data we are generating daily.