Proof by induction, with worked proofs
Mathematical induction proves a statement for every natural number at once: show it holds for the first one, and show that whenever it holds for one number it holds for the next. Work through four proofs one step at a time, then find the flaw in a famous wrong one.
On this page
The principle
Let be a statement about a natural number , such as “”. To prove for all by induction, you prove two things:
- Base case: is true.
- Inductive step: for every , if is true, then is true. The assumption is called the inductive hypothesis.
Together these give , then , then , and so on, with no gaps. The usual picture is an infinite row of dominoes: the base case knocks over the first one, and the inductive step guarantees each falling domino knocks over the next.
Checking cases is not a proof
Before proving something it is worth testing it. The checker computes both sides of a few claims for the first values. The last claim is a warning: is prime for , then fails at , where it equals . However many cases you check, only a proof covers them all.
Four worked proofs
Each proof reveals one step at a time. Before revealing the next step, try to predict it.
Proof 1: the sum of the first n integers
Claim. For every , .
Base case, . The left side is 1; the right side is . They agree.
Inductive hypothesis. Fix some and assume .
Goal. Show .
Use the hypothesis. The first terms are exactly the hypothesis, so the left side is .
Simplify. , which is the goal.
Conclude. The base case holds and each case implies the next, so the formula holds for every . ∎
Proof 2: the sum of the first n odd numbers
Claim. For every , .
Base case, . .
Inductive hypothesis. Assume for some .
Inductive step. The next odd number is . Adding it to both sides gives . ∎
Picture. A square of dots grows to by adding an L-shaped border of dots. The algebra above is that picture.
Proof 3: a later base case, 2ⁿ > n² for n ≥ 5
Claim. For every , . (The checker shows it fails for , so the base case has to be 5.)
Base case, . .
Inductive hypothesis. Assume for some .
Use it. .
Compare with the goal. We need , that is, . Since , .
Chain them. . ∎ The inductive step needed ; the base case needed 5. Both conditions matter.
Proof 4: strong induction, every integer ≥ 2 is a product of primes
Claim. Every integer can be written as a product of one or more primes.
Why ordinary induction is awkward. Knowing that 11 is a product of primes says nothing useful about 12. But 12 = 3 × 4, and the factors are smaller numbers we would like to use.
Strong induction. In the inductive step, assume the claim for every integer from 2 up to , and prove it for . This is just as valid: the dominoes behind you have all fallen, not only the last one.
Base case, . 2 is prime, so it is a product of one prime.
Case 1: is prime. Then it is a product of one prime, itself.
Case 2: is composite. Then with . By the hypothesis both and are products of primes; putting the two products together writes as one. ∎
Spot the mistake
A broken proof: all horses are the same colour
“Claim.” In every set of horses, all the horses have the same colour.
Base case, . A set with one horse has only one colour in it. True.
Inductive step. Assume any horses share a colour. Take horses and line them up. The first share a colour, and so do the last .
The suspicious move. “The two groups overlap, so the colour is the same throughout.”
The flaw. When , the first group is horse 1 and the last group is horse 2. They don’t overlap at all, so nothing connects their colours. The step from 1 to 2 is false, and every later case depends on it.
The lesson. An inductive step must work for every , including the smallest. Always test the argument on the first step explicitly.
Writing an induction proof
- State precisely, and the starting value .
- Prove the base case by direct calculation.
- Write the inductive hypothesis out in full, with in place of .
- Write the goal, , in full too. Seeing both side by side usually shows how to get from one to the other.
- Point to the exact place where you use the hypothesis. If you never use it, you didn’t need induction, or something is wrong.
Induction in computer science
Recursion and induction are the same idea: a recursive function is correct if its base case is correct and each recursive case is correct assuming the smaller calls are. Loop invariants, like the one that proves binary search correct, are induction on the number of iterations. And structural induction proves facts about lists, trees and syntax by doing the base case for the smallest structures (the empty list, a leaf) and the inductive step for each way of building bigger ones.
References
- D. J. Velleman, How to Prove It: A Structured Approach, 3rd ed., Cambridge University Press, 2019. Chapter 6. doi:10.1017/9781108539890
- E. Lehman, F. T. Leighton and A. R. Meyer, Mathematics for Computer Science, MIT, 2017. Chapter 5.
- “Mathematical induction”, Wikipedia.