Logic
Mathematical Induction
Prove for n=1, then assume for n and prove for n+1 — covers all natural numbers
Mathematical induction proves a statement P(n) holds for all natural numbers n by two steps — base case (P(1) is true) and inductive step (if P(k) is true, then P(k+1) is true). Together they cover all n by domino effect. Foundational proof technique introduced by Pascal and Fermat in the 1600s, formalized by De Morgan in 1838. Used to prove formulas (sum of integers = n(n+1)/2), inequalities (Bernoulli's), recursive algorithms' correctness, and theorems across all areas of math.
- Two stepsBase case (n=1) + inductive step (n → n+1)
- Strong inductionAssume true for ALL k ≤ n; prove for n+1
- Well-ordering principleEquivalent to induction (every nonempty subset of ℕ has a min)
- Common formula1 + 2 + ... + n = n(n+1)/2 — proved by induction
- TermedDe Morgan, 1838 — "method of recurrent reasoning"
- LimitationOnly works for properties indexed by ℕ (or well-ordered sets)
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
The principle
To prove a statement P(n) holds for all natural numbers n ≥ n₀ (typically n₀ = 1):
- Base case — verify P(n₀) is true.
- Inductive step — assume P(k) is true for some k ≥ n₀ (the inductive hypothesis), and prove P(k+1) is true.
If both steps succeed, then P(n) is true for all n ≥ n₀.
The domino analogy
Imagine an infinite row of dominoes. Two facts together knock them all over:
- The first domino is pushed (base case).
- If the kth domino falls, it knocks the (k+1)th domino (inductive step).
Conclusion — all dominoes fall. The base case "starts" the chain; the inductive step "propagates" it.
Classic example — sum of first n integers
Claim — for all n ≥ 1, 1 + 2 + 3 + ... + n = n(n+1)/2.
Base case — n = 1: LHS = 1; RHS = 1·2/2 = 1. ✓
Inductive step — assume 1 + 2 + ... + k = k(k+1)/2 (inductive hypothesis). Show it holds for k+1:
1 + 2 + ... + k + (k+1) = k(k+1)/2 + (k+1) [by IH]
= (k+1)(k/2 + 1)
= (k+1)(k+2)/2 ✓
By induction, the formula holds for all n ≥ 1.
Strong induction
In strong induction, the inductive step assumes P(j) for ALL j with n₀ ≤ j ≤ k (not just j = k):
- Base case — P(n₀) true.
- Strong inductive step — assume P(j) for all n₀ ≤ j ≤ k; prove P(k+1).
Strong induction is equivalent in logical power to weak induction (any proof using one can be converted to the other) but is often more convenient when the proof of P(k+1) needs multiple prior cases — like recurrence relations or factorization arguments.
Common induction proofs
| Statement | Form | Type |
|---|---|---|
| 1 + 2 + ... + n = n(n+1)/2 | Sum formula | Weak |
| 1² + 2² + ... + n² = n(n+1)(2n+1)/6 | Sum formula | Weak |
| 2ⁿ > n for n ≥ 1 | Inequality | Weak |
| (1 + x)ⁿ ≥ 1 + nx for x ≥ −1, n ≥ 1 | Bernoulli's | Weak |
| n³ − n divisible by 6 | Divisibility | Weak |
| Every integer ≥ 2 has prime factorization | Existence | Strong |
| F(n) = Fibonacci closed form | Recurrence | Strong |
| Every chess position can reach a deterministic outcome | Game theory | Strong |
Well-ordering principle
Well-ordering principle — every nonempty subset of natural numbers has a smallest element.
This is logically equivalent to induction. Each can be proved from the other using ordinary logical principles. Proofs by contradiction often invoke well-ordering — "let n be the smallest counterexample."
Generalizes to any well-ordered set — a totally ordered set where every nonempty subset has a minimum. ℕ is well-ordered; ℝ is not (no smallest positive real). Transfinite induction extends to ordinals beyond ℕ.
Structural induction — beyond ℕ
For recursively-defined structures (trees, lists, formal expressions), structural induction generalizes the principle:
- Base case — prove for atomic structures (e.g., empty list, leaf node).
- Inductive step — assume for all "smaller" substructures; prove for the larger structure built from them.
Used to prove:
- Properties of recursive algorithms (e.g., merge sort always produces sorted output).
- Type system soundness in programming languages.
- Theorems about formal grammars and proof trees.
JavaScript — verifying induction-proven formulas
// Verify the formula 1 + 2 + ... + n = n(n+1)/2 numerically
function sumFirstN(n) {
let total = 0;
for (let i = 1; i <= n; i++) total += i;
return total;
}
function formulaSumN(n) {
return n * (n + 1) / 2;
}
for (let n = 1; n <= 100; n++) {
console.assert(sumFirstN(n) === formulaSumN(n), `Failed for n = ${n}`);
}
console.log('Sum formula verified for n = 1 to 100');
// Verify 1² + 2² + ... + n² = n(n+1)(2n+1)/6
function sumOfSquares(n) {
let total = 0;
for (let i = 1; i <= n; i++) total += i * i;
return total;
}
function formulaSquares(n) {
return n * (n + 1) * (2 * n + 1) / 6;
}
for (let n = 1; n <= 100; n++) {
console.assert(sumOfSquares(n) === formulaSquares(n));
}
console.log('Sum of squares formula verified');
// Strong induction example: prime factorization
function primeFactors(n) {
const factors = [];
for (let p = 2; p * p <= n; p++) {
while (n % p === 0) {
factors.push(p);
n /= p;
}
}
if (n > 1) factors.push(n);
return factors;
}
// FTA: every integer ≥ 2 has unique prime factorization
console.log(primeFactors(60)); // [2, 2, 3, 5]
console.log(primeFactors(2310)); // [2, 3, 5, 7, 11]
// Bernoulli's inequality: (1+x)ⁿ ≥ 1+nx for x ≥ -1, n ≥ 1
function checkBernoulli(x, n) {
return Math.pow(1 + x, n) >= 1 + n * x - 1e-10; // tolerance for FP
}
console.log(checkBernoulli(0.5, 10)); // true
console.log(checkBernoulli(-0.5, 5)); // true
console.log(checkBernoulli(2, 100)); // true
Where induction shows up
- Pure mathematics — proofs. Foundation for proofs by recurrence; many theorems in number theory, combinatorics, analysis.
- Algorithm correctness. Recursive algorithms (binary search, merge sort, dynamic programming) are proven correct via structural or numerical induction.
- Algorithm complexity. Solving recurrences (T(n) = 2T(n/2) + n → O(n log n)) often uses induction to verify.
- Programming language theory. Type systems, operational semantics, denotational semantics — all use structural induction over syntax/derivation trees.
- Combinatorics. Counting identities, partition theorems, Ramsey theory — proven via clever induction.
- Number theory. Prime factorization, divisibility properties, modular results often prove by strong induction.
- Computer science theory. Computability, complexity proofs, correctness of recursive data structures.
Common mistakes
- Forgetting the base case. Without the base case, the inductive step is meaningless — you've only shown the property is "self-propagating," not that it's true. Famous fallacy — "prove all horses are the same color" relies on missing or wrong base case.
- Wrong inductive hypothesis. Assume P(k) (single value), not "P(n) for all n" (which is what you're trying to prove). The hypothesis is one specific case used to prove the next.
- Inductive step missing the n+1 case. Some students prove P(k) implies P(k+2), or another offset. Only P(k) → P(k+1) covers everything (without gaps).
- Confusing induction with conjecture verification. Checking many cases (P(1), P(2), ..., P(100)) doesn't prove P(n) for all n. Induction needs the proof of "P(k) → P(k+1)" symbolically, not by checking values.
- Strong vs weak induction confusion. Weak — assume P(k); strong — assume P(1) through P(k). Use strong when the proof of P(k+1) genuinely needs earlier cases, not just k.
- Trying to use induction on real numbers. Standard induction works on ℕ or well-ordered sets. Reals don't have successors; you need different methods (continuity, limits) for real-valued statements.
Frequently asked questions
How does induction work, intuitively?
Like falling dominoes. (1) Knock over the first domino — base case. (2) Show — if any domino falls, the next one falls — inductive step. Conclusion — every domino falls. Base case proves P(1); inductive step proves "P(k) → P(k+1)." By domino chain, P(2), P(3), ..., P(n), ... all true. Covers all natural numbers without checking each individually.
What's the difference between weak and strong induction?
Weak induction — assume P(k); prove P(k+1). Strong induction — assume P(1), P(2), ..., P(k); prove P(k+1). Strong allows using ALL prior cases, not just the immediate predecessor. Equivalent in power (any strong-induction proof can be converted to weak), but strong is more convenient when proof requires multiple prior cases (e.g., Fibonacci recurrence, fundamental theorem of arithmetic).
What's the well-ordering principle?
Every nonempty subset of natural numbers has a smallest element. Equivalent to induction over ℕ. Often used in proofs by contradiction — "suppose some n violates P; let n be the smallest such; then P(n-1) is true, but contradicts inductive step." Well-ordering generalizes to any well-ordered set; transfinite induction extends to ordinals.
How do you prove the sum 1 + 2 + ... + n = n(n+1)/2?
Base case n = 1 — sum = 1 = 1·2/2 = 1. ✓ Inductive step — assume 1 + 2 + ... + k = k(k+1)/2. Then 1 + 2 + ... + k + (k+1) = k(k+1)/2 + (k+1) = (k+1)(k/2 + 1) = (k+1)(k+2)/2 ✓. Therefore true for all n by induction. Gauss famously computed this sum at age ~9.
When does induction fail or not apply?
When the property isn't indexed by natural numbers. Statements like "for all real x, ..." can't use direct induction (uncountably many cases, no successor). Statements about finite sets sometimes need set-induction. Other proof techniques — direct proof, contradiction, contrapositive, structural induction (for trees, graphs).
What's structural induction?
Generalization of induction to recursive structures — trees, lists, formal languages. Base case — for atomic structures (empty list, leaf node). Inductive step — assume property holds for substructures; prove for the whole. Used to prove correctness of recursive algorithms, type systems, programming language semantics.
What's a famous example of strong induction?
Fundamental theorem of arithmetic — every integer > 1 factors uniquely into primes. Proof by strong induction — assume every k between 2 and n-1 factors uniquely. Show n factors. If n is prime, done. If n = a·b composite, both a, b < n factor uniquely (by inductive hypothesis), so n's factorization is product of theirs. Need ALL smaller cases, not just n-1.