Mathwords logoReference LibraryMathwords

Algorithm

Algorithm

A set of instructions used to solve a problem or obtain a desired result. For example, the "shampoo algorithm" explains how to wash one's hair: wet hair, lather, rinse, repeat. Gaussian elimination is an algorithm for solving linear systems of equations.

Worked Example

Problem: Use the Euclidean algorithm to find the greatest common divisor (GCD) of 48 and 18.
Step 1: Divide the larger number by the smaller and find the remainder.
48=2×18+1248 = 2 \times 18 + 12
Step 2: Replace the larger number with the smaller, and the smaller with the remainder. Repeat.
18=1×12+618 = 1 \times 12 + 6
Step 3: Repeat again.
12=2×6+012 = 2 \times 6 + 0
Step 4: When the remainder is 0, the last nonzero remainder is the GCD.
Answer: The GCD of 48 and 18 is 6. The Euclidean algorithm gave us clear, repeatable steps that always reach a definite answer.

Why It Matters

Algorithms are the backbone of problem-solving in mathematics and computer science. Whenever you follow long division, factor a polynomial using a set procedure, or sort a list of numbers, you are executing an algorithm. Recognizing the algorithmic structure behind a method helps you apply it consistently, verify your work, and eventually design your own solution strategies.

Common Mistakes

Mistake: Confusing an algorithm with a single formula or equation.
Correction: A formula like the quadratic formula gives a direct computation, while an algorithm is a sequence of steps—possibly involving decisions and repetition—that leads to a result. An algorithm may use formulas within its steps, but the two concepts are distinct.

Related Terms