TExcelTAD
Home › Discrete Mathematics › Strong Induction

Strong Induction

In ordinary induction the step from nn to n+1n + 1 may use only P(n)P(n). Strong induction lets the step use all earlier cases P(0),P(1),…,P(n)P(0), P(1), \ldots, P(n). This fits problems where the next case depends on cases further back: Fibonacci numbers, factorization into primes, and recursive algorithms that split a problem into unequal parts.

The principle

To prove ∀n∈N. P(n)\forall n \in \mathbb{N}.\ P(n):

  1. Base case(s): prove P(0)P(0) (and maybe a few more small cases).
  2. Inductive step: for every n≥0n \ge 0, prove that P(0)∧P(1)∧⋯∧P(n)P(0) \land P(1) \land \cdots \land P(n) implies P(n+1)P(n + 1).

Strong induction is not more powerful than ordinary induction (apply ordinary induction to Q(n)=P(0)∧⋯∧P(n)Q(n) = P(0) \land \cdots \land P(n)), but it is often more convenient.

Products of primes, again

Theorem. Every integer n≥2n \ge 2 is a product of primes.

Proof by strong induction. Assume every mm with 2≤m≤n2 \le m \le n is a product of primes, and consider n+1n + 1. If n+1n + 1 is prime, it is a product of one prime. Otherwise n+1=abn + 1 = ab with 2≤a,b≤n2 \le a, b \le n. By the hypothesis, aa and bb are products of primes, hence so is abab. ■\blacksquare

Ordinary induction would be awkward here: knowing that nn factors says nothing about n+1n + 1.

Making change

Theorem. Every amount of n≥12n \ge 12 cents can be paid with 4-cent and 5-cent coins.

Proof. Base cases: 12=4+4+412 = 4 + 4 + 4, 13=4+4+513 = 4 + 4 + 5, 14=4+5+514 = 4 + 5 + 5, 15=5+5+515 = 5 + 5 + 5. Step: for n+1≥16n + 1 \ge 16, the amount n+1−4=n−3≥12n + 1 - 4 = n - 3 \ge 12 can be paid by the hypothesis; add one 4-cent coin. ■\blacksquare

The step reaches back 4 cases, so it needs 4 base cases. The proof is again an algorithm:

python · try it yourself
def pay(n):
    """Coins of 4 and 5 adding to n >= 12, following the strong-induction proof."""
    base = {12: [4, 4, 4], 13: [4, 4, 5], 14: [4, 5, 5], 15: [5, 5, 5]}
    if n in base:
        return base[n]
    return pay(n - 4) + [4]

for n in [12, 17, 23, 30, 31]:
    coins = pay(n)
    print(n, "=", " + ".join(map(str, coins)), "  check:", sum(coins) == n)
cannot = [n for n in range(1, 12) if not any((n - 5 * k) % 4 == 0 for k in range(n // 5 + 1))]
print("amounts below 12 that cannot be paid:", cannot)
12 = 4 + 4 + 4   check: True
17 = 4 + 4 + 5 + 4   check: True
23 = 5 + 5 + 5 + 4 + 4   check: True
30 = 4 + 5 + 5 + 4 + 4 + 4 + 4   check: True
31 = 5 + 5 + 5 + 4 + 4 + 4 + 4   check: True
amounts below 12 that cannot be paid: [1, 2, 3, 6, 7, 11]

11 is the largest amount that cannot be paid (the Frobenius number of 4 and 5 is 4⋅5−4−5=114 \cdot 5 - 4 - 5 = 11).

Fibonacci bounds

The Fibonacci numbers are F0=0F_0 = 0, F1=1F_1 = 1, Fn+1=Fn+Fn−1F_{n+1} = F_n + F_{n-1}. Each term depends on the two before it, so strong induction is natural.

Theorem. Fn<2nF_n < 2^n for all n≥0n \ge 0.

Proof. Base: F0=0<1F_0 = 0 < 1, F1=1<2F_1 = 1 < 2. Step: for n+1≥2n + 1 \ge 2, Fn+1=Fn+Fn−1<2n+2n−1<2n+2n=2n+1F_{n+1} = F_n + F_{n-1} < 2^n + 2^{n-1} < 2^n + 2^n = 2^{n+1}. ■\blacksquare

A sharper bound with the same method: Fn≥φn−2F_n \ge \varphi^{n-2} for n≥1n \ge 1, where φ=1+52≈1.618\varphi = \frac{1 + \sqrt{5}}{2} \approx 1.618 satisfies φ2=φ+1\varphi^2 = \varphi + 1. So Fibonacci numbers grow exponentially, which is why the naive recursive fib takes exponential time.

python · try it yourself
phi = (1 + 5 ** 0.5) / 2
a, b = 0, 1
for n in range(1, 16):
    a, b = b, a + b          # now a = F_n
    if n % 3 == 0:
        print(f"n={n:2d}  F_n={a:4d}  phi^(n-2)={phi ** (n - 2):8.2f}  2^n={2 ** n:6d}")
n= 3  F_n=   2  phi^(n-2)=    1.62  2^n=     8
n= 6  F_n=   8  phi^(n-2)=    6.85  2^n=    64
n= 9  F_n=  34  phi^(n-2)=   29.03  2^n=   512
n=12  F_n= 144  phi^(n-2)=  122.99  2^n=  4096
n=15  F_n= 610  phi^(n-2)=  521.00  2^n= 32768

The unstacking game

Split a stack of nn boxes into two stacks of aa and bb boxes and score abab points; keep splitting until all stacks have one box. Every strategy scores exactly n(n−1)2\frac{n(n-1)}{2}. Strong induction: the first split scores abab, then the parts score a(a−1)2\frac{a(a-1)}{2} and b(b−1)2\frac{b(b-1)}{2} by the hypothesis (they are smaller than nn), and ab+a(a−1)2+b(b−1)2=(a+b)(a+b−1)2ab + \frac{a(a-1)}{2} + \frac{b(b-1)}{2} = \frac{(a+b)(a+b-1)}{2}. Exercise 3 checks it by computer.

In software

Divide-and-conquer algorithms (quicksort, merge sort, binary search on unequal halves) recurse on parts of some smaller size, not necessarily n−1n - 1. Their correctness proofs use strong induction: assume the algorithm is correct on all smaller inputs.

Exercises

Exercise 1: Stamps of 3 and 7

Prove that every amount n≥12n \ge 12 can be paid with 3-cent and 7-cent stamps.

Answer

Base cases 12, 13, 14; step: pay n−2n - 2 (that is, (n+1)−3(n + 1) - 3) and add a 3.

Solution

Base: 12=3⋅412 = 3 \cdot 4, 13=3⋅2+713 = 3 \cdot 2 + 7, 14=7⋅214 = 7 \cdot 2. Step: for n+1≥15n + 1 \ge 15, n+1−3≥12n + 1 - 3 \ge 12 is payable by the hypothesis; add a 3-cent stamp. Three base cases are needed because the step goes back 3. (11 is not payable: 11−7=411 - 7 = 4 and 11 are not multiples of 3.)

Exercise 2: Every positive integer is a sum of distinct powers of 2

Prove it by strong induction.

Answer

Take the largest power 2k≤n2^k \le n; n−2k<2kn - 2^k < 2^k is a sum of distinct smaller powers.

Solution

Base: 1=201 = 2^0. Step: let n≥2n \ge 2 and 2k≤n<2k+12^k \le n < 2^{k+1}. If n=2kn = 2^k we are done. Otherwise 0<n−2k<2k0 < n - 2^k < 2^k, so by the hypothesis n−2kn - 2^k is a sum of distinct powers of 2, all smaller than 2k2^k (since they sum to less than 2k2^k). Adding 2k2^k keeps them distinct. ■\blacksquare This is the existence of binary representation.

Exercise 3: Unstacking (code)

Play the unstacking game for n=10n = 10 with random splits several times and compare the score with n(n−1)2\frac{n(n-1)}{2}.

Answer

Every run scores 45.

Solution
python · try it yourself
import random

def play(n, rng):
    if n == 1:
        return 0
    a = rng.randint(1, n - 1)
    return a * (n - a) + play(a, rng) + play(n - a, rng)

rng = random.Random(3)
print([play(10, rng) for _ in range(6)], 10 * 9 // 2)
[45, 45, 45, 45, 45, 45] 45

Test yourself

What may the inductive step of strong induction assume?

  1. Only P(n)P(n)
  2. P(0),P(1),…,P(n)P(0), P(1), \ldots, P(n)
  3. P(n+1)P(n + 1)
  4. Nothing

A strong-induction step for P(n+1)P(n + 1) uses P(n−3)P(n - 3). How many base cases are needed?

  1. 1
  2. 2
  3. 4
  4. None

Is strong induction able to prove things that ordinary induction cannot?

  1. Yes, always
  2. No, they are equivalent in power
  3. Only for primes
  4. Only for infinite sets